HlClassScoreMapper.xml 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.jjt.hl.mapper.HlClassScoreMapper">
  6. <resultMap type="HlClassScore" id="HlClassScoreResult">
  7. <result property="scoreClassId" column="SCORE_CLASS_ID"/>
  8. <result property="hlScoreId" column="HL_SCORE_ID"/>
  9. <result property="modelId" column="MODEL_ID"/>
  10. <result property="objType" column="OBJ_TYPE"/>
  11. <result property="scoreType" column="SCORE_TYPE"/>
  12. <result property="hlScore" column="HL_SCORE"/>
  13. <result property="loseScore" column="LOSE_SCORE"/>
  14. <result property="score" column="SCORE"/>
  15. <result property="createBy" column="CREATE_BY"/>
  16. <result property="createTime" column="CREATE_TIME"/>
  17. <result property="updateBy" column="UPDATE_BY"/>
  18. <result property="updateTime" column="UPDATE_TIME"/>
  19. <result property="remark" column="REMARK"/>
  20. <collection property="hlObjList" javaType="java.util.List" resultMap="hlObjResult"/>
  21. </resultMap>
  22. <resultMap id="hlObjResult" type="HlObj">
  23. <result property="hlObjId" column="HL_OBJ_ID"/>
  24. <result property="hlClassId" column="HL_CLASS_ID"/>
  25. <result property="objId" column="OBJ_ID"/>
  26. <result property="objName" column="OBJ_NAME"/>
  27. <result property="objType" column="OBJ_TYPE"/>
  28. </resultMap>
  29. <sql id="selectHlClassScoreVo">
  30. select *
  31. from (SELECT A.SCORE_CLASS_ID,
  32. A.HL_SCORE_ID,
  33. A.MODEL_ID,
  34. A.OBJ_TYPE,
  35. A.SCORE_TYPE,
  36. A.HL_SCORE,
  37. A.LOSE_SCORE,
  38. A.SCORE,
  39. A.CREATE_BY,
  40. A.CREATE_TIME,
  41. A.UPDATE_BY,
  42. A.UPDATE_TIME,
  43. A.REMARK
  44. b.hl_obj_id,
  45. b.OBJ_ID,
  46. b.OBJ_NAME
  47. from hl_class a
  48. left JOIN (SELECT a.*, b.OBJ_NAME, b.OBJ_TYPE
  49. FROM hl_obj a,
  50. biz_obj b
  51. WHERE a.obj_id = b.obj_id) b ON a.hl_class_id = b.hl_class_id and a.obj_type=b.obj_type) t
  52. </sql>
  53. <select id="selectHlClassScoreList" parameterType="HlClassScore" resultMap="HlClassScoreResult">
  54. <include refid="selectHlClassScoreVo"/>
  55. <where>
  56. <if test="hlScoreId != null ">
  57. and HL_SCORE_ID = #{hlScoreId}
  58. </if>
  59. <if test="modelId != null ">
  60. and MODEL_ID = #{modelId}
  61. </if>
  62. <if test="objType != null and objType != ''">
  63. and OBJ_TYPE = #{objType}
  64. </if>
  65. <if test="scoreType != null and scoreType != ''">
  66. and SCORE_TYPE = #{scoreType}
  67. </if>
  68. <if test="hlScore != null ">
  69. and HL_SCORE = #{hlScore}
  70. </if>
  71. <if test="loseScore != null ">
  72. and LOSE_SCORE = #{loseScore}
  73. </if>
  74. <if test="score != null ">
  75. and SCORE = #{score}
  76. </if>
  77. <if test="createBy != null and createBy != ''">
  78. and CREATE_BY = #{createBy}
  79. </if>
  80. <if test="createTime != null ">
  81. and CREATE_TIME = #{createTime}
  82. </if>
  83. <if test="updateBy != null and updateBy != ''">
  84. and UPDATE_BY = #{updateBy}
  85. </if>
  86. <if test="updateTime != null ">
  87. and UPDATE_TIME = #{updateTime}
  88. </if>
  89. <if test="remark != null and remark != ''">
  90. and REMARK = #{remark}
  91. </if>
  92. </where>
  93. </select>
  94. <select id="selectHlClassScoreByScoreClassId" parameterType="Long"
  95. resultMap="HlClassScoreResult">
  96. <include refid="selectHlClassScoreVo"/>
  97. where SCORE_CLASS_ID = #{scoreClassId}
  98. </select>
  99. <insert id="insertHlClassScore" parameterType="HlClassScore" useGeneratedKeys="true"
  100. keyProperty="scoreClassId">
  101. insert into hl_class_score
  102. <trim prefix="(" suffix=")" suffixOverrides=",">
  103. <if test="hlScoreId != null">HL_SCORE_ID,
  104. </if>
  105. <if test="modelId != null">MODEL_ID,
  106. </if>
  107. <if test="objType != null">OBJ_TYPE,
  108. </if>
  109. <if test="scoreType != null">SCORE_TYPE,
  110. </if>
  111. <if test="hlScore != null">HL_SCORE,
  112. </if>
  113. <if test="loseScore != null">LOSE_SCORE,
  114. </if>
  115. <if test="score != null">SCORE,
  116. </if>
  117. <if test="createBy != null">CREATE_BY,
  118. </if>
  119. <if test="createTime != null">CREATE_TIME,
  120. </if>
  121. <if test="updateBy != null">UPDATE_BY,
  122. </if>
  123. <if test="updateTime != null">UPDATE_TIME,
  124. </if>
  125. <if test="remark != null">REMARK,
  126. </if>
  127. </trim>
  128. <trim prefix="values (" suffix=")" suffixOverrides=",">
  129. <if test="hlScoreId != null">#{hlScoreId},
  130. </if>
  131. <if test="modelId != null">#{modelId},
  132. </if>
  133. <if test="objType != null">#{objType},
  134. </if>
  135. <if test="scoreType != null">#{scoreType},
  136. </if>
  137. <if test="hlScore != null">#{hlScore},
  138. </if>
  139. <if test="loseScore != null">#{loseScore},
  140. </if>
  141. <if test="score != null">#{score},
  142. </if>
  143. <if test="createBy != null">#{createBy},
  144. </if>
  145. <if test="createTime != null">#{createTime},
  146. </if>
  147. <if test="updateBy != null">#{updateBy},
  148. </if>
  149. <if test="updateTime != null">#{updateTime},
  150. </if>
  151. <if test="remark != null">#{remark},
  152. </if>
  153. </trim>
  154. </insert>
  155. <update id="updateHlClassScore" parameterType="HlClassScore">
  156. update hl_class_score
  157. <trim prefix="SET" suffixOverrides=",">
  158. <if test="hlScoreId != null">HL_SCORE_ID =
  159. #{hlScoreId},
  160. </if>
  161. <if test="modelId != null">MODEL_ID =
  162. #{modelId},
  163. </if>
  164. <if test="objType != null">OBJ_TYPE =
  165. #{objType},
  166. </if>
  167. <if test="scoreType != null">SCORE_TYPE =
  168. #{scoreType},
  169. </if>
  170. <if test="hlScore != null">HL_SCORE =
  171. #{hlScore},
  172. </if>
  173. <if test="loseScore != null">LOSE_SCORE =
  174. #{loseScore},
  175. </if>
  176. <if test="score != null">SCORE =
  177. #{score},
  178. </if>
  179. <if test="createBy != null">CREATE_BY =
  180. #{createBy},
  181. </if>
  182. <if test="createTime != null">CREATE_TIME =
  183. #{createTime},
  184. </if>
  185. <if test="updateBy != null">UPDATE_BY =
  186. #{updateBy},
  187. </if>
  188. <if test="updateTime != null">UPDATE_TIME =
  189. #{updateTime},
  190. </if>
  191. <if test="remark != null">REMARK =
  192. #{remark},
  193. </if>
  194. </trim>
  195. where SCORE_CLASS_ID = #{scoreClassId}
  196. </update>
  197. <delete id="deleteHlClassScoreByScoreClassId" parameterType="Long">
  198. delete
  199. from hl_class_score
  200. where SCORE_CLASS_ID = #{scoreClassId}
  201. </delete>
  202. <delete id="deleteHlClassScoreByScoreClassIds" parameterType="String">
  203. delete from hl_class_score where SCORE_CLASS_ID in
  204. <foreach item="scoreClassId" collection="array" open="(" separator="," close=")">
  205. #{scoreClassId}
  206. </foreach>
  207. </delete>
  208. </mapper>