PatentMapper.xml 97 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958
  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.PatentMapper">
  4. <select id="getDateTime" resultType="java.lang.Integer">
  5. select ifnull(${type}(${column}), 0) from os_patent where id in (<trim prefix="" suffixOverrides=",">
  6. ${ids}</trim>) and ${column} is not null
  7. </select>
  8. <select id="getDateTime2" resultType="java.lang.Integer">
  9. select ifnull(${type}(unix_timestamp(name)), 0) from os_patent_field_text where id in (select fid from
  10. os_patent_field_patent_link where pid in (<trim prefix="" suffixOverrides=",">${ids}</trim>) and cid = ${field})
  11. </select>
  12. <select id="getCustomFieldCount" resultType="java.lang.Integer">
  13. select distinct b.pid
  14. from os_patent_field_text a
  15. left join os_patent_field_patent_link b on a.id = b.fid
  16. <where>
  17. and a.cid = #{field} and a.`name` ${mino} #{minv} and a.`name` ${maxo} #{maxv}
  18. and b.pid in
  19. <foreach collection="ids" item="item" separator="," open="(" close=")">
  20. #{item}
  21. </foreach>
  22. </where>
  23. </select>
  24. <select id="getCustomFieldTime" resultType="java.lang.Integer">
  25. select distinct b.pid
  26. from os_patent_field_text a
  27. left join os_patent_field_patent_link b on a.id = b.fid
  28. <where>
  29. and a.cid = #{field} and (unix_timestamp(a.`name`) between #{startDate} and #{endDate})
  30. and b.pid in
  31. <foreach collection="ids" item="item" separator="," open="(" close=")">
  32. #{item}
  33. </foreach>
  34. </where>
  35. </select>
  36. <select id="getPatentListByIdAndColumn" resultType="java.util.Map">
  37. select ${column}
  38. from os_patent
  39. where id = #{id}
  40. </select>
  41. <select id="getPageList" parameterType="cn.cslg.pas.common.model.vo.PatentVO"
  42. resultType="cn.cslg.pas.domain.Patent">
  43. select a.id, a.`name` as name, a.nameout as name_out, a.patentno as patent_no, a.abstract_path, a.abstract as
  44. abstract_str, a.abstractout as abstract_out,
  45. a.publicno as public_no, a.publicdate as public_date, a.simple_family, a.inpadoc_family, a.applicationno as
  46. application_no, a.appdate as application_date,
  47. a.`status` as simple_status, a.type, a.publictodate as public_accredit_date, a.fpublicdate as first_public_date,
  48. a.prioritydate as priority_date, a.publictono as public_accredit_no,
  49. b.look as `read`, a.agencyid as agency_id, a.num2 as right_num, a.quoteno as quote_num, a.quotedno as
  50. quoted_num,
  51. a.patsnap_family as patSnapFamily, a.patsnapfamilynum as patSnapFamilyNum
  52. from os_patent a
  53. <if test="params.folder != null and params.folder != ''">
  54. left join os_portfolio_link b on b.pid = a.id
  55. </if>
  56. <if test="params.folder == null or params.folder == ''">
  57. left join os_thematic_pid b on b.pid = a.id
  58. </if>
  59. <if test="params.queryLabel == true">
  60. left join os_patent_label d on d.pid = a.id and d.tid = b.zid
  61. </if>
  62. <if test="params.queryApplicantOriginal == true">
  63. left join os_applicant_attr e on e.type = 2 and e.pid = a.id
  64. </if>
  65. <if test="params.queryApplicantCurrent == true">
  66. left join os_applicant_attr f on f.type = 1 and f.pid = a.id
  67. </if>
  68. <if test="params.queryInventor == true">
  69. left join os_patent_inventor_relation g on g.pid = a.id
  70. left join os_patent_inventor g1 on g1.id = g.fid
  71. </if>
  72. <if test="params.queryInventorMerge == true">
  73. left join os_patent_inventor_merge g2 on g2.inventor_id = g.fid
  74. </if>
  75. <if test="params.queryApplicantOriginalStandard == true">
  76. left join os_applicant_attr h on h.type = 2 and h.pid = a.id
  77. left join os_patent_applicant h1 on h1.id = h.applicantid
  78. </if>
  79. <if test="params.queryApplicantCurrentStandard == true">
  80. left join os_applicant_attr i on i.type = 1 and i.pid = a.id
  81. left join os_patent_applicant i1 on i1.id = i.applicantid
  82. </if>
  83. <if test="params.queryApplicantOriginalMerge == true">
  84. left join os_associate_applicant j on e.applicantid = j.applicantid
  85. </if>
  86. <if test="params.queryApplicantCurrentMerge == true">
  87. left join os_associate_applicant k on f.applicantid = k.applicantid
  88. </if>
  89. <if test="params.queryApplicantAddress == true">
  90. left join os_applicant_attr m on m.pid = a.id and m.type = 2
  91. left join os_patent_applicant o on o.id = m.applicantid
  92. </if>
  93. <if test="params.queryAffair == true">
  94. left join os_patent_affair p on p.pid = a.id
  95. </if>
  96. <if test="params.queryClassNumberIpc == true">
  97. left join os_patent_typeno q1 on q1.pid = a.id
  98. </if>
  99. <if test="params.queryClassNumberCpc == true">
  100. left join os_patent_typeno q2 on q2.pid = a.id
  101. </if>
  102. <if test="params.queryClassNumberUpc == true">
  103. left join os_patent_typeno q3 on q3.pid = a.id
  104. </if>
  105. <if test="params.queryClassNumberLoc == true">
  106. left join os_patent_typeno q4 on q4.pid = a.id
  107. </if>
  108. <if test="params.selfField !=null and params.selfField.size()>0">
  109. left join os_patent_field_patent_link a2 on a2.pid = a.id
  110. </if>
  111. <where>
  112. <if test="params.read == 'read'">
  113. and b.look = 1
  114. </if>
  115. <if test="params.read == 'unread'">
  116. and b.look = 0
  117. </if>
  118. <if test="params.projectId != null and params.importTaskId == null">
  119. and b.zid = #{params.projectId}
  120. </if>
  121. <if test="params.importTaskId != null and params.projectId == null">
  122. and a.patentno in
  123. ( select PATENT_NO from ASSO_IMPORTTASK_PATENT where IMPORTTASK_ID in
  124. <foreach item="item" collection="params.importTaskId" index="index" open="(" separator=","
  125. close=") ">
  126. #{item}
  127. </foreach>
  128. )
  129. </if>
  130. <if test="params.importTaskId != null and params.projectId != null">
  131. and (b.zid = #{params.projectId} or
  132. a.patentno in
  133. ( select PATENT_NO from ASSO_IMPORTTASK_PATENT where IMPORTTASK_ID in
  134. <foreach item="item" collection="params.importTaskId" index="index" open="(" separator=","
  135. close=") ">
  136. #{item}
  137. </foreach>
  138. )
  139. )
  140. </if>
  141. <if test="params.projectId == null and params.projectId == null">
  142. and 1 !=1
  143. </if>
  144. <if test="params.folder != null and params.folder != ''">
  145. and b.fid = #{params.folder}
  146. </if>
  147. <if test="params.nameSql != null and params.nameSql != ''">
  148. and (${params.nameSql})
  149. </if>
  150. <if test="params.abstractStrSql != null and params.abstractStrSql != ''">
  151. and (${params.abstractStrSql})
  152. </if>
  153. <if test="params.publicNoSql != null and params.publicNoSql != ''">
  154. and (${params.publicNoSql})
  155. </if>
  156. <if test="params.applicationNoSql != null and params.applicationNoSql != ''">
  157. and (${params.applicationNoSql})
  158. </if>
  159. <if test="params.rightContentSql != null and params.rightContentSql != ''">
  160. and (select count(*) from os_patent_right where a.id = patent_id and (${params.rightContentSql})) > 0
  161. </if>
  162. <if test="params.querySimpleFamily == true">
  163. and (a.simple_family = (select id from os_patent_simplefamily where type = 1 and patent_no = a.patentno)
  164. or a.simple_family is null)
  165. </if>
  166. <if test="params.queryInpadocFamily == true">
  167. and (a.inpadoc_family = (select id from os_patent_simplefamily where type = 2 and patent_no =
  168. a.patentno) or a.inpadoc_family is null)
  169. </if>
  170. <if test="params.queryPatSnapFamily == true">
  171. and (a.patsnap_family = (select id from os_patent_simplefamily where type = 3 and patent_no =
  172. a.patentno) or a.patsnap_family is null)
  173. </if>
  174. <if test="params.whereClassNumberIpc != null">
  175. and q1.type = 1 and
  176. <foreach collection="params.whereClassNumberIpc" item="item" separator="or" open="(" close=")">
  177. <if test="params.queryClassNumberIpcMethod == 1">
  178. left(q1.code, 1)
  179. </if>
  180. <if test="params.queryClassNumberIpcMethod == 2">
  181. left(q1.code, 3)
  182. </if>
  183. <if test="params.queryClassNumberIpcMethod == 3">
  184. left(q1.code, 4)
  185. </if>
  186. <if test="params.queryClassNumberIpcMethod == 4">
  187. substring_index(q1.code, '/', 1)
  188. </if>
  189. <if test="params.queryClassNumberIpcMethod == 5">
  190. q1.code
  191. </if>
  192. = #{item}
  193. </foreach>
  194. </if>
  195. <if test="params.whereClassNumberCpc != null">
  196. and q2.type = 2 and
  197. <foreach collection="params.whereClassNumberCpc" item="item" separator="or" open="(" close=")">
  198. <if test="params.queryClassNumberCpcMethod == 1">
  199. left(q2.code, 1)
  200. </if>
  201. <if test="params.queryClassNumberCpcMethod == 2">
  202. left(q2.code, 3)
  203. </if>
  204. <if test="params.queryClassNumberCpcMethod == 3">
  205. left(q2.code, 4)
  206. </if>
  207. <if test="params.queryClassNumberCpcMethod == 4">
  208. substring_index(q2.code, '/', 1)
  209. </if>
  210. <if test="params.queryClassNumberCpcMethod == 5">
  211. q2.code
  212. </if>
  213. = #{item}
  214. </foreach>
  215. </if>
  216. <if test="params.whereClassNumberUpc != null">
  217. and q3.type = 3 and
  218. <foreach collection="params.whereClassNumberUpc" item="item" separator="or" open="(" close=")">
  219. <if test="params.queryClassNumberUpcMethod == 1">
  220. q3.code
  221. </if>
  222. <if test="params.queryClassNumberUpcMethod == 2">
  223. substring_index(q3.code, '/', 1)
  224. </if>
  225. <if test="params.queryClassNumberUpcMethod == 3">
  226. substring_index(q3.code, '/', -1)
  227. </if>
  228. = #{item}
  229. </foreach>
  230. </if>
  231. <if test="params.whereClassNumberLoc != null">
  232. and q4.type = 4 and
  233. <foreach collection="params.whereClassNumberLoc" item="item" separator="or" open="(" close=")">
  234. <if test="params.queryClassNumberLocMethod == 1">
  235. q4.code
  236. </if>
  237. <if test="params.queryClassNumberLocMethod == 2">
  238. substring_index(q4.code, '/', 1)
  239. </if>
  240. <if test="params.queryClassNumberLocMethod == 3">
  241. substring_index(q4.code, '/', -1)
  242. </if>
  243. = #{item}
  244. </foreach>
  245. </if>
  246. <if test="params.whereApplicantOriginal != null">
  247. and e.applicantid in
  248. <foreach collection="params.whereApplicantOriginal" item="item" separator="," open="(" close=")">
  249. #{item}
  250. </foreach>
  251. </if>
  252. <if test="params.whereApplicantCurrent != null">
  253. and f.applicantid in
  254. <foreach collection="params.whereApplicantCurrent" item="item" separator="," open="(" close=")">
  255. #{item}
  256. </foreach>
  257. </if>
  258. <if test="params.whereInventor != null">
  259. and g1.id in
  260. <foreach collection="params.whereInventor" item="item" separator="," open="(" close=")">
  261. #{item}
  262. </foreach>
  263. </if>
  264. <if test="params.whereInventorMerge != null">
  265. and (
  266. g2.merge_id in
  267. <foreach collection="params.whereInventorMerge" item="item" separator="," open="(" close=")">
  268. #{item}
  269. </foreach>
  270. or
  271. g.fid in
  272. <foreach collection="params.whereInventorMerge" item="item" separator="," open="(" close=")">
  273. #{item}
  274. </foreach>
  275. )
  276. </if>
  277. <if test="params.whereApplicantOriginalStandard != null">
  278. and h1.bname in
  279. <foreach collection="params.whereApplicantOriginalStandard" item="item" separator="," open="("
  280. close=")">
  281. #{item}
  282. </foreach>
  283. </if>
  284. <if test="params.whereApplicantCurrentStandard != null">
  285. and i1.bname in
  286. <foreach collection="params.whereApplicantCurrentStandard" item="item" separator="," open="(" close=")">
  287. #{item}
  288. </foreach>
  289. </if>
  290. <if test="params.whereApplicantOriginalMerge != null">
  291. and (
  292. j.mergeid in
  293. <foreach collection="params.whereApplicantOriginalMerge" item="item" separator="," open="(" close=")">
  294. #{item}
  295. </foreach>
  296. or
  297. e.applicantid in
  298. <foreach collection="params.whereApplicantOriginalMerge" item="item" separator="," open="(" close=")">
  299. #{item}
  300. </foreach>
  301. )
  302. </if>
  303. <if test="params.whereApplicantCurrentMerge != null">
  304. and (
  305. k.mergeid in
  306. <foreach collection="params.whereApplicantCurrentMerge" item="item" separator="," open="(" close=")">
  307. #{item}
  308. </foreach>
  309. or
  310. f.applicantid in
  311. <foreach collection="params.whereApplicantCurrentMerge" item="item" separator="," open="(" close=")">
  312. #{item}
  313. </foreach>
  314. )
  315. </if>
  316. <if test="params.whereBureau != null">
  317. and a.bureau in
  318. <foreach collection="params.whereBureau" item="item" separator="," open="(" close=")">
  319. #{item}
  320. </foreach>
  321. </if>
  322. <if test="params.whereType != null">
  323. and a.type in
  324. <foreach collection="params.whereType" item="item" separator="," open="(" close=")">
  325. #{item}
  326. </foreach>
  327. </if>
  328. <if test="params.whereStatus != null">
  329. and a.status in
  330. <foreach collection="params.whereStatus" item="item" separator="," open="(" close=")">
  331. #{item}
  332. </foreach>
  333. </if>
  334. <if test="params.whereAppDate != null">
  335. and from_unixtime(a.appdate, '%Y') in
  336. <foreach collection="params.whereAppDate" item="item" separator="," open="(" close=")">
  337. #{item}
  338. </foreach>
  339. </if>
  340. <if test="params.wherePublicDate != null">
  341. and from_unixtime(a.publicdate, '%Y') in
  342. <foreach collection="params.wherePublicDate" item="item" separator="," open="(" close=")">
  343. #{item}
  344. </foreach>
  345. </if>
  346. <if test="params.whereCountry != null">
  347. and o.country in
  348. <foreach collection="params.whereCountry" item="item" separator="," open="(" close=")">
  349. #{item}
  350. </foreach>
  351. </if>
  352. <if test="params.whereApplicantProvince != null">
  353. and o.province_id in
  354. <foreach collection="params.whereApplicantProvince" item="item" separator="," open="(" close=")">
  355. #{item}
  356. </foreach>
  357. </if>
  358. <if test="params.whereAffair != null">
  359. and p.status REGEXP #{params.whereAffair}
  360. </if>
  361. <if test="params.whereLabel != null">
  362. and d.tagname in
  363. <foreach collection="params.whereLabel" item="item" separator="," open="(" close=")">
  364. #{item}
  365. </foreach>
  366. </if>
  367. <if test="params.selfField != null and params.selfField.size()>0">
  368. and
  369. <foreach collection="params.selfField" item="item" separator=" and " open="(" close=")">
  370. a.id in (
  371. select distinct a3.id from os_patent a3 left join os_patent_field_patent_link a4
  372. on a4.pid = a3.id
  373. and a4.cid=#{item.key}
  374. <where>
  375. a4.fid in
  376. <foreach collection="item.value" item="item2" separator="," open="(" close=")">
  377. #{item2}
  378. </foreach>
  379. <if test="item.isnull==true">
  380. or a4.id is null
  381. </if>
  382. </where>
  383. )
  384. </foreach>
  385. </if>
  386. </where>
  387. group by a.id
  388. order by
  389. <if test="params.sort.prop == 'id'">a.id</if>
  390. <if test="params.sort.prop == 'name'">a.name</if>
  391. <if test="params.sort.prop == 'patentNo'">a.patentno</if>
  392. <if test="params.sort.prop == 'applicationNo'">a.applicationno</if>
  393. <if test="params.sort.prop == 'applicationDate'">a.appdate</if>
  394. <if test="params.sort.prop == 'publicDate'">a.publicdate</if>
  395. <if test="params.sort.prop == 'publicAccreditDate'">a.publictodate</if>
  396. <if test="params.sort.prop == 'rightNum'">a.num2</if>
  397. <if test="params.sort.prop == 'quoteNum'">a.quoteno</if>
  398. <if test="params.sort.prop == 'quotedNum'">a.quotedno</if>
  399. ${params.sort.order}
  400. </select>
  401. <select id="getPatentQuerySourcePageList" parameterType="cn.cslg.pas.common.model.vo.PatentQueryFieldSourceVO"
  402. resultType="cn.cslg.pas.common.model.dto.PatentQueryFieldSourceDTO">
  403. <if test="params.key == '41-1'">
  404. <include refid="Patent_Query_Source_Base_Select">
  405. <property name="label" value="a.publicno"/>
  406. <property name="count" value="distinct a.publicno"/>
  407. <property name="value" value="a.publicno"/>
  408. </include>
  409. <include refid="Patent_Query_Source_Base_Where">
  410. <property name="label" value="a.publicno"/>
  411. </include>
  412. <include refid="Patent_Query_Source_Base_Group">
  413. <property name="groupBy" value="a.publicno"/>
  414. <property name="orderBy" value="count"/>
  415. </include>
  416. </if>
  417. <if test="params.key == '41-2'">
  418. <include refid="Patent_Query_Source_Base_Select">
  419. <property name="label" value="a.applicationno"/>
  420. <property name="count" value="distinct a.applicationno"/>
  421. <property name="value" value="a.applicationno"/>
  422. </include>
  423. <include refid="Patent_Query_Source_Base_Where">
  424. <property name="label" value="a.applicationno"/>
  425. </include>
  426. <include refid="Patent_Query_Source_Base_Group">
  427. <property name="groupBy" value="a.applicationno"/>
  428. <property name="orderBy" value="count"/>
  429. </include>
  430. </if>
  431. <if test="params.key == '18-6' or params.key == '19-6' or params.key == '23-6' or params.key == '24-6'">
  432. <include refid="Patent_Query_Source_Base_Select">
  433. <property name="label" value="e.name"/>
  434. <property name="count" value="distinct d.pid"/>
  435. <property name="value" value="e.id"/>
  436. </include>
  437. left join os_applicant_attr d on d.pid = a.id and d.type = #{params.applicantType}
  438. left join os_patent_applicant e on e.id = d.applicantid
  439. <include refid="Patent_Query_Source_Base_Where">
  440. <property name="label" value="e.name"/>
  441. </include>
  442. and e.name is not null
  443. <if test="params.key == '23-6' or params.key == '24-6'">
  444. and d.order = 0
  445. </if>
  446. <include refid="Patent_Query_Source_Base_Group">
  447. <property name="groupBy" value="d.applicantid"/>
  448. <property name="orderBy" value="count"/>
  449. </include>
  450. </if>
  451. <if test="params.key == '18-7' or params.key == '19-7' or params.key == '23-7' or params.key == '24-7'">
  452. <include refid="Patent_Query_Source_Base_Select">
  453. <property name="label" value="e.bname"/>
  454. <property name="count" value="distinct d.pid"/>
  455. <property name="value" value="e.bname"/>
  456. </include>
  457. left join os_applicant_attr d on d.pid = a.id and d.type = #{params.applicantType}
  458. left join os_patent_applicant e on e.id = d.applicantid
  459. <include refid="Patent_Query_Source_Base_Where">
  460. <property name="label" value="e.bname"/>
  461. </include>
  462. and e.bname is not null
  463. <if test="params.key == '23-7' or params.key == '24-7'">
  464. and d.order = 0
  465. </if>
  466. <include refid="Patent_Query_Source_Base_Group">
  467. <property name="groupBy" value="e.bname"/>
  468. <property name="orderBy" value="count"/>
  469. </include>
  470. </if>
  471. <if test="params.key == '20-0'">
  472. <include refid="Patent_Query_Source_Base_Select">
  473. <property name="label" value="e.name"/>
  474. <property name="count" value="distinct d.pid"/>
  475. <property name="value" value="e.id"/>
  476. </include>
  477. left join os_patent_inventor_relation d on d.pid = a.id
  478. left join os_patent_inventor e on e.id = d.fid
  479. <include refid="Patent_Query_Source_Base_Where">
  480. <property name="label" value="e.name"/>
  481. </include>
  482. and e.name is not null
  483. <include refid="Patent_Query_Source_Base_Group">
  484. <property name="groupBy" value="d.fid"/>
  485. <property name="orderBy" value="count"/>
  486. </include>
  487. </if>
  488. <if test="params.key == '20-1'">
  489. select temp.* from ((
  490. <include refid="Patent_Query_Source_Base_Select">
  491. <property name="label" value="e.name"/>
  492. <property name="count" value="distinct d.pid"/>
  493. <property name="value" value="e.id"/>
  494. </include>
  495. left join os_patent_inventor_relation d on d.pid = a.id
  496. left join os_patent_inventor e on e.id = d.fid
  497. <include refid="Patent_Query_Source_Base_Where">
  498. <property name="label" value="e.name"/>
  499. </include>
  500. and e.name is not null
  501. and e.id not in (select inventor_id from os_patent_inventor_merge where project_id = b.zid)
  502. group by d.fid
  503. ) union all (
  504. <include refid="Patent_Query_Source_Base_Select">
  505. <property name="label" value="e.name"/>
  506. <property name="count" value="distinct d.pid"/>
  507. <property name="value" value="e.id"/>
  508. </include>
  509. left join os_patent_inventor_relation d on d.pid = a.id
  510. left join os_patent_inventor_merge e1 on e1.inventor_id = d.fid
  511. left join os_patent_inventor e on e.id = e1.merge_id
  512. <include refid="Patent_Query_Source_Base_Where">
  513. <property name="label" value="e.name"/>
  514. </include>
  515. and e.name is not null
  516. and e.project_id = b.zid
  517. group by e.id
  518. )) as temp where 1 = 1 order by `count` desc, `value` asc
  519. </if>
  520. <if test="params.key == '21-0'">
  521. <include refid="Patent_Query_Source_Base_Select">
  522. <property name="label" value="x.name"/>
  523. <property name="count" value="distinct a.id"/>
  524. <property name="value" value="x.id"/>
  525. </include>
  526. left join os_patent_agency x on x.id = a.agencyid
  527. <include refid="Patent_Query_Source_Base_Where">
  528. <property name="label" value="x.name"/>
  529. </include>
  530. and a.agencyid is not null
  531. <include refid="Patent_Query_Source_Base_Group">
  532. <property name="groupBy" value="a.agencyid"/>
  533. <property name="orderBy" value="count"/>
  534. </include>
  535. </if>
  536. <if test="params.key == '22-0'">
  537. <include refid="Patent_Query_Source_Base_Select">
  538. <property name="label" value="x2.name"/>
  539. <property name="count" value="distinct a.id"/>
  540. <property name="value" value="x2.id"/>
  541. </include>
  542. left join os_patent_agent_link x1 on x1.pid = a.id
  543. left join os_patent_agent x2 on x2.id = x1.aid
  544. <include refid="Patent_Query_Source_Base_Where">
  545. <property name="label" value="x2.name"/>
  546. </include>
  547. and x2.id is not null
  548. <include refid="Patent_Query_Source_Base_Group">
  549. <property name="groupBy" value="a.agencyid"/>
  550. <property name="orderBy" value="count"/>
  551. </include>
  552. </if>
  553. <if test="params.key == '18-8' or params.key == '19-8' or params.key == '23-8' or params.key == '24-8'">
  554. select temp.* from ((
  555. <include refid="Patent_Query_Source_Base_Select">
  556. <property name="label" value="e.name"/>
  557. <property name="count" value="distinct d.pid"/>
  558. <property name="value" value="e.id"/>
  559. </include>
  560. left join os_applicant_attr d on d.pid = a.id and d.type = #{params.applicantType}
  561. left join os_patent_applicant e on e.id = d.applicantid
  562. <include refid="Patent_Query_Source_Base_Where">
  563. <property name="label" value="e.name"/>
  564. </include>
  565. and e.id not in (select applicantid from os_associate_applicant where tid = b.zid) and e.name is not null
  566. <if test="params.key == '23-8' or params.key == '24-8'">
  567. and d.order = 0
  568. </if>
  569. group by e.id
  570. ) union all (
  571. <include refid="Patent_Query_Source_Base_Select">
  572. <property name="label" value="e.name"/>
  573. <property name="count" value="distinct d.pid"/>
  574. <property name="value" value="e.id"/>
  575. </include>
  576. left join os_applicant_attr d on d.pid = a.id and d.type = #{params.applicantType}
  577. left join os_associate_applicant f on f.applicantid = d.applicantid
  578. left join os_patent_applicant e on e.id = f.mergeid
  579. <include refid="Patent_Query_Source_Base_Where">
  580. <property name="label" value="e.name"/>
  581. </include>
  582. and e.name is not null and e.project_id = b.zid
  583. <if test="params.key == '23-8' or params.key == '24-8'">
  584. and d.order = 0
  585. </if>
  586. group by e.id
  587. )) as temp where 1 = 1 order by `count` desc, `value` asc
  588. </if>
  589. <if test="params.key == '13-1'">
  590. <include refid="Patent_Query_Source_Base_Select">
  591. <property name="label" value="left(d.code, 1)"/>
  592. <property name="count" value="distinct d.pid"/>
  593. <property name="value" value="left(d.code, 1)"/>
  594. </include>
  595. left join os_patent_typeno d on d.pid = a.id
  596. <include refid="Patent_Query_Source_Base_Where">
  597. <property name="label" value="left(d.code, 1)"/>
  598. </include>
  599. and d.type = 1
  600. <include refid="Patent_Query_Source_Base_Group">
  601. <property name="groupBy" value="left(d.code, 1)"/>
  602. <property name="orderBy" value="count"/>
  603. </include>
  604. </if>
  605. <if test="params.key == '13-2'">
  606. <include refid="Patent_Query_Source_Base_Select">
  607. <property name="label" value="left(d.code, 3)"/>
  608. <property name="count" value="distinct d.pid"/>
  609. <property name="value" value="left(d.code, 3)"/>
  610. </include>
  611. left join os_patent_typeno d on d.pid = a.id
  612. <include refid="Patent_Query_Source_Base_Where">
  613. <property name="label" value="left(d.code, 3)"/>
  614. </include>
  615. and d.type = 1
  616. <include refid="Patent_Query_Source_Base_Group">
  617. <property name="groupBy" value="left(d.code, 3)"/>
  618. <property name="orderBy" value="count"/>
  619. </include>
  620. </if>
  621. <if test="params.key == '13-3'">
  622. <include refid="Patent_Query_Source_Base_Select">
  623. <property name="label" value="left(d.code, 4)"/>
  624. <property name="count" value="distinct d.pid"/>
  625. <property name="value" value="left(d.code, 4)"/>
  626. </include>
  627. left join os_patent_typeno d on d.pid = a.id
  628. <include refid="Patent_Query_Source_Base_Where">
  629. <property name="label" value="left(d.code, 4)"/>
  630. </include>
  631. and d.type = 1
  632. <include refid="Patent_Query_Source_Base_Group">
  633. <property name="groupBy" value="left(d.code, 4)"/>
  634. <property name="orderBy" value="count"/>
  635. </include>
  636. </if>
  637. <if test="params.key == '13-4'">
  638. <include refid="Patent_Query_Source_Base_Select">
  639. <property name="label" value="substring_index(d.code, '/', 1)"/>
  640. <property name="count" value="distinct d.pid"/>
  641. <property name="value" value="substring_index(d.code, '/', 1)"/>
  642. </include>
  643. left join os_patent_typeno d on d.pid = a.id
  644. <include refid="Patent_Query_Source_Base_Where">
  645. <property name="label" value="substring_index(d.code, '/', 1)"/>
  646. </include>
  647. and d.type = 1
  648. <include refid="Patent_Query_Source_Base_Group">
  649. <property name="groupBy" value="substring_index(d.code, '/', 1)"/>
  650. <property name="orderBy" value="count"/>
  651. </include>
  652. </if>
  653. <if test="params.key == '13-5'">
  654. <include refid="Patent_Query_Source_Base_Select">
  655. <property name="label" value="d.code"/>
  656. <property name="count" value="distinct d.pid"/>
  657. <property name="value" value="d.code"/>
  658. </include>
  659. left join os_patent_typeno d on d.pid = a.id
  660. <include refid="Patent_Query_Source_Base_Where">
  661. <property name="label" value="d.code"/>
  662. </include>
  663. and d.type = 1
  664. <include refid="Patent_Query_Source_Base_Group">
  665. <property name="groupBy" value="d.code"/>
  666. <property name="orderBy" value="count"/>
  667. </include>
  668. </if>
  669. <if test="params.key == '14-1'">
  670. <include refid="Patent_Query_Source_Base_Select">
  671. <property name="label" value="left(d.code, 1)"/>
  672. <property name="count" value="distinct d.pid"/>
  673. <property name="value" value="left(d.code, 1)"/>
  674. </include>
  675. left join os_patent_typeno d on d.pid = a.id
  676. <include refid="Patent_Query_Source_Base_Where">
  677. <property name="label" value="left(d.code, 1)"/>
  678. </include>
  679. and d.type = 1 and d.main = 1
  680. <include refid="Patent_Query_Source_Base_Group">
  681. <property name="groupBy" value="left(d.code, 1)"/>
  682. <property name="orderBy" value="count"/>
  683. </include>
  684. </if>
  685. <if test="params.key == '14-2'">
  686. <include refid="Patent_Query_Source_Base_Select">
  687. <property name="label" value="left(d.code, 3)"/>
  688. <property name="count" value="distinct d.pid"/>
  689. <property name="value" value="left(d.code, 3)"/>
  690. </include>
  691. left join os_patent_typeno d on d.pid = a.id
  692. <include refid="Patent_Query_Source_Base_Where">
  693. <property name="label" value="left(d.code, 3)"/>
  694. </include>
  695. and d.type = 1 and d.main = 1
  696. <include refid="Patent_Query_Source_Base_Group">
  697. <property name="groupBy" value="left(d.code, 3)"/>
  698. <property name="orderBy" value="count"/>
  699. </include>
  700. </if>
  701. <if test="params.key == '14-3'">
  702. <include refid="Patent_Query_Source_Base_Select">
  703. <property name="label" value="left(d.code, 4)"/>
  704. <property name="count" value="distinct d.pid"/>
  705. <property name="value" value="left(d.code, 4)"/>
  706. </include>
  707. left join os_patent_typeno d on d.pid = a.id
  708. <include refid="Patent_Query_Source_Base_Where">
  709. <property name="label" value="left(d.code, 4)"/>
  710. </include>
  711. and d.type = 1 and d.main = 1
  712. <include refid="Patent_Query_Source_Base_Group">
  713. <property name="groupBy" value="left(d.code, 4)"/>
  714. <property name="orderBy" value="count"/>
  715. </include>
  716. </if>
  717. <if test="params.key == '14-4'">
  718. <include refid="Patent_Query_Source_Base_Select">
  719. <property name="label" value="substring_index(d.code, '/', 1)"/>
  720. <property name="count" value="distinct d.pid"/>
  721. <property name="value" value="substring_index(d.code, '/', 1)"/>
  722. </include>
  723. left join os_patent_typeno d on d.pid = a.id
  724. <include refid="Patent_Query_Source_Base_Where">
  725. <property name="label" value="substring_index(d.code, '/', 1)"/>
  726. </include>
  727. and d.type = 1 and d.main = 1
  728. <include refid="Patent_Query_Source_Base_Group">
  729. <property name="groupBy" value="substring_index(d.code, '/', 1)"/>
  730. <property name="orderBy" value="count"/>
  731. </include>
  732. </if>
  733. <if test="params.key == '14-5'">
  734. <include refid="Patent_Query_Source_Base_Select">
  735. <property name="label" value="d.code"/>
  736. <property name="count" value="distinct d.pid"/>
  737. <property name="value" value="d.code"/>
  738. </include>
  739. left join os_patent_typeno d on d.pid = a.id
  740. <include refid="Patent_Query_Source_Base_Where">
  741. <property name="label" value="d.code"/>
  742. </include>
  743. and d.type = 1 and d.main = 1
  744. <include refid="Patent_Query_Source_Base_Group">
  745. <property name="groupBy" value="d.code"/>
  746. <property name="orderBy" value="count"/>
  747. </include>
  748. </if>
  749. <if test="params.key == '15-1'">
  750. <include refid="Patent_Query_Source_Base_Select">
  751. <property name="label" value="left(d.code, 1)"/>
  752. <property name="count" value="distinct d.pid"/>
  753. <property name="value" value="left(d.code, 1)"/>
  754. </include>
  755. left join os_patent_typeno d on d.pid = a.id
  756. <include refid="Patent_Query_Source_Base_Where">
  757. <property name="label" value="left(d.code, 1)"/>
  758. </include>
  759. and d.type = 2
  760. <include refid="Patent_Query_Source_Base_Group">
  761. <property name="groupBy" value="left(d.code, 1)"/>
  762. <property name="orderBy" value="count"/>
  763. </include>
  764. </if>
  765. <if test="params.key == '15-2'">
  766. <include refid="Patent_Query_Source_Base_Select">
  767. <property name="label" value="left(d.code, 3)"/>
  768. <property name="count" value="distinct d.pid"/>
  769. <property name="value" value="left(d.code, 3)"/>
  770. </include>
  771. left join os_patent_typeno d on d.pid = a.id
  772. <include refid="Patent_Query_Source_Base_Where">
  773. <property name="label" value="left(d.code, 3)"/>
  774. </include>
  775. and d.type = 2
  776. <include refid="Patent_Query_Source_Base_Group">
  777. <property name="groupBy" value="left(d.code, 3)"/>
  778. <property name="orderBy" value="count"/>
  779. </include>
  780. </if>
  781. <if test="params.key == '15-3'">
  782. <include refid="Patent_Query_Source_Base_Select">
  783. <property name="label" value="left(d.code, 4)"/>
  784. <property name="count" value="distinct d.pid"/>
  785. <property name="value" value="left(d.code, 4)"/>
  786. </include>
  787. left join os_patent_typeno d on d.pid = a.id
  788. <include refid="Patent_Query_Source_Base_Where">
  789. <property name="label" value="left(d.code, 4)"/>
  790. </include>
  791. and d.type = 2
  792. <include refid="Patent_Query_Source_Base_Group">
  793. <property name="groupBy" value="left(d.code, 4)"/>
  794. <property name="orderBy" value="count"/>
  795. </include>
  796. </if>
  797. <if test="params.key == '15-4'">
  798. <include refid="Patent_Query_Source_Base_Select">
  799. <property name="label" value="substring_index(d.code, '/', 1)"/>
  800. <property name="count" value="distinct d.pid"/>
  801. <property name="value" value="substring_index(d.code, '/', 1)"/>
  802. </include>
  803. left join os_patent_typeno d on d.pid = a.id
  804. <include refid="Patent_Query_Source_Base_Where">
  805. <property name="label" value="substring_index(d.code, '/', 1)"/>
  806. </include>
  807. and d.type = 2
  808. <include refid="Patent_Query_Source_Base_Group">
  809. <property name="groupBy" value="substring_index(d.code, '/', 1)"/>
  810. <property name="orderBy" value="count"/>
  811. </include>
  812. </if>
  813. <if test="params.key == '15-5'">
  814. <include refid="Patent_Query_Source_Base_Select">
  815. <property name="label" value="d.code"/>
  816. <property name="count" value="distinct d.pid"/>
  817. <property name="value" value="d.code"/>
  818. </include>
  819. left join os_patent_typeno d on d.pid = a.id
  820. <include refid="Patent_Query_Source_Base_Where">
  821. <property name="label" value="d.code"/>
  822. </include>
  823. and d.type = 2
  824. <include refid="Patent_Query_Source_Base_Group">
  825. <property name="groupBy" value="d.code"/>
  826. <property name="orderBy" value="count"/>
  827. </include>
  828. </if>
  829. <if test="params.key == '17-1'">
  830. <include refid="Patent_Query_Source_Base_Select">
  831. <property name="label" value="d.code"/>
  832. <property name="count" value="distinct d.pid"/>
  833. <property name="value" value="d.code"/>
  834. </include>
  835. left join os_patent_typeno d on d.pid = a.id
  836. <include refid="Patent_Query_Source_Base_Where">
  837. <property name="label" value="d.code"/>
  838. </include>
  839. and d.type = 3
  840. <include refid="Patent_Query_Source_Base_Group">
  841. <property name="groupBy" value="d.code"/>
  842. <property name="orderBy" value="count"/>
  843. </include>
  844. </if>
  845. <if test="params.key == '17-2'">
  846. <include refid="Patent_Query_Source_Base_Select">
  847. <property name="label" value="substring_index(d.code, '/', 1)"/>
  848. <property name="count" value="distinct d.pid"/>
  849. <property name="value" value="substring_index(d.code, '/', 1)"/>
  850. </include>
  851. left join os_patent_typeno d on d.pid = a.id
  852. <include refid="Patent_Query_Source_Base_Where">
  853. <property name="label" value="substring_index(d.code, '/', 1)"/>
  854. </include>
  855. and d.type = 3
  856. <include refid="Patent_Query_Source_Base_Group">
  857. <property name="groupBy" value="substring_index(d.code, '/', 1)"/>
  858. <property name="orderBy" value="count"/>
  859. </include>
  860. </if>
  861. <if test="params.key == '17-3'">
  862. <include refid="Patent_Query_Source_Base_Select">
  863. <property name="label" value="substring_index(d.code, '/', -1)"/>
  864. <property name="count" value="distinct d.pid"/>
  865. <property name="value" value="substring_index(d.code, '/', -1)"/>
  866. </include>
  867. left join os_patent_typeno d on d.pid = a.id
  868. <include refid="Patent_Query_Source_Base_Where">
  869. <property name="label" value="substring_index(d.code, '/', -1)"/>
  870. </include>
  871. and d.type = 3
  872. <include refid="Patent_Query_Source_Base_Group">
  873. <property name="groupBy" value="substring_index(d.code, '/', -1)"/>
  874. <property name="orderBy" value="count"/>
  875. </include>
  876. </if>
  877. <if test="params.key == '16-1'">
  878. <include refid="Patent_Query_Source_Base_Select">
  879. <property name="label" value="d.code"/>
  880. <property name="count" value="distinct d.pid"/>
  881. <property name="value" value="d.code"/>
  882. </include>
  883. left join os_patent_typeno d on d.pid = a.id
  884. <include refid="Patent_Query_Source_Base_Where">
  885. <property name="label" value="d.code"/>
  886. </include>
  887. and d.type = 4
  888. <include refid="Patent_Query_Source_Base_Group">
  889. <property name="groupBy" value="d.code"/>
  890. <property name="orderBy" value="count"/>
  891. </include>
  892. </if>
  893. <if test="params.key == '16-2'">
  894. <include refid="Patent_Query_Source_Base_Select">
  895. <property name="label" value="substring_index(d.code, '-', 1)"/>
  896. <property name="count" value="distinct d.pid"/>
  897. <property name="value" value="substring_index(d.code, '-', 1)"/>
  898. </include>
  899. left join os_patent_typeno d on d.pid = a.id
  900. <include refid="Patent_Query_Source_Base_Where">
  901. <property name="label" value="substring_index(d.code, '-', 1)"/>
  902. </include>
  903. and d.type = 4
  904. <include refid="Patent_Query_Source_Base_Group">
  905. <property name="groupBy" value="substring_index(d.code, '-', 1)"/>
  906. <property name="orderBy" value="count"/>
  907. </include>
  908. </if>
  909. <if test="params.key == '16-3'">
  910. <include refid="Patent_Query_Source_Base_Select">
  911. <property name="label" value="substring_index(d.code, '-', -1)"/>
  912. <property name="count" value="distinct d.pid"/>
  913. <property name="value" value="substring_index(d.code, '-', -1)"/>
  914. </include>
  915. left join os_patent_typeno d on d.pid = a.id
  916. <include refid="Patent_Query_Source_Base_Where">
  917. <property name="label" value="substring_index(d.code, '-', -1)"/>
  918. </include>
  919. and d.type = 4
  920. <include refid="Patent_Query_Source_Base_Group">
  921. <property name="groupBy" value="substring_index(d.code, '-', -1)"/>
  922. <property name="orderBy" value="count"/>
  923. </include>
  924. </if>
  925. <if test="params.key == '25-12'">
  926. <include refid="Patent_Query_Source_Base_Select">
  927. <property name="label" value="from_unixtime(a.appdate, '%Y')"/>
  928. <property name="count" value="distinct a.id"/>
  929. <property name="value" value="from_unixtime(a.appdate, '%Y')"/>
  930. </include>
  931. <include refid="Patent_Query_Source_Base_Where">
  932. <property name="label" value="from_unixtime(a.appdate, '%Y')"/>
  933. </include>
  934. and a.appdate > 0
  935. <if test="params.startDate != '' and params.endDate != '' and params.startDate != null and params.endDate != null">
  936. and from_unixtime(a.appdate, '%Y') between #{params.startDate} and #{params.endDate}
  937. </if>
  938. <include refid="Patent_Query_Source_Base_Group">
  939. <property name="groupBy" value="from_unixtime(a.appdate, '%Y')"/>
  940. <property name="orderBy" value="label"/>
  941. </include>
  942. </if>
  943. <if test="params.key == '28-0'">
  944. <include refid="Patent_Query_Source_Base_Select">
  945. <property name="label" value="a.bureau"/>
  946. <property name="count" value="distinct a.id"/>
  947. <property name="value" value="a.bureau"/>
  948. </include>
  949. <include refid="Patent_Query_Source_Base_Where">
  950. <property name="label" value="a.bureau"/>
  951. </include>
  952. and (a.bureau is not null or a.bureau != '')
  953. <include refid="Patent_Query_Source_Base_Group">
  954. <property name="groupBy" value="a.bureau"/>
  955. <property name="orderBy" value="count"/>
  956. </include>
  957. </if>
  958. <if test="params.key == '37-0'">
  959. <include refid="Patent_Query_Source_Base_Select">
  960. <property name="label" value="c1.label"/>
  961. <property name="count" value="distinct a.id"/>
  962. <property name="value" value="a.type"/>
  963. </include>
  964. left join os_system_dict c1 on a.type = c1.value and c1.type = 'PATENT_TYPE'
  965. <include refid="Patent_Query_Source_Base_Where">
  966. <property name="label" value="c1.label"/>
  967. </include>
  968. and c1.label is not null
  969. <include refid="Patent_Query_Source_Base_Group">
  970. <property name="groupBy" value="a.type"/>
  971. <property name="orderBy" value="count"/>
  972. </include>
  973. </if>
  974. <if test="params.key == '36-0'">
  975. <include refid="Patent_Query_Source_Base_Select">
  976. <property name="label" value="c1.label"/>
  977. <property name="count" value="distinct a.id"/>
  978. <property name="value" value="a.status"/>
  979. </include>
  980. left join os_system_dict c1 on a.status = c1.value and c1.type = 'PATENT_SIMPLE_STATUS'
  981. <include refid="Patent_Query_Source_Base_Where">
  982. <property name="label" value="c1.label"/>
  983. </include>
  984. and c1.label is not null
  985. <include refid="Patent_Query_Source_Base_Group">
  986. <property name="groupBy" value="a.status"/>
  987. <property name="orderBy" value="count"/>
  988. </include>
  989. </if>
  990. <if test="params.key == '29-17' or params.key == '30-17'">
  991. <include refid="Patent_Query_Source_Base_Select">
  992. <property name="label" value="f.label"/>
  993. <property name="count" value="distinct a.id"/>
  994. <property name="value" value="f.value"/>
  995. </include>
  996. left join os_applicant_attr c1 on c1.pid = a.id and c1.type = #{params.applicantType}
  997. left join os_patent_applicant e on e.id = c1.applicantid
  998. left join os_system_dict f on e.country = f.value and f.type = 'COUNTRIES'
  999. <include refid="Patent_Query_Source_Base_Where">
  1000. <property name="label" value="f.label"/>
  1001. </include>
  1002. and f.value is not null
  1003. <include refid="Patent_Query_Source_Base_Group">
  1004. <property name="groupBy" value="e.country"/>
  1005. <property name="orderBy" value="count"/>
  1006. </include>
  1007. </if>
  1008. <if test="params.key == '29-18' or params.key == '30-18'">
  1009. <include refid="Patent_Query_Source_Base_Select">
  1010. <property name="label" value="f.name"/>
  1011. <property name="count" value="distinct a.id"/>
  1012. <property name="value" value="f.id"/>
  1013. </include>
  1014. left join os_applicant_attr c1 on c1.pid = a.id and c1.type = #{params.applicantType}
  1015. left join os_patent_applicant e on e.id = c1.applicantid
  1016. left join os_area f on e.province_id = f.id
  1017. <include refid="Patent_Query_Source_Base_Where">
  1018. <property name="label" value="f.name"/>
  1019. </include>
  1020. and f.id is not null
  1021. <include refid="Patent_Query_Source_Base_Group">
  1022. <property name="groupBy" value="e.province_id"/>
  1023. <property name="orderBy" value="count"/>
  1024. </include>
  1025. </if>
  1026. <if test="params.key == '29-19' or params.key == '30-19'">
  1027. <include refid="Patent_Query_Source_Base_Select">
  1028. <property name="label" value="f.name"/>
  1029. <property name="count" value="distinct a.id"/>
  1030. <property name="value" value="f.id"/>
  1031. </include>
  1032. left join os_applicant_attr c1 on c1.pid = a.id and c1.type = #{params.applicantType}
  1033. left join os_patent_applicant e on e.id = c1.applicantid
  1034. left join os_area f on e.city_id = f.id
  1035. <include refid="Patent_Query_Source_Base_Where">
  1036. <property name="label" value="f.name"/>
  1037. </include>
  1038. and f.id is not null
  1039. <include refid="Patent_Query_Source_Base_Group">
  1040. <property name="groupBy" value="e.city_id"/>
  1041. <property name="orderBy" value="count"/>
  1042. </include>
  1043. </if>
  1044. <if test="params.key == '29-20' or params.key == '30-20'">
  1045. <include refid="Patent_Query_Source_Base_Select">
  1046. <property name="label" value="f.name"/>
  1047. <property name="count" value="distinct a.id"/>
  1048. <property name="value" value="f.id"/>
  1049. </include>
  1050. left join os_applicant_attr c1 on c1.pid = a.id and c1.type = #{params.applicantType}
  1051. left join os_patent_applicant e on e.id = c1.applicantid
  1052. left join os_area f on e.area_id = f.id
  1053. <include refid="Patent_Query_Source_Base_Where">
  1054. <property name="label" value="f.name"/>
  1055. </include>
  1056. and f.id is not null
  1057. <include refid="Patent_Query_Source_Base_Group">
  1058. <property name="groupBy" value="e.area_id"/>
  1059. <property name="orderBy" value="count"/>
  1060. </include>
  1061. </if>
  1062. <if test="params.key == '31-0'">
  1063. <include refid="Patent_Query_Source_Base_Select">
  1064. <property name="label" value="f.label"/>
  1065. <property name="count" value="distinct a.id"/>
  1066. <property name="value" value="f.value"/>
  1067. </include>
  1068. left join os_system_dict f on a.prioritycountry = f.value and f.type = 'COUNTRIES'
  1069. <include refid="Patent_Query_Source_Base_Where">
  1070. <property name="label" value="f.label"/>
  1071. </include>
  1072. and f.value is not null
  1073. <include refid="Patent_Query_Source_Base_Group">
  1074. <property name="groupBy" value="a.prioritycountry"/>
  1075. <property name="orderBy" value="count"/>
  1076. </include>
  1077. </if>
  1078. <if test="params.key == '26-12'">
  1079. <include refid="Patent_Query_Source_Base_Select">
  1080. <property name="label" value="from_unixtime(a.publicdate, '%Y')"/>
  1081. <property name="count" value="distinct a.id"/>
  1082. <property name="value" value="from_unixtime(a.publicdate, '%Y')"/>
  1083. </include>
  1084. <include refid="Patent_Query_Source_Base_Where">
  1085. <property name="label" value="from_unixtime(a.publicdate, '%Y')"/>
  1086. </include>
  1087. and a.publicdate > 0
  1088. <if test="params.startDate != '' and params.endDate != '' and params.startDate != null and params.endDate != null">
  1089. and from_unixtime(a.publicdate, '%Y') between #{params.startDate} and #{params.endDate}
  1090. </if>
  1091. <include refid="Patent_Query_Source_Base_Group">
  1092. <property name="groupBy" value="from_unixtime(a.publicdate, '%Y')"/>
  1093. <property name="orderBy" value="label"/>
  1094. </include>
  1095. </if>
  1096. <if test="params.key == '40-0'">
  1097. <include refid="Patent_Query_Source_Base_Select">
  1098. <property name="label" value="d.label"/>
  1099. <property name="count" value="distinct a.id"/>
  1100. <property name="value" value="d.value"/>
  1101. </include>
  1102. left join os_patent_affair c1 on b.pid = c1.pid
  1103. left join os_system_dict d on d.label = c1.status
  1104. <include refid="Patent_Query_Source_Base_Where">
  1105. <property name="label" value="d.label"/>
  1106. </include>
  1107. and d.value is not null
  1108. <include refid="Patent_Query_Source_Base_Group">
  1109. <property name="groupBy" value="d.value"/>
  1110. <property name="orderBy" value="count"/>
  1111. </include>
  1112. </if>
  1113. <if test="params.key == '54-0'">
  1114. <include refid="Patent_Query_Source_Base_Select">
  1115. <property name="label" value="c1.tagname"/>
  1116. <property name="count" value="distinct a.id"/>
  1117. <property name="value" value="c1.tagname"/>
  1118. </include>
  1119. left join os_patent_label c1 on b.pid = c1.pid
  1120. <include refid="Patent_Query_Source_Base_Where">
  1121. <property name="label" value="c1.tagname"/>
  1122. </include>
  1123. and c1.tid = #{params.projectId}
  1124. <include refid="Patent_Query_Source_Base_Group">
  1125. <property name="groupBy" value="c1.tagname"/>
  1126. <property name="orderBy" value="count"/>
  1127. </include>
  1128. </if>
  1129. <if test="params.type != 'query'">
  1130. select temp.* from ((
  1131. <include refid="Patent_Query_Source_Base_Select">
  1132. <property name="label" value="null"/>
  1133. <property name="count" value="a.id"/>
  1134. <property name="value" value="null"/>
  1135. </include>
  1136. <include refid="Patent_Query_Source_Base_Where">
  1137. <property name="label" value="null"/>
  1138. </include>
  1139. and a.id not in (select pid from os_patent_field_patent_link where cid = #{params.customFieldId})
  1140. ) union all (
  1141. <include refid="Patent_Query_Source_Base_Select">
  1142. <property name="label" value="d.name"/>
  1143. <property name="count" value="distinct e.pid"/>
  1144. <property name="value" value="d.id"/>
  1145. </include>
  1146. left join os_patent_field_patent_link e on e.pid = b.pid
  1147. left join os_patent_field c1 on c1.id = e.cid
  1148. <if test="params.type == 6">
  1149. left join os_patent_field_tree d on d.cid = e.cid
  1150. </if>
  1151. <if test="params.type == 0 or params.type == 1 or params.type == 2">
  1152. left join os_patent_field_text d on d.cid = e.cid and d.name is not null and d.name != ''
  1153. </if>
  1154. <if test="params.type == 3 or params.type == 4 or params.type == 5">
  1155. left join os_patent_field_multiple d on d.cid = e.cid
  1156. </if>
  1157. <include refid="Patent_Query_Source_Base_Where">
  1158. <property name="label" value="d.name"/>
  1159. </include>
  1160. and c1.id = #{params.customFieldId}
  1161. <if test="params.customFieldTreeType == 0">
  1162. and e.fid in (select id from os_patent_field_tree where cid = c1.id and find_in_set(d.id , replace(path
  1163. , '/', ',')))
  1164. </if>
  1165. <if test="params.customFieldTreeType == null">
  1166. and e.fid = d.id
  1167. </if>
  1168. group by d.id
  1169. )) as temp where 1 = 1 order by `count` desc, `value` asc
  1170. </if>
  1171. </select>
  1172. <sql id="Patent_Query_Source_Base_Select">
  1173. select ifnull(${label}, '未选择') as label, count(${count}) as `count`, ifnull(${value}, 'null') as `value`,
  1174. group_concat(distinct a.id) as ids
  1175. from os_patent a
  1176. <if test="params.folder != null and params.folder != ''">
  1177. left join os_portfolio_link b on b.pid = a.id
  1178. </if>
  1179. <if test="params.folder == null or params.folder == ''">
  1180. left join os_thematic_pid b on b.pid = a.id
  1181. </if>
  1182. </sql>
  1183. <sql id="Patent_Query_Source_Base_Where">
  1184. <where>
  1185. <if test="params.projectId != null">
  1186. and b.zid = #{params.projectId}
  1187. </if>
  1188. <if test="params.folder != '' and params.folder != null">
  1189. and b.fid = #{params.folder}
  1190. </if>
  1191. <if test="params.label != '' and params.label != null">
  1192. and ${label} like concat('%', #{params.label}, '%')
  1193. </if>
  1194. <if test="ids != null and ids.size() != 0">
  1195. and b.pid in
  1196. <foreach collection="ids" item="item" separator="," open="(" close=")">
  1197. #{item}
  1198. </foreach>
  1199. </if>
  1200. </where>
  1201. </sql>
  1202. <sql id="Patent_Query_Source_Base_Group">
  1203. group by
  1204. ${groupBy}
  1205. order
  1206. by
  1207. `${orderBy}`
  1208. desc,
  1209. `value`
  1210. asc
  1211. </sql>
  1212. <select id="getListForRMS" resultType="java.lang.String">
  1213. select DISTINCT a.patentno as patent_no
  1214. from os_patent a
  1215. <if test="params.applicationName !=null ">
  1216. left join os_applicant_attr b on a.id=b.pid and b.type =1
  1217. left join os_patent_applicant c on c.id=b.applicantid
  1218. </if>
  1219. <if test=" params.obligeeName !=null">
  1220. left join os_applicant_attr d on a.id=d.pid and d.type =2
  1221. left join os_patent_applicant e on e.id=d.applicantid
  1222. </if>
  1223. <if test="params.numberIpc!=null ">
  1224. left join os_patent_typeno f on f.pid =a.id and f.type =1
  1225. </if>
  1226. <if test=" params.numberCpc!=null ">
  1227. left join os_patent_typeno g on g.pid =a.id and g.type =2
  1228. </if>
  1229. <if test=" params.numberUpc!=null">
  1230. left join os_patent_typeno h on h.pid =a.id and h.type =3
  1231. </if>
  1232. <if test="params.projectId != null and params.pasOptions !=null and params.pasOptions.size()!=0">
  1233. left join os_thematic_pid i on i.pid=a.id left join os_patent_field_patent_link j on a.id=j.pid
  1234. </if>
  1235. <where>
  1236. <choose>
  1237. <when test="params.projectId != null or (params.patentNos != null and params.patentNos.size()!=0) or params.reportId!=null ">
  1238. <if test="params.projectId != null">
  1239. and ( a.id in (select pid from os_thematic_pid where zid = #{params.projectId})
  1240. <if test="params.patentNos != null and params.patentNos.size()!=0">
  1241. or patentno in
  1242. <foreach item="item" collection="params.patentNos" index="index" open="(" separator=","
  1243. close=")">
  1244. #{item}
  1245. </foreach>
  1246. </if>
  1247. <if test="params.reportId != null">
  1248. or patentno in
  1249. ( select PATENT_NO from ASSO_IMPORTTASK_PATENT where REPORT_ID =#{params.reportId}
  1250. )
  1251. </if>
  1252. )
  1253. </if>
  1254. <if test="params.projectId == null and params.patentNos != null and params.patentNos.size()!=0">
  1255. (patentno in
  1256. <foreach item="item" collection="params.patentNos" index="index" open="(" separator=","
  1257. close=")">
  1258. #{item}
  1259. </foreach>
  1260. <if test="params.reportId != null">
  1261. or patentno in
  1262. ( select PATENT_NO from ASSO_IMPORTTASK_PATENT where REPORT_ID =#{params.reportId}
  1263. )
  1264. </if>
  1265. )
  1266. </if>
  1267. <if test="params.projectId == null and (params.patentNos == null or params.patentNos.size()==0) and params.reportId != null">
  1268. patentno in
  1269. ( select PATENT_NO from ASSO_IMPORTTASK_PATENT where REPORT_ID =#{params.reportId}
  1270. )
  1271. </if>
  1272. <if test="params.notInPatentNos != null and params.notInPatentNos.size!=0">
  1273. and patentno not in
  1274. <foreach item="item" collection="params.notInPatentNos" index="index" open="(" separator=","
  1275. close=")">
  1276. #{item}
  1277. </foreach>
  1278. </if>
  1279. <if test="params.conPatentNos != null and params.conPatentNos.size!=0">
  1280. and patentno in
  1281. <foreach item="item" collection="params.conPatentNos" index="index" open="(" separator=","
  1282. close=")">
  1283. #{item}
  1284. </foreach>
  1285. </if>
  1286. <if test="params.applicationName !=null and params.applicationName !='' ">
  1287. and c.name REGEXP #{params.applicationName}
  1288. </if>
  1289. <if test="params.obligeeName !=null and params.obligeeName!=''">
  1290. and e.name REGEXP #{params.obligeeName}
  1291. </if>
  1292. <if test="params.numberIpc !=null and params.numberIpc!=''">
  1293. and f.code like concat("%", #{params.numberIpc}, "%")
  1294. </if>
  1295. <if test="params.numberCpc !=null and params.numberCpc!=''">
  1296. and g.code like concat("%", #{params.numberCpc}, "%")
  1297. </if>
  1298. <if test="params.numberUpc !=null and params.numberUpc!=''">
  1299. and h.code like concat("%", #{params.numberUpc}, "%")
  1300. </if>
  1301. <if test="params.patentNo !=null and params.patentNo !=''">
  1302. and a.patentNo REGEXP #{params.patentNo}
  1303. </if>
  1304. <if test="params.applicationNo !=null and params.applicationNo !=''">
  1305. and a.applicationNo like concat("%", #{params.applicationNo}, "%")
  1306. </if>
  1307. <if test="params.abstractStr !=null and params.abstractStr !=''">
  1308. and a.abstract like concat("%", #{params.abstractStr}, "%")
  1309. </if>
  1310. <if test="params.patentName !=null and params.patentName !=''">
  1311. and a.`name` like concat("%", #{params.patentName}, "%")
  1312. </if>
  1313. <if test="params.PasOptions !=null and params.PasOptions.size()!=0">
  1314. and (
  1315. <foreach item="item" collection="params.PasOptions" index="index" open="(" separator="or"
  1316. close=")">
  1317. <if test="item.key !=null">
  1318. (j.cid=#{item.fieldId} and j.fid =#{item.key})
  1319. </if>
  1320. <if test="item.key ==null">
  1321. (j.cid is null or j.cid !=#{item.fieldId})
  1322. </if>
  1323. </foreach>
  1324. )
  1325. </if>
  1326. <if test="params.orderItem!=null and params.orderItem!='SysOrder'">
  1327. order by #{params.orderItem}
  1328. <if test="params.orderType!=null">
  1329. #{params.orderType}
  1330. </if>
  1331. </if>
  1332. <if test="params.orderItem==null">
  1333. order by a.patentno
  1334. </if>
  1335. <if test="params.orderItem=='SysOrder' and params.patentNos != null and params.patentNos.size()!=0">
  1336. order by field (a.patentno,
  1337. <foreach item="item" collection="params.patentNos" index="index" open="" separator=","
  1338. close=")">
  1339. #{item}
  1340. </foreach>
  1341. </if>
  1342. <if test=" params.endNumber &gt; 0">
  1343. limit #{params.startNumber},#{params.endNumber}
  1344. </if>
  1345. </when>
  1346. <otherwise>
  1347. 1!=1
  1348. </otherwise>
  1349. </choose>
  1350. </where>
  1351. </select>
  1352. <select id="getPageListForRMS2" parameterType="cn.cslg.pas.common.model.vo.PatentVO"
  1353. resultType="cn.cslg.pas.domain.Patent">
  1354. select DISTINCT a.id, a.`name` as name, a.nameout as name_out, a.patentno as patent_no, a.abstract_path,
  1355. a.abstract as
  1356. abstract_str, a.abstractout as abstract_out,
  1357. a.publicno as public_no, a.publicdate as public_date, a.simple_family, a.inpadoc_family, a.applicationno as
  1358. application_no, a.appdate as application_date,
  1359. a.`status` as simple_status, a.type, a.publictodate as public_accredit_date, a.fpublicdate as first_public_date,
  1360. a.prioritydate as priority_date,
  1361. a.agencyid as agency_id, a.num2 as right_num, a.quoteno as quote_num, a.quotedno as quoted_num,
  1362. a.patsnap_family as patSnapFamily, a.patsnapfamilynum as patSnapFamilyNum
  1363. from os_patent a
  1364. <if test="params.applicationName !=null ">
  1365. left join os_applicant_attr b on a.id=b.pid and b.type =1
  1366. left join os_patent_applicant c on c.id=b.applicantid
  1367. </if>
  1368. <if test=" params.obligeeName !=null">
  1369. left join os_applicant_attr d on a.id=d.pid and d.type =2
  1370. left join os_patent_applicant e on e.id=d.applicantid
  1371. </if>
  1372. <if test="params.numberIpc!=null ">
  1373. left join os_patent_typeno f on f.pid =a.id and f.type =1
  1374. </if>
  1375. <if test=" params.numberCpc!=null ">
  1376. left join os_patent_typeno g on g.pid =a.id and g.type =2
  1377. </if>
  1378. <if test=" params.numberUpc!=null">
  1379. left join os_patent_typeno h on h.pid =a.id and h.type =3
  1380. </if>
  1381. <if test="params.projectId != null and params.pasOptions !=null and params.pasOptions.size()!=0">
  1382. left join os_thematic_pid i on i.pid=a.id left join os_patent_field_patent_link j on a.id=j.pid
  1383. </if>
  1384. <where>
  1385. <choose>
  1386. <when test="params.projectId != null or (params.patentNos != null and params.patentNos.size()!=0) or params.reportId!=null ">
  1387. <if test="params.projectId != null">
  1388. and ( a.id in (select pid from os_thematic_pid where zid = #{params.projectId})
  1389. <if test="params.patentNos != null and params.patentNos.size()!=0">
  1390. or patentno in
  1391. <foreach item="item" collection="params.patentNos" index="index" open="(" separator=","
  1392. close=")">
  1393. #{item}
  1394. </foreach>
  1395. </if>
  1396. <if test="params.reportId != null">
  1397. or patentno in
  1398. ( select PATENT_NO from ASSO_IMPORTTASK_PATENT where REPORT_ID =#{params.reportId}
  1399. )
  1400. </if>
  1401. )
  1402. </if>
  1403. <if test="params.projectId == null and params.patentNos != null and params.patentNos.size()!=0">
  1404. (patentno in
  1405. <foreach item="item" collection="params.patentNos" index="index" open="(" separator=","
  1406. close=")">
  1407. #{item}
  1408. </foreach>
  1409. <if test="params.reportId != null">
  1410. or patentno in
  1411. ( select PATENT_NO from ASSO_IMPORTTASK_PATENT where REPORT_ID =#{params.reportId}
  1412. )
  1413. </if>
  1414. )
  1415. </if>
  1416. <if test="params.projectId == null and (params.patentNos == null or params.patentNos.size()==0) and params.reportId != null">
  1417. patentno in
  1418. ( select PATENT_NO from ASSO_IMPORTTASK_PATENT where REPORT_ID =#{params.reportId}
  1419. )
  1420. </if>
  1421. <if test="params.notInPatentNos != null and params.notInPatentNos.size!=0">
  1422. and patentno not in
  1423. <foreach item="item" collection="params.notInPatentNos" index="index" open="(" separator=","
  1424. close=")">
  1425. #{item}
  1426. </foreach>
  1427. </if>
  1428. <if test="params.conPatentNos != null and params.conPatentNos.size!=0">
  1429. and patentno in
  1430. <foreach item="item" collection="params.conPatentNos" index="index" open="(" separator=","
  1431. close=")">
  1432. #{item}
  1433. </foreach>
  1434. </if>
  1435. <if test="params.applicationName !=null and params.applicationName !='' ">
  1436. and c.name REGEXP #{params.applicationName}
  1437. </if>
  1438. <if test="params.obligeeName !=null and params.obligeeName!=''">
  1439. and e.name REGEXP #{params.obligeeName}
  1440. </if>
  1441. <if test="params.numberIpc !=null and params.numberIpc!=''">
  1442. and f.code like concat("%", #{params.numberIpc}, "%")
  1443. </if>
  1444. <if test="params.numberCpc !=null and params.numberCpc!=''">
  1445. and g.code like concat("%", #{params.numberCpc}, "%")
  1446. </if>
  1447. <if test="params.numberUpc !=null and params.numberUpc!=''">
  1448. and h.code like concat("%", #{params.numberUpc}, "%")
  1449. </if>
  1450. <if test="params.patentNo !=null and params.patentNo !=''">
  1451. and a.patentNo REGEXP #{params.patentNo}
  1452. </if>
  1453. <if test="params.applicationNo !=null and params.applicationNo !=''">
  1454. and a.applicationNo like concat("%", #{params.applicationNo}, "%")
  1455. </if>
  1456. <if test="params.abstractStr !=null and params.abstractStr !=''">
  1457. and a.abstract like concat("%", #{params.abstractStr}, "%")
  1458. </if>
  1459. <if test="params.patentName !=null and params.patentName !=''">
  1460. and a.`name` like concat("%", #{params.patentName}, "%")
  1461. </if>
  1462. <if test="params.PasOptions !=null and params.PasOptions.size()!=0">
  1463. and (
  1464. <foreach item="item" collection="params.PasOptions" index="index" open="(" separator="or"
  1465. close=")">
  1466. <if test="item.key !=null">
  1467. (j.cid=#{item.fieldId} and j.fid =#{item.key})
  1468. </if>
  1469. <if test="item.key ==null">
  1470. (j.cid is null or j.cid !=#{item.fieldId})
  1471. </if>
  1472. </foreach>
  1473. )
  1474. </if>
  1475. <if test="params.orderItem!=null and params.orderItem!='SysOrder'">
  1476. order by #{params.orderItem}
  1477. <if test="params.orderType!=null">
  1478. #{params.orderType}
  1479. </if>
  1480. </if>
  1481. <if test="params.orderItem==null">
  1482. order by a.patentno
  1483. </if>
  1484. <if test="params.orderItem=='SysOrder' and params.patentNos != null and params.patentNos.size()!=0">
  1485. order by field (a.patentno,
  1486. <foreach item="item" collection="params.patentNos" index="index" open="" separator=","
  1487. close=")">
  1488. #{item}
  1489. </foreach>
  1490. </if>
  1491. </when>
  1492. <otherwise>
  1493. 1!=1
  1494. </otherwise>
  1495. </choose>
  1496. </where>
  1497. </select>
  1498. <select id="getConPantentNos" parameterType="cn.cslg.pas.common.model.QueryPatentVO"
  1499. resultType="java.lang.String">
  1500. select DISTINCT a.patentno as patent_no
  1501. from os_patent a
  1502. <if test="params.applicationName !=null ">
  1503. left join os_applicant_attr b on a.id=b.pid and b.type =1
  1504. left join os_patent_applicant c on c.id=b.applicantid
  1505. </if>
  1506. <if test=" params.obligeeName !=null">
  1507. left join os_applicant_attr d on a.id=d.pid and d.type =2
  1508. left join os_patent_applicant e on e.id=d.applicantid
  1509. </if>
  1510. <if test="params.numberIpc!=null ">
  1511. left join os_patent_typeno f on f.pid =a.id and f.type =1
  1512. </if>
  1513. <if test=" params.numberCpc!=null ">
  1514. left join os_patent_typeno g on g.pid =a.id and g.type =2
  1515. </if>
  1516. <if test=" params.numberUpc!=null">
  1517. left join os_patent_typeno h on h.pid =a.id and h.type =3
  1518. </if>
  1519. <where>
  1520. <choose>
  1521. <when test="params.projectId != null or (params.patentNos != null and params.patentNos.size()!=0) or params.reportId!=null ">
  1522. <if test="params.projectId != null">
  1523. and ( a.id in (select pid from os_thematic_pid where zid = #{params.projectId})
  1524. <if test="params.patentNos != null and params.patentNos.size()!=0">
  1525. or patentno in
  1526. <foreach item="item" collection="params.patentNos" index="index" open="(" separator=","
  1527. close=")">
  1528. #{item}
  1529. </foreach>
  1530. </if>
  1531. <if test="params.reportId != null">
  1532. or patentno in
  1533. ( select PATENT_NO from ASSO_IMPORTTASK_PATENT where REPORT_ID =#{params.reportId}
  1534. )
  1535. </if>
  1536. )
  1537. </if>
  1538. <if test="params.projectId == null and params.patentNos != null and params.patentNos.size()!=0">
  1539. (patentno in
  1540. <foreach item="item" collection="params.patentNos" index="index" open="(" separator=","
  1541. close=")">
  1542. #{item}
  1543. </foreach>
  1544. <if test="params.reportId != null">
  1545. or patentno in
  1546. ( select PATENT_NO from ASSO_IMPORTTASK_PATENT where REPORT_ID =#{params.reportId}
  1547. )
  1548. </if>
  1549. )
  1550. </if>
  1551. <if test="params.projectId == null and (params.patentNos == null or params.patentNos.size()==0) and params.reportId != null">
  1552. patentno in
  1553. ( select PATENT_NO from ASSO_IMPORTTASK_PATENT where REPORT_ID =#{params.reportId}
  1554. )
  1555. </if>
  1556. <if test="params.notInPatentNos != null and params.notInPatentNos.size!=0">
  1557. and patentno not in
  1558. <foreach item="item" collection="params.notInPatentNos" index="index" open="(" separator=","
  1559. close=")">
  1560. #{item}
  1561. </foreach>
  1562. </if>
  1563. <if test="params.conPatentNos != null and params.conPatentNos.size!=0">
  1564. and patentno in
  1565. <foreach item="item" collection="params.conPatentNos" index="index" open="(" separator=","
  1566. close=")">
  1567. #{item}
  1568. </foreach>
  1569. </if>
  1570. <if test="params.applicationName !=null and params.applicationName !='' ">
  1571. and c.name like concat("%",#{params.applicationName}, "%")
  1572. </if>
  1573. <if test="params.obligeeName !=null and params.obligeeName!=''">
  1574. and e.name like concat("%", #{params.obligeeName}, "%")
  1575. </if>
  1576. <if test="params.numberIpc !=null and params.numberIpc!=''">
  1577. and f.code like concat("%", #{params.numberIpc}, "%")
  1578. </if>
  1579. <if test="params.numberCpc !=null and params.numberCpc!=''">
  1580. and g.code like concat("%", #{params.numberCpc}, "%")
  1581. </if>
  1582. <if test="params.numberUpc !=null and params.numberUpc!=''">
  1583. and h.code like concat("%", #{params.numberUpc}, "%")
  1584. </if>
  1585. <if test="params.patentNo !=null and params.patentNo !=''">
  1586. and a.patentNo like concat("%",#{params.patentNo}, "%")
  1587. </if>
  1588. <if test="params.applicationNo !=null and params.applicationNo !=''">
  1589. and a.applicationNo like concat("%", #{params.applicationNo}, "%")
  1590. </if>
  1591. <if test="params.abstractStr !=null and params.abstractStr !=''">
  1592. and a.abstract like concat("%", #{params.abstractStr}, "%")
  1593. </if>
  1594. <if test="params.patentName !=null and params.patentName !=''">
  1595. and a.`name` like concat("%", #{params.patentName}, "%")
  1596. </if>
  1597. <if test="params.startNumber!=null and params.endNumber!=null">
  1598. limit #{params.startNumber} , #{params.endNumber}
  1599. </if>
  1600. </when>
  1601. <otherwise>
  1602. 1!=1
  1603. </otherwise>
  1604. </choose>
  1605. </where>
  1606. </select>
  1607. <select id="getConPantents" parameterType="cn.cslg.pas.common.model.QueryPatentVO" resultType="cn.cslg.pas.domain.Patent">
  1608. select DISTINCT a.id, a.`name` as name, a.nameout as name_out, a.patentno as patent_no, a.abstract_path,
  1609. a.abstract as
  1610. abstract_str, a.abstractout as abstract_out,
  1611. a.publicno as public_no, a.publicdate as public_date, a.simple_family, a.inpadoc_family, a.applicationno as
  1612. application_no, a.appdate as application_date,
  1613. a.`status` as simple_status, a.type, a.publictodate as public_accredit_date, a.fpublicdate as first_public_date,
  1614. a.prioritydate as priority_date,
  1615. a.agencyid as agency_id, a.num2 as right_num, a.quoteno as quote_num, a.quotedno as quoted_num,
  1616. a.patsnap_family as patSnapFamily, a.patsnapfamilynum as patSnapFamilyNum
  1617. from os_patent a
  1618. <if test="params.applicationName !=null ">
  1619. left join os_applicant_attr b on a.id=b.pid and b.type =1
  1620. left join os_patent_applicant c on c.id=b.applicantid
  1621. </if>
  1622. <if test=" params.obligeeName !=null">
  1623. left join os_applicant_attr d on a.id=d.pid and d.type =2
  1624. left join os_patent_applicant e on e.id=d.applicantid
  1625. </if>
  1626. <if test="params.numberIpc!=null ">
  1627. left join os_patent_typeno f on f.pid =a.id and f.type =1
  1628. </if>
  1629. <if test=" params.numberCpc!=null ">
  1630. left join os_patent_typeno g on g.pid =a.id and g.type =2
  1631. </if>
  1632. <if test=" params.numberUpc!=null">
  1633. left join os_patent_typeno h on h.pid =a.id and h.type =3
  1634. </if>
  1635. <if test="params.projectId != null and params.pasOptions !=null and params.pasOptions.size()!=0">
  1636. left join os_thematic_pid i on i.pid=a.id left join os_patent_field_patent_link j on a.id=j.pid
  1637. </if>
  1638. <where>
  1639. <choose>
  1640. <when test="params.projectId != null or (params.patentNos != null and params.patentNos.size()!=0) or params.reportId!=null ">
  1641. <if test="params.projectId != null">
  1642. and ( a.id in (select pid from os_thematic_pid where zid = #{params.projectId})
  1643. <if test="params.patentNos != null and params.patentNos.size()!=0">
  1644. or patentno in
  1645. <foreach item="item" collection="params.patentNos" index="index" open="(" separator=","
  1646. close=")">
  1647. #{item}
  1648. </foreach>
  1649. </if>
  1650. <if test="params.reportId != null">
  1651. or patentno in
  1652. ( select PATENT_NO from ASSO_IMPORTTASK_PATENT where REPORT_ID =#{params.reportId}
  1653. )
  1654. </if>
  1655. )
  1656. </if>
  1657. <if test="params.projectId == null and params.patentNos != null and params.patentNos.size()!=0">
  1658. (patentno in
  1659. <foreach item="item" collection="params.patentNos" index="index" open="(" separator=","
  1660. close=")">
  1661. #{item}
  1662. </foreach>
  1663. <if test="params.reportId != null">
  1664. or patentno in
  1665. ( select PATENT_NO from ASSO_IMPORTTASK_PATENT where REPORT_ID =#{params.reportId}
  1666. )
  1667. </if>
  1668. )
  1669. </if>
  1670. <if test="params.projectId == null and (params.patentNos == null or params.patentNos.size()==0) and params.reportId != null">
  1671. patentno in
  1672. ( select PATENT_NO from ASSO_IMPORTTASK_PATENT where REPORT_ID =#{params.reportId}
  1673. )
  1674. </if>
  1675. <if test="params.notInPatentNos != null and params.notInPatentNos.size!=0">
  1676. and patentno not in
  1677. <foreach item="item" collection="params.notInPatentNos" index="index" open="(" separator=","
  1678. close=")">
  1679. #{item}
  1680. </foreach>
  1681. </if>
  1682. <if test="params.conPatentNos != null and params.conPatentNos.size!=0">
  1683. and patentno in
  1684. <foreach item="item" collection="params.conPatentNos" index="index" open="(" separator=","
  1685. close=")">
  1686. #{item}
  1687. </foreach>
  1688. </if>
  1689. <if test="params.applicationName !=null and params.applicationName !='' ">
  1690. and c.name REGEXP #{params.applicationName}
  1691. </if>
  1692. <if test="params.obligeeName !=null and params.obligeeName!=''">
  1693. and e.name REGEXP #{params.obligeeName}
  1694. </if>
  1695. <if test="params.numberIpc !=null and params.numberIpc!=''">
  1696. and f.code like concat("%", #{params.numberIpc}, "%")
  1697. </if>
  1698. <if test="params.numberCpc !=null and params.numberCpc!=''">
  1699. and g.code like concat("%", #{params.numberCpc}, "%")
  1700. </if>
  1701. <if test="params.numberUpc !=null and params.numberUpc!=''">
  1702. and h.code like concat("%", #{params.numberUpc}, "%")
  1703. </if>
  1704. <if test="params.patentNo !=null and params.patentNo !=''">
  1705. and a.patentNo REGEXP #{params.patentNo}
  1706. </if>
  1707. <if test="params.applicationNo !=null and params.applicationNo !=''">
  1708. and a.applicationNo like concat("%", #{params.applicationNo}, "%")
  1709. </if>
  1710. <if test="params.abstractStr !=null and params.abstractStr !=''">
  1711. and a.abstract like concat("%", #{params.abstractStr}, "%")
  1712. </if>
  1713. <if test="params.patentName !=null and params.patentName !=''">
  1714. and a.`name` like concat("%", #{params.patentName}, "%")
  1715. </if>
  1716. <if test="params.PasOptions !=null and params.PasOptions.size()!=0">
  1717. and (
  1718. <foreach item="item" collection="params.PasOptions" index="index" open="(" separator="or"
  1719. close=")">
  1720. <if test="item.key !=null">
  1721. (j.cid=#{item.fieldId} and j.fid =#{item.key})
  1722. </if>
  1723. <if test="item.key ==null">
  1724. (j.cid is null or j.cid !=#{item.fieldId})
  1725. </if>
  1726. </foreach>
  1727. )
  1728. </if>
  1729. <if test="params.orderItem!=null and params.orderItem!='SysOrder'">
  1730. order by #{params.orderItem}
  1731. <if test="params.orderType!=null">
  1732. #{params.orderType}
  1733. </if>
  1734. </if>
  1735. <if test="params.orderItem==null">
  1736. order by a.patentno
  1737. </if>
  1738. <if test="params.orderItem=='SysOrder' and params.patentNos != null and params.patentNos.size()!=0">
  1739. order by field (a.patentno,
  1740. <foreach item="item" collection="params.patentNos" index="index" open="" separator=","
  1741. close=")">
  1742. #{item}
  1743. </foreach>
  1744. </if>
  1745. <if test="params.startNumber!=null and params.endNumber!=null">
  1746. limit #{params.startNumber} , #{params.endNumber}
  1747. </if>
  1748. </when>
  1749. <otherwise>
  1750. 1!=1
  1751. </otherwise>
  1752. </choose>
  1753. </where>
  1754. </select>
  1755. <select id="getConPantentsCount" parameterType="cn.cslg.pas.common.model.QueryPatentVO" resultType="java.lang.Integer">
  1756. select count(*)
  1757. from os_patent a
  1758. <if test="params.applicationName !=null ">
  1759. left join os_applicant_attr b on a.id=b.pid and b.type =1
  1760. left join os_patent_applicant c on c.id=b.applicantid
  1761. </if>
  1762. <if test=" params.obligeeName !=null">
  1763. left join os_applicant_attr d on a.id=d.pid and d.type =2
  1764. left join os_patent_applicant e on e.id=d.applicantid
  1765. </if>
  1766. <if test="params.numberIpc!=null ">
  1767. left join os_patent_typeno f on f.pid =a.id and f.type =1
  1768. </if>
  1769. <if test=" params.numberCpc!=null ">
  1770. left join os_patent_typeno g on g.pid =a.id and g.type =2
  1771. </if>
  1772. <if test=" params.numberUpc!=null">
  1773. left join os_patent_typeno h on h.pid =a.id and h.type =3
  1774. </if>
  1775. <if test="params.projectId != null and params.pasOptions !=null and params.pasOptions.size()!=0">
  1776. left join os_thematic_pid i on i.pid=a.id left join os_patent_field_patent_link j on a.id=j.pid
  1777. </if>
  1778. <where>
  1779. <choose>
  1780. <when test="params.projectId != null or (params.patentNos != null and params.patentNos.size()!=0) or params.reportId!=null ">
  1781. <if test="params.projectId != null">
  1782. and ( a.id in (select pid from os_thematic_pid where zid = #{params.projectId})
  1783. <if test="params.patentNos != null and params.patentNos.size()!=0">
  1784. or patentno in
  1785. <foreach item="item" collection="params.patentNos" index="index" open="(" separator=","
  1786. close=")">
  1787. #{item}
  1788. </foreach>
  1789. </if>
  1790. <if test="params.reportId != null">
  1791. or patentno in
  1792. ( select PATENT_NO from ASSO_IMPORTTASK_PATENT where REPORT_ID =#{params.reportId}
  1793. )
  1794. </if>
  1795. )
  1796. </if>
  1797. <if test="params.projectId == null and params.patentNos != null and params.patentNos.size()!=0">
  1798. (patentno in
  1799. <foreach item="item" collection="params.patentNos" index="index" open="(" separator=","
  1800. close=")">
  1801. #{item}
  1802. </foreach>
  1803. <if test="params.reportId != null">
  1804. or patentno in
  1805. ( select PATENT_NO from ASSO_IMPORTTASK_PATENT where REPORT_ID =#{params.reportId}
  1806. )
  1807. </if>
  1808. )
  1809. </if>
  1810. <if test="params.projectId == null and (params.patentNos == null or params.patentNos.size()==0) and params.reportId != null">
  1811. patentno in
  1812. ( select PATENT_NO from ASSO_IMPORTTASK_PATENT where REPORT_ID =#{params.reportId}
  1813. )
  1814. </if>
  1815. <if test="params.notInPatentNos != null and params.notInPatentNos.size!=0">
  1816. and patentno not in
  1817. <foreach item="item" collection="params.notInPatentNos" index="index" open="(" separator=","
  1818. close=")">
  1819. #{item}
  1820. </foreach>
  1821. </if>
  1822. <if test="params.conPatentNos != null and params.conPatentNos.size!=0">
  1823. and patentno in
  1824. <foreach item="item" collection="params.conPatentNos" index="index" open="(" separator=","
  1825. close=")">
  1826. #{item}
  1827. </foreach>
  1828. </if>
  1829. <if test="params.applicationName !=null and params.applicationName !='' ">
  1830. and c.name REGEXP #{params.applicationName}
  1831. </if>
  1832. <if test="params.obligeeName !=null and params.obligeeName!=''">
  1833. and e.name REGEXP #{params.obligeeName}
  1834. </if>
  1835. <if test="params.numberIpc !=null and params.numberIpc!=''">
  1836. and f.code like concat("%", #{params.numberIpc}, "%")
  1837. </if>
  1838. <if test="params.numberCpc !=null and params.numberCpc!=''">
  1839. and g.code like concat("%", #{params.numberCpc}, "%")
  1840. </if>
  1841. <if test="params.numberUpc !=null and params.numberUpc!=''">
  1842. and h.code like concat("%", #{params.numberUpc}, "%")
  1843. </if>
  1844. <if test="params.patentNo !=null and params.patentNo !=''">
  1845. and a.patentNo REGEXP #{params.patentNo}
  1846. </if>
  1847. <if test="params.applicationNo !=null and params.applicationNo !=''">
  1848. and a.applicationNo like concat("%", #{params.applicationNo}, "%")
  1849. </if>
  1850. <if test="params.abstractStr !=null and params.abstractStr !=''">
  1851. and a.abstract like concat("%", #{params.abstractStr}, "%")
  1852. </if>
  1853. <if test="params.patentName !=null and params.patentName !=''">
  1854. and a.`name` like concat("%", #{params.patentName}, "%")
  1855. </if>
  1856. <if test="params.PasOptions !=null and params.PasOptions.size()!=0">
  1857. and (
  1858. <foreach item="item" collection="params.PasOptions" index="index" open="(" separator="or"
  1859. close=")">
  1860. <if test="item.key !=null">
  1861. (j.cid=#{item.fieldId} and j.fid =#{item.key})
  1862. </if>
  1863. <if test="item.key ==null">
  1864. (j.cid is null or j.cid !=#{item.fieldId})
  1865. </if>
  1866. </foreach>
  1867. )
  1868. </if>
  1869. <if test="params.orderItem!=null and params.orderItem!='SysOrder'">
  1870. order by #{params.orderItem}
  1871. <if test="params.orderType!=null">
  1872. #{params.orderType}
  1873. </if>
  1874. </if>
  1875. <if test="params.orderItem==null">
  1876. order by a.patentno
  1877. </if>
  1878. <if test="params.orderItem=='SysOrder' and params.patentNos != null and params.patentNos.size()!=0">
  1879. order by field (a.patentno,
  1880. <foreach item="item" collection="params.patentNos" index="index" open="" separator=","
  1881. close=")">
  1882. #{item}
  1883. </foreach>
  1884. </if>
  1885. <if test="params.startNumber!=null and params.endNumber!=null">
  1886. limit #{params.startNumber} , #{params.endNumber}
  1887. </if>
  1888. </when>
  1889. <otherwise>
  1890. 1!=1
  1891. </otherwise>
  1892. </choose>
  1893. </where>
  1894. </select>
  1895. <select id="getPatent" parameterType="java.util.List" resultType="cn.cslg.pas.domain.Patent">
  1896. select a.id, a.`name` as name, a.nameout as name_out, a.patentno as patent_no, a.abstract_path, a.abstract as
  1897. abstract_str, a.abstractout as abstract_out,
  1898. a.publicno as public_no, a.publicdate as public_date, a.simple_family, a.inpadoc_family, a.applicationno as
  1899. application_no, a.appdate as application_date,
  1900. a.`status` as simple_status, a.type, a.publictodate as public_accredit_date, a.fpublicdate as first_public_date,
  1901. a.prioritydate as priority_date,
  1902. a.agencyid as agency_id, a.num2 as right_num, a.quoteno as quote_num, a.quotedno as quoted_num,
  1903. a.quote,
  1904. a.patsnap_family as patSnapFamily, a.patsnapfamilynum as patSnapFamilyNum
  1905. from os_patent a
  1906. <where>
  1907. <if test="patentNo != null and patentNo.size!=0">
  1908. patentno in
  1909. <foreach item="item" collection="patentNo" index="index" open="(" separator="," close=")">
  1910. #{item}
  1911. </foreach>
  1912. </if>
  1913. <if test="patentNo == null or patentNo.size==0">
  1914. 1!=1
  1915. </if>
  1916. <if test="n!=-1 and p!=-1">
  1917. limit #{n},#{p}
  1918. </if>
  1919. </where>
  1920. </select>
  1921. <!-- int getPatentNumber(@Param("patentNo")List<String> patentNo);-->
  1922. <select id="getPatentNumber" resultType="java.lang.Integer">
  1923. select count(*) from os_patent
  1924. where patentno in
  1925. <foreach item="item" collection="patentNo" index="index" open="(" separator="," close=")">
  1926. #{item}
  1927. </foreach>
  1928. </select>
  1929. </mapper>