From 1541e1d492e1859856551fa4641e749dacaa108c Mon Sep 17 00:00:00 2001 From: pd <2776455882@qq.com> Date: Fri, 21 Aug 2020 10:29:01 +0800 Subject: [PATCH] Merge branch 'master' of D:\idea\work\tms with conflicts. --- .../com/msdw/tms/common/utils/Constant.java | 58 ++++++++++++++ .../tms/controller/ProjectController.java | 79 +++++++++++++++++++ .../controller/ProjectRecordController.java | 78 ++++++++++++++++++ .../java/com/msdw/tms/dao/ProjectDao.java | 17 ++++ .../com/msdw/tms/dao/ProjectRecordDao.java | 17 ++++ .../com/msdw/tms/entity/ProjectEntity.java | 69 ++++++++++++++++ .../msdw/tms/entity/ProjectRecordEntity.java | 60 ++++++++++++++ .../java/com/msdw/tms/entity/UserEntity.java | 48 +++++++++++ .../msdw/tms/entity/vo/ProjectEntityVo.java | 9 +++ .../com/msdw/tms/entity/vo/UserEntityVo.java | 39 +++++++++ .../tms/service/ProjectRecordService.java | 20 +++++ .../com/msdw/tms/service/ProjectService.java | 23 ++++++ .../impl/ProjectRecordServiceImpl.java | 29 +++++++ .../tms/service/impl/ProjectServiceImpl.java | 52 ++++++++++++ .../service/impl/QuestionsServiceImpl.java | 6 +- src/main/resources/mapper/tms/ProjectDao.xml | 22 ++++++ .../resources/mapper/tms/ProjectRecordDao.xml | 20 +++++ src/test/java/com/msdw/tms/Main.java | 45 +++++++++++ .../com/msdw/tms/TmsApplicationTests.java | 1 - 19 files changed, 686 insertions(+), 6 deletions(-) create mode 100644 src/main/java/com/msdw/tms/controller/ProjectController.java create mode 100644 src/main/java/com/msdw/tms/controller/ProjectRecordController.java create mode 100644 src/main/java/com/msdw/tms/dao/ProjectDao.java create mode 100644 src/main/java/com/msdw/tms/dao/ProjectRecordDao.java create mode 100644 src/main/java/com/msdw/tms/entity/ProjectEntity.java create mode 100644 src/main/java/com/msdw/tms/entity/ProjectRecordEntity.java create mode 100644 src/main/java/com/msdw/tms/entity/UserEntity.java create mode 100644 src/main/java/com/msdw/tms/entity/vo/ProjectEntityVo.java create mode 100644 src/main/java/com/msdw/tms/entity/vo/UserEntityVo.java create mode 100644 src/main/java/com/msdw/tms/service/ProjectRecordService.java create mode 100644 src/main/java/com/msdw/tms/service/ProjectService.java create mode 100644 src/main/java/com/msdw/tms/service/impl/ProjectRecordServiceImpl.java create mode 100644 src/main/java/com/msdw/tms/service/impl/ProjectServiceImpl.java create mode 100644 src/main/resources/mapper/tms/ProjectDao.xml create mode 100644 src/main/resources/mapper/tms/ProjectRecordDao.xml create mode 100644 src/test/java/com/msdw/tms/Main.java diff --git a/src/main/java/com/msdw/tms/common/utils/Constant.java b/src/main/java/com/msdw/tms/common/utils/Constant.java index 9562d95..831d575 100644 --- a/src/main/java/com/msdw/tms/common/utils/Constant.java +++ b/src/main/java/com/msdw/tms/common/utils/Constant.java @@ -18,6 +18,18 @@ public class Constant { * 超级管理员ID */ public static final int SUPER_ADMIN = 1; + /** + * 管理员 + */ + public static final int ADMIN = 2; + /** + * 教师 + */ + public static final int TEACHER = 3; + /** + * 学生 + */ + public static final int STUDENT = 4; /** * 当前页码 */ @@ -204,6 +216,7 @@ public class Constant { } } + /** * 是否删除 */ @@ -317,9 +330,54 @@ public class Constant { return desc; } + public void setDesc(String desc) { + this.desc = desc; + } + + } + public enum Submit{ + + SUBMIT (1,"已提交"), + NOT_SUBMIT (0,"未提交"); + + + private Integer type; + private String desc; + + Submit(Integer type, String desc){ + this.type = type; + this.desc = desc; + }; + + public Integer getType() { + return type; + } + + public void setType(Integer type) { + this.type = type; + } + + public String getDesc() { + return desc; + } + public void setDesc(String desc) { this.desc = desc; } } + +// public static void main(String[] args) { +// String answer = "A"; +//// System.out.println(answer.length());//3 +//// System.out.println(answer.charAt(2));//E +// +// String str = ""; +// for (int i = 0; i < answer.length(); i++) { +// char c = answer.charAt(i); +// str += c + ","; +// } +// str = str.substring(0, str.length() - 1); +// System.out.println(str); +// } } \ No newline at end of file diff --git a/src/main/java/com/msdw/tms/controller/ProjectController.java b/src/main/java/com/msdw/tms/controller/ProjectController.java new file mode 100644 index 0000000..8a85f1f --- /dev/null +++ b/src/main/java/com/msdw/tms/controller/ProjectController.java @@ -0,0 +1,79 @@ +package com.msdw.tms.controller; + +import com.msdw.tms.common.utils.PageUtils; +import com.msdw.tms.common.utils.R; +import com.msdw.tms.entity.ProjectEntity; +import com.msdw.tms.service.ProjectService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Arrays; +import java.util.Map; + + +/** + * + * + * @author + * @email + * @date 2020-08-19 16:07:02 + */ +@RestController +@RequestMapping("fictitious/project") +public class ProjectController { + + @Autowired + private ProjectService projectService; + + /** + * 列表 + */ + @RequestMapping("/list") + public R list(@RequestParam Map params){ + PageUtils page = projectService.queryPage(params); + + return R.ok().put("page", page); + } + + + /** + * 信息 + */ + @RequestMapping("/info/{projectid}") + public R info(@PathVariable("projectid") Integer projectid){ + ProjectEntity project = projectService.getById(projectid); + + return R.ok().put("project", project); + } + + /** + * 保存 + */ + @RequestMapping("/save") + public R save(@RequestBody ProjectEntity project){ + projectService.save(project); + + return R.ok(); + } + + /** + * 修改 + */ + @RequestMapping("/update") + public R update(@RequestBody ProjectEntity project){ + projectService.updateById(project); + + return R.ok(); + } + + /** + * 删除 + */ + @RequestMapping("/delete") + public R delete(@RequestBody Integer[] projectids){ + projectService.removeByIds(Arrays.asList(projectids)); + + return R.ok(); + } + +} diff --git a/src/main/java/com/msdw/tms/controller/ProjectRecordController.java b/src/main/java/com/msdw/tms/controller/ProjectRecordController.java new file mode 100644 index 0000000..b3f0c8a --- /dev/null +++ b/src/main/java/com/msdw/tms/controller/ProjectRecordController.java @@ -0,0 +1,78 @@ +package com.msdw.tms.controller; + +import com.msdw.tms.common.utils.PageUtils; +import com.msdw.tms.common.utils.R; +import com.msdw.tms.entity.ProjectRecordEntity; +import com.msdw.tms.service.ProjectRecordService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Arrays; +import java.util.Map; + + +/** + * + * + * @author + * @email + * @date 2020-08-19 16:07:02 + */ +@RestController +@RequestMapping("fictitious/projectrecord") +public class ProjectRecordController { + @Autowired + private ProjectRecordService projectRecordService; + + /** + * 列表 + */ + @RequestMapping("/list") + public R list(@RequestParam Map params){ + PageUtils page = projectRecordService.queryPage(params); + + return R.ok().put("page", page); + } + + + /** + * 信息 + */ + @RequestMapping("/info/{recordid}") + public R info(@PathVariable("recordid") Integer recordid){ + ProjectRecordEntity projectRecord = projectRecordService.getById(recordid); + + return R.ok().put("projectRecord", projectRecord); + } + + /** + * 保存 + */ + @RequestMapping("/save") + public R save(@RequestBody ProjectRecordEntity projectRecord){ + projectRecordService.save(projectRecord); + + return R.ok(); + } + + /** + * 修改 + */ + @RequestMapping("/update") + public R update(@RequestBody ProjectRecordEntity projectRecord){ + projectRecordService.updateById(projectRecord); + + return R.ok(); + } + + /** + * 删除 + */ + @RequestMapping("/delete") + public R delete(@RequestBody Integer[] recordids){ + projectRecordService.removeByIds(Arrays.asList(recordids)); + + return R.ok(); + } + +} diff --git a/src/main/java/com/msdw/tms/dao/ProjectDao.java b/src/main/java/com/msdw/tms/dao/ProjectDao.java new file mode 100644 index 0000000..595fc38 --- /dev/null +++ b/src/main/java/com/msdw/tms/dao/ProjectDao.java @@ -0,0 +1,17 @@ +package com.msdw.tms.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.msdw.tms.entity.ProjectEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * + * + * @author + * @email + * @date 2020-08-19 16:07:02 + */ +@Mapper +public interface ProjectDao extends BaseMapper { + +} diff --git a/src/main/java/com/msdw/tms/dao/ProjectRecordDao.java b/src/main/java/com/msdw/tms/dao/ProjectRecordDao.java new file mode 100644 index 0000000..ef1642c --- /dev/null +++ b/src/main/java/com/msdw/tms/dao/ProjectRecordDao.java @@ -0,0 +1,17 @@ +package com.msdw.tms.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.msdw.tms.entity.ProjectRecordEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * + * + * @author + * @email + * @date 2020-08-19 16:07:02 + */ +@Mapper +public interface ProjectRecordDao extends BaseMapper { + +} diff --git a/src/main/java/com/msdw/tms/entity/ProjectEntity.java b/src/main/java/com/msdw/tms/entity/ProjectEntity.java new file mode 100644 index 0000000..c6ba9f9 --- /dev/null +++ b/src/main/java/com/msdw/tms/entity/ProjectEntity.java @@ -0,0 +1,69 @@ +package com.msdw.tms.entity; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * + * + * @author + * @email + * @date 2020-08-19 16:07:02 + */ +@Data +@TableName("tms_project") +public class ProjectEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 实验项目id + */ + @TableId + private Integer projectid; + /** + * 实验项目名称 + */ + private String projectname; + /** + * 实验目标 + */ + private String projecttarget; + /** + * 实验描述 + */ + private String projectdescribe; + /** + * 实验描述(0开启 1未开启) + */ + private Integer isprojectdata; + /** + * 实验提示 + */ + private String projecttips; + /** + * 实验状态(0已发布 1未发布) + */ + private Integer projectstate; + /** + * 归属 + */ + private Integer ascription; + /** + * 创建人 + */ + private Integer userid; + /** + * 创建时间 + */ + private Date creationtime; + /** + * 删除(0未删除 1已删除) + */ + private Integer isdel; + +} diff --git a/src/main/java/com/msdw/tms/entity/ProjectRecordEntity.java b/src/main/java/com/msdw/tms/entity/ProjectRecordEntity.java new file mode 100644 index 0000000..7ac6665 --- /dev/null +++ b/src/main/java/com/msdw/tms/entity/ProjectRecordEntity.java @@ -0,0 +1,60 @@ +package com.msdw.tms.entity; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * + * + * @author + * @email + * @date 2020-08-19 16:07:02 + */ +@Data +@TableName("tms_project_record") +public class ProjectRecordEntity implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 记录id + */ + @TableId + private Integer recordid; + /** + * 用户id + */ + private Integer userid; + /** + * 实验项目id + */ + private Integer projectid; + /** + * 得分 + */ + private Integer score; + /** + * 记录状态 + */ + private Integer recordstate; + /** + * 起始时间 + */ + private Date startingtime; + /** + * 结束时间 + */ + private Date endtime; + /** + * 提交时间 + */ + private Date submittime; + /** + * 删除(0未删除 1已删除) + */ + private Integer isdel; + +} diff --git a/src/main/java/com/msdw/tms/entity/UserEntity.java b/src/main/java/com/msdw/tms/entity/UserEntity.java new file mode 100644 index 0000000..69cb3f3 --- /dev/null +++ b/src/main/java/com/msdw/tms/entity/UserEntity.java @@ -0,0 +1,48 @@ +package com.msdw.tms.entity; + +import lombok.Data; + +@Data +public class UserEntity { + //用户id + private Integer userId; + //用户姓名 + private String userName; + //用户账号 + private String account; + //用户密码 + private String password; + //国家 + private String countries; + //绑定省份id + private Integer provinceId; + //绑定城市id + private Integer cityId; + //创建时间 + private String creationTime; + //登陆次数 + private Integer logInNumber; + //性别 + private Integer sex; + //证件类型(1、身份证) + private Integer documentType; + //身份证 + private String IDNumber; + //教育程度(1、研究数及以上) + private Integer educationDegree; + //电话 + private String phone; + //微信账号 + private String WeChatID; + //出生日期 + private String dateBirth; + //邮箱 + private String email; + //学校id + private Integer schoolId; + //唯一标示性账号 + private String uniqueIdentificationAccount; + //用户头像路径 + private String userAvatars; + +} diff --git a/src/main/java/com/msdw/tms/entity/vo/ProjectEntityVo.java b/src/main/java/com/msdw/tms/entity/vo/ProjectEntityVo.java new file mode 100644 index 0000000..b549376 --- /dev/null +++ b/src/main/java/com/msdw/tms/entity/vo/ProjectEntityVo.java @@ -0,0 +1,9 @@ +package com.msdw.tms.entity.vo; + +import java.io.Serializable; + +public class ProjectEntityVo implements Serializable { + + private Integer RoleId; + +} diff --git a/src/main/java/com/msdw/tms/entity/vo/UserEntityVo.java b/src/main/java/com/msdw/tms/entity/vo/UserEntityVo.java new file mode 100644 index 0000000..fd3b76d --- /dev/null +++ b/src/main/java/com/msdw/tms/entity/vo/UserEntityVo.java @@ -0,0 +1,39 @@ +package com.msdw.tms.entity.vo; + +import com.msdw.tms.entity.UserEntity; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class UserEntityVo extends UserEntity implements Serializable { + + //搜索内容 + private String searchContent; + //学校名称 + private String schoolName; + //省份名称 + private String provinceName; + //城市名称 + private String cityName; + //条件查询月 + private Integer month; + //条件查询结束时间 + private String endTime; + //专业类ID + private Integer professionalClassId; + //专业类名称 + private String professionalClassName; + //学科ID + private Integer disciplineId; + //学科名称 + private String disciplineName; + //专业id + private Integer professionalId; + //专业名称 + private String professionalName; + + private List user; + +} diff --git a/src/main/java/com/msdw/tms/service/ProjectRecordService.java b/src/main/java/com/msdw/tms/service/ProjectRecordService.java new file mode 100644 index 0000000..663bdc6 --- /dev/null +++ b/src/main/java/com/msdw/tms/service/ProjectRecordService.java @@ -0,0 +1,20 @@ +package com.msdw.tms.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.msdw.tms.common.utils.PageUtils; +import com.msdw.tms.entity.ProjectRecordEntity; + +import java.util.Map; + +/** + * + * + * @author + * @email + * @date 2020-08-19 16:07:02 + */ +public interface ProjectRecordService extends IService { + + PageUtils queryPage(Map params); +} + diff --git a/src/main/java/com/msdw/tms/service/ProjectService.java b/src/main/java/com/msdw/tms/service/ProjectService.java new file mode 100644 index 0000000..accc909 --- /dev/null +++ b/src/main/java/com/msdw/tms/service/ProjectService.java @@ -0,0 +1,23 @@ +package com.msdw.tms.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.msdw.tms.common.utils.PageUtils; +import com.msdw.tms.entity.ProjectEntity; + +import java.util.List; +import java.util.Map; + +/** + * + * + * @author + * @email + * @date 2020-08-19 16:07:02 + */ +public interface ProjectService extends IService { + + PageUtils queryPage(Map params); + + public List list(Integer page, Integer size,ProjectEntity project); +} + diff --git a/src/main/java/com/msdw/tms/service/impl/ProjectRecordServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/ProjectRecordServiceImpl.java new file mode 100644 index 0000000..0430590 --- /dev/null +++ b/src/main/java/com/msdw/tms/service/impl/ProjectRecordServiceImpl.java @@ -0,0 +1,29 @@ +package com.msdw.tms.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.msdw.tms.common.utils.PageUtils; +import com.msdw.tms.common.utils.Query; +import com.msdw.tms.dao.ProjectRecordDao; +import com.msdw.tms.entity.ProjectRecordEntity; +import com.msdw.tms.service.ProjectRecordService; +import org.springframework.stereotype.Service; + +import java.util.Map; + + +@Service("projectRecordService") +public class ProjectRecordServiceImpl extends ServiceImpl implements ProjectRecordService { + + @Override + public PageUtils queryPage(Map params) { + IPage page = this.page( + new Query().getPage(params), + new QueryWrapper() + ); + + return new PageUtils(page); + } + +} \ No newline at end of file diff --git a/src/main/java/com/msdw/tms/service/impl/ProjectServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/ProjectServiceImpl.java new file mode 100644 index 0000000..294626f --- /dev/null +++ b/src/main/java/com/msdw/tms/service/impl/ProjectServiceImpl.java @@ -0,0 +1,52 @@ +package com.msdw.tms.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.msdw.tms.common.utils.Constant; +import com.msdw.tms.common.utils.PageUtils; +import com.msdw.tms.common.utils.Query; +import com.msdw.tms.dao.ProjectDao; +import com.msdw.tms.entity.ProjectEntity; +import com.msdw.tms.service.ProjectService; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; + + +@Service("projectService") +public class ProjectServiceImpl extends ServiceImpl implements ProjectService { + + @Override + public PageUtils queryPage(Map params) { + IPage page = this.page( + new Query().getPage(params), + + new QueryWrapper() + ); + + return new PageUtils(page); + } + + @Override + public List list(Integer page, Integer size,ProjectEntity project) { + + //请求包装类 + QueryWrapper queryWrapper = new QueryWrapper<>(); + + Integer userid = project.getUserid(); + queryWrapper.eq("is_del", Constant.IsDel.NOT_DEL.getType()) + .eq("projectState", Constant.Submit.SUBMIT.getType()) + .eq("userId",userid); + + queryWrapper.select("projectId","projectName").groupBy("projectId"); + + IPage projects = this.page( + new Query().getPage(page, size), + queryWrapper + ); + + return null; + } +} \ No newline at end of file diff --git a/src/main/java/com/msdw/tms/service/impl/QuestionsServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/QuestionsServiceImpl.java index f282bb7..f324752 100644 --- a/src/main/java/com/msdw/tms/service/impl/QuestionsServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/QuestionsServiceImpl.java @@ -281,10 +281,6 @@ public class QuestionsServiceImpl extends ServiceImpl + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/tms/ProjectRecordDao.xml b/src/main/resources/mapper/tms/ProjectRecordDao.xml new file mode 100644 index 0000000..e4c6ea0 --- /dev/null +++ b/src/main/resources/mapper/tms/ProjectRecordDao.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/java/com/msdw/tms/Main.java b/src/test/java/com/msdw/tms/Main.java new file mode 100644 index 0000000..ca7a67a --- /dev/null +++ b/src/test/java/com/msdw/tms/Main.java @@ -0,0 +1,45 @@ +package com.msdw.tms; + +import com.msdw.tms.entity.ProjectEntity; +import org.springframework.util.StringUtils; + +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; + +public class Main { + + public static void main(String[] args) { + + List project = new ArrayList<>(); + ProjectEntity p1 = new ProjectEntity(); + p1.setProjectid(1); + p1.setProjectname("1"); + project.add(p1); + + ProjectEntity p2 = new ProjectEntity(); + p2.setProjectid(3); + p2.setProjectname("3"); + project.add(p2); + + ProjectEntity p3 = new ProjectEntity(); + p3.setProjectid(2); + p3.setProjectname("2"); + project.add(p3); + + project.sort(new Comparator() { + @Override + public int compare(ProjectEntity o1, ProjectEntity o2) { + if(StringUtils.isEmpty(o1.getProjectid()) || StringUtils.isEmpty(o2.getProjectid()) ) + return 0; + return o1.getProjectid().compareTo(o2.getProjectid()); + } + }); + + for (ProjectEntity pro:project) { + System.out.println(pro); + } + } + +} + diff --git a/src/test/java/com/msdw/tms/TmsApplicationTests.java b/src/test/java/com/msdw/tms/TmsApplicationTests.java index 641de60..f8576e2 100644 --- a/src/test/java/com/msdw/tms/TmsApplicationTests.java +++ b/src/test/java/com/msdw/tms/TmsApplicationTests.java @@ -54,5 +54,4 @@ class TmsApplicationTests { // String DateNow = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss")); // 当前日期和时间 System.out.println(DateNow); } - }