ganzi-api/inventory-dao/src/main/resources/mapper/AccidentMapper.xml

743 lines
30 KiB
XML
Raw Normal View History

2022-09-16 15:07:17 +08:00
<?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.rzyc.mapper.AccidentMapper">
<resultMap id="BaseResultMap" type="com.rzyc.model.Accident">
<id column="AccidentId" jdbcType="VARCHAR" property="accidentid" />
<result column="SysEnterpriseId" jdbcType="VARCHAR" property="sysenterpriseid" />
<result column="AccidentTypeId" jdbcType="VARCHAR" property="accidenttypeid" />
<result column="OrgCode" jdbcType="VARCHAR" property="orgcode" />
<result column="EntName" jdbcType="VARCHAR" property="entname" />
<result column="AccidentName" jdbcType="VARCHAR" property="accidentname" />
<result column="OrgName" jdbcType="VARCHAR" property="orgname" />
<result column="Unite" jdbcType="VARCHAR" property="unite" />
<result column="other" jdbcType="VARCHAR" property="other" />
<result column="acRectifica" jdbcType="VARCHAR" property="acRectifica" />
<result column="togetherUnite" jdbcType="VARCHAR" property="togetherUnite" />
<result column="happenLink" jdbcType="VARCHAR" property="happenLink" />
<result column="Industry" jdbcType="VARCHAR" property="industry" />
<result column="victim" jdbcType="VARCHAR" property="victim" />
<result column="advice" jdbcType="VARCHAR" property="advice" />
<result column="accountability" jdbcType="VARCHAR" property="accountability" />
<result column="AccidentLevel" jdbcType="VARCHAR" property="accidentlevel" />
<result column="HappenTime" jdbcType="TIMESTAMP" property="happentime" />
<result column="BookRelationAdd" jdbcType="VARCHAR" property="bookrelationadd" />
<result column="AccidentCourse" jdbcType="VARCHAR" property="accidentcourse" />
<result column="AccidentReason" jdbcType="VARCHAR" property="accidentreason" />
<result column="DeathCount" jdbcType="VARCHAR" property="deathcount" />
<result column="SeriousInjury" jdbcType="VARCHAR" property="seriousinjury" />
<result column="MinorWound" jdbcType="DECIMAL" property="minorwound" />
<result column="LossMoney" jdbcType="VARCHAR" property="lossmoney" />
<result column="CreatedOn" jdbcType="TIMESTAMP" property="createdon" />
<result column="CreatedBy" jdbcType="VARCHAR" property="createdby" />
<result column="ModifiedOn" jdbcType="TIMESTAMP" property="modifiedon" />
<result column="ModifiedBy" jdbcType="VARCHAR" property="modifiedby" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
AccidentId, SysEnterpriseId, AccidentTypeId, OrgCode, EntName, AccidentName, OrgName,
Unite,
other,
acRectifica,
togetherUnite,
happenLink,
Industry,
victim,
advice,
accountability,
AccidentLevel, HappenTime, BookRelationAdd, AccidentCourse, AccidentReason,
DeathCount, SeriousInjury, MinorWound, LossMoney, CreatedOn, CreatedBy, ModifiedOn,
ModifiedBy
</sql>
<select id="selectByExample" parameterType="com.rzyc.model.AccidentExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from Accident
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="limit != null">
<if test="offset != null">
limit ${offset}, ${limit}
</if>
<if test="offset == null">
limit ${limit}
</if>
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from Accident
where AccidentId = #{accidentid,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from Accident
where AccidentId = #{accidentid,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="com.rzyc.model.AccidentExample">
delete from Accident
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.rzyc.model.Accident">
insert into Accident (AccidentId, SysEnterpriseId, AccidentTypeId,
OrgCode, EntName, AccidentName,
OrgName,
Unite,
other,
acRectifica,
togetherUnite,
happenLink,
Industry,
victim,
advice,
accountability,
AccidentLevel,
HappenTime, BookRelationAdd, AccidentCourse,
AccidentReason, DeathCount, SeriousInjury,
MinorWound, LossMoney, CreatedOn,
CreatedBy, ModifiedOn, ModifiedBy
)
values (#{accidentid,jdbcType=VARCHAR}, #{sysenterpriseid,jdbcType=VARCHAR}, #{accidenttypeid,jdbcType=VARCHAR},
#{orgcode,jdbcType=VARCHAR}, #{entname,jdbcType=VARCHAR}, #{accidentname,jdbcType=VARCHAR},
#{orgname,jdbcType=VARCHAR},
#{unite,jdbcType=VARCHAR},
#{other,jdbcType=VARCHAR},
#{acRectifica,jdbcType=VARCHAR},
#{togetherUnite,jdbcType=VARCHAR},
#{happenLink,jdbcType=VARCHAR},
#{industry,jdbcType=VARCHAR},
#{victim,jdbcType=VARCHAR},
#{advice,jdbcType=VARCHAR},
#{accountability,jdbcType=VARCHAR},
#{accidentlevel,jdbcType=VARCHAR},
#{happentime,jdbcType=TIMESTAMP}, #{bookrelationadd,jdbcType=VARCHAR}, #{accidentcourse,jdbcType=VARCHAR},
#{accidentreason,jdbcType=VARCHAR}, #{deathcount,jdbcType=VARCHAR}, #{seriousinjury,jdbcType=VARCHAR},
#{minorwound,jdbcType=DECIMAL}, #{lossmoney,jdbcType=VARCHAR}, #{createdon,jdbcType=TIMESTAMP},
#{createdby,jdbcType=VARCHAR}, #{modifiedon,jdbcType=TIMESTAMP}, #{modifiedby,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.rzyc.model.Accident">
insert into Accident
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="accidentid != null">
AccidentId,
</if>
<if test="sysenterpriseid != null">
SysEnterpriseId,
</if>
<if test="accidenttypeid != null">
AccidentTypeId,
</if>
<if test="orgcode != null">
OrgCode,
</if>
<if test="entname != null">
EntName,
</if>
<if test="accidentname != null">
AccidentName,
</if>
<if test="orgname != null">
OrgName,
</if>
<if test="unite != null">
Unite,
</if>
<if test="other != null">
other,
</if>
<if test="acRectifica != null">
acRectifica,
</if>
<if test="togetherUnite != null">
togetherUnite,
</if>
<if test="happenLink != null">
happenLink,
</if>
<if test="industry != null">
Industry,
</if>
<if test="victim != null">
victim,
</if>
<if test="advice != null">
advice,
</if>
<if test="accountability != null">
accountability,
</if>
<if test="accidentlevel != null">
AccidentLevel,
</if>
<if test="happentime != null">
HappenTime,
</if>
<if test="bookrelationadd != null">
BookRelationAdd,
</if>
<if test="accidentcourse != null">
AccidentCourse,
</if>
<if test="accidentreason != null">
AccidentReason,
</if>
<if test="deathcount != null">
DeathCount,
</if>
<if test="seriousinjury != null">
SeriousInjury,
</if>
<if test="minorwound != null">
MinorWound,
</if>
<if test="lossmoney != null">
LossMoney,
</if>
<if test="createdon != null">
CreatedOn,
</if>
<if test="createdby != null">
CreatedBy,
</if>
<if test="modifiedon != null">
ModifiedOn,
</if>
<if test="modifiedby != null">
ModifiedBy,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="accidentid != null">
#{accidentid,jdbcType=VARCHAR},
</if>
<if test="sysenterpriseid != null">
#{sysenterpriseid,jdbcType=VARCHAR},
</if>
<if test="accidenttypeid != null">
#{accidenttypeid,jdbcType=VARCHAR},
</if>
<if test="orgcode != null">
#{orgcode,jdbcType=VARCHAR},
</if>
<if test="entname != null">
#{entname,jdbcType=VARCHAR},
</if>
<if test="accidentname != null">
#{accidentname,jdbcType=VARCHAR},
</if>
<if test="orgname != null">
#{orgname,jdbcType=VARCHAR},
</if>
<if test="unite != null">
#{unite,jdbcType=VARCHAR},
</if>
<if test="other != null">
#{other,jdbcType=VARCHAR},
</if>
<if test="acRectifica != null">
#{acRectifica,jdbcType=VARCHAR},
</if>
<if test="togetherUnite != null">
#{togetherUnite,jdbcType=VARCHAR},
</if>
<if test="happenLink != null">
#{happenLink,jdbcType=VARCHAR},
</if>
<if test="industry != null">
#{industry,jdbcType=VARCHAR},
</if>
<if test="victim != null">
#{victim,jdbcType=VARCHAR},
</if>
<if test="advice != null">
#{advice,jdbcType=VARCHAR},
</if>
<if test="accountability != null">
#{accountability,jdbcType=VARCHAR},
</if>
<if test="accidentlevel != null">
#{accidentlevel,jdbcType=VARCHAR},
</if>
<if test="happentime != null">
#{happentime,jdbcType=TIMESTAMP},
</if>
<if test="bookrelationadd != null">
#{bookrelationadd,jdbcType=VARCHAR},
</if>
<if test="accidentcourse != null">
#{accidentcourse,jdbcType=VARCHAR},
</if>
<if test="accidentreason != null">
#{accidentreason,jdbcType=VARCHAR},
</if>
<if test="deathcount != null">
#{deathcount,jdbcType=VARCHAR},
</if>
<if test="seriousinjury != null">
#{seriousinjury,jdbcType=VARCHAR},
</if>
<if test="minorwound != null">
#{minorwound,jdbcType=DECIMAL},
</if>
<if test="lossmoney != null">
#{lossmoney,jdbcType=VARCHAR},
</if>
<if test="createdon != null">
#{createdon,jdbcType=TIMESTAMP},
</if>
<if test="createdby != null">
#{createdby,jdbcType=VARCHAR},
</if>
<if test="modifiedon != null">
#{modifiedon,jdbcType=TIMESTAMP},
</if>
<if test="modifiedby != null">
#{modifiedby,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.rzyc.model.AccidentExample" resultType="java.lang.Long">
select count(*) from Accident
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update Accident
<set>
<if test="record.accidentid != null">
AccidentId = #{record.accidentid,jdbcType=VARCHAR},
</if>
<if test="record.sysenterpriseid != null">
SysEnterpriseId = #{record.sysenterpriseid,jdbcType=VARCHAR},
</if>
<if test="record.accidenttypeid != null">
AccidentTypeId = #{record.accidenttypeid,jdbcType=VARCHAR},
</if>
<if test="record.orgcode != null">
OrgCode = #{record.orgcode,jdbcType=VARCHAR},
</if>
<if test="record.entname != null">
EntName = #{record.entname,jdbcType=VARCHAR},
</if>
<if test="record.accidentname != null">
AccidentName = #{record.accidentname,jdbcType=VARCHAR},
</if>
<if test="record.orgname != null">
OrgName = #{record.orgname,jdbcType=VARCHAR},
</if>
<if test="record.unite != null">
Unite = #{record.unite,jdbcType=VARCHAR},
</if>
<if test="record.other != null">
other = #{record.other,jdbcType=VARCHAR},
</if>
<if test="record.acRectifica != null">
acRectifica = #{record.acRectifica,jdbcType=VARCHAR},
</if>
<if test="record.togetherUnite != null">
togetherUnite = #{record.togetherUnite,jdbcType=VARCHAR},
</if>
<if test="record.happenLink != null">
happenLink = #{record.happenLink,jdbcType=VARCHAR},
</if>
<if test="record.industry != null">
Industry = #{record.industry,jdbcType=VARCHAR},
</if>
<if test="record.victim != null">
victim = #{record.victim,jdbcType=VARCHAR},
</if>
<if test="record.advice != null">
advice = #{record.advice,jdbcType=VARCHAR},
</if>
<if test="record.accountability != null">
accountability = #{record.accountability,jdbcType=VARCHAR},
</if>
<if test="record.accidentlevel != null">
AccidentLevel = #{record.accidentlevel,jdbcType=VARCHAR},
</if>
<if test="record.happentime != null">
HappenTime = #{record.happentime,jdbcType=TIMESTAMP},
</if>
<if test="record.bookrelationadd != null">
BookRelationAdd = #{record.bookrelationadd,jdbcType=VARCHAR},
</if>
<if test="record.accidentcourse != null">
AccidentCourse = #{record.accidentcourse,jdbcType=VARCHAR},
</if>
<if test="record.accidentreason != null">
AccidentReason = #{record.accidentreason,jdbcType=VARCHAR},
</if>
<if test="record.deathcount != null">
DeathCount = #{record.deathcount,jdbcType=VARCHAR},
</if>
<if test="record.seriousinjury != null">
SeriousInjury = #{record.seriousinjury,jdbcType=VARCHAR},
</if>
<if test="record.minorwound != null">
MinorWound = #{record.minorwound,jdbcType=DECIMAL},
</if>
<if test="record.lossmoney != null">
LossMoney = #{record.lossmoney,jdbcType=VARCHAR},
</if>
<if test="record.createdon != null">
CreatedOn = #{record.createdon,jdbcType=TIMESTAMP},
</if>
<if test="record.createdby != null">
CreatedBy = #{record.createdby,jdbcType=VARCHAR},
</if>
<if test="record.modifiedon != null">
ModifiedOn = #{record.modifiedon,jdbcType=TIMESTAMP},
</if>
<if test="record.modifiedby != null">
ModifiedBy = #{record.modifiedby,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update Accident
set AccidentId = #{record.accidentid,jdbcType=VARCHAR},
SysEnterpriseId = #{record.sysenterpriseid,jdbcType=VARCHAR},
AccidentTypeId = #{record.accidenttypeid,jdbcType=VARCHAR},
OrgCode = #{record.orgcode,jdbcType=VARCHAR},
EntName = #{record.entname,jdbcType=VARCHAR},
AccidentName = #{record.accidentname,jdbcType=VARCHAR},
OrgName = #{record.orgname,jdbcType=VARCHAR},
Unite = #{record.unite,jdbcType=VARCHAR},
other = #{record.other,jdbcType=VARCHAR},
acRectifica = #{record.acRectifica,jdbcType=VARCHAR},
togetherUnite = #{record.togetherUnite,jdbcType=VARCHAR},
happenLink = #{record.happenLink,jdbcType=VARCHAR},
Industry = #{record.industry,jdbcType=VARCHAR},
victim = #{record.victim,jdbcType=VARCHAR},
advice = #{record.advice,jdbcType=VARCHAR},
accountability = #{record.accountability,jdbcType=VARCHAR},
AccidentLevel = #{record.accidentlevel,jdbcType=VARCHAR},
HappenTime = #{record.happentime,jdbcType=TIMESTAMP},
BookRelationAdd = #{record.bookrelationadd,jdbcType=VARCHAR},
AccidentCourse = #{record.accidentcourse,jdbcType=VARCHAR},
AccidentReason = #{record.accidentreason,jdbcType=VARCHAR},
DeathCount = #{record.deathcount,jdbcType=VARCHAR},
SeriousInjury = #{record.seriousinjury,jdbcType=VARCHAR},
MinorWound = #{record.minorwound,jdbcType=DECIMAL},
LossMoney = #{record.lossmoney,jdbcType=VARCHAR},
CreatedOn = #{record.createdon,jdbcType=TIMESTAMP},
CreatedBy = #{record.createdby,jdbcType=VARCHAR},
ModifiedOn = #{record.modifiedon,jdbcType=TIMESTAMP},
ModifiedBy = #{record.modifiedby,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.rzyc.model.Accident">
update Accident
<set>
<if test="sysenterpriseid != null">
SysEnterpriseId = #{sysenterpriseid,jdbcType=VARCHAR},
</if>
<if test="accidenttypeid != null">
AccidentTypeId = #{accidenttypeid,jdbcType=VARCHAR},
</if>
<if test="orgcode != null">
OrgCode = #{orgcode,jdbcType=VARCHAR},
</if>
<if test="entname != null">
EntName = #{entname,jdbcType=VARCHAR},
</if>
<if test="accidentname != null">
AccidentName = #{accidentname,jdbcType=VARCHAR},
</if>
<if test="orgname != null">
OrgName = #{orgname,jdbcType=VARCHAR},
</if>
<if test="unite != null">
Unite = #{unite,jdbcType=VARCHAR},
</if>
<if test="other != null">
other = #{other,jdbcType=VARCHAR},
</if>
<if test="acRectifica != null">
acRectifica = #{acRectifica,jdbcType=VARCHAR},
</if>
<if test="togetherUnite != null">
togetherUnite = #{togetherUnite,jdbcType=VARCHAR},
</if>
<if test="happenLink != null">
happenLink = #{happenLink,jdbcType=VARCHAR},
</if>
<if test="industry != null">
Industry = #{industry,jdbcType=VARCHAR},
</if>
<if test="victim != null">
victim = #{victim,jdbcType=VARCHAR},
</if>
<if test="advice != null">
advice = #{advice,jdbcType=VARCHAR},
</if>
<if test="accountability != null">
accountability = #{accountability,jdbcType=VARCHAR},
</if>
<if test="accidentlevel != null">
AccidentLevel = #{accidentlevel,jdbcType=VARCHAR},
</if>
<if test="happentime != null">
HappenTime = #{happentime,jdbcType=TIMESTAMP},
</if>
<if test="bookrelationadd != null">
BookRelationAdd = #{bookrelationadd,jdbcType=VARCHAR},
</if>
<if test="accidentcourse != null">
AccidentCourse = #{accidentcourse,jdbcType=VARCHAR},
</if>
<if test="accidentreason != null">
AccidentReason = #{accidentreason,jdbcType=VARCHAR},
</if>
<if test="deathcount != null">
DeathCount = #{deathcount,jdbcType=VARCHAR},
</if>
<if test="seriousinjury != null">
SeriousInjury = #{seriousinjury,jdbcType=VARCHAR},
</if>
<if test="minorwound != null">
MinorWound = #{minorwound,jdbcType=DECIMAL},
</if>
<if test="lossmoney != null">
LossMoney = #{lossmoney,jdbcType=VARCHAR},
</if>
<if test="createdon != null">
CreatedOn = #{createdon,jdbcType=TIMESTAMP},
</if>
<if test="createdby != null">
CreatedBy = #{createdby,jdbcType=VARCHAR},
</if>
<if test="modifiedon != null">
ModifiedOn = #{modifiedon,jdbcType=TIMESTAMP},
</if>
<if test="modifiedby != null">
ModifiedBy = #{modifiedby,jdbcType=VARCHAR},
</if>
</set>
where AccidentId = #{accidentid,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.rzyc.model.Accident">
update Accident
set SysEnterpriseId = #{sysenterpriseid,jdbcType=VARCHAR},
AccidentTypeId = #{accidenttypeid,jdbcType=VARCHAR},
OrgCode = #{orgcode,jdbcType=VARCHAR},
EntName = #{entname,jdbcType=VARCHAR},
AccidentName = #{accidentname,jdbcType=VARCHAR},
OrgName = #{orgname,jdbcType=VARCHAR},
Unite = #{unite,jdbcType=VARCHAR},
other = #{other,jdbcType=VARCHAR},
acRectifica = #{acRectifica,jdbcType=VARCHAR},
togetherUnite = #{togetherUnite,jdbcType=VARCHAR},
happenLink = #{happenLink,jdbcType=VARCHAR},
Industry = #{industry,jdbcType=VARCHAR},
victim = #{victim,jdbcType=VARCHAR},
advice = #{advice,jdbcType=VARCHAR},
accountability = #{accountability,jdbcType=VARCHAR},
AccidentLevel = #{accidentlevel,jdbcType=VARCHAR},
HappenTime = #{happentime,jdbcType=TIMESTAMP},
BookRelationAdd = #{bookrelationadd,jdbcType=VARCHAR},
AccidentCourse = #{accidentcourse,jdbcType=VARCHAR},
AccidentReason = #{accidentreason,jdbcType=VARCHAR},
DeathCount = #{deathcount,jdbcType=VARCHAR},
SeriousInjury = #{seriousinjury,jdbcType=VARCHAR},
MinorWound = #{minorwound,jdbcType=DECIMAL},
LossMoney = #{lossmoney,jdbcType=VARCHAR},
CreatedOn = #{createdon,jdbcType=TIMESTAMP},
CreatedBy = #{createdby,jdbcType=VARCHAR},
ModifiedOn = #{modifiedon,jdbcType=TIMESTAMP},
ModifiedBy = #{modifiedby,jdbcType=VARCHAR}
where AccidentId = #{accidentid,jdbcType=VARCHAR}
</update>
<!--事故列表-->
<resultMap id="AccidentResultMap" type="com.rzyc.model.Accident">
<id column="AccidentId" jdbcType="VARCHAR" property="accidentid" />
<result column="SysEnterpriseId" jdbcType="VARCHAR" property="sysenterpriseid" />
<result column="AccidentTypeId" jdbcType="VARCHAR" property="accidenttypeid" />
<result column="OrgCode" jdbcType="VARCHAR" property="orgcode" />
<result column="EntName" jdbcType="VARCHAR" property="entname" />
<result column="AccidentName" jdbcType="VARCHAR" property="accidentname" />
<result column="OrgName" jdbcType="VARCHAR" property="orgname" />
<result column="Unite" jdbcType="VARCHAR" property="unite" />
<result column="other" jdbcType="VARCHAR" property="other" />
<result column="acRectifica" jdbcType="VARCHAR" property="acRectifica" />
<result column="togetherUnite" jdbcType="VARCHAR" property="togetherUnite" />
<result column="happenLink" jdbcType="VARCHAR" property="happenLink" />
<result column="Industry" jdbcType="VARCHAR" property="industry" />
<result column="victim" jdbcType="VARCHAR" property="victim" />
<result column="advice" jdbcType="VARCHAR" property="advice" />
<result column="accountability" jdbcType="VARCHAR" property="accountability" />
<result column="AccidentLevel" jdbcType="VARCHAR" property="accidentlevel" />
<result column="HappenTime" jdbcType="TIMESTAMP" property="happentime" />
<result column="BookRelationAdd" jdbcType="VARCHAR" property="bookrelationadd" />
<result column="AccidentCourse" jdbcType="VARCHAR" property="accidentcourse" />
<result column="AccidentReason" jdbcType="VARCHAR" property="accidentreason" />
<result column="DeathCount" jdbcType="VARCHAR" property="deathcount" />
<result column="SeriousInjury" jdbcType="VARCHAR" property="seriousinjury" />
<result column="MinorWound" jdbcType="DECIMAL" property="minorwound" />
<result column="LossMoney" jdbcType="VARCHAR" property="lossmoney" />
<result column="CreatedOn" jdbcType="TIMESTAMP" property="createdon" />
<result column="CreatedBy" jdbcType="VARCHAR" property="createdby" />
<result column="ModifiedOn" jdbcType="TIMESTAMP" property="modifiedon" />
<result column="ModifiedBy" jdbcType="VARCHAR" property="modifiedby" />
<result column="AccidentType" jdbcType="VARCHAR" property="accidenttype" />
</resultMap>
<!--事故列表-->
<select id="accidentList" resultMap="AccidentResultMap">
SELECT adt.AccidentType,ad.* FROM `Accident` ad
LEFT JOIN `AccidentType` adt ON ad.AccidentTypeId = adt.AccidentTypeId
WHERE del_state =1
<if test="enterpriseId != null and '' != enterpriseId">
and ad.SysEnterpriseId = #{enterpriseId}
</if>
<if test="title != null and '' != title">
and ad.AccidentName like concat('%',#{title},'%')
</if>
ORDER BY ad.ModifiedOn DESC
</select>
<select id="accidentDetailByCompanyId" resultMap="AccidentResultMap">
select * from Accident A left join AccidentType Act on A.AccidentTypeId=Act.AccidentTypeId
where A.SysEnterpriseId=#{enterpriseId} order by A.OrgName desc
</select>
<update id="updateState" parameterType="java.util.List">
update Accident set del_state = 2 where OthEquipmentId in (
<foreach collection="list" item="item" index="index" open="" close="" separator=",">
#{item}
</foreach>
)
</update>
<resultMap id="GetAccidentResultMap" type="com.rzyc.bean.bigdata.GetAccident">
<result column="month" jdbcType="VARCHAR" property="month" />
<result column="Frequency" jdbcType="VARCHAR" property="Frequency" />
<result column="DeathToll" jdbcType="VARCHAR" property="DeathToll" />
</resultMap>
<select id="getAccident" resultMap="GetAccidentResultMap">
SELECT `view`.`month` AS `month`,COUNT(`view`.`AccidentId`) AS `Frequency`,
COALESCE(SUM(`view`.`DeathCount`),0) AS `DeathToll`
FROM (SELECT `a`.`month` AS `month`,`b`.`AccidentId` AS `AccidentId`,`b`.`SysEnterpriseId` AS `SysEnterpriseId`,
`b`.`AccidentTypeId` AS `AccidentTypeId`,`b`.`OrgCode` AS `OrgCode`,`b`.`EntName` AS `EntName`,
`b`.`AccidentName` AS `AccidentName`,`b`.`OrgName` AS `OrgName`,`b`.`Unite` AS `Unite`,
`b`.`AccidentLevel` AS `AccidentLevel`,`b`.`HappenTime` AS `HappenTime`,`b`.`BookRelationAdd` AS `BookRelationAdd`,
`b`.`AccidentCourse` AS `AccidentCourse`,`b`.`AccidentReason` AS `AccidentReason`,`b`.`DeathCount` AS `DeathCount`,
`b`.`SeriousInjury` AS `SeriousInjury`,`b`.`MinorWound` AS `MinorWound`,`b`.`LossMoney` AS `LossMoney`,`b`.`HappenLink` AS `HappenLink`,
`b`.`TogetherUnite` AS `TogetherUnite`,`b`.`Victim` AS `Victim`,`b`.`Accountability` AS `Accountability`,`b`.`Other` AS `Other`,
`b`.`AcReason` AS `AcReason`,`b`.`AcRectifica` AS `AcRectifica`,`b`.`Advice` AS `Advice`,`b`.`CreatedBy` AS `CreatedBy`,
`b`.`CreatedOn` AS `CreatedOn`,`b`.`ModifiedOn` AS `ModifiedOn`,`b`.`ModifiedBy` AS `ModifiedBy`
FROM (((SELECT DATE_FORMAT(CURDATE(),'%Y-%m') AS `month`)
UNION SELECT DATE_FORMAT((CURDATE() - INTERVAL 1 MONTH),'%Y-%m') AS `month`
UNION SELECT DATE_FORMAT((CURDATE() - INTERVAL 2 MONTH),'%Y-%m') AS `month`
UNION SELECT DATE_FORMAT((CURDATE() - INTERVAL 3 MONTH),'%Y-%m') AS `month`
UNION SELECT DATE_FORMAT((CURDATE() - INTERVAL 4 MONTH),'%Y-%m') AS `month`
UNION SELECT DATE_FORMAT((CURDATE() - INTERVAL 5 MONTH),'%Y-%m') AS `month`
UNION SELECT DATE_FORMAT((CURDATE() - INTERVAL 6 MONTH),'%Y-%m') AS `month`
UNION SELECT DATE_FORMAT((CURDATE() - INTERVAL 7 MONTH),'%Y-%m') AS `month`
UNION SELECT DATE_FORMAT((CURDATE() - INTERVAL 8 MONTH),'%Y-%m') AS `month`
UNION SELECT DATE_FORMAT((CURDATE() - INTERVAL 9 MONTH),'%Y-%m') AS `month`
UNION SELECT DATE_FORMAT((CURDATE() - INTERVAL 10 MONTH),'%Y-%m') AS `month`
UNION SELECT DATE_FORMAT((CURDATE() - INTERVAL 11 MONTH),'%Y-%m') AS `month`) `a`
LEFT JOIN `Accident` `b` ON((`a`.`month` = DATE_FORMAT(`b`.`HappenTime`,'%Y-%m'))))) `view`
GROUP BY `view`.`month`
</select>
<resultMap id="AccidentInfoResultMap" type="com.rzyc.bean.bigdata.check.AccidentNum">
<result column="monthTime" jdbcType="INTEGER" property="month" />
<result column="accidentNum" jdbcType="INTEGER" property="accidentNum" />
<result column="deathNum" jdbcType="INTEGER" property="deathNum" />
</resultMap>
<!--事故趋势分析-->
<select id="accidentNum" resultMap="AccidentInfoResultMap">
SELECT
DATE_FORMAT(ad.HappenTime,'%m') monthTime,
count(ad.AccidentId) accidentNum,
sum(ad.DeathCount) deathNum
FROM Accident ad
left join SysEnterprise se on ad.SysEnterpriseId = se.SysEnterpriseId
where ad.HappenTime like #{yearStr}
<if test="null != areaCode and '' != areaCode">
and se.street_code = #{areaCode}
</if>
GROUP BY monthTime
order by monthTime asc
</select>
</mapper>