DailyRecordAirconditionerDao.xml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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="cn.ourwill.module.house.dao.daily.DailyRecordAirconditionerDao">
  4. <resultMap type="cn.ourwill.module.house.entity.daily.DailyRecordAirconditioner" id="baseMap">
  5. <result column= "id" property="id" />
  6. <result column= "device_id" property="deviceId" />
  7. <result column= "grain_id" property="grainId" />
  8. <result column= "run_time" property="runTime" />
  9. <result column= "time_consum" property="timeConsum" />
  10. <result column= "open_purpose" property="openPurpose" />
  11. <result column= "run_status" property="runStatus" />
  12. <result column= "handle_status" property="handleStatus" />
  13. <result column= "operator" property="operator" />
  14. <result column= "remark" property="remark" />
  15. <result column= "use_energy" property="useEnergy" />
  16. </resultMap>
  17. <sql id="dailyRecordAirconditionerColumns">
  18. id ,
  19. device_id ,
  20. grain_id ,
  21. run_time ,
  22. time_consum ,
  23. open_purpose ,
  24. run_status ,
  25. handle_status ,
  26. operator ,
  27. remark ,
  28. use_energy ,
  29. problem
  30. </sql>
  31. <sql id="dailyRecordAirconditionerJoins">
  32. </sql>
  33. <select id="get" resultType="cn.ourwill.module.house.entity.daily.DailyRecordAirconditioner">
  34. SELECT
  35. <include refid="dailyRecordAirconditionerColumns"/>
  36. FROM daily_record_airconditioner a
  37. <include refid="dailyRecordAirconditionerJoins"/>
  38. WHERE a.id = #{id}
  39. </select>
  40. <select id="findList" resultType="cn.ourwill.module.house.entity.daily.DailyRecordAirconditioner">
  41. SELECT
  42. <include refid="dailyRecordAirconditionerColumns"/>
  43. FROM daily_record_airconditioner a
  44. <include refid="dailyRecordAirconditionerJoins"/>
  45. <where>
  46. <if test="deviceId !=null and deviceId != ''">
  47. and a.device_id=${deviceId}
  48. </if>
  49. </where>
  50. <choose>
  51. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  52. ORDER BY ${page.orderBy}
  53. </when>
  54. <otherwise>
  55. </otherwise>
  56. </choose>
  57. </select>
  58. <select id="findAllList" resultType="cn.ourwill.module.house.entity.daily.DailyRecordAirconditioner">
  59. SELECT
  60. <include refid="dailyRecordAirconditionerColumns"/>
  61. FROM daily_record_airconditioner a
  62. <include refid="dailyRecordAirconditionerJoins"/>
  63. <where>
  64. </where>
  65. <choose>
  66. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  67. ORDER BY ${page.orderBy}
  68. </when>
  69. <otherwise>
  70. </otherwise>
  71. </choose>
  72. </select>
  73. <insert id="insert">
  74. INSERT INTO daily_record_airconditioner
  75. <trim prefix="(" suffix=")" suffixOverrides="," >
  76. <if test=" id != null" >
  77. id,
  78. </if>
  79. <if test=" deviceId != null" >
  80. device_id,
  81. </if>
  82. <if test=" grainId != null" >
  83. grain_id,
  84. </if>
  85. <if test=" runTime != null" >
  86. run_time,
  87. </if>
  88. <if test=" timeConsum != null" >
  89. time_consum,
  90. </if>
  91. <if test=" openPurpose != null" >
  92. open_purpose,
  93. </if>
  94. <if test=" runStatus != null" >
  95. run_status,
  96. </if>
  97. <if test=" handleStatus != null" >
  98. handle_status,
  99. </if>
  100. <if test=" operator != null" >
  101. operator,
  102. </if>
  103. <if test=" remark != null" >
  104. remark,
  105. </if>
  106. <if test=" useEnergy != null" >
  107. use_energy,
  108. </if>
  109. <if test=" problem != null" >
  110. problem</if>
  111. </trim>
  112. <trim prefix="values (" suffix=")" suffixOverrides="," >
  113. <if test=" id != null" >
  114. #{id},
  115. </if>
  116. <if test=" deviceId != null" >
  117. #{deviceId},
  118. </if>
  119. <if test=" grainId != null" >
  120. #{grainId},
  121. </if>
  122. <if test=" runTime != null" >
  123. #{runTime},
  124. </if>
  125. <if test=" timeConsum != null" >
  126. #{timeConsum},
  127. </if>
  128. <if test=" openPurpose != null" >
  129. #{openPurpose},
  130. </if>
  131. <if test=" runStatus != null" >
  132. #{runStatus},
  133. </if>
  134. <if test=" handleStatus != null" >
  135. #{handleStatus},
  136. </if>
  137. <if test=" operator != null" >
  138. #{operator},
  139. </if>
  140. <if test=" remark != null" >
  141. #{remark},
  142. </if>
  143. <if test=" useEnergy != null" >
  144. #{useEnergy},
  145. </if>
  146. <if test=" problem != null" >
  147. #{problem}</if>
  148. </trim>
  149. </insert>
  150. <update id="update">
  151. UPDATE daily_record_airconditioner SET
  152. device_id = #{deviceId},
  153. grain_id = #{grainId},
  154. run_time = #{runTime},
  155. time_consum = #{timeConsum},
  156. open_purpose = #{openPurpose},
  157. run_status = #{runStatus},
  158. handle_status = #{handleStatus},
  159. operator = #{operator},
  160. remark = #{remark},
  161. use_energy = #{useEnergy},
  162. problem = #{problem}
  163. WHERE id = #{id}
  164. </update>
  165. <update id="delete">
  166. DELETE FROM daily_record_airconditioner
  167. WHERE id = #{id}
  168. </update>
  169. <update id="deleteByIds">
  170. DELETE FROM daily_record_airconditioner
  171. WHERE id in (#{ids})
  172. </update>
  173. </mapper>