DailyRecordMaintainDao.xml 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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.DailyRecordMaintainDao">
  4. <resultMap type="cn.ourwill.module.house.entity.daily.DailyRecordMaintain" id="BaseResultMap">
  5. <result column="id" property="id"/>
  6. <result column="check_date" property="checkDate"/>
  7. <!-- <result column="type" property="type"/>-->
  8. <result column="project" property="project"/>
  9. <result column="problem" property="problem"/>
  10. <!-- <result column="opinion" property="opinion"/>
  11. <result column="bosshead" property="bosshead"/>
  12. <result column="maintain_start_date" property="maintainStartDate"/>
  13. <result column="maintain_end_date" property="maintainEndDate"/>-->
  14. <result column="result" property="result"/>
  15. <result column="remark" property="remark"/>
  16. <!-- <result column="check_person" property="checkPerson"/>-->
  17. <result column="house_id" property="houseId"/>
  18. <result column="uuid" property="uuid"/>
  19. <result column="c_id" property="cId"/>
  20. <result column="c_time" property="cTime" />
  21. <result column="u_id" property="uId"/>
  22. <result column="u_time" property="uTime" />
  23. <!--<result column="finish_date" property="finishDate"/>-->
  24. </resultMap>
  25. <sql id="houseColumns">
  26. id,check_date,project,problem,result,remark,house_id,uuid,c_id,c_time,u_id,u_time
  27. </sql>
  28. <sql id="houseColumns_old">
  29. id,check_date,type,project,problem,opinion,bosshead,maintain_start_date,maintain_end_date,result,remark,check_person,house_id,finish_date
  30. </sql>
  31. <insert id="insert" parameterType="cn.ourwill.module.house.entity.daily.DailyRecordMaintain">
  32. INSERT INTO daily_record_maintain( <include refid="houseColumns"/>)
  33. VALUES (
  34. #{id},#{checkDate},#{project},#{problem},#{result},#{remark},#{houseId},#{uuid},#{cId},#{cTime},#{uId},#{uTime}
  35. )
  36. </insert>
  37. <!-- <insert id="insert" parameterType="cn.ourwill.module.house.entity.daily.DailyRecordMaintain">
  38. INSERT INTO daily_record_maintain( <include refid="houseColumns"/>)
  39. VALUES (
  40. #{id},#{checkDate},#{type},#{project},#{problem},#{opinion},#{bosshead},#{maintainStartDate},#{maintainEndDate},#{result},#{remark},#{checkPerson},#{houseId},#{finishDate}
  41. )
  42. </insert>-->
  43. <!-- 查询检测记录 -->
  44. <select id="findList" parameterType="cn.ourwill.module.house.entity.daily.DailyRecordMaintain" resultMap="BaseResultMap">
  45. SELECT <include refid="houseColumns"/>
  46. FROM daily_record_maintain WHERE 1 = 1
  47. <if test="maintainStartDate != null and maintainEndDate != null">
  48. AND check_date BETWEEN #{maintainStartDate} AND #{maintainEndDate}
  49. </if>
  50. <!--<if test="type != null">
  51. AND type = #{type}
  52. </if>-->
  53. <if test="houseId != null">
  54. and house_id = #{houseId}
  55. </if>
  56. <if test="cTime !=null">
  57. and c_time like CONCAT('%',#{cTime},'%')
  58. </if>
  59. order by id desc
  60. </select>
  61. <!-- 根据id查询 -->
  62. <select id="getById" parameterType="long" resultType="cn.ourwill.module.house.entity.daily.DailyRecordMaintain">
  63. SELECT <include refid="houseColumns"/>
  64. FROM daily_record_maintain
  65. WHERE id = #{value}
  66. </select>
  67. <!-- 根据houseid查询 -->
  68. <select id="getByHouseId" parameterType="long" resultMap="BaseResultMap">
  69. SELECT DISTINCT(project) FROM daily_record_maintain
  70. WHERE house_id = #{value}
  71. </select>
  72. <select id="findAllList" resultMap="BaseResultMap">
  73. SELECT <include refid="houseColumns"/>
  74. FROM daily_record_maintain
  75. order by id desc
  76. </select>
  77. <update id="update" parameterType="cn.ourwill.module.house.entity.daily.DailyRecordMaintain">
  78. UPDATE daily_record_maintain
  79. <set>
  80. <if test="checkDate != null">
  81. check_date = #{checkDate},
  82. </if>
  83. <if test="type != null">
  84. type = #{type},
  85. </if>
  86. <if test="project != null">
  87. project = #{project},
  88. </if>
  89. <if test="problem != null">
  90. problem = #{problem},
  91. </if>
  92. <if test="opinion != null">
  93. opinion = #{opinion},
  94. </if>
  95. <if test="bosshead != null">
  96. bosshead = #{bosshead},
  97. </if>
  98. <if test="maintainStartDate != null">
  99. maintain_start_date = #{maintainStartDate},
  100. </if>
  101. <if test="maintainEndDate != null">
  102. maintain_end_date = #{maintainEndDate},
  103. </if>
  104. <if test="result != null">
  105. result = #{result},
  106. </if>
  107. <if test="remark != null">
  108. remark = #{remark},
  109. </if>
  110. <if test="checkPerson != null">
  111. check_person = #{checkPerson},
  112. </if>
  113. <if test="finishDate != null">
  114. finish_date = #{finishDate}
  115. </if>
  116. </set>
  117. WHERE id = #{id}
  118. </update>
  119. <update id="updateByUUID" parameterType="cn.ourwill.module.house.entity.daily.DailyRecordMaintain">
  120. UPDATE daily_record_maintain
  121. <set>
  122. <if test="checkDate != null">
  123. check_date = #{checkDate},
  124. </if>
  125. <if test="type != null">
  126. type = #{type},
  127. </if>
  128. <if test="project != null">
  129. project = #{project},
  130. </if>
  131. <if test="problem != null">
  132. problem = #{problem},
  133. </if>
  134. <if test="opinion != null">
  135. opinion = #{opinion},
  136. </if>
  137. <if test="bosshead != null">
  138. bosshead = #{bosshead},
  139. </if>
  140. <if test="maintainStartDate != null">
  141. maintain_start_date = #{maintainStartDate},
  142. </if>
  143. <if test="maintainEndDate != null">
  144. maintain_end_date = #{maintainEndDate},
  145. </if>
  146. <if test="result != null">
  147. result = #{result},
  148. </if>
  149. <if test="remark != null">
  150. remark = #{remark},
  151. </if>
  152. <if test="checkPerson != null">
  153. check_person = #{checkPerson},
  154. </if>
  155. <if test="finishDate != null">
  156. finish_date = #{finishDate}
  157. </if>
  158. </set>
  159. WHERE uuid = #{uuid}
  160. </update>
  161. <!-- 删除维修记录 -->
  162. <delete id="deleteById" parameterType="long">
  163. DELETE FROM daily_record_maintain WHERE id = #{value}
  164. </delete>
  165. <!-- 查询检查类别 -->
  166. <select id="getType" resultType="string">
  167. SELECT DISTINCT type FROM daily_record_maintain
  168. </select>
  169. <select id="findByHouseId" resultMap="BaseResultMap">
  170. SELECT *
  171. FROM daily_record_maintain a
  172. where house_id=#{houseId}
  173. <if test="cTime != null">
  174. AND c_time <![CDATA[ <= ]]> #{cTime}
  175. </if>
  176. </select>
  177. <select id="getByUuid" resultMap="BaseResultMap">
  178. SELECT *
  179. FROM daily_record_maintain a
  180. where uuid=#{uuid}
  181. </select>
  182. <delete id="deleteByHouseId">
  183. DELETE FROM daily_record_maintain
  184. WHERE house_id = #{houseId}
  185. <if test="cTime != null">
  186. AND c_time <![CDATA[ <= ]]> #{cTime}
  187. </if>
  188. </delete>
  189. </mapper>