<?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.gkhy.hazmat.system.mapper.HzWarningMapper">
|
<resultMap type="com.gkhy.hazmat.system.domain.HzWarning" id="HzWarningResult">
|
<result property="id" column="id" />
|
<result property="hazmatId" column="hazmat_id" />
|
<result property="basicId" column="basic_id" />
|
<result property="state" column="state" />
|
<result property="createId" column="create_id" />
|
<result property="useTime" column="use_time" />
|
<result property="handleTime" column="handle_time" />
|
<result property="companyId" column="company_id" />
|
<result property="version" column="version" />
|
<result property="createBy" column="create_by" />
|
<result property="createTime" column="create_time" />
|
<result property="updateBy" column="update_by" />
|
<result property="updateTime" column="update_time" />
|
<result property="remark" column="remark" />
|
<result property="createName" column="create_name" />
|
<association property="hazmatBasic" javaType="com.gkhy.hazmat.system.domain.HzHazmatBasic" resultMap="hazmatBasicResult" />
|
|
</resultMap>
|
|
<resultMap type="com.gkhy.hazmat.system.domain.HzHazmatBasic" id="hazmatBasicResult">
|
<result property="id" column="basic_id" />
|
<result property="name" column="basic_name" />
|
</resultMap>
|
|
<sql id="selectWarningVo">
|
select a.id, a.hazmat_id, a.basic_id,a.state, a.create_id,a.use_time,a.handle_time, a.company_id,a.version, a.create_by, a.create_time, a.update_by, a.update_time, a.remark,
|
b.name as basic_name,c.name as create_name
|
from hz_warning a
|
left join hz_hazmat_basic b on a.basic_id=b.id
|
left join sys_user c on c.id=a.create_id
|
</sql>
|
|
<update id="batchUpdateState">
|
update hz_warning set state=0,handle_time=null where hazmat_id in
|
<foreach collection="hazmatIds" item="hazmatId" open="(" separator="," close=")">
|
#{hazmatId}
|
</foreach>
|
</update>
|
|
<select id="selectWarningList" resultMap="HzWarningResult"
|
parameterType="com.gkhy.hazmat.system.domain.HzWarning">
|
<include refid="selectWarningVo"/>
|
<where>
|
<if test="state != null">
|
AND a.state= #{state}
|
</if>
|
<if test="companyId != null">
|
AND a.company_id =#{companyId}
|
</if>
|
</where>
|
order by id desc
|
</select>
|
|
<select id="selectExistHazmatId" resultType="java.lang.Long">
|
select hazmat_id from hz_waring where hazmat_id in
|
<foreach collection="hazmatIds" item="hazmatId" open="(" separator="," close=")">
|
#{hazmatId}
|
</foreach>
|
</select>
|
|
<select id="selectWarningCount" resultType="java.lang.Integer" parameterType="java.lang.Long">
|
select count(1) from hz_warning where company_id=#{companyId} and state=0
|
</select>
|
|
|
</mapper>
|