AssoProductPatentMapper.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  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="cn.cslg.pas.mapper.asso.AssoProductPatentMapper">
  4. <!--批量插入数据-->
  5. <!--int insertBatch(List<AssoProductPicture> assoProductPictures);-->
  6. <insert id="insertBatch">
  7. insert into asso_product_patent (product_id,patent_no)
  8. values
  9. <foreach collection="patentNos" item="item" separator=",">
  10. (#{productId},#{item})
  11. </foreach>
  12. </insert>
  13. <select id="getPageListProductPatent" parameterType="cn.cslg.pas.common.model.vo.PatentVO"
  14. resultType="cn.cslg.pas.domain.Patent">
  15. select DISTINCT a.id, a.`name` as name, a.nameout as name_out, a.patentno as patent_no, a.abstract_path,
  16. a.abstract as
  17. abstract_str, a.abstractout as abstract_out,
  18. a.publicno as public_no, a.publicdate as public_date, a.simple_family, a.inpadoc_family, a.applicationno as
  19. application_no, a.appdate as application_date,
  20. a.`status` as simple_status, a.type, a.publictodate as public_accredit_date, a.fpublicdate as first_public_date,
  21. a.prioritydate as priority_date,
  22. a.agencyid as agency_id, a.num2 as right_num, a.quoteno as quote_num, a.quotedno as quoted_num,
  23. a.patsnap_family as patSnapFamily, a.patsnapfamilynum as patSnapFamilyNum
  24. from os_patent a
  25. <if test="params.productId !=null">
  26. left join asso_product_patent i on i.patent_no=a.patentno
  27. </if>
  28. <if test="params.structureId !=null and params.structureId !=''">
  29. left join asso_structure_patent t on t.patent_no =a.patentno
  30. </if>
  31. <if test="params.applicationName !=null ">
  32. left join os_applicant_attr b on a.id=b.pid and b.type =1
  33. left join os_patent_applicant c on c.id=b.applicantid
  34. </if>
  35. <if test=" params.obligeeName !=null">
  36. left join os_applicant_attr d on a.id=d.pid and d.type =2
  37. left join os_patent_applicant e on e.id=d.applicantid
  38. </if>
  39. <if test="params.numberIpc!=null ">
  40. left join os_patent_typeno f on f.pid =a.id and f.type =1
  41. </if>
  42. <if test=" params.numberCpc!=null ">
  43. left join os_patent_typeno g on g.pid =a.id and g.type =2
  44. </if>
  45. <if test=" params.numberUpc!=null">
  46. left join os_patent_typeno h on h.pid =a.id and h.type =3
  47. </if>
  48. <where>
  49. <if test="params.productId !=null">
  50. and i.product_id =#{params.productId}
  51. </if>
  52. <if test="params.applicationName !=null and params.applicationName !='' ">
  53. and c.name REGEXP #{params.applicationName}
  54. </if>
  55. <if test="params.obligeeName !=null and params.obligeeName!=''">
  56. and e.name REGEXP #{params.obligeeName}
  57. </if>
  58. <if test="params.numberIpc !=null and params.numberIpc!=''">
  59. and f.code like concat("%", #{params.numberIpc}, "%")
  60. </if>
  61. <if test="params.numberCpc !=null and params.numberCpc!=''">
  62. and g.code like concat("%", #{params.numberCpc}, "%")
  63. </if>
  64. <if test="params.numberUpc !=null and params.numberUpc!=''">
  65. and h.code like concat("%", #{params.numberUpc}, "%")
  66. </if>
  67. <if test="params.patentNo !=null and params.patentNo !=''">
  68. and a.patentNo REGEXP #{params.patentNo}
  69. </if>
  70. <if test="params.applicationNo !=null and params.applicationNo !=''">
  71. and a.applicationNo like concat("%", #{params.applicationNo}, "%")
  72. </if>
  73. <if test="params.abstractStr !=null and params.abstractStr !=''">
  74. and a.abstract like concat("%", #{params.abstractStr}, "%")
  75. </if>
  76. <if test="params.patentName !=null and params.patentName !=''">
  77. and a.`name` like concat("%", #{params.patentName}, "%")
  78. </if>
  79. <if test="params.structureId !=null and params.structureId !=''">
  80. and find_in_set(#{params.structureId}, t.path)
  81. </if>
  82. <if test="params.orderItem!=null and params.orderItem!='SysOrder'">
  83. order by #{params.orderItem}
  84. <if test="params.orderType!=null">
  85. #{params.orderType}
  86. </if>
  87. </if>
  88. <if test="params.orderItem==null">
  89. order by a.patentno
  90. </if>
  91. <if test="params.orderItem=='SysOrder' and params.patentNos != null and params.patentNos.size()!=0">
  92. order by field (a.patentno,
  93. <foreach item="item" collection="params.patentNos" index="index" open="" separator=","
  94. close=")">
  95. #{item}
  96. </foreach>
  97. </if>
  98. </where>
  99. </select>
  100. <select id="getPageListStructurePatent" parameterType="cn.cslg.pas.common.model.vo.PatentVO"
  101. resultType="cn.cslg.pas.domain.Patent">
  102. select DISTINCT a.id, a.`name` as name, a.nameout as name_out, a.patentno as patent_no, a.abstract_path,
  103. a.abstract as
  104. abstract_str, a.abstractout as abstract_out,
  105. a.publicno as public_no, a.publicdate as public_date, a.simple_family, a.inpadoc_family, a.applicationno as
  106. application_no, a.appdate as application_date,
  107. a.`status` as simple_status, a.type, a.publictodate as public_accredit_date, a.fpublicdate as first_public_date,
  108. a.prioritydate as priority_date,
  109. a.agencyid as agency_id, a.num2 as right_num, a.quoteno as quote_num, a.quotedno as quoted_num,
  110. a.patsnap_family as patSnapFamily, a.patsnapfamilynum as patSnapFamilyNum
  111. from os_patent a
  112. <if test="params.productId !=null and params.productId !=''">
  113. left join asso_structure_patent t on t.patent_no =a.patentno
  114. </if>
  115. <if test="params.applicationName !=null ">
  116. left join os_applicant_attr b on a.id=b.pid and b.type =1
  117. left join os_patent_applicant c on c.id=b.applicantid
  118. </if>
  119. <if test=" params.obligeeName !=null">
  120. left join os_applicant_attr d on a.id=d.pid and d.type =2
  121. left join os_patent_applicant e on e.id=d.applicantid
  122. </if>
  123. <if test="params.numberIpc!=null ">
  124. left join os_patent_typeno f on f.pid =a.id and f.type =1
  125. </if>
  126. <if test=" params.numberCpc!=null ">
  127. left join os_patent_typeno g on g.pid =a.id and g.type =2
  128. </if>
  129. <if test=" params.numberUpc!=null">
  130. left join os_patent_typeno h on h.pid =a.id and h.type =3
  131. </if>
  132. <where>
  133. <if test="params.productId !=null">
  134. and t.product_id =#{params.productId}
  135. </if>
  136. <if test="params.applicationName !=null and params.applicationName !='' ">
  137. and c.name REGEXP #{params.applicationName}
  138. </if>
  139. <if test="params.obligeeName !=null and params.obligeeName!=''">
  140. and e.name REGEXP #{params.obligeeName}
  141. </if>
  142. <if test="params.numberIpc !=null and params.numberIpc!=''">
  143. and f.code like concat("%", #{params.numberIpc}, "%")
  144. </if>
  145. <if test="params.numberCpc !=null and params.numberCpc!=''">
  146. and g.code like concat("%", #{params.numberCpc}, "%")
  147. </if>
  148. <if test="params.numberUpc !=null and params.numberUpc!=''">
  149. and h.code like concat("%", #{params.numberUpc}, "%")
  150. </if>
  151. <if test="params.patentNo !=null and params.patentNo !=''">
  152. and a.patentNo REGEXP #{params.patentNo}
  153. </if>
  154. <if test="params.applicationNo !=null and params.applicationNo !=''">
  155. and a.applicationNo like concat("%", #{params.applicationNo}, "%")
  156. </if>
  157. <if test="params.abstractStr !=null and params.abstractStr !=''">
  158. and a.abstract like concat("%", #{params.abstractStr}, "%")
  159. </if>
  160. <if test="params.patentName !=null and params.patentName !=''">
  161. and a.`name` like concat("%", #{params.patentName}, "%")
  162. </if>
  163. <if test="params.structureId !=null and params.structureId !=''">
  164. and find_in_set(#{params.structureId}, t.path)
  165. </if>
  166. <if test="params.orderItem!=null and params.orderItem!='SysOrder'">
  167. order by #{params.orderItem}
  168. <if test="params.orderType!=null">
  169. #{params.orderType}
  170. </if>
  171. </if>
  172. <if test="params.orderItem==null">
  173. order by a.patentno
  174. </if>
  175. <if test="params.orderItem=='SysOrder' and params.patentNos != null and params.patentNos.size()!=0">
  176. order by field (a.patentno,
  177. <foreach item="item" collection="params.patentNos" index="index" open="" separator=","
  178. close=")">
  179. #{item}
  180. </foreach>
  181. </if>
  182. </where>
  183. </select>
  184. <select id="getPatentNos" resultType="java.lang.String">
  185. select a.patentno as patent_no
  186. from os_patent a
  187. left join asso_product_patent i on i.patent_no=a.patentno
  188. and i.product_id =#{params.productId}
  189. <if test="params.applicationName !=null ">
  190. left join os_applicant_attr b on a.id=b.pid and b.type =1
  191. left join os_patent_applicant c on c.id=b.applicantid
  192. </if>
  193. <if test=" params.obligeeName !=null">
  194. left join os_applicant_attr d on a.id=d.pid and d.type =2
  195. left join os_patent_applicant e on e.id=d.applicantid
  196. </if>
  197. <if test="params.numberIpc!=null ">
  198. left join os_patent_typeno f on f.pid =a.id and f.type =1
  199. </if>
  200. <if test=" params.numberCpc!=null ">
  201. left join os_patent_typeno g on g.pid =a.id and g.type =2
  202. </if>
  203. <if test=" params.numberUpc!=null">
  204. left join os_patent_typeno h on h.pid =a.id and h.type =3
  205. </if>
  206. <where>
  207. <if test="params.applicationName !=null and params.applicationName !='' ">
  208. and c.name REGEXP #{params.applicationName}
  209. </if>
  210. <if test="params.obligeeName !=null and params.obligeeName!=''">
  211. and e.name REGEXP #{params.obligeeName}
  212. </if>
  213. <if test="params.numberIpc !=null and params.numberIpc!=''">
  214. and f.code like concat("%", #{params.numberIpc}, "%")
  215. </if>
  216. <if test="params.numberCpc !=null and params.numberCpc!=''">
  217. and g.code like concat("%", #{params.numberCpc}, "%")
  218. </if>
  219. <if test="params.numberUpc !=null and params.numberUpc!=''">
  220. and h.code like concat("%", #{params.numberUpc}, "%")
  221. </if>
  222. <if test="params.patentNo !=null and params.patentNo !=''">
  223. and a.patentNo REGEXP #{params.patentNo}
  224. </if>
  225. <if test="params.applicationNo !=null and params.applicationNo !=''">
  226. and a.applicationNo like concat("%", #{params.applicationNo}, "%")
  227. </if>
  228. <if test="params.abstractStr !=null and params.abstractStr !=''">
  229. and a.abstract like concat("%", #{params.abstractStr}, "%")
  230. </if>
  231. <if test="params.patentName !=null and params.patentName !=''">
  232. and a.`name` like concat("%", #{params.patentName}, "%")
  233. </if>
  234. <if test="params.isIn ==0">
  235. and (i.product_id is null)
  236. </if>
  237. <if test="params.isIn !=0">
  238. and (i.product_id =#{params.productId})
  239. </if>
  240. <if test="params.orderItem!=null and params.orderItem!='SysOrder'">
  241. order by #{params.orderItem}
  242. <if test="params.orderType!=null">
  243. #{params.orderType}
  244. </if>
  245. </if>
  246. <if test="params.orderItem==null">
  247. order by a.patentno
  248. </if>
  249. <if test="params.orderItem=='SysOrder' and params.patentNos != null and params.patentNos.size()!=0">
  250. order by field (a.patentno,
  251. <foreach item="item" collection="params.patentNos" index="index" open="" separator=","
  252. close=")">
  253. #{item}
  254. </foreach>
  255. </if>
  256. <if test=" params.endNumber &gt; 0">
  257. limit #{params.startNumber},#{params.endNumber}
  258. </if>
  259. </where>
  260. </select>
  261. <!--插入数据-->
  262. <!--int insert(AssoProductPatent assoProductPatent);-->
  263. <insert id="insert" useGeneratedKeys="true" keyProperty="id">
  264. insert into asso_product_patent (patent_no, product_id)
  265. values (#{patentNo}, #{productId});
  266. </insert>
  267. <!--根据产品id删除数据-->
  268. <!--int deleteByProductId(Integer productId);-->
  269. <delete id="deleteByProductId">
  270. delete
  271. from asso_product_patent
  272. where product_id = #{productId};
  273. </delete>
  274. </mapper>