feat(examine): 考核管理添加权限控制并优化排序功能

- 在 ExamineDetailController 和 ExamineUserController 中添加了权限控制注解
- 在 ExamineUser 中添加了 userName 和 isAsc 字段
- 修改了 ExamineUserMapper.xml 以支持用户昵称查询和排序功能
- 优化了查询参数验证逻辑
dev_1.1.0
chenhao 2025-01-03 10:36:18 +08:00
parent fadadde6f1
commit ab2844e5bd
4 changed files with 35 additions and 11 deletions

View File

@ -2,6 +2,7 @@ package tech.unissense.pms.web.controller.business.examine.detail;
import cn.hutool.core.lang.Assert;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import tech.unissense.pms.business.examine.config.domain.ExamineConfig;
import tech.unissense.pms.business.examine.config.enums.ReviewTypeEnum;
import tech.unissense.pms.business.examine.config.service.ExamineConfigService;
@ -63,6 +64,7 @@ public class ExamineDetailController extends BaseController {
}
@GetMapping
@PreAuthorize("@ss.hasPermi('examine:manager:list')")
public AjaxResult list(ExamineDetailRequestDto dto) {
Assert.notNull(dto.getExamineTaskId(), "考核任务ID不能为空");
// Assert.notNull(dto.getExamineId(), "考核ID不能为空");

View File

@ -1,5 +1,7 @@
package tech.unissense.pms.web.controller.business.examine.user;
import cn.hutool.core.util.StrUtil;
import org.springframework.security.access.prepost.PreAuthorize;
import tech.unissense.pms.business.examine.user.domain.ExamineUser;
import tech.unissense.pms.business.examine.user.service.ExamineUserService;
import org.springframework.data.domain.Page;
@ -8,6 +10,7 @@ import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import tech.unissense.pms.common.core.controller.BaseController;
import tech.unissense.pms.common.core.page.TableDataInfo;
import tech.unissense.pms.common.exception.ServiceException;
import javax.annotation.Resource;
@ -47,7 +50,14 @@ public class ExamineUserController extends BaseController {
* @date 2025/01/02 10:36
*/
@GetMapping
@PreAuthorize("@ss.hasPermi('examine:manager:list')")
public TableDataInfo queryPage(ExamineUser examineUser) {
if (StrUtil.isNotEmpty(examineUser.getIsAsc())) {
//判断参数是否合法
if (!"ASC".equalsIgnoreCase(examineUser.getIsAsc()) && !"DESC".equalsIgnoreCase(examineUser.getIsAsc())) {
throw new ServiceException("参数不合法");
}
}
startPage();
return getDataTable(examineUserService.list(examineUser));
}

View File

@ -24,6 +24,7 @@ public class ExamineUser implements Serializable {
*
*/
private Integer userId;
private String userName;
/**
* ()
*/
@ -47,6 +48,7 @@ public class ExamineUser implements Serializable {
private String deptId;
private String isAsc;
}

View File

@ -58,37 +58,47 @@
</if>
</where>
</select>
<select id="list" resultMap="ExamineUserMap">
<include refid="base_query"/>
<select id="list" resultType="ExamineUser">
select t1.id,
t1.task_id,
t1.user_id,
t1.score,
t1.judge_content,
t1.manage_score,
t1.examine_status,
t1.examine_status_self,
t2.nick_name as userName
from pms_examine_user t1 left join sys_user t2 on t1.user_id = t2.user_id
<where>
<if test="id != null">
and id = #{id}
and t1.id = #{id}
</if>
<if test="taskId != null">
and task_id = #{taskId}
and t1.task_id = #{taskId}
</if>
<if test="userId != null">
and user_id = #{userId}
and t1.user_id = #{userId}
</if>
<if test="score != null">
and score = #{score}
and t1.score = #{score}
</if>
<if test="judgeContent != null and judgeContent != ''">
and judge_content = #{judgeContent}
and t1.judge_content = #{judgeContent}
</if>
<if test="manageScore != null">
and manage_score = #{manageScore}
and t1.manage_score = #{manageScore}
</if>
<if test="examineStatus != null and examineStatus != ''">
and examine_status = #{examineStatus}
and t1.examine_status = #{examineStatus}
</if>
<if test="examineStatusSelf != null and examineStatusSelf != ''">
and examine_status_self = #{examineStatusSelf}
and t1.examine_status_self = #{examineStatusSelf}
</if>
<if test="deptId != null and deptId != ''">
and user_id in (select id from sys_user where dept_id = #{deptId})
and t2.dept_id = #{deptId}
</if>
</where>
order by ifnull(manage_score,-1) ${isAsc}
</select>
<select id="queryByTaskIdAndUserId" resultMap="ExamineUserMap">
<include refid="base_query"/>