TemplateOption.xml 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  4. <!-- namespace必须指向DAO接口 -->
  5. <mapper namespace="com.jpsoft.employment.modules.base.dao.TemplateOptionDAO">
  6. <resultMap id="TemplateOptionMap" type="com.jpsoft.employment.modules.base.entity.TemplateOption">
  7. <id property="id" column="id_"/>
  8. <result property="templateId" column="template_id"/>
  9. <result property="serialNum" column="serial_num"/>
  10. <result property="name" column="name_"/>
  11. <result property="budgetRevenue" column="budget_revenue"/>
  12. <result property="index" column="index_"/>
  13. <result property="createTime" column="create_time"/>
  14. <result property="updateTime" column="update_time"/>
  15. <result property="createBy" column="create_by"/>
  16. <result property="updateBy" column="update_by"/>
  17. <result property="delFlag" column="del_flag"/>
  18. <result property="departmentIds" column="department_ids"/>
  19. <result property="isSum" column="is_sum"/>
  20. <result property="incomeTimeRange" column="income_time_range" />
  21. <result property="incomeType" column="income_type" />
  22. <result property="endDate" column="end_date" />
  23. <result property="chargePerson" column="charge_person" />
  24. <result property="curBudgetRevenue" column="cur_budget_revenue" />
  25. <result property="isCountSummary" column="is_count_summary" />
  26. </resultMap>
  27. <insert id="insert" parameterType="com.jpsoft.employment.modules.base.entity.TemplateOption">
  28. <!--
  29. <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
  30. select sys_guid() from dual
  31. </selectKey>
  32. -->
  33. <![CDATA[
  34. insert into base_template_option
  35. (id_,template_id,serial_num,name_,budget_revenue,index_,create_time,update_time,
  36. create_by,update_by,del_flag,department_ids,is_sum,income_time_range,income_type,
  37. end_date,charge_person,cur_budget_revenue,is_count_summary)
  38. values
  39. (
  40. #{id,jdbcType=VARCHAR}
  41. ,#{templateId,jdbcType=VARCHAR}
  42. ,#{serialNum,jdbcType=VARCHAR}
  43. ,#{name,jdbcType=VARCHAR}
  44. ,#{budgetRevenue,jdbcType=NUMERIC}
  45. ,#{index,jdbcType= NUMERIC }
  46. ,#{createTime,jdbcType= TIMESTAMP }
  47. ,#{updateTime,jdbcType= TIMESTAMP }
  48. ,#{createBy,jdbcType=VARCHAR}
  49. ,#{updateBy,jdbcType=VARCHAR}
  50. ,#{delFlag,jdbcType= NUMERIC }
  51. ,#{departmentIds,jdbcType=VARCHAR}
  52. ,#{isSum,jdbcType= NUMERIC }
  53. ,#{incomeTimeRange,jdbcType=VARCHAR}
  54. ,#{incomeType,jdbcType=VARCHAR}
  55. ,#{endDate,jdbcType= TIMESTAMP }
  56. ,#{chargePerson,jdbcType=VARCHAR}
  57. ,#{curBudgetRevenue,jdbcType= NUMERIC }
  58. ,#{isCountSummary,jdbcType= NUMERIC }
  59. )
  60. ]]>
  61. </insert>
  62. <delete id="delete" parameterType="string">
  63. delete from base_template_option where id_=#{id,jdbcType=VARCHAR}
  64. </delete>
  65. <update id="update" parameterType="com.jpsoft.employment.modules.base.entity.TemplateOption">
  66. update base_template_option
  67. <set>
  68. <if test="templateId!=null">
  69. template_id=#{templateId,jdbcType=VARCHAR},
  70. </if>
  71. <if test="serialNum!=null">
  72. serial_num=#{serialNum,jdbcType=VARCHAR},
  73. </if>
  74. <if test="name!=null">
  75. name_=#{name,jdbcType=VARCHAR},
  76. </if>
  77. <if test="budgetRevenue!=null">
  78. budget_revenue=#{budgetRevenue,jdbcType=NUMERIC},
  79. </if>
  80. <if test="index!=null">
  81. index_=#{index,jdbcType= NUMERIC },
  82. </if>
  83. <if test="createTime!=null">
  84. create_time=#{createTime,jdbcType= TIMESTAMP },
  85. </if>
  86. <if test="updateTime!=null">
  87. update_time=#{updateTime,jdbcType= TIMESTAMP },
  88. </if>
  89. <if test="createBy!=null">
  90. create_by=#{createBy,jdbcType=VARCHAR},
  91. </if>
  92. <if test="updateBy!=null">
  93. update_by=#{updateBy,jdbcType=VARCHAR},
  94. </if>
  95. <if test="delFlag!=null">
  96. del_flag=#{delFlag,jdbcType= NUMERIC },
  97. </if>
  98. <if test="departmentIds!=null">
  99. department_ids=#{departmentIds,jdbcType=VARCHAR},
  100. </if>
  101. <if test="isSum!=null">
  102. is_sum=#{isSum,jdbcType= NUMERIC },
  103. </if>
  104. <if test="incomeTimeRange!=null">
  105. income_time_range=#{incomeTimeRange,jdbcType=VARCHAR},
  106. </if>
  107. <if test="incomeType!=null">
  108. income_type=#{incomeType,jdbcType=VARCHAR},
  109. </if>
  110. <if test="endDate!=null">
  111. end_date=#{endDate,jdbcType= TIMESTAMP },
  112. </if>
  113. <if test="chargePerson!=null">
  114. charge_person=#{chargePerson,jdbcType=VARCHAR},
  115. </if>
  116. <if test="curBudgetRevenue!=null">
  117. cur_budget_revenue=#{curBudgetRevenue,jdbcType= NUMERIC },
  118. </if>
  119. <if test="isCountSummary!=null">
  120. is_count_summary=#{isCountSummary,jdbcType= NUMERIC },
  121. </if>
  122. </set>
  123. where id_=#{id}
  124. </update>
  125. <select id="get" parameterType="string" resultMap="TemplateOptionMap">
  126. select * from base_template_option where id_=#{0}
  127. </select>
  128. <select id="exist" parameterType="string" resultType="int">
  129. select count(*) from base_template_option where id_=#{0}
  130. </select>
  131. <select id="list" resultMap="TemplateOptionMap">
  132. select * from base_template_option
  133. </select>
  134. <select id="findLastIndexByTemplateId" resultType="java.lang.String">
  135. select index_ from base_template_option
  136. where del_flag=false
  137. and template_id=#{templateId}
  138. order by index_ desc
  139. limit 1
  140. </select>
  141. <select id="findByTemplateId" resultMap="TemplateOptionMap">
  142. select * from base_template_option
  143. where del_flag=false
  144. and template_id=#{templateId}
  145. order by index_ asc
  146. </select>
  147. <select id="findByTemplateIdAndLen" resultMap="TemplateOptionMap">
  148. select * from base_template_option
  149. where del_flag=false
  150. and template_id=#{templateId}
  151. and length(serial_num)=#{length}
  152. order by index_ asc
  153. </select>
  154. <select id="search" parameterType="hashmap" resultMap="TemplateOptionMap">
  155. <![CDATA[
  156. select * from base_template_option
  157. ]]>
  158. <where>
  159. del_flag=false
  160. <if test="searchParams.id != null">
  161. and ID_ like #{searchParams.id}
  162. </if>
  163. </where>
  164. <foreach item="sort" collection="sortList" open="order by" separator=",">
  165. ${sort.name} ${sort.order}
  166. </foreach>
  167. </select>
  168. <select id="findByConditions" parameterType="hashmap" resultMap="TemplateOptionMap">
  169. <![CDATA[
  170. select * from base_template_option
  171. ]]>
  172. <where>
  173. del_flag=false
  174. <if test="searchParams.templateId != null">
  175. and template_id = #{searchParams.templateId}
  176. </if>
  177. <if test="searchParams.departmentId != null">
  178. and department_ids like #{searchParams.departmentId}
  179. </if>
  180. </where>
  181. order by index_ asc
  182. </select>
  183. <select id="findByTemplateIdAndNum" resultMap="TemplateOptionMap">
  184. SELECT * FROM base_template_option
  185. WHERE del_flag=false and template_id=#{templateId}
  186. and serial_num LIKE #{serialNum}
  187. and length(serial_num)=#{length}
  188. order by index_ asc
  189. </select>
  190. </mapper>