IndicatorDao.xml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  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.ims.eval.dao.IndicatorDao">
  4. <sql id="indicatorColumns">
  5. a.id AS "id",
  6. a.indicator_name AS "indicatorName",
  7. a.indicator_cede AS "indicatorCede",
  8. a.unit AS "unit",
  9. a.is_quantified AS "isQuantified",
  10. a.is_additional AS "isAdditional",
  11. a.des AS "des",
  12. a.bin_section AS "binSection",
  13. a.bin_stage AS "binStage",
  14. a.dept AS "dept",
  15. a.company AS "company",
  16. a.enable AS "enable",
  17. a.create_time AS "createTime",
  18. a.update_time AS "updateTime",
  19. a.create_by AS "createBy",
  20. a.update_by AS "updateBy",
  21. a.remark AS "remark",
  22. a.order_num AS "orderNum"
  23. </sql>
  24. <sql id="whereStr">
  25. 1=1
  26. <!-- 快速定位 -->
  27. <if test="sqlMap.key != null and sqlMap.key != ''">
  28. AND (
  29. )
  30. </if>
  31. <!-- 高级查询dataFilter -->
  32. <if test="sqlMap.df != null and sqlMap.df != ''">
  33. AND ( ${sqlMap.df} )
  34. </if>
  35. <!-- 默认查询baseFilter -->
  36. <if test="sqlMap.bf != null and sqlMap.bf != ''">
  37. AND ( ${sqlMap.bf} )
  38. </if>
  39. <!-- 基本Query查询 -->
  40. <if test="sqlMap.baseQuery != null and sqlMap.baseQuery != ''">
  41. AND ( ${sqlMap.baseQuery} )
  42. </if>
  43. <!-- 特定Query查询 -->
  44. <if test="sqlMap.specQuery != null and sqlMap.specQuery != ''">
  45. AND ( ${sqlMap.specQuery} )
  46. </if>
  47. <if test="sqlMap.dsf != null and sqlMap.dsf != ''">
  48. AND (${sqlMap.dsf})
  49. </if>
  50. </sql>
  51. <select id="get" resultType="Indicator">
  52. SELECT
  53. <include refid="indicatorColumns"/>
  54. FROM public.{table.name} a
  55. WHERE a.id = #{id}
  56. </select>
  57. <select id="findList" resultType="Indicator">
  58. SELECT
  59. <include refid="indicatorColumns"/>
  60. FROM public.indicator a
  61. <where>
  62. <include refid="whereStr"/>
  63. </where>
  64. <choose>
  65. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  66. ORDER BY ${page.orderBy}
  67. </when>
  68. <otherwise>
  69. </otherwise>
  70. </choose>
  71. </select>
  72. <select id="findAllList" resultType="Indicator">
  73. SELECT
  74. <include refid="indicatorColumns"/>
  75. FROM public.indicator a
  76. <where>
  77. <include refid="whereStr"/>
  78. </where>
  79. <choose>
  80. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  81. ORDER BY ${page.orderBy}
  82. </when>
  83. <otherwise>
  84. </otherwise>
  85. </choose>
  86. </select>
  87. <sql id="insertColumns">
  88. id,
  89. indicator_name,
  90. indicator_cede,
  91. unit,
  92. is_quantified,
  93. is_additional,
  94. des,
  95. bin_section,
  96. bin_stage,
  97. dept,
  98. company,
  99. enable,
  100. create_time,
  101. update_time,
  102. remark,
  103. order_num
  104. </sql>
  105. <insert id="insert">
  106. <selectKey keyProperty="id" resultType="String" order="BEFORE">
  107. <choose>
  108. <when test="id == null or id == ''">
  109. select get_next_id('indicator','') from dual
  110. </when>
  111. <otherwise>
  112. select #{id} from dual
  113. </otherwise>
  114. </choose>
  115. </selectKey>
  116. INSERT INTO indicator(
  117. <include refid="insertColumns"/>
  118. ) VALUES (
  119. #{id
  120. , jdbcType=VARCHAR
  121. },
  122. #{indicatorName
  123. , jdbcType=VARCHAR
  124. },
  125. #{indicatorCede
  126. , jdbcType=VARCHAR
  127. },
  128. #{unit
  129. , jdbcType=VARCHAR
  130. },
  131. #{isQuantified
  132. , jdbcType=VARCHAR
  133. },
  134. #{isAdditional
  135. , jdbcType=VARCHAR
  136. },
  137. #{des
  138. , jdbcType=VARCHAR
  139. },
  140. #{binSection
  141. , jdbcType=VARCHAR
  142. },
  143. #{binStage
  144. , jdbcType=VARCHAR
  145. },
  146. #{dept
  147. , jdbcType=VARCHAR
  148. },
  149. #{company
  150. , jdbcType=VARCHAR
  151. },
  152. #{enable
  153. },
  154. #{createTime
  155. },
  156. #{updateTime
  157. },
  158. #{remark
  159. , jdbcType=VARCHAR
  160. },
  161. #{orderNum
  162. }
  163. )
  164. </insert>
  165. <insert id="insertList">
  166. INSERT INTO indicator(
  167. <include refid="insertColumns"/>
  168. ) select FFF.* from (
  169. <foreach collection="list" item="item" index="index" separator="UNION ALL" >
  170. select
  171. #{item.id, jdbcType=VARCHAR} as "id",
  172. #{item.indicatorName, jdbcType=VARCHAR} as "indicatorName",
  173. #{item.indicatorCede, jdbcType=VARCHAR} as "indicatorCede",
  174. #{item.unit, jdbcType=VARCHAR} as "unit",
  175. #{item.isQuantified, jdbcType=VARCHAR} as "isQuantified",
  176. #{item.isAdditional, jdbcType=VARCHAR} as "isAdditional",
  177. #{item.des, jdbcType=VARCHAR} as "des",
  178. #{item.binSection, jdbcType=VARCHAR} as "binSection",
  179. #{item.binStage, jdbcType=VARCHAR} as "binStage",
  180. #{item.dept, jdbcType=VARCHAR} as "dept",
  181. #{item.company, jdbcType=VARCHAR} as "company",
  182. #{item.enable} as "enable",
  183. #{item.createTime} as "createTime",
  184. #{item.updateTime} as "updateTime",
  185. #{item.remark, jdbcType=VARCHAR} as "remark",
  186. #{item.orderNum} as "orderNum"
  187. from dual
  188. </foreach>
  189. ) FFF
  190. </insert>
  191. <update id="update">
  192. UPDATE indicator SET
  193. id = #{id},
  194. indicator_name = #{indicatorName},
  195. indicator_cede = #{indicatorCede},
  196. unit = #{unit},
  197. is_quantified = #{isQuantified},
  198. is_additional = #{isAdditional},
  199. des = #{des},
  200. bin_section = #{binSection},
  201. bin_stage = #{binStage},
  202. dept = #{dept},
  203. company = #{company},
  204. enable = #{enable},
  205. create_time = #{createTime},
  206. update_time = #{updateTime},
  207. update_by = #{updateBy},
  208. remark = #{remark},
  209. order_num = #{orderNum}
  210. WHERE id = #{id, jdbcType=VARCHAR}
  211. </update>
  212. <update id="delete">
  213. DELETE FROM public.indicator
  214. WHERE
  215. <choose>
  216. <when test="id != null and id != ''">
  217. id = #{id, jdbcType=VARCHAR}
  218. </when>
  219. <otherwise>
  220. </otherwise>
  221. </choose>
  222. </update>
  223. </mapper>