AssessRecordMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  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.AssessRecordMapper">
  4. <resultMap id="AssessRecordDtoMap" type="com.zhyc.xps.lylc.dto.AssessRecordDto">
  5. <result column="oc_id" property="ocId" jdbcType="BIGINT" />
  6. <result column="group_id" property="groupId" jdbcType="BIGINT" />
  7. <result column="group_name" property="groupName" jdbcType="VARCHAR" />
  8. <result column="position_id" property="positionId" jdbcType="BIGINT" />
  9. <result column="position_name" property="positionName" jdbcType="VARCHAR" />
  10. <result column="account_id" property="accountId" jdbcType="BIGINT" />
  11. <result column="account_name" property="accountName" jdbcType="VARCHAR" />
  12. <result column="record_id" property="recordId" jdbcType="BIGINT" />
  13. <result column="target_oc_id" property="targetOcId" jdbcType="BIGINT" />
  14. <result column="event" property="event" jdbcType="VARCHAR" />
  15. <result column="story_id" property="storyId" jdbcType="BIGINT" />
  16. <result column="target_id" property="targetId" jdbcType="BIGINT" />
  17. <result column="item_id" property="itemId" jdbcType="BIGINT" />
  18. <result column="point_id" property="pointId" jdbcType="BIGINT" />
  19. <result column="score" property="score" jdbcType="DOUBLE" />
  20. <result column="assess_time" property="assessTime" jdbcType="DATE" />
  21. <result column="remark" property="remark" jdbcType="VARCHAR" />
  22. </resultMap>
  23. <sql id="AssessRecordDto_Cols">
  24. A.oc_id,
  25. A.group_id,
  26. B.group_name,
  27. A.position_id,
  28. C.position_name,
  29. A.account_id,
  30. D.account_name,
  31. D.account_real_name,
  32. D.account_avatar,
  33. A.record_id,
  34. A.target_oc_id,
  35. A.event,
  36. A.story_id,
  37. A.target_id,
  38. A.item_id,
  39. A.point_id,
  40. A.score,
  41. A.assess_time,
  42. A.remark
  43. </sql>
  44. <!--基于ID查询-->
  45. <select id="getById" resultMap="AssessRecordDtoMap">
  46. SELECT
  47. <include refid="AssessRecordDto_Cols"/>
  48. FROM hos_assess_record AS A
  49. LEFT JOIN s_group AS B ON (A.oc_id = B.oc_id AND A.group_id = B.group_id)
  50. LEFT JOIN s_position AS C ON (A.oc_id = C.oc_id AND A.position_id = C.position_id)
  51. LEFT JOIN account AS D ON (A.oc_id = D.oc_id AND A.account_id = D.account_id)
  52. WHERE A.deleted_flag = 0
  53. <if test="ocId != null">
  54. AND A.oc_id = #{ocId ,jdbcType=BIGINT}
  55. </if>
  56. <if test="recordId != null">
  57. AND A.record_id = #{recordId ,jdbcType=BIGINT}
  58. </if>
  59. <if test="storyId != null">
  60. AND A.story_id = #{storyId ,jdbcType=BIGINT}
  61. </if>
  62. <if test="targetId != null">
  63. AND A.target_id = #{targetId ,jdbcType=BIGINT}
  64. </if>
  65. <if test="itemId != null">
  66. AND A.item_id = #{itemId ,jdbcType=BIGINT}
  67. </if>
  68. <if test="pointId != null">
  69. AND A.point_id = #{pointId ,jdbcType=BIGINT}
  70. </if>
  71. </select>
  72. <!--分页查询-->
  73. <select id="getByPage" parameterType="java.util.Map" resultMap="AssessRecordDtoMap">
  74. SELECT
  75. <include refid="AssessRecordDto_Cols"/>
  76. FROM hos_assess_record AS A
  77. LEFT JOIN s_group AS B ON (A.oc_id = B.oc_id AND A.group_id = B.group_id)
  78. LEFT JOIN s_position AS C ON (A.oc_id = C.oc_id AND A.position_id = C.position_id)
  79. LEFT JOIN account AS D ON (A.oc_id = D.oc_id AND A.account_id = D.account_id)
  80. WHERE A.deleted_flag = 0
  81. <if test="ocId != null">
  82. AND A.oc_id = #{ocId ,jdbcType=BIGINT}
  83. </if>
  84. <if test="storyId != null">
  85. AND A.story_id = #{storyId ,jdbcType=BIGINT}
  86. </if>
  87. <if test="targetId != null">
  88. AND A.target_id = #{targetId ,jdbcType=BIGINT}
  89. </if>
  90. <if test="itemId != null">
  91. AND A.item_id = #{itemId ,jdbcType=BIGINT}
  92. </if>
  93. <if test="pointId != null">
  94. AND A.point_id = #{pointId ,jdbcType=BIGINT}
  95. </if>
  96. <if test="keywords != null and keywords != ''">
  97. AND A.event like "%"#{keywords}"%"
  98. </if>
  99. ORDER BY A.assess_time DESC
  100. </select>
  101. <!--列表查询-->
  102. <select id="getByList" parameterType="java.util.Map" resultMap="AssessRecordDtoMap" >
  103. SELECT
  104. <include refid="AssessRecordDto_Cols"/>
  105. FROM hos_assess_record AS A
  106. LEFT JOIN s_group AS B ON (A.oc_id = B.oc_id AND A.group_id = B.group_id)
  107. LEFT JOIN s_position AS C ON (A.oc_id = C.oc_id AND A.position_id = C.position_id)
  108. LEFT JOIN account AS D ON (A.oc_id = D.oc_id AND A.account_id = D.account_id)
  109. WHERE A.deleted_flag = 0
  110. <if test="ocId != null">
  111. AND A.oc_id = #{ocId ,jdbcType=BIGINT}
  112. </if>
  113. <if test="storyId != null">
  114. AND A.story_id = #{storyId ,jdbcType=BIGINT}
  115. </if>
  116. <if test="targetId != null">
  117. AND A.target_id = #{targetId ,jdbcType=BIGINT}
  118. </if>
  119. <if test="itemId != null">
  120. AND A.item_id = #{itemId ,jdbcType=BIGINT}
  121. </if>
  122. <if test="pointId != null">
  123. AND A.point_id = #{pointId ,jdbcType=BIGINT}
  124. </if>
  125. <if test="keywords != null and keywords != ''">
  126. AND A.event like "%"#{keywords}"%"
  127. </if>
  128. <if test="year != null">
  129. AND year(A.assess_time) = #{year ,jdbcType=BIGINT}
  130. </if>
  131. <if test="month != null">
  132. AND month(A.assess_time) = #{month ,jdbcType=BIGINT}
  133. </if>
  134. ORDER BY A.assess_time DESC
  135. </select>
  136. <insert id="create" parameterType="com.zhyc.xps.lylc.entity.AssessRecord">
  137. INSERT INTO hos_assess_record
  138. <trim prefix="(" suffix=")" suffixOverrides=",">
  139. <if test="ocId != null">
  140. oc_id,
  141. </if>
  142. <if test="groupId != null">
  143. group_id,
  144. </if>
  145. <if test="positionId != null">
  146. position_id,
  147. </if>
  148. <if test="accountId != null">
  149. account_id,
  150. </if>
  151. <if test="recordId != null">
  152. record_id,
  153. </if>
  154. <if test="event != null and event !=''">
  155. event,
  156. </if>
  157. <if test="targetOcId != null">
  158. target_oc_id,
  159. </if>
  160. <if test="storyId != null">
  161. story_id,
  162. </if>
  163. <if test="targetId != null">
  164. target_id,
  165. </if>
  166. <if test="itemId != null">
  167. item_id,
  168. </if>
  169. <if test="pointId != null">
  170. point_id,
  171. </if>
  172. <if test="score != null">
  173. score,
  174. </if>
  175. <if test="assessTime != null">
  176. assess_time,
  177. </if>
  178. <if test="remark != null and remark != ''">
  179. remark,
  180. </if>
  181. <if test="createdBy != null">
  182. created_by,
  183. </if>
  184. <if test="createdAt != null">
  185. created_at,
  186. </if>
  187. </trim>
  188. <trim prefix="values (" suffix=")" suffixOverrides=",">
  189. <if test="ocId != null">
  190. #{ocId,jdbcType=BIGINT},
  191. </if>
  192. <if test="groupId != null">
  193. #{groupId, jdbcType=BIGINT},
  194. </if>
  195. <if test="positionId != null">
  196. #{positionId, jdbcType=BIGINT},
  197. </if>
  198. <if test="accountId != null">
  199. #{accountId, jdbcType=BIGINT},
  200. </if>
  201. <if test="recordId != null">
  202. #{recordId, jdbcType=BIGINT},
  203. </if>
  204. <if test="event != null and event !=''">
  205. #{event, jdbcType=VARCHAR},
  206. </if>
  207. <if test="targetOcId != null">
  208. #{targetOcId, jdbcType=BIGINT},
  209. </if>
  210. <if test="storyId != null">
  211. #{storyId ,jdbcType=BIGINT},
  212. </if>
  213. <if test="targetId != null">
  214. #{targetId ,jdbcType=BIGINT},
  215. </if>
  216. <if test="itemId != null">
  217. #{itemId ,jdbcType=BIGINT},
  218. </if>
  219. <if test="pointId != null">
  220. #{pointId ,jdbcType=BIGINT},
  221. </if>
  222. <if test="score != null">
  223. #{score ,jdbcType=DOUBLE},
  224. </if>
  225. <if test="assessTime != null">
  226. #{assessTime ,jdbcType=TIMESTAMP},
  227. </if>
  228. <if test="remark != null and remark != ''">
  229. #{remark ,jdbcType=VARCHAR},
  230. </if>
  231. <if test="createdBy != null">
  232. #{createdBy ,jdbcType=BIGINT},
  233. </if>
  234. <if test="createdAt != null">
  235. #{createdAt ,jdbcType=TIMESTAMP},
  236. </if>
  237. </trim>
  238. </insert>
  239. <!--删除-->
  240. <update id="delete" parameterType="java.util.Map">
  241. UPDATE hos_assess_record
  242. <trim suffixOverrides=",">
  243. <set>
  244. <if test="deletedFlag != null">
  245. deleted_flag = #{deletedFlag,jdbcType=BIGINT},
  246. </if>
  247. <if test="deletedTime != null">
  248. deleted_time = #{deletedTime,jdbcType=TIMESTAMP},
  249. </if>
  250. <if test="deletedBy != null">
  251. deleted_by = #{deletedBy,jdbcType=BIGINT},
  252. </if>
  253. </set>
  254. </trim>
  255. WHERE 1 = 1
  256. <if test="ocId != null">
  257. AND oc_id = #{ocId ,jdbcType=BIGINT}
  258. </if>
  259. <if test="recordId != null">
  260. AND record_id = #{recordId ,jdbcType=BIGINT}
  261. </if>
  262. <if test="storyId != null">
  263. AND story_id = #{storyId ,jdbcType=BIGINT}
  264. </if>
  265. <if test="targetId != null">
  266. AND target_id = #{targetId ,jdbcType=BIGINT}
  267. </if>
  268. <if test="itemId != null">
  269. AND item_id = #{itemId ,jdbcType=BIGINT},
  270. </if>
  271. <if test="pointId != null">
  272. AND point_id = #{pointId ,jdbcType=BIGINT}
  273. </if>
  274. </update>
  275. </mapper>