上传事故调查管理代码
parent
7b9d086d55
commit
73f05b7638
|
@ -0,0 +1,74 @@
|
|||
package com.zcloud.controller.accident;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import com.zcloud.controller.base.BaseController;
|
||||
import com.zcloud.entity.Page;
|
||||
import com.zcloud.entity.PageData;
|
||||
import com.zcloud.entity.accident.AccidentRecords;
|
||||
import com.zcloud.service.accident.AccidentRecordsService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@RestController("/accident")
|
||||
public class AccidentRecordsController extends BaseController {
|
||||
|
||||
private final AccidentRecordsService accidentRecordsService;
|
||||
|
||||
@RequestMapping(value = "/page")
|
||||
public Map<String, Object> queryPage(Page page, HttpServletRequest request) {
|
||||
page.setPd(new PageData(request));
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("result", "success");
|
||||
result.put("varList", accidentRecordsService.queryPage(page));
|
||||
result.put("page", page);
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping("/{id}")
|
||||
public Map<String, Object> getById(@PathVariable("id") Long id) {
|
||||
Assert.notNull(id, "id不能为空");
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("result", "success");
|
||||
result.put("info", accidentRecordsService.getById(id));
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping("/save")
|
||||
public Map<String, Object> save(HttpServletRequest request) {
|
||||
AccidentRecords accidentRecords = BeanUtil.mapToBean(new PageData(request), AccidentRecords.class, true);
|
||||
accidentRecordsService.save(accidentRecords);
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("result", "success");
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping("/update")
|
||||
public Map<String, Object> update(HttpServletRequest request) {
|
||||
AccidentRecords accidentRecords = BeanUtil.mapToBean(new PageData(request), AccidentRecords.class, true);
|
||||
accidentRecordsService.update(accidentRecords);
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("result", "success");
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping("/delete/{ids}")
|
||||
public Map<String, Object> delete(@PathVariable("ids") String values) {
|
||||
Assert.notEmpty(values, "ids不能为空");
|
||||
Long[] ids = Arrays.stream(values.split(",")).map(Convert::toLong).collect(Collectors.toList()).toArray(new Long[]{});
|
||||
accidentRecordsService.delete(ids);
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("result", "success");
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,162 @@
|
|||
package com.zcloud.entity.accident;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 事故记录表
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class AccidentRecords implements Serializable {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@NotNull(message = "主键ID不能为null")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 事故案号
|
||||
*/
|
||||
@Size(max = 50,message = "事故案号最大长度要小于 50")
|
||||
private String incidentNumber;
|
||||
|
||||
/**
|
||||
* 事故名称
|
||||
*/
|
||||
@Size(max = 100,message = "事故名称最大长度要小于 100")
|
||||
private String incidentName;
|
||||
|
||||
/**
|
||||
* 事故类型
|
||||
*/
|
||||
private Integer incidentType;
|
||||
|
||||
/**
|
||||
* 所属公司
|
||||
*/
|
||||
@Size(max = 100,message = "所属公司最大长度要小于 100")
|
||||
private String companyName;
|
||||
|
||||
/**
|
||||
* 事故级别
|
||||
*/
|
||||
@Size(max = 50,message = "事故级别最大长度要小于 50")
|
||||
private String incidentLevel;
|
||||
|
||||
/**
|
||||
* 事故性质
|
||||
*/
|
||||
@Size(max = 50,message = "事故性质最大长度要小于 50")
|
||||
private String incidentNature;
|
||||
|
||||
/**
|
||||
* 事故发生地点
|
||||
*/
|
||||
@Size(max = 200,message = "事故发生地点最大长度要小于 200")
|
||||
private String location;
|
||||
|
||||
/**
|
||||
* 事故发生时间
|
||||
*/
|
||||
private Date incidentDate;
|
||||
|
||||
/**
|
||||
* 直接经济损失(万元)
|
||||
*/
|
||||
@Size(max = 100,message = "直接经济损失(万元)最大长度要小于 100")
|
||||
private String directLoss;
|
||||
|
||||
/**
|
||||
* 受伤人数
|
||||
*/
|
||||
private Integer injured;
|
||||
|
||||
/**
|
||||
* 死亡人数
|
||||
*/
|
||||
private Integer fatalities;
|
||||
|
||||
/**
|
||||
* 重伤人数
|
||||
*/
|
||||
private Integer seriouslyInjured;
|
||||
|
||||
/**
|
||||
* 事故起因
|
||||
*/
|
||||
@Size(max = 200,message = "事故起因最大长度要小于 200")
|
||||
private String cause;
|
||||
|
||||
/**
|
||||
* 事故概述
|
||||
*/
|
||||
private String summary;
|
||||
|
||||
/**
|
||||
* 事故照片(可以存储图片路径或使用 BLOB 类型存储图片本身)
|
||||
*/
|
||||
private String photos;
|
||||
|
||||
/**
|
||||
* 原因分析及责任认定
|
||||
*/
|
||||
private String analysis;
|
||||
|
||||
/**
|
||||
* 考核建议
|
||||
*/
|
||||
private String suggestions;
|
||||
|
||||
/**
|
||||
* 整改措施
|
||||
*/
|
||||
private String measures;
|
||||
|
||||
/**
|
||||
* 填表人
|
||||
*/
|
||||
@Size(max = 50,message = "填表人最大长度要小于 50")
|
||||
private String creator;
|
||||
|
||||
/**
|
||||
* 报出日期
|
||||
*/
|
||||
private Date reportDate;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@Size(max = 50,message = "创建人最大长度要小于 50")
|
||||
private String createdBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createdTime;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
@Size(max = 50,message = "修改人最大长度要小于 50")
|
||||
private String updatedBy;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Date updatedTime;
|
||||
|
||||
/**
|
||||
* 逻辑删除标志,0=未删除,1=已删除
|
||||
*/
|
||||
@NotNull(message = "逻辑删除标志,0=未删除,1=已删除不能为null")
|
||||
private Integer isDeleted;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -0,0 +1,136 @@
|
|||
package com.zcloud.entity.accident.dto;
|
||||
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import com.zcloud.entity.accident.validated.Create;
|
||||
import com.zcloud.entity.accident.validated.Update;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Null;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class AccidentRecordsDto implements Serializable {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@NotNull(message = "主键ID不能为null", groups = Update.class)
|
||||
@Null(message = "主键ID必须null", groups = Create.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 事故案号
|
||||
*/
|
||||
@Size(max = 50, message = "事故案号最大长度要小于 50", groups = {Create.class, Update.class})
|
||||
private String incidentNumber;
|
||||
|
||||
/**
|
||||
* 事故名称
|
||||
*/
|
||||
@Size(max = 100, message = "事故名称最大长度要小于 100", groups = {Create.class, Update.class})
|
||||
private String incidentName;
|
||||
|
||||
/**
|
||||
* 事故类型
|
||||
*/
|
||||
@Range(min = 1, max = 21, message = "事故类型范围在1-21之间", groups = {Create.class, Update.class})
|
||||
private Integer incidentType;
|
||||
|
||||
/**
|
||||
* 所属公司
|
||||
*/
|
||||
@Size(max = 100, message = "所属公司最大长度要小于 100", groups = {Create.class, Update.class})
|
||||
private String companyName;
|
||||
|
||||
/**
|
||||
* 事故级别
|
||||
*/
|
||||
@Size(max = 50, message = "事故级别最大长度要小于 50", groups = {Create.class, Update.class})
|
||||
private String incidentLevel;
|
||||
|
||||
/**
|
||||
* 事故性质
|
||||
*/
|
||||
@Size(max = 50, message = "事故性质最大长度要小于 50", groups = {Create.class, Update.class})
|
||||
private String incidentNature;
|
||||
|
||||
/**
|
||||
* 事故发生地点
|
||||
*/
|
||||
@Size(max = 200, message = "事故发生地点最大长度要小于 200", groups = {Create.class, Update.class})
|
||||
private String location;
|
||||
|
||||
/**
|
||||
* 事故发生时间
|
||||
*/
|
||||
@DateTimeFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
|
||||
private Date incidentDate;
|
||||
|
||||
/**
|
||||
* 直接经济损失(万元)
|
||||
*/
|
||||
@Size(max = 100, message = "直接经济损失(万元)最大长度要小于 100", groups = {Create.class, Update.class})
|
||||
private String directLoss;
|
||||
|
||||
/**
|
||||
* 受伤人数
|
||||
*/
|
||||
private Integer injured;
|
||||
|
||||
/**
|
||||
* 死亡人数
|
||||
*/
|
||||
private Integer fatalities;
|
||||
|
||||
/**
|
||||
* 重伤人数
|
||||
*/
|
||||
private Integer seriouslyInjured;
|
||||
|
||||
/**
|
||||
* 事故起因
|
||||
*/
|
||||
@Size(max = 200, message = "事故起因最大长度要小于 200", groups = {Create.class, Update.class})
|
||||
private String cause;
|
||||
|
||||
/**
|
||||
* 事故概述
|
||||
*/
|
||||
private String summary;
|
||||
|
||||
/**
|
||||
* 事故照片(可以存储图片路径或使用 BLOB 类型存储图片本身)
|
||||
*/
|
||||
private String photos;
|
||||
|
||||
/**
|
||||
* 原因分析及责任认定
|
||||
*/
|
||||
private String analysis;
|
||||
|
||||
/**
|
||||
* 考核建议
|
||||
*/
|
||||
private String suggestions;
|
||||
|
||||
/**
|
||||
* 整改措施
|
||||
*/
|
||||
private String measures;
|
||||
|
||||
/**
|
||||
* 填表人
|
||||
*/
|
||||
@Size(max = 50, message = "填表人最大长度要小于 50", groups = {Create.class, Update.class})
|
||||
private String creator;
|
||||
|
||||
/**
|
||||
* 报出日期
|
||||
*/
|
||||
private Date reportDate;
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
package com.zcloud.entity.accident.validated;
|
||||
|
||||
public interface Create {
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
package com.zcloud.entity.accident.validated;
|
||||
|
||||
public interface Update {
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.zcloud.mapper.datasource.accident;
|
||||
|
||||
import com.zcloud.entity.Page;
|
||||
import com.zcloud.entity.PageData;
|
||||
import com.zcloud.entity.accident.AccidentRecords;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface AccidentRecordsMapper {
|
||||
|
||||
List<PageData> listPage(Page page);
|
||||
|
||||
PageData getById(Long id);
|
||||
|
||||
int save(AccidentRecords accidentRecords);
|
||||
|
||||
int updateById(AccidentRecords accidentRecords);
|
||||
|
||||
int delete(@Param("ids") Long[] ids);
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.zcloud.service.accident;
|
||||
|
||||
import com.zcloud.entity.Page;
|
||||
import com.zcloud.entity.PageData;
|
||||
import com.zcloud.entity.accident.AccidentRecords;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface AccidentRecordsService {
|
||||
|
||||
List<PageData> queryPage(Page page);
|
||||
|
||||
PageData getById(Long id);
|
||||
|
||||
void save(AccidentRecords accidentRecords);
|
||||
|
||||
void update(AccidentRecords bean);
|
||||
|
||||
void delete(Long[] ids);
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
package com.zcloud.service.accident.impl;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.zcloud.entity.Page;
|
||||
import com.zcloud.entity.PageData;
|
||||
import com.zcloud.entity.accident.AccidentRecords;
|
||||
import com.zcloud.entity.accident.validated.Create;
|
||||
import com.zcloud.entity.accident.validated.Update;
|
||||
import com.zcloud.mapper.datasource.accident.AccidentRecordsMapper;
|
||||
import com.zcloud.service.accident.AccidentRecordsService;
|
||||
import com.zcloud.util.Jurisdiction;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class AccidentRecordsServiceImpl implements AccidentRecordsService {
|
||||
|
||||
private final AccidentRecordsMapper accidentRecordsMapper;
|
||||
|
||||
@Override
|
||||
public List<PageData> queryPage(Page page) {
|
||||
return accidentRecordsMapper.listPage(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageData getById(Long id) {
|
||||
return accidentRecordsMapper.getById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void save(@Validated(Create.class) AccidentRecords accidentRecords) {
|
||||
accidentRecords.setId(IdUtil.getSnowflake(1, 1).nextId());
|
||||
accidentRecords.setCreatedBy(Jurisdiction.getUsername());
|
||||
accidentRecords.setCreatedTime(new Date());
|
||||
accidentRecords.setIsDeleted(0);
|
||||
Assert.isTrue(accidentRecordsMapper.save(accidentRecords) == 1, "新增事故记录失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(@Validated(Update.class) AccidentRecords accidentRecords) {
|
||||
accidentRecords.setUpdatedBy(Jurisdiction.getUsername());
|
||||
accidentRecords.setUpdatedTime(new Date());
|
||||
Assert.isTrue(accidentRecordsMapper.updateById(accidentRecords) == 1, "更新事故记录失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delete(Long[] ids) {
|
||||
Assert.isTrue(accidentRecordsMapper.delete(ids) == ids.length, "删除事故记录失败");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,300 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zcloud.mapper.datasource.accident.AccidentRecordsMapper">
|
||||
<resultMap id="BaseResultMap" type="com.zcloud.entity.accident.AccidentRecords">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table accident_records-->
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="incident_number" jdbcType="VARCHAR" property="incidentNumber" />
|
||||
<result column="incident_name" jdbcType="VARCHAR" property="incidentName" />
|
||||
<result column="incident_type" jdbcType="BOOLEAN" property="incidentType" />
|
||||
<result column="company_name" jdbcType="VARCHAR" property="companyName" />
|
||||
<result column="incident_level" jdbcType="VARCHAR" property="incidentLevel" />
|
||||
<result column="incident_nature" jdbcType="VARCHAR" property="incidentNature" />
|
||||
<result column="location" jdbcType="VARCHAR" property="location" />
|
||||
<result column="incident_date" jdbcType="TIMESTAMP" property="incidentDate" />
|
||||
<result column="direct_loss" jdbcType="VARCHAR" property="directLoss" />
|
||||
<result column="injured" jdbcType="INTEGER" property="injured" />
|
||||
<result column="fatalities" jdbcType="INTEGER" property="fatalities" />
|
||||
<result column="seriously_injured" jdbcType="INTEGER" property="seriouslyInjured" />
|
||||
<result column="cause" jdbcType="VARCHAR" property="cause" />
|
||||
<result column="summary" jdbcType="LONGVARCHAR" property="summary" />
|
||||
<result column="photos" jdbcType="LONGVARCHAR" property="photos" />
|
||||
<result column="analysis" jdbcType="LONGVARCHAR" property="analysis" />
|
||||
<result column="suggestions" jdbcType="LONGVARCHAR" property="suggestions" />
|
||||
<result column="measures" jdbcType="LONGVARCHAR" property="measures" />
|
||||
<result column="creator" jdbcType="VARCHAR" property="creator" />
|
||||
<result column="report_date" jdbcType="DATE" property="reportDate" />
|
||||
<result column="created_by" jdbcType="VARCHAR" property="createdBy" />
|
||||
<result column="created_time" jdbcType="TIMESTAMP" property="createdTime" />
|
||||
<result column="updated_by" jdbcType="VARCHAR" property="updatedBy" />
|
||||
<result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime" />
|
||||
<result column="is_deleted" jdbcType="BOOLEAN" property="isDeleted" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, incident_number, incident_name, incident_type, company_name, incident_level,
|
||||
incident_nature, `location`, incident_date, direct_loss, injured, fatalities, seriously_injured,
|
||||
cause, summary, photos, analysis, suggestions, measures, creator, report_date, created_by,
|
||||
created_time, updated_by, updated_time, is_deleted
|
||||
</sql>
|
||||
|
||||
<select id="listPage" parameterType="page" resultType="pd">
|
||||
select id, company_name, location, incident_date, incident_name
|
||||
from accident_records
|
||||
<where>
|
||||
<if test="pd.incidentName != null and pd.incidentName != ''">
|
||||
and incident_number like concat('%', #{pd.incidentName}, '%')
|
||||
</if>
|
||||
<if test="pd.incidentDates != null and pd.incidentDates.size() == 2">
|
||||
and incident_date between #{pd.incidentDates[0]} and #{pd.incidentDates[1]}
|
||||
</if>
|
||||
<if test="pd.location != null and pd.location != ''">
|
||||
and incident_number like concat('%', #{pd.location}, '%')
|
||||
</if>
|
||||
<if test="pd.incidentLevel != null and pd.incidentLevel != ''">
|
||||
and incident_number like concat('%', #{pd.incidentLevel}, '%')
|
||||
</if>
|
||||
<if test="pd.incidentType != null">
|
||||
and incidentType = #{pd.incidentType}
|
||||
</if>
|
||||
<if test="1 == 1">
|
||||
and is_deleted = 0
|
||||
</if>
|
||||
</where>
|
||||
order by incident_date desc , company_name
|
||||
</select>
|
||||
|
||||
<select id="getById" resultType="com.zcloud.entity.PageData">
|
||||
select id,
|
||||
incident_number,
|
||||
incident_name,
|
||||
incident_type,
|
||||
company_name,
|
||||
incident_level,
|
||||
incident_nature,
|
||||
`location`,
|
||||
incident_date,
|
||||
direct_loss,
|
||||
injured,
|
||||
fatalities,
|
||||
seriously_injured,
|
||||
cause,
|
||||
summary,
|
||||
photos,
|
||||
analysis,
|
||||
suggestions,
|
||||
measures,
|
||||
creator,
|
||||
report_date
|
||||
from accident_records
|
||||
where id = #{id} and is_deleted = 0;
|
||||
</select>
|
||||
|
||||
<insert id="save" parameterType="com.zcloud.entity.accident.AccidentRecords">
|
||||
insert into accident_records
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="incidentNumber != null">
|
||||
incident_number,
|
||||
</if>
|
||||
<if test="incidentName != null">
|
||||
incident_name,
|
||||
</if>
|
||||
<if test="incidentType != null">
|
||||
incident_type,
|
||||
</if>
|
||||
<if test="companyName != null">
|
||||
company_name,
|
||||
</if>
|
||||
<if test="incidentLevel != null">
|
||||
incident_level,
|
||||
</if>
|
||||
<if test="incidentNature != null">
|
||||
incident_nature,
|
||||
</if>
|
||||
<if test="location != null">
|
||||
location,
|
||||
</if>
|
||||
<if test="incidentDate != null">
|
||||
incident_date,
|
||||
</if>
|
||||
<if test="directLoss != null">
|
||||
direct_loss,
|
||||
</if>
|
||||
<if test="injured != null">
|
||||
injured,
|
||||
</if>
|
||||
<if test="fatalities != null">
|
||||
fatalities,
|
||||
</if>
|
||||
<if test="seriouslyInjured != null">
|
||||
seriously_injured,
|
||||
</if>
|
||||
<if test="cause != null">
|
||||
cause,
|
||||
</if>
|
||||
<if test="summary != null">
|
||||
summary,
|
||||
</if>
|
||||
<if test="photos != null">
|
||||
photos,
|
||||
</if>
|
||||
<if test="analysis != null">
|
||||
analysis,
|
||||
</if>
|
||||
<if test="suggestions != null">
|
||||
suggestions,
|
||||
</if>
|
||||
<if test="measures != null">
|
||||
measures,
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
creator,
|
||||
</if>
|
||||
<if test="reportDate != null">
|
||||
report_date,
|
||||
</if>
|
||||
<if test="createdBy != null">
|
||||
created_by,
|
||||
</if>
|
||||
<if test="createdTime != null">
|
||||
created_time,
|
||||
</if>
|
||||
<if test="updatedBy != null">
|
||||
updated_by,
|
||||
</if>
|
||||
<if test="updatedTime != null">
|
||||
updated_time,
|
||||
</if>
|
||||
<if test="isDeleted != null">
|
||||
is_deleted
|
||||
</if>
|
||||
</trim>
|
||||
values
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="incidentNumber != null">
|
||||
#{incidentNumber},
|
||||
</if>
|
||||
<if test="incidentName != null">
|
||||
#{incidentName},
|
||||
</if>
|
||||
<if test="incidentType != null">
|
||||
#{incidentType},
|
||||
</if>
|
||||
<if test="companyName != null">
|
||||
#{companyName},
|
||||
</if>
|
||||
<if test="incidentLevel != null">
|
||||
#{incidentLevel},
|
||||
</if>
|
||||
<if test="incidentNature != null">
|
||||
#{incidentNature},
|
||||
</if>
|
||||
<if test="location != null">
|
||||
#{location},
|
||||
</if>
|
||||
<if test="incidentDate != null">
|
||||
#{incidentDate},
|
||||
</if>
|
||||
<if test="directLoss != null">
|
||||
#{directLoss},
|
||||
</if>
|
||||
<if test="injured != null">
|
||||
#{injured},
|
||||
</if>
|
||||
<if test="fatalities != null">
|
||||
#{fatalities},
|
||||
</if>
|
||||
<if test="seriouslyInjured != null">
|
||||
#{seriouslyInjured},
|
||||
</if>
|
||||
<if test="cause != null">
|
||||
#{cause},
|
||||
</if>
|
||||
<if test="summary != null">
|
||||
#{summary},
|
||||
</if>
|
||||
<if test="photos != null">
|
||||
#{photos},
|
||||
</if>
|
||||
<if test="analysis != null">
|
||||
#{analysis},
|
||||
</if>
|
||||
<if test="suggestions != null">
|
||||
#{suggestions},
|
||||
</if>
|
||||
<if test="measures != null">
|
||||
#{measures},
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
#{creator},
|
||||
</if>
|
||||
<if test="reportDate != null">
|
||||
#{reportDate},
|
||||
</if>
|
||||
<if test="createdBy != null">
|
||||
#{createdBy},
|
||||
</if>
|
||||
<if test="createdTime != null">
|
||||
#{createdTime},
|
||||
</if>
|
||||
<if test="updatedBy != null">
|
||||
#{updatedBy},
|
||||
</if>
|
||||
<if test="updatedTime != null">
|
||||
#{updatedTime},
|
||||
</if>
|
||||
<if test="isDeleted != null">
|
||||
#{isDeleted}
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateById" parameterType="com.zcloud.entity.accident.AccidentRecords">
|
||||
UPDATE accident_records
|
||||
<set>
|
||||
<if test="incidentNumber != null">incident_number = #{incidentNumber},</if>
|
||||
<if test="incidentName != null">incident_name = #{incidentName},</if>
|
||||
<if test="incidentType != null">incident_type = #{incidentType},</if>
|
||||
<if test="companyName != null">company_name = #{companyName},</if>
|
||||
<if test="incidentLevel != null">incident_level = #{incidentLevel},</if>
|
||||
<if test="incidentNature != null">incident_nature = #{incidentNature},</if>
|
||||
<if test="location != null">location = #{location},</if>
|
||||
<if test="incidentDate != null">incident_date = #{incidentDate},</if>
|
||||
<if test="directLoss != null">direct_loss = #{directLoss},</if>
|
||||
<if test="injured != null">injured = #{injured},</if>
|
||||
<if test="fatalities != null">fatalities = #{fatalities},</if>
|
||||
<if test="seriouslyInjured != null">seriously_injured = #{seriouslyInjured},</if>
|
||||
<if test="cause != null">cause = #{cause},</if>
|
||||
<if test="summary != null">summary = #{summary},</if>
|
||||
<if test="photos != null">photos = #{photos},</if>
|
||||
<if test="analysis != null">analysis = #{analysis},</if>
|
||||
<if test="suggestions != null">suggestions = #{suggestions},</if>
|
||||
<if test="measures != null">measures = #{measures},</if>
|
||||
<if test="creator != null">creator = #{creator},</if>
|
||||
<if test="reportDate != null">report_date = #{reportDate},</if>
|
||||
<if test="createdBy != null">created_by = #{createdBy},</if>
|
||||
<if test="createdTime != null">created_time = #{createdTime},</if>
|
||||
<if test="updatedBy != null">updated_by = #{updatedBy},</if>
|
||||
<if test="updatedTime != null">updated_time = #{updatedTime},</if>
|
||||
<if test="isDeleted != null">is_deleted = #{isDeleted}</if>
|
||||
</set>
|
||||
WHERE id = #{id} and is_deleted = 0
|
||||
</update>
|
||||
|
||||
<update id="delete">
|
||||
update accident_records
|
||||
set is_deleted = 1
|
||||
where
|
||||
id IN
|
||||
<foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</update>
|
||||
</mapper>
|
Loading…
Reference in New Issue