OrgIntellectualPropertyMapper.xml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381
  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 u.id as uid, a.utilityPatent, b.exteriorPatent, c.softwareWorks, d.defensePatent, e.newPlantCariety, f.nationalCrop,
  276. g.nationalDrug, h.chineseMedicine, i.circuitDesign, j.inventionPatent from
  277. (
  278. select id from user where id = #{1}
  279. ) u LEFT JOIN
  280. (
  281. select uid, count(1) as utilityPatent
  282. from org_intellectual_property
  283. where uid = #{1} and catagory = 2 and authorization_date
  284. >= (select str_to_date(CONCAT(#{0}-2,'-01-01'), '%Y-%m-%d %H') )
  285. and authorization_date <![CDATA[ < ]]> (select str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
  286. and deleted_sign = 0
  287. ) a on a.uid = u.id
  288. LEFT JOIN
  289. (
  290. select uid, count(1) as exteriorPatent
  291. from org_intellectual_property
  292. where uid = #{1} and catagory = 3 and authorization_date
  293. >= (select str_to_date(CONCAT(#{0}-2,'-01-01'), '%Y-%m-%d %H') )
  294. and authorization_date <![CDATA[ < ]]> (select str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
  295. and deleted_sign = 0
  296. ) b on u.id = b.uid
  297. LEFT JOIN
  298. (
  299. select uid, count(1) as softwareWorks
  300. from org_intellectual_property
  301. where uid = #{1} and catagory = 4 and authorization_date
  302. >= (select str_to_date(CONCAT(#{0}-2,'-01-01'), '%Y-%m-%d %H') )
  303. and authorization_date <![CDATA[ < ]]> (select str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
  304. and deleted_sign = 0
  305. ) c on u.id = c.uid
  306. LEFT JOIN
  307. (
  308. select uid, count(1) as defensePatent
  309. from org_intellectual_property
  310. where uid = #{1} and catagory = 5 and authorization_date
  311. >= (select str_to_date(CONCAT(#{0}-2,'-01-01'), '%Y-%m-%d %H') )
  312. and authorization_date <![CDATA[ < ]]> (select str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
  313. and deleted_sign = 0
  314. ) d on u.id = d.uid
  315. LEFT JOIN
  316. (
  317. select uid, count(1) as newPlantCariety
  318. from org_intellectual_property
  319. where uid = #{1} and catagory = 6 and authorization_date
  320. >= (select str_to_date(CONCAT(#{0}-2,'-01-01'), '%Y-%m-%d %H') )
  321. and authorization_date <![CDATA[ < ]]> (select str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
  322. and deleted_sign = 0
  323. ) e on u.id = e.uid
  324. LEFT JOIN
  325. (
  326. select uid, count(1) as nationalCrop
  327. from org_intellectual_property
  328. where uid = #{1} and catagory = 7 and authorization_date
  329. >= (select str_to_date(CONCAT(#{0}-2,'-01-01'), '%Y-%m-%d %H') )
  330. and authorization_date <![CDATA[ < ]]> (select str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
  331. and deleted_sign = 0
  332. ) f on u.id = f.uid
  333. LEFT JOIN
  334. (
  335. select uid, count(1) as nationalDrug
  336. from org_intellectual_property
  337. where uid = #{1} and catagory = 8 and authorization_date
  338. >= (select str_to_date(CONCAT(#{0}-2,'-01-01'), '%Y-%m-%d %H') )
  339. and authorization_date <![CDATA[ < ]]> (select str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
  340. and deleted_sign = 0
  341. ) g on u.id = g.uid
  342. LEFT JOIN
  343. (
  344. select uid, count(1) as chineseMedicine
  345. from org_intellectual_property
  346. where uid = #{1} and catagory = 9 and authorization_date
  347. >= (select str_to_date(CONCAT(#{0}-2,'-01-01'), '%Y-%m-%d %H') )
  348. and authorization_date <![CDATA[ < ]]> (select str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
  349. and deleted_sign = 0
  350. ) h on u.id = h.uid
  351. LEFT JOIN
  352. (
  353. select uid, count(1) as circuitDesign
  354. from org_intellectual_property
  355. where uid = #{1} and catagory = 10 and authorization_date
  356. >= (select str_to_date(CONCAT(#{0}-2,'-01-01'), '%Y-%m-%d %H') )
  357. and authorization_date <![CDATA[ < ]]> (select str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
  358. and deleted_sign = 0
  359. ) i on u.id = i.uid
  360. LEFT JOIN
  361. (
  362. select uid, count(1) as inventionPatent
  363. from org_intellectual_property
  364. where uid = #{1} and catagory = 11 and authorization_date
  365. >= (select str_to_date(CONCAT(#{0}-2,'-01-01'), '%Y-%m-%d %H') )
  366. and authorization_date <![CDATA[ < ]]> (select str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
  367. and deleted_sign = 0
  368. ) j on u.id = j.uid
  369. </select>
  370. </mapper>