IndicatorDao.xml 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  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. indicator_name,
  89. indicator_cede,
  90. unit,
  91. is_quantified,
  92. is_additional,
  93. des,
  94. bin_section,
  95. bin_stage,
  96. dept,
  97. company,
  98. enable,
  99. create_time,
  100. update_time,
  101. remark,
  102. order_num
  103. </sql>
  104. <insert id="insert">
  105. <selectKey keyProperty="id" resultType="String" order="BEFORE">
  106. <choose>
  107. <when test="id == null or id == ''">
  108. select get_next_id('indicator','') from dual
  109. </when>
  110. <otherwise>
  111. select #{id} from dual
  112. </otherwise>
  113. </choose>
  114. </selectKey>
  115. INSERT INTO indicator(
  116. <include refid="insertColumns"/>
  117. ) VALUES (
  118. #{indicatorName
  119. , jdbcType=VARCHAR
  120. },
  121. #{indicatorCede
  122. , jdbcType=VARCHAR
  123. },
  124. #{unit
  125. , jdbcType=VARCHAR
  126. },
  127. #{isQuantified
  128. , jdbcType=VARCHAR
  129. },
  130. #{isAdditional
  131. , jdbcType=VARCHAR
  132. },
  133. #{des
  134. , jdbcType=VARCHAR
  135. },
  136. #{binSection
  137. , jdbcType=VARCHAR
  138. },
  139. #{binStage
  140. , jdbcType=VARCHAR
  141. },
  142. #{dept
  143. , jdbcType=VARCHAR
  144. },
  145. #{company
  146. , jdbcType=VARCHAR
  147. },
  148. #{enable
  149. , jdbcType=VARCHAR
  150. },
  151. #{createTime, jdbcType=TIMESTAMP
  152. },
  153. #{updateTime, jdbcType=TIMESTAMP
  154. },
  155. #{remark
  156. , jdbcType=VARCHAR
  157. },
  158. #{orderNum
  159. , jdbcType=VARCHAR
  160. }
  161. )
  162. </insert>
  163. <insert id="insertList">
  164. INSERT INTO indicator(
  165. <include refid="insertColumns"/>
  166. ) select FFF.* from (
  167. <foreach collection="list" item="item" index="index" separator="UNION ALL" >
  168. select
  169. #{item.indicatorName, jdbcType=VARCHAR} as "indicatorName",
  170. #{item.indicatorCede, jdbcType=VARCHAR} as "indicatorCede",
  171. #{item.unit, jdbcType=VARCHAR} as "unit",
  172. #{item.isQuantified, jdbcType=VARCHAR} as "isQuantified",
  173. #{item.isAdditional, jdbcType=VARCHAR} as "isAdditional",
  174. #{item.des, jdbcType=VARCHAR} as "des",
  175. #{item.binSection, jdbcType=VARCHAR} as "binSection",
  176. #{item.binStage, jdbcType=VARCHAR} as "binStage",
  177. #{item.dept, jdbcType=VARCHAR} as "dept",
  178. #{item.company, jdbcType=VARCHAR} as "company",
  179. #{item.enable, jdbcType=VARCHAR} as "enable",
  180. #{item.createTime, jdbcType=TIMESTAMP} as "createTime",
  181. #{item.updateTime, jdbcType=TIMESTAMP} as "updateTime",
  182. #{item.remark, jdbcType=VARCHAR} as "remark",
  183. #{item.orderNum, jdbcType=VARCHAR} as "orderNum"
  184. from dual
  185. </foreach>
  186. ) FFF
  187. </insert>
  188. <update id="update">
  189. UPDATE indicator SET
  190. id = #{id},
  191. indicator_name = #{indicatorName},
  192. indicator_cede = #{indicatorCede},
  193. unit = #{unit},
  194. is_quantified = #{isQuantified},
  195. is_additional = #{isAdditional},
  196. des = #{des},
  197. bin_section = #{binSection},
  198. bin_stage = #{binStage},
  199. dept = #{dept},
  200. company = #{company},
  201. enable = #{enable},
  202. create_time = #{createTime},
  203. update_time = #{updateTime},
  204. update_by = #{updateBy},
  205. remark = #{remark},
  206. order_num = #{orderNum}
  207. WHERE id = #{id, jdbcType=VARCHAR}
  208. </update>
  209. <update id="delete">
  210. DELETE FROM public.indicator
  211. WHERE
  212. <choose>
  213. <when test="id != null and id != ''">
  214. id = #{id, jdbcType=VARCHAR}
  215. </when>
  216. <otherwise>
  217. </otherwise>
  218. </choose>
  219. </update>
  220. </mapper>