AssessMonthRecordMapper.xml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  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="com.zhyc.xps.lylc.mapper.AssessMonthRecordMapper">
  4. <resultMap id="AssessDtoMap" type="com.zhyc.xps.lylc.dto.AssessMonthRecordDto">
  5. <result column="oc_id" property="ocId" jdbcType="BIGINT" />
  6. <result column="story_id" property="storyId" jdbcType="BIGINT" />
  7. <result column="target_id" property="targetId" jdbcType="BIGINT" />
  8. <result column="target_title" property="targetTitle" jdbcType="VARCHAR" />
  9. <result column="target_code" property="targetCode" jdbcType="VARCHAR" />
  10. <result column="item_id" property="itemId" jdbcType="BIGINT" />
  11. <result column="item_title" property="itemTitle" jdbcType="VARCHAR" />
  12. <result column="item_code" property="itemCode" jdbcType="VARCHAR" />
  13. <result column="point_id" property="pointId" jdbcType="BIGINT" />
  14. <result column="point_content" property="pointContent" jdbcType="VARCHAR" />
  15. <result column="point_code" property="pointCode" jdbcType="VARCHAR" />
  16. <result column="year" property="year" jdbcType="BIGINT" />
  17. <result column="record_id" property="recordId" jdbcType="BIGINT" />
  18. <result column="month" property="month" jdbcType="BIGINT" />
  19. <result column="hos_score" property="hosScore" jdbcType="DOUBLE" />
  20. <result column="nhc_score" property="nhcScore" jdbcType="DOUBLE" />
  21. <result column="remark" property="remark" jdbcType="VARCHAR" />
  22. </resultMap>
  23. <!--基于ID查询-->
  24. <select id="getById" resultMap="AssessDtoMap">
  25. SELECT
  26. A.oc_id,
  27. A.story_id,
  28. A.target_id,
  29. B.target_title,
  30. B.target_code,
  31. A.item_id,
  32. C.item_title,
  33. C.item_code,
  34. A.point_id,
  35. D.point_content,
  36. D.point_code,
  37. A.record_id,
  38. A.year,
  39. A.month,
  40. A.hos_score,
  41. A.nhc_score,
  42. E.remark
  43. FROM hos_assess_month_record AS A
  44. LEFT JOIN assess_story_target AS B ON (A.story_id=B.story_id AND A.target_id=B.target_id)
  45. LEFT join assess_story_target_item AS C ON (A.story_id=C.story_id AND A.target_id=C.target_id AND A.item_id=C.item_id)
  46. LEFT join assess_story_target_item_point AS D ON (A.story_id=D.story_id AND A.target_id=D.target_id AND A.item_id=D.item_id AND A.point_id= D.point_id)
  47. LEFT join hos_assess_record AS E ON (A.oc_id = E.oc_id AND A.record_id = E.record_id)
  48. WHERE A.deleted_flag = 0
  49. AND A.oc_id = #{ocId ,jdbcType=BIGINT}
  50. AND A.story_id = #{storyId ,jdbcType=BIGINT}
  51. AND A.target_id = #{targetId ,jdbcType=BIGINT}
  52. AND A.item_id = #{itemId ,jdbcType=BIGINT}
  53. AND A.point_id = #{pointId ,jdbcType=BIGINT}
  54. AND A.year = #{year, jdbcType=BIGINT}
  55. AND A.month = #{month, jdbcType=BIGINT}
  56. </select>
  57. <!--列表查询-->
  58. <select id="getByList" parameterType="java.util.Map" resultMap="AssessDtoMap" >
  59. SELECT
  60. A.oc_id,
  61. A.story_id,
  62. A.target_id,
  63. B.target_title,
  64. B.target_code,
  65. A.item_id,
  66. C.item_title,
  67. C.item_code,
  68. A.point_id,
  69. D.point_code,
  70. D.point_content,
  71. A.record_id,
  72. A.year,
  73. A.month,
  74. A.hos_score,
  75. A.nhc_score,
  76. E.remark
  77. FROM hos_assess_month_record AS A
  78. LEFT JOIN assess_story_target AS B ON (A.story_id = B.story_id AND A.target_id = B.target_id)
  79. LEFT join assess_story_target_item AS C ON (A.story_id = C.story_id AND A.target_id = C.target_id AND A.item_id = C.item_id)
  80. LEFT join assess_story_target_item_point AS D ON (A.story_id = D.story_id AND A.target_id = D.target_id AND A.item_id = D.item_id AND A.point_id= D.point_id)
  81. LEFT join hos_assess_record AS E ON (A.oc_id = E.oc_id AND A.record_id = E.record_id)
  82. WHERE A.deleted_flag = 0
  83. <if test="ocId != null">
  84. AND A.oc_id = #{ocId ,jdbcType=BIGINT}
  85. </if>
  86. <if test="storyId != null">
  87. AND A.story_id = #{storyId ,jdbcType=BIGINT}
  88. </if>
  89. <if test="targetId != null">
  90. AND A.target_id = #{targetId ,jdbcType=BIGINT}
  91. </if>
  92. <if test="itemId != null">
  93. AND A.item_id = #{itemId ,jdbcType=BIGINT}
  94. </if>
  95. <if test="pointId != null">
  96. AND A.point_id = #{pointId ,jdbcType=BIGINT}
  97. </if>
  98. <if test="year != null">
  99. AND A.year = #{year ,jdbcType=BIGINT}
  100. </if>
  101. <if test="month != null">
  102. AND A.month = #{month ,jdbcType=BIGINT}
  103. </if>
  104. ORDER BY A.story_id, A.target_id, A.item_id, D.sort_no
  105. </select>
  106. <insert id="create" parameterType="com.zhyc.xps.lylc.entity.Assess">
  107. INSERT INTO hos_assess_month_record
  108. <trim prefix="(" suffix=")" suffixOverrides=",">
  109. <if test="ocId != null">
  110. oc_id,
  111. </if>
  112. <if test="storyId != null">
  113. story_id,
  114. </if>
  115. <if test="targetId != null">
  116. target_id,
  117. </if>
  118. <if test="itemId != null">
  119. item_id,
  120. </if>
  121. <if test="pointId != null">
  122. point_id,
  123. </if>
  124. <if test="recordId != null">
  125. record_id,
  126. </if>
  127. <if test="year != null">
  128. year,
  129. </if>
  130. <if test="month != null">
  131. month,
  132. </if>
  133. <if test="nhcScore != null">
  134. nhc_score,
  135. </if>
  136. <if test="hosScore != null">
  137. hos_score,
  138. </if>
  139. <if test="createdBy != null">
  140. created_by,
  141. </if>
  142. <if test="createdAt != null">
  143. created_at,
  144. </if>
  145. </trim>
  146. <trim prefix="values (" suffix=")" suffixOverrides=",">
  147. <if test="ocId != null">
  148. #{ocId,jdbcType=BIGINT},
  149. </if>
  150. <if test="storyId != null">
  151. #{storyId ,jdbcType=BIGINT},
  152. </if>
  153. <if test="targetId != null">
  154. #{targetId ,jdbcType=BIGINT},
  155. </if>
  156. <if test="itemId != null">
  157. #{itemId ,jdbcType=BIGINT},
  158. </if>
  159. <if test="pointId != null">
  160. #{pointId ,jdbcType=BIGINT},
  161. </if>
  162. <if test="recordId != null">
  163. #{recordId ,jdbcType=BIGINT},
  164. </if>
  165. <if test="year != null">
  166. #{year ,jdbcType=BIGINT},
  167. </if>
  168. <if test="month != null">
  169. #{month ,jdbcType=BIGINT},
  170. </if>
  171. <if test="nhcScore != null">
  172. #{nhcScore ,jdbcType=DOUBLE},
  173. </if>
  174. <if test="hosScore != null">
  175. #{hosScore ,jdbcType=DOUBLE},
  176. </if>
  177. <if test="createdBy != null">
  178. #{createdBy ,jdbcType=BIGINT},
  179. </if>
  180. <if test="createdAt != null">
  181. #{createdAt ,jdbcType=TIMESTAMP},
  182. </if>
  183. </trim>
  184. </insert>
  185. <!--更新-->
  186. <update id="update" parameterType="com.zhyc.xps.lylc.entity.Assess">
  187. UPDATE hos_assess_month_record
  188. <trim suffixOverrides=",">
  189. <set>
  190. <if test="recordId != null">
  191. record_id = #{recordId ,jdbcType=BIGINT},
  192. </if>
  193. <if test="nhcScore != null">
  194. nhc_score = #{nhcScore ,jdbcType=DOUBLE},
  195. </if>
  196. <if test="hosScore != null">
  197. hos_score = #{hosScore ,jdbcType=DOUBLE},
  198. </if>
  199. <if test="updatedBy != null ">
  200. updated_by = #{updatedBy ,jdbcType=BIGINT},
  201. </if>
  202. <if test="updatedAt != null">
  203. updated_at = #{updatedAt ,jdbcType=TIMESTAMP},
  204. </if>
  205. </set>
  206. </trim>
  207. WHERE oc_id = #{ocId ,jdbcType=BIGINT}
  208. AND story_id = #{storyId, jdbcType=BIGINT}
  209. AND target_id = #{targetId, jdbcType=BIGINT}
  210. AND item_id = #{itemId, jdbcType=BIGINT}
  211. AND point_id = #{pointId, jdbcType=BIGINT}
  212. AND year = #{year, jdbcType=BIGINT}
  213. AND month = #{month, jdbcType=BIGINT}
  214. </update>
  215. <!--删除-->
  216. <update id="delete" parameterType="java.util.Map">
  217. UPDATE hos_assess_month_record
  218. <trim suffixOverrides=",">
  219. <set>
  220. <if test="deletedFlag != null">
  221. deleted_flag = #{deletedFlag,jdbcType=BIGINT},
  222. </if>
  223. <if test="deletedTime != null">
  224. deleted_time = #{deletedTime,jdbcType=TIMESTAMP},
  225. </if>
  226. <if test="deletedBy != null">
  227. deleted_by = #{deletedBy,jdbcType=BIGINT},
  228. </if>
  229. </set>
  230. </trim>
  231. WHERE oc_id = #{ocId ,jdbcType=BIGINT}
  232. <if test="storyId != null">
  233. AND story_id = #{storyId ,jdbcType=BIGINT}
  234. </if>
  235. <if test="targetId != null">
  236. AND target_id = #{targetId ,jdbcType=BIGINT}
  237. </if>
  238. <if test="itemId != null">
  239. AND item_id = #{itemId ,jdbcType=BIGINT},
  240. </if>
  241. <if test="pointId != null">
  242. AND point_id = #{pointId ,jdbcType=BIGINT}
  243. </if>
  244. <if test="recordId != null">
  245. AND record_id = #{recordId ,jdbcType=BIGINT}
  246. </if>
  247. </update>
  248. </mapper>