Browse Source

修复不满意信件sql语句构造优先级导致的查询错误

master
21819 2 years ago
parent
commit
3a2bec5f5b
  1. 21
      mailbox-lan/src/main/java/com/biutag/lan/service/WorkService.java

21
mailbox-lan/src/main/java/com/biutag/lan/service/WorkService.java

@ -454,9 +454,11 @@ public class WorkService extends ServiceImpl<WorkMapper, Work> {
.le(StrUtil.isNotBlank(mailQuery.getMailTimeStartEnd()), "TO_CHAR(m.mail_time, 'YYYY-MM-DD')", mailQuery.getMailTimeStartEnd())
.eq(StrUtil.isNotBlank(mailQuery.getSource()), "m.source", mailQuery.getSource())
.eq(StrUtil.isNotBlank(mailQuery.getMailLevel()), "m.mail_level", mailQuery.getMailLevel())
.nested(i -> i.eq("m.satisfaction_status", "不满意")
.or().eq("m.verify_feedback", "不满意"))
.or().apply("m.id = ma.mail_id");
.nested(i ->
i.eq("m.satisfaction_status", "不满意")
.or().eq("m.verify_feedback", "不满意")
.or().apply("m.id = ma.mail_id")
);
mailCategorySearch(mailQuery, queryWrapper);
deptSearch(mailQuery, queryWrapper);
roleCheck(queryWrapper);
@ -472,7 +474,6 @@ public class WorkService extends ServiceImpl<WorkMapper, Work> {
queryWrapper.like("w.contact_phone", mailQuery.getContactFieldValue());
break;
}
}
// 排序
queryWrapper.orderByDesc("m.mail_time");
@ -513,13 +514,19 @@ public class WorkService extends ServiceImpl<WorkMapper, Work> {
} else if (roleId.equals(RoleEnum.SECOND_DEPT_LEADER.getRoleId()) || roleId.equals(RoleEnum.SECOND_DEPT_CLASSES.getRoleId())) {
//数据,领导只能看到自己管辖的部门
Integer deptId = AdminThreadLocal.getDeptId();
queryWrapper.eq("m.second_dept_id", deptId);
queryWrapper.and(i ->
i.eq("m.second_dept_id", deptId)
);
} else if (roleId.equals(RoleEnum.THREE_DEPT_LEADER.getRoleId()) || roleId.equals(RoleEnum.THREE_DEPT_CLASSES.getRoleId())) {
Integer deptId = AdminThreadLocal.getDeptId();
queryWrapper.eq("m.three_dept_id", deptId);
queryWrapper.and(i ->
i.eq("m.three_dept_id", deptId)
);
} else {
String empNo = AdminThreadLocal.getEmpNo();
queryWrapper.eq("w.police_emp_no", empNo);
queryWrapper.and(i ->
i.eq("w.police_emp_no", empNo)
);
}
}

Loading…
Cancel
Save