Merge branch 'master' of D:\idea\work\tms with conflicts.

hehai
pd 4 years ago
parent e321bec332
commit 1541e1d492
  1. 58
      src/main/java/com/msdw/tms/common/utils/Constant.java
  2. 79
      src/main/java/com/msdw/tms/controller/ProjectController.java
  3. 78
      src/main/java/com/msdw/tms/controller/ProjectRecordController.java
  4. 17
      src/main/java/com/msdw/tms/dao/ProjectDao.java
  5. 17
      src/main/java/com/msdw/tms/dao/ProjectRecordDao.java
  6. 69
      src/main/java/com/msdw/tms/entity/ProjectEntity.java
  7. 60
      src/main/java/com/msdw/tms/entity/ProjectRecordEntity.java
  8. 48
      src/main/java/com/msdw/tms/entity/UserEntity.java
  9. 9
      src/main/java/com/msdw/tms/entity/vo/ProjectEntityVo.java
  10. 39
      src/main/java/com/msdw/tms/entity/vo/UserEntityVo.java
  11. 20
      src/main/java/com/msdw/tms/service/ProjectRecordService.java
  12. 23
      src/main/java/com/msdw/tms/service/ProjectService.java
  13. 29
      src/main/java/com/msdw/tms/service/impl/ProjectRecordServiceImpl.java
  14. 52
      src/main/java/com/msdw/tms/service/impl/ProjectServiceImpl.java
  15. 6
      src/main/java/com/msdw/tms/service/impl/QuestionsServiceImpl.java
  16. 22
      src/main/resources/mapper/tms/ProjectDao.xml
  17. 20
      src/main/resources/mapper/tms/ProjectRecordDao.xml
  18. 45
      src/test/java/com/msdw/tms/Main.java
  19. 1
      src/test/java/com/msdw/tms/TmsApplicationTests.java

@ -18,6 +18,18 @@ public class Constant {
* 超级管理员ID * 超级管理员ID
*/ */
public static final int SUPER_ADMIN = 1; 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; 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) { public void setDesc(String desc) {
this.desc = 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);
// }
} }

@ -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<String, Object> 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();
}
}

@ -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<String, Object> 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();
}
}

@ -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<ProjectEntity> {
}

@ -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<ProjectRecordEntity> {
}

@ -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;
}

@ -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;
}

@ -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;
}

@ -0,0 +1,9 @@
package com.msdw.tms.entity.vo;
import java.io.Serializable;
public class ProjectEntityVo implements Serializable {
private Integer RoleId;
}

@ -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<UserEntity> user;
}

@ -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<ProjectRecordEntity> {
PageUtils queryPage(Map<String, Object> params);
}

@ -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<ProjectEntity> {
PageUtils queryPage(Map<String, Object> params);
public List<ProjectEntity> list(Integer page, Integer size,ProjectEntity project);
}

@ -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<ProjectRecordDao, ProjectRecordEntity> implements ProjectRecordService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<ProjectRecordEntity> page = this.page(
new Query<ProjectRecordEntity>().getPage(params),
new QueryWrapper<ProjectRecordEntity>()
);
return new PageUtils(page);
}
}

@ -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<ProjectDao, ProjectEntity> implements ProjectService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<ProjectEntity> page = this.page(
new Query<ProjectEntity>().getPage(params),
new QueryWrapper<ProjectEntity>()
);
return new PageUtils(page);
}
@Override
public List<ProjectEntity> list(Integer page, Integer size,ProjectEntity project) {
//请求包装类
QueryWrapper<ProjectEntity> 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<ProjectEntity> projects = this.page(
new Query<ProjectEntity>().getPage(page, size),
queryWrapper
);
return null;
}
}

@ -281,10 +281,6 @@ public class QuestionsServiceImpl extends ServiceImpl<QuestionsDao, QuestionsEnt
/** /**
* 校验题干重复和题型不对的从列表中将该题剔除名称相同的要去重 * 校验题干重复和题型不对的从列表中将该题剔除名称相同的要去重
*
* @param file
* @return
* @throws IOException
*/ */
@Override @Override
@Transactional @Transactional
@ -378,7 +374,7 @@ public class QuestionsServiceImpl extends ServiceImpl<QuestionsDao, QuestionsEnt
BeanUtils.copyProperties(evaluationRules, evaluation); BeanUtils.copyProperties(evaluationRules, evaluation);
Integer evaluationType = evaluationRules.getEvaluationType(); Integer evaluationType = evaluationRules.getEvaluationType();
if (evaluationType == Constant.RulesType.RANDOM.getType()) {//随机 if (evaluationType.equals(Constant.RulesType.RANDOM.getType())) {//随机
// 类型为随机,直接用题目数量 // 类型为随机,直接用题目数量
Integer questionNum = evaluationRules.getQuestionNum(); Integer questionNum = evaluationRules.getQuestionNum();
// 查询题库所有未删除,未禁用的题目id // 查询题库所有未删除,未禁用的题目id

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.msdw.tms.dao.ProjectDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.msdw.tms.entity.ProjectEntity" id="projectMap">
<result property="projectid" column="projectId"/>
<result property="projectname" column="projectName"/>
<result property="projecttarget" column="projectTarget"/>
<result property="projectdescribe" column="projectDescribe"/>
<result property="isprojectdata" column="isProjectData"/>
<result property="projecttips" column="projectTips"/>
<result property="projectstate" column="projectState"/>
<result property="ascription" column="ascription"/>
<result property="userid" column="userId"/>
<result property="creationtime" column="creationTime"/>
<result property="isdel" column="isdel"/>
</resultMap>
</mapper>

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yipin.liuwanr.fictitious.dao.ProjectRecordDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.yipin.liuwanr.fictitious.entity.ProjectRecordEntity" id="projectRecordMap">
<result property="recordid" column="recordId"/>
<result property="userid" column="userId"/>
<result property="projectid" column="projectId"/>
<result property="score" column="score"/>
<result property="recordstate" column="recordState"/>
<result property="startingtime" column="startingTime"/>
<result property="endtime" column="endTime"/>
<result property="submittime" column="submitTime"/>
<result property="isdel" column="isdel"/>
</resultMap>
</mapper>

@ -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<ProjectEntity> 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<ProjectEntity>() {
@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);
}
}
}

@ -54,5 +54,4 @@ class TmsApplicationTests {
// String DateNow = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss")); // 当前日期和时间 // String DateNow = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss")); // 当前日期和时间
System.out.println(DateNow); System.out.println(DateNow);
} }
} }

Loading…
Cancel
Save