DailyRecordMaintainFileDao.xml 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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.DailyRecordMaintainFileDao">
  4. <resultMap type="cn.ourwill.module.house.entity.daily.DailyRecordMaintainFile" id="BaseResultMap">
  5. <result column="id" property="id"/>
  6. <result column="uuid" property="uuid"/>
  7. <result column="file_uuid" property="fileUuid" jdbcType="INTEGER" />
  8. <result column="check_date" property="checkDate"/>
  9. <!-- <result column="type" property="type"/>-->
  10. <result column="project" property="project"/>
  11. <result column="problem" property="problem"/>
  12. <!-- <result column="opinion" property="opinion"/>
  13. <result column="bosshead" property="bosshead"/>
  14. <result column="maintain_start_date" property="maintainStartDate"/>
  15. <result column="maintain_end_date" property="maintainEndDate"/>-->
  16. <result column="result" property="result"/>
  17. <result column="remark" property="remark"/>
  18. <!-- <result column="check_person" property="checkPerson"/>-->
  19. <result column="house_id" property="houseId"/>
  20. <result column="uuid" property="uuid"/>
  21. <result column="c_id" property="cId"/>
  22. <result column="c_time" property="cTime" />
  23. <result column="u_id" property="uId"/>
  24. <result column="u_time" property="uTime" />
  25. <!--<result column="finish_date" property="finishDate"/>-->
  26. </resultMap>
  27. <sql id="houseColumns">
  28. id,file_uuid,check_date,project,problem,result,remark,house_id,uuid,c_id,c_time,u_id,u_time
  29. </sql>
  30. <sql id="houseColumns_old">
  31. id,file_uuid,check_date,type,project,problem,opinion,bosshead,maintain_start_date,maintain_end_date,result,remark,check_person,house_id,finish_date
  32. </sql>
  33. <insert id="insert" parameterType="cn.ourwill.module.house.entity.daily.DailyRecordMaintainFile">
  34. INSERT INTO daily_record_maintain_file( <include refid="houseColumns"/>)
  35. VALUES (
  36. #{id},#{fileUuid},#{checkDate},#{project},#{problem},#{result},#{remark},#{houseId},#{uuid},#{cId},#{cTime},#{uId},#{uTime}
  37. )
  38. </insert>
  39. <!-- <insert id="insert" parameterType="cn.ourwill.module.house.entity.daily.DailyRecordMaintain">
  40. INSERT INTO daily_record_maintain_file( <include refid="houseColumns"/>)
  41. VALUES (
  42. #{id},#{checkDate},#{type},#{project},#{problem},#{opinion},#{bosshead},#{maintainStartDate},#{maintainEndDate},#{result},#{remark},#{checkPerson},#{houseId},#{finishDate}
  43. )
  44. </insert>-->
  45. <!-- 查询检测记录 -->
  46. <select id="findList" parameterType="cn.ourwill.module.house.entity.daily.DailyRecordMaintainFile" resultMap="BaseResultMap">
  47. SELECT <include refid="houseColumns"/>
  48. FROM daily_record_maintain_file WHERE 1 = 1
  49. <if test="maintainStartDate != null and maintainEndDate != null">
  50. AND check_date BETWEEN #{maintainStartDate} AND #{maintainEndDate}
  51. </if>
  52. <!--<if test="type != null">
  53. AND type = #{type}
  54. </if>-->
  55. <if test="houseId != null">
  56. and house_id = #{houseId}
  57. </if>
  58. order by id desc
  59. </select>
  60. <!-- 根据id查询 -->
  61. <select id="getById" parameterType="long" resultType="cn.ourwill.module.house.entity.daily.DailyRecordMaintainFile">
  62. SELECT <include refid="houseColumns"/>
  63. FROM daily_record_maintain_file
  64. WHERE id = #{value}
  65. </select>
  66. <select id="getByUuid" resultType="cn.ourwill.module.house.entity.daily.DailyRecordMaintainFile">
  67. SELECT *
  68. FROM daily_record_maintain_file
  69. WHERE uuid = #{uuid}
  70. </select>
  71. <select id="findAllList" resultMap="BaseResultMap">
  72. SELECT <include refid="houseColumns"/>
  73. FROM daily_record_maintain_file
  74. order by id desc
  75. </select>
  76. <update id="update" parameterType="cn.ourwill.module.house.entity.daily.DailyRecordMaintainFile">
  77. UPDATE daily_record_maintain_file
  78. <set>
  79. <if test="checkDate != null">
  80. check_date = #{checkDate},
  81. </if>
  82. <if test="type != null">
  83. type = #{type},
  84. </if>
  85. <if test="project != null">
  86. project = #{project},
  87. </if>
  88. <if test="problem != null">
  89. problem = #{problem},
  90. </if>
  91. <if test="opinion != null">
  92. opinion = #{opinion},
  93. </if>
  94. <if test="bosshead != null">
  95. bosshead = #{bosshead},
  96. </if>
  97. <if test="maintainStartDate != null">
  98. maintain_start_date = #{maintainStartDate},
  99. </if>
  100. <if test="maintainEndDate != null">
  101. maintain_end_date = #{maintainEndDate},
  102. </if>
  103. <if test="result != null">
  104. result = #{result},
  105. </if>
  106. <if test="remark != null">
  107. remark = #{remark},
  108. </if>
  109. <if test="checkPerson != null">
  110. check_person = #{checkPerson},
  111. </if>
  112. <if test="finishDate != null">
  113. finish_date = #{finishDate}
  114. </if>
  115. </set>
  116. WHERE id = #{id}
  117. </update>
  118. <!-- 删除维修记录 -->
  119. <delete id="deleteById" parameterType="long">
  120. DELETE FROM daily_record_maintain_file WHERE id = #{value}
  121. </delete>
  122. <!-- 查询检查类别 -->
  123. <select id="getType" resultType="string">
  124. SELECT DISTINCT type FROM daily_record_maintain_file
  125. </select>
  126. <delete id="deleteByHouseId">
  127. DELETE FROM daily_record_maintain_file
  128. WHERE house_id = #{houseId}
  129. <if test="cTime != null">
  130. AND cTime <![CDATA[ <= ]]> #{cTime}
  131. </if>
  132. </delete>
  133. </mapper>