OrgIntellectualPropertyMapper.xml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425
  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.OrgIntellectualPropertyMapper" >
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.OrgIntellectualProperty" >
  5. <id column="id" property="id" jdbcType="VARCHAR" />
  6. <result column="uid" property="uid" jdbcType="VARCHAR" />
  7. <result column="pid" property="pid" jdbcType="VARCHAR" />
  8. <result column="intellectual_property_number" property="intellectualPropertyNumber" jdbcType="VARCHAR" />
  9. <result column="intellectual_property_name" property="intellectualPropertyName" jdbcType="VARCHAR" />
  10. <result column="sort_number" property="sortNumber" jdbcType="VARCHAR" />
  11. <result column="catagory" property="catagory" jdbcType="INTEGER" />
  12. <result column="obtain_way" property="obtainWay" jdbcType="INTEGER" />
  13. <result column="authorization_number" property="authorizationNumber" jdbcType="VARCHAR" />
  14. <result column="authorization_date" property="authorizationDate" jdbcType="TIMESTAMP" />
  15. <result column="evaluation_category" property="evaluationCategory" jdbcType="INTEGER" />
  16. <result column="property_right_url" property="propertyRightUrl" jdbcType="VARCHAR" />
  17. <result column="type" property="type" jdbcType="INTEGER" />
  18. <result column="deleted_sign" property="deletedSign" jdbcType="INTEGER" />
  19. </resultMap>
  20. <sql id="Base_Column_List" >
  21. id, uid, pid, intellectual_property_number, intellectual_property_name, sort_number, catagory,
  22. obtain_way, authorization_number, authorization_date, evaluation_category, property_right_url,
  23. type, deleted_sign
  24. </sql>
  25. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
  26. select
  27. <include refid="Base_Column_List" />
  28. from org_intellectual_property
  29. where id = #{id,jdbcType=VARCHAR}
  30. </select>
  31. <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
  32. delete from org_intellectual_property
  33. where id = #{id,jdbcType=VARCHAR}
  34. </delete>
  35. <insert id="insert" parameterType="com.goafanti.common.model.OrgIntellectualProperty" >
  36. insert into org_intellectual_property (id, uid, pid, intellectual_property_number,
  37. intellectual_property_name, sort_number, catagory,
  38. obtain_way, authorization_number, authorization_date,
  39. evaluation_category, property_right_url, type, deleted_sign)
  40. values (#{id,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR}, #{pid,jdbcType=VARCHAR}, #{intellectualPropertyNumber,jdbcType=VARCHAR},
  41. #{intellectualPropertyName,jdbcType=VARCHAR}, #{sortNumber,jdbcType=VARCHAR}, #{catagory,jdbcType=INTEGER},
  42. #{obtainWay,jdbcType=INTEGER}, #{authorizationNumber,jdbcType=VARCHAR}, #{authorizationDate,jdbcType=TIMESTAMP},
  43. #{evaluationCategory,jdbcType=INTEGER}, #{propertyRightUrl,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER},
  44. #{deletedSign,jdbcType=INTEGER})
  45. </insert>
  46. <insert id="insertSelective" parameterType="com.goafanti.common.model.OrgIntellectualProperty" >
  47. insert into org_intellectual_property
  48. <trim prefix="(" suffix=")" suffixOverrides="," >
  49. <if test="id != null" >
  50. id,
  51. </if>
  52. <if test="uid != null" >
  53. uid,
  54. </if>
  55. <if test="pid != null" >
  56. pid,
  57. </if>
  58. <if test="intellectualPropertyNumber != null" >
  59. intellectual_property_number,
  60. </if>
  61. <if test="intellectualPropertyName != null" >
  62. intellectual_property_name,
  63. </if>
  64. <if test="sortNumber != null" >
  65. sort_number,
  66. </if>
  67. <if test="catagory != null" >
  68. catagory,
  69. </if>
  70. <if test="obtainWay != null" >
  71. obtain_way,
  72. </if>
  73. <if test="authorizationNumber != null" >
  74. authorization_number,
  75. </if>
  76. <if test="authorizationDate != null" >
  77. authorization_date,
  78. </if>
  79. <if test="evaluationCategory != null" >
  80. evaluation_category,
  81. </if>
  82. <if test="propertyRightUrl != null" >
  83. property_right_url,
  84. </if>
  85. <if test="type != null" >
  86. type,
  87. </if>
  88. <if test="deletedSign != null" >
  89. deleted_sign,
  90. </if>
  91. </trim>
  92. <trim prefix="values (" suffix=")" suffixOverrides="," >
  93. <if test="id != null" >
  94. #{id,jdbcType=VARCHAR},
  95. </if>
  96. <if test="uid != null" >
  97. #{uid,jdbcType=VARCHAR},
  98. </if>
  99. <if test="pid != null" >
  100. #{pid,jdbcType=VARCHAR},
  101. </if>
  102. <if test="intellectualPropertyNumber != null" >
  103. #{intellectualPropertyNumber,jdbcType=VARCHAR},
  104. </if>
  105. <if test="intellectualPropertyName != null" >
  106. #{intellectualPropertyName,jdbcType=VARCHAR},
  107. </if>
  108. <if test="sortNumber != null" >
  109. #{sortNumber,jdbcType=VARCHAR},
  110. </if>
  111. <if test="catagory != null" >
  112. #{catagory,jdbcType=INTEGER},
  113. </if>
  114. <if test="obtainWay != null" >
  115. #{obtainWay,jdbcType=INTEGER},
  116. </if>
  117. <if test="authorizationNumber != null" >
  118. #{authorizationNumber,jdbcType=VARCHAR},
  119. </if>
  120. <if test="authorizationDate != null" >
  121. #{authorizationDate,jdbcType=TIMESTAMP},
  122. </if>
  123. <if test="evaluationCategory != null" >
  124. #{evaluationCategory,jdbcType=INTEGER},
  125. </if>
  126. <if test="propertyRightUrl != null" >
  127. #{propertyRightUrl,jdbcType=VARCHAR},
  128. </if>
  129. <if test="type != null" >
  130. #{type,jdbcType=INTEGER},
  131. </if>
  132. <if test="deletedSign != null" >
  133. #{deletedSign,jdbcType=INTEGER},
  134. </if>
  135. </trim>
  136. </insert>
  137. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.OrgIntellectualProperty" >
  138. update org_intellectual_property
  139. <set >
  140. <if test="uid != null" >
  141. uid = #{uid,jdbcType=VARCHAR},
  142. </if>
  143. <if test="pid != null" >
  144. pid = #{pid,jdbcType=VARCHAR},
  145. </if>
  146. <if test="intellectualPropertyNumber != null" >
  147. intellectual_property_number = #{intellectualPropertyNumber,jdbcType=VARCHAR},
  148. </if>
  149. <if test="intellectualPropertyName != null" >
  150. intellectual_property_name = #{intellectualPropertyName,jdbcType=VARCHAR},
  151. </if>
  152. <if test="sortNumber != null" >
  153. sort_number = #{sortNumber,jdbcType=VARCHAR},
  154. </if>
  155. <if test="catagory != null" >
  156. catagory = #{catagory,jdbcType=INTEGER},
  157. </if>
  158. <if test="obtainWay != null" >
  159. obtain_way = #{obtainWay,jdbcType=INTEGER},
  160. </if>
  161. <if test="authorizationNumber != null" >
  162. authorization_number = #{authorizationNumber,jdbcType=VARCHAR},
  163. </if>
  164. <if test="authorizationDate != null" >
  165. authorization_date = #{authorizationDate,jdbcType=TIMESTAMP},
  166. </if>
  167. <if test="evaluationCategory != null" >
  168. evaluation_category = #{evaluationCategory,jdbcType=INTEGER},
  169. </if>
  170. <if test="propertyRightUrl != null" >
  171. property_right_url = #{propertyRightUrl,jdbcType=VARCHAR},
  172. </if>
  173. <if test="type != null" >
  174. type = #{type,jdbcType=INTEGER},
  175. </if>
  176. <if test="deletedSign != null" >
  177. deleted_sign = #{deletedSign,jdbcType=INTEGER},
  178. </if>
  179. </set>
  180. where id = #{id,jdbcType=VARCHAR}
  181. </update>
  182. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.OrgIntellectualProperty" >
  183. update org_intellectual_property
  184. set uid = #{uid,jdbcType=VARCHAR},
  185. pid = #{pid,jdbcType=VARCHAR},
  186. intellectual_property_number = #{intellectualPropertyNumber,jdbcType=VARCHAR},
  187. intellectual_property_name = #{intellectualPropertyName,jdbcType=VARCHAR},
  188. sort_number = #{sortNumber,jdbcType=VARCHAR},
  189. catagory = #{catagory,jdbcType=INTEGER},
  190. obtain_way = #{obtainWay,jdbcType=INTEGER},
  191. authorization_number = #{authorizationNumber,jdbcType=VARCHAR},
  192. authorization_date = #{authorizationDate,jdbcType=TIMESTAMP},
  193. evaluation_category = #{evaluationCategory,jdbcType=INTEGER},
  194. property_right_url = #{propertyRightUrl,jdbcType=VARCHAR},
  195. type = #{type,jdbcType=INTEGER},
  196. deleted_sign = #{deletedSign,jdbcType=INTEGER}
  197. where id = #{id,jdbcType=VARCHAR}
  198. </update>
  199. <select id="findOrgIntellectualPropertyListByPage" parameterType="java.lang.String" resultMap="BaseResultMap">
  200. select
  201. <include refid="Base_Column_List" />
  202. from org_intellectual_property
  203. where deleted_sign = 0
  204. <if test="uid != null">
  205. and uid = #{uid,jdbcType=VARCHAR}
  206. </if>
  207. <if test="sDate != null">
  208. and authorization_date <![CDATA[ >= ]]> #{sDate,jdbcType=TIMESTAMP}
  209. </if>
  210. <if test="eDate != null">
  211. and authorization_date <![CDATA[ < ]]> #{eDate,jdbcType=TIMESTAMP}
  212. </if>
  213. order by authorization_date desc
  214. <if test="page_sql != null">
  215. ${page_sql}
  216. </if>
  217. </select>
  218. <select id="findOrgIntellectualPropertyCount" resultType="java.lang.Integer" parameterType="String">
  219. select count(1)
  220. from org_intellectual_property
  221. where deleted_sign = 0
  222. <if test="uid != null">
  223. and uid = #{uid,jdbcType=VARCHAR}
  224. </if>
  225. <if test="sDate != null">
  226. and authorization_date <![CDATA[ >= ]]> #{sDate,jdbcType=TIMESTAMP}
  227. </if>
  228. <if test="eDate != null">
  229. and authorization_date <![CDATA[ < ]]> #{eDate,jdbcType=TIMESTAMP}
  230. </if>
  231. </select>
  232. <update id="batchDeleteByPrimaryKey" parameterType="java.util.List">
  233. update org_intellectual_property set deleted_sign = 1
  234. where id in
  235. <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
  236. #{item}
  237. </foreach>
  238. </update>
  239. <select id="selectOrgIntellectualPropertyByPid" resultMap="BaseResultMap" parameterType="java.lang.String" >
  240. select
  241. <include refid="Base_Column_List" />
  242. from org_intellectual_property
  243. where pid = #{pid,jdbcType=VARCHAR} and deleted_sign = 0
  244. </select>
  245. <select id="selectPatentTypeDetail" parameterType="java.lang.String" resultType="com.goafanti.cognizance.bo.OrgIntellectualPropertyDetailBo">
  246. select
  247. o.id, o.uid, o.pid, o.intellectual_property_number as intellectualPropertyNumber, o.intellectual_property_name as intellectualPropertyName,
  248. o.sort_number as sortNumber, o.catagory,
  249. o.obtain_way as obtainWay, o.authorization_number as authorizationNumber, o.authorization_date as authorizationDate,
  250. o.evaluation_category as evaluationCategory, o.property_right_url as propertyRightUrl,
  251. o.type, p.patent_writing_url as manuscript
  252. from org_intellectual_property o LEFT JOIN patent_info p on o.pid = p.id
  253. where o.id = #{id,jdbcType=VARCHAR} and o.deleted_sign = 0 and p.deleted_sign = 0
  254. </select>
  255. <select id="selectCopyrightTypeDetail" parameterType="java.lang.String" resultType="com.goafanti.cognizance.bo.OrgIntellectualPropertyDetailBo">
  256. select
  257. o.id, o.uid, o.pid, o.intellectual_property_number as intellectualPropertyNumber, o.intellectual_property_name as intellectualPropertyName,
  258. o.sort_number as sortNumber, o.catagory,
  259. o.obtain_way as obtainWay, o.authorization_number as authorizationNumber, o.authorization_date as authorizationDate,
  260. o.evaluation_category as evaluationCategory, o.property_right_url as propertyRightUrl,
  261. o.type, c.application_url as manuscript
  262. from org_intellectual_property o LEFT JOIN copyright_info c on o.pid = c.id
  263. where o.id = #{id,jdbcType=VARCHAR} and o.deleted_sign = 0 and c.delete_sign = 0
  264. </select>
  265. <select id="selectIntellectualPropertyList" resultMap="BaseResultMap">
  266. select
  267. <include refid="Base_Column_List" />
  268. from org_intellectual_property
  269. where uid = #{1} and authorization_date
  270. >= (select str_to_date(CONCAT(#{0}-2,'-01-01'), '%Y-%m-%d %H'))
  271. and authorization_date <![CDATA[ < ]]> (select str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
  272. and deleted_sign = 0 order by authorization_date
  273. </select>
  274. <select id="selectIntellectualPropertyCount" resultType="com.goafanti.cognizance.bo.AnnualReportPropertyRightBo">
  275. select
  276. u.id as uid,
  277. a.utilityPatent,
  278. b.exteriorPatent,
  279. c.softwareWorks,
  280. d.defensePatent,
  281. e.newPlantCariety,
  282. f.nationalCrop,
  283. g.nationalDrug,
  284. h.chineseMedicine,
  285. i.circuitDesign,
  286. j.inventionPatent from
  287. (
  288. select
  289. id
  290. from user
  291. where id = #{1}
  292. )
  293. u LEFT JOIN
  294. (
  295. select
  296. uid,
  297. count(1) as utilityPatent
  298. from org_intellectual_property
  299. where uid = #{1}
  300. and catagory = 2
  301. and authorization_date >=
  302. (
  303. select
  304. str_to_date(CONCAT(#{0}-2,'-01-01'), '%Y-%m-%d %H')
  305. )
  306. and authorization_date <![CDATA[ < ]]>
  307. (
  308. select
  309. str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H')
  310. )
  311. and deleted_sign = 0
  312. ) a on a.uid = u.id
  313. LEFT JOIN
  314. (
  315. select uid, count(1) as exteriorPatent
  316. from org_intellectual_property
  317. where uid = #{1} and catagory = 3 and authorization_date
  318. >= (select str_to_date(CONCAT(#{0}-2,'-01-01'), '%Y-%m-%d %H') )
  319. and authorization_date <![CDATA[ < ]]> (select str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
  320. and deleted_sign = 0
  321. ) b on u.id = b.uid
  322. LEFT JOIN
  323. (
  324. select uid, count(1) as softwareWorks
  325. from org_intellectual_property
  326. where uid = #{1} and catagory = 4 and authorization_date
  327. >= (select str_to_date(CONCAT(#{0}-2,'-01-01'), '%Y-%m-%d %H') )
  328. and authorization_date <![CDATA[ < ]]> (select str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
  329. and deleted_sign = 0
  330. ) c on u.id = c.uid
  331. LEFT JOIN
  332. (
  333. select uid, count(1) as defensePatent
  334. from org_intellectual_property
  335. where uid = #{1} and catagory = 5 and authorization_date
  336. >= (select str_to_date(CONCAT(#{0}-2,'-01-01'), '%Y-%m-%d %H') )
  337. and authorization_date <![CDATA[ < ]]> (select str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
  338. and deleted_sign = 0
  339. ) d on u.id = d.uid
  340. LEFT JOIN
  341. (
  342. select uid, count(1) as newPlantCariety
  343. from org_intellectual_property
  344. where uid = #{1} and catagory = 6 and authorization_date
  345. >= (select str_to_date(CONCAT(#{0}-2,'-01-01'), '%Y-%m-%d %H') )
  346. and authorization_date <![CDATA[ < ]]> (select str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
  347. and deleted_sign = 0
  348. ) e on u.id = e.uid
  349. LEFT JOIN
  350. (
  351. select uid, count(1) as nationalCrop
  352. from org_intellectual_property
  353. where uid = #{1} and catagory = 7 and authorization_date
  354. >= (select str_to_date(CONCAT(#{0}-2,'-01-01'), '%Y-%m-%d %H') )
  355. and authorization_date <![CDATA[ < ]]> (select str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
  356. and deleted_sign = 0
  357. ) f on u.id = f.uid
  358. LEFT JOIN
  359. (
  360. select uid, count(1) as nationalDrug
  361. from org_intellectual_property
  362. where uid = #{1} and catagory = 8 and authorization_date
  363. >= (select str_to_date(CONCAT(#{0}-2,'-01-01'), '%Y-%m-%d %H') )
  364. and authorization_date <![CDATA[ < ]]> (select str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
  365. and deleted_sign = 0
  366. ) g on u.id = g.uid
  367. LEFT JOIN
  368. (
  369. select uid, count(1) as chineseMedicine
  370. from org_intellectual_property
  371. where uid = #{1} and catagory = 9 and authorization_date
  372. >= (select str_to_date(CONCAT(#{0}-2,'-01-01'), '%Y-%m-%d %H') )
  373. and authorization_date <![CDATA[ < ]]> (select str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
  374. and deleted_sign = 0
  375. ) h on u.id = h.uid
  376. LEFT JOIN
  377. (
  378. select uid, count(1) as circuitDesign
  379. from org_intellectual_property
  380. where uid = #{1} and catagory = 10 and authorization_date
  381. >= (select str_to_date(CONCAT(#{0}-2,'-01-01'), '%Y-%m-%d %H') )
  382. and authorization_date <![CDATA[ < ]]> (select str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
  383. and deleted_sign = 0
  384. ) i on u.id = i.uid
  385. LEFT JOIN
  386. (
  387. select uid, count(1) as inventionPatent
  388. from org_intellectual_property
  389. where uid = #{1} and catagory = 11 and authorization_date
  390. >= (select str_to_date(CONCAT(#{0}-2,'-01-01'), '%Y-%m-%d %H') )
  391. and authorization_date <![CDATA[ < ]]> (select str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
  392. and deleted_sign = 0
  393. ) j on u.id = j.uid
  394. </select>
  395. <select id="findIntellectualPropertyNum" parameterType="java.lang.String" resultType="java.lang.Integer">
  396. select
  397. count(1)
  398. from
  399. org_intellectual_property
  400. where
  401. deleted_sign = 0
  402. and uid = #{uid,jdbcType=VARCHAR}
  403. </select>
  404. <select id="findByUidAndIntellectualPropertyNumber" resultMap="BaseResultMap" >
  405. select
  406. <include refid="Base_Column_List" />
  407. from org_intellectual_property
  408. where uid = #{uid,jdbcType=VARCHAR}
  409. and intellectual_Property_number = #{intellectualPropertyNumber,jdbcType=VARCHAR}
  410. and deleted_sign = 0
  411. </select>
  412. </mapper>