添加安全环保检查导出功能
parent
ab7b7e0aad
commit
125c3a626c
|
|
@ -5,6 +5,7 @@ import com.alibaba.cola.dto.MultiResponse;
|
||||||
import com.alibaba.cola.dto.PageResponse;
|
import com.alibaba.cola.dto.PageResponse;
|
||||||
import com.alibaba.cola.dto.Response;
|
import com.alibaba.cola.dto.Response;
|
||||||
import com.alibaba.cola.dto.SingleResponse;
|
import com.alibaba.cola.dto.SingleResponse;
|
||||||
|
import com.jjb.saas.framework.auth.utils.AuthContext;
|
||||||
import com.zcloud.key.project.api.inspection.SafetyEnvironmentalInspectionServiceI;
|
import com.zcloud.key.project.api.inspection.SafetyEnvironmentalInspectionServiceI;
|
||||||
import com.zcloud.key.project.dto.clientobject.inspection.SafetyEnvironmentalInspectionCO;
|
import com.zcloud.key.project.dto.clientobject.inspection.SafetyEnvironmentalInspectionCO;
|
||||||
import com.zcloud.key.project.dto.inspection.SafetyEnvironmentalInspectionAddCmd;
|
import com.zcloud.key.project.dto.inspection.SafetyEnvironmentalInspectionAddCmd;
|
||||||
|
|
@ -17,6 +18,7 @@ import lombok.AllArgsConstructor;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -70,7 +72,11 @@ public class SafetyEnvironmentalInspectionController {
|
||||||
public PageResponse<SafetyEnvironmentalInspectionCO> page(@RequestBody SafetyEnvironmentalInspectionPageQry qry) {
|
public PageResponse<SafetyEnvironmentalInspectionCO> page(@RequestBody SafetyEnvironmentalInspectionPageQry qry) {
|
||||||
return safetyEnvironmentalInspectionService.listPage(qry);
|
return safetyEnvironmentalInspectionService.listPage(qry);
|
||||||
}
|
}
|
||||||
|
@ApiOperation("导出")
|
||||||
|
@GetMapping("/export")
|
||||||
|
public void export(@RequestParam(value = "ids") Long[] ids, HttpServletResponse httpServletResponse) {
|
||||||
|
safetyEnvironmentalInspectionService.export(ids, httpServletResponse);
|
||||||
|
}
|
||||||
@ApiOperation("所有数据")
|
@ApiOperation("所有数据")
|
||||||
@GetMapping("/listAll")
|
@GetMapping("/listAll")
|
||||||
public MultiResponse<SafetyEnvironmentalInspectionCO> listAll() {
|
public MultiResponse<SafetyEnvironmentalInspectionCO> listAll() {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.zcloud.key.project.command.convertor.inspection;
|
package com.zcloud.key.project.command.convertor.inspection;
|
||||||
|
|
||||||
|
import com.zcloud.gbscommon.excelEntity.SafetyEnvironmentalInspectionExportEntity;
|
||||||
import com.zcloud.key.project.dto.clientobject.inspection.SafetyEnvironmentalInspectionCO;
|
import com.zcloud.key.project.dto.clientobject.inspection.SafetyEnvironmentalInspectionCO;
|
||||||
import com.zcloud.key.project.persistence.dataobject.inspection.SafetyEnvironmentalInspectionDO;
|
import com.zcloud.key.project.persistence.dataobject.inspection.SafetyEnvironmentalInspectionDO;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
|
|
@ -22,5 +23,7 @@ public interface SafetyEnvironmentalInspectionCoConvertor {
|
||||||
List<SafetyEnvironmentalInspectionCO> converDOsToCOs(List<SafetyEnvironmentalInspectionDO> safetyEnvironmentalInspectionDOs);
|
List<SafetyEnvironmentalInspectionCO> converDOsToCOs(List<SafetyEnvironmentalInspectionDO> safetyEnvironmentalInspectionDOs);
|
||||||
|
|
||||||
SafetyEnvironmentalInspectionCO converDOToCO(SafetyEnvironmentalInspectionDO safetyEnvironmentalInspectionDO);
|
SafetyEnvironmentalInspectionCO converDOToCO(SafetyEnvironmentalInspectionDO safetyEnvironmentalInspectionDO);
|
||||||
|
|
||||||
|
List<SafetyEnvironmentalInspectionExportEntity> converDOsToExcelEntitys(List<SafetyEnvironmentalInspectionDO> safetyEnvironmentalInspectionDOs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ public class AiAlarmQueryExe {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public AiAlarmCO queryById(Long id) {
|
public AiAlarmCO queryById(Long id) {
|
||||||
return aiAlarmCoConvertor.converDOToCO(aiAlarmRepository.getById(id));
|
return aiAlarmCoConvertor.converDOToCO(aiAlarmRepository.findById(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
package com.zcloud.key.project.command.query.inspection;
|
package com.zcloud.key.project.command.query.inspection;
|
||||||
|
|
||||||
import com.alibaba.cola.dto.PageResponse;
|
import com.alibaba.cola.dto.PageResponse;
|
||||||
|
import com.alibaba.cola.exception.BizException;
|
||||||
|
import com.zcloud.gbscommon.excelEntity.SafetyEnvironmentalInspectionExportEntity;
|
||||||
|
import com.zcloud.gbscommon.excelEntity.UserExcelExportEntity;
|
||||||
|
import com.zcloud.gbscommon.utils.ExcelUtils;
|
||||||
import com.zcloud.gbscommon.utils.PageQueryHelper;
|
import com.zcloud.gbscommon.utils.PageQueryHelper;
|
||||||
import com.zcloud.key.project.command.convertor.hidden.HiddenCoConvertor;
|
import com.zcloud.key.project.command.convertor.hidden.HiddenCoConvertor;
|
||||||
import com.zcloud.key.project.command.convertor.hidden.HiddenFindUserCoConvertor;
|
import com.zcloud.key.project.command.convertor.hidden.HiddenFindUserCoConvertor;
|
||||||
|
|
@ -18,6 +22,7 @@ import com.zcloud.key.project.persistence.dataobject.hidden.HiddenFindUserDO;
|
||||||
import com.zcloud.key.project.persistence.dataobject.inspection.SafetyEnvironmentalInspectionContentDO;
|
import com.zcloud.key.project.persistence.dataobject.inspection.SafetyEnvironmentalInspectionContentDO;
|
||||||
import com.zcloud.key.project.persistence.dataobject.inspection.SafetyEnvironmentalInspectionDO;
|
import com.zcloud.key.project.persistence.dataobject.inspection.SafetyEnvironmentalInspectionDO;
|
||||||
import com.zcloud.key.project.persistence.dataobject.inspection.SafetyEnvironmentalInspectionUserDO;
|
import com.zcloud.key.project.persistence.dataobject.inspection.SafetyEnvironmentalInspectionUserDO;
|
||||||
|
import com.zcloud.key.project.persistence.mapper.inspection.SafetyEnvironmentalInspectionMapper;
|
||||||
import com.zcloud.key.project.persistence.repository.hidden.HiddenFindUserRepository;
|
import com.zcloud.key.project.persistence.repository.hidden.HiddenFindUserRepository;
|
||||||
import com.zcloud.key.project.persistence.repository.hidden.HiddenRepository;
|
import com.zcloud.key.project.persistence.repository.hidden.HiddenRepository;
|
||||||
import com.zcloud.key.project.persistence.repository.inspection.SafetyEnvironmentalInspectionContentRepository;
|
import com.zcloud.key.project.persistence.repository.inspection.SafetyEnvironmentalInspectionContentRepository;
|
||||||
|
|
@ -27,10 +32,9 @@ import lombok.AllArgsConstructor;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.HashMap;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.*;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -126,5 +130,20 @@ public class SafetyEnvironmentalInspectionQueryExe {
|
||||||
List<SafetyEnvironmentalInspectionCO> examCenterCOS = safetyEnvironmentalInspectionCoConvertor.converDOsToCOs(pageResponse.getData());
|
List<SafetyEnvironmentalInspectionCO> examCenterCOS = safetyEnvironmentalInspectionCoConvertor.converDOsToCOs(pageResponse.getData());
|
||||||
return PageResponse.of(examCenterCOS, pageResponse.getTotalCount(), pageResponse.getPageSize(), pageResponse.getPageIndex());
|
return PageResponse.of(examCenterCOS, pageResponse.getTotalCount(), pageResponse.getPageSize(), pageResponse.getPageIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void export(Long[] ids, HttpServletResponse httpServletResponse) {
|
||||||
|
if (ids == null || ids.length == 0){
|
||||||
|
throw new BizException("请勾选要导出的数据");
|
||||||
|
}
|
||||||
|
Map<String, Object> params = new HashMap<>();
|
||||||
|
params.put("ids", ids);
|
||||||
|
List<SafetyEnvironmentalInspectionDO> safetyEnvironmentalInspectionDOs = safetyEnvironmentalInspectionRepository.listAll(params);
|
||||||
|
List<SafetyEnvironmentalInspectionExportEntity> safetyEnvironmentalInspectionExportEntities = safetyEnvironmentalInspectionCoConvertor.converDOsToExcelEntitys(safetyEnvironmentalInspectionDOs);
|
||||||
|
try {
|
||||||
|
ExcelUtils.exportExcel(httpServletResponse, SafetyEnvironmentalInspectionExportEntity.class, "安全环保检查信息", safetyEnvironmentalInspectionExportEntities);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,8 @@ import com.zcloud.key.project.dto.inspection.SafetyEnvironmentalInspectionUpdate
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* web-app
|
* web-app
|
||||||
*
|
*
|
||||||
|
|
@ -70,5 +72,10 @@ public class SafetyEnvironmentalInspectionServiceImpl implements SafetyEnvironme
|
||||||
public void removeBatch(Long[] ids) {
|
public void removeBatch(Long[] ids) {
|
||||||
safetyEnvironmentalInspectionRemoveExe.execute(ids);
|
safetyEnvironmentalInspectionRemoveExe.execute(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void export(Long[] ids, HttpServletResponse httpServletResponse) {
|
||||||
|
safetyEnvironmentalInspectionQueryExe.export(ids, httpServletResponse);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@ import com.zcloud.key.project.dto.inspection.SafetyEnvironmentalInspectionAuditD
|
||||||
import com.zcloud.key.project.dto.inspection.SafetyEnvironmentalInspectionPageQry;
|
import com.zcloud.key.project.dto.inspection.SafetyEnvironmentalInspectionPageQry;
|
||||||
import com.zcloud.key.project.dto.inspection.SafetyEnvironmentalInspectionUpdateCmd;
|
import com.zcloud.key.project.dto.inspection.SafetyEnvironmentalInspectionUpdateCmd;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* web-client
|
* web-client
|
||||||
*
|
*
|
||||||
|
|
@ -30,5 +32,7 @@ public interface SafetyEnvironmentalInspectionServiceI {
|
||||||
void remove(Long id);
|
void remove(Long id);
|
||||||
|
|
||||||
void removeBatch(Long[] ids);
|
void removeBatch(Long[] ids);
|
||||||
|
|
||||||
|
void export(Long[] ids, HttpServletResponse httpServletResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,14 @@ public class AiAlarmCO extends ClientObject {
|
||||||
private LocalDateTime alarmTime;
|
private LocalDateTime alarmTime;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "相关方单位负责人id")
|
||||||
|
private String xgfMasterUserId;
|
||||||
|
@ApiModelProperty(value = "相关方单位负责人名称")
|
||||||
|
private String xgfMasterUserName;
|
||||||
|
@ApiModelProperty(value = "相关方单位负责人部门id")
|
||||||
|
private String xgfMasterDepartmentId;
|
||||||
|
@ApiModelProperty(value = "相关方单位负责人部门名称")
|
||||||
|
private String xgfMasterDepartmentName;
|
||||||
//处置状态 0-待处理 1-已处理
|
//处置状态 0-待处理 1-已处理
|
||||||
@ApiModelProperty(value = "处置状态 0-待处理 1-已处理")
|
@ApiModelProperty(value = "处置状态 0-待处理 1-已处理")
|
||||||
private Integer state;
|
private Integer state;
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,25 @@ public class AiAlarmDO extends BaseDO {
|
||||||
@ApiModelProperty(value = "处置人")
|
@ApiModelProperty(value = "处置人")
|
||||||
private Long disposeUserId;
|
private Long disposeUserId;
|
||||||
|
|
||||||
|
|
||||||
|
// kp.xgf_master_user_id,
|
||||||
|
// xgfu.name as xgf_master_user_name,
|
||||||
|
// xgfu.department_id as xgf_master_department_id,
|
||||||
|
// xgfd.name as xgf_master_department_name
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "相关方单位负责人id")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String xgfMasterUserId;
|
||||||
|
@ApiModelProperty(value = "相关方单位负责人名称")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String xgfMasterUserName;
|
||||||
|
@ApiModelProperty(value = "相关方单位负责人部门id")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String xgfMasterDepartmentId;
|
||||||
|
@ApiModelProperty(value = "相关方单位负责人部门名称")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String xgfMasterDepartmentName;
|
||||||
|
|
||||||
public AiAlarmDO(String aiAlarmId) {
|
public AiAlarmDO(String aiAlarmId) {
|
||||||
this.aiAlarmId = aiAlarmId;
|
this.aiAlarmId = aiAlarmId;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,5 +16,7 @@ import java.util.Map;
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface AiAlarmMapper extends BaseMapper<AiAlarmDO> {
|
public interface AiAlarmMapper extends BaseMapper<AiAlarmDO> {
|
||||||
IPage<AiAlarmDO> selectListPage(IPage<AiAlarmDO> iPage, Map<String, Object> params, String menuPerms);
|
IPage<AiAlarmDO> selectListPage(IPage<AiAlarmDO> iPage, Map<String, Object> params, String menuPerms);
|
||||||
|
|
||||||
|
AiAlarmDO findById(Long id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import com.zcloud.key.project.persistence.dataobject.project.KeyProjectDO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -24,5 +25,7 @@ public interface SafetyEnvironmentalInspectionMapper extends BaseMapper<SafetyEn
|
||||||
SafetyEnvironmentalInspectionDO getByInspectionId(String inspectionId);
|
SafetyEnvironmentalInspectionDO getByInspectionId(String inspectionId);
|
||||||
|
|
||||||
SafetyEnvironmentalInspectionDO getInfoById(Long id);
|
SafetyEnvironmentalInspectionDO getInfoById(Long id);
|
||||||
|
|
||||||
|
List<SafetyEnvironmentalInspectionDO> listAll(@Param("params") Map<String, Object> params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,5 +14,7 @@ import java.util.Map;
|
||||||
*/
|
*/
|
||||||
public interface AiAlarmRepository extends BaseRepository<AiAlarmDO> {
|
public interface AiAlarmRepository extends BaseRepository<AiAlarmDO> {
|
||||||
PageResponse<AiAlarmDO> listPage(Map<String, Object> params);
|
PageResponse<AiAlarmDO> listPage(Map<String, Object> params);
|
||||||
|
|
||||||
|
AiAlarmDO findById(Long id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,5 +32,10 @@ public class AiAlarmRepositoryImpl extends BaseRepositoryImpl<AiAlarmMapper, AiA
|
||||||
IPage<AiAlarmDO> result = aiAlarmMapper.selectListPage(iPage, params, null);
|
IPage<AiAlarmDO> result = aiAlarmMapper.selectListPage(iPage, params, null);
|
||||||
return PageHelper.pageToResponse(result, result.getRecords());
|
return PageHelper.pageToResponse(result, result.getRecords());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AiAlarmDO findById(Long id) {
|
||||||
|
return aiAlarmMapper.findById(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ import com.zcloud.key.project.persistence.repository.inspection.SafetyEnvironmen
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -61,5 +62,10 @@ public class SafetyEnvironmentalInspectionRepositoryImpl extends BaseRepositoryI
|
||||||
public SafetyEnvironmentalInspectionDO getInfoById(Long id) {
|
public SafetyEnvironmentalInspectionDO getInfoById(Long id) {
|
||||||
return safetyEnvironmentalInspectionMapper.getInfoById(id);
|
return safetyEnvironmentalInspectionMapper.getInfoById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SafetyEnvironmentalInspectionDO> listAll(Map<String, Object> params) {
|
||||||
|
return safetyEnvironmentalInspectionMapper.listAll(params);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import com.jjb.saas.framework.repository.repo.BaseRepository;
|
||||||
import com.zcloud.key.project.persistence.dataobject.inspection.SafetyEnvironmentalInspectionDO;
|
import com.zcloud.key.project.persistence.dataobject.inspection.SafetyEnvironmentalInspectionDO;
|
||||||
import com.zcloud.key.project.persistence.dataobject.inspection.SafetyEnvironmentalInspectionUserDO;
|
import com.zcloud.key.project.persistence.dataobject.inspection.SafetyEnvironmentalInspectionUserDO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -22,5 +23,7 @@ public interface SafetyEnvironmentalInspectionRepository extends BaseRepository<
|
||||||
SafetyEnvironmentalInspectionDO getByInspectionId(String inspectionId);
|
SafetyEnvironmentalInspectionDO getByInspectionId(String inspectionId);
|
||||||
|
|
||||||
SafetyEnvironmentalInspectionDO getInfoById(Long id);
|
SafetyEnvironmentalInspectionDO getInfoById(Long id);
|
||||||
|
|
||||||
|
List<SafetyEnvironmentalInspectionDO> listAll(Map<String, Object> params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,5 +23,21 @@
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="findById" resultType="com.zcloud.key.project.persistence.dataobject.ai.AiAlarmDO">
|
||||||
|
select
|
||||||
|
aa.*,
|
||||||
|
kp.project_name,
|
||||||
|
kp.xgf_master_user_id,
|
||||||
|
xgfu.name as xgf_master_user_name,
|
||||||
|
xgfu.department_id as xgf_master_department_id,
|
||||||
|
xgfd.name as xgf_master_department_name
|
||||||
|
from
|
||||||
|
ai_alarm aa
|
||||||
|
left join key_project kp on kp.key_project_id = aa.key_project_id
|
||||||
|
left join user xgfu on xgfu.id = kp.xgf_master_user_id
|
||||||
|
left join department xgfd on xgfd.id = xgfu.department_id
|
||||||
|
where aa.id = #{id}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -142,5 +142,82 @@
|
||||||
left join department ad on ad.id = i.department_id
|
left join department ad on ad.id = i.department_id
|
||||||
where i.id = #{id}
|
where i.id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="listAll" resultType="com.zcloud.key.project.persistence.dataobject.inspection.SafetyEnvironmentalInspectionDO">
|
||||||
|
select
|
||||||
|
i.*,
|
||||||
|
kp.project_name,
|
||||||
|
GROUP_CONCAT(DISTINCT iuu.name) inspection_user_name,
|
||||||
|
indc.corp_name inspected_corpinfo_name,
|
||||||
|
xmu.name xgf_master_user_name
|
||||||
|
|
||||||
|
FROM
|
||||||
|
safety_environmental_inspection i
|
||||||
|
left join key_project kp on kp.key_project_id = i.key_project_id
|
||||||
|
left join user creu on creu.id = i.create_id
|
||||||
|
left join (
|
||||||
|
SELECT
|
||||||
|
inspection_id,
|
||||||
|
department_id,
|
||||||
|
user_id,
|
||||||
|
type,
|
||||||
|
RANK() OVER (
|
||||||
|
PARTITION BY inspection_id
|
||||||
|
ORDER BY type DESC
|
||||||
|
) AS rn
|
||||||
|
FROM safety_environmental_inspection_user
|
||||||
|
WHERE delete_enum = 'FALSE'
|
||||||
|
AND type IN (2, 5)
|
||||||
|
) iu on iu.inspection_id = i.inspection_id AND iu.rn = 1
|
||||||
|
left join user iuu on iuu.id = iu.user_id
|
||||||
|
left join corp_info indc on indc.id = i.inspected_corpinfo_id
|
||||||
|
left join user xmu on xmu.id = i.xgf_master_user_id
|
||||||
|
where i.delete_enum = 'FALSE'
|
||||||
|
<if test="params.place != null and params.place != ''">
|
||||||
|
and i.place LIKE CONCAT('%', #{params.place}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="params.createName != null and params.createName != ''">
|
||||||
|
and creu.name LIKE CONCAT('%', #{params.createName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="params.inspectionDepartmentId != null and params.inspectionDepartmentId != ''">
|
||||||
|
and iu.department_id = #{params.inspectionDepartmentId}
|
||||||
|
</if>
|
||||||
|
<if test="params.timeStart != null and params.timeStart != ''">
|
||||||
|
and i.time_end >= #{params.timeStart}
|
||||||
|
</if>
|
||||||
|
<if test="params.timeEnd != null and params.timeEnd != ''">
|
||||||
|
and i.time_start <= #{params.timeEnd}
|
||||||
|
</if>
|
||||||
|
<if test="params.year != null and params.year != ''">
|
||||||
|
and YEAR(STR_TO_DATE(i.create_time, '%Y-%m-%d %H:%i:%s')) = #{params.year}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="params.inspectedCorpinfoName != null and params.inspectedCorpinfoName != ''">
|
||||||
|
and indc.corp_name LIKE CONCAT('%', #{params.inspectedCorpinfoName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="params.projectName != null and params.projectName != ''">
|
||||||
|
and kp.project_name LIKE CONCAT('%', #{params.projectName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="params.statusList != null and params.statusList.size() > 0">
|
||||||
|
and i.status in
|
||||||
|
<foreach item="status" collection="params.statusList" separator="," open="(" close=")" index="">
|
||||||
|
#{status}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="params.ids != null and params.ids.size() > 0">
|
||||||
|
and i.id in
|
||||||
|
<foreach item="id" collection="params.ids" separator="," open="(" close=")" index="">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
|
||||||
|
GROUP BY i.id
|
||||||
|
<if test="params.inspectionUserName != null and params.inspectionUserName != ''">
|
||||||
|
HAVING inspection_user_name LIKE CONCAT('%', #{params.inspectionUserName}, '%')
|
||||||
|
</if>
|
||||||
|
ORDER BY
|
||||||
|
CASE WHEN i.status = 6 THEN 0 ELSE 1 END,
|
||||||
|
i.create_time desc
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue