项目列表展示,名字去重

master
shijie 4 years ago
parent 18683df583
commit b62d61d468
  1. 48
      src/main/java/com/yipin/liuwanr/mapper/Project_ManagementMapper.java
  2. 7
      src/main/java/com/yipin/liuwanr/service/Project_ManagementService.java

@ -17,12 +17,12 @@ import com.yipin.liuwanr.entity.Role;
* 项目管理系统 项目管理表
*
* @author 86151
*
*/
public interface Project_ManagementMapper {
/**
* 查询项目名称
*
* @param projectName
* @return
*/
@ -35,16 +35,16 @@ public interface Project_ManagementMapper {
* @param management
* @return
*/
@Select({ "<script>",
@Select({"<script>",
"select projectId,projectName,projectPermissions,founder,creationTime,state 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='state!=null'> and state=#{state}</if>",
" <if test='systemId!=null'> and systemId=#{systemId}</if>",
" <if test='userId!=null'> and userId=#{userId}</if>",
" <if test='projectName!=null'> and projectName like concat('%',#{projectName},'%')</if>",
" ORDER BY creationTime desc",
"</script>" })
"</script>"})
List<Project_Management> queryManagements(Project_Management management);
@ -57,9 +57,18 @@ public interface Project_ManagementMapper {
@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);
/**
* 根据实验项目id查询项目名称
*
* @param projectId
* @return
*/
@Select("select projectName from hr_project_management where isdel=0 and projectId=#{projectId}")
String getNameByProjectId(Integer projectId);
/**
* 批量删除
*
* @param projectId
*/
@Update("<script>" + "<foreach collection = 'point' item ='projectId' open='' close='' separator=';'>"
@ -90,6 +99,7 @@ public interface Project_ManagementMapper {
/**
* 点击编辑或者创建项目管理页面的保存按钮后,
* 修改角色表中的对应数据的项目id
*
* @param ids
* @param projectId
*/
@ -97,7 +107,7 @@ public interface Project_ManagementMapper {
"<foreach collection = 'ids' item ='id' open='' close='' separator=';'>"
+ "update hr_role set projectId=#{projectId} where roleId=#{id}</foreach>"
+ "</script>")
void updateRoleProjectId(@Param("ids")List<Integer> ids,@Param("projectId")Integer projectId);
void updateRoleProjectId(@Param("ids") List<Integer> ids, @Param("projectId") Integer projectId);
@Delete("delete from hr_role where projectId=#{projectId}")
@ -109,16 +119,17 @@ public interface Project_ManagementMapper {
* @param role
* @return
*/
@Select({ "<script>",
@Select({"<script>",
"select roleId,roleNumber,roleType,roleAttribute from hr_role where roleId in",
"<foreach collection='role' item='ro' open='(' separator=',' close=')'>" + "#{ro} " + "</foreach> ",
"</script>" })
"</script>"})
List<Role> getByRoleId(@Param("role") List<Integer> role);
/**
* 点击具体某个项目信息的编辑按钮,
* 跳转到编辑项目管理页面的实验数据的信息展示
*
* @param projectId
* @return
*/
@ -128,30 +139,33 @@ public interface Project_ManagementMapper {
/**
* 添加判分点面板的判分信息展示
*
* @return
*/
@Select({ "<script>",
@Select({"<script>",
"select judgmentPointsId,judgmentPointsName from hr_judgment_points where isdel=0 and systemId=#{systemId} and isopen=0",
" <if test='judgmentPointsName!=null'> and judgmentPointsName like concat('%','${judgmentPointsName}','%')</if>",
"</script>" })
"</script>"})
List<Judgment_Points> queryAllJudgmentPoints(Judgment_Points points);
/**
* 从判分点添加面板选择完数据后
* 创建项目管理页面的实验任务信息展示
*
* @param point
* @return
*/
@Select({ "<script>",
@Select({"<script>",
"select judgmentPointsId,judgmentPointsName,experimentalRequirements from hr_judgment_points where isdel=0 and judgmentPointsId in",
"<foreach collection='point' item='po' open='(' separator=',' close=')'>" + "#{po} " + "</foreach> ",
"</script>" })
"</script>"})
List<Judgment_Points> getByjudgmentPointsIds(@Param("point") List<Integer> point);
/**
* 点击具体某个项目信息的编辑按钮,
* 跳转到编辑项目管理页面的实验任务的信息展示
*
* @param projectId
* @return
*/
@ -164,6 +178,7 @@ public interface Project_ManagementMapper {
/**
* 取出判分点中的项目管理的id
*
* @param judgmentPointsId
* @return
*/
@ -172,6 +187,7 @@ public interface Project_ManagementMapper {
/**
* 点击保存按按需要修改判分点表中对应的项目id,实验要求
*
* @param projectId
* @param judgmentPointsId
*/
@ -180,7 +196,7 @@ public interface Project_ManagementMapper {
" <if test='experimentalRequirements!=null'>,experimentalRequirements=#{experimentalRequirements}</if>",
" where judgmentPointsId=#{judgmentPointsId}",
"</script>"})
void updateProject(String projectId,String experimentalRequirements,Integer judgmentPointsId);
void updateProject(String projectId, String experimentalRequirements, Integer judgmentPointsId);
/**
@ -189,8 +205,8 @@ public interface Project_ManagementMapper {
* @param management
*/
@Insert("INSERT INTO hr_project_management(projectName,projectPermissions,experimentalGoal,caseDescription,experimentSuggests,state,founder,systemId,creationTime,isstartexperimental,isstartexperimentSuggests,userId,isExperiment,isAttendance,isdel)"
+ " VALUES (#{projectName},#{projectPermissions},#{experimentalGoal},#{caseDescription},#{experimentSuggests},#{state},1,#{systemId},now(),#{isstartexperimental},#{isstartexperimentSuggests},#{userId},0,0,0)")
@Options(useGeneratedKeys = true,keyProperty = "projectId",keyColumn = "projectId")
+ " VALUES (#{projectName},#{projectPermissions},#{experimentalGoal},#{caseDescription},#{experimentSuggests},#{state},#{founder},#{systemId},now(),#{isstartexperimental},#{isstartexperimentSuggests},#{userId},0,0,0)")
@Options(useGeneratedKeys = true, keyProperty = "projectId", keyColumn = "projectId")
void insertProjectManagement(Project_Management management);
/**
@ -204,6 +220,7 @@ public interface Project_ManagementMapper {
/**
* 根据项目id,查询出该项目所有的判分点id
*
* @param projectId
* @return
*/
@ -212,6 +229,7 @@ public interface Project_ManagementMapper {
/**
* 根据项目id,查询出该项目所有的角色id
*
* @param projectId
* @return
*/
@ -221,6 +239,7 @@ public interface Project_ManagementMapper {
/**
* 查询用户角色
*
* @param userId
* @return
*/
@ -230,6 +249,7 @@ public interface Project_ManagementMapper {
/**
* 查询用户角色
*
* @param userId
* @return
*/

@ -592,11 +592,16 @@ public class Project_ManagementService {
}
//项目名称去重
String projectName = pro.getProjectName();
String name = mapper.getNameByProjectId(pro.getProjectId());
if (projectName != null && !projectName.equals(name)) {
Integer count = mapper.getByprojectName(projectName);
if (count != null) {
if (count != null && count > 1) {
projectName += (count + 1);
pro.setProjectName(projectName);
}
}
//修改项目信息
mapper.updateProjectManagement(pro);
resp.put("retcode", 200);

Loading…
Cancel
Save