123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- <?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.welampiot.dao.PlcPolicyCmdDao">
-
- <insert id="addPlcPolicyCmdZeroType" parameterType="PlcPolicyCmdDTO" keyProperty="id" useGeneratedKeys="true">
- insert into plc_policy_cmd(plc_policy_id, policyType, base_time_type,
- <if test="startTime1 != null and startTime1 != ''">
- starttime1, bright1, color1,
- </if>
- <if test="endTime1 != null and endTime1 != ''">
- endtime1, end_bright1, end_color1,
- </if>
- <if test="startTime2 != null and startTime2 != ''">
- starttime2, bright2, color2,
- </if>
- <if test="endTime2 != null and endTime2 != ''">
- endtime2, end_bright2, end_color2,
- </if>
- <if test="startTime3 != null and startTime3 != ''">
- starttime3, bright3, color3,
- </if>
- <if test="endTime3 != null and endTime3 != ''">
- endtime3, end_bright3, end_color3,
- </if>
- <if test="startTime4 != null and startTime4 != ''">
- starttime4, bright4, color4,
- </if>
- <if test="endTime4 != null and endTime4 != ''">
- endtime4, end_bright4, end_color4,
- </if>
- <if test="startTime5 != null and startTime5 != ''">
- starttime5, bright5, color5,
- </if>
- <if test="endTime5 != null and endTime5 != ''">
- endtime5, end_bright5, end_color5,
- </if>
- <if test="startTime6 != null and startTime6 != ''">
- starttime6, bright6, color6,
- </if>
- <if test="endTime6 != null and endTime6 != ''">
- endtime6, end_bright6, end_color6,
- </if>
- <if test="weekly != null">
- weekly,
- </if>
- lighter_mask)
- values (#{plcPolicyId},#{policyType},#{baseTimeType},
- <if test="startTime1 != null and startTime1 != ''">
- #{startTime1},#{bright1},#{color1},
- </if>
- <if test="endTime1 != null and endTime1 != ''">
- #{endTime1},#{endBright1},#{endColor1},
- </if>
- <if test="startTime2 != null and startTime2 != ''">
- #{startTime2},#{bright2},#{color2},
- </if>
- <if test="endTime2 != null and endTime2 != ''">
- #{endTime2},#{endBright2},#{endColor2},
- </if>
- <if test="startTime3 != null and startTime3 != ''">
- #{startTime3},#{bright3},#{color3},
- </if>
- <if test="endTime3 != null and endTime3 != ''">
- #{endTime3},#{endBright3},#{endColor3},
- </if>
- <if test="startTime4 != null and startTime4 != ''">
- #{startTime4},#{bright4},#{color4},
- </if>
- <if test="endTime4 != null and endTime4 != ''">
- #{endTime4},#{endBright4},#{endColor4},
- </if>
- <if test="startTime5 != null and startTime5 != ''">
- #{startTime5},#{bright5},#{color5},
- </if>
- <if test="endTime5 != null and endTime5 != ''">
- #{endTime5},#{endBright5},#{endColor5},
- </if>
- <if test="startTime6 != null and startTime6 != ''">
- #{startTime6},#{bright6},#{color6},
- </if>
- <if test="endTime6 != null and endTime6 != ''">
- #{endTime6},#{endBright6},#{endColor6},
- </if>
- <if test="weekly != null">
- #{weekly},
- </if>
- #{lighterMask})
- </insert>
- <insert id="addPlcPolicyCmdSunType" useGeneratedKeys="true" keyProperty="id" parameterType="PlcPolicyCmdDTO">
- insert into plc_policy_cmd(plc_policy_id, policyType, base_time_type,
- sunrise, start_delay_time, start_bright, start_color,
- sunset, end_delay_time, end_bright, end_color,
- <if test="weekly != null">
- weekly,
- </if>
- lighter_mask)
- values (#{plcPolicyId},#{policyType},#{baseTimeType},
- #{sunrise},#{startDelayTime},#{startBright},#{startColor},
- #{sunset},#{endDelayTime},#{endBright},#{endColor},
- <if test="weekly != null">
- #{weekly},
- </if>
- #{lighterMask})
- </insert>
- <delete id="deletePlcPolicyCmdByPlcPolicyId">
- delete
- from plc_policy_cmd
- where plc_policy_id = #{plcPolicyId};
- </delete>
- <select id="getPlcPolicyCmdListByPolicyId" resultType="PlcPolicyCmdDTO">
- select
- p.id, p.plc_policy_id as plcPolicyId, p.policyType, p.base_time_type as baseTimeType,
- p.lighter_mask as lighterMask, p.starttime1 as startTime1, p.bright1, p.color1,
- p.endtime1 as endTime1,p.end_bright1 as endBright1, p.end_color1 as endColor1,
- p.starttime2 as startTime2, p.bright2, p.color2, p.endtime2 as endTime2, p.end_bright2 as endBright2, p.end_color2 as endColor2,
- p.starttime3 as startTime3, p.endtime3 as endTime3, p.bright3, p.color3, p.end_bright3 as endBright3, p.end_color3 as endColor3,
- p.starttime4 as startTime4, p.endtime4 as endTime4, p.bright4, p.color4, p.end_bright4 as endBright4, p.end_color4 as endColor4,
- p.starttime5 as startTime5, p.endtime5 as endTime5, p.bright5, p.color5, p.end_bright5 as endBright5, p.end_color5 as endColor5,
- p.starttime6 as startTime6, p.endtime6 as endTime6, p.bright6, p.color6, p.end_bright6 as endBright6, p.end_color6 as endColor6,
- p.sunrise, p.start_delay_time as startDelayTime, p.start_bright as startBright, p.start_color as startColor,
- p.sunset, p.end_delay_time as endDelayTime, p.end_bright as endBright, p.end_color as endColor,
- p.weekly, p.holiday_date as holidayDate, p.holiday_day as holidayDay
- from plc_policy_cmd p
- where p.plc_policy_id in
- <foreach collection="policyIds" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </select>
- <select id="getPlcPolicyCmdByPolicyId" resultType="PlcPolicyCmdDTO">
- select
- p.id, p.plc_policy_id as plcPolicyId, p.policyType, p.base_time_type as baseTimeType,
- p.lighter_mask as lighterMask, p.starttime1 as startTime1, p.bright1, p.color1,
- p.endtime1 as endTime1,p.end_bright1 as endBright1, p.end_color1 as endColor1,
- p.starttime2 as startTime2, p.bright2, p.color2, p.endtime2 as endTime2, p.end_bright2 as endBright2, p.end_color2 as endColor2,
- p.starttime3 as startTime3, p.endtime3 as endTime3, p.bright3, p.color3, p.end_bright3 as endBright3, p.end_color3 as endColor3,
- p.starttime4 as startTime4, p.endtime4 as endTime4, p.bright4, p.color4, p.end_bright4 as endBright4, p.end_color4 as endColor4,
- p.starttime5 as startTime5, p.endtime5 as endTime5, p.bright5, p.color5, p.end_bright5 as endBright5, p.end_color5 as endColor5,
- p.starttime6 as startTime6, p.endtime6 as endTime6, p.bright6, p.color6, p.end_bright6 as endBright6, p.end_color6 as endColor6,
- p.sunrise, p.start_delay_time as startDelayTime, p.start_bright as startBright, p.start_color as startColor,
- p.sunset, p.end_delay_time as endDelayTime, p.end_bright as endBright, p.end_color as endColor,
- p.weekly, p.holiday_date as holidayDate, p.holiday_day as holidayDay
- from plc_policy_cmd p
- where p.plc_policy_id = #{policyId}
- </select>
- </mapper>
|