校园失物招领系统带万字文档java项目失物招领管理系统java课程设计java毕业设计springboot vue

文章目录

  • 校园失物招领系统
    • 一、项目演示
    • 二、项目介绍
    • 三、万字字项目文档
    • 四、部分功能截图
    • 五、部分代码展示
    • 六、底部获取项目源码带万字文档(9.9¥带走)

校园失物招领系统

一、项目演示

校园失物招领系统

二、项目介绍

语言: Java 数据库:MySQL

技术栈 : SpringBoot+MybatisPlus+Vue+Html

系统角色:管理员、用户

管理员:管理员:登录、基础数据管理、系统管理、留言板管理、失物信息管理、失物认领管理、寻物启事管理等功能

用户:登录、注册、留言板、公告信息、失物招领、失物认领、寻物启事、个人中心、我发布的失物信息、我的失物认领、我发布的寻物启事、寻物启事留言等功能

三、万字字项目文档

在这里插入图片描述

在这里插入图片描述

四、部分功能截图

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

五、部分代码展示


package com.controller;import java.io.File;
import java.math.BigDecimal;
import java.net.URL;
import java.text.SimpleDateFormat;
import com.alibaba.fastjson.JSONObject;
import java.util.*;
import org.springframework.beans.BeanUtils;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.context.ContextLoader;
import javax.servlet.ServletContext;
import com.service.TokenService;
import com.utils.*;
import java.lang.reflect.InvocationTargetException;import com.service.DictionaryService;
import org.apache.commons.lang3.StringUtils;
import com.annotation.IgnoreAuth;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.entity.*;
import com.entity.view.*;
import com.service.*;
import com.utils.PageUtils;
import com.utils.R;
import com.alibaba.fastjson.*;/*** 操作日志* 后端接口* @author* @email
*/
@RestController
@Controller
@RequestMapping("/caozuorizhi")
public class CaozuorizhiController {private static final Logger logger = LoggerFactory.getLogger(CaozuorizhiController.class);private static final String TABLE_NAME = "caozuorizhi";@Autowiredprivate CaozuorizhiService caozuorizhiService;@Autowiredprivate TokenService tokenService;@Autowiredprivate DictionaryService dictionaryService;//字典@Autowiredprivate LiuyanService liuyanService;//留言板@Autowiredprivate NewsService newsService;//公告信息@Autowiredprivate ShiwuzhaolingService shiwuzhaolingService;//失物信息@Autowiredprivate ShiwuzhaolingYuyueService shiwuzhaolingYuyueService;//失物认领@Autowiredprivate XunwuqishiService xunwuqishiService;//寻物启事@Autowiredprivate XunwuqishiLiuyanService xunwuqishiLiuyanService;//寻物启事留言@Autowiredprivate YonghuService yonghuService;//用户@Autowiredprivate UsersService usersService;//管理员/*** 后端列表*/@RequestMapping("/page")public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));String role = String.valueOf(request.getSession().getAttribute("role"));if(false)return R.error(511,"永不会进入");else if("用户".equals(role))params.put("yonghuId",request.getSession().getAttribute("userId"));CommonUtil.checkMap(params);PageUtils page = caozuorizhiService.queryPage(params);//字典表数据转换List<CaozuorizhiView> list =(List<CaozuorizhiView>)page.getList();for(CaozuorizhiView c:list){//修改对应字典表字段dictionaryService.dictionaryConvert(c, request);}return R.ok().put("data", page);}/*** 后端详情*/@RequestMapping("/info/{id}")public R info(@PathVariable("id") Long id, HttpServletRequest request){logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);CaozuorizhiEntity caozuorizhi = caozuorizhiService.selectById(id);if(caozuorizhi !=null){//entity转viewCaozuorizhiView view = new CaozuorizhiView();BeanUtils.copyProperties( caozuorizhi , view );//把实体数据重构到view中//修改对应字典表字段dictionaryService.dictionaryConvert(view, request);return R.ok().put("data", view);}else {return R.error(511,"查不到数据");}}/*** 后端保存*/@RequestMapping("/save")public R save(@RequestBody CaozuorizhiEntity caozuorizhi, HttpServletRequest request){logger.debug("save方法:,,Controller:{},,caozuorizhi:{}",this.getClass().getName(),caozuorizhi.toString());String role = String.valueOf(request.getSession().getAttribute("role"));if(false)return R.error(511,"永远不会进入");Wrapper<CaozuorizhiEntity> queryWrapper = new EntityWrapper<CaozuorizhiEntity>().eq("caozuorizhi_this_biao", caozuorizhi.getCaozuorizhiThisBiao()).eq("caozuorizhi_caozuobiao", caozuorizhi.getCaozuorizhiCaozuobiao()).eq("caozuorizhi_caozuozhanghu", caozuorizhi.getCaozuorizhiCaozuozhanghu()).eq("caozuorizhi_caozuoleixing", caozuorizhi.getCaozuorizhiCaozuoleixing());logger.info("sql语句:"+queryWrapper.getSqlSegment());CaozuorizhiEntity caozuorizhiEntity = caozuorizhiService.selectOne(queryWrapper);if(caozuorizhiEntity==null){caozuorizhi.setInsertTime(new Date());caozuorizhi.setCreateTime(new Date());caozuorizhiService.insert(caozuorizhi);return R.ok();}else {return R.error(511,"表中有相同数据");}}/*** 后端修改*/@RequestMapping("/update")public R update(@RequestBody CaozuorizhiEntity caozuorizhi, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {logger.debug("update方法:,,Controller:{},,caozuorizhi:{}",this.getClass().getName(),caozuorizhi.toString());CaozuorizhiEntity oldCaozuorizhiEntity = caozuorizhiService.selectById(caozuorizhi.getId());//查询原先数据String role = String.valueOf(request.getSession().getAttribute("role"));
//        if(false)
//            return R.error(511,"永远不会进入");caozuorizhiService.updateById(caozuorizhi);//根据id更新return R.ok();}/*** 删除*/@RequestMapping("/delete")public R delete(@RequestBody Integer[] ids, HttpServletRequest request){logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());List<CaozuorizhiEntity> oldCaozuorizhiList =caozuorizhiService.selectBatchIds(Arrays.asList(ids));//要删除的数据caozuorizhiService.deleteBatchIds(Arrays.asList(ids));return R.ok();}/*** 批量上传*/@RequestMapping("/batchInsert")public R save( String fileName, HttpServletRequest request){logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);Integer yonghuId = Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId")));SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//.eq("time", new SimpleDateFormat("yyyy-MM-dd").format(new Date()))try {List<CaozuorizhiEntity> caozuorizhiList = new ArrayList<>();//上传的东西Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段Date date = new Date();int lastIndexOf = fileName.lastIndexOf(".");if(lastIndexOf == -1){return R.error(511,"该文件没有后缀");}else{String suffix = fileName.substring(lastIndexOf);if(!".xls".equals(suffix)){return R.error(511,"只支持后缀为xls的excel文件");}else{URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);//获取文件路径File file = new File(resource.getFile());if(!file.exists()){return R.error(511,"找不到上传文件,请联系管理员");}else{List<List<String>> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件dataList.remove(0);//删除第一行,因为第一行是提示for(List<String> data:dataList){//循环CaozuorizhiEntity caozuorizhiEntity = new CaozuorizhiEntity();
//                            caozuorizhiEntity.setCaozuorizhiThisBiao(data.get(0));                    //操作人所在表 要改的
//                            caozuorizhiEntity.setCaozuorizhiCaozuobiao(data.get(0));                    //操作表 要改的
//                            caozuorizhiEntity.setCaozuorizhiCaozuozhanghu(data.get(0));                    //操作账户 要改的
//                            caozuorizhiEntity.setCaozuorizhiCaozuoleixing(data.get(0));                    //操作类型 要改的
//                            caozuorizhiEntity.setCaozuorizhiText(data.get(0));                    //操作内容 要改的
//                            caozuorizhiEntity.setInsertTime(date);//时间
//                            caozuorizhiEntity.setCreateTime(date);//时间caozuorizhiList.add(caozuorizhiEntity);//把要查询是否重复的字段放入map中}//查询是否重复caozuorizhiService.insertBatch(caozuorizhiList);return R.ok();}}}}catch (Exception e){e.printStackTrace();return R.error(511,"批量插入数据异常,请联系管理员");}}/*** 前端列表*/@IgnoreAuth@RequestMapping("/list")public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));CommonUtil.checkMap(params);PageUtils page = caozuorizhiService.queryPage(params);//字典表数据转换List<CaozuorizhiView> list =(List<CaozuorizhiView>)page.getList();for(CaozuorizhiView c:list)dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段return R.ok().put("data", page);}/*** 前端详情*/@RequestMapping("/detail/{id}")public R detail(@PathVariable("id") Long id, HttpServletRequest request){logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);CaozuorizhiEntity caozuorizhi = caozuorizhiService.selectById(id);if(caozuorizhi !=null){//entity转viewCaozuorizhiView view = new CaozuorizhiView();BeanUtils.copyProperties( caozuorizhi , view );//把实体数据重构到view中//修改对应字典表字段dictionaryService.dictionaryConvert(view, request);return R.ok().put("data", view);}else {return R.error(511,"查不到数据");}}/*** 前端保存*/@RequestMapping("/add")public R add(@RequestBody CaozuorizhiEntity caozuorizhi, HttpServletRequest request){logger.debug("add方法:,,Controller:{},,caozuorizhi:{}",this.getClass().getName(),caozuorizhi.toString());Wrapper<CaozuorizhiEntity> queryWrapper = new EntityWrapper<CaozuorizhiEntity>().eq("caozuorizhi_this_biao", caozuorizhi.getCaozuorizhiThisBiao()).eq("caozuorizhi_caozuobiao", caozuorizhi.getCaozuorizhiCaozuobiao()).eq("caozuorizhi_caozuozhanghu", caozuorizhi.getCaozuorizhiCaozuozhanghu()).eq("caozuorizhi_caozuoleixing", caozuorizhi.getCaozuorizhiCaozuoleixing()).eq("caozuorizhi_text", caozuorizhi.getCaozuorizhiText())
//            .notIn("caozuorizhi_types", new Integer[]{102});logger.info("sql语句:"+queryWrapper.getSqlSegment());CaozuorizhiEntity caozuorizhiEntity = caozuorizhiService.selectOne(queryWrapper);if(caozuorizhiEntity==null){caozuorizhi.setInsertTime(new Date());caozuorizhi.setCreateTime(new Date());caozuorizhiService.insert(caozuorizhi);return R.ok();}else {return R.error(511,"表中有相同数据");}}}
package com.controller;import java.io.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.*;import javax.servlet.http.HttpServletRequest;import com.alibaba.fastjson.JSON;
import com.utils.StringUtil;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;import com.annotation.IgnoreAuth;
import com.baidu.aip.face.AipFace;
import com.baidu.aip.face.MatchRequest;
import com.baidu.aip.util.Base64Util;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.entity.ConfigEntity;
import com.service.CommonService;
import com.service.ConfigService;
import com.utils.BaiduUtil;
import com.utils.FileUtil;
import com.utils.R;/*** 通用接口*/
@RestController
public class CommonController {private static final Logger logger = LoggerFactory.getLogger(CommonController.class);@Autowiredprivate CommonService commonService;/*** Java代码实现MySQL数据库导出** @param mysqlUrl     MySQL安装路径* @param hostIP       MySQL数据库所在服务器地址IP* @param userName     进入数据库所需要的用户名* @param hostPort     数据库端口* @param password     进入数据库所需要的密码* @param savePath     数据库文件保存路径* @param fileName     数据库导出文件文件名* @param databaseName 要导出的数据库名* @return 返回true表示导出成功,否则返回false。*/@IgnoreAuth@RequestMapping("/beifen")public R beifen(String mysqlUrl, String hostIP, String userName, String hostPort, String password, String savePath, String fileName, String databaseName) {File saveFile = new File(savePath);if (!saveFile.exists()) {// 如果目录不存在 saveFile.mkdirs();// 创建文件夹 }if (!savePath.endsWith(File.separator)) {savePath = savePath + File.separator;}PrintWriter printWriter = null;BufferedReader bufferedReader = null;try {Runtime runtime = Runtime.getRuntime();String cmd = mysqlUrl + "mysqldump -h" + hostIP + " -u" + userName + " -P" + hostPort + " -p" + password + " " + databaseName;runtime.exec(cmd);Process process = runtime.exec(cmd);InputStreamReader inputStreamReader = new InputStreamReader(process.getInputStream(), "utf8");bufferedReader = new BufferedReader(inputStreamReader);printWriter = new PrintWriter(new OutputStreamWriter(new FileOutputStream(savePath + fileName), "utf8"));String line;while ((line = bufferedReader.readLine()) != null) {printWriter.println(line);}printWriter.flush();} catch (Exception e) {e.printStackTrace();return R.error("备份数据出错");} finally {try {if (bufferedReader != null) {bufferedReader.close();}if (printWriter != null) {printWriter.close();}} catch (Exception e) {e.printStackTrace();}}return R.ok();}/*** Java实现MySQL数据库导入** @param mysqlUrl     MySQL安装路径* @param hostIP       MySQL数据库所在服务器地址IP* @param userName     进入数据库所需要的用户名* @param hostPort     数据库端口* @param password     进入数据库所需要的密码* @param savePath     数据库文件保存路径* @param fileName     数据库导出文件文件名* @param databaseName 要导出的数据库名*/@IgnoreAuth@RequestMapping("/huanyuan")public R huanyuan(String mysqlUrl, String hostIP, String userName, String hostPort, String password, String savePath, String fileName, String databaseName) {try {Runtime rt = Runtime.getRuntime();Process child1 = rt.exec(mysqlUrl+"mysql.exe  -h" + hostIP + " -u" + userName + " -P" + hostPort + " -p" + password + " " + databaseName);OutputStream out = child1.getOutputStream();//控制台的输入信息作为输出流String inStr;StringBuffer sb = new StringBuffer("");String outStr;BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(savePath+"/"+fileName), "utf-8"));while ((inStr = br.readLine()) != null) {sb.append(inStr + "\r\n");}outStr = sb.toString();OutputStreamWriter writer = new OutputStreamWriter(out, "utf8");writer.write(outStr);
// 注:这里如果用缓冲方式写入文件的话,会导致中文乱码,用flush()方法则可以避免writer.flush();out.close();br.close();writer.close();} catch (Exception e) {e.printStackTrace();return R.error("数据导入出错");}return R.ok();}/*** 饼状图求和* @return*/@RequestMapping("/pieSum")public R pieSum(@RequestParam Map<String,Object> params) {logger.debug("饼状图求和:,,Controller:{},,params:{}",this.getClass().getName(),params);List<Map<String, Object>> result = commonService.pieSum(params);return R.ok().put("data", result);}/*** 饼状图统计* @return*/@RequestMapping("/pieCount")public R pieCount(@RequestParam Map<String,Object> params) {logger.debug("饼状图统计:,,Controller:{},,params:{}",this.getClass().getName(),params);List<Map<String, Object>> result = commonService.pieCount(params);return R.ok().put("data", result);}/*** 柱状图求和单列* @return*/@RequestMapping("/barSumOne")public R barSumOne(@RequestParam Map<String,Object> params) {logger.debug("柱状图求和单列:,,Controller:{},,params:{}",this.getClass().getName(),params);List<Map<String, Object>> result = commonService.barSumOne(params);List<String> xAxis = new ArrayList<>();//报表x轴List<List<String>> yAxis = new ArrayList<>();//y轴List<String> legend = new ArrayList<>();//标题List<String> yAxis0 = new ArrayList<>();yAxis.add(yAxis0);legend.add("");for(Map<String, Object> map :result){String oneValue = String.valueOf(map.get("name"));String value = String.valueOf(map.get("value"));xAxis.add(oneValue);yAxis0.add(value);}Map<String, Object> resultMap = new HashMap<>();resultMap.put("xAxis",xAxis);resultMap.put("yAxis",yAxis);resultMap.put("legend",legend);return R.ok().put("data", resultMap);}/*** 柱状图统计单列* @return*/@RequestMapping("/barCountOne")public R barCountOne(@RequestParam Map<String,Object> params) {logger.debug("柱状图统计单列:,,Controller:{},,params:{}",this.getClass().getName(),params);List<Map<String, Object>> result = commonService.barCountOne(params);List<String> xAxis = new ArrayList<>();//报表x轴List<List<String>> yAxis = new ArrayList<>();//y轴List<String> legend = new ArrayList<>();//标题List<String> yAxis0 = new ArrayList<>();yAxis.add(yAxis0);legend.add("");for(Map<String, Object> map :result){String oneValue = String.valueOf(map.get("name"));String value = String.valueOf(map.get("value"));xAxis.add(oneValue);yAxis0.add(value);}Map<String, Object> resultMap = new HashMap<>();resultMap.put("xAxis",xAxis);resultMap.put("yAxis",yAxis);resultMap.put("legend",legend);return R.ok().put("data", resultMap);}/*** 柱状图统计双列* @return*/@RequestMapping("/barSumTwo")public R barSumTwo(@RequestParam Map<String,Object> params) {logger.debug("柱状图统计双列:,,Controller:{},,params:{}",this.getClass().getName(),params);List<Map<String, Object>> result = commonService.barSumTwo(params);List<String> xAxis = new ArrayList<>();//报表x轴List<List<String>> yAxis = new ArrayList<>();//y轴List<String> legend = new ArrayList<>();//标题Map<String, HashMap<String, String>> dataMap = new LinkedHashMap<>();for(Map<String, Object> map :result){String name1Value = String.valueOf(map.get("name1"));String name2Value = String.valueOf(map.get("name2"));String value = String.valueOf(map.get("value"));if(!legend.contains(name2Value)){legend.add(name2Value);//添加完成后 就是最全的第二列的类型}if(dataMap.containsKey(name1Value)){dataMap.get(name1Value).put(name2Value,value);}else{HashMap<String, String> name1Data = new HashMap<>();name1Data.put(name2Value,value);dataMap.put(name1Value,name1Data);}}for(int i =0; i<legend.size(); i++){yAxis.add(new ArrayList<String>());}Set<String> keys = dataMap.keySet();for(String key:keys){xAxis.add(key);HashMap<String, String> map = dataMap.get(key);for(int i =0; i<legend.size(); i++){List<String> data = yAxis.get(i);if(StringUtil.isNotEmpty(map.get(legend.get(i)))){data.add(map.get(legend.get(i)));}else{data.add("0");}}}System.out.println();Map<String, Object> resultMap = new HashMap<>();resultMap.put("xAxis",xAxis);resultMap.put("yAxis",yAxis);resultMap.put("legend",legend);return R.ok().put("data", resultMap);}/*** 柱状图统计双列* @return*/@RequestMapping("/barCountTwo")public R barCountTwo(@RequestParam Map<String,Object> params) {logger.debug("柱状图统计双列:,,Controller:{},,params:{}",this.getClass().getName(),params);List<Map<String, Object>> result = commonService.barCountTwo(params);List<String> xAxis = new ArrayList<>();//报表x轴List<List<String>> yAxis = new ArrayList<>();//y轴List<String> legend = new ArrayList<>();//标题Map<String, HashMap<String, String>> dataMap = new LinkedHashMap<>();for(Map<String, Object> map :result){String name1Value = String.valueOf(map.get("name1"));String name2Value = String.valueOf(map.get("name2"));String value = String.valueOf(map.get("value"));if(!legend.contains(name2Value)){legend.add(name2Value);//添加完成后 就是最全的第二列的类型}if(dataMap.containsKey(name1Value)){dataMap.get(name1Value).put(name2Value,value);}else{HashMap<String, String> name1Data = new HashMap<>();name1Data.put(name2Value,value);dataMap.put(name1Value,name1Data);}}for(int i =0; i<legend.size(); i++){yAxis.add(new ArrayList<String>());}Set<String> keys = dataMap.keySet();for(String key:keys){xAxis.add(key);HashMap<String, String> map = dataMap.get(key);for(int i =0; i<legend.size(); i++){List<String> data = yAxis.get(i);if(StringUtil.isNotEmpty(map.get(legend.get(i)))){data.add(map.get(legend.get(i)));}else{data.add("0");}}}System.out.println();Map<String, Object> resultMap = new HashMap<>();resultMap.put("xAxis",xAxis);resultMap.put("yAxis",yAxis);resultMap.put("legend",legend);return R.ok().put("data", resultMap);}/**tableName 查询表condition1 条件1condition1Value 条件1值average 计算平均评分取值有值 Number(res.data.value.toFixed(1))无值 if(res.data){}* */@IgnoreAuth@RequestMapping("/queryScore")public R queryScore(@RequestParam Map<String, Object> params) {logger.debug("queryScore:,,Controller:{},,params:{}",this.getClass().getName(),params);Map<String, Object> queryScore = commonService.queryScore(params);return R.ok().put("data", queryScore);}/*** 查询字典表的分组统计总条数*  tableName  		表名*	groupColumn  	分组字段* @return*/@RequestMapping("/newSelectGroupCount")public R newSelectGroupCount(@RequestParam Map<String,Object> params) {logger.debug("newSelectGroupCount:,,Controller:{},,params:{}",this.getClass().getName(),params);List<Map<String, Object>> result = commonService.newSelectGroupCount(params);return R.ok().put("data", result);}/*** 查询字典表的分组求和* tableName  		表名* groupColumn  		分组字段* sumCloum			统计字段* @return*/@RequestMapping("/newSelectGroupSum")public R newSelectGroupSum(@RequestParam Map<String,Object> params) {logger.debug("newSelectGroupSum:,,Controller:{},,params:{}",this.getClass().getName(),params);List<Map<String, Object>> result = commonService.newSelectGroupSum(params);return R.ok().put("data", result);}/*** 柱状图求和 老的*/@RequestMapping("/barSum")public R barSum(@RequestParam Map<String,Object> params) {logger.debug("barSum方法:,,Controller:{},,params:{}",this.getClass().getName(), com.alibaba.fastjson.JSONObject.toJSONString(params));Boolean isJoinTableFlag =  false;//是否有级联表相关String one =  "";//第一优先String two =  "";//第二优先//处理thisTable和joinTable 处理内容是把json字符串转为Map并把带有,的切割为数组//当前表Map<String,Object> thisTable = JSON.parseObject(String.valueOf(params.get("thisTable")),Map.class);params.put("thisTable",thisTable);//级联表String joinTableString = String.valueOf(params.get("joinTable"));if(StringUtil.isNotEmpty(joinTableString)) {Map<String, Object> joinTable = JSON.parseObject(joinTableString, Map.class);params.put("joinTable", joinTable);isJoinTableFlag = true;}if(StringUtil.isNotEmpty(String.valueOf(thisTable.get("date")))){//当前表日期thisTable.put("date",String.valueOf(thisTable.get("date")).split(","));one = "thisDate0";}if(isJoinTableFlag){//级联表日期Map<String, Object> joinTable = (Map<String, Object>) params.get("joinTable");if(StringUtil.isNotEmpty(String.valueOf(joinTable.get("date")))){joinTable.put("date",String.valueOf(joinTable.get("date")).split(","));if(StringUtil.isEmpty(one)){one ="joinDate0";}else{if(StringUtil.isEmpty(two)){two ="joinDate0";}}}}if(StringUtil.isNotEmpty(String.valueOf(thisTable.get("string")))){//当前表字符串thisTable.put("string",String.valueOf(thisTable.get("string")).split(","));if(StringUtil.isEmpty(one)){one ="thisString0";}else{if(StringUtil.isEmpty(two)){two ="thisString0";}}}if(isJoinTableFlag){//级联表字符串Map<String, Object> joinTable = (Map<String, Object>) params.get("joinTable");if(StringUtil.isNotEmpty(String.valueOf(joinTable.get("string")))){joinTable.put("string",String.valueOf(joinTable.get("string")).split(","));if(StringUtil.isEmpty(one)){one ="joinString0";}else{if(StringUtil.isEmpty(two)){two ="joinString0";}}}}if(StringUtil.isNotEmpty(String.valueOf(thisTable.get("types")))){//当前表类型thisTable.put("types",String.valueOf(thisTable.get("types")).split(","));if(StringUtil.isEmpty(one)){one ="thisTypes0";}else{if(StringUtil.isEmpty(two)){two ="thisTypes0";}}}if(isJoinTableFlag){//级联表类型Map<String, Object> joinTable = (Map<String, Object>) params.get("joinTable");if(StringUtil.isNotEmpty(String.valueOf(joinTable.get("types")))){joinTable.put("types",String.valueOf(joinTable.get("types")).split(","));if(StringUtil.isEmpty(one)){one ="joinTypes0";}else{if(StringUtil.isEmpty(two)){two ="joinTypes0";}}}}List<Map<String, Object>> result = commonService.barSum(params);List<String> xAxis = new ArrayList<>();//报表x轴List<List<String>> yAxis = new ArrayList<>();//y轴List<String> legend = new ArrayList<>();//标题if(StringUtil.isEmpty(two)){//不包含第二列List<String> yAxis0 = new ArrayList<>();yAxis.add(yAxis0);legend.add("");for(Map<String, Object> map :result){String oneValue = String.valueOf(map.get(one));String value = String.valueOf(map.get("value"));xAxis.add(oneValue);yAxis0.add(value);}}else{//包含第二列Map<String, HashMap<String, String>> dataMap = new LinkedHashMap<>();if(StringUtil.isNotEmpty(two)){for(Map<String, Object> map :result){String oneValue = String.valueOf(map.get(one));String twoValue = String.valueOf(map.get(two));String value = String.valueOf(map.get("value"));if(!legend.contains(twoValue)){legend.add(twoValue);//添加完成后 就是最全的第二列的类型}if(dataMap.containsKey(oneValue)){dataMap.get(oneValue).put(twoValue,value);}else{HashMap<String, String> oneData = new HashMap<>();oneData.put(twoValue,value);dataMap.put(oneValue,oneData);}}}for(int i =0; i<legend.size(); i++){yAxis.add(new ArrayList<String>());}Set<String> keys = dataMap.keySet();for(String key:keys){xAxis.add(key);HashMap<String, String> map = dataMap.get(key);for(int i =0; i<legend.size(); i++){List<String> data = yAxis.get(i);if(StringUtil.isNotEmpty(map.get(legend.get(i)))){data.add(map.get(legend.get(i)));}else{data.add("0");}}}System.out.println();}Map<String, Object> resultMap = new HashMap<>();resultMap.put("xAxis",xAxis);resultMap.put("yAxis",yAxis);resultMap.put("legend",legend);return R.ok().put("data", resultMap);}/*** 柱状图统计 老的*/@RequestMapping("/barCount")public R barCount(@RequestParam Map<String,Object> params) {logger.debug("barCount方法:,,Controller:{},,params:{}",this.getClass().getName(), com.alibaba.fastjson.JSONObject.toJSONString(params));Boolean isJoinTableFlag =  false;//是否有级联表相关String one =  "";//第一优先String two =  "";//第二优先//处理thisTable和joinTable 处理内容是把json字符串转为Map并把带有,的切割为数组//当前表Map<String,Object> thisTable = JSON.parseObject(String.valueOf(params.get("thisTable")),Map.class);params.put("thisTable",thisTable);//级联表String joinTableString = String.valueOf(params.get("joinTable"));if(StringUtil.isNotEmpty(joinTableString)) {Map<String, Object> joinTable = JSON.parseObject(joinTableString, Map.class);params.put("joinTable", joinTable);isJoinTableFlag = true;}if(StringUtil.isNotEmpty(String.valueOf(thisTable.get("date")))){//当前表日期thisTable.put("date",String.valueOf(thisTable.get("date")).split(","));one = "thisDate0";}if(isJoinTableFlag){//级联表日期Map<String, Object> joinTable = (Map<String, Object>) params.get("joinTable");if(StringUtil.isNotEmpty(String.valueOf(joinTable.get("date")))){joinTable.put("date",String.valueOf(joinTable.get("date")).split(","));if(StringUtil.isEmpty(one)){one ="joinDate0";}else{if(StringUtil.isEmpty(two)){two ="joinDate0";}}}}if(StringUtil.isNotEmpty(String.valueOf(thisTable.get("string")))){//当前表字符串thisTable.put("string",String.valueOf(thisTable.get("string")).split(","));if(StringUtil.isEmpty(one)){one ="thisString0";}else{if(StringUtil.isEmpty(two)){two ="thisString0";}}}if(isJoinTableFlag){//级联表字符串Map<String, Object> joinTable = (Map<String, Object>) params.get("joinTable");if(StringUtil.isNotEmpty(String.valueOf(joinTable.get("string")))){joinTable.put("string",String.valueOf(joinTable.get("string")).split(","));if(StringUtil.isEmpty(one)){one ="joinString0";}else{if(StringUtil.isEmpty(two)){two ="joinString0";}}}}if(StringUtil.isNotEmpty(String.valueOf(thisTable.get("types")))){//当前表类型thisTable.put("types",String.valueOf(thisTable.get("types")).split(","));if(StringUtil.isEmpty(one)){one ="thisTypes0";}else{if(StringUtil.isEmpty(two)){two ="thisTypes0";}}}if(isJoinTableFlag){//级联表类型Map<String, Object> joinTable = (Map<String, Object>) params.get("joinTable");if(StringUtil.isNotEmpty(String.valueOf(joinTable.get("types")))){joinTable.put("types",String.valueOf(joinTable.get("types")).split(","));if(StringUtil.isEmpty(one)){one ="joinTypes0";}else{if(StringUtil.isEmpty(two)){two ="joinTypes0";}}}}List<Map<String, Object>> result = commonService.barCount(params);List<String> xAxis = new ArrayList<>();//报表x轴List<List<String>> yAxis = new ArrayList<>();//y轴List<String> legend = new ArrayList<>();//标题if(StringUtil.isEmpty(two)){//不包含第二列List<String> yAxis0 = new ArrayList<>();yAxis.add(yAxis0);legend.add("");for(Map<String, Object> map :result){String oneValue = String.valueOf(map.get(one));String value = String.valueOf(map.get("value"));xAxis.add(oneValue);yAxis0.add(value);}}else{//包含第二列Map<String, HashMap<String, String>> dataMap = new LinkedHashMap<>();if(StringUtil.isNotEmpty(two)){for(Map<String, Object> map :result){String oneValue = String.valueOf(map.get(one));String twoValue = String.valueOf(map.get(two));String value = String.valueOf(map.get("value"));if(!legend.contains(twoValue)){legend.add(twoValue);//添加完成后 就是最全的第二列的类型}if(dataMap.containsKey(oneValue)){dataMap.get(oneValue).put(twoValue,value);}else{HashMap<String, String> oneData = new HashMap<>();oneData.put(twoValue,value);dataMap.put(oneValue,oneData);}}}for(int i =0; i<legend.size(); i++){yAxis.add(new ArrayList<String>());}Set<String> keys = dataMap.keySet();for(String key:keys){xAxis.add(key);HashMap<String, String> map = dataMap.get(key);for(int i =0; i<legend.size(); i++){List<String> data = yAxis.get(i);if(StringUtil.isNotEmpty(map.get(legend.get(i)))){data.add(map.get(legend.get(i)));}else{data.add("0");}}}System.out.println();}Map<String, Object> resultMap = new HashMap<>();resultMap.put("xAxis",xAxis);resultMap.put("yAxis",yAxis);resultMap.put("legend",legend);return R.ok().put("data", resultMap);}
}

package com.controller;import java.io.File;
import java.math.BigDecimal;
import java.net.URL;
import java.text.SimpleDateFormat;
import com.alibaba.fastjson.JSONObject;
import java.util.*;
import org.springframework.beans.BeanUtils;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.context.ContextLoader;
import javax.servlet.ServletContext;
import com.service.TokenService;
import com.utils.*;
import java.lang.reflect.InvocationTargetException;import com.service.DictionaryService;
import org.apache.commons.lang3.StringUtils;
import com.annotation.IgnoreAuth;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.entity.*;
import com.entity.view.*;
import com.service.*;
import com.utils.PageUtils;
import com.utils.R;
import com.alibaba.fastjson.*;/*** 失物认领* 后端接口* @author* @email
*/
@RestController
@Controller
@RequestMapping("/shiwuzhaolingYuyue")
public class ShiwuzhaolingYuyueController {private static final Logger logger = LoggerFactory.getLogger(ShiwuzhaolingYuyueController.class);private static final String TABLE_NAME = "shiwuzhaolingYuyue";@Autowiredprivate ShiwuzhaolingYuyueService shiwuzhaolingYuyueService;@Autowiredprivate TokenService tokenService;@Autowiredprivate CaozuorizhiService caozuorizhiService;//操作日志@Autowiredprivate DictionaryService dictionaryService;//字典@Autowiredprivate LiuyanService liuyanService;//留言板@Autowiredprivate NewsService newsService;//公告信息@Autowiredprivate ShiwuzhaolingService shiwuzhaolingService;//失物信息@Autowiredprivate XunwuqishiService xunwuqishiService;//寻物启事@Autowiredprivate XunwuqishiLiuyanService xunwuqishiLiuyanService;//寻物启事留言@Autowiredprivate YonghuService yonghuService;//用户@Autowiredprivate UsersService usersService;//管理员/*** 后端列表*/@RequestMapping("/page")public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));String role = String.valueOf(request.getSession().getAttribute("role"));if(false)return R.error(511,"永不会进入");else if("用户".equals(role))params.put("yonghuId",request.getSession().getAttribute("userId"));CommonUtil.checkMap(params);PageUtils page = shiwuzhaolingYuyueService.queryPage(params);//字典表数据转换List<ShiwuzhaolingYuyueView> list =(List<ShiwuzhaolingYuyueView>)page.getList();for(ShiwuzhaolingYuyueView c:list){//修改对应字典表字段dictionaryService.dictionaryConvert(c, request);}caozuorizhiService.insertCaozuorizhi(String.valueOf(request.getSession().getAttribute("role")),TABLE_NAME,String.valueOf(request.getSession().getAttribute("username")),"列表查询",list.toString());return R.ok().put("data", page);}/*** 后端详情*/@RequestMapping("/info/{id}")public R info(@PathVariable("id") Long id, HttpServletRequest request){logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);ShiwuzhaolingYuyueEntity shiwuzhaolingYuyue = shiwuzhaolingYuyueService.selectById(id);if(shiwuzhaolingYuyue !=null){//entity转viewShiwuzhaolingYuyueView view = new ShiwuzhaolingYuyueView();BeanUtils.copyProperties( shiwuzhaolingYuyue , view );//把实体数据重构到view中//级联表 失物信息//级联表ShiwuzhaolingEntity shiwuzhaoling = shiwuzhaolingService.selectById(shiwuzhaolingYuyue.getShiwuzhaolingId());if(shiwuzhaoling != null){BeanUtils.copyProperties( shiwuzhaoling , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "yonghuId"});//把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表view.setShiwuzhaolingId(shiwuzhaoling.getId());}//级联表 用户//级联表YonghuEntity yonghu = yonghuService.selectById(shiwuzhaolingYuyue.getYonghuId());if(yonghu != null){BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "yonghuId"});//把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表view.setYonghuId(yonghu.getId());}//修改对应字典表字段dictionaryService.dictionaryConvert(view, request);caozuorizhiService.insertCaozuorizhi(String.valueOf(request.getSession().getAttribute("role")),TABLE_NAME,String.valueOf(request.getSession().getAttribute("username")),"单条数据查看",view.toString());return R.ok().put("data", view);}else {return R.error(511,"查不到数据");}}/*** 后端保存*/@RequestMapping("/save")public R save(@RequestBody ShiwuzhaolingYuyueEntity shiwuzhaolingYuyue, HttpServletRequest request){logger.debug("save方法:,,Controller:{},,shiwuzhaolingYuyue:{}",this.getClass().getName(),shiwuzhaolingYuyue.toString());String role = String.valueOf(request.getSession().getAttribute("role"));if(false)return R.error(511,"永远不会进入");else if("用户".equals(role))shiwuzhaolingYuyue.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));Wrapper<ShiwuzhaolingYuyueEntity> queryWrapper = new EntityWrapper<ShiwuzhaolingYuyueEntity>().eq("shiwuzhaoling_id", shiwuzhaolingYuyue.getShiwuzhaolingId()).eq("yonghu_id", shiwuzhaolingYuyue.getYonghuId()).in("shiwuzhaoling_yuyue_yesno_types", new Integer[]{1,2});logger.info("sql语句:"+queryWrapper.getSqlSegment());ShiwuzhaolingYuyueEntity shiwuzhaolingYuyueEntity = shiwuzhaolingYuyueService.selectOne(queryWrapper);if(shiwuzhaolingYuyueEntity==null){shiwuzhaolingYuyue.setShiwuzhaolingYuyueYesnoTypes(1);shiwuzhaolingYuyue.setInsertTime(new Date());shiwuzhaolingYuyue.setCreateTime(new Date());shiwuzhaolingYuyueService.insert(shiwuzhaolingYuyue);caozuorizhiService.insertCaozuorizhi(String.valueOf(request.getSession().getAttribute("role")),TABLE_NAME,String.valueOf(request.getSession().getAttribute("username")),"新增",shiwuzhaolingYuyue.toString());return R.ok();}else {if(shiwuzhaolingYuyueEntity.getShiwuzhaolingYuyueYesnoTypes()==1)return R.error(511,"有相同的待审核的数据");else if(shiwuzhaolingYuyueEntity.getShiwuzhaolingYuyueYesnoTypes()==2)return R.error(511,"有相同的审核通过的数据");elsereturn R.error(511,"表中有相同数据");}}/*** 后端修改*/@RequestMapping("/update")public R update(@RequestBody ShiwuzhaolingYuyueEntity shiwuzhaolingYuyue, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {logger.debug("update方法:,,Controller:{},,shiwuzhaolingYuyue:{}",this.getClass().getName(),shiwuzhaolingYuyue.toString());ShiwuzhaolingYuyueEntity oldShiwuzhaolingYuyueEntity = shiwuzhaolingYuyueService.selectById(shiwuzhaolingYuyue.getId());//查询原先数据String role = String.valueOf(request.getSession().getAttribute("role"));
//        if(false)
//            return R.error(511,"永远不会进入");
//        else if("用户".equals(role))
//            shiwuzhaolingYuyue.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));shiwuzhaolingYuyueService.updateById(shiwuzhaolingYuyue);//根据id更新List<String> strings = caozuorizhiService.clazzDiff(shiwuzhaolingYuyue, oldShiwuzhaolingYuyueEntity, request,new String[]{"updateTime"});caozuorizhiService.insertCaozuorizhi(String.valueOf(request.getSession().getAttribute("role")),TABLE_NAME,String.valueOf(request.getSession().getAttribute("username")),"修改",strings.toString());return R.ok();}/*** 审核*/@RequestMapping("/shenhe")public R shenhe(@RequestBody ShiwuzhaolingYuyueEntity shiwuzhaolingYuyueEntity, HttpServletRequest request){logger.debug("shenhe方法:,,Controller:{},,shiwuzhaolingYuyueEntity:{}",this.getClass().getName(),shiwuzhaolingYuyueEntity.toString());ShiwuzhaolingYuyueEntity oldShiwuzhaolingYuyue = shiwuzhaolingYuyueService.selectById(shiwuzhaolingYuyueEntity.getId());//查询原先数据if(shiwuzhaolingYuyueEntity.getShiwuzhaolingYuyueYesnoTypes() == 2){//通过ShiwuzhaolingEntity shiwuzhaolingEntity = shiwuzhaolingService.selectById(oldShiwuzhaolingYuyue.getShiwuzhaolingId());shiwuzhaolingEntity.setRenlingzhuangtaiTypes(2);shiwuzhaolingService.updateById(shiwuzhaolingEntity);}else if(shiwuzhaolingYuyueEntity.getShiwuzhaolingYuyueYesnoTypes() == 3){//拒绝}shiwuzhaolingYuyueService.updateById(shiwuzhaolingYuyueEntity);//审核caozuorizhiService.insertCaozuorizhi(String.valueOf(request.getSession().getAttribute("role")),TABLE_NAME,String.valueOf(request.getSession().getAttribute("username")),"审核数据","审核"+oldShiwuzhaolingYuyue+"数据,审核结果是"+(shiwuzhaolingYuyueEntity.getShiwuzhaolingYuyueYesnoTypes()==2?"通过":"拒绝"));return R.ok();}/*** 删除*/@RequestMapping("/delete")public R delete(@RequestBody Integer[] ids, HttpServletRequest request){logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());List<ShiwuzhaolingYuyueEntity> oldShiwuzhaolingYuyueList =shiwuzhaolingYuyueService.selectBatchIds(Arrays.asList(ids));//要删除的数据shiwuzhaolingYuyueService.deleteBatchIds(Arrays.asList(ids));caozuorizhiService.insertCaozuorizhi(String.valueOf(request.getSession().getAttribute("role")),TABLE_NAME,String.valueOf(request.getSession().getAttribute("username")),"删除",oldShiwuzhaolingYuyueList.toString());return R.ok();}/*** 批量上传*/@RequestMapping("/batchInsert")public R save( String fileName, HttpServletRequest request){logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);Integer yonghuId = Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId")));SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//.eq("time", new SimpleDateFormat("yyyy-MM-dd").format(new Date()))try {List<ShiwuzhaolingYuyueEntity> shiwuzhaolingYuyueList = new ArrayList<>();//上传的东西Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段Date date = new Date();int lastIndexOf = fileName.lastIndexOf(".");if(lastIndexOf == -1){return R.error(511,"该文件没有后缀");}else{String suffix = fileName.substring(lastIndexOf);if(!".xls".equals(suffix)){return R.error(511,"只支持后缀为xls的excel文件");}else{URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);//获取文件路径File file = new File(resource.getFile());if(!file.exists()){return R.error(511,"找不到上传文件,请联系管理员");}else{List<List<String>> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件dataList.remove(0);//删除第一行,因为第一行是提示for(List<String> data:dataList){//循环ShiwuzhaolingYuyueEntity shiwuzhaolingYuyueEntity = new ShiwuzhaolingYuyueEntity();
//                            shiwuzhaolingYuyueEntity.setShiwuzhaolingId(Integer.valueOf(data.get(0)));   //失物id 要改的
//                            shiwuzhaolingYuyueEntity.setYonghuId(Integer.valueOf(data.get(0)));   //认领用户 要改的
//                            shiwuzhaolingYuyueEntity.setShiwuzhaolingYuyueText(data.get(0));                    //认领凭证 要改的
//                            shiwuzhaolingYuyueEntity.setShiwuzhaolingYuyueYesnoTypes(Integer.valueOf(data.get(0)));   //审核 要改的
//                            shiwuzhaolingYuyueEntity.setShiwuzhaolingYuyueYesnoText(data.get(0));                    //详情 要改的
//                            shiwuzhaolingYuyueEntity.setInsertTime(date);//时间
//                            shiwuzhaolingYuyueEntity.setCreateTime(date);//时间shiwuzhaolingYuyueList.add(shiwuzhaolingYuyueEntity);//把要查询是否重复的字段放入map中}//查询是否重复shiwuzhaolingYuyueService.insertBatch(shiwuzhaolingYuyueList);caozuorizhiService.insertCaozuorizhi(String.valueOf(request.getSession().getAttribute("role")),TABLE_NAME,String.valueOf(request.getSession().getAttribute("username")),"批量新增",shiwuzhaolingYuyueList.toString());return R.ok();}}}}catch (Exception e){e.printStackTrace();return R.error(511,"批量插入数据异常,请联系管理员");}}/*** 前端列表*/@IgnoreAuth@RequestMapping("/list")public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));CommonUtil.checkMap(params);PageUtils page = shiwuzhaolingYuyueService.queryPage(params);//字典表数据转换List<ShiwuzhaolingYuyueView> list =(List<ShiwuzhaolingYuyueView>)page.getList();for(ShiwuzhaolingYuyueView c:list)dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段caozuorizhiService.insertCaozuorizhi(String.valueOf(request.getSession().getAttribute("role")),TABLE_NAME,String.valueOf(request.getSession().getAttribute("username")),"列表查询",list.toString());return R.ok().put("data", page);}/*** 前端详情*/@RequestMapping("/detail/{id}")public R detail(@PathVariable("id") Long id, HttpServletRequest request){logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);ShiwuzhaolingYuyueEntity shiwuzhaolingYuyue = shiwuzhaolingYuyueService.selectById(id);if(shiwuzhaolingYuyue !=null){//entity转viewShiwuzhaolingYuyueView view = new ShiwuzhaolingYuyueView();BeanUtils.copyProperties( shiwuzhaolingYuyue , view );//把实体数据重构到view中//级联表ShiwuzhaolingEntity shiwuzhaoling = shiwuzhaolingService.selectById(shiwuzhaolingYuyue.getShiwuzhaolingId());if(shiwuzhaoling != null){BeanUtils.copyProperties( shiwuzhaoling , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段view.setShiwuzhaolingId(shiwuzhaoling.getId());}//级联表YonghuEntity yonghu = yonghuService.selectById(shiwuzhaolingYuyue.getYonghuId());if(yonghu != null){BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段view.setYonghuId(yonghu.getId());}//修改对应字典表字段dictionaryService.dictionaryConvert(view, request);caozuorizhiService.insertCaozuorizhi(String.valueOf(request.getSession().getAttribute("role")),TABLE_NAME,String.valueOf(request.getSession().getAttribute("username")),"单条数据查看",view.toString());return R.ok().put("data", view);}else {return R.error(511,"查不到数据");}}/*** 前端保存*/@RequestMapping("/add")public R add(@RequestBody ShiwuzhaolingYuyueEntity shiwuzhaolingYuyue, HttpServletRequest request){logger.debug("add方法:,,Controller:{},,shiwuzhaolingYuyue:{}",this.getClass().getName(),shiwuzhaolingYuyue.toString());Wrapper<ShiwuzhaolingYuyueEntity> queryWrapper = new EntityWrapper<ShiwuzhaolingYuyueEntity>().eq("shiwuzhaoling_id", shiwuzhaolingYuyue.getShiwuzhaolingId()).eq("yonghu_id", shiwuzhaolingYuyue.getYonghuId()).eq("shiwuzhaoling_yuyue_text", shiwuzhaolingYuyue.getShiwuzhaolingYuyueText()).in("shiwuzhaoling_yuyue_yesno_types", new Integer[]{1,2}).eq("shiwuzhaoling_yuyue_yesno_text", shiwuzhaolingYuyue.getShiwuzhaolingYuyueYesnoText())
//            .notIn("shiwuzhaoling_yuyue_types", new Integer[]{102});logger.info("sql语句:"+queryWrapper.getSqlSegment());ShiwuzhaolingYuyueEntity shiwuzhaolingYuyueEntity = shiwuzhaolingYuyueService.selectOne(queryWrapper);if(shiwuzhaolingYuyueEntity==null){shiwuzhaolingYuyue.setShiwuzhaolingYuyueYesnoTypes(1);shiwuzhaolingYuyue.setInsertTime(new Date());shiwuzhaolingYuyue.setCreateTime(new Date());shiwuzhaolingYuyueService.insert(shiwuzhaolingYuyue);caozuorizhiService.insertCaozuorizhi(String.valueOf(request.getSession().getAttribute("role")),TABLE_NAME,String.valueOf(request.getSession().getAttribute("username")),"前台新增",shiwuzhaolingYuyue.toString());return R.ok();}else {if(shiwuzhaolingYuyueEntity.getShiwuzhaolingYuyueYesnoTypes()==1)return R.error(511,"有相同的待审核的数据");else if(shiwuzhaolingYuyueEntity.getShiwuzhaolingYuyueYesnoTypes()==2)return R.error(511,"有相同的审核通过的数据");elsereturn R.error(511,"表中有相同数据");}}}

六、底部获取项目源码带万字文档(9.9¥带走)

有问题,或者需要协助调试运行项目的也可以

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/web/39853.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

JAVA导出数据库字典到Excel

文章目录 1、查询某张表字段信息2、TableVo接收sql查询得到的数据3、excel导出4、导出案例 1、查询某张表字段信息 select column_name as columnName, -- 字段名 COLUMN_DEFAULT as colDefault, -- 默认值 column_key as columnKey, -- PRI-主键&#xff0c;UNI-唯一键&…

【Python实战因果推断】21_倾向分1

目录 The Impact of Management Training Adjusting with Regression 之前学习了如何使用线性回归调整混杂因素。此外&#xff0c;还向您介绍了通过正交化去偏差的概念&#xff0c;这是目前最有用的偏差调整技术之一。不过&#xff0c;您还需要学习另一种技术--倾向加权。这种…

p标签文本段落中因编辑器换行引起的空格问题完美解决方案

目录 1.修改前的代码&#xff1a;2.修改后的代码3.总结 在HTML文档中&#xff0c;如何要在&#xff08;p标签&#xff09;内写一段很长的文本段落&#xff0c;并且没有 换行。由于IDE或者编辑器界面大小有限或需要在vue中逻辑处理动态显示文本&#xff0c;一行写完太长&#x…

Eslint prettier airbnb规范 配置

1.安装vscode的Eslint和prettier 插件 eslint&#xff1a;代码质量检查工具 https://eslint.nodejs.cn/docs/latest/use/getting-started prettier&#xff1a;代码风格格式化工具 https://www.prettier.cn/docs/index.html /* eslint-config-airbnb-base airbnb 规范 esl…

高德地图轨迹回放并提示具体信息

先上效果图 到达某地点后显示提示语&#xff1a;比如&#xff1a;12&#xff1a;56分驶入康庄大道、左转驶入xx大道等 <!doctype html> <html> <head><meta charset"utf-8"><meta http-equiv"X-UA-Compatible" content"…

【前端CSS3】CSS显示模式(黑马程序员)

文章目录 一、前言&#x1f680;&#x1f680;&#x1f680;二、CSS元素显示模式&#xff1a;☀️☀️☀️2.1 什么是元素显示模式2.2 块元素2.3 行内元素2.4 行块元素2.5 元素显示模式的转换 三、总结&#x1f680;&#x1f680;&#x1f680; 一、前言&#x1f680;&#x1f…

巴图自动化Modbus协议转Profinet协议网关模块连智能仪表与PLC通讯

一、现场要求:PLC作为控制器&#xff0c;仪表设备作为执行设备。执行设备可以实时响应PLC传送的指令&#xff0c;并将数据反馈给PLC&#xff0c;从而实现PLC对仪表设备的控制和监控&#xff0c;实现对生产过程的精确控制。 二、解决方案:通过巴图自动化Modbus协议转Profinet协议…

Robust Test-Time Adaptation in Dynamic Scenarios--论文阅读

论文笔记 资料 1.代码地址 https://github.com/BIT-DA/RoTTA 2.论文地址 https://arxiv.org/abs/2303.13899 3.数据集地址 coming soon 1论文摘要的翻译 测试时间自适应(TTA)旨在使预先7训练的模型适用于仅具有未标记测试数据流的测试分布。大多数以前的TTA方法已经在…

为什么要卸载手机上面的抖音?

删除抖音等社交媒体应用可能出于多种原因&#xff0c;这里列举一些常见的考虑因素&#xff1a; 1. **时间管理**&#xff1a; 抖音和其他社交媒体平台可能会占用大量时间&#xff0c;影响个人的日常生活和工作学习效率。 这个对于自己而言是一个客观存在的事情&#xff1a; 2.…

安卓请求服务器[根据服务器的内容来更新spinner]

根据服务器的内容来更新spinner 本文内容请结合如下两篇文章一起看: 腾讯云函数node.js返回自动带反斜杠 腾讯云函数部署环境[使用函数URL] 现在有这样一个需求,APP有一个下拉选择框作为版本选择,因为改个管脚就变成一个版本,客户需求也很零散,所以后期会大量增加版本,这时候每…

数据预处理:统计关联性分析/数据清洗/数据增强/特征工程实例

专栏介绍 1.专栏面向零基础或基础较差的机器学习入门的读者朋友,旨在利用实际代码案例和通俗化文字说明,使读者朋友快速上手机器学习及其相关知识体系。 2.专栏内容上包括数据采集、数据读写、数据预处理、分类\回归\聚类算法、可视化等技术。 3.需要强调的是,专栏仅介绍主…

gitLab使用流程

标题1.配置账户 git config --global user.name git config --global user.email mygitlabmali.cn 标题2.生成秘匙 ssh-keygen -t rsa -C “mygitlabmail.cn” 。 //输入命令后一直回车 &#xff0c;输入命令后一直回车&#xff08;密码可以不填&#xff09;&#xff0c;至…

Anaconda+Pycharm两个软件从头到尾下载流程

前言&#xff1a; 1、使用教程前&#xff0c;请将电脑上的所有的Python卸载掉。再下载Anaconda&#xff0c;Anaconda这个软件里面就含有python。 彻底删除python方法&#xff1a; 1、计算机——属性——高级系统设置——环境变量 2、查看电脑用户自己设计的环境变量&#x…

Xilinx FPGA:vivado关于RAM的一些零碎的小知识

一、xilinx fpga嵌入式存储单元 RAM----随机存取存储器&#xff1a;上电工作时可以随时从任何一个指定的地址写入&#xff08;存入&#xff09;或读出&#xff08;取出&#xff09;信息。缺点是一旦断电所存储的数据将随之丢失。RAM在计算机和数字系统中用来暂时性存储程序、数…

下载安装MySQL

1.软件的下载 打开官网下载mysql-installer-community-8.0.37.0.msi 2.软件的安装 mysql下载完成后&#xff0c;找到下载文件&#xff0c;双击安装 3.配置环境变量 4.自带客户端登录与退出

护网蓝队面试

一、sql注入分类 **原理&#xff1a;**没有对用户输入项进行验证和处理直接拼接到查询语句中 查询语句中插⼊恶意SQL代码传递后台sql服务器分析执行 **从注入参数类型分&#xff1a;**数字型注入、字符型注入 **从注入效果分&#xff1a;**报错注入、布尔注入、延时注入、联…

测试引擎模拟接口实战

在上一章的内容中&#xff0c;我简单介绍了整个微服务的各个子模块&#xff0c;还封装了一些工具类。 当然&#xff0c;若还没完成上次内容的也可以点击右侧的传送门------传送门 EngineApplication 在开发测试引擎模拟接口之前&#xff0c;还需要给xxx-engine创建一个Sprin…

bpftrace几种使用实例

1. 排查内存泄漏 memory.c memory.bt 可以执行相关memory&#xff0c;用bpftrace追踪malloc和free的过程 修改memory.bt&#xff0c;加上malloc和free统计&#xff0c;重新执行 2. 验证tcp连接关闭是应用关闭还是内核关闭 nginx服务启动后&#xff0c;会处于监听状态&…

imx6ull/linux应用编程学习(9)串口应用编程

什么是串口&#xff1f; 串口全称叫做串行接口&#xff0c;串行接口指的是数据一个一个的按顺序传输&#xff0c;通信线路简单。使用两条线即可实现双向通信&#xff0c;一条用于发送&#xff0c;一条用于接收。串口通信距离远&#xff0c;但是速度相对会低&#xff0c;串口是一…

GPU相关的一些截图(备查,待整理)

GPU相关的一些截图 这里记录一些与GPU相关的截图,方便查阅