AssessRecordMapper.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  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. </select>
  60. <!--分页查询-->
  61. <select id="getByPage" parameterType="java.util.Map" resultMap="AssessRecordDtoMap">
  62. SELECT
  63. <include refid="AssessRecordDto_Cols"/>
  64. FROM hos_assess_record AS A
  65. LEFT JOIN s_group AS B ON (A.oc_id = B.oc_id AND A.group_id = B.group_id)
  66. LEFT JOIN s_position AS C ON (A.oc_id = C.oc_id AND A.position_id = C.position_id)
  67. LEFT JOIN account AS D ON (A.oc_id = D.oc_id AND A.account_id = D.account_id)
  68. WHERE A.deleted_flag = 0
  69. <if test="ocId != null">
  70. AND A.oc_id = #{ocId ,jdbcType=BIGINT}
  71. </if>
  72. <if test="storyId != null">
  73. AND A.story_id = #{storyId ,jdbcType=BIGINT}
  74. </if>
  75. <if test="targetId != null">
  76. AND A.target_id = #{targetId ,jdbcType=BIGINT}
  77. </if>
  78. <if test="itemId != null">
  79. AND A.item_id = #{itemId ,jdbcType=BIGINT}
  80. </if>
  81. <if test="pointId != null">
  82. AND A.point_id = #{pointId ,jdbcType=BIGINT}
  83. </if>
  84. <if test="keywords != null and keywords != ''">
  85. AND A.event like "%"#{keywords}"%"
  86. </if>
  87. ORDER BY A.assess_time DESC
  88. </select>
  89. <!--列表查询-->
  90. <select id="getByList" parameterType="java.util.Map" resultMap="AssessRecordDtoMap" >
  91. SELECT
  92. <include refid="AssessRecordDto_Cols"/>
  93. FROM hos_assess_record AS A
  94. LEFT JOIN s_group AS B ON (A.oc_id = B.oc_id AND A.group_id = B.group_id)
  95. LEFT JOIN s_position AS C ON (A.oc_id = C.oc_id AND A.position_id = C.position_id)
  96. LEFT JOIN account AS D ON (A.oc_id = D.oc_id AND A.account_id = D.account_id)
  97. WHERE A.deleted_flag = 0
  98. <if test="ocId != null">
  99. AND A.oc_id = #{ocId ,jdbcType=BIGINT}
  100. </if>
  101. <if test="storyId != null">
  102. AND A.story_id = #{storyId ,jdbcType=BIGINT}
  103. </if>
  104. <if test="targetId != null">
  105. AND A.target_id = #{targetId ,jdbcType=BIGINT}
  106. </if>
  107. <if test="itemId != null">
  108. AND A.item_id = #{itemId ,jdbcType=BIGINT}
  109. </if>
  110. <if test="pointId != null">
  111. AND A.point_id = #{pointId ,jdbcType=BIGINT}
  112. </if>
  113. <if test="keywords != null and keywords != ''">
  114. AND A.event like "%"#{keywords}"%"
  115. </if>
  116. <if test="year != null">
  117. AND year(A.assess_time) = #{year ,jdbcType=BIGINT}
  118. </if>
  119. <if test="month != null">
  120. AND month(A.assess_time) = #{month ,jdbcType=BIGINT}
  121. </if>
  122. ORDER BY A.assess_time DESC
  123. </select>
  124. <insert id="create" parameterType="com.zhyc.xps.lylc.entity.AssessRecord">
  125. INSERT INTO hos_assess_record
  126. <trim prefix="(" suffix=")" suffixOverrides=",">
  127. <if test="ocId != null">
  128. oc_id,
  129. </if>
  130. <if test="groupId != null">
  131. group_id,
  132. </if>
  133. <if test="positionId != null">
  134. position_id,
  135. </if>
  136. <if test="accountId != null">
  137. account_id,
  138. </if>
  139. <if test="recordId != null">
  140. record_id,
  141. </if>
  142. <if test="event != null and event !=''">
  143. event,
  144. </if>
  145. <if test="targetOcId != null">
  146. target_oc_id,
  147. </if>
  148. <if test="storyId != null">
  149. story_id,
  150. </if>
  151. <if test="targetId != null">
  152. target_id,
  153. </if>
  154. <if test="itemId != null">
  155. item_id,
  156. </if>
  157. <if test="pointId != null">
  158. point_id,
  159. </if>
  160. <if test="score != null">
  161. score,
  162. </if>
  163. <if test="assessTime != null">
  164. assess_time,
  165. </if>
  166. <if test="remark != null and remark != ''">
  167. remark,
  168. </if>
  169. <if test="createdBy != null">
  170. created_by,
  171. </if>
  172. <if test="createdAt != null">
  173. created_at,
  174. </if>
  175. </trim>
  176. <trim prefix="values (" suffix=")" suffixOverrides=",">
  177. <if test="ocId != null">
  178. #{ocId,jdbcType=BIGINT},
  179. </if>
  180. <if test="groupId != null">
  181. #{groupId, jdbcType=BIGINT},
  182. </if>
  183. <if test="positionId != null">
  184. #{positionId, jdbcType=BIGINT},
  185. </if>
  186. <if test="accountId != null">
  187. #{accountId, jdbcType=BIGINT},
  188. </if>
  189. <if test="recordId != null">
  190. #{recordId, jdbcType=BIGINT},
  191. </if>
  192. <if test="event != null and event !=''">
  193. #{event, jdbcType=VARCHAR},
  194. </if>
  195. <if test="targetOcId != null">
  196. #{targetOcId, jdbcType=BIGINT},
  197. </if>
  198. <if test="storyId != null">
  199. #{storyId ,jdbcType=BIGINT},
  200. </if>
  201. <if test="targetId != null">
  202. #{targetId ,jdbcType=BIGINT},
  203. </if>
  204. <if test="itemId != null">
  205. #{itemId ,jdbcType=BIGINT},
  206. </if>
  207. <if test="pointId != null">
  208. #{pointId ,jdbcType=BIGINT},
  209. </if>
  210. <if test="score != null">
  211. #{score ,jdbcType=DOUBLE},
  212. </if>
  213. <if test="assessTime != null">
  214. #{assessTime ,jdbcType=TIMESTAMP},
  215. </if>
  216. <if test="remark != null and remark != ''">
  217. #{remark ,jdbcType=VARCHAR},
  218. </if>
  219. <if test="createdBy != null">
  220. #{createdBy ,jdbcType=BIGINT},
  221. </if>
  222. <if test="createdAt != null">
  223. #{createdAt ,jdbcType=TIMESTAMP},
  224. </if>
  225. </trim>
  226. </insert>
  227. <!--更新-->
  228. <update id="update" parameterType="com.zhyc.xps.lylc.entity.AssessRecord">
  229. UPDATE hos_assess_record
  230. <trim suffixOverrides=",">
  231. <set>
  232. <if test="groupId != null">
  233. group_id = #{groupId, jdbcType=BIGINT},
  234. </if>
  235. <if test="positionId != null">
  236. position_id = #{positionId, jdbcType=BIGINT},
  237. </if>
  238. <if test="accountId != null">
  239. account_id = #{accountId, jdbcType=BIGINT},
  240. </if>
  241. <if test="event != null and event !=''">
  242. event = #{event, jdbcType=VARCHAR},
  243. </if>
  244. <if test="targetOcId != null">
  245. target_oc_id = #{targetOcId, jdbcType=BIGINT},
  246. </if>
  247. <if test="storyId != null">
  248. story_id = #{storyId ,jdbcType=BIGINT},
  249. </if>
  250. <if test="targetId != null">
  251. target_id = #{targetId ,jdbcType=BIGINT},
  252. </if>
  253. <if test="itemId != null">
  254. item_id = #{itemId ,jdbcType=BIGINT},
  255. </if>
  256. <if test="pointId != null">
  257. point_id = #{pointId ,jdbcType=BIGINT},
  258. </if>
  259. <if test="score != null">
  260. score = #{score ,jdbcType=DOUBLE},
  261. </if>
  262. <if test="assessTime != null">
  263. assess_time = #{assessTime ,jdbcType=TIMESTAMP},
  264. </if>
  265. <if test="remark != null and remark != ''">
  266. remark = #{remark ,jdbcType=VARCHAR},
  267. </if>
  268. <if test="updatedBy != null ">
  269. updated_by = #{updatedBy ,jdbcType=BIGINT},
  270. </if>
  271. <if test="updatedAt != null">
  272. updated_at = #{updatedAt ,jdbcType=TIMESTAMP},
  273. </if>
  274. </set>
  275. </trim>
  276. WHERE 1 = 1
  277. <if test="ocId != null">
  278. AND oc_id = #{ocId ,jdbcType=BIGINT}
  279. </if>
  280. <if test="recordId != null">
  281. AND record_id = #{recordId ,jdbcType=BIGINT}
  282. </if>
  283. </update>
  284. <!--删除-->
  285. <delete id="delete" parameterType="java.util.Map">
  286. DELETE FROM hos_assess_record
  287. WHERE 1 = 1
  288. <if test="ocId != null">
  289. AND oc_id = #{ocId ,jdbcType=BIGINT}
  290. </if>
  291. <if test="year != null">
  292. AND year(assess_time) = #{year, jdbcType=BIGINT}
  293. </if>
  294. <if test="month != null">
  295. AND month(assess_time) = #{month, jdbcType=BIGINT}
  296. </if>
  297. <if test="recordId != null">
  298. AND record_id = #{recordId ,jdbcType=BIGINT}
  299. </if>
  300. <if test="storyId != null">
  301. AND story_id = #{storyId ,jdbcType=BIGINT}
  302. </if>
  303. <if test="targetId != null">
  304. AND target_id = #{targetId ,jdbcType=BIGINT}
  305. </if>
  306. <if test="itemId != null">
  307. AND item_id = #{itemId ,jdbcType=BIGINT}
  308. </if>
  309. <if test="pointId != null">
  310. AND point_id = #{pointId ,jdbcType=BIGINT}
  311. </if>
  312. </delete>
  313. </mapper>