From 036af8cd158f5768c83cd98ad6dd6256a22feec6 Mon Sep 17 00:00:00 2001 From: 龚焕茏 <2842157468@qq.com> Date: 星期五, 23 八月 2024 16:33:37 +0800 Subject: [PATCH] fix:调整 --- ycl-pojo/src/main/java/com/ycl/platform/domain/form/ReportForm.java | 23 ++-- ycl-pojo/src/main/java/com/ycl/platform/domain/entity/Report.java | 8 + ycl-pojo/src/main/java/com/ycl/platform/domain/query/ReportQuery.java | 9 - ycl-server/src/main/java/com/ycl/platform/service/ReportService.java | 22 +++ ycl-server/src/main/java/com/ycl/platform/controller/ReportController.java | 46 +++++--- ycl-server/src/main/resources/mapper/zgyw/ReportMapper.xml | 23 ++-- ycl-pojo/src/main/java/com/ycl/platform/domain/dto/ReportImportDTO.java | 19 +++ ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml | 21 +-- ycl-pojo/src/main/java/com/ycl/platform/domain/vo/ReportVO.java | 17 +-- ycl-server/src/main/java/com/ycl/platform/service/impl/ReportServiceImpl.java | 60 +++++++++++ 10 files changed, 170 insertions(+), 78 deletions(-) diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/dto/ReportImportDTO.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/dto/ReportImportDTO.java new file mode 100644 index 0000000..9921b02 --- /dev/null +++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/dto/ReportImportDTO.java @@ -0,0 +1,19 @@ +package com.ycl.platform.domain.dto; + +import annotation.Excel; +import lombok.Data; + +/** + * @author gonghl + * @since 2024/8/23 涓婂崍 10:41 + */ +@Data +public class ReportImportDTO { + + @Excel(name = "璁惧缂栫爜") + private String serialNumber; + + @Excel(name = "鐐逛綅鍚嶇О") + private String pointName; + +} diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/Report.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/Report.java index 07f8c7e..93d08bb 100644 --- a/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/Report.java +++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/Report.java @@ -33,8 +33,8 @@ private Integer peopleId; @ApiModelProperty("鐐逛綅ID") - @TableField("point_id") - private Integer pointId; + @TableField("serial_number") + private String serialNumber; @TableField("report_type") private String reportType; @@ -74,4 +74,8 @@ /** 鏍囪瘑鍙凤細鍙敤浜庢煡璇㈠巻鍙插鏍歌褰� */ @TableField("identify") private String identify; + + /** 瀵煎叆鎵规鍙� */ + @TableField("import_batch_number") + private String importBatchNumber; } diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/form/ReportForm.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/form/ReportForm.java index 461f9a2..c5029f2 100644 --- a/ycl-pojo/src/main/java/com/ycl/platform/domain/form/ReportForm.java +++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/form/ReportForm.java @@ -1,21 +1,20 @@ package com.ycl.platform.domain.form; import com.fasterxml.jackson.annotation.JsonFormat; -import com.ycl.system.domain.group.Update; -import com.ycl.system.domain.group.Add; import com.ycl.platform.base.AbsForm; import com.ycl.platform.domain.entity.Report; -import java.time.LocalDateTime; -import java.util.Date; - -import org.springframework.beans.BeanUtils; -import jakarta.validation.constraints.NotBlank; -import jakarta.validation.constraints.NotNull; -import org.springframework.lang.NonNull; +import com.ycl.system.domain.group.Add; +import com.ycl.system.domain.group.Update; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import jakarta.validation.constraints.NotBlank; import lombok.Data; import lombok.experimental.Accessors; +import org.springframework.beans.BeanUtils; +import org.springframework.lang.NonNull; +import org.springframework.web.multipart.MultipartFile; + +import java.util.Date; /** * 鎶ュ琛ㄥ崟 @@ -32,9 +31,11 @@ private Integer peopleId; - @NotNull(message = "鐐逛綅涓嶈兘涓虹┖", groups = {Add.class, Update.class}) @ApiModelProperty("鐐逛綅") - private Integer pointId; + private String pointId; + + @ApiModelProperty("瀵煎叆鐐逛綅") + private MultipartFile importPointId; @ApiModelProperty("鐢熸晥鏃堕棿") @JsonFormat(pattern = "yyyy-MM-dd") diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/query/ReportQuery.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/query/ReportQuery.java index 2e69882..50b9caf 100644 --- a/ycl-pojo/src/main/java/com/ycl/platform/domain/query/ReportQuery.java +++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/query/ReportQuery.java @@ -1,15 +1,12 @@ package com.ycl.platform.domain.query; import com.ycl.platform.base.AbsQuery; - -import java.util.Date; -import java.util.List; -import org.springframework.lang.NonNull; -import jakarta.validation.constraints.NotBlank; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.experimental.Accessors; + +import java.util.List; /** * 鎶ュ鏌ヨ @@ -24,6 +21,8 @@ private String reportType; + private String keyword; + // private Date beginCreateTime; // // private Date endCreateTime; diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/vo/ReportVO.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/vo/ReportVO.java index 13f523d..1be1ae5 100644 --- a/ycl-pojo/src/main/java/com/ycl/platform/domain/vo/ReportVO.java +++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/vo/ReportVO.java @@ -4,16 +4,12 @@ import com.fasterxml.jackson.annotation.JsonFormat; import com.ycl.platform.base.AbsVo; import com.ycl.platform.domain.entity.Report; - -import java.util.Date; -import java.util.List; -import java.time.LocalDateTime; -import org.springframework.lang.NonNull; -import org.springframework.beans.BeanUtils; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.experimental.Accessors; +import org.springframework.beans.BeanUtils; +import org.springframework.lang.NonNull; + +import java.util.Date; /** * 鎶ュ灞曠ず @@ -35,8 +31,9 @@ @Excel(name = "鎶ュ浜哄憳") private String peopleName; - /** 鐐逛綅ID */ - private Integer pointId; + /** 璁惧缂栫爜 */ + private String serialNumber; + @Excel(name = "鐐逛綅") private String pointName; diff --git a/ycl-server/src/main/java/com/ycl/platform/controller/ReportController.java b/ycl-server/src/main/java/com/ycl/platform/controller/ReportController.java index 4f85e46..4c754bf 100644 --- a/ycl-server/src/main/java/com/ycl/platform/controller/ReportController.java +++ b/ycl-server/src/main/java/com/ycl/platform/controller/ReportController.java @@ -1,28 +1,24 @@ package com.ycl.platform.controller; -import com.ycl.platform.domain.entity.Report; -import com.ycl.platform.domain.entity.TMonitor; import com.ycl.platform.domain.form.ReportAuditingForm; -import com.ycl.platform.domain.vo.ReportVO; -import com.ycl.platform.domain.vo.TMonitorVO; -import com.ycl.system.domain.group.Update; -import com.ycl.system.domain.group.Add; -import com.ycl.utils.poi.ExcelUtil; -import jakarta.servlet.http.HttpServletResponse; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.validation.annotation.Validated; -import lombok.RequiredArgsConstructor; -import java.util.List; -import org.springframework.validation.annotation.Validated; -import jakarta.validation.constraints.NotEmpty; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import com.ycl.platform.service.ReportService; -import com.ycl.system.Result; import com.ycl.platform.domain.form.ReportForm; import com.ycl.platform.domain.query.ReportQuery; +import com.ycl.platform.domain.vo.ReportVO; +import com.ycl.platform.service.ReportService; +import com.ycl.system.Result; +import com.ycl.system.domain.group.Add; +import com.ycl.system.domain.group.Update; +import com.ycl.utils.poi.ExcelUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.constraints.NotEmpty; import lombok.RequiredArgsConstructor; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; + +import java.util.List; /** * 鎶ュ 鍓嶇鎺у埗鍣� @@ -46,6 +42,20 @@ return reportService.add(form); } + @PostMapping("/import") + @ApiOperation(value = "瀵煎叆", notes = "瀵煎叆") + @PreAuthorize("@ss.hasPermi('system:report:add')") + public Result importData(ReportForm form) { + return reportService.importData(form); + } + + @PostMapping("/importTemplate") + @ApiOperation(value = "瀵煎叆妯℃澘", notes = "瀵煎叆妯℃澘") + @PreAuthorize("@ss.hasPermi('system:report:add')") + public void importTemplate(HttpServletResponse response) { + reportService.importTemplate(response); + } + @PutMapping @ApiOperation(value = "淇敼", notes = "淇敼") @PreAuthorize("@ss.hasPermi('system:report:edit')") diff --git a/ycl-server/src/main/java/com/ycl/platform/service/ReportService.java b/ycl-server/src/main/java/com/ycl/platform/service/ReportService.java index c8f3bba..791a32f 100644 --- a/ycl-server/src/main/java/com/ycl/platform/service/ReportService.java +++ b/ycl-server/src/main/java/com/ycl/platform/service/ReportService.java @@ -1,12 +1,14 @@ package com.ycl.platform.service; -import com.ycl.platform.domain.entity.Report; import com.baomidou.mybatisplus.extension.service.IService; +import com.ycl.platform.domain.entity.Report; import com.ycl.platform.domain.form.ReportAuditingForm; -import com.ycl.platform.domain.vo.ReportVO; -import com.ycl.system.Result; import com.ycl.platform.domain.form.ReportForm; import com.ycl.platform.domain.query.ReportQuery; +import com.ycl.platform.domain.vo.ReportVO; +import com.ycl.system.Result; +import jakarta.servlet.http.HttpServletResponse; + import java.util.List; /** @@ -24,6 +26,20 @@ */ Result add(ReportForm form); + + /** + * 瀵煎叆妯℃澘 + * @param response 缁撴灉 + */ + void importTemplate(HttpServletResponse response); + + /** + * 瀵煎叆 + * @param form 鏁版嵁 + * @return 缁撴灉 + */ + Result importData(ReportForm form); + /** * 淇敼 * @param form diff --git a/ycl-server/src/main/java/com/ycl/platform/service/impl/ReportServiceImpl.java b/ycl-server/src/main/java/com/ycl/platform/service/impl/ReportServiceImpl.java index 8ae4329..0e45a4b 100644 --- a/ycl-server/src/main/java/com/ycl/platform/service/impl/ReportServiceImpl.java +++ b/ycl-server/src/main/java/com/ycl/platform/service/impl/ReportServiceImpl.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ycl.platform.domain.dto.ReportImportDTO; import com.ycl.platform.domain.entity.Report; import com.ycl.platform.domain.entity.YwPeople; import com.ycl.platform.domain.entity.YwPoint; @@ -19,13 +20,18 @@ import com.ycl.platform.service.ReportService; import com.ycl.system.Result; import com.ycl.system.page.PageUtil; +import com.ycl.utils.DateUtils; import com.ycl.utils.SecurityUtils; +import com.ycl.utils.poi.ExcelUtil; import com.ycl.utils.uuid.IdUtils; +import enumeration.general.ErrorTypeEnum; +import jakarta.servlet.http.HttpServletResponse; import lombok.RequiredArgsConstructor; +import lombok.SneakyThrows; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; -import org.springframework.context.annotation.Bean; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import org.springframework.util.Assert; import org.springframework.util.CollectionUtils; @@ -56,11 +62,16 @@ */ @Override public Result add(ReportForm form) { + if (Objects.isNull(form.getPointId())) { + throw new RuntimeException("鐐逛綅涓嶈兘涓虹┖"); + } Long userId = SecurityUtils.getUserId(); YwPeople people = new LambdaQueryChainWrapper<>(peopleMapper).eq(YwPeople::getUserId, userId).one(); form.setPeopleId(people.getId()); form.setUnitId(people.getBelongUnit()); Report entity = ReportForm.getEntityByForm(form, null); + entity.setSerialNumber(form.getPointId()); + entity.setErrorType(String.join(",", form.getErrorType())); entity.setStatus(0); entity.setIdentify(IdUtils.timeAddRandomNO(3)); Date now = new Date(); @@ -68,6 +79,46 @@ entity.setUpdateTime(now); if(baseMapper.insert(entity) > 0) { return Result.ok("娣诲姞鎴愬姛"); + } + return Result.error("娣诲姞澶辫触"); + } + + @Override + @SneakyThrows + public void importTemplate(HttpServletResponse response) { + ExcelUtil<ReportImportDTO> excelUtil = new ExcelUtil<>(ReportImportDTO.class); + excelUtil.exportExcel(response, null, "鎶ュ瀵煎叆妯℃澘"); + } + + @Override + @SneakyThrows + @Transactional + public Result importData(ReportForm form) { + if (Objects.isNull(form.getImportPointId())) { + throw new RuntimeException("鐐逛綅涓嶈兘涓虹┖"); + } + Long userId = SecurityUtils.getUserId(); + YwPeople people = new LambdaQueryChainWrapper<>(peopleMapper).eq(YwPeople::getUserId, userId).one(); + form.setPeopleId(people.getId()); + form.setUnitId(people.getBelongUnit()); + // 璇诲彇excel鏁版嵁 + ExcelUtil<ReportImportDTO> excelUtil = new ExcelUtil<>(ReportImportDTO.class); + List<ReportImportDTO> list = excelUtil.importExcel(form.getImportPointId().getInputStream()); + // 鎵归噺鎻掑叆 + ArrayList<Report> reports = new ArrayList<>(); + long l = System.currentTimeMillis(); + list.forEach( item -> { + Report entity = ReportForm.getEntityByForm(form, null); + entity.setImportBatchNumber(String.valueOf(l)); + entity.setSerialNumber(item.getSerialNumber()); + entity.setStatus(0); + entity.setIdentify(IdUtils.timeAddRandomNO(3)); + entity.setCreateTime(DateUtils.getNowDate()); + entity.setUpdateTime(DateUtils.getNowDate()); + reports.add(entity); + }); + if (saveBatch(reports)) { + return Result.ok("瀵煎叆鎴愬姛"); } return Result.error("娣诲姞澶辫触"); } @@ -138,6 +189,7 @@ public Result page(ReportQuery query) { IPage<ReportVO> page = PageUtil.getPage(query, ReportVO.class); baseMapper.page(page, query); + page.getRecords().forEach(item -> item.setErrorType(ErrorTypeEnum.getEnumValue(item.getErrorType()))); return Result.ok().data(page).total(page.getTotal()); } @@ -193,7 +245,7 @@ .eq(StringUtils.isNotBlank(query.getReportType()), Report::getReportType, query.getReportType()) // .le(Objects.nonNull(query.getBeginCreateTime()), Report::getBeginCreateTime, query.getBeginCreateTime()) // .ge(Objects.nonNull(query.getEndCreateTime()), Report::getEndCreateTime, query.getEndCreateTime()) - .in(!CollectionUtils.isEmpty(query.getPointIdList()), Report::getPointId, query.getPointIdList()) +// .in(!CollectionUtils.isEmpty(query.getPointIdList()), Report::getPointId, query.getPointIdList()) .in(!CollectionUtils.isEmpty(query.getPeopleIdList()), Report::getPeopleId, query.getPeopleIdList()) .orderByDesc(Report::getCreateTime) .page(PageUtil.getPage(query, Report.class)); @@ -206,8 +258,8 @@ vo.setUnitName(unit.getUnitName()); YwPeople ywPeople = peopleMapper.selectById(vo.getPeopleId()); vo.setPeopleName(ywPeople.getYwPersonName()); - YwPoint ywPoint = ywpointMapper.selectById(vo.getPointId()); - vo.setPointName(ywPoint.getPointName()); + // YwPoint ywPoint = ywpointMapper.selectById(vo.getPointId()); + // vo.setPointName(ywPoint.getPointName()); return vo; } ) diff --git a/ycl-server/src/main/resources/mapper/zgyw/ReportMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/ReportMapper.xml index 9da4ca5..c97ca6c 100644 --- a/ycl-server/src/main/resources/mapper/zgyw/ReportMapper.xml +++ b/ycl-server/src/main/resources/mapper/zgyw/ReportMapper.xml @@ -9,7 +9,7 @@ <result column="update_time" property="updateTime" /> <result column="unit_id" property="unitId" /> <result column="people_id" property="peopleId" /> - <result column="point_id" property="pointId" /> + <result column="serial_number" property="serialNumber" /> <result column="auditing_time" property="auditingTime" /> <result column="report_content" property="reportContent" /> <result column="report_materials" property="reportMaterials" /> @@ -23,13 +23,13 @@ t_report r LEFT JOIN t_yw_unit u ON r.unit_id = u.id and u.deleted = 0 LEFT JOIN t_yw_people p ON r.people_id = p.id and p.deleted = 0 - LEFT JOIN t_yw_point pt ON r.point_id = pt.id and pt.deleted = 0 - INNER JOIN ( + LEFT JOIN t_yw_point pt ON r.serial_number = pt.serial_number and pt.deleted = 0 + /* INNER JOIN ( SELECT identify,MAX(create_time) AS create_time FROM t_report WHERE deleted = 0 GROUP BY identify - ) as rr ON r.create_time = rr.create_time + ) as rr ON r.create_time = rr.create_time*/ WHERE r.deleted = 0 <if test="query.reportType != null and query.reportType != ''"> @@ -38,11 +38,8 @@ <if test="query.status != null"> AND r.status = #{query.status} </if> - <if test="query.pointId != null and query.pointId != ''"> - AND pt.point_name like concat('%', #{query.pointId}, '%') - </if> - <if test="query.peopleId != null and query.peopleId != ''"> - AND p.yw_person_name like concat('%', #{query.peopleId}, '%') + <if test="query.keyword != null and query.keyword != ''"> + AND (pt.point_name like concat('%', #{query.pointId}, '%') OR p.yw_person_name like concat('%', #{query.peopleId}, '%')) </if> ORDER BY r.update_time DESC </select> @@ -54,7 +51,7 @@ t_report r LEFT JOIN t_yw_unit u ON r.unit_id = u.id and u.deleted = 0 LEFT JOIN t_yw_people p ON r.people_id = p.id and p.deleted = 0 - LEFT JOIN t_yw_point pt ON r.point_id = pt.id and pt.deleted = 0 + LEFT JOIN t_yw_point pt ON r.serial_number = pt.serial_number and pt.deleted = 0 INNER JOIN ( SELECT identify, create_time FROM t_report @@ -66,17 +63,17 @@ <select id="selectNumberList" resultType="java.lang.String"> SELECT yp.serial_number FROM t_report r - LEFT JOIN t_yw_point yp ON r.point_id = yp.id + LEFT JOIN t_yw_point yp ON r.serial_number = yp.serial_number WHERE r.status = #{status} AND #{date} between r.begin_create_time and r.end_create_time </select> <select id="checkPointReported" resultType="com.ycl.platform.domain.vo.ReportVO"> SELECT - r.id, r.errorType + r.id, r.error_type FROM t_report r - INNER JOIN t_yw_point yo ON r.point_id = yo.id AND yo.deleted = 0 + INNER JOIN t_yw_point yo ON r.serial_number = yo.serial_number AND yo.deleted = 0 INNER JOIN t_work_order wo ON yo.serial_number = wo.serial_number AND wo.serial_number = #{serialNumber} AND wo.deleted = 0 WHERE r.status = 1 diff --git a/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml index 78b6c63..1dd8412 100644 --- a/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml +++ b/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml @@ -367,10 +367,9 @@ COUNT(p2.id) AS errorNum, COUNT(p1.id) - COUNT(p2.id) AS normalNum FROM t_monitor - LEFT JOIN t_yw_point p1 ON t_monitor.serial_number = p1.serial_number <if test="dataScope == 1"> AND p1.province_tag = 'province' </if> - LEFT JOIN t_yw_point p2 ON t_monitor.serial_number = p2.serial_number AND p2.recovery = 1 <if test="dataScope == 1"> AND p2.province_tag = 'province' </if> + LEFT JOIN t_yw_point p1 ON t_monitor.serial_number = p1.serial_number <if test="dataScope == 1"> AND p1.province_tag = 'province' </if><if test="deptId != null"> AND p1.dept_id = #{deptId} </if> + LEFT JOIN t_yw_point p2 ON t_monitor.serial_number = p2.serial_number AND p2.recovery = 1 AND p1.id = p2.id <if test="dataScope == 1"> AND p2.province_tag = 'province' </if><if test="deptId != null"> AND p2.dept_id = #{deptId} </if> WHERE INSTR(camera_fun_type, 1) - <if test="deptId != null"> AND p1.dept_id = #{deptId} AND p2.dept_id = #{deptId} </if> UNION ALL SELECT '杞﹁締' as type, @@ -378,10 +377,9 @@ COUNT(p2.id) AS errorNum, COUNT(p1.id) - COUNT(p2.id) AS normalNum FROM t_monitor - LEFT JOIN t_yw_point p1 ON t_monitor.serial_number = p1.serial_number <if test="dataScope == 1"> AND p1.province_tag = 'province' </if> - LEFT JOIN t_yw_point p2 ON t_monitor.serial_number = p2.serial_number AND p2.recovery = 1 <if test="dataScope == 1"> AND p2.province_tag = 'province' </if> + LEFT JOIN t_yw_point p1 ON t_monitor.serial_number = p1.serial_number <if test="dataScope == 1"> AND p1.province_tag = 'province' </if><if test="deptId != null"> AND p1.dept_id = #{deptId} </if> + LEFT JOIN t_yw_point p2 ON t_monitor.serial_number = p2.serial_number AND p2.recovery = 1 AND p1.id = p2.id <if test="dataScope == 1"> AND p2.province_tag = 'province' </if><if test="deptId != null"> AND p2.dept_id = #{deptId} </if> WHERE INSTR(camera_fun_type, 2) - <if test="deptId != null"> AND p1.dept_id = #{deptId} AND p2.dept_id = #{deptId} </if> UNION ALL SELECT '浜鸿劯' as type, @@ -389,10 +387,9 @@ COUNT(p2.id) AS errorNum, COUNT(p1.id) - COUNT(p2.id) AS normalNum FROM t_monitor - LEFT JOIN t_yw_point p1 ON t_monitor.serial_number = p1.serial_number <if test="dataScope == 1"> AND p1.province_tag = 'province' </if> - LEFT JOIN t_yw_point p2 ON t_monitor.serial_number = p2.serial_number AND p2.recovery = 1 <if test="dataScope == 1"> AND p2.province_tag = 'province' </if> + LEFT JOIN t_yw_point p1 ON t_monitor.serial_number = p1.serial_number <if test="dataScope == 1"> AND p1.province_tag = 'province' </if><if test="deptId != null"> AND p1.dept_id = #{deptId} </if> + LEFT JOIN t_yw_point p2 ON t_monitor.serial_number = p2.serial_number AND p2.recovery = 1 AND p1.id = p2.id <if test="dataScope == 1"> AND p2.province_tag = 'province' </if><if test="deptId != null"> AND p2.dept_id = #{deptId} </if> WHERE INSTR(camera_fun_type, 3) - <if test="deptId != null"> AND p1.dept_id = #{deptId} AND p2.dept_id = #{deptId} </if> </select> <select id="monitorRate" resultType="com.ycl.platform.domain.vo.screen.MonitorRateVO"> @@ -409,7 +406,7 @@ FROM sys_dept d LEFT JOIN t_yw_point p ON p.dept_id = d.dept_id AND p.deleted = 0 <if test="dataScope == 1"> AND p.province_tag = 'province' </if> - LEFT JOIN t_yw_point p2 ON p2.dept_id = d.dept_id AND p2.deleted = 0 AND p2.recovery = 1 <if test="dataScope == 1"> AND p2.province_tag = 'province' </if> + LEFT JOIN t_yw_point p2 ON p2.dept_id = d.dept_id AND p2.deleted = 0 AND p2.recovery = 1 AND p.id = p2.id <if test="dataScope == 1"> AND p2.province_tag = 'province' </if> LEFT JOIN t_monitor m ON m.serial_number = p.serial_number AND INSTR(m.camera_fun_type, 1) LEFT JOIN t_monitor m2 ON m2.serial_number = p2.serial_number AND INSTR(m2.camera_fun_type, 1) WHERE d.del_flag = 0 AND d.area IS NOT NULL @@ -427,7 +424,7 @@ FROM sys_dept d LEFT JOIN t_yw_point p ON p.dept_id = d.dept_id AND p.deleted = 0 <if test="dataScope == 1"> AND p.province_tag = 'province' </if> - LEFT JOIN t_yw_point p2 ON p2.dept_id = d.dept_id AND p2.deleted = 0 AND p2.recovery = 1 <if test="dataScope == 1"> AND p2.province_tag = 'province' </if> + LEFT JOIN t_yw_point p2 ON p2.dept_id = d.dept_id AND p2.deleted = 0 AND p2.recovery = 1 AND p.id = p2.id <if test="dataScope == 1"> AND p2.province_tag = 'province' </if> LEFT JOIN t_monitor m ON m.serial_number = p.serial_number AND INSTR(m.camera_fun_type, 2) LEFT JOIN t_monitor m2 ON m2.serial_number = p2.serial_number AND INSTR(m2.camera_fun_type, 2) WHERE d.del_flag = 0 AND d.area IS NOT NULL @@ -445,7 +442,7 @@ FROM sys_dept d LEFT JOIN t_yw_point p ON p.dept_id = d.dept_id AND p.deleted = 0 <if test="dataScope == 1"> AND p.province_tag = 'province' </if> - LEFT JOIN t_yw_point p2 ON p2.dept_id = d.dept_id AND p2.deleted = 0 AND p2.recovery = 1 <if test="dataScope == 1"> AND p2.province_tag = 'province' </if> + LEFT JOIN t_yw_point p2 ON p2.dept_id = d.dept_id AND p2.deleted = 0 AND p2.recovery = 1 AND p.id = p2.id <if test="dataScope == 1"> AND p2.province_tag = 'province' </if> LEFT JOIN t_monitor m ON m.serial_number = p.serial_number AND INSTR(m.camera_fun_type, 3) LEFT JOIN t_monitor m2 ON m2.serial_number = p2.serial_number AND INSTR(m2.camera_fun_type, 3) WHERE d.del_flag = 0 AND d.area IS NOT NULL -- Gitblit v1.8.0