PatentCostMapper.xml 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  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.goafanti.common.dao.PatentCostMapper">
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.PatentCost">
  5. <id column="id" property="id" jdbcType="VARCHAR" />
  6. <result column="pid" property="pid" jdbcType="VARCHAR" />
  7. <result column="annual_fee" property="annualFee" jdbcType="INTEGER" />
  8. <result column="annual_fee_state" property="annualFeeState"
  9. jdbcType="INTEGER" />
  10. <result column="application_fee" property="applicationFee"
  11. jdbcType="INTEGER" />
  12. <result column="trial_fee" property="trialFee" jdbcType="INTEGER" />
  13. <result column="printing_fee" property="printingFee" jdbcType="INTEGER" />
  14. <result column="funds" property="funds" jdbcType="INTEGER" />
  15. <result column="reimbursement" property="reimbursement"
  16. jdbcType="INTEGER" />
  17. <result column="payment_state" property="paymentState"
  18. jdbcType="INTEGER" />
  19. </resultMap>
  20. <sql id="Base_Column_List">
  21. id, pid, annual_fee, annual_fee_state, application_fee, trial_fee,
  22. printing_fee,
  23. funds, reimbursement, payment_state
  24. </sql>
  25. <select id="selectByPrimaryKey" resultMap="BaseResultMap"
  26. parameterType="java.lang.String">
  27. select
  28. <include refid="Base_Column_List" />
  29. from patent_cost
  30. where id = #{id,jdbcType=VARCHAR}
  31. </select>
  32. <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
  33. delete from patent_cost
  34. where id = #{id,jdbcType=VARCHAR}
  35. </delete>
  36. <insert id="insert" parameterType="com.goafanti.common.model.PatentCost">
  37. insert into patent_cost (id, pid, annual_fee,
  38. annual_fee_state, application_fee, trial_fee,
  39. printing_fee, funds, reimbursement,
  40. payment_state)
  41. values (#{id,jdbcType=VARCHAR}, #{pid,jdbcType=VARCHAR},
  42. #{annualFee,jdbcType=INTEGER},
  43. #{annualFeeState,jdbcType=INTEGER}, #{applicationFee,jdbcType=INTEGER}, #{trialFee,jdbcType=INTEGER},
  44. #{printingFee,jdbcType=INTEGER}, #{funds,jdbcType=INTEGER},
  45. #{reimbursement,jdbcType=INTEGER},
  46. #{paymentState,jdbcType=INTEGER})
  47. </insert>
  48. <insert id="insertSelective" parameterType="com.goafanti.common.model.PatentCost">
  49. insert into patent_cost
  50. <trim prefix="(" suffix=")" suffixOverrides=",">
  51. <if test="id != null">
  52. id,
  53. </if>
  54. <if test="pid != null">
  55. pid,
  56. </if>
  57. <if test="annualFee != null">
  58. annual_fee,
  59. </if>
  60. <if test="annualFeeState != null">
  61. annual_fee_state,
  62. </if>
  63. <if test="applicationFee != null">
  64. application_fee,
  65. </if>
  66. <if test="trialFee != null">
  67. trial_fee,
  68. </if>
  69. <if test="printingFee != null">
  70. printing_fee,
  71. </if>
  72. <if test="funds != null">
  73. funds,
  74. </if>
  75. <if test="reimbursement != null">
  76. reimbursement,
  77. </if>
  78. <if test="paymentState != null">
  79. payment_state,
  80. </if>
  81. </trim>
  82. <trim prefix="values (" suffix=")" suffixOverrides=",">
  83. <if test="id != null">
  84. #{id,jdbcType=VARCHAR},
  85. </if>
  86. <if test="pid != null">
  87. #{pid,jdbcType=VARCHAR},
  88. </if>
  89. <if test="annualFee != null">
  90. #{annualFee,jdbcType=INTEGER},
  91. </if>
  92. <if test="annualFeeState != null">
  93. #{annualFeeState,jdbcType=INTEGER},
  94. </if>
  95. <if test="applicationFee != null">
  96. #{applicationFee,jdbcType=INTEGER},
  97. </if>
  98. <if test="trialFee != null">
  99. #{trialFee,jdbcType=INTEGER},
  100. </if>
  101. <if test="printingFee != null">
  102. #{printingFee,jdbcType=INTEGER},
  103. </if>
  104. <if test="funds != null">
  105. #{funds,jdbcType=INTEGER},
  106. </if>
  107. <if test="reimbursement != null">
  108. #{reimbursement,jdbcType=INTEGER},
  109. </if>
  110. <if test="paymentState != null">
  111. #{paymentState,jdbcType=INTEGER},
  112. </if>
  113. </trim>
  114. </insert>
  115. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.PatentCost">
  116. update patent_cost
  117. <set>
  118. <if test="pid != null">
  119. pid = #{pid,jdbcType=VARCHAR},
  120. </if>
  121. <if test="annualFee != null">
  122. annual_fee = #{annualFee,jdbcType=INTEGER},
  123. </if>
  124. <if test="annualFeeState != null">
  125. annual_fee_state = #{annualFeeState,jdbcType=INTEGER},
  126. </if>
  127. <if test="applicationFee != null">
  128. application_fee = #{applicationFee,jdbcType=INTEGER},
  129. </if>
  130. <if test="trialFee != null">
  131. trial_fee = #{trialFee,jdbcType=INTEGER},
  132. </if>
  133. <if test="printingFee != null">
  134. printing_fee = #{printingFee,jdbcType=INTEGER},
  135. </if>
  136. <if test="funds != null">
  137. funds = #{funds,jdbcType=INTEGER},
  138. </if>
  139. <if test="reimbursement != null">
  140. reimbursement = #{reimbursement,jdbcType=INTEGER},
  141. </if>
  142. <if test="paymentState != null">
  143. payment_state = #{paymentState,jdbcType=INTEGER},
  144. </if>
  145. </set>
  146. where id = #{id,jdbcType=VARCHAR}
  147. </update>
  148. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.PatentCost">
  149. update patent_cost
  150. set pid = #{pid,jdbcType=VARCHAR},
  151. annual_fee = #{annualFee,jdbcType=INTEGER},
  152. annual_fee_state = #{annualFeeState,jdbcType=INTEGER},
  153. application_fee = #{applicationFee,jdbcType=INTEGER},
  154. trial_fee = #{trialFee,jdbcType=INTEGER},
  155. printing_fee = #{printingFee,jdbcType=INTEGER},
  156. funds = #{funds,jdbcType=INTEGER},
  157. reimbursement = #{reimbursement,jdbcType=INTEGER},
  158. payment_state = #{paymentState,jdbcType=INTEGER}
  159. where id = #{id,jdbcType=VARCHAR}
  160. </update>
  161. <select id="findApplicationFeeListByPage" parameterType="String"
  162. resultType="com.goafanti.patent.bo.PatentApplicationFeeBo">
  163. select p.uid as uid , p.id as pid ,o.id as oid, c.id as cid,
  164. p.serial_number as serialNumber ,p.patent_number as patentNumber ,
  165. o.licence_province as locationProvince , o.unit_name as unitName ,
  166. p.patent_name as patentName , p.patent_application_date as
  167. patentApplicationDate,
  168. c.payment_state as paymentState,c.application_fee as applicationFee ,
  169. c.trial_fee as trialFee , c.printing_fee as printingFee ,
  170. c.funds as funds , c.reimbursement as reimbursement
  171. from patent_info p
  172. LEFT JOIN organization_identity o on o.uid = p.uid
  173. LEFT JOIN patent_cost c on p.id = c.pid
  174. <if test="principal != null">
  175. left join contract_log l on p.contract_id=l.cid
  176. </if>
  177. WHERE p.deleted_sign = 0
  178. <if test="locationProvince != null">
  179. and o.licence_province = #{locationProvince,jdbcType=INTEGER}
  180. </if>
  181. <if test="pStart != null">
  182. and p.patent_application_date <![CDATA[ >= ]]>
  183. #{pStart,jdbcType=TIMESTAMP}
  184. </if>
  185. <if test="pEnd">
  186. and p.patent_application_date <![CDATA[ < ]]>
  187. #{pEnd,jdbcType=TIMESTAMP}
  188. </if>
  189. <if test="principal != null">
  190. group by p.id,o.id,c.id
  191. </if>
  192. order by p.serial_number DESC
  193. <if test="page_sql!=null">
  194. ${page_sql}
  195. </if>
  196. </select>
  197. <select id="findApplicationFeeCount" resultType="java.lang.Integer"
  198. parameterType="java.lang.String">
  199. select count(distinct(p.id))
  200. from patent_info p
  201. LEFT JOIN organization_identity o on o.uid = p.uid
  202. LEFT JOIN patent_cost c on p.id = c.pid
  203. <if test="principal != null">
  204. left join contract_log l on p.contract_id=l.cid
  205. </if>
  206. WHERE p.deleted_sign = 0
  207. <if test="locationProvince != null">
  208. and o.licence_province = #{locationProvince,jdbcType=INTEGER}
  209. </if>
  210. <if test="pStart != null">
  211. and p.patent_application_date <![CDATA[ >= ]]>
  212. #{pStart,jdbcType=TIMESTAMP}
  213. </if>
  214. <if test="pEnd">
  215. and p.patent_application_date <![CDATA[ < ]]>
  216. #{pEnd,jdbcType=TIMESTAMP}
  217. </if>
  218. </select>
  219. <insert id="batchInsert" parameterType="com.goafanti.common.model.PatentCost">
  220. insert into patent_cost (id, pid, annual_fee,
  221. annual_fee_state, application_fee, trial_fee,
  222. printing_fee, funds, reimbursement,
  223. payment_state)
  224. values
  225. <foreach item="item" index="index" collection="list" separator=",">
  226. (
  227. #{item.id,jdbcType=VARCHAR},
  228. #{item.pid,jdbcType=VARCHAR},
  229. #{item.annualFee,jdbcType=INTEGER},
  230. #{item.annualFeeState,jdbcType=INTEGER},
  231. #{item.applicationFee,jdbcType=INTEGER},
  232. #{item.trialFee,jdbcType=INTEGER},
  233. #{item.printingFee,jdbcType=INTEGER},
  234. #{item.funds,jdbcType=INTEGER},
  235. #{item.reimbursement,jdbcType=INTEGER},
  236. #{item.paymentState,jdbcType=INTEGER}
  237. )
  238. </foreach>
  239. </insert>
  240. <update id="batchUpdateByPrimaryKey" parameterType="java.util.List">
  241. update patent_cost set annual_fee_state = 0
  242. where id in
  243. <foreach item="item" index="index" collection="list" open="("
  244. separator="," close=")">
  245. #{item}
  246. </foreach>
  247. </update>
  248. </mapper>