DeviceApproveBackDao.xml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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.DeviceApproveBackDao">
  4. <resultMap type="cn.ourwill.module.house.entity.daily.DeviceApproveBack" id="baseMap">
  5. <result column="id" property="id"/>
  6. <result column="back_content" property="backContent"/>
  7. <result column="back_time" property="backTime"/>
  8. <result column="back_level" property="backLevel"/>
  9. <result column="back_name" property="backName"/>
  10. <result column="c_id" property="cId"/>
  11. <result column="c_time" property="cTime"/>
  12. <result column="u_id" property="uId"/>
  13. <result column="u_time" property="uTime"/>
  14. <result column="version" property="version"/>
  15. <result column="uuid" property="uuid"/>
  16. <result column="sync_flag" property="syncFlag"/>
  17. </resultMap>
  18. <insert id="insert" keyColumn="id" keyProperty="id" useGeneratedKeys="true"
  19. parameterType="cn.ourwill.module.house.entity.daily.DeviceApprove">
  20. INSERT INTO daily_device_feedback
  21. <trim prefix="(" suffix=")" suffixOverrides=",">
  22. <if test=" backContent != null">
  23. back_content,
  24. </if>
  25. <if test=" backTime != null and backTime != ''">
  26. back_time,
  27. </if>
  28. <if test="backLevel !=null">
  29. back_level,
  30. </if>
  31. <if test="backName !=null">
  32. back_name,
  33. </if>
  34. <if test="uuid !=null">
  35. uuid,
  36. </if>
  37. <if test="syncFlag !=null">
  38. sync_flag,
  39. </if>
  40. <if test=" cTime != null">
  41. c_time,
  42. </if>
  43. <if test=" cId != null">
  44. c_id,
  45. </if>
  46. <if test=" uTime != null">
  47. u_time,
  48. </if>
  49. <if test=" uId != null">
  50. u_id,
  51. </if>
  52. <if test=" version != null">
  53. version
  54. </if>
  55. </trim>
  56. <trim prefix="values (" suffix=")" suffixOverrides=",">
  57. <if test=" backContent != null">
  58. #{backContent},
  59. </if>
  60. <if test=" backTime != null and backTime != ''">
  61. #{backTime},
  62. </if>
  63. <if test="backLevel !=null">
  64. #{backLevel},
  65. </if>
  66. <if test="backName !=null">
  67. #{backName},
  68. </if>
  69. <if test="uuid !=null">
  70. #{uuid},
  71. </if>
  72. <if test="syncFlag !=null">
  73. #{syncFlag},
  74. </if>
  75. <if test=" cTime != null">
  76. #{cTime},
  77. </if>
  78. <if test=" cId != null">
  79. #{cId},
  80. </if>
  81. <if test=" uTime != null">
  82. #{uTime},
  83. </if>
  84. <if test=" uId != null">
  85. #{uId},
  86. </if>
  87. <if test=" version != null">
  88. #{version}
  89. </if>
  90. </trim>
  91. </insert>
  92. <sql id="columns">
  93. a.id,
  94. a.grain_id,
  95. a.house_id,
  96. a.status,
  97. a.application_name,
  98. a.application_time,
  99. a.uuid,
  100. a.remark,
  101. a.sync_flag,
  102. </sql>
  103. <sql id="sgcolumns">
  104. sg.name AS grainName
  105. </sql>
  106. <sql id="joinCols">
  107. </sql>
  108. <select id="get" resultMap="baseMap">
  109. SELECT
  110. *
  111. FROM daily_device_feedback
  112. WHERE id = #{id}
  113. </select>
  114. <select id="findList" resultMap="baseMap">
  115. SELECT
  116. <include refid="columns"/>
  117. <include refid="sgcolumns"/>
  118. FROM daily_device_feedback a
  119. LEFT JOIN sys_grain sg on sg.id=a.grain_id
  120. <include refid="joinCols"/>
  121. <where>
  122. <if test="grainList !=null">
  123. and a.grain_id in
  124. <foreach item="item" index="index" collection="grainList" open="(" separator="," close=")">
  125. #{item}
  126. </foreach>
  127. </if>
  128. <if test="statusList !=null">
  129. and a.status in
  130. <foreach item="item" index="index" collection="statusList" open="(" separator="," close=")">
  131. #{item}
  132. </foreach>
  133. </if>
  134. <if test="status !=null">
  135. and a.status = #{status}
  136. </if>
  137. </where>
  138. <choose>
  139. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  140. ORDER BY ${page.orderBy}
  141. </when>
  142. <otherwise>
  143. </otherwise>
  144. </choose>
  145. </select>
  146. <select id="getByUuid" resultMap="baseMap">
  147. select * from daily_device_feedback where uuid=#{uuid} and back_level=#{backLevel}
  148. </select>
  149. <delete id="deleteById">
  150. delete from daily_device_feedback where id=#{id}
  151. </delete>
  152. <delete id="deleteByUuid">
  153. delete from daily_device_feedback where uuid=#{uuid}
  154. </delete>
  155. </mapper>