LightStripPolicyCmdMapper.xml 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.welampiot.dao.LightStripPolicyCmdDao">
  4. <select id="getLightStripPolicyCmdList" resultType="LightStripPolicyCmdDTO">
  5. select
  6. l.id,l.value,l.type,l.strip_policy_id as stripPolicyId,
  7. l.policy_type1 policyType1,l.starttime1 as startTime1,l.type_cmd1 as typeCmd1,
  8. l.policy_type2 policyType2,l.starttime2 as startTime2,l.type_cmd2 as typeCmd2,
  9. l.policy_type3 policyType3,l.starttime3 as startTime3,l.type_cmd3 as typeCmd3,
  10. l.policy_type4 policyType4,l.starttime4 as startTime4,l.type_cmd4 as typeCmd4,
  11. l.policy_type5 policyType5,l.starttime5 as startTime5,l.type_cmd5 as typeCmd5,
  12. l.policy_type6 policyType6,l.starttime6 as startTime6,l.type_cmd6 as typeCmd6,
  13. l.policy_type7 policyType7,l.starttime7 as startTime7,l.type_cmd7 as typeCmd7,
  14. l.policy_type8 policyType8,l.starttime8 as startTime8,l.type_cmd8 as typeCmd8,
  15. l.policy_type9 policyType9,l.starttime9 as startTime9,l.type_cmd9 as typeCmd9,
  16. l.policy_type10 policyType10,l.starttime10 as startTime10,l.type_cmd10 as typeCmd10,
  17. l.policy_type11 policyType11,l.starttime11 as startTime11,l.type_cmd11 as typeCmd11,
  18. l.policy_type12 policyType12,l.starttime12 as startTime12,l.type_cmd12 as typeCmd12
  19. from light_strip_policy_cmd l
  20. where l.strip_policy_id in
  21. <foreach collection="ids" item="item" open="(" separator="," close=")">
  22. #{item}
  23. </foreach>
  24. </select>
  25. <insert id="addLightStripPolicyCmdData" parameterType="LightStripPolicyCmdDTO" useGeneratedKeys="true" keyProperty="id">
  26. insert into light_strip_policy_cmd(strip_policy_id,type,`value`,
  27. <if test="policyType1 != null and policyType1 != ''">
  28. policy_type1, starttime1, type_cmd1,
  29. </if>
  30. <if test="policyType2 != null and policyType2 != ''">
  31. policy_type2, starttime2, type_cmd2,
  32. </if>
  33. <if test="policyType3 != null and policyType3 != ''">
  34. policy_type3, starttime3, type_cmd3,
  35. </if>
  36. <if test="policyType4 != null and policyType4 != ''">
  37. policy_type4, starttime4, type_cmd4,
  38. </if>
  39. <if test="policyType5 != null and policyType5 != ''">
  40. policy_type5, starttime5, type_cmd5,
  41. </if>
  42. <if test="policyType6 != null and policyType6 != ''">
  43. policy_type6, starttime6, type_cmd6,
  44. </if>
  45. <if test="policyType7 != null and policyType7 != ''">
  46. policy_type7, starttime7, type_cmd7,
  47. </if>
  48. <if test="policyType8 != null and policyType8 != ''">
  49. policy_type8, starttime8, type_cmd8,
  50. </if>
  51. <if test="policyType9 != null and policyType9 != ''">
  52. policy_type9, starttime9, type_cmd9,
  53. </if>
  54. <if test="policyType10 != null and policyType10 != ''">
  55. policy_type10, starttime10, type_cmd10,
  56. </if>
  57. <if test="policyType11 != null and policyType11 != ''">
  58. policy_type11, starttime11, type_cmd11,
  59. </if>
  60. <if test="policyType12 != null and policyType12 != ''">
  61. policy_type12, starttime12, type_cmd12,
  62. </if>
  63. createtime, updatetime)
  64. values (#{stripPolicyId},#{type},#{value},
  65. <if test="policyType1 != null and policyType1 != ''">
  66. #{policyType1},#{startTime1},#{typeCmd1},
  67. </if>
  68. <if test="policyType2 != null and policyType2 != ''">
  69. #{policyType2},#{startTime2},#{typeCmd2},
  70. </if>
  71. <if test="policyType3 != null and policyType3 != ''">
  72. #{policyType3},#{startTime3},#{typeCmd3},
  73. </if>
  74. <if test="policyType4 != null and policyType4 != ''">
  75. #{policyType4},#{startTime4},#{typeCmd4},
  76. </if>
  77. <if test="policyType5 != null and policyType5 != ''">
  78. #{policyType5},#{startTime5},#{typeCmd5},
  79. </if>
  80. <if test="policyType6 != null and policyType6 != ''">
  81. #{policyType6},#{startTime6},#{typeCmd6},
  82. </if>
  83. <if test="policyType7 != null and policyType7 != ''">
  84. #{policyType7},#{startTime7},#{typeCmd7},
  85. </if>
  86. <if test="policyType8 != null and policyType8 != ''">
  87. #{policyType8},#{startTime8},#{typeCmd8},
  88. </if>
  89. <if test="policyType9 != null and policyType9 != ''">
  90. #{policyType9},#{startTime9},#{typeCmd9},
  91. </if>
  92. <if test="policyType10 != null and policyType10 != ''">
  93. #{policyType10},#{startTime10},#{typeCmd10},
  94. </if>
  95. <if test="policyType11 != null and policyType11 != ''">
  96. #{policyType11},#{startTime11},#{typeCmd11},
  97. </if>
  98. <if test="policyType12 != null and policyType12 != ''">
  99. #{policyType12},#{startTime12},#{typeCmd12},
  100. </if>
  101. #{createTime},#{updateTime}
  102. )
  103. </insert>
  104. <delete id="deleteLightStripPolicyCmdByPolicyId">
  105. delete
  106. from light_strip_policy_cmd
  107. where strip_policy_id = #{policyId};
  108. </delete>
  109. <select id="getStripPolicyCmdByPolicyId" resultType="LightStripPolicyCmdDTO">
  110. select
  111. l.id,l.value,l.type,l.strip_policy_id as stripPolicyId,
  112. l.policy_type1 policyType1,l.starttime1 as startTime1,l.type_cmd1 as typeCmd1,
  113. l.policy_type2 policyType2,l.starttime2 as startTime2,l.type_cmd2 as typeCmd2,
  114. l.policy_type3 policyType3,l.starttime3 as startTime3,l.type_cmd3 as typeCmd3,
  115. l.policy_type4 policyType4,l.starttime4 as startTime4,l.type_cmd4 as typeCmd4,
  116. l.policy_type5 policyType5,l.starttime5 as startTime5,l.type_cmd5 as typeCmd5,
  117. l.policy_type6 policyType6,l.starttime6 as startTime6,l.type_cmd6 as typeCmd6,
  118. l.policy_type7 policyType7,l.starttime7 as startTime7,l.type_cmd7 as typeCmd7,
  119. l.policy_type8 policyType8,l.starttime8 as startTime8,l.type_cmd8 as typeCmd8,
  120. l.policy_type9 policyType9,l.starttime9 as startTime9,l.type_cmd9 as typeCmd9,
  121. l.policy_type10 policyType10,l.starttime10 as startTime10,l.type_cmd10 as typeCmd10,
  122. l.policy_type11 policyType11,l.starttime11 as startTime11,l.type_cmd11 as typeCmd11,
  123. l.policy_type12 policyType12,l.starttime12 as startTime12,l.type_cmd12 as typeCmd12
  124. from light_strip_policy_cmd l
  125. where l.strip_policy_id = #{policyId}
  126. </select>
  127. </mapper>