修正考核问题查询的sql

master
李一帆 2025-04-10 11:48:57 +08:00
parent 7bc6712180
commit 97632ce613
2 changed files with 56 additions and 40 deletions

View File

@ -56,7 +56,7 @@ public interface AssessTeamRatingMapper extends BaseMapper<AssessTeamRating> {
left join public.assess_task t5 on t1.task_id = t5.id left join public.assess_task t5 on t1.task_id = t5.id
where t.is_need_rectify = 1 and t5.status = 3 where t.is_need_rectify = 1 and t5.status = 3
<if test="obj.userId != null"> <if test="obj.userId != null">
and t.object_id = #{obj.userId} and t2.object_user_id = #{obj.userId}
</if> </if>
<if test="obj.taskName != null and obj.taskName != ''"> <if test="obj.taskName != null and obj.taskName != ''">
and t5.task_name like concat('%', #{obj.taskName}::text, '%') and t5.task_name like concat('%', #{obj.taskName}::text, '%')

View File

@ -12,8 +12,14 @@ import com.gunshi.project.xyt.entity.vo.AssessRectifyVo;
import com.gunshi.project.xyt.entity.vo.AssessScoreVo; import com.gunshi.project.xyt.entity.vo.AssessScoreVo;
import com.gunshi.project.xyt.mapper.*; import com.gunshi.project.xyt.mapper.*;
import com.gunshi.project.xyt.model.*; import com.gunshi.project.xyt.model.*;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.SecurityUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -33,8 +39,7 @@ import java.util.stream.Collectors;
@Service @Service
@Slf4j @Slf4j
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public class AssessTeamRatingService extends ServiceImpl<AssessTeamRatingMapper, AssessTeamRating> public class AssessTeamRatingService extends ServiceImpl<AssessTeamRatingMapper, AssessTeamRating> {
{
@Autowired @Autowired
private FileAssociationsService fileService; private FileAssociationsService fileService;
@ -191,7 +196,6 @@ public class AssessTeamRatingService extends ServiceImpl<AssessTeamRatingMapper,
} }
public Map<Long, List<AssessRatingVo>> scoreDetail(Long objectId) { public Map<Long, List<AssessRatingVo>> scoreDetail(Long objectId) {
List<AssessRatingVo> list = this.baseMapper.scoreByObjectId(objectId); List<AssessRatingVo> list = this.baseMapper.scoreByObjectId(objectId);
fillRating(list); fillRating(list);
@ -210,6 +214,18 @@ public class AssessTeamRatingService extends ServiceImpl<AssessTeamRatingMapper,
} }
public Page<AssessRectifyVo> listPage(AssessTaskPageSo page) { public Page<AssessRectifyVo> listPage(AssessTaskPageSo page) {
/*
SecurityContext context = SecurityContextHolder.getContext();
Authentication auth = context.getAuthentication();
Object principal = auth.getPrincipal();
log.info("principal is {}", principal);
LoginUser loginUser = (LoginUser) principal;
SysUser user = loginUser.getUser();
boolean admin = SecurityUtils.isAdmin(user.getUserId());
if (!admin) {
page.setUserId(user.getUserId());
}
*/
Page<AssessRectifyVo> res = this.baseMapper.listPage(page.getPageSo().toPage(), page); Page<AssessRectifyVo> res = this.baseMapper.listPage(page.getPageSo().toPage(), page);
if (res.getRecords() != null && res.getRecords().size() > 0) { if (res.getRecords() != null && res.getRecords().size() > 0) {
for (AssessRectifyVo record : res.getRecords()) { for (AssessRectifyVo record : res.getRecords()) {