<?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.safePlatform.safeCheck.repository.SafeCheckUnitAndQuotaRepository" >
|
<resultMap id="BaseResultMap" type="com.gkhy.safePlatform.safeCheck.entity.SafeCheckUnitAndQuota" >
|
<id column="id" property="id" />
|
<result column="unit_id" property="unitId"/>
|
<result column="unit_uuid" property="unitUuid" />
|
<result column="point_id" property="pointId" />
|
<result column="point_uuid" property="pointUuid" />
|
<result column="region_id" property="regionId" />
|
<result column="region_uuid" property="regionUuid" />
|
<result column="rfid_id" property="rfidId" />
|
<result column="quota_id" property="quotaId" />
|
<result column="quota_unit" property="quotaUnit" />
|
<result column="exec_sequence" property="execSequence" />
|
<result column="delete_status" property="deleteStatus" />
|
<result column="data_report_type" property="dataReportType" />
|
<result column="first_reference_value" property="firstReferenceValue" />
|
<result column="second_reference_sign" property="secondReferenceSign" />
|
<result column="second_reference_value" property="secondReferenceValue" />
|
<result column="third_reference_sign" property="thirdReferenceSign" />
|
<result column="third_reference_value" property="thirdReferenceValue" />
|
<result column="create_user_name" property="createUserName" />
|
<result column="gmt_create" property="gmtCreate" />
|
<result column="last_edit_user_name" property="lastEditUserName" />
|
<result column="gmt_moditify" property="gmtModitify" />
|
</resultMap>
|
|
<sql id="allUnitAndQuotaFields">
|
id,
|
unit_id,
|
unit_uuid,
|
point_id,
|
point_uuid,
|
region_id,
|
region_uuid,
|
rfid_id,
|
quota_id,
|
quota_unit,
|
exec_sequence,
|
delete_status,
|
data_report_type,
|
first_reference_value,
|
second_reference_sign,
|
second_reference_value,
|
third_reference_sign,
|
third_reference_value,
|
create_user_name,
|
gmt_create,
|
last_edit_user_name,
|
gmt_moditify
|
</sql>
|
|
<insert id="saveUnitAndQuotas" >
|
insert into safe_check_unit_and_quota(
|
unit_id,
|
unit_uuid,
|
point_id,
|
point_uuid,
|
region_id,
|
region_uuid,
|
rfid_id,
|
quota_id,
|
quota_unit,
|
exec_sequence,
|
delete_status,
|
data_report_type,
|
first_reference_value,
|
second_reference_sign,
|
second_reference_value,
|
third_reference_sign,
|
third_reference_value,
|
create_user_name,
|
gmt_create,
|
last_edit_user_name,
|
gmt_moditify
|
)
|
values
|
<foreach collection="safeCheckUnitAndQuotas" item="safeCheckUnitAndQuota" separator="," >
|
(#{safeCheckUnitAndQuota.unitId},
|
#{safeCheckUnitAndQuota.unitUuid},
|
#{safeCheckUnitAndQuota.pointId},
|
#{safeCheckUnitAndQuota.pointUuid},
|
#{safeCheckUnitAndQuota.regionId},
|
#{safeCheckUnitAndQuota.regionUuid},
|
#{safeCheckUnitAndQuota.rfidId},
|
#{safeCheckUnitAndQuota.quotaId},
|
#{safeCheckUnitAndQuota.quotaUnit},
|
#{safeCheckUnitAndQuota.execSequence},
|
#{safeCheckUnitAndQuota.deleteStatus},
|
#{safeCheckUnitAndQuota.dataReportType},
|
#{safeCheckUnitAndQuota.firstReferenceValue},
|
#{safeCheckUnitAndQuota.secondReferenceSign},
|
#{safeCheckUnitAndQuota.secondReferenceValue},
|
#{safeCheckUnitAndQuota.thirdReferenceSign},
|
#{safeCheckUnitAndQuota.thirdReferenceValue},
|
#{safeCheckUnitAndQuota.createUserName},
|
#{safeCheckUnitAndQuota.gmtCreate},
|
#{safeCheckUnitAndQuota.lastEditUserName},
|
#{safeCheckUnitAndQuota.gmtModitify}
|
)
|
</foreach>
|
</insert>
|
|
|
<update id="updateUnitAndQuotasById">
|
update safe_check_unit_and_quota
|
<trim prefix="set" suffixOverrides=",">
|
<!-- <trim prefix="delete_status = case" suffix="end,">-->
|
<!-- <foreach collection="unitAndQuotas" item="unitAndQuota" index="index">-->
|
<!-- <if test="unitAndQuota.deleteStatus != null">-->
|
<!-- when id=#{unitAndQuota.id} then #{unitAndQuota.deleteStatus}-->
|
<!-- </if>-->
|
<!-- </foreach>-->
|
<!-- </trim>-->
|
<trim prefix="last_edit_user_name = case" suffix="end,">
|
<foreach collection="unitAndQuotas" item="unitAndQuota" index="index">
|
<if test="unitAndQuota.lastEditUserName != null">
|
when id=#{unitAndQuota.id} then #{unitAndQuota.lastEditUserName}
|
</if>
|
</foreach>
|
</trim>
|
<trim prefix="gmt_moditify = case" suffix="end,">
|
<foreach collection="unitAndQuotas" item="unitAndQuota" index="index">
|
<if test="unitAndQuota.gmtModitify != null">
|
when id=#{unitAndQuota.id} then #{unitAndQuota.gmtModitify}
|
</if>
|
</foreach>
|
</trim>
|
</trim>
|
where id in
|
<foreach collection="unitAndQuotas" separator="," item="unitAndQuota" index="index" open="(" close=")">
|
#{unitAndQuota.id}
|
</foreach>
|
and delete_status = #{deleteStatus}
|
</update>
|
|
|
<update id="deleteTaskUnitPoint">
|
update safe_check_unit_and_quota
|
<set>
|
<if test="unitAndQuota.deleteStatus != null">
|
delete_status = #{unitAndQuota.deleteStatus},
|
</if>
|
<if test="unitAndQuota.lastEditUserName != null">
|
last_edit_user_name = #{unitAndQuota.lastEditUserName},
|
</if>
|
<if test="unitAndQuota.gmtModitify != null">
|
gmt_moditify = #{unitAndQuota.gmtModitify}
|
</if>
|
where id = #{unitAndQuota.id} and delete_status = #{status}
|
</set>
|
</update>
|
<update id="updateTaskUnitPointById">
|
update safe_check_unit_and_quota
|
<set>
|
<if test="unitAndQuota.pointId != null">
|
point_id = #{unitAndQuota.pointId},
|
</if>
|
<if test="unitAndQuota.regionId != null">
|
region_id = #{unitAndQuota.regionId},
|
</if>
|
<if test="unitAndQuota.rfidId != null">
|
rfid_id = #{unitAndQuota.rfidId},
|
</if>
|
<if test="unitAndQuota.quotaId != null">
|
quota_id = #{unitAndQuota.quotaId},
|
</if>
|
<if test="unitAndQuota.quotaUnit != null">
|
quota_unit = #{unitAndQuota.quotaUnit},
|
</if>
|
<if test="unitAndQuota.execSequence != null">
|
exec_sequence = #{unitAndQuota.execSequence},
|
</if>
|
<if test="unitAndQuota.dataReportType != null">
|
data_report_type = #{unitAndQuota.dataReportType},
|
</if>
|
<if test="unitAndQuota.firstReferenceValue != null">
|
first_reference_value = #{unitAndQuota.firstReferenceValue},
|
</if>
|
<if test="unitAndQuota.secondReferenceSign != null">
|
second_reference_sign = #{unitAndQuota.secondReferenceSign},
|
</if>
|
<if test="unitAndQuota.secondReferenceValue != null">
|
second_reference_value = #{unitAndQuota.secondReferenceValue},
|
</if>
|
<if test="unitAndQuota.thirdReferenceSign != null">
|
third_reference_sign = #{unitAndQuota.thirdReferenceSign},
|
</if>
|
<if test="unitAndQuota.thirdReferenceValue != null">
|
third_reference_value = #{unitAndQuota.thirdReferenceValue},
|
</if>
|
<if test="unitAndQuota.lastEditUserName != null">
|
last_edit_user_name = #{unitAndQuota.lastEditUserName},
|
</if>
|
<if test="unitAndQuota.gmtModitify != null">
|
gmt_moditify = #{unitAndQuota.gmtModitify},
|
</if>
|
</set>
|
where id = #{unitAndQuota.id} and unit_id = #{unitAndQuota.unitId} and delete_status = #{status}
|
</update>
|
|
|
<!-- 暂时不需要-->
|
<select id="unitIsExitTheQuota" resultType="java.lang.Integer">
|
select count(*)
|
from safe_check_unit_and_quota
|
where quota_id = #{quotaId} and delete_status = #{deleteStatus}
|
</select>
|
|
<select id="listByTaskUnitId" resultMap="BaseResultMap">
|
select
|
<include refid="allUnitAndQuotaFields"></include>
|
from safe_check_unit_and_quota
|
where unit_id = #{taskUnitId} and delete_status = #{deleteStatus}
|
</select>
|
|
<select id="getUnitAndQuotaByid" resultType="com.gkhy.safePlatform.safeCheck.entity.SafeCheckUnitAndQuota">
|
select
|
<include refid="allUnitAndQuotaFields"></include>
|
from safe_check_unit_and_quota
|
<where>
|
<if test="condition.id != null">
|
id = #{condition.id} and
|
</if>
|
<if test="condition.taskUnitId != null">
|
unit_id = #{condition.taskUnitId} and
|
</if>
|
<if test="status != null">
|
delete_status = #{status}
|
</if>
|
</where>
|
</select>
|
|
</mapper>
|