完成项目管理

master
zhiyong.ning 4 years ago
parent a079c9e9c9
commit 8381216bf4
  1. 6
      pom.xml
  2. 56
      src/main/java/com/yipin/liuwanr/controller/ProjectManagementController.java
  3. 6
      src/main/java/com/yipin/liuwanr/entity/ManagementAndPointVo.java
  4. 48
      src/main/java/com/yipin/liuwanr/entity/ProjectManagement.java
  5. 53
      src/main/java/com/yipin/liuwanr/mapper/ProjectManagementMapper.java
  6. 58
      src/main/java/com/yipin/liuwanr/service/ProjectManagementService.java
  7. 5
      src/main/resources/application.properties
  8. 20
      src/test/java/com/yipin/liuwanr/Project_ManagementTest.java

@ -9,10 +9,10 @@
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.pdxm</groupId>
<artifactId>project_maagement-1</artifactId>
<artifactId>projectManagement</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>project_maagement-1</name>
<packaging>jar</packaging>
<name>projectManagement</name>
<description>我的第一个springboot程序</description>
<properties>

@ -3,6 +3,7 @@ package com.yipin.liuwanr.controller;
import java.util.HashMap;
import java.util.List;
import com.yipin.liuwanr.entity.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -16,21 +17,17 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.yipin.liuwanr.entity.Judgment_Points;
import com.yipin.liuwanr.entity.ManagementAndPointVo;
import com.yipin.liuwanr.entity.Project_Management;
import com.yipin.liuwanr.entity.Response;
import com.yipin.liuwanr.entity.Role;
import com.yipin.liuwanr.service.Project_ManagementService;
import com.yipin.liuwanr.entity.ProjectManagement;
import com.yipin.liuwanr.service.ProjectManagementService;
@Api(value = "项目管理", tags = "项目管理相关方法")
@RestController
@RequestMapping("/ProjectManagement")
@CrossOrigin
public class Project_ManagementController {
public class ProjectManagementController {
@Autowired
private Project_ManagementService service;
private ProjectManagementService service;
/**
* 查询用户角色
@ -67,7 +64,8 @@ public class Project_ManagementController {
*/
@ApiOperation(value = "项目管理列表", notes = "项目管理列表")
@GetMapping("/queryAllManagements")
Response queryAllManagements(@ApiParam(name = "projectPermissions", value = "项目权限(0、练习 1、考核 2、竞赛)", required = false) @RequestParam(required = false) Integer projectPermissions,
Response queryAllManagements(
@ApiParam(name = "projectPermissions", value = "项目权限(0、练习 1、考核 2、竞赛)", required = false) @RequestParam(required = false) Integer projectPermissions,
@ApiParam(name = "founder", value = "项目创建人(0、系统 1、老师)", required = false) @RequestParam(required = false) Integer founder,
@ApiParam(name = "state", value = "项目状态(0、草稿箱 1、已发布)", required = false) @RequestParam(required = false) Integer state,
@ApiParam(name = "projectName", value = "项目名称", required = false) @RequestParam(required = false) String projectName,
@ -76,7 +74,7 @@ public class Project_ManagementController {
@ApiParam(name = "pageNo", value = "第几页,页码", required = true) @RequestParam Integer pageNo,
@ApiParam(name = "pageSize", value = "每页展示的数据条数", required = true) @RequestParam Integer pageSize) {
Response resp = new Response();
Project_Management vo = new Project_Management();
ProjectManagement vo = new ProjectManagement();
if (null != projectPermissions) {
vo.setProjectPermissions(projectPermissions);
}
@ -110,14 +108,14 @@ public class Project_ManagementController {
/**
* 批量删除
*
* @param point 项目id集合
* @param projectId 项目id集合
* @return
*/
@ApiOperation(value = "批量删除", notes = "批量删除")
@PostMapping("/removeProjectManagement")
Response removeProjectManagement(@ApiParam(name = "point", value = "项目主键Id", required = true) @RequestBody List<Integer> point) {
Response removeProjectManagement(@ApiParam(name = "projectId", value = "项目主键Id", required = true) @RequestBody List<Integer> projectId) {
Response resp = new Response();
HashMap<String, Object> ret = service.deleteProjectManagement(point);
HashMap<String, Object> ret = service.deleteProjectManagement(projectId);
int status = (int) ret.get("retcode");
if (status == 200) {
resp.setStatus(status);
@ -310,7 +308,7 @@ public class Project_ManagementController {
@PostMapping("/addProjectManagement")
Response insertProjectManagement(@RequestBody @ApiParam(name = "新建项目管理所需类", value = "传入json格式", required = true) ManagementAndPointVo vo) {
Response resp = new Response();
Project_Management pro = vo.getManagement();
ProjectManagement pro = vo.getManagement();
List<Judgment_Points> points = vo.getPooints();
List<Integer> roles = vo.getRoleId();
if (StringUtils.isEmpty(pro)) {
@ -344,6 +342,28 @@ public class Project_ManagementController {
return resp;
}
/**
* 查询单个项目判分点信息根据项目id
*
* @param projectId 项目id
* @return
*/
@ApiOperation(value = "查询单个项目判分点信息", notes = "查询单个项目判分点信息")
@GetMapping("/getJudgmentPoints")
Response getJudgmentPoints(@ApiParam(name = "projectId", value = "项目id", required = true) @RequestParam Integer projectId) {
Response resp = new Response();
HashMap<String, Object> ret = service.getJudgmentPoints(projectId);
int status = (int) ret.get("retcode");
if (status == 200) {
resp.setStatus(status);
resp.setMessage(ret.get("retvalue"));
} else {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
}
return resp;
}
/**
* 修改项目管理信息
*
@ -354,24 +374,24 @@ public class Project_ManagementController {
@PostMapping("/updateProjectManagement")
Response updateProjectManagement(@ApiParam(name = "新建项目管理所需类", value = "传入json格式", required = true) @RequestBody ManagementAndPointVo vo) {
Response resp = new Response();
Project_Management pro = vo.getManagement();
ProjectManagement pro = vo.getManagement();
List<Judgment_Points> points = vo.getPooints();
List<Integer> roles = vo.getRoleId();
if (StringUtils.isEmpty(pro)) {
resp.setStatus(300);
resp.setMessage("management cannot be empty");
resp.setMessage("项目管理为空,修改失败!");
return resp;
}
if (points.isEmpty() || points.size() <= 0) {
resp.setStatus(300);
resp.setMessage("pooints cannot be empty");
resp.setMessage("判分点为空,修改失败!");
return resp;
}
if (pro.getIsstartexperimental() == 0) {//开启实验数据
if (roles.isEmpty() || roles.size() <= 0) {
resp.setStatus(300);
resp.setMessage("roleId cannot be empty");
resp.setMessage("角色id为空,修改失败!");
return resp;
}
}

@ -8,7 +8,7 @@ import java.util.List;
@ApiModel(value = "ManagementAndPointVo对象", description = "添加项目管理对象ManagementAndPointVo")
public class ManagementAndPointVo {
@ApiModelProperty(value = "项目管理实体类", name = "management", required = true)
private Project_Management management;//项目管理
private ProjectManagement management;//项目管理
//@ApiModelProperty(value = "判分点信息列表,key:判分点主键 value:分数", name = "pooints", example = "[{\"judgmentPointsId\":184,\"judgmentPointsName\":\"列表——元素的修改 \",\"experimentalRequirements\":\"新学期开始,老师组织了学习小组,该学习小组有A,B,C,D五个学生\\nList1=[''A'',''B'',''C'',''D'']\\n列表元素-修改-请使用下标索引\\n第三天上课,老师发现把E同学的名字打错了,应该T。请修改并打印本小组的全体学生\",\"score\":\"100\"}]", required = true)
@ApiModelProperty(value = "判分点信息列表,key:判分点主键 value:分数", name = "pooints", required = true)
@ -17,11 +17,11 @@ public class ManagementAndPointVo {
@ApiModelProperty(value = "角色id列表", name = "roleId", example = "[403]", required = true)
private List<Integer> roleId;//存储角色id
public Project_Management getManagement() {
public ProjectManagement getManagement() {
return management;
}
public void setManagement(Project_Management management) {
public void setManagement(ProjectManagement management) {
this.management = management;
}

@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
* @author 86151
*/
@ApiModel(value = "Project_Management对象", description = "项目管理对象Project_Management")
public class Project_Management {
public class ProjectManagement {
@ApiModelProperty(value = "项目主键ID,编辑项目需要传,新增项目不需要传", name = "projectId", example = "223")
private Integer projectId;// 项目主键ID
@ -47,6 +47,12 @@ public class Project_Management {
@ApiModelProperty(value = "绑定服务配置ID", name = "systemId", example = "1", required = true)
private Integer systemId;// 绑定服务配置ID
@ApiModelProperty(value = "知识点", name = "knowledgePoints", example = "一加一等于二", required = true)
private String knowledgePoints; // 知识点
@ApiModelProperty(value = "实验介绍", name = "experimentIntroduction", example = "一加一等于二", required = true)
private String experimentIntroduction; // 实验介绍
@ApiModelProperty(hidden = true)
private Integer isdel;
@ -59,10 +65,30 @@ public class Project_Management {
@ApiModelProperty(value = "是否启用实验提示(0启用 1不启用)", name = "isstartexperimentSuggests", example = "0", required = true)
private Integer isstartexperimentSuggests;
@ApiModelProperty(value = "用户ID", name = "userId", example = "4", required = true)
private Integer userId;
@ApiModelProperty(value = "知识点是否启用(0、启用 1、不展示)", name = "knowledgePointsIsEnable", example = "0", required = true)
private Integer knowledgePointsIsEnable;
@ApiModelProperty(value = "实验介绍是否启用(0、启用 1、不展示)", name = "userId", example = "0", required = true)
private Integer experimentIntroductionIsEnable;
public Integer getKnowledgePointsIsEnable() {
return knowledgePointsIsEnable;
}
public void setKnowledgePointsIsEnable(Integer knowledgePointsIsEnable) {
this.knowledgePointsIsEnable = knowledgePointsIsEnable;
}
public Integer getExperimentIntroductionIsEnable() {
return experimentIntroductionIsEnable;
}
public void setExperimentIntroductionIsEnable(Integer experimentIntroductionIsEnable) {
this.experimentIntroductionIsEnable = experimentIntroductionIsEnable;
}
public Integer getUserId() {
return userId;
@ -88,6 +114,22 @@ public class Project_Management {
this.isstartexperimentSuggests = isstartexperimentSuggests;
}
public String getKnowledgePoints() {
return knowledgePoints;
}
public void setKnowledgePoints(String knowledgePoints) {
this.knowledgePoints = knowledgePoints;
}
public String getExperimentIntroduction() {
return experimentIntroduction;
}
public void setExperimentIntroduction(String experimentIntroduction) {
this.experimentIntroduction = experimentIntroduction;
}
public Integer getProjectId() {
return projectId;
}
@ -203,7 +245,7 @@ public class Project_Management {
@Override
public String toString() {
return "Project_Management{" +
return "ProjectManagement{" +
"projectId=" + projectId +
", projectName='" + projectName + '\'' +
", projectPermissions=" + projectPermissions +

@ -2,6 +2,7 @@ package com.yipin.liuwanr.mapper;
import java.util.List;
import com.yipin.liuwanr.entity.ProjectManagement;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
@ -10,7 +11,6 @@ import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import com.yipin.liuwanr.entity.Judgment_Points;
import com.yipin.liuwanr.entity.Project_Management;
import com.yipin.liuwanr.entity.Role;
/**
@ -18,7 +18,7 @@ import com.yipin.liuwanr.entity.Role;
*
* @author 86151
*/
public interface Project_ManagementMapper {
public interface ProjectManagementMapper {
/**
* 查询项目名称
@ -46,20 +46,21 @@ public interface Project_ManagementMapper {
* " ORDER BY creationTime desc",
*/
@Select({"<script>",
"select projectId,projectName,projectPermissions,founder,creationTime,state from hr_project_management where isdel=0",
// "select projectId,projectName,projectPermissions,founder,creationTime,state,knowledgePoints,experimentIntroduction from hr_project_management where isdel=0",
"select * from hr_project_management where isdel=0",
" <if test='projectPermissions!=null'> and projectPermissions=#{projectPermissions}</if>",
// " <if test='founder!=null'> and founder=#{founder}</if>",
// " <if test='userId!=null'> and (userId=#{userId} or founder = 0)</if>",
" <if test='userId==null and founder!=null '> and founder=#{founder}</if>",//服务端跳项目管理
" <if test='userId!=null and founder==null'> and (userId=#{userId} or founder = 0)</if>",//教师端,一开始进入项目管理,看见自己创建的和其他人看见的
" <if test='userId!=null and founder==0'> and founder=#{founder}</if>",//教师选择创建人为系统
" <if test='userId!=null and founder==1'> and userId=#{userId}</if>",//教师选则创建人为老师
// " <if test='userId==null and founder!=null '> and founder=#{founder}</if>",//服务端跳项目管理
" <if test='userId!=null'> and userId=#{userId}</if>",//教师端,一开始进入项目管理,看见自己创建的和其他人看见的
" <if test='founder!=null'> and founder=#{founder}</if>",//教师选择创建人为系统
// " <if test='userId!=null and founder==1'> and userId=#{userId}</if>",//教师选则创建人为老师
" <if test='state!=null'> and state=#{state}</if>",
" <if test='systemId!=null'> and systemId=#{systemId}</if>",
" <if test='projectName!=null'> and projectName like concat('%',#{projectName},'%')</if>",
" ORDER BY creationTime desc",
"</script>"})
List<Project_Management> queryManagements(Project_Management management);
List<ProjectManagement> queryManagements(ProjectManagement management);
/**
@ -68,8 +69,8 @@ public interface Project_ManagementMapper {
* @param projectId
* @return
*/
@Select("select projectId,projectName,projectPermissions,experimentalGoal,caseDescription,experimentSuggests,state,isstartexperimental,isstartexperimentSuggests,userId from hr_project_management where isdel=0 and projectId=#{projectId}")
Project_Management getProjectId(Integer projectId);
@Select("select projectId,projectName,projectPermissions,experimentalGoal,caseDescription,experimentSuggests,state,isstartexperimental,isstartexperimentSuggests,userId,knowledgePoints,experimentIntroduction from hr_project_management where isdel=0 and projectId=#{projectId}")
ProjectManagement getProjectId(Integer projectId);
/**
* 根据实验项目id查询项目名称
@ -85,10 +86,10 @@ public interface Project_ManagementMapper {
*
* @param projectId
*/
@Update("<script>" + "<foreach collection = 'point' item ='projectId' open='' close='' separator=';'>"
+ "update hr_project_management set isdel=1 where projectId=#{projectId}</foreach>"
@Update("<script>"
+ "update hr_project_management set isdel=1 where projectId=#{projectId}"
+ "</script>")
void deleteProjectManagement(@Param("point") List<Integer> projectId);
void deleteProjectManagement(Integer projectId);
/**
@ -119,7 +120,7 @@ public interface Project_ManagementMapper {
*/
@Update("<script>" +
"<foreach collection = 'ids' item ='id' open='' close='' separator=';'>"
+ "update hr_role set projectId=#{projectId} where roleId=#{id}</foreach>"
+ "update hr_role set projectId=#{projectId} where roleId=#{ids}</foreach>"
+ "</script>")
void updateRoleProjectId(@Param("ids") List<Integer> ids, @Param("projectId") Integer projectId);
@ -140,6 +141,18 @@ public interface Project_ManagementMapper {
List<Role> getByRoleId(@Param("role") List<Integer> role);
/**
* 查询单个项目判分点信息根据项目id
*
* @param projectId 项目id
* @return
*/
@Select({"<script>",
"select * from hr_judgment_points where find_in_set(#{projectId},projectId)",
"</script>"})
List<Judgment_Points> getJudgmentPoints(@Param("projectId") Integer projectId);
/**
* 点击具体某个项目信息的编辑按钮,
* 跳转到编辑项目管理页面的实验数据的信息展示
@ -199,6 +212,7 @@ public interface Project_ManagementMapper {
@Select("select projectId,experimentalRequirements from hr_judgment_points where judgmentPointsId=#{judgmentPointsId}")
Judgment_Points getByjudgmentPointsId(Integer judgmentPointsId);
/**
* 点击保存按按需要修改判分点表中对应的项目id,实验要求
*
@ -212,16 +226,15 @@ public interface Project_ManagementMapper {
"</script>"})
void updateProject(String projectId, String experimentalRequirements, Integer judgmentPointsId);
/**
* 添加项目管理信息
*
* @param management
*/
@Insert("INSERT INTO hr_project_management(projectName,projectPermissions,experimentalGoal,caseDescription,experimentSuggests,state,founder,systemId,creationTime,isstartexperimental,isstartexperimentSuggests,userId)"
+ " VALUES (#{projectName},#{projectPermissions},#{experimentalGoal},#{caseDescription},#{experimentSuggests},#{state},#{founder},#{systemId},now(),#{isstartexperimental},#{isstartexperimentSuggests},#{userId})")
@Insert("INSERT INTO hr_project_management(projectName,projectPermissions,experimentalGoal,caseDescription,experimentSuggests,state,founder,systemId,creationTime,isstartexperimental,isstartexperimentSuggests,userId,knowledgePoints,experimentIntroduction,knowledgePointsIsEnable,experimentIntroductionIsEnable)"
+ " VALUES (#{projectName},#{projectPermissions},#{experimentalGoal},#{caseDescription},#{experimentSuggests},#{state},#{founder},#{systemId},now(),#{isstartexperimental},#{isstartexperimentSuggests},#{userId},#{knowledgePoints},#{experimentIntroduction},#{knowledgePointsIsEnable},#{experimentIntroductionIsEnable})")
@Options(useGeneratedKeys = true, keyProperty = "projectId", keyColumn = "projectId")
void insertProjectManagement(Project_Management management);
void insertProjectManagement(ProjectManagement management);
/**
* 修改项目管理信息
@ -229,8 +242,8 @@ public interface Project_ManagementMapper {
* @param management
*/
@Update("update hr_project_management set projectName=#{projectName},projectPermissions=#{projectPermissions},experimentalGoal=#{experimentalGoal},caseDescription=#{caseDescription},experimentSuggests=#{experimentSuggests},state=#{state},"
+ "isstartexperimental=#{isstartexperimental},isstartexperimentSuggests=#{isstartexperimentSuggests} where projectId=#{projectId}")
void updateProjectManagement(Project_Management management);
+ "isstartexperimental=#{isstartexperimental},isstartexperimentSuggests=#{isstartexperimentSuggests},knowledgePoints=#{knowledgePoints},experimentIntroduction=#{experimentIntroduction},knowledgePointsIsEnable=#{knowledgePointsIsEnable},experimentIntroductionIsEnable=#{experimentIntroductionIsEnable} where projectId=#{projectId}")
void updateProjectManagement(ProjectManagement management);
/**
* 根据项目id,查询出该项目所有的判分点id

@ -15,16 +15,16 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.yipin.liuwanr.helper.UserUtil;
import com.yipin.liuwanr.mapper.Project_ManagementMapper;
import com.yipin.liuwanr.mapper.ProjectManagementMapper;
import com.yipin.liuwanr.mapper.ScoreIndexMapper;
@Service
public class Project_ManagementService {
public class ProjectManagementService {
private static Logger logger = Logger.getLogger(Project_ManagementService.class);
private static Logger logger = Logger.getLogger(ProjectManagementService.class);
@Autowired
private Project_ManagementMapper mapper;
private ProjectManagementMapper mapper;
@Autowired
private ScoreIndexMapper indexMapper;
@ -74,7 +74,7 @@ public class Project_ManagementService {
* @param vo
* @return
*/
public HashMap<String, Object> queryAllManagements(Project_Management vo, Integer pageNo, Integer pageSize) {
public HashMap<String, Object> queryAllManagements(ProjectManagement vo, Integer pageNo, Integer pageSize) {
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
//获取用户的角色信息
@ -83,7 +83,7 @@ public class Project_ManagementService {
//角色不对(学生没有权限)
if (roleId == 4) {
resp.put("retcode", 300);
resp.put("retvalue", "Role does not meet the requirements");
resp.put("retvalue", "抱歉,您的权限不能访问该地址!");
return resp;
}
//角色等于管理员或者超级管理员
@ -93,8 +93,8 @@ public class Project_ManagementService {
}
PageHelper.startPage(pageNo, pageSize);
//条件查询
List<Project_Management> list = mapper.queryManagements(vo);
PageInfo<Project_Management> info = new PageInfo<Project_Management>(list);
List<ProjectManagement> list = mapper.queryManagements(vo);
PageInfo<ProjectManagement> info = new PageInfo<ProjectManagement>(list);
resp.put("retvalue", new PageResult(info.getTotal(), list));
resp.put("retcode", 200);
} catch (Exception e) {
@ -110,14 +110,14 @@ public class Project_ManagementService {
/**
* 批量删除
*
* @param point项目管理id
* @param projectId项目管理id
* @return
*/
@Transactional
public HashMap<String, Object> deleteProjectManagement(List<Integer> point) {
public HashMap<String, Object> deleteProjectManagement(List<Integer> projectId) {
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
for (Integer po : point) {
for (Integer po : projectId) {
//判分点
List<Judgment_Points> points = mapper.queryProjectIds(po);
for (int i = 0; i < points.size(); i++) {
@ -142,7 +142,11 @@ public class Project_ManagementService {
indexMapper.removeAllprojectId(po);
mapper.deleteRole(po);
}
mapper.deleteProjectManagement(point);
int size = projectId.size();
for (int i = 0;i<size;i++){
Integer id = projectId.get(i);
mapper.deleteProjectManagement(id);
}
resp.put("retcode", 200);
} catch (Exception e) {
logger.error(e.getMessage());
@ -168,7 +172,7 @@ public class Project_ManagementService {
try {
// 项目信息
Project_Management management = mapper.getProjectId(projectId);
ProjectManagement management = mapper.getProjectId(projectId);
if (null != management) {
// 判分点信息
@ -331,7 +335,27 @@ public class Project_ManagementService {
/**
* 添加完角色信息 角色信息展示
* 查询单个项目判分点信息根据项目id
*
* @param projectId 项目id
* @return
*/
public HashMap<String, Object> getJudgmentPoints(Integer projectId) {
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
resp.put("retvalue", mapper.getJudgmentPoints(projectId));
resp.put("retcode", 200);
} catch (Exception e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "Inquiry Failed");
return resp;
}
return resp;
}
/**
* 查询单个项目判分点信息
*
* @param roleId 角色ID
* @return
@ -401,7 +425,7 @@ public class Project_ManagementService {
* @return
*/
@Transactional
public HashMap<String, Object> insertProjectManagement(Project_Management pro, List<Judgment_Points> points, List<Integer> roles) {
public HashMap<String, Object> insertProjectManagement(ProjectManagement pro, List<Judgment_Points> points, List<Integer> roles) {
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
// 添加项目信息
@ -470,7 +494,7 @@ public class Project_ManagementService {
HashMap<String, Object> resp = new HashMap<String, Object>();
try{
Integer count = mapper.getByprojectName(projectName);
if(count>1){
if(count>=1){
resp.put("retcode", 300);
resp.put("retvalue", "该项目名称已存在");
}else{
@ -491,7 +515,7 @@ public class Project_ManagementService {
* @return
*/
@Transactional
public HashMap<String, Object> updateProjectManagement(Project_Management pro, List<Judgment_Points> points,
public HashMap<String, Object> updateProjectManagement(ProjectManagement pro, List<Judgment_Points> points,
List<Integer> roles) {
HashMap<String, Object> resp = new HashMap<String, Object>();

@ -1,8 +1,11 @@
spring.datasource.url=jdbc:mysql://www.liuwanr.cn:3306/huoran?useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true
spring.datasource.url=jdbc:mysql://rm-wz9y13wf7u8q8610fwo.mysql.rds.aliyuncs.com:3306/huoran?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
spring.datasource.username=super
spring.datasource.password=huoran888
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.jackson.default-property-inclusion=non-null
server.port=1010
server.servlet.context-path=
logging.level.com.yipin.liuwanr.mapper=debug

@ -1,8 +1,8 @@
package com.yipin.liuwanr;
import com.yipin.liuwanr.entity.*;
import com.yipin.liuwanr.mapper.Project_ManagementMapper;
import com.yipin.liuwanr.service.Project_ManagementService;
import com.yipin.liuwanr.mapper.ProjectManagementMapper;
import com.yipin.liuwanr.service.ProjectManagementService;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@ -17,10 +17,10 @@ import java.util.List;
public class Project_ManagementTest {
@Autowired
private Project_ManagementService managementService;
private ProjectManagementService managementService;
@Autowired
private Project_ManagementMapper projectManagementMapper;
private ProjectManagementMapper projectManagementMapper;
/**
* 查询用户角色信息
@ -49,7 +49,7 @@ public class Project_ManagementTest {
Integer systemId = 1;
Integer userId = 4;
Project_Management vo = new Project_Management();
ProjectManagement vo = new ProjectManagement();
if (null != projectPermissions) {
vo.setProjectPermissions(projectPermissions);
}
@ -85,7 +85,7 @@ public class Project_ManagementTest {
System.out.println("total = " + total);
List<Project_Management> rows = (List<Project_Management>) pageResult.getRows();
List<ProjectManagement> rows = (List<ProjectManagement>) pageResult.getRows();
rows.forEach(item -> {
System.out.println(item.toString());
@ -228,7 +228,7 @@ public class Project_ManagementTest {
@Transactional //在单元测试中 Transaction注解会对数据库的更新(insert update delete)进行回滚 ,以保证数据不污染
@Test
public void testInsertProjectManagement() {
/*Project_Management pro = new Project_Management();
/*ProjectManagement pro = new ProjectManagement();
pro.setProjectName("简单加法计算");
pro.setProjectPermissions(1);
pro.setExperimentalGoal("本项目将会帮助学生了解简单的加法计算");
@ -248,7 +248,7 @@ public class Project_ManagementTest {
points.add(judgmentPoints);
List<Integer> roles = new ArrayList<>();
roles.add(433);*/
Project_Management pro = projectManagementMapper.getProjectId(302);
ProjectManagement pro = projectManagementMapper.getProjectId(302);
pro.setProjectId(null);
pro.setFounder(0);
List<Judgment_Points> points = projectManagementMapper.queryProjectIds(302);
@ -275,7 +275,7 @@ public class Project_ManagementTest {
@Transactional
@Test
public void testUpdateProjectManagement() {
/*Project_Management pro = new Project_Management();
/*ProjectManagement pro = new ProjectManagement();
pro.setProjectId(302);
pro.setProjectName("简单加法计算");
pro.setProjectPermissions(1);
@ -296,7 +296,7 @@ public class Project_ManagementTest {
points.add(judgmentPoints);
List<Integer> roles = new ArrayList<>();
roles.add(433);*/
Project_Management pro = projectManagementMapper.getProjectId(302);
ProjectManagement pro = projectManagementMapper.getProjectId(302);
pro.setFounder(0);
List<Judgment_Points> points = projectManagementMapper.queryProjectIds(302);
List<Integer> roles = projectManagementMapper.getByRoleProjectId(302);

Loading…
Cancel
Save