<?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.ycl.platform.mapper.ContractRuleRecordMapper">
|
|
<resultMap type="com.ycl.platform.domain.entity.ContractRuleRecord" id="ContractRuleRecordResult">
|
<result property="id" column="id"/>
|
<result property="unitId" column="unit_id"/>
|
<result property="siteOnline" column="site_online"/>
|
<result property="createTime" column="create_time"/>
|
<result property="deleted" column="deleted"/>
|
</resultMap>
|
|
<sql id="selectContractRuleRecordVo">
|
select id, unit_id, site_online, create_time, deleted
|
from t_contract_rule_record
|
</sql>
|
|
<select id="selectMonth" resultMap="ContractRuleRecordResult">
|
select id, unit_id, site_online, create_time, deleted
|
from t_contract_rule_record
|
where DATE(create_time) between #{startTime} and #{endTime}
|
</select>
|
<select id="selectContractRuleRecordList" resultMap="ContractRuleRecordResult">
|
<include refid="selectContractRuleRecordVo"/>
|
<where>
|
<if test="unitId != null ">and unit_id = #{unitId}</if>
|
<if test="siteOnline != null ">and site_online = #{siteOnline}</if>
|
<if test="deleted != null ">and deleted = #{deleted}</if>
|
</where>
|
</select>
|
|
<select id="selectContractRuleRecordById" resultMap="ContractRuleRecordResult">
|
<include refid="selectContractRuleRecordVo"/>
|
where id = #{id}
|
</select>
|
|
<insert id="insertContractRuleRecord" useGeneratedKeys="true" keyProperty="id">
|
insert into t_contract_rule_record
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="unitId != null">unit_id,</if>
|
<if test="siteOnline != null">site_online,</if>
|
<if test="createTime != null">create_time,</if>
|
<if test="deleted != null">deleted,</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="unitId != null">#{unitId},</if>
|
<if test="siteOnline != null">#{siteOnline},</if>
|
<if test="createTime != null">#{createTime},</if>
|
<if test="deleted != null">#{deleted},</if>
|
</trim>
|
</insert>
|
|
<insert id="insertBatch">
|
insert into t_contract_rule_record (unit_id,site_online,create_time)
|
values
|
<foreach collection="list" item="item" separator=",">
|
(#{item.unitId},#{item.siteOnline},#{item.createTime})
|
</foreach>
|
</insert>
|
|
<update id="updateContractRuleRecord">
|
update t_contract_rule_record
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="unitId != null">unit_id = #{unitId},</if>
|
<if test="siteOnline != null">site_online = #{siteOnline},</if>
|
<if test="createTime != null">create_time = #{createTime},</if>
|
<if test="deleted != null">deleted = #{deleted},</if>
|
</trim>
|
where id = #{id}
|
</update>
|
|
<delete id="deleteContractRuleRecordById">
|
delete
|
from t_contract_rule_record
|
where id = #{id}
|
</delete>
|
|
<delete id="deleteContractRuleRecordByIds">
|
delete from t_contract_rule_record where id in
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</delete>
|
</mapper>
|