🍊作者:计算机编程-吉哥
🍊简介:专业从事JavaWeb程序开发,微信小程序开发,定制化项目、 源码、代码讲解、文档撰写、ppt制作。做自己喜欢的事,生活就是快乐的。
🍊心愿:点赞 👍 收藏 ⭐评论 📝
🍅 文末获取源码联系👇🏻 精彩专栏推荐订阅 👇🏻 不然下次找不到哟~
Java毕业设计项目~热门选题推荐《1000套》
目录
springboot、mybatisplus、vue、elementui、html、css、js、mysql、jdk1.8
16张
idea、navicat
管理员、用户、老师
5.3 论坛
5.4 获奖
5.5 个人中心
5.6 后台登录
5.7 老师功能展示
5.8 管理员功能展示
5.9 专家功能展示
-
- CREATE TABLE `config` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `name` varchar(100) NOT NULL COMMENT '配置参数名称',
- `value` varchar(100) DEFAULT NULL COMMENT '配置参数值',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='配置文件';
-
-
- CREATE TABLE `dictionary` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `dic_code` varchar(200) DEFAULT NULL COMMENT '字段',
- `dic_name` varchar(200) DEFAULT NULL COMMENT '字段名',
- `code_index` int(11) DEFAULT NULL COMMENT '编码',
- `index_name` varchar(200) DEFAULT NULL COMMENT '编码名字 Search111 ',
- `super_id` int(11) DEFAULT NULL COMMENT '父字段id',
- `beizhu` varchar(200) DEFAULT NULL COMMENT '备注',
- `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8 COMMENT='字典';
-
-
- CREATE TABLE `forum` (
- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `forum_name` varchar(200) DEFAULT NULL COMMENT '帖子标题 Search111 ',
- `yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
- `laoshi_id` int(11) DEFAULT NULL COMMENT '老师',
- `zhuanjia_id` int(11) DEFAULT NULL COMMENT '专家',
- `users_id` int(11) DEFAULT NULL COMMENT '管理员',
- `forum_content` longtext COMMENT '发布内容',
- `super_ids` int(11) DEFAULT NULL COMMENT '父id',
- `forum_state_types` int(11) DEFAULT NULL COMMENT '帖子状态',
- `insert_time` timestamp NULL DEFAULT NULL COMMENT '发帖时间',
- `update_time` timestamp NULL DEFAULT NULL COMMENT '修改时间',
- `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show2',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8 COMMENT='论坛';
-
- CREATE TABLE `gonggao` (
- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',
- `gonggao_name` varchar(200) DEFAULT NULL COMMENT '公告名称 Search111 ',
- `gonggao_photo` varchar(200) DEFAULT NULL COMMENT '公告图片 ',
- `gonggao_types` int(11) NOT NULL COMMENT '公告类型 Search111 ',
- `insert_time` timestamp NULL DEFAULT NULL COMMENT '公告发布时间 ',
- `gonggao_content` longtext COMMENT '公告详情 ',
- `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 nameShow',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8 COMMENT='竞赛公告';
-
-
- CREATE TABLE `huojiang` (
- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',
- `huojiang_name` varchar(200) DEFAULT NULL COMMENT '获奖名称 Search111 ',
- `huojiang_uuid_number` varchar(200) DEFAULT NULL COMMENT '获奖编号',
- `huojiang_photo` varchar(200) DEFAULT NULL COMMENT '获奖照片',
- `huojiang_types` int(11) DEFAULT NULL COMMENT '获奖类型 Search111',
- `huojiang_xues` int(11) DEFAULT NULL COMMENT '学生排名',
- `huojiang_content` longtext COMMENT '获奖介绍 ',
- `huojiang_delete` int(11) DEFAULT NULL COMMENT '逻辑删除',
- `insert_time` timestamp NULL DEFAULT NULL COMMENT '录入时间',
- `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 photoShow',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8 COMMENT='获奖';
-
-
- CREATE TABLE `laoshi` (
- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `username` varchar(200) DEFAULT NULL COMMENT '账户',
- `password` varchar(200) DEFAULT NULL COMMENT '密码',
- `laoshi_name` varchar(200) DEFAULT NULL COMMENT '老师姓名 Search111 ',
- `laoshi_phone` varchar(200) DEFAULT NULL COMMENT '老师手机号',
- `laoshi_id_number` varchar(200) DEFAULT NULL COMMENT '老师身份证号',
- `laoshi_photo` varchar(200) DEFAULT NULL COMMENT '老师头像',
- `sex_types` int(11) DEFAULT NULL COMMENT '性别',
- `laoshi_email` varchar(200) DEFAULT NULL COMMENT '老师邮箱',
- `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='老师';
-
-
- CREATE TABLE `pingshen` (
- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `pingshen_uuid_number` varchar(200) DEFAULT NULL COMMENT '报名唯一编号 Search111 ',
- `saishi_tijiao_id` int(11) DEFAULT NULL COMMENT '赛事提交',
- `laoshi_id` int(11) DEFAULT NULL COMMENT '老师',
- `pingshen_file` varchar(200) DEFAULT NULL COMMENT '参赛作品',
- `pingshen_zhidao` varchar(200) DEFAULT NULL COMMENT '指导老师',
- `pingshen_text` text COMMENT '内容',
- `insert_time` timestamp NULL DEFAULT NULL COMMENT '赛事提交时间',
- `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8 COMMENT='评审';
-
-
- CREATE TABLE `pingshen_fenpei` (
- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `pingshen_fenpei_uuid_number` varchar(200) DEFAULT NULL COMMENT '报名唯一编号 Search111 ',
- `pingshen_id` int(11) DEFAULT NULL COMMENT '评审',
- `zhuanjia_id` int(11) DEFAULT NULL COMMENT '专家',
- `pingshen_fenpei_text` text COMMENT '内容',
- `insert_time` timestamp NULL DEFAULT NULL COMMENT '分配时间',
- `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8 COMMENT='评审分配';
-
- CREATE TABLE `pingshen_pingfen` (
- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `pingshen_pingfen_uuid_number` varchar(200) DEFAULT NULL COMMENT '报名唯一编号 Search111 ',
- `pingshen_fenpei_id` int(11) DEFAULT NULL COMMENT '评审分配',
- `zhuanjia_id` int(11) DEFAULT NULL COMMENT '专家',
- `pingshen_pingfen_pingfen` int(11) DEFAULT NULL COMMENT '打分',
- `pingshen_pingfen_text` text COMMENT '内容',
- `insert_time` timestamp NULL DEFAULT NULL COMMENT '分配时间',
- `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8 COMMENT='评审打分';
-
-
- CREATE TABLE `saishi` (
- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',
- `saishi_name` varchar(200) DEFAULT NULL COMMENT '赛事名称 Search111 ',
- `saishi_uuid_number` varchar(200) DEFAULT NULL COMMENT '赛事编号',
- `saishi_photo` varchar(200) DEFAULT NULL COMMENT '赛事照片',
- `saishi_address` varchar(200) DEFAULT NULL COMMENT '赛事地点',
- `saishi_types` int(11) DEFAULT NULL COMMENT '赛事类型 Search111',
- `saishi_content` longtext COMMENT '赛事介绍 ',
- `saishi_delete` int(11) DEFAULT NULL COMMENT '逻辑删除',
- `insert_time` timestamp NULL DEFAULT NULL COMMENT '录入时间',
- `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 photoShow',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8 COMMENT='赛事';
-
-
- CREATE TABLE `token` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `userid` bigint(20) NOT NULL COMMENT '儿童id',
- `username` varchar(100) NOT NULL COMMENT '儿童名',
- `tablename` varchar(100) DEFAULT NULL COMMENT '表名',
- `role` varchar(100) DEFAULT NULL COMMENT '角色',
- `token` varchar(200) NOT NULL COMMENT '密码',
- `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '新增时间',
- `expiratedtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '过期时间',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COMMENT='token表';
-
-
- CREATE TABLE `users` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `username` varchar(100) NOT NULL COMMENT '儿童名',
- `password` varchar(100) NOT NULL COMMENT '密码',
- `role` varchar(100) DEFAULT '管理员' COMMENT '角色',
- `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '新增时间',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='管理员';
-
-
- CREATE TABLE `yonghu` (
- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `username` varchar(200) DEFAULT NULL COMMENT '账户',
- `password` varchar(200) DEFAULT NULL COMMENT '密码',
- `yonghu_name` varchar(200) DEFAULT NULL COMMENT '用户姓名 Search111 ',
- `yonghu_phone` varchar(200) DEFAULT NULL COMMENT '用户手机号',
- `yonghu_id_number` varchar(200) DEFAULT NULL COMMENT '用户身份证号',
- `yonghu_photo` varchar(200) DEFAULT NULL COMMENT '用户头像',
- `sex_types` int(11) DEFAULT NULL COMMENT '性别',
- `yonghu_email` varchar(200) DEFAULT NULL COMMENT '用户邮箱',
- `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='用户';
-
-
- CREATE TABLE `zhuanjia` (
- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `username` varchar(200) DEFAULT NULL COMMENT '账户',
- `password` varchar(200) DEFAULT NULL COMMENT '密码',
- `zhuanjia_name` varchar(200) DEFAULT NULL COMMENT '专家姓名 Search111 ',
- `zhuanjia_phone` varchar(200) DEFAULT NULL COMMENT '专家手机号',
- `zhuanjia_id_number` varchar(200) DEFAULT NULL COMMENT '专家身份证号',
- `zhuanjia_photo` varchar(200) DEFAULT NULL COMMENT '专家头像',
- `sex_types` int(11) DEFAULT NULL COMMENT '性别',
- `zhuanjia_email` varchar(200) DEFAULT NULL COMMENT '专家邮箱',
- `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='专家';
-
- package com.controller;
-
- /**
- * 评审
- * 后端接口
- * @author 计算机编程-吉哥
- * @email
- */
- @RestController
- @Controller
- @RequestMapping("/pingshen")
- public class PingshenController {
- private static final Logger logger = LoggerFactory.getLogger(PingshenController.class);
-
- private static final String TABLE_NAME = "pingshen";
-
- @Autowired
- private PingshenService pingshenService;
-
-
- @Autowired
- private TokenService tokenService;
-
- @Autowired
- private DictionaryService dictionaryService;//字典
- @Autowired
- private ForumService forumService;//论坛
- @Autowired
- private GonggaoService gonggaoService;//竞赛公告
- @Autowired
- private HuojiangService huojiangService;//获奖
- @Autowired
- private LaoshiService laoshiService;//老师
- @Autowired
- private PingshenFenpeiService pingshenFenpeiService;//评审分配
- @Autowired
- private PingshenPingfenService pingshenPingfenService;//评审打分
- @Autowired
- private SaishiService saishiService;//赛事
- @Autowired
- private SaishiTijiaoService saishiTijiaoService;//赛事提交
- @Autowired
- private SaishiYuyueService saishiYuyueService;//赛事报名
- @Autowired
- private YonghuService yonghuService;//用户
- @Autowired
- private ZhuanjiaService zhuanjiaService;//专家
- @Autowired
- private UsersService usersService;//管理员
-
-
- /**
- * 后端列表
- */
- @RequestMapping("/page")
- public R page(@RequestParam Map
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"));
- else if("老师".equals(role))
- params.put("laoshiId",request.getSession().getAttribute("userId"));
- else if("专家".equals(role))
- params.put("zhuanjiaId",request.getSession().getAttribute("userId"));
- CommonUtil.checkMap(params);
- PageUtils page = pingshenService.queryPage(params);
-
- //字典表数据转换
- List
list =(List)page.getList(); - for(PingshenView 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);
- PingshenEntity pingshen = pingshenService.selectById(id);
- if(pingshen !=null){
- //entity转view
- PingshenView view = new PingshenView();
- BeanUtils.copyProperties( pingshen , view );//把实体数据重构到view中
- //级联表 赛事提交
- //级联表
- SaishiTijiaoEntity saishiTijiao = saishiTijiaoService.selectById(pingshen.getSaishiTijiaoId());
- if(saishiTijiao != null){
- BeanUtils.copyProperties( saishiTijiao , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "laoshiId"});//把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表
- view.setSaishiTijiaoId(saishiTijiao.getId());
- }
- //级联表 老师
- //级联表
- LaoshiEntity laoshi = laoshiService.selectById(pingshen.getLaoshiId());
- if(laoshi != null){
- BeanUtils.copyProperties( laoshi , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "laoshiId"});//把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表
- view.setLaoshiId(laoshi.getId());
- }
- //修改对应字典表字段
- dictionaryService.dictionaryConvert(view, request);
- return R.ok().put("data", view);
- }else {
- return R.error(511,"查不到数据");
- }
-
- }
-
- /**
- * 后端保存
- */
- @RequestMapping("/save")
- public R save(@RequestBody PingshenEntity pingshen, HttpServletRequest request){
- logger.debug("save方法:,,Controller:{},,pingshen:{}",this.getClass().getName(),pingshen.toString());
-
- String role = String.valueOf(request.getSession().getAttribute("role"));
- if(false)
- return R.error(511,"永远不会进入");
- else if("老师".equals(role))
- pingshen.setLaoshiId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
-
- Wrapper
queryWrapper = new EntityWrapper() - .eq("saishi_tijiao_id", pingshen.getSaishiTijiaoId())
- .eq("laoshi_id", pingshen.getLaoshiId())
- .eq("pingshen_zhidao", pingshen.getPingshenZhidao())
- ;
-
- logger.info("sql语句:"+queryWrapper.getSqlSegment());
- PingshenEntity pingshenEntity = pingshenService.selectOne(queryWrapper);
- if(pingshenEntity==null){
- pingshen.setInsertTime(new Date());
- pingshen.setCreateTime(new Date());
- pingshenService.insert(pingshen);
- return R.ok();
- }else {
- return R.error(511,"表中有相同数据");
- }
- }
-
- /**
- * 后端修改
- */
- @RequestMapping("/update")
- public R update(@RequestBody PingshenEntity pingshen, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {
- logger.debug("update方法:,,Controller:{},,pingshen:{}",this.getClass().getName(),pingshen.toString());
- PingshenEntity oldPingshenEntity = pingshenService.selectById(pingshen.getId());//查询原先数据
-
- String role = String.valueOf(request.getSession().getAttribute("role"));
- // if(false)
- // return R.error(511,"永远不会进入");
- // else if("老师".equals(role))
- // pingshen.setLaoshiId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
- if("".equals(pingshen.getPingshenFile()) || "null".equals(pingshen.getPingshenFile())){
- pingshen.setPingshenFile(null);
- }
-
- pingshenService.updateById(pingshen);//根据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
oldPingshenList =pingshenService.selectBatchIds(Arrays.asList(ids));//要删除的数据 - pingshenService.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
pingshenList = new ArrayList<>();//上传的东西 - Map
> 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
> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件
- dataList.remove(0);//删除第一行,因为第一行是提示
- for(List
data:dataList){ - //循环
- PingshenEntity pingshenEntity = new PingshenEntity();
- pingshenList.add(pingshenEntity);
- //把要查询是否重复的字段放入map中
- //报名唯一编号
- if(seachFields.containsKey("pingshenUuidNumber")){
- List
pingshenUuidNumber = seachFields.get("pingshenUuidNumber"); - pingshenUuidNumber.add(data.get(0));//要改的
- }else{
- List
pingshenUuidNumber = new ArrayList<>(); - pingshenUuidNumber.add(data.get(0));//要改的
- seachFields.put("pingshenUuidNumber",pingshenUuidNumber);
- }
- }
-
- //查询是否重复
- //报名唯一编号
- List
pingshenEntities_pingshenUuidNumber = pingshenService.selectList(new EntityWrapper().in("pingshen_uuid_number", seachFields.get("pingshenUuidNumber"))); - if(pingshenEntities_pingshenUuidNumber.size() >0 ){
- ArrayList
repeatFields = new ArrayList<>(); - for(PingshenEntity s:pingshenEntities_pingshenUuidNumber){
- repeatFields.add(s.getPingshenUuidNumber());
- }
- return R.error(511,"数据库的该表中的 [报名唯一编号] 字段已经存在 存在数据为:"+repeatFields.toString());
- }
- pingshenService.insertBatch(pingshenList);
- return R.ok();
- }
- }
- }
- }catch (Exception e){
- e.printStackTrace();
- return R.error(511,"批量插入数据异常,请联系管理员");
- }
- }
-
-
-
-
- /**
- * 前端列表
- */
- @IgnoreAuth
- @RequestMapping("/list")
- public R list(@RequestParam Map
params, HttpServletRequest request) { - logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
-
- CommonUtil.checkMap(params);
- PageUtils page = pingshenService.queryPage(params);
-
- //字典表数据转换
- List
list =(List)page.getList(); - for(PingshenView 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);
- PingshenEntity pingshen = pingshenService.selectById(id);
- if(pingshen !=null){
-
-
- //entity转view
- PingshenView view = new PingshenView();
- BeanUtils.copyProperties( pingshen , view );//把实体数据重构到view中
-
- //级联表
- SaishiTijiaoEntity saishiTijiao = saishiTijiaoService.selectById(pingshen.getSaishiTijiaoId());
- if(saishiTijiao != null){
- BeanUtils.copyProperties( saishiTijiao , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
- view.setSaishiTijiaoId(saishiTijiao.getId());
- }
- //级联表
- LaoshiEntity laoshi = laoshiService.selectById(pingshen.getLaoshiId());
- if(laoshi != null){
- BeanUtils.copyProperties( laoshi , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
- view.setLaoshiId(laoshi.getId());
- }
- //修改对应字典表字段
- dictionaryService.dictionaryConvert(view, request);
- return R.ok().put("data", view);
- }else {
- return R.error(511,"查不到数据");
- }
- }
-
-
- /**
- * 前端保存
- */
- @RequestMapping("/add")
- public R add(@RequestBody PingshenEntity pingshen, HttpServletRequest request){
- logger.debug("add方法:,,Controller:{},,pingshen:{}",this.getClass().getName(),pingshen.toString());
- Wrapper
queryWrapper = new EntityWrapper() - .eq("pingshen_uuid_number", pingshen.getPingshenUuidNumber())
- .eq("saishi_tijiao_id", pingshen.getSaishiTijiaoId())
- .eq("laoshi_id", pingshen.getLaoshiId())
- .eq("pingshen_zhidao", pingshen.getPingshenZhidao())
- .eq("pingshen_text", pingshen.getPingshenText())
- // .notIn("pingshen_types", new Integer[]{102})
- ;
- logger.info("sql语句:"+queryWrapper.getSqlSegment());
- PingshenEntity pingshenEntity = pingshenService.selectOne(queryWrapper);
- if(pingshenEntity==null){
- pingshen.setInsertTime(new Date());
- pingshen.setCreateTime(new Date());
- pingshenService.insert(pingshen);
-
- return R.ok();
- }else {
- return R.error(511,"表中有相同数据");
- }
- }
-
- }
-
- package com.service;
-
- import com.baomidou.mybatisplus.service.IService;
- import com.utils.PageUtils;
- import com.entity.PingshenEntity;
- import java.util.Map;
- import javax.servlet.http.HttpServletRequest;
- import org.springframework.lang.Nullable;
- import java.util.List;
-
- /**
- * 评审 服务类
- */
- public interface PingshenService extends IService
{ -
- /**
- * @param params 查询参数
- * @return 带分页的查询出来的数据
- */
- PageUtils queryPage(Map
params) ; -
- }
- package com.service.impl;
-
- /**
- * 评审 服务实现类
- */
- @Service("pingshenService")
- @Transactional
- public class PingshenServiceImpl extends ServiceImpl
implements PingshenService { -
- @Override
- public PageUtils queryPage(Map
params) { - Page
page =new Query(params).getPage(); - page.setRecords(baseMapper.selectListView(page,params));
- return new PageUtils(page);
- }
-
-
- }
- package com.dao;
-
- import com.entity.PingshenEntity;
- import com.baomidou.mybatisplus.mapper.BaseMapper;
- import java.util.List;
- import java.util.Map;
- import com.baomidou.mybatisplus.plugins.pagination.Pagination;
-
- import org.apache.ibatis.annotations.Param;
- import com.entity.view.PingshenView;
-
- /**
- * 评审 Dao 接口
- *
- * @author
- */
- public interface PingshenDao extends BaseMapper
{ -
- List
selectListView(Pagination page,@Param("params")Map params) ; -
- }
你可能还有感兴趣的项目👇🏻👇🏻👇🏻
更多项目推荐:计算机毕业设计项目
如果大家有任何疑虑,请在下方咨询或评论