当前位置:   article > 正文

基于ssm+vue校园二手物品交易平台源码和论文_基于vue的校园二手交易平台系统国内外文献综述

基于vue的校园二手交易平台系统国内外文献综述

基于ssm+vue校园二手物品交易平台源码和论文144

 开发工具:idea 或eclipse
 数据库mysql5.7+
 数据库链接工具:navcat,小海豚等
  技术:ssm

摘  要

现代经济快节奏发展以及不断完善升级的信息化技术,让传统数据信息的管理升级为软件存储,归纳,集中处理数据信息的管理方式。本校园二手物品交易平台就是在这样的大环境下诞生,其可以帮助管理者在短时间内处理完毕庞大的数据信息,使用这种软件工具可以帮助管理人员提高事务处理效率,达到事半功倍的效果。此校园二手物品交易平台利用当下成熟完善的SSM框架,使用跨平台的可开发大型商业网站的Java语言,以及最受欢迎的RDBMS应用软件之一的Mysql数据库进行程序开发.校园二手物品交易平台的开发根据操作人员需要设计的界面简洁美观,在功能模块布局上跟同类型网站保持一致,程序在实现基本要求功能时,也为数据信息面临的安全问题提供了一些实用的解决方案。可以说该程序在帮助管理者高效率地处理工作事务的同时,也实现了数据信息的整体化,规范化与自动化。

关键词:校园二手物品交易平台;SSM框架;Mysql;自动化

  1. package com.controller;
  2. import java.text.SimpleDateFormat;
  3. import java.util.ArrayList;
  4. import java.util.Arrays;
  5. import java.util.Calendar;
  6. import java.util.Map;
  7. import java.util.HashMap;
  8. import java.util.Iterator;
  9. import java.util.Date;
  10. import java.util.List;
  11. import javax.servlet.http.HttpServletRequest;
  12. import com.utils.ValidatorUtils;
  13. import org.apache.commons.lang3.StringUtils;
  14. import org.springframework.beans.factory.annotation.Autowired;
  15. import org.springframework.web.bind.annotation.PathVariable;
  16. import org.springframework.web.bind.annotation.RequestBody;
  17. import org.springframework.web.bind.annotation.RequestMapping;
  18. import org.springframework.web.bind.annotation.RequestParam;
  19. import org.springframework.web.bind.annotation.RestController;
  20. import com.baomidou.mybatisplus.mapper.EntityWrapper;
  21. import com.baomidou.mybatisplus.mapper.Wrapper;
  22. import com.annotation.IgnoreAuth;
  23. import com.entity.ShangpinxinxiEntity;
  24. import com.entity.view.ShangpinxinxiView;
  25. import com.service.ShangpinxinxiService;
  26. import com.service.TokenService;
  27. import com.utils.PageUtils;
  28. import com.utils.R;
  29. import com.utils.MD5Util;
  30. import com.utils.MPUtil;
  31. import com.utils.CommonUtil;
  32. /**
  33. * 商品信息
  34. * 后端接口
  35. * @author
  36. * @email
  37. * @date 2023-09-01 17:42:09
  38. */
  39. @RestController
  40. @RequestMapping("/shangpinxinxi")
  41. public class ShangpinxinxiController {
  42. @Autowired
  43. private ShangpinxinxiService shangpinxinxiService;
  44. /**
  45. * 后端列表
  46. */
  47. @RequestMapping("/page")
  48. public R page(@RequestParam Map<String, Object> params,ShangpinxinxiEntity shangpinxinxi, HttpServletRequest request){
  49. String tableName = request.getSession().getAttribute("tableName").toString();
  50. if(tableName.equals("shangjia")) {
  51. shangpinxinxi.setZhanghao((String)request.getSession().getAttribute("username"));
  52. }
  53. EntityWrapper<ShangpinxinxiEntity> ew = new EntityWrapper<ShangpinxinxiEntity>();
  54. PageUtils page = shangpinxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, shangpinxinxi), params), params));
  55. return R.ok().put("data", page);
  56. }
  57. /**
  58. * 前端列表
  59. */
  60. @IgnoreAuth
  61. @RequestMapping("/list")
  62. public R list(@RequestParam Map<String, Object> params,ShangpinxinxiEntity shangpinxinxi, HttpServletRequest request){
  63. EntityWrapper<ShangpinxinxiEntity> ew = new EntityWrapper<ShangpinxinxiEntity>();
  64. PageUtils page = shangpinxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, shangpinxinxi), params), params));
  65. return R.ok().put("data", page);
  66. }
  67. /**
  68. * 列表
  69. */
  70. @RequestMapping("/lists")
  71. public R list( ShangpinxinxiEntity shangpinxinxi){
  72. EntityWrapper<ShangpinxinxiEntity> ew = new EntityWrapper<ShangpinxinxiEntity>();
  73. ew.allEq(MPUtil.allEQMapPre( shangpinxinxi, "shangpinxinxi"));
  74. return R.ok().put("data", shangpinxinxiService.selectListView(ew));
  75. }
  76. /**
  77. * 查询
  78. */
  79. @RequestMapping("/query")
  80. public R query(ShangpinxinxiEntity shangpinxinxi){
  81. EntityWrapper< ShangpinxinxiEntity> ew = new EntityWrapper< ShangpinxinxiEntity>();
  82. ew.allEq(MPUtil.allEQMapPre( shangpinxinxi, "shangpinxinxi"));
  83. ShangpinxinxiView shangpinxinxiView = shangpinxinxiService.selectView(ew);
  84. return R.ok("查询商品信息成功").put("data", shangpinxinxiView);
  85. }
  86. /**
  87. * 后端详情
  88. */
  89. @RequestMapping("/info/{id}")
  90. public R info(@PathVariable("id") Long id){
  91. ShangpinxinxiEntity shangpinxinxi = shangpinxinxiService.selectById(id);
  92. shangpinxinxi.setClicknum(shangpinxinxi.getClicknum()+1);
  93. shangpinxinxi.setClicktime(new Date());
  94. shangpinxinxiService.updateById(shangpinxinxi);
  95. return R.ok().put("data", shangpinxinxi);
  96. }
  97. /**
  98. * 前端详情
  99. */
  100. @RequestMapping("/detail/{id}")
  101. public R detail(@PathVariable("id") Long id){
  102. ShangpinxinxiEntity shangpinxinxi = shangpinxinxiService.selectById(id);
  103. shangpinxinxi.setClicknum(shangpinxinxi.getClicknum()+1);
  104. shangpinxinxi.setClicktime(new Date());
  105. shangpinxinxiService.updateById(shangpinxinxi);
  106. return R.ok().put("data", shangpinxinxi);
  107. }
  108. /**
  109. * 后端保存
  110. */
  111. @RequestMapping("/save")
  112. public R save(@RequestBody ShangpinxinxiEntity shangpinxinxi, HttpServletRequest request){
  113. shangpinxinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
  114. //ValidatorUtils.validateEntity(shangpinxinxi);
  115. shangpinxinxiService.insert(shangpinxinxi);
  116. return R.ok();
  117. }
  118. /**
  119. * 前端保存
  120. */
  121. @RequestMapping("/add")
  122. public R add(@RequestBody ShangpinxinxiEntity shangpinxinxi, HttpServletRequest request){
  123. shangpinxinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
  124. //ValidatorUtils.validateEntity(shangpinxinxi);
  125. shangpinxinxiService.insert(shangpinxinxi);
  126. return R.ok();
  127. }
  128. /**
  129. * 修改
  130. */
  131. @RequestMapping("/update")
  132. public R update(@RequestBody ShangpinxinxiEntity shangpinxinxi, HttpServletRequest request){
  133. //ValidatorUtils.validateEntity(shangpinxinxi);
  134. shangpinxinxiService.updateById(shangpinxinxi);//全部更新
  135. return R.ok();
  136. }
  137. /**
  138. * 删除
  139. */
  140. @RequestMapping("/delete")
  141. public R delete(@RequestBody Long[] ids){
  142. shangpinxinxiService.deleteBatchIds(Arrays.asList(ids));
  143. return R.ok();
  144. }
  145. /**
  146. * 提醒接口
  147. */
  148. @RequestMapping("/remind/{columnName}/{type}")
  149. public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
  150. @PathVariable("type") String type,@RequestParam Map<String, Object> map) {
  151. map.put("column", columnName);
  152. map.put("type", type);
  153. if(type.equals("2")) {
  154. SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  155. Calendar c = Calendar.getInstance();
  156. Date remindStartDate = null;
  157. Date remindEndDate = null;
  158. if(map.get("remindstart")!=null) {
  159. Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
  160. c.setTime(new Date());
  161. c.add(Calendar.DAY_OF_MONTH,remindStart);
  162. remindStartDate = c.getTime();
  163. map.put("remindstart", sdf.format(remindStartDate));
  164. }
  165. if(map.get("remindend")!=null) {
  166. Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
  167. c.setTime(new Date());
  168. c.add(Calendar.DAY_OF_MONTH,remindEnd);
  169. remindEndDate = c.getTime();
  170. map.put("remindend", sdf.format(remindEndDate));
  171. }
  172. }
  173. Wrapper<ShangpinxinxiEntity> wrapper = new EntityWrapper<ShangpinxinxiEntity>();
  174. if(map.get("remindstart")!=null) {
  175. wrapper.ge(columnName, map.get("remindstart"));
  176. }
  177. if(map.get("remindend")!=null) {
  178. wrapper.le(columnName, map.get("remindend"));
  179. }
  180. String tableName = request.getSession().getAttribute("tableName").toString();
  181. if(tableName.equals("shangjia")) {
  182. wrapper.eq("zhanghao", (String)request.getSession().getAttribute("username"));
  183. }
  184. int count = shangpinxinxiService.selectCount(wrapper);
  185. return R.ok().put("count", count);
  186. }
  187. /**
  188. * 前端智能排序
  189. */
  190. @IgnoreAuth
  191. @RequestMapping("/autoSort")
  192. public R autoSort(@RequestParam Map<String, Object> params,ShangpinxinxiEntity shangpinxinxi, HttpServletRequest request,String pre){
  193. EntityWrapper<ShangpinxinxiEntity> ew = new EntityWrapper<ShangpinxinxiEntity>();
  194. Map<String, Object> newMap = new HashMap<String, Object>();
  195. Map<String, Object> param = new HashMap<String, Object>();
  196. Iterator<Map.Entry<String, Object>> it = param.entrySet().iterator();
  197. while (it.hasNext()) {
  198. Map.Entry<String, Object> entry = it.next();
  199. String key = entry.getKey();
  200. String newKey = entry.getKey();
  201. if (pre.endsWith(".")) {
  202. newMap.put(pre + newKey, entry.getValue());
  203. } else if (StringUtils.isEmpty(pre)) {
  204. newMap.put(newKey, entry.getValue());
  205. } else {
  206. newMap.put(pre + "." + newKey, entry.getValue());
  207. }
  208. }
  209. params.put("sort", "clicknum");
  210. params.put("order", "desc");
  211. PageUtils page = shangpinxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, shangpinxinxi), params), params));
  212. return R.ok().put("data", page);
  213. }
  214. }
  1. package com.controller;
  2. import java.io.File;
  3. import java.io.FileNotFoundException;
  4. import java.io.IOException;
  5. import java.text.SimpleDateFormat;
  6. import java.util.ArrayList;
  7. import java.util.Calendar;
  8. import java.util.Date;
  9. import java.util.HashMap;
  10. import java.util.List;
  11. import java.util.Map;
  12. import javax.servlet.http.HttpServletRequest;
  13. import org.apache.commons.lang3.StringUtils;
  14. import org.json.JSONObject;
  15. import org.slf4j.Logger;
  16. import org.slf4j.LoggerFactory;
  17. import org.springframework.beans.factory.annotation.Autowired;
  18. import org.springframework.util.ResourceUtils;
  19. import org.springframework.web.bind.annotation.PathVariable;
  20. import org.springframework.web.bind.annotation.RequestBody;
  21. import org.springframework.web.bind.annotation.RequestMapping;
  22. import org.springframework.web.bind.annotation.RequestParam;
  23. import org.springframework.web.bind.annotation.RestController;
  24. import com.annotation.IgnoreAuth;
  25. import com.baidu.aip.face.AipFace;
  26. import com.baidu.aip.face.MatchRequest;
  27. import com.baidu.aip.util.Base64Util;
  28. import com.baomidou.mybatisplus.mapper.EntityWrapper;
  29. import com.baomidou.mybatisplus.mapper.Wrapper;
  30. import com.entity.ConfigEntity;
  31. import com.service.CommonService;
  32. import com.service.ConfigService;
  33. import com.utils.BaiduUtil;
  34. import com.utils.FileUtil;
  35. import com.utils.R;
  36. /**
  37. * 通用接口
  38. */
  39. @RestController
  40. public class CommonController{
  41. private static final Logger logger = LoggerFactory.getLogger(CommonController.class);
  42. @Autowired
  43. private CommonService commonService;
  44. @Autowired
  45. private ConfigService configService;
  46. private static AipFace client = null;
  47. private static String BAIDU_DITU_AK = null;
  48. @RequestMapping("/location")
  49. public R location(String lng,String lat) {
  50. if(BAIDU_DITU_AK==null) {
  51. BAIDU_DITU_AK = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "baidu_ditu_ak")).getValue();
  52. if(BAIDU_DITU_AK==null) {
  53. return R.error("请在配置管理中正确配置baidu_ditu_ak");
  54. }
  55. }
  56. Map<String, String> map = BaiduUtil.getCityByLonLat(BAIDU_DITU_AK, lng, lat);
  57. return R.ok().put("data", map);
  58. }
  59. /**
  60. * 人脸比对
  61. *
  62. * @param face1 人脸1
  63. * @param face2 人脸2
  64. * @return
  65. */
  66. @RequestMapping("/matchFace")
  67. public R matchFace(String face1, String face2, HttpServletRequest request) {
  68. if(client==null) {
  69. /*String AppID = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "AppID")).getValue();*/
  70. String APIKey = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "APIKey")).getValue();
  71. String SecretKey = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "SecretKey")).getValue();
  72. String token = BaiduUtil.getAuth(APIKey, SecretKey);
  73. if(token==null) {
  74. return R.error("请在配置管理中正确配置APIKey和SecretKey");
  75. }
  76. client = new AipFace(null, APIKey, SecretKey);
  77. client.setConnectionTimeoutInMillis(2000);
  78. client.setSocketTimeoutInMillis(60000);
  79. }
  80. JSONObject res = null;
  81. try {
  82. File file1 = new File(request.getSession().getServletContext().getRealPath("/upload")+"/"+face1);
  83. File file2 = new File(request.getSession().getServletContext().getRealPath("/upload")+"/"+face2);
  84. String img1 = Base64Util.encode(FileUtil.FileToByte(file1));
  85. String img2 = Base64Util.encode(FileUtil.FileToByte(file2));
  86. MatchRequest req1 = new MatchRequest(img1, "BASE64");
  87. MatchRequest req2 = new MatchRequest(img2, "BASE64");
  88. ArrayList<MatchRequest> requests = new ArrayList<MatchRequest>();
  89. requests.add(req1);
  90. requests.add(req2);
  91. res = client.match(requests);
  92. System.out.println(res.get("result"));
  93. } catch (FileNotFoundException e) {
  94. e.printStackTrace();
  95. return R.error("文件不存在");
  96. } catch (IOException e) {
  97. e.printStackTrace();
  98. }
  99. return R.ok().put("data", com.alibaba.fastjson.JSONObject.parse(res.get("result").toString()));
  100. }
  101. /**
  102. * 获取table表中的column列表(联动接口)
  103. * @return
  104. */
  105. @RequestMapping("/option/{tableName}/{columnName}")
  106. @IgnoreAuth
  107. public R getOption(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName,String level,String parent) {
  108. Map<String, Object> params = new HashMap<String, Object>();
  109. params.put("table", tableName);
  110. params.put("column", columnName);
  111. if(StringUtils.isNotBlank(level)) {
  112. params.put("level", level);
  113. }
  114. if(StringUtils.isNotBlank(parent)) {
  115. params.put("parent", parent);
  116. }
  117. List<String> data = commonService.getOption(params);
  118. return R.ok().put("data", data);
  119. }
  120. /**
  121. * 根据table中的column获取单条记录
  122. * @return
  123. */
  124. @RequestMapping("/follow/{tableName}/{columnName}")
  125. @IgnoreAuth
  126. public R getFollowByOption(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName, @RequestParam String columnValue) {
  127. Map<String, Object> params = new HashMap<String, Object>();
  128. params.put("table", tableName);
  129. params.put("column", columnName);
  130. params.put("columnValue", columnValue);
  131. Map<String, Object> result = commonService.getFollowByOption(params);
  132. return R.ok().put("data", result);
  133. }
  134. /**
  135. * 修改table表的sfsh状态
  136. * @param map
  137. * @return
  138. */
  139. @RequestMapping("/sh/{tableName}")
  140. public R sh(@PathVariable("tableName") String tableName, @RequestBody Map<String, Object> map) {
  141. map.put("table", tableName);
  142. commonService.sh(map);
  143. return R.ok();
  144. }
  145. /**
  146. * 获取需要提醒的记录数
  147. * @param tableName
  148. * @param columnName
  149. * @param type 1:数字 2:日期
  150. * @param map
  151. * @return
  152. */
  153. @RequestMapping("/remind/{tableName}/{columnName}/{type}")
  154. @IgnoreAuth
  155. public R remindCount(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName,
  156. @PathVariable("type") String type,@RequestParam Map<String, Object> map) {
  157. map.put("table", tableName);
  158. map.put("column", columnName);
  159. map.put("type", type);
  160. if(type.equals("2")) {
  161. SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  162. Calendar c = Calendar.getInstance();
  163. Date remindStartDate = null;
  164. Date remindEndDate = null;
  165. if(map.get("remindstart")!=null) {
  166. Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
  167. c.setTime(new Date());
  168. c.add(Calendar.DAY_OF_MONTH,remindStart);
  169. remindStartDate = c.getTime();
  170. map.put("remindstart", sdf.format(remindStartDate));
  171. }
  172. if(map.get("remindend")!=null) {
  173. Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
  174. c.setTime(new Date());
  175. c.add(Calendar.DAY_OF_MONTH,remindEnd);
  176. remindEndDate = c.getTime();
  177. map.put("remindend", sdf.format(remindEndDate));
  178. }
  179. }
  180. int count = commonService.remindCount(map);
  181. return R.ok().put("count", count);
  182. }
  183. /**
  184. * 圖表统计
  185. */
  186. @IgnoreAuth
  187. @RequestMapping("/group/{tableName}")
  188. public R group1(@PathVariable("tableName") String tableName, @RequestParam Map<String,Object> params) {
  189. params.put("table1", tableName);
  190. List<Map<String, Object>> result = commonService.chartBoth(params);
  191. return R.ok().put("data", result);
  192. }
  193. /**
  194. * 单列求和
  195. */
  196. @RequestMapping("/cal/{tableName}/{columnName}")
  197. @IgnoreAuth
  198. public R cal(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName) {
  199. Map<String, Object> params = new HashMap<String, Object>();
  200. params.put("table", tableName);
  201. params.put("column", columnName);
  202. Map<String, Object> result = commonService.selectCal(params);
  203. return R.ok().put("data", result);
  204. }
  205. /**
  206. * 分组统计
  207. */
  208. @RequestMapping("/group/{tableName}/{columnName}")
  209. @IgnoreAuth
  210. public R group(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName) {
  211. Map<String, Object> params = new HashMap<String, Object>();
  212. params.put("table", tableName);
  213. params.put("column", columnName);
  214. List<Map<String, Object>> result = commonService.selectGroup(params);
  215. return R.ok().put("data", result);
  216. }
  217. /**
  218. * (按值统计)
  219. */
  220. @RequestMapping("/value/{tableName}/{xColumnName}/{yColumnName}")
  221. @IgnoreAuth
  222. public R value(@PathVariable("tableName") String tableName, @PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName) {
  223. Map<String, Object> params = new HashMap<String, Object>();
  224. params.put("table", tableName);
  225. params.put("xColumn", xColumnName);
  226. params.put("yColumn", yColumnName);
  227. List<Map<String, Object>> result = commonService.selectValue(params);
  228. return R.ok().put("data", result);
  229. }
  230. /**
  231. * 下面为新加的
  232. *
  233. *
  234. *
  235. */
  236. /**
  237. * 分组求和
  238. */
  239. @RequestMapping("/sum/group")
  240. @IgnoreAuth
  241. public R newSelectGroupSum(/*@PathVariable("tableName") String tableName, @PathVariable("groupColumn") String groupColumn, @PathVariable("sumCloum") String sumCloum*/) {
  242. // logger.debug("newSelectGroupSum:,,Controller:{},,tableName:{},groupColumn:{},sumCloum:{}",this.getClass().getName(),tableName,groupColumn,sumCloum);
  243. logger.debug("newSelectGroupSum");
  244. Map<String, Object> params = new HashMap<String, Object>();
  245. // params.put("tableName", tableName);
  246. // params.put("groupColumn", groupColumn);
  247. // params.put("sumColumn", sumCloum);
  248. List<Map<String, Object>> result = commonService.newSelectGroupSum(params);
  249. return R.ok().put("data", result);
  250. }
  251. /**
  252. * 查询字典表的分组统计总条数
  253. * @param tableName 表名
  254. * @param groupColumn 分组字段
  255. * @return
  256. */
  257. @RequestMapping("/count/group/{tableName}/{groupColumn}")
  258. @IgnoreAuth
  259. public R newSelectGroupCount(@PathVariable("tableName") String tableName, @PathVariable("groupColumn") String groupColumn) {
  260. logger.debug("newSelectGroupCount:,,Controller:{},,tableName:{},groupColumn:{}",this.getClass().getName(),tableName,groupColumn);
  261. Map<String, Object> params = new HashMap<String, Object>();
  262. params.put("tableName", tableName);
  263. params.put("groupColumn", groupColumn);
  264. List<Map<String, Object>> result = commonService.newSelectGroupCount(params);
  265. return R.ok().put("data", result);
  266. }
  267. /**
  268. * 当前表的日期分组求和
  269. * @param tableName 表名
  270. * @param groupColumn 分组字段
  271. * @param sumCloum 统计字段
  272. * @param dateFormatType 日期格式化类型 1:年 2:月 3:日
  273. * @return
  274. */
  275. @RequestMapping("/sum/group/{tableName}/{groupColumn}/{sumCloum}/{dateFormatType}")
  276. @IgnoreAuth
  277. public R newSelectDateGroupSum(@PathVariable("tableName") String tableName, @PathVariable("groupColumn") String groupColumn, @PathVariable("sumCloum") String sumCloum, @PathVariable("dateFormatType") String dateFormatType) {
  278. logger.debug("newSelectDateGroupSum:,,Controller:{},,tableName:{},groupColumn:{},sumCloum:{},dateFormatType:{}",this.getClass().getName(),tableName,groupColumn,sumCloum,dateFormatType);
  279. Map<String, Object> params = new HashMap<String, Object>();
  280. params.put("tableName", tableName);
  281. params.put("groupColumn", groupColumn);
  282. params.put("sumColumn", sumCloum);
  283. if("1".equals(dateFormatType)){
  284. params.put("dateFormat", "%Y");
  285. }else if("2".equals(dateFormatType)){
  286. params.put("dateFormat", "%Y-%m");
  287. }else if("3".equals(dateFormatType)){
  288. params.put("dateFormat", "%Y-%m-%d");
  289. }else{
  290. R.error("日期格式化不正确");
  291. }
  292. List<Map<String, Object>> result = commonService.newSelectDateGroupSum(params);
  293. return R.ok().put("data", result);
  294. }
  295. /**
  296. *
  297. * 查询字典表的分组统计总条数
  298. * @param tableName 表名
  299. * @param groupColumn 分组字段
  300. * @param dateFormatType 日期格式化类型 1:年 2:月 3:日
  301. * @return
  302. */
  303. @RequestMapping("/count/group/{tableName}/{groupColumn}/{dateFormatType}")
  304. @IgnoreAuth
  305. public R newSelectDateGroupCount(@PathVariable("tableName") String tableName, @PathVariable("groupColumn") String groupColumn, @PathVariable("dateFormatType") String dateFormatType) {
  306. logger.debug("newSelectDateGroupCount:,,Controller:{},,tableName:{},groupColumn:{},dateFormatType:{}",this.getClass().getName(),tableName,groupColumn,dateFormatType);
  307. Map<String, Object> params = new HashMap<String, Object>();
  308. params.put("tableName", tableName);
  309. params.put("groupColumn", groupColumn);
  310. if("1".equals(dateFormatType)){
  311. params.put("dateFormat", "%Y");
  312. }else if("2".equals(dateFormatType)){
  313. params.put("dateFormat", "%Y-%m");
  314. }else if("3".equals(dateFormatType)){
  315. params.put("dateFormat", "%Y-%m-%d");
  316. }else{
  317. R.error("日期格式化类型不正确");
  318. }
  319. List<Map<String, Object>> result = commonService.newSelectDateGroupCount(params);
  320. return R.ok().put("data", result);
  321. }
  322. /**
  323. * 字段加数字
  324. * @param tableName 表名
  325. * @param id id
  326. * @param column 字段
  327. * @param number 数量
  328. * @return
  329. */
  330. @RequestMapping("/plus/{tableName}/{id}/{column}/{number}")
  331. public R plusCloumNumber(@PathVariable("tableName") String tableName, @PathVariable("id") Integer id, @PathVariable("column") String column, @PathVariable("number") String number) {
  332. logger.debug("plusCloumNumber:,,Controller:{},,tableName:{},id:{},column:{},number:{}",this.getClass().getName(),tableName,id,column,number);
  333. Map<String, Object> params = new HashMap<String, Object>();
  334. params.put("tableName", tableName);
  335. params.put("id", id);
  336. params.put("column", column);
  337. params.put("number", number);
  338. int i = commonService.plusCloumNumber(params);
  339. if(i>0){
  340. return R.ok();
  341. }
  342. return R.error("添加失败");
  343. }
  344. /**
  345. * 字段减数字
  346. * @param tableName
  347. * @param id
  348. * @param column
  349. * @param number
  350. * @return
  351. */
  352. @RequestMapping("/reduce/{tableName}/{id}/{column}/{number}")
  353. public R reduceCloumNumber(@PathVariable("tableName") String tableName, @PathVariable("id") Integer id, @PathVariable("column") String column, @PathVariable("number") String number) {
  354. logger.debug("reduceCloumNumber:,,Controller:{},,tableName:{},id:{},column:{},number:{}",this.getClass().getName(),tableName,id,column,number);
  355. Map<String, Object> params = new HashMap<String, Object>();
  356. params.put("tableName", tableName);
  357. params.put("id", id);
  358. params.put("column", column);
  359. params.put("number", number);
  360. int i = commonService.reduceCloumNumber(params);
  361. if(i>0){
  362. return R.ok();
  363. }
  364. return R.error("添加失败");
  365. }
  366. @RequestMapping("/update/{tableName}/{id}/{column}/{value}")
  367. public R updateCloumValue(@PathVariable("tableName") String tableName, @PathVariable("id") Integer id, @PathVariable("column") String column, @PathVariable("value") String value) {
  368. logger.debug("updateCloumValue:,,Controller:{},,tableName:{},id:{},column:{},number:{}",this.getClass().getName(),tableName,id,column,value);
  369. Map<String, Object> params = new HashMap<String, Object>();
  370. params.put("tableName", tableName);
  371. params.put("id", id);
  372. params.put("column", column);
  373. params.put("value", value);
  374. int i = commonService.updateCloumValue(params);
  375. if(i>0){
  376. return R.ok();
  377. }
  378. return R.error("添加失败");
  379. }
  380. }

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小小林熬夜学编程/article/detail/205076?site
推荐阅读
相关标签
  

闽ICP备14008679号