xuhy
3 天以前 1b09f886a2c8dc47c4945dace5bd649a7b4ef0ad
bug修改
4个文件已修改
420 ■■■■ 已修改文件
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/ReportController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/TaskUtil.java 395 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/TLeaveMapper.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/TTaskMapper.xml 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/ReportController.java
@@ -24,6 +24,7 @@
import io.swagger.annotations.ApiOperation;
import io.swagger.models.auth.In;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@@ -384,6 +385,9 @@
        }
        List<ProjectDeptDetailsVO> res = new ArrayList<>();
        List<TTask> tasks = taskCleanerService.list(tTaskLambdaQueryWrapper);
        if(CollectionUtils.isEmpty(tasks)){
            return R.ok(res);
        }
        List<TTaskDetail> taskDetails = taskDetailService.lambdaQuery().orderByDesc(BaseModel::getCreateTime).list();
        List<String> collect = tasks.stream().map(TTask::getProjectId).distinct().collect(Collectors.toList());
        List<TProjectDept> projectDepts = projectDeptService.list();
ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/TaskUtil.java
@@ -20,6 +20,7 @@
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
@@ -63,7 +64,7 @@
    // 每一个小时执行一次
//    @Scheduled(cron = "0 0 0 * * ?")
    @Scheduled(fixedRate = 1500000000)
//    @Scheduled(fixedRate = 1500000000)
    public void dayOfCreateInspection() {
        try {
@@ -76,6 +77,17 @@
                // 创建任务
                createInspection(template);
            });
            // 查询前一天为执行的所有任务,改成已超时状态
            List<TTask> taskCleanList = taskCleanService.list(Wrappers.lambdaQuery(TTask.class)
                    .like(TTask::getImplementTime, LocalDate.now().minusDays(1))
                    .eq(TTask::getStatus, 1));
            if (!CollectionUtils.isEmpty(taskCleanList)) {
                taskCleanList.forEach(task -> {
                    task.setStatus(2);
                });
                taskCleanService.updateBatchById(taskCleanList);
            }
        } catch (Exception e) {
            e.printStackTrace();
@@ -124,205 +136,206 @@
                continue;
            }
            SysUser sysUser = sysUsers.get(0);
            List<TProjectDept> projectDeptLists = new ArrayList<>();
            if(sysUser.getDeptType() == 1){
                TProjectDept projectDept = projectDeptService.getById(sysUser.getDeptId());
                if("0".equals(projectDept.getParentId())){
                    projectDeptLists = projectDeptService.list(Wrappers.lambdaQuery(TProjectDept.class)
                            .eq(TProjectDept::getParentId, projectDept.getId()));
            int taskCount = 0;
            for (SysUser sysUser : sysUsers) {
                List<TProjectDept> projectDeptLists = new ArrayList<>();
                if(sysUser.getDeptType() == 1){
                    TProjectDept projectDept = projectDeptService.getById(sysUser.getDeptId());
                    if("0".equals(projectDept.getParentId())){
                        projectDeptLists = projectDeptService.list(Wrappers.lambdaQuery(TProjectDept.class)
                                .eq(TProjectDept::getParentId, projectDept.getId()));
                    }else {
                        projectDeptLists.add(projectDept);
                    }
                }else {
                    projectDeptLists.add(projectDept);
                    projectDeptLists = projectDeptService.list(Wrappers.lambdaQuery(TProjectDept.class)
                            .ne(TProjectDept::getParentId,0));
                }
            }else {
                projectDeptLists = projectDeptService.list(Wrappers.lambdaQuery(TProjectDept.class)
                        .ne(TProjectDept::getParentId,0));
            }
            List<String> proDeptIds = projectDeptLists.stream().map(TProjectDept::getId).collect(Collectors.toList());
                List<String> proDeptIds = projectDeptLists.stream().map(TProjectDept::getId).collect(Collectors.toList());
            // 获取项目部在该模板详情中的权重
            List<String> projectDeptIds = redisCache.getCacheList(detail.getId() + PROJECT_DEPT_WEIGHT);
            // 获取项目部列表
            List<TProjectDept> projectDeptList;
            if(CollectionUtils.isEmpty(projectDeptIds)){
                projectDeptList = projectDeptLists;
            }else {
                projectDeptList = projectDeptService.list(Wrappers.lambdaQuery(TProjectDept.class)
                        .ne(TProjectDept::getParentId,0)
                        .in(TProjectDept::getId, proDeptIds)
                        .notIn(TProjectDept::getId, projectDeptIds));
                // 所过所有的项目部都被抽取了,则重新抽取,并且清空项目部权重
                if(CollectionUtils.isEmpty(projectDeptList)){
                // 获取项目部在该模板详情中的权重
                List<String> projectDeptIds = redisCache.getCacheList(detail.getId() + PROJECT_DEPT_WEIGHT);
                // 获取项目部列表
                List<TProjectDept> projectDeptList;
                if(CollectionUtils.isEmpty(projectDeptIds)){
                    projectDeptList = projectDeptLists;
                    redisCache.deleteObject(detail.getId() + PROJECT_DEPT_WEIGHT);
                }
            }
            // 如果可抽取的项目部数不足,先抽取余下项目部后,再清空权重,重新抽取
            List<TProjectDept> projectDepts = randomSelection(projectDeptList, num2);
            if(projectDepts.size() < num2){
                List<String> proIds = projectDepts.stream().map(TProjectDept::getId).collect(Collectors.toList());
                List<TProjectDept> projectDeptList1 = projectDeptService.list(Wrappers.lambdaQuery(TProjectDept.class)
                        .notIn(TProjectDept::getId, proIds)
                        .ne(TProjectDept::getParentId,0));
                redisCache.deleteObject(detail.getId() + PROJECT_DEPT_WEIGHT);
                List<TProjectDept> projectDepts1 = randomSelection(projectDeptList1, num2 - projectDepts.size());
                List<String> proIds1 = projectDepts1.stream().map(TProjectDept::getId).collect(Collectors.toList());
                // 将已抽取的项目部id保存到redis中
                redisCache.setCacheList(detail.getId() + PROJECT_DEPT_WEIGHT, proIds1);
                projectDepts.addAll(projectDepts1);
            }else {
                List<String> proIds = projectDepts.stream().map(TProjectDept::getId).collect(Collectors.toList());
                // 将已抽取的项目部id保存到redis中
                redisCache.setCacheList(detail.getId() + PROJECT_DEPT_WEIGHT, proIds);
            }
            List<String> proIds = projectDepts.stream().map(TProjectDept::getId).collect(Collectors.toList());
            // 拿到抽取的项目部下的所有保洁员
//            List<TProjectDept> tProjectDeptList = projectDeptService.list(Wrappers.lambdaQuery(TProjectDept.class)
//                    .in(TProjectDept::getId, proIds));
            // 获取片区id
            List<String> areaIds = projectDepts.stream().map(TProjectDept::getId).collect(Collectors.toList());
            if(CollectionUtils.isEmpty(areaIds)){
                return;
            }
            // 计算每天需要抽取多少个保洁员
            long count = cleanerService.count(Wrappers.lambdaQuery(TCleaner.class)
                    .in(TCleaner::getProjectId, areaIds));
            int cleanerSums = num1 * Integer.parseInt(count + "");
            // 获取每天需要抽取的保洁员数,向上取整
            if (cleanerSums < cycle){
                cleanerSums = cycle;
            }
            int dayCleanerCount = cleanerSums / cycle;
            if((cycle == detail.getCurrentValue()) && cleanerSums % cycle != 0){
                dayCleanerCount++;
            }
            // 获取保洁员权重
            List<String> cleanerIds = redisCache.getCacheList(detail.getId() + CLEANER_WEIGHT);
            // 获取保洁员列表
            List<TCleaner> cleaners;
            if(CollectionUtils.isEmpty(cleanerIds)){
                cleaners = cleanerService.list(Wrappers.lambdaQuery(TCleaner.class)
                        .in(TCleaner::getProjectId, areaIds));
            }else {
                cleaners = cleanerService.list(Wrappers.lambdaQuery(TCleaner.class)
                        .in(TCleaner::getProjectId, areaIds)
                        .notIn(TCleaner::getId, cleanerIds));
                if(CollectionUtils.isEmpty(cleaners)){
                    cleaners = cleanerService.list(Wrappers.lambdaQuery(TCleaner.class)
                            .in(TCleaner::getProjectId, areaIds));
                    redisCache.deleteObject(detail.getId() + CLEANER_WEIGHT);
                }
            }
            // 抽取保洁员
            List<TCleaner> tCleaners = randomSelection(cleaners, dayCleanerCount);
            if(CollectionUtils.isEmpty(tCleaners)){
                log.error("没有可抽取的保洁员");
                continue;
            }
            if(tCleaners.size() < dayCleanerCount){
                List<String> cleanIds = tCleaners.stream().map(TCleaner::getId).collect(Collectors.toList());
                List<TCleaner> cleaners1 = cleanerService.list(Wrappers.lambdaQuery(TCleaner.class)
                        .in(TCleaner::getProjectId, areaIds)
                        .notIn(TCleaner::getId, cleanIds));
                redisCache.deleteObject(detail.getId() + CLEANER_WEIGHT);
                List<TCleaner> tCleaners1 = randomSelection(cleaners1, dayCleanerCount - tCleaners.size());
                List<String> cleanIds1 = tCleaners1.stream().map(TCleaner::getId).collect(Collectors.toList());
                // 将已抽取的保洁员id保存到redis中
                cleanIds1.addAll(cleanIds);
                redisCache.setCacheList(detail.getId() + CLEANER_WEIGHT, cleanIds1);
                tCleaners.addAll(tCleaners1);
            }else {
                List<String> cleanIds = tCleaners.stream().map(TCleaner::getId).collect(Collectors.toList());
                redisCache.setCacheList(detail.getId() + CLEANER_WEIGHT, cleanIds);
            }
            // 通过保洁员id查询点位
            List<String> cleanersIds = tCleaners.stream().map(TCleaner::getId).collect(Collectors.toList());
            List<TLocation> locationList = locationService.list(Wrappers.lambdaQuery(TLocation.class)
                    .in(TLocation::getLocationCleaner, cleanersIds));
            // 查询点位类型
            JSONArray jsonArray = JSONObject.parseArray(num4);
            List<TLocation> tLocationList = new ArrayList<>();
            for (Object o : jsonArray) {
                JSONObject jsonObject = JSONObject.parseObject(o.toString());
                String id = jsonObject.getString("id");
                BigDecimal value = jsonObject.getBigDecimal("value");
                List<TLocation> locations = locationList.stream().filter(tLocation -> tLocation.getLocationType().equals(id)).collect(Collectors.toList());
                if(!CollectionUtils.isEmpty(locations)){
                    BigDecimal bigDecimal = new BigDecimal(locations.size()).multiply(value.divide(new BigDecimal(100), 2, BigDecimal.ROUND_DOWN)).setScale(0, BigDecimal.ROUND_UP);
                    int locationCount = bigDecimal.intValue();
                    if(locationCount > 0){
                        List<TLocation> tLocations = randomSelection(locations, locationCount);
                        tLocationList.addAll(tLocations);
                }else {
                    projectDeptList = projectDeptService.list(Wrappers.lambdaQuery(TProjectDept.class)
                            .ne(TProjectDept::getParentId,0)
                            .in(TProjectDept::getId, proDeptIds)
                            .notIn(TProjectDept::getId, projectDeptIds));
                    // 所过所有的项目部都被抽取了,则重新抽取,并且清空项目部权重
                    if(CollectionUtils.isEmpty(projectDeptList)){
                        projectDeptList = projectDeptLists;
                        redisCache.deleteObject(detail.getId() + PROJECT_DEPT_WEIGHT);
                    }
                }
            }
            // 抽取重复点位
            Integer currentValue = detail.getCurrentValue();
            if(currentValue != cycle){
                // 周期天数加一
                detail.setCurrentValue(currentValue + 1);
                // 获取重复点位
                Set<TLocation> repeatLocation = redisCache.getCacheSet(detail.getId() + REPEAT_LOCATION);
                if(!CollectionUtils.isEmpty(repeatLocation)){
                    List<TLocation> locations = randomSelection(new ArrayList<>(tLocationList), num3);
                    tLocationList.addAll(locations);
                // 如果可抽取的项目部数不足,先抽取余下项目部后,再清空权重,重新抽取
                List<TProjectDept> projectDepts = randomSelection(projectDeptList, num2);
                if(projectDepts.size() < num2){
                    List<String> proIds = projectDepts.stream().map(TProjectDept::getId).collect(Collectors.toList());
                    List<TProjectDept> projectDeptList1 = projectDeptService.list(Wrappers.lambdaQuery(TProjectDept.class)
                            .notIn(TProjectDept::getId, proIds)
                            .ne(TProjectDept::getParentId,0));
                    redisCache.deleteObject(detail.getId() + PROJECT_DEPT_WEIGHT);
                    List<TProjectDept> projectDepts1 = randomSelection(projectDeptList1, num2 - projectDepts.size());
                    List<String> proIds1 = projectDepts1.stream().map(TProjectDept::getId).collect(Collectors.toList());
                    // 将已抽取的项目部id保存到redis中
                    redisCache.setCacheList(detail.getId() + PROJECT_DEPT_WEIGHT, proIds1);
                    projectDepts.addAll(projectDepts1);
                }else {
                    List<String> proIds = projectDepts.stream().map(TProjectDept::getId).collect(Collectors.toList());
                    // 将已抽取的项目部id保存到redis中
                    redisCache.setCacheList(detail.getId() + PROJECT_DEPT_WEIGHT, proIds);
                }
                Set<TLocation> locationSet = new HashSet<>(tLocationList);
                redisCache.setCacheSet(detail.getId() + REPEAT_LOCATION, locationSet);
                List<String> proIds = projectDepts.stream().map(TProjectDept::getId).collect(Collectors.toList());
            }else {
                // 设置当前周期为0
                detail.setCurrentValue(0);
                // 将重复点位置空
                redisCache.deleteObject(detail.getId() + REPEAT_LOCATION);
                // 将项目部权重置空
                redisCache.deleteObject(detail.getId() + PROJECT_DEPT_WEIGHT);
                // 将保洁员权重置空
                redisCache.deleteObject(detail.getId() + CLEANER_WEIGHT);
                // 拿到抽取的项目部下的所有保洁员
//            List<TProjectDept> tProjectDeptList = projectDeptService.list(Wrappers.lambdaQuery(TProjectDept.class)
//                    .in(TProjectDept::getId, proIds));
                // 获取片区id
                List<String> areaIds = projectDepts.stream().map(TProjectDept::getId).collect(Collectors.toList());
                if(CollectionUtils.isEmpty(areaIds)){
                    return;
                }
                // 计算每天需要抽取多少个保洁员
                long count = cleanerService.count(Wrappers.lambdaQuery(TCleaner.class)
                        .in(TCleaner::getProjectId, areaIds));
                int cleanerSums = num1 * Integer.parseInt(count + "");
                // 获取每天需要抽取的保洁员数,向上取整
                if (cleanerSums < cycle){
                    cleanerSums = cycle;
                }
                int dayCleanerCount = cleanerSums / cycle;
                if((cycle == detail.getCurrentValue()) && cleanerSums % cycle != 0){
                    dayCleanerCount++;
                }
                // 获取保洁员权重
                List<String> cleanerIds = redisCache.getCacheList(detail.getId() + CLEANER_WEIGHT);
                // 获取保洁员列表
                List<TCleaner> cleaners;
                if(CollectionUtils.isEmpty(cleanerIds)){
                    cleaners = cleanerService.list(Wrappers.lambdaQuery(TCleaner.class)
                            .in(TCleaner::getProjectId, areaIds));
                }else {
                    cleaners = cleanerService.list(Wrappers.lambdaQuery(TCleaner.class)
                            .in(TCleaner::getProjectId, areaIds)
                            .notIn(TCleaner::getId, cleanerIds));
                    if(CollectionUtils.isEmpty(cleaners)){
                        cleaners = cleanerService.list(Wrappers.lambdaQuery(TCleaner.class)
                                .in(TCleaner::getProjectId, areaIds));
                        redisCache.deleteObject(detail.getId() + CLEANER_WEIGHT);
                    }
                }
                // 抽取保洁员
                List<TCleaner> tCleaners = randomSelection(cleaners, dayCleanerCount);
                if(CollectionUtils.isEmpty(tCleaners)){
                    log.error("没有可抽取的保洁员,模板id为:{}",detail.getId());
                    continue;
                }
                if(tCleaners.size() < dayCleanerCount){
                    List<String> cleanIds = tCleaners.stream().map(TCleaner::getId).collect(Collectors.toList());
                    List<TCleaner> cleaners1 = cleanerService.list(Wrappers.lambdaQuery(TCleaner.class)
                            .in(TCleaner::getProjectId, areaIds)
                            .notIn(TCleaner::getId, cleanIds));
                    redisCache.deleteObject(detail.getId() + CLEANER_WEIGHT);
                    List<TCleaner> tCleaners1 = randomSelection(cleaners1, dayCleanerCount - tCleaners.size());
                    List<String> cleanIds1 = tCleaners1.stream().map(TCleaner::getId).collect(Collectors.toList());
                    // 将已抽取的保洁员id保存到redis中
                    cleanIds1.addAll(cleanIds);
                    redisCache.setCacheList(detail.getId() + CLEANER_WEIGHT, cleanIds1);
                    tCleaners.addAll(tCleaners1);
                }else {
                    List<String> cleanIds = tCleaners.stream().map(TCleaner::getId).collect(Collectors.toList());
                    redisCache.setCacheList(detail.getId() + CLEANER_WEIGHT, cleanIds);
                }
                // 通过保洁员id查询点位
                List<String> cleanersIds = tCleaners.stream().map(TCleaner::getId).collect(Collectors.toList());
                List<TLocation> locationList = locationService.list(Wrappers.lambdaQuery(TLocation.class)
                        .in(TLocation::getLocationCleaner, cleanersIds));
                // 查询点位类型
                JSONArray jsonArray = JSONObject.parseArray(num4);
                List<TLocation> tLocationList = new ArrayList<>();
                for (Object o : jsonArray) {
                    JSONObject jsonObject = JSONObject.parseObject(o.toString());
                    String id = jsonObject.getString("id");
                    BigDecimal value = jsonObject.getBigDecimal("value");
                    List<TLocation> locations = locationList.stream().filter(tLocation -> tLocation.getLocationType().equals(id)).collect(Collectors.toList());
                    if(!CollectionUtils.isEmpty(locations)){
                        BigDecimal bigDecimal = new BigDecimal(locations.size()).multiply(value.divide(new BigDecimal(100), 2, BigDecimal.ROUND_DOWN)).setScale(0, BigDecimal.ROUND_UP);
                        int locationCount = bigDecimal.intValue();
                        if(locationCount > 0){
                            List<TLocation> tLocations = randomSelection(locations, locationCount);
                            tLocationList.addAll(tLocations);
                        }
                    }
                }
                // 抽取重复点位
                Integer currentValue = detail.getCurrentValue();
                if(currentValue != cycle){
                    // 周期天数加一
                    detail.setCurrentValue(currentValue + 1);
                    // 获取重复点位
                    Set<TLocation> repeatLocation = redisCache.getCacheSet(detail.getId() + REPEAT_LOCATION);
                    if(!CollectionUtils.isEmpty(repeatLocation)){
                        List<TLocation> locations = randomSelection(new ArrayList<>(tLocationList), num3);
                        tLocationList.addAll(locations);
                    }
                    Set<TLocation> locationSet = new HashSet<>(tLocationList);
                    redisCache.setCacheSet(detail.getId() + REPEAT_LOCATION, locationSet);
                }else {
                    // 设置当前周期为0
                    detail.setCurrentValue(0);
                    // 将重复点位置空
                    redisCache.deleteObject(detail.getId() + REPEAT_LOCATION);
                    // 将项目部权重置空
                    redisCache.deleteObject(detail.getId() + PROJECT_DEPT_WEIGHT);
                    // 将保洁员权重置空
                    redisCache.deleteObject(detail.getId() + CLEANER_WEIGHT);
                }
                // 创建任务
                List<TTask> tasks = new ArrayList<>();
                for (TLocation tLocation : tLocationList) {
                    TTask task = new TTask();
                    // 获取保洁员
                    tCleaners.stream().filter(tCleaner -> tCleaner.getId().equals(tLocation.getLocationCleaner())).findFirst().ifPresent(tCleaner -> {
                        task.setProjectId(tCleaner.getProjectId());
                        task.setCleanerId(tCleaner.getId());
                    });
                    // 获取巡检员
                    task.setPatrolInspector(sysUser.getUserId().toString());
                    task.setPatrolInspectorDept(sysUser.getDeptId());
                    task.setUserId(sysUser.getUserId());
                    task.setStatus(1);
                    task.setLocationId(tLocation.getId());
                    task.setImplementTime(LocalDateTime.now().plusDays(1));
                    task.setTaskType(1);
                    task.setTemplateId(detail.getTemplateId());
                    String nameAndCode = CodeGenerateUtils.generateVolumeSn();
                    task.setTaskName(nameAndCode);
                    task.setTaskCode(nameAndCode);
                    tasks.add(task);
                }
                // 添加应生成任务数量
                TTemplateCount templateCount = new TTemplateCount();
                templateCount.setTemplateId(detail.getId());
                templateCount.setTaskCount(tLocationList.size()* cycle);
                templateCount.setUserId(sysUser.getUserId());
                templateCountService.save(templateCount);
                taskCleanService.saveBatch(tasks);
                taskCount = taskCount + tasks.size();
            }
            // 创建任务
            List<TTask> tasks = new ArrayList<>();
            for (TLocation tLocation : tLocationList) {
                TTask task = new TTask();
                // 获取保洁员
                tCleaners.stream().filter(tCleaner -> tCleaner.getId().equals(tLocation.getLocationCleaner())).findFirst().ifPresent(tCleaner -> {
                    task.setProjectId(tCleaner.getProjectId());
                    task.setCleanerId(tCleaner.getId());
                });
                // 获取巡检员
                task.setPatrolInspector(sysUser.getUserId().toString());
                task.setPatrolInspectorDept(sysUser.getDeptId());
                task.setUserId(sysUser.getUserId());
                task.setStatus(1);
                task.setLocationId(tLocation.getId());
                task.setImplementTime(LocalDateTime.now().plusDays(1));
                task.setTaskType(1);
                task.setTemplateId(detail.getTemplateId());
                String nameAndCode = CodeGenerateUtils.generateVolumeSn();
                task.setTaskName(nameAndCode);
                task.setTaskCode(nameAndCode);
                tasks.add(task);
            }
            // 添加应生成任务数量
            TTemplateCount templateCount = new TTemplateCount();
            templateCount.setTemplateId(detail.getId());
            templateCount.setTaskCount(tLocationList.size()* cycle);
            templateCount.setUserId(sysUser.getUserId());
            templateCountService.save(templateCount);
            taskCleanService.saveBatch(tasks);
            template.setTaskCount(tasks.size());
            template.setTaskCount(taskCount);
            templateService.updateById(template);
            templateDetailService.updateById(detail);
        }
ruoyi-system/src/main/resources/mapper/system/TLeaveMapper.xml
@@ -43,9 +43,8 @@
        <if test="query.auditStatus != null">
            and t1.audit_status = #{query.auditStatus}
        </if>
          <if test="query.startTime != null and startTime != ''">
              and (t1.start_time between #{startTime} and #{endTime})
                and (t1.end_time between #{startTime} and #{endTime})
        <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''">
              and (t1.start_time between #{query.startTime} and #{query.endTime})
        </if>
        <if test="query.deptIds != null and query.deptIds.size()>0">
            AND t2.deptId IN
ruoyi-system/src/main/resources/mapper/system/TTaskMapper.xml
@@ -159,7 +159,7 @@
        left join sys_user t2 on t1.user_id = t2.user_id
        left join t_template t3 on t1.template_id = t3.id
        where 1=1
        and t1.`disabled` = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
        and t1.`disabled` = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} and t3.id is not null
        <if test="query.templateIds != null and query.templateIds.size()>0">
            AND t1.template_id IN
            <foreach collection="query.templateIds" separator="," item="id" open="(" close=")">
@@ -171,6 +171,12 @@
            <foreach collection="query.patrolInspectorIds" separator="," item="id" open="(" close=")">
                #{id}
            </foreach>
        </if>
        <if test="query.templateName != null and query.templateName != ''">
            AND t3.template_name like concat('%',#{query.templateName},'%')
        </if>
        <if test="query.nickName != null and query.nickName != ''">
            AND t2.nick_name like concat('%',#{query.nickName},'%')
        </if>
        group by t1.user_id,t1.template_id
@@ -183,7 +189,7 @@
        left join sys_user t2 on t1.user_id = t2.user_id
        left join t_template t3 on t1.template_id = t3.id
        where 1=1
        and t1.`disabled` = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
        and t1.`disabled` = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} and t3.id is not null
        <if test="query.templateIds != null and query.templateIds.size()>0">
            AND t1.template_id IN
            <foreach collection="query.templateIds" separator="," item="id" open="(" close=")">
@@ -196,6 +202,12 @@
                #{id}
            </foreach>
        </if>
        <if test="query.templateName != null and query.templateName != ''">
            AND t3.template_name like concat('%',#{query.templateName},'%')
        </if>
        <if test="query.nickName != null and query.nickName != ''">
            AND t2.nick_name like concat('%',#{query.nickName},'%')
        </if>
        group by t1.user_id,t1.template_id
    </select>