Compare commits
2 Commits
21a7364a36
...
e6cd88d54a
| Author | SHA1 | Date |
|---|---|---|
|
|
e6cd88d54a | |
|
|
835b51f034 |
9
pom.xml
9
pom.xml
|
|
@ -20,9 +20,18 @@
|
|||
<artifactId>zcloud_gbscommon</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-stream-rocketmq</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.jjb.saas</groupId>
|
||||
<artifactId>jjb-saas-system-client</artifactId>
|
||||
<version>1.7.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<!--Project modules-->
|
||||
<dependency>
|
||||
<groupId>com.zcloud.accident</groupId>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,11 @@
|
|||
package com.zcloud.accident;
|
||||
|
||||
import com.jjb.saas.base.starter.bootstart.JJBSpringbootApplication;
|
||||
import com.jjb.saas.framework.event.consumer.EnableConsumer;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.cloud.stream.annotation.EnableBinding;
|
||||
import org.springframework.cloud.stream.messaging.Sink;
|
||||
import org.springframework.cloud.stream.messaging.Source;
|
||||
|
||||
/**
|
||||
* Spring Boot Starter
|
||||
|
|
|
|||
|
|
@ -4,3 +4,5 @@ spring:
|
|||
- classpath:nacos.yml
|
||||
- classpath:sdk.yml
|
||||
- classpath:swagger.yml
|
||||
server:
|
||||
port: 8085
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ spring:
|
|||
file-extension: yml
|
||||
shared-configs:
|
||||
- config-common.yml
|
||||
- config-port.yml
|
||||
# - config-port.yml
|
||||
- config-mq.yml
|
||||
- config-log.yml
|
||||
- config-sdk-server.yml
|
||||
|
|
|
|||
|
|
@ -17,10 +17,6 @@
|
|||
<groupId>com.jjb.saas</groupId>
|
||||
<artifactId>jjb-saas-framework-adapter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-stream-rocketmq</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.zcloud.accident</groupId>
|
||||
|
|
|
|||
|
|
@ -1,14 +1,15 @@
|
|||
package com.zcloud.accident.web;
|
||||
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.cola.dto.MultiResponse;
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.alibaba.cola.dto.Response;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.jjb.saas.framework.auth.model.SSOUser;
|
||||
import com.jjb.saas.framework.auth.utils.AuthContext;
|
||||
import com.jjb.saas.framework.event.producer.RemoteEventPublisher;
|
||||
import com.zcloud.accident.api.AccidentServiceI;
|
||||
import com.zcloud.accident.command.convertor.AccidentExportConvertor;
|
||||
import com.zcloud.accident.command.convertor.EventExportConvertor;
|
||||
import com.zcloud.accident.dto.AccidentAddCmd;
|
||||
import com.zcloud.accident.dto.AccidentCountQry;
|
||||
import com.zcloud.accident.dto.AccidentPageQry;
|
||||
|
|
@ -16,13 +17,11 @@ import com.zcloud.accident.dto.AccidentUpdateCmd;
|
|||
import com.zcloud.accident.dto.clientobject.AccidentCO;
|
||||
import com.zcloud.accident.dto.clientobject.AccidentCountStatCO;
|
||||
import com.zcloud.accident.dto.clientobject.AccidentExportCO;
|
||||
import com.zcloud.accident.command.convertor.AccidentExportConvertor;
|
||||
import com.zcloud.accident.dto.clientobject.EventExportCO;
|
||||
import com.zcloud.accident.util.ExcelUtils;
|
||||
import com.zcloud.gbscommon.event.user.ZcUserEvent;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
|
@ -46,11 +45,12 @@ import java.util.List;
|
|||
public class AccidentController {
|
||||
private final AccidentServiceI accidentService;
|
||||
private final AccidentExportConvertor accidentExportConvertor;
|
||||
private final RemoteEventPublisher remoteEventPublisher ;
|
||||
private final EventExportConvertor eventExportConvertor;
|
||||
|
||||
@ApiOperation("新增")
|
||||
@PostMapping("/save")
|
||||
public SingleResponse<AccidentCO> add(@Validated @RequestBody AccidentAddCmd cmd) {
|
||||
SSOUser ssoUser = AuthContext.getCurrentUser();
|
||||
cmd.setDepartmentId(AuthContext.getOrgId());
|
||||
return accidentService.add(cmd);
|
||||
}
|
||||
|
||||
|
|
@ -94,16 +94,28 @@ public class AccidentController {
|
|||
}
|
||||
|
||||
@ApiOperation("导出Excel")
|
||||
@PostMapping("/export")
|
||||
public void export(@RequestBody AccidentPageQry qry, HttpServletResponse response) throws IOException {
|
||||
@GetMapping("/export")
|
||||
public void export(AccidentPageQry qry, HttpServletResponse response) throws IOException {
|
||||
if(ObjectUtil.isNull(qry.getEqCorpinfoId())){
|
||||
qry.setEqCorpinfoId(AuthContext.getTenantId());
|
||||
}
|
||||
// 使用listAll方法获取所有符合条件的数据
|
||||
List<AccidentCO> accidentCOList = accidentService.listAll(qry);
|
||||
// 转换为导出CO
|
||||
List<AccidentExportCO> exportCOList = accidentExportConvertor.convertToExportCOList(accidentCOList);
|
||||
// 生成文件名
|
||||
String fileName = "事故数据_" + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
|
||||
// 调用工具类导出Excel
|
||||
ExcelUtils.exportExcel(response, AccidentExportCO.class, fileName, exportCOList);
|
||||
if(qry.getEqType() == 1){
|
||||
// 转换为导出CO
|
||||
List<EventExportCO> exportCOList = eventExportConvertor.convertToExportCOList(accidentCOList);
|
||||
// 生成文件名
|
||||
String fileName = "事件数据_" + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
|
||||
// 调用工具类导出Excel
|
||||
ExcelUtils.exportExcel(response, EventExportCO.class, fileName, exportCOList);
|
||||
}else{
|
||||
// 转换为导出CO
|
||||
List<AccidentExportCO> exportCOList = accidentExportConvertor.convertToExportCOList(accidentCOList);
|
||||
// 生成文件名
|
||||
String fileName = "事故数据_" + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
|
||||
// 调用工具类导出Excel
|
||||
ExcelUtils.exportExcel(response, AccidentExportCO.class, fileName, exportCOList);
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("按照公司和事故类型统计个数")
|
||||
|
|
@ -111,12 +123,5 @@ public class AccidentController {
|
|||
public MultiResponse<AccidentCountStatCO> countByCorpinfoIdAndIncidentType(@RequestBody AccidentCountQry accidentCountQry) {
|
||||
return accidentService.countByCorpinfoIdAndIncidentType(accidentCountQry);
|
||||
}
|
||||
|
||||
@GetMapping("/test")
|
||||
public void test() {
|
||||
ZcUserEvent zcUserEvent = new ZcUserEvent();
|
||||
zcUserEvent.setName("hello world");
|
||||
remoteEventPublisher.sendMessage(zcUserEvent,"zcloud:user:ev2" );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
package com.zcloud.accident.command.convertor;
|
||||
|
||||
import com.zcloud.accident.dto.clientobject.AccidentCO;
|
||||
import com.zcloud.accident.dto.clientobject.AccidentExportCO;
|
||||
import com.zcloud.accident.dto.clientobject.EventExportCO;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 事故导出转换器
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface EventExportConvertor {
|
||||
|
||||
/**
|
||||
* 将AccidentCO转换为AccidentExportCO
|
||||
* @param accidentCO AccidentCO对象
|
||||
* @return AccidentExportCO对象
|
||||
*/
|
||||
EventExportCO convertToExportCO(AccidentCO accidentCO);
|
||||
|
||||
/**
|
||||
* 将AccidentCO列表转换为AccidentExportCO列表
|
||||
* @param accidentCOList AccidentCO列表
|
||||
* @return AccidentExportCO列表
|
||||
*/
|
||||
List<EventExportCO> convertToExportCOList(List<AccidentCO> accidentCOList);
|
||||
}
|
||||
|
|
@ -49,7 +49,13 @@ public class AccidentQueryExe {
|
|||
*/
|
||||
public PageResponse<AccidentCO> execute(AccidentPageQry accidentPageQry) {
|
||||
Map<String, Object> params = PageQueryHelper.toHashMap(accidentPageQry);
|
||||
PageResponse<AccidentDO> pageResponse = accidentRepository.listPage(params);
|
||||
String menuPerms = "";
|
||||
if(accidentPageQry.getEqType() == 1){
|
||||
menuPerms = "zcloud-event";
|
||||
}else{
|
||||
menuPerms = "zcloud-accident";
|
||||
}
|
||||
PageResponse<AccidentDO> pageResponse = accidentRepository.listPage(params,menuPerms);
|
||||
List<AccidentCO> examCenterCOS = accidentCoConvertor.converDOsToCOs(pageResponse.getData());
|
||||
return PageResponse.of(examCenterCOS, pageResponse.getTotalCount(), pageResponse.getPageSize(), pageResponse.getPageIndex());
|
||||
}
|
||||
|
|
@ -62,7 +68,13 @@ public class AccidentQueryExe {
|
|||
*/
|
||||
public List<AccidentCO> listAll(AccidentPageQry accidentPageQry) {
|
||||
Map<String, Object> params = PageQueryHelper.toHashMap(accidentPageQry);
|
||||
List<AccidentDO> accidentDOs = accidentRepository.listAll(params);
|
||||
String menuPerms = "";
|
||||
if(accidentPageQry.getEqType() == 1){
|
||||
menuPerms = "zcloud-event";
|
||||
}else{
|
||||
menuPerms = "zcloud-accident";
|
||||
}
|
||||
List<AccidentDO> accidentDOs = accidentRepository.listAll(params,menuPerms);
|
||||
return accidentCoConvertor.converDOsToCOs(accidentDOs);
|
||||
}
|
||||
/**
|
||||
|
|
@ -71,7 +83,7 @@ public class AccidentQueryExe {
|
|||
* @return 统计结果列表
|
||||
*/
|
||||
public MultiResponse<AccidentCountStatCO> countByCorpinfoIdAndIncidentType(AccidentCountQry accidentCountQry) {
|
||||
List<com.zcloud.accident.domain.model.AccidentCountStat> resultList = accidentGateway.countByCorpinfoIdAndIncidentType(accidentCountQry.getCorpinfoIds());
|
||||
List<com.zcloud.accident.domain.model.AccidentCountStat> resultList = accidentGateway.countByCorpinfoIdAndIncidentType(accidentCountQry.getCorpinfoIds(),accidentCountQry.getEqAccidentType());
|
||||
List<AccidentCountStatCO> coList = accidentCountStatConvertor.convertToCOList(resultList);
|
||||
return MultiResponse.of(coList);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,9 +24,8 @@ import java.time.LocalDateTime;
|
|||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AccidentAddCmd extends Command {
|
||||
@ApiModelProperty(value = "主键", name = "id", required = true)
|
||||
@NotNull(message = "主键不能为空")
|
||||
private Long id;
|
||||
@ApiModelProperty(value = "业务主键id", name = "id", required = true)
|
||||
private String accidentId;
|
||||
@ApiModelProperty(value = "事故案号", name = "incidentNumber", required = true)
|
||||
@NotEmpty(message = "事故案号不能为空")
|
||||
private String incidentNumber;
|
||||
|
|
@ -42,7 +41,6 @@ public class AccidentAddCmd extends Command {
|
|||
private String incidentLevel;
|
||||
private String incidentLevelName;
|
||||
@ApiModelProperty(value = "事故性质", name = "incidentNature", required = true)
|
||||
@NotEmpty(message = "事故性质不能为空")
|
||||
private String incidentNature;
|
||||
@ApiModelProperty(value = "事故发生地点", name = "location", required = true)
|
||||
@NotEmpty(message = "事故发生地点不能为空")
|
||||
|
|
@ -52,16 +50,12 @@ public class AccidentAddCmd extends Command {
|
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime incidentDate;
|
||||
@ApiModelProperty(value = "直接经济损失(万元)", name = "directLoss", required = true)
|
||||
@NotNull(message = "直接经济损失(万元)不能为空")
|
||||
private BigDecimal directLoss;
|
||||
@ApiModelProperty(value = "受伤人数", name = "injured", required = true)
|
||||
@NotNull(message = "受伤人数不能为空")
|
||||
private Integer injured;
|
||||
@ApiModelProperty(value = "死亡人数", name = "fatalities", required = true)
|
||||
@NotNull(message = "死亡人数不能为空")
|
||||
private Integer fatalities;
|
||||
@ApiModelProperty(value = "重伤人数", name = "seriouslyInjured", required = true)
|
||||
@NotNull(message = "重伤人数不能为空")
|
||||
private Integer seriouslyInjured;
|
||||
@ApiModelProperty(value = "事故起因", name = "cause", required = true)
|
||||
@NotEmpty(message = "事故起因不能为空")
|
||||
|
|
@ -78,6 +72,9 @@ public class AccidentAddCmd extends Command {
|
|||
@ApiModelProperty(value = "整改措施", name = "measures", required = true)
|
||||
@NotEmpty(message = "整改措施不能为空")
|
||||
private String measures;
|
||||
@ApiModelProperty(value = "填报人", name = "reportUser", required = true)
|
||||
@NotEmpty(message = "填报人不能为空")
|
||||
private String reportUser;
|
||||
@ApiModelProperty(value = "报出日期", name = "reportDate", required = true)
|
||||
@NotNull(message = "报出日期不能为空")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
|
|
@ -85,5 +82,7 @@ public class AccidentAddCmd extends Command {
|
|||
@ApiModelProperty(value = "1事件/2事故", name = "type", required = true)
|
||||
@NotNull(message = "1事件/2事故不能为空")
|
||||
private Integer type;
|
||||
@ApiModelProperty(value = "部门id", name = "departmentId")
|
||||
private Long departmentId;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,13 +8,15 @@ import java.util.List;
|
|||
/**
|
||||
* 事故统计查询命令
|
||||
* 用于按照公司ID列表和事故类型统计事故数量
|
||||
*
|
||||
*
|
||||
* @Author
|
||||
* @Date
|
||||
*/
|
||||
@Data
|
||||
public class AccidentCountQry extends Query {
|
||||
|
||||
|
||||
@ApiModelProperty(value = "公司ID列表")
|
||||
private List<String> corpinfoIds;
|
||||
}
|
||||
@ApiModelProperty(value = "类型")
|
||||
private Integer eqAccidentType;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,10 @@ import com.alibaba.cola.dto.PageQuery;
|
|||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
|
|
@ -27,6 +29,8 @@ public class AccidentPageQry extends PageQuery {
|
|||
* - `le`: 小于等于比较查询
|
||||
* - `ne`: 不等比较查询,对应SQL的!=操作符
|
||||
*/
|
||||
@ApiModelProperty(value = "所属企业", name = "eqCorpinfoId")
|
||||
private Long eqCorpinfoId;
|
||||
@ApiModelProperty(value = "事故名称", name = "likeIncidentName")
|
||||
private String likeIncidentName;
|
||||
@ApiModelProperty(value = "事故地点", name = "likeLocation")
|
||||
|
|
@ -36,11 +40,9 @@ public class AccidentPageQry extends PageQuery {
|
|||
@ApiModelProperty(value = "事故级别", name = "likeIncidentLevel")
|
||||
private String eqIncidentLevel;
|
||||
@ApiModelProperty(value = "开始时间", name = "geIncidentDate")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime geIncidentDate;
|
||||
private String geIncidentDate;
|
||||
@ApiModelProperty(value = "结束时间", name = "leIncidentDate")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime leIncidentDate;
|
||||
private String leIncidentDate;
|
||||
@ApiModelProperty(value = "类型1事件2事故", name = "eqType")
|
||||
private Integer eqType;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,69 +26,47 @@ public class AccidentUpdateCmd extends Command {
|
|||
@NotNull(message = "主键id不能为空")
|
||||
private Long id;
|
||||
@ApiModelProperty(value = "事故案号", name = "incidentNumber", required = true)
|
||||
@NotEmpty(message = "事故案号不能为空")
|
||||
private String incidentNumber;
|
||||
@ApiModelProperty(value = "事故名称", name = "incidentName", required = true)
|
||||
@NotEmpty(message = "事故名称不能为空")
|
||||
private String incidentName;
|
||||
@ApiModelProperty(value = "事故类型", name = "incidentType", required = true)
|
||||
@NotEmpty(message = "事故类型不能为空")
|
||||
private String incidentType;
|
||||
@ApiModelProperty(value = "事故类型", name = "incidentTypeName", required = true)
|
||||
@NotEmpty(message = "事故类型不能为空")
|
||||
private String incidentTypeName;
|
||||
@ApiModelProperty(value = "公司id", name = "corpinfoId", required = true)
|
||||
@NotNull(message = "公司id不能为空")
|
||||
private Long corpinfoId;
|
||||
@ApiModelProperty(value = "事故级别", name = "incidentLevel", required = true)
|
||||
@NotEmpty(message = "事故级别不能为空")
|
||||
private String incidentLevel;
|
||||
@ApiModelProperty(value = "事故级别", name = "incidentLevelName", required = true)
|
||||
@NotEmpty(message = "事故级别不能为空")
|
||||
private String incidentLevelName;
|
||||
@ApiModelProperty(value = "事故性质", name = "incidentNature", required = true)
|
||||
@NotEmpty(message = "事故性质不能为空")
|
||||
private String incidentNature;
|
||||
@ApiModelProperty(value = "事故发生地点", name = "location", required = true)
|
||||
@NotEmpty(message = "事故发生地点不能为空")
|
||||
private String location;
|
||||
@ApiModelProperty(value = "事故发生时间", name = "incidentDate", required = true)
|
||||
@NotNull(message = "事故发生时间不能为空")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime incidentDate;
|
||||
@ApiModelProperty(value = "直接经济损失(万元)", name = "directLoss", required = true)
|
||||
@NotNull(message = "直接经济损失(万元)不能为空")
|
||||
private BigDecimal directLoss;
|
||||
@ApiModelProperty(value = "受伤人数", name = "injured", required = true)
|
||||
@NotNull(message = "受伤人数不能为空")
|
||||
private Integer injured;
|
||||
@ApiModelProperty(value = "死亡人数", name = "fatalities", required = true)
|
||||
@NotNull(message = "死亡人数不能为空")
|
||||
private Integer fatalities;
|
||||
@ApiModelProperty(value = "重伤人数", name = "seriouslyInjured", required = true)
|
||||
@NotNull(message = "重伤人数不能为空")
|
||||
private Integer seriouslyInjured;
|
||||
@ApiModelProperty(value = "事故起因", name = "cause", required = true)
|
||||
@NotEmpty(message = "事故起因不能为空")
|
||||
private String cause;
|
||||
@ApiModelProperty(value = "事故概述", name = "summary", required = true)
|
||||
@NotEmpty(message = "事故概述不能为空")
|
||||
private String summary;
|
||||
@ApiModelProperty(value = "原因分析及责任认定", name = "analysis", required = true)
|
||||
@NotEmpty(message = "原因分析及责任认定不能为空")
|
||||
private String analysis;
|
||||
@ApiModelProperty(value = "考核建议", name = "suggestions", required = true)
|
||||
@NotEmpty(message = "考核建议不能为空")
|
||||
private String suggestions;
|
||||
@ApiModelProperty(value = "整改措施", name = "measures", required = true)
|
||||
@NotEmpty(message = "整改措施不能为空")
|
||||
private String measures;
|
||||
@ApiModelProperty(value = "填报人", name = "reportUser", required = true)
|
||||
@NotEmpty(message = "填报人不能为空")
|
||||
private String reportUser;
|
||||
@ApiModelProperty(value = "报出日期", name = "reportDate", required = true)
|
||||
@NotNull(message = "报出日期不能为空")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime reportDate;
|
||||
@ApiModelProperty(value = "1事件/2事故", name = "type", required = true)
|
||||
@NotNull(message = "1事件/2事故不能为空")
|
||||
private Integer type;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import com.jjb.saas.framework.core.annotation.Excel;
|
|||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
|
@ -85,8 +86,11 @@ public class AccidentCO extends ClientObject {
|
|||
//整改措施
|
||||
@ApiModelProperty(value = "整改措施")
|
||||
private String measures;
|
||||
@ApiModelProperty(value = "填报人")
|
||||
private String reportUser;
|
||||
//报出日期
|
||||
@ApiModelProperty(value = "报出日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime reportDate;
|
||||
//1事件/2事故
|
||||
@ApiModelProperty(value = "1事件/2事故")
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.zcloud.accident.dto.clientobject;
|
|||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.excel.annotation.format.DateTimeFormat;
|
||||
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
|
@ -15,77 +16,91 @@ import java.time.LocalDateTime;
|
|||
@Data
|
||||
public class AccidentExportCO {
|
||||
|
||||
@ApiModelProperty(value = "所属公司")
|
||||
@ExcelProperty(value = "所属公司", index = 0)
|
||||
@ColumnWidth(20)
|
||||
private String corpinfoName;
|
||||
|
||||
@ApiModelProperty(value = "事故案号")
|
||||
@ExcelProperty(value = "事故案号", index = 0)
|
||||
@ExcelProperty(value = "事故案号", index = 1)
|
||||
@ColumnWidth(20)
|
||||
private String incidentNumber;
|
||||
|
||||
@ApiModelProperty(value = "事故名称")
|
||||
@ExcelProperty(value = "事故名称", index = 1)
|
||||
@ExcelProperty(value = "事故名称", index = 2)
|
||||
@ColumnWidth(20)
|
||||
private String incidentName;
|
||||
|
||||
@ApiModelProperty(value = "事故类型")
|
||||
@ExcelProperty(value = "事故类型", index = 2)
|
||||
@ExcelProperty(value = "事故类型", index = 3)
|
||||
@ColumnWidth(20)
|
||||
private String incidentTypeName;
|
||||
|
||||
@ApiModelProperty(value = "公司")
|
||||
@ExcelProperty(value = "公司", index = 3)
|
||||
private String corpinfoName;
|
||||
|
||||
@ApiModelProperty(value = "事故级别")
|
||||
@ExcelProperty(value = "事故级别", index = 4)
|
||||
@ColumnWidth(20)
|
||||
private String incidentLevelName;
|
||||
|
||||
@ApiModelProperty(value = "事故性质")
|
||||
@ExcelProperty(value = "事故性质", index = 5)
|
||||
private String incidentNature;
|
||||
|
||||
@ApiModelProperty(value = "事故发生地点")
|
||||
@ExcelProperty(value = "事故发生地点", index = 6)
|
||||
@ExcelProperty(value = "事故发生地点", index = 5)
|
||||
@ColumnWidth(20)
|
||||
private String location;
|
||||
|
||||
@ApiModelProperty(value = "事故发生时间")
|
||||
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
|
||||
@ExcelProperty(value = "事故发生时间", index = 7,format = "yyyy-MM-dd HH:mm:ss")
|
||||
@ExcelProperty(value = "事故发生时间", index = 6)
|
||||
@ColumnWidth(20)
|
||||
private LocalDateTime incidentDate;
|
||||
|
||||
@ApiModelProperty(value = "直接经济损失(万元)")
|
||||
@ExcelProperty(value = "直接经济损失(万元)", index = 8)
|
||||
@ExcelProperty(value = "直接经济损失(万元)", index = 7)
|
||||
@ColumnWidth(20)
|
||||
private BigDecimal directLoss;
|
||||
|
||||
@ApiModelProperty(value = "受伤人数")
|
||||
@ExcelProperty(value = "受伤人数", index = 9)
|
||||
@ExcelProperty(value = "受伤人数", index = 8)
|
||||
@ColumnWidth(20)
|
||||
private Integer injured;
|
||||
|
||||
@ApiModelProperty(value = "死亡人数")
|
||||
@ExcelProperty(value = "死亡人数", index = 10)
|
||||
@ExcelProperty(value = "死亡人数", index = 9)
|
||||
@ColumnWidth(20)
|
||||
private Integer fatalities;
|
||||
|
||||
@ApiModelProperty(value = "重伤人数")
|
||||
@ExcelProperty(value = "重伤人数", index = 11)
|
||||
@ExcelProperty(value = "重伤人数", index = 10)
|
||||
@ColumnWidth(20)
|
||||
private Integer seriouslyInjured;
|
||||
|
||||
@ApiModelProperty(value = "事故起因")
|
||||
@ExcelProperty(value = "事故起因", index = 12)
|
||||
@ExcelProperty(value = "事故起因", index = 11)
|
||||
@ColumnWidth(20)
|
||||
private String cause;
|
||||
|
||||
@ApiModelProperty(value = "事故概述")
|
||||
@ExcelProperty(value = "事故概述", index = 13)
|
||||
@ExcelProperty(value = "事故概述", index = 12)
|
||||
@ColumnWidth(20)
|
||||
private String summary;
|
||||
|
||||
@ApiModelProperty(value = "原因分析及责任认定")
|
||||
@ExcelProperty(value = "原因分析及责任认定", index = 14)
|
||||
@ExcelProperty(value = "原因分析及责任认定", index = 13)
|
||||
@ColumnWidth(20)
|
||||
private String analysis;
|
||||
|
||||
@ApiModelProperty(value = "考核建议")
|
||||
@ExcelProperty(value = "考核建议", index = 15)
|
||||
@ExcelProperty(value = "考核建议", index = 14)
|
||||
@ColumnWidth(20)
|
||||
private String suggestions;
|
||||
|
||||
@ApiModelProperty(value = "整改措施")
|
||||
@ExcelProperty(value = "整改措施", index = 16)
|
||||
@ExcelProperty(value = "整改措施", index = 15)
|
||||
@ColumnWidth(20)
|
||||
private String measures;
|
||||
|
||||
@ApiModelProperty(value = "报出日期")
|
||||
@ExcelProperty(value = "报出日期", index = 17,format = "yyyy-MM-dd HH:mm:ss")
|
||||
@ExcelProperty(value = "报出日期", index = 16)
|
||||
@ColumnWidth(20)
|
||||
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime reportDate;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,107 @@
|
|||
package com.zcloud.accident.dto.clientobject;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.excel.annotation.format.DateTimeFormat;
|
||||
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 事件导出客户端对象
|
||||
* 用于Excel导出
|
||||
*/
|
||||
@Data
|
||||
public class EventExportCO {
|
||||
|
||||
@ApiModelProperty(value = "所属公司")
|
||||
@ExcelProperty(value = "所属公司", index = 0)
|
||||
@ColumnWidth(20)
|
||||
private String corpinfoName;
|
||||
|
||||
@ApiModelProperty(value = "事件案号")
|
||||
@ExcelProperty(value = "事件案号", index = 1)
|
||||
@ColumnWidth(20)
|
||||
private String incidentNumber;
|
||||
|
||||
@ApiModelProperty(value = "事件名称")
|
||||
@ExcelProperty(value = "事件名称", index = 2)
|
||||
@ColumnWidth(20)
|
||||
private String incidentName;
|
||||
|
||||
@ApiModelProperty(value = "事件类型")
|
||||
@ExcelProperty(value = "事件类型", index = 3)
|
||||
@ColumnWidth(20)
|
||||
private String incidentTypeName;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "事件级别")
|
||||
@ExcelProperty(value = "事件级别", index = 4)
|
||||
@ColumnWidth(20)
|
||||
private String incidentLevelName;
|
||||
|
||||
@ApiModelProperty(value = "事件发生地点")
|
||||
@ExcelProperty(value = "事件发生地点", index = 5)
|
||||
@ColumnWidth(20)
|
||||
private String location;
|
||||
|
||||
@ApiModelProperty(value = "事件发生时间")
|
||||
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
|
||||
@ExcelProperty(value = "事件发生时间", index = 6)
|
||||
@ColumnWidth(20)
|
||||
private LocalDateTime incidentDate;
|
||||
|
||||
@ApiModelProperty(value = "直接经济损失(万元)")
|
||||
@ExcelProperty(value = "直接经济损失(万元)", index = 7)
|
||||
@ColumnWidth(20)
|
||||
private BigDecimal directLoss;
|
||||
|
||||
@ApiModelProperty(value = "受伤人数")
|
||||
@ExcelProperty(value = "受伤人数", index = 8)
|
||||
@ColumnWidth(20)
|
||||
private Integer injured;
|
||||
|
||||
@ApiModelProperty(value = "死亡人数")
|
||||
@ExcelProperty(value = "死亡人数", index = 9)
|
||||
@ColumnWidth(20)
|
||||
private Integer fatalities;
|
||||
|
||||
@ApiModelProperty(value = "重伤人数")
|
||||
@ExcelProperty(value = "重伤人数", index = 10)
|
||||
@ColumnWidth(20)
|
||||
private Integer seriouslyInjured;
|
||||
|
||||
@ApiModelProperty(value = "事件起因")
|
||||
@ExcelProperty(value = "事件起因", index = 11)
|
||||
@ColumnWidth(20)
|
||||
private String cause;
|
||||
|
||||
@ApiModelProperty(value = "事件概述")
|
||||
@ExcelProperty(value = "事件概述", index = 12)
|
||||
@ColumnWidth(20)
|
||||
private String summary;
|
||||
|
||||
@ApiModelProperty(value = "原因分析及责任认定")
|
||||
@ExcelProperty(value = "原因分析及责任认定", index = 13)
|
||||
@ColumnWidth(20)
|
||||
private String analysis;
|
||||
|
||||
@ApiModelProperty(value = "考核建议")
|
||||
@ExcelProperty(value = "考核建议", index = 14)
|
||||
@ColumnWidth(20)
|
||||
private String suggestions;
|
||||
|
||||
@ApiModelProperty(value = "整改措施")
|
||||
@ExcelProperty(value = "整改措施", index = 15)
|
||||
@ColumnWidth(20)
|
||||
private String measures;
|
||||
|
||||
@ApiModelProperty(value = "报出日期")
|
||||
@ExcelProperty(value = "报出日期", index = 16)
|
||||
@ColumnWidth(20)
|
||||
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime reportDate;
|
||||
|
||||
}
|
||||
|
|
@ -27,12 +27,14 @@ public interface AccidentGateway {
|
|||
*/
|
||||
Boolean deletedAccidentById(Long id);
|
||||
Boolean deletedAccidentByIds(Long[] id);
|
||||
|
||||
|
||||
/**
|
||||
* 按照corpinfoId和incidentType统计个数
|
||||
* @param corpinfoIds 公司ID列表
|
||||
*
|
||||
* @param corpinfoIds 公司ID列表
|
||||
* @param eqAccidentType
|
||||
* @return 统计结果列表,包含corpinfoId、incidentType和count字段
|
||||
*/
|
||||
List<AccidentCountStat> countByCorpinfoIdAndIncidentType(List<String> corpinfoIds);
|
||||
List<AccidentCountStat> countByCorpinfoIdAndIncidentType(List<String> corpinfoIds, Integer eqAccidentType);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
|
|||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
|
@ -17,7 +18,7 @@ import java.time.LocalDateTime;
|
|||
@Data
|
||||
public class AccidentE extends BaseE {
|
||||
//主键id
|
||||
private Long id;
|
||||
private String accidentId;
|
||||
//事故案号
|
||||
private String incidentNumber;
|
||||
//事故名称
|
||||
|
|
@ -54,9 +55,13 @@ public class AccidentE extends BaseE {
|
|||
private String suggestions;
|
||||
//整改措施
|
||||
private String measures;
|
||||
//填报人
|
||||
private String reportUser;
|
||||
//报出日期
|
||||
private LocalDateTime reportDate;
|
||||
//1事件/2事故
|
||||
private Integer type;
|
||||
//部门id
|
||||
private Long departmentId;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,18 +1,17 @@
|
|||
package com.zcloud.accident.gatewayimpl;
|
||||
|
||||
import com.jjb.saas.framework.auth.utils.AuthContext;
|
||||
import com.zcloud.accident.domain.gateway.AccidentGateway;
|
||||
import com.zcloud.accident.domain.model.AccidentE;
|
||||
import com.zcloud.accident.domain.model.AccidentCountStat;
|
||||
import com.zcloud.accident.persistence.dataobject.AccidentDO;
|
||||
import com.zcloud.accident.persistence.repository.AccidentRepository;
|
||||
import com.zcloud.gbscommon.utils.Tools;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* web-infrastructure
|
||||
|
|
@ -26,8 +25,10 @@ public class AccidentGatewayImpl implements AccidentGateway {
|
|||
|
||||
@Override
|
||||
public Boolean add(AccidentE accidentE) {
|
||||
AccidentDO d = new AccidentDO(Tools.get32UUID());
|
||||
BeanUtils.copyProperties(accidentE, d, "accidentId");
|
||||
AccidentDO d = new AccidentDO();
|
||||
BeanUtils.copyProperties(accidentE, d);
|
||||
d.setCorpinfoId(AuthContext.getTenantId());
|
||||
d.setCorpinfoName(AuthContext.getCurrentUser().getTenantName());
|
||||
accidentRepository.save(d);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -51,8 +52,8 @@ public class AccidentGatewayImpl implements AccidentGateway {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<AccidentCountStat> countByCorpinfoIdAndIncidentType(List<String> corpinfoIds) {
|
||||
return accidentRepository.countByCorpinfoIdAndIncidentType(corpinfoIds);
|
||||
public List<AccidentCountStat> countByCorpinfoIdAndIncidentType(List<String> corpinfoIds, Integer eqAccidentType) {
|
||||
return accidentRepository.countByCorpinfoIdAndIncidentType(corpinfoIds,eqAccidentType);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import lombok.Data;
|
|||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Date;
|
||||
import java.time.LocalDateTime;
|
||||
|
|
@ -86,6 +87,8 @@ public class AccidentDO extends BaseDO {
|
|||
//整改措施
|
||||
@ApiModelProperty(value = "整改措施")
|
||||
private String measures;
|
||||
@ApiModelProperty(value = "填报人")
|
||||
private String reportUser;
|
||||
//报出日期
|
||||
@ApiModelProperty(value = "报出日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
|
|
@ -93,6 +96,8 @@ public class AccidentDO extends BaseDO {
|
|||
//1事件/2事故
|
||||
@ApiModelProperty(value = "1事件/2事故")
|
||||
private Integer type;
|
||||
@ApiModelProperty(value = "部门id")
|
||||
private Long departmentId;
|
||||
|
||||
public AccidentDO(String accidentId) {
|
||||
this.accidentId = accidentId;
|
||||
|
|
|
|||
|
|
@ -1,26 +1,40 @@
|
|||
package com.zcloud.accident.persistence.mapper;
|
||||
|
||||
import com.zcloud.accident.persistence.dataobject.AccidentDO;
|
||||
import com.zcloud.accident.domain.model.AccidentCountStat;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.jjb.saas.framework.datascope.annotation.DataScope;
|
||||
import com.jjb.saas.framework.datascope.annotation.DataScopes;
|
||||
import com.zcloud.accident.domain.model.AccidentCountStat;
|
||||
import com.zcloud.accident.persistence.dataobject.AccidentDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* web-infrastructure
|
||||
* @Author fangjiakai
|
||||
* @Date 2025-10-29 14:28:43
|
||||
*/
|
||||
* web-infrastructure
|
||||
*
|
||||
* @Author fangjiakai
|
||||
* @Date 2025-10-29 14:28:43
|
||||
*/
|
||||
@Mapper
|
||||
@DataScopes({
|
||||
@DataScope(method = "listPage", menuPerms = ""),
|
||||
@DataScope(method = "list", menuPerms = "")})
|
||||
public interface AccidentMapper extends BaseMapper<AccidentDO> {
|
||||
|
||||
/**
|
||||
* 按照corpinfoId和incidentType统计个数
|
||||
* @param corpinfoIds 公司ID列表
|
||||
*
|
||||
* @param corpinfoIds 公司ID列表
|
||||
* @param eqAccidentType
|
||||
* @return 统计结果列表,包含corpinfoId、incidentType和count字段
|
||||
*/
|
||||
List<AccidentCountStat> countByCorpinfoIdAndIncidentType(@Param("corpinfoIds") List<String> corpinfoIds);
|
||||
List<AccidentCountStat> countByCorpinfoIdAndIncidentType(@Param("corpinfoIds") List<String> corpinfoIds, @Param("eqAccidentType") Integer eqAccidentType);
|
||||
|
||||
IPage<AccidentDO> listPage(IPage<AccidentDO> iPage, @Param("params") Map<String, Object> params,String menuPerms);
|
||||
|
||||
List<AccidentDO> list(@Param("params") Map<String, Object> params, String menuPerms);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,20 +15,24 @@ import java.util.Map;
|
|||
* @Date 2025-10-29 14:28:45
|
||||
*/
|
||||
public interface AccidentRepository extends BaseRepository<AccidentDO> {
|
||||
PageResponse<AccidentDO> listPage(Map<String,Object> params);
|
||||
PageResponse<AccidentDO> listPage(Map<String,Object> params,String menuPerms);
|
||||
|
||||
/**
|
||||
* 获取所有符合条件的数据
|
||||
* @param params 查询参数
|
||||
*
|
||||
* @param params 查询参数
|
||||
* @param menuPerms
|
||||
* @return 数据列表
|
||||
*/
|
||||
List<AccidentDO> listAll(Map<String,Object> params);
|
||||
List<AccidentDO> listAll(Map<String,Object> params,String menuPerms);
|
||||
|
||||
/**
|
||||
* 按照corpinfoId和incidentType统计个数
|
||||
* @param corpinfoIds 公司ID列表
|
||||
*
|
||||
* @param corpinfoIds 公司ID列表
|
||||
* @param eqAccidentType
|
||||
* @return 统计结果列表,包含corpinfoId、incidentType和count字段
|
||||
*/
|
||||
List<AccidentCountStat> countByCorpinfoIdAndIncidentType(@Param("corpinfoIds") List<String> corpinfoIds);
|
||||
List<AccidentCountStat> countByCorpinfoIdAndIncidentType(@Param("corpinfoIds") List<String> corpinfoIds,@Param("eqAccidentType") Integer eqAccidentType);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,52 +1,48 @@
|
|||
package com.zcloud.accident.persistence.repository.impl;
|
||||
|
||||
import com.jjb.saas.framework.repository.common.PageHelper;
|
||||
import com.zcloud.accident.persistence.dataobject.AccidentDO;
|
||||
import com.zcloud.accident.domain.model.AccidentCountStat;
|
||||
import com.zcloud.accident.persistence.mapper.AccidentMapper;
|
||||
import com.zcloud.accident.persistence.repository.AccidentRepository;
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.zcloud.gbscommon.utils.PageQueryHelper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.jjb.saas.framework.repository.common.PageHelper;
|
||||
import com.jjb.saas.framework.repository.repo.impl.BaseRepositoryImpl;
|
||||
import com.zcloud.accident.domain.model.AccidentCountStat;
|
||||
import com.zcloud.accident.persistence.dataobject.AccidentDO;
|
||||
import com.zcloud.accident.persistence.mapper.AccidentMapper;
|
||||
import com.zcloud.accident.persistence.repository.AccidentRepository;
|
||||
import com.zcloud.gbscommon.utils.PageQueryHelper;
|
||||
import com.zcloud.gbscommon.utils.Query;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* web-infrastructure
|
||||
* @Author fangjiakai
|
||||
* @Date 2025-10-29 14:28:49
|
||||
*/
|
||||
* web-infrastructure
|
||||
*
|
||||
* @Author fangjiakai
|
||||
* @Date 2025-10-29 14:28:49
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class AccidentRepositoryImpl extends BaseRepositoryImpl<AccidentMapper, AccidentDO> implements AccidentRepository {
|
||||
private final AccidentMapper accidentMapper;
|
||||
|
||||
@Override
|
||||
public PageResponse<AccidentDO> listPage(Map<String,Object> params) {
|
||||
IPage<AccidentDO> iPage = new Query<AccidentDO>().getPage(params);
|
||||
QueryWrapper<AccidentDO> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper = PageQueryHelper.createPageQueryWrapper(queryWrapper, params);
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
IPage<AccidentDO> result = accidentMapper.selectPage(iPage, queryWrapper);
|
||||
public PageResponse<AccidentDO> listPage(Map<String, Object> params,String menuPerms) {
|
||||
IPage<AccidentDO> iPage = new Query<AccidentDO>().getPage(params);
|
||||
IPage<AccidentDO> result = accidentMapper.listPage(iPage, params,menuPerms);
|
||||
return PageHelper.pageToResponse(result, result.getRecords());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<AccidentDO> listAll(Map<String,Object> params) {
|
||||
QueryWrapper<AccidentDO> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper = PageQueryHelper.createPageQueryWrapper(queryWrapper, params);
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
return accidentMapper.selectList(queryWrapper);
|
||||
public List<AccidentDO> listAll(Map<String, Object> params, String menuPerms) {
|
||||
return accidentMapper.list(params, menuPerms);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<AccidentCountStat> countByCorpinfoIdAndIncidentType(List<String> corpinfoIds) {
|
||||
return accidentMapper.countByCorpinfoIdAndIncidentType(corpinfoIds);
|
||||
public List<AccidentCountStat> countByCorpinfoIdAndIncidentType(List<String> corpinfoIds, Integer eqAccidentType) {
|
||||
return accidentMapper.countByCorpinfoIdAndIncidentType(corpinfoIds, eqAccidentType);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,70 @@
|
|||
|
||||
<mapper namespace="com.zcloud.accident.persistence.mapper.AccidentMapper">
|
||||
|
||||
<select id="listPage" resultType="com.zcloud.accident.persistence.dataobject.AccidentDO">
|
||||
select * from accident
|
||||
<where>
|
||||
and delete_enum = 'FALSE'
|
||||
<if test="params.eqCorpinfoId != null">
|
||||
and tenant_id = #{params.eqCorpinfoId}
|
||||
</if>
|
||||
<if test="params.likeIncidentName != null and params.likeIncidentName != ''" >
|
||||
and incident_name like concat('%',#{params.likeIncidentName},'%')
|
||||
</if>
|
||||
<if test="params.likeLocation != null and params.likeLocation != ''">
|
||||
and location like concat('%',#{params.likeLocation},'%')
|
||||
</if>
|
||||
<if test="params.eqIncidentType != null and params.eqIncidentType != ''">
|
||||
and incident_type = #{params.eqIncidentType}
|
||||
</if>
|
||||
<if test="params.eqIncidentLevel != null and params.eqIncidentLevel != ''">
|
||||
and incident_level = #{params.eqIncidentLevel}
|
||||
</if>
|
||||
<if test="params.geIncidentDate != null and params.geIncidentDate != ''">
|
||||
and incident_date >= #{params.geIncidentDate}
|
||||
</if>
|
||||
<if test="params.leIncidentDate != null and params.leIncidentDate != ''">
|
||||
and incident_date <= #{params.leIncidentDate}
|
||||
</if>
|
||||
<if test="params.eqType != null">
|
||||
and type = #{params.eqType}
|
||||
</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="list" resultType="com.zcloud.accident.persistence.dataobject.AccidentDO">
|
||||
select * from accident
|
||||
<where>
|
||||
and delete_enum = 'FALSE'
|
||||
<if test="params.eqCorpinfoId != null">
|
||||
and tenant_id = #{params.eqCorpinfoId}
|
||||
</if>
|
||||
<if test="params.likeIncidentName != null and params.likeIncidentName != ''" >
|
||||
and incident_name like concat('%',#{params.likeIncidentName},'%')
|
||||
</if>
|
||||
<if test="params.likeLocation != null and params.likeLocation != ''">
|
||||
and location like concat('%',#{params.likeLocation},'%')
|
||||
</if>
|
||||
<if test="params.eqIncidentType != null and params.eqIncidentType != ''">
|
||||
and incident_type = #{params.eqIncidentType}
|
||||
</if>
|
||||
<if test="params.eqIncidentLevel != null and params.eqIncidentLevel != ''">
|
||||
and incident_level = #{params.eqIncidentLevel}
|
||||
</if>
|
||||
<if test="params.geIncidentDate != null and params.geIncidentDate != ''">
|
||||
and incident_date >= #{params.geIncidentDate}
|
||||
</if>
|
||||
<if test="params.leIncidentDate != null and params.leIncidentDate != ''">
|
||||
and incident_date <= #{params.leIncidentDate}
|
||||
</if>
|
||||
<if test="params.eqType != null">
|
||||
and type = #{params.eqType}
|
||||
</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="countByCorpinfoIdAndIncidentType" resultType="com.zcloud.accident.domain.model.AccidentCountStat">
|
||||
SELECT
|
||||
corpinfo_id,
|
||||
|
|
@ -11,6 +75,10 @@
|
|||
COUNT(*) as count
|
||||
from accident
|
||||
<where>
|
||||
and delete_enum = 'FALSE'
|
||||
<if test="eqAccidentType != null ">
|
||||
AND type = #{eqAccidentType}
|
||||
</if>
|
||||
<if test="corpinfoIds != null and !corpinfoIds.isEmpty() and corpinfoIds.size()>0">
|
||||
AND corpinfo_id IN
|
||||
<foreach collection="corpinfoIds" item="item" open="(" separator="," close=")">
|
||||
|
|
|
|||
Loading…
Reference in New Issue