DeviceApproveDao.xml 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  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.DeviceApproveDao">
  4. <resultMap type="cn.ourwill.module.house.entity.daily.DeviceApprove" id="baseMap">
  5. <result column="id" property="id"/>
  6. <result column="grain_id" property="grainId"/>
  7. <result column="house_id" property="houseId"/>
  8. <result column="status" property="status"/>
  9. <result column="appr_name_fkk" property="apprNameFkk"/>
  10. <result column="appr_time_fkk" property="apprTimeFkk"/>
  11. <result column="appr_name_zskk" property="apprNameZskk"/>
  12. <result column="appr_time_zskk" property="apprTimeZskk"/>
  13. <result column="appr_name_zskg" property="apprNameZskg"/>
  14. <result column="appr_time_zskg" property="apprTimeZskg"/>
  15. <result column="application_name" property="applicationName"/>
  16. <result column="application_time" property="applicationTime"/>
  17. <result column="c_id" property="cId"/>
  18. <result column="c_time" property="cTime"/>
  19. <result column="u_id" property="uId"/>
  20. <result column="u_time" property="uTime"/>
  21. <result column="version" property="version"/>
  22. <result column="uuid" property="duuid"/>
  23. <result column="remark" property="remark"/>
  24. <result column="sync_flag" property="syncFlag"/>
  25. </resultMap>
  26. <insert id="insert" keyColumn="id" keyProperty="id" useGeneratedKeys="true"
  27. parameterType="cn.ourwill.module.house.entity.daily.DeviceApprove">
  28. INSERT INTO daily_device_approve
  29. <trim prefix="(" suffix=")" suffixOverrides=",">
  30. <if test=" grainId != null">
  31. grain_id,
  32. </if>
  33. <if test=" houseId != null and houseId != ''">
  34. house_id,
  35. </if>
  36. <if test="status !=null">
  37. status,
  38. </if>
  39. <if test="apprNameFkk !=null">
  40. appr_name_fkk,
  41. </if>
  42. <if test="apprTimeFkk !=null">
  43. appr_time_fkk,
  44. </if>
  45. <if test="applicationName !=null">
  46. application_name,
  47. </if>
  48. <if test="applicationTime !=null">
  49. application_time,
  50. </if>
  51. <if test="duuid !=null">
  52. uuid,
  53. </if>
  54. <if test="syncFlag !=null">
  55. sync_flag,
  56. </if>
  57. <if test=" cTime != null">
  58. c_time,
  59. </if>
  60. <if test=" cId != null">
  61. c_id,
  62. </if>
  63. <if test=" uTime != null">
  64. u_time,
  65. </if>
  66. <if test=" uId != null">
  67. u_id,
  68. </if>
  69. <if test=" remark != null">
  70. remark,
  71. </if>
  72. <if test=" version != null">
  73. version
  74. </if>
  75. </trim>
  76. <trim prefix="values (" suffix=")" suffixOverrides=",">
  77. <if test=" grainId != null">
  78. #{grainId},
  79. </if>
  80. <if test=" houseId != null and houseId != ''">
  81. #{houseId},
  82. </if>
  83. <if test=" status != null">
  84. #{status},
  85. </if>
  86. <if test="apprNameFkk !=null">
  87. #{apprNameFkk},
  88. </if>
  89. <if test="apprTimeFkk !=null">
  90. #{apprTimeFkk},
  91. </if>
  92. <if test="applicationName !=null">
  93. #{applicationName},
  94. </if>
  95. <if test="applicationTime !=null">
  96. #{applicationTime},
  97. </if>
  98. <if test="duuid !=null">
  99. #{duuid},
  100. </if>
  101. <if test="syncFlag !=null">
  102. #{syncFlag},
  103. </if>
  104. <if test=" cTime != null">
  105. #{cTime},
  106. </if>
  107. <if test=" cId != null">
  108. #{cId},
  109. </if>
  110. <if test=" uTime != null">
  111. #{uTime},
  112. </if>
  113. <if test=" uId != null">
  114. #{uId},
  115. </if>
  116. <if test=" remark != null">
  117. #{remark},
  118. </if>
  119. <if test=" version != null">
  120. #{version}
  121. </if>
  122. </trim>
  123. </insert>
  124. <update id="updateStatus">
  125. update daily_device_approve set status=#{status} where id=#{id}
  126. </update>
  127. <sql id="columns">
  128. a.id,
  129. a.grain_id,
  130. a.house_id,
  131. a.status,
  132. a.application_name,
  133. a.application_time,
  134. a.uuid,
  135. a.remark,
  136. a.sync_flag,
  137. </sql>
  138. <sql id="sgcolumns">
  139. sg.name AS grainName
  140. </sql>
  141. <sql id="joinCols">
  142. </sql>
  143. <select id="get" resultMap="baseMap">
  144. SELECT
  145. *
  146. FROM daily_device_approve
  147. WHERE id = #{id}
  148. </select>
  149. <select id="findList" resultMap="baseMap">
  150. SELECT
  151. <include refid="columns"/>
  152. <include refid="sgcolumns"/>
  153. FROM daily_device_approve a
  154. LEFT JOIN sys_grain sg on sg.id=a.grain_id
  155. <include refid="joinCols"/>
  156. <where>
  157. <if test="grainList !=null">
  158. and a.grain_id in
  159. <foreach item="item" index="index" collection="grainList" open="(" separator="," close=")">
  160. #{item}
  161. </foreach>
  162. </if>
  163. <if test="statusList !=null">
  164. and a.status in
  165. <foreach item="item" index="index" collection="statusList" open="(" separator="," close=")">
  166. #{item}
  167. </foreach>
  168. </if>
  169. <if test="status !=null">
  170. and a.status = #{status}
  171. </if>
  172. <if test="applicationTime !=null">
  173. and a.application_time like CONCAT('%',#{applicationTime},'%')
  174. </if>
  175. </where>
  176. <choose>
  177. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  178. ORDER BY ${page.orderBy}
  179. </when>
  180. <otherwise>
  181. </otherwise>
  182. </choose>
  183. </select>
  184. <delete id="deleteById">
  185. delete from daily_device_approve where id=#{id}
  186. </delete>
  187. </mapper>