BizModelMapper.xml 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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.biz.mapper.BizModelMapper">
  6. <resultMap type="BizModel" id="BizModelResult">
  7. <result property="modelId" column="MODEL_ID"/>
  8. <result property="modelCode" column="MODEL_CODE"/>
  9. <result property="modelName" column="MODEL_NAME"/>
  10. <result property="modelScore" column="MODEl_SCORE"/>
  11. <result property="modelType" column="MODEL_TYPE"/>
  12. <result property="createBy" column="CREATE_BY"/>
  13. <result property="createTime" column="CREATE_TIME"/>
  14. <result property="updateBy" column="UPDATE_BY"/>
  15. <result property="updateTime" column="UPDATE_TIME"/>
  16. <result property="remark" column="REMARK"/>
  17. </resultMap>
  18. <sql id="selectBizModelVo">
  19. select MODEL_ID,
  20. MODEL_CODE,
  21. MODEL_NAME,
  22. MODEl_SCORE,
  23. MODEL_TYPE,
  24. CREATE_BY,
  25. CREATE_TIME,
  26. UPDATE_BY,
  27. UPDATE_TIME,
  28. REMARK
  29. from biz_model
  30. </sql>
  31. <select id="selectBizModelList" parameterType="BizModel" resultMap="BizModelResult">
  32. <include refid="selectBizModelVo"/>
  33. <where>
  34. <if test="modelCode != null and modelCode != ''">
  35. and MODEL_CODE = #{modelCode}
  36. </if>
  37. <if test="modelName != null and modelName != ''">
  38. and MODEL_NAME like concat('%', #{modelName}, '%')
  39. </if>
  40. <if test="modelScore != null ">
  41. and MODEl_SCORE = #{modelScore}
  42. </if>
  43. <if test="modelType != null and modelType != ''">
  44. and MODEL_TYPE = #{modelType}
  45. </if>
  46. <if test="createBy != null and createBy != ''">
  47. and CREATE_BY = #{createBy}
  48. </if>
  49. <if test="createTime != null ">
  50. and CREATE_TIME = #{createTime}
  51. </if>
  52. <if test="updateBy != null and updateBy != ''">
  53. and UPDATE_BY = #{updateBy}
  54. </if>
  55. <if test="updateTime != null ">
  56. and UPDATE_TIME = #{updateTime}
  57. </if>
  58. <if test="remark != null and remark != ''">
  59. and REMARK = #{remark}
  60. </if>
  61. </where>
  62. </select>
  63. <select id="selectBizModelByModelId" parameterType="Long"
  64. resultMap="BizModelResult">
  65. <include refid="selectBizModelVo"/>
  66. where MODEL_ID = #{modelId}
  67. </select>
  68. <select id="selectObjList" resultType="com.jjt.biz.domain.BizObj">
  69. select *
  70. from biz_obj
  71. where obj_id not in (select obj_id from biz_model_detail where model_id = #{modelId})
  72. </select>
  73. <select id="selectBizModelMetricsList" resultType="com.jjt.biz.domain.BizObjMetrics">
  74. SELECT *
  75. from biz_obj_metrics
  76. WHERE obj_id IN (SELECT obj_id FROM biz_model_detail WHERE model_id = #{modelId})
  77. </select>
  78. <insert id="insertBizModel" parameterType="BizModel" useGeneratedKeys="true"
  79. keyProperty="modelId">
  80. insert into biz_model
  81. <trim prefix="(" suffix=")" suffixOverrides=",">
  82. <if test="modelCode != null">MODEL_CODE,
  83. </if>
  84. <if test="modelName != null">MODEL_NAME,
  85. </if>
  86. <if test="modelScore != null">MODEl_SCORE,
  87. </if>
  88. <if test="modelType != null">MODEL_TYPE,
  89. </if>
  90. <if test="createBy != null">CREATE_BY,
  91. </if>
  92. <if test="createTime != null">CREATE_TIME,
  93. </if>
  94. <if test="updateBy != null">UPDATE_BY,
  95. </if>
  96. <if test="updateTime != null">UPDATE_TIME,
  97. </if>
  98. <if test="remark != null">REMARK,
  99. </if>
  100. </trim>
  101. <trim prefix="values (" suffix=")" suffixOverrides=",">
  102. <if test="modelCode != null">#{modelCode},
  103. </if>
  104. <if test="modelName != null">#{modelName},
  105. </if>
  106. <if test="modelScore != null">#{modelScore},
  107. </if>
  108. <if test="modelType != null">#{modelType},
  109. </if>
  110. <if test="createBy != null">#{createBy},
  111. </if>
  112. <if test="createTime != null">#{createTime},
  113. </if>
  114. <if test="updateBy != null">#{updateBy},
  115. </if>
  116. <if test="updateTime != null">#{updateTime},
  117. </if>
  118. <if test="remark != null">#{remark},
  119. </if>
  120. </trim>
  121. </insert>
  122. <update id="updateBizModel" parameterType="BizModel">
  123. update biz_model
  124. <trim prefix="SET" suffixOverrides=",">
  125. <if test="modelCode != null">MODEL_CODE =
  126. #{modelCode},
  127. </if>
  128. <if test="modelName != null">MODEL_NAME =
  129. #{modelName},
  130. </if>
  131. <if test="modelScore != null">MODEl_SCORE =
  132. #{modelScore},
  133. </if>
  134. <if test="modelType != null">MODEL_TYPE =
  135. #{modelType},
  136. </if>
  137. <if test="createBy != null">CREATE_BY =
  138. #{createBy},
  139. </if>
  140. <if test="createTime != null">CREATE_TIME =
  141. #{createTime},
  142. </if>
  143. <if test="updateBy != null">UPDATE_BY =
  144. #{updateBy},
  145. </if>
  146. <if test="updateTime != null">UPDATE_TIME =
  147. #{updateTime},
  148. </if>
  149. <if test="remark != null">REMARK =
  150. #{remark},
  151. </if>
  152. </trim>
  153. where MODEL_ID = #{modelId}
  154. </update>
  155. <delete id="deleteBizModelByModelId" parameterType="Long">
  156. delete
  157. from biz_model
  158. where MODEL_ID = #{modelId}
  159. </delete>
  160. <delete id="deleteBizModelByModelIds" parameterType="String">
  161. delete from biz_model where MODEL_ID in
  162. <foreach item="modelId" collection="array" open="(" separator="," close=")">
  163. #{modelId}
  164. </foreach>
  165. </delete>
  166. </mapper>