PatentNewMapper.xml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.goafanti.common.dao.PatentNewMapper">
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.PatentNew">
  5. <!--
  6. WARNING - @mbg.generated
  7. This element is automatically generated by MyBatis Generator, do not modify.
  8. This element was generated on Thu May 27 11:21:28 CST 2021.
  9. -->
  10. <id column="id" jdbcType="INTEGER" property="id" />
  11. <result column="patent_no" jdbcType="VARCHAR" property="patentNo" />
  12. <result column="name" jdbcType="VARCHAR" property="name" />
  13. <result column="type" jdbcType="INTEGER" property="type" />
  14. <result column="status" jdbcType="INTEGER" property="status" />
  15. <result column="apply_date" jdbcType="DATE" property="applyDate" />
  16. <result column="authorization_date" jdbcType="DATE" property="authorizationDate" />
  17. <result column="patent_amount" jdbcType="DECIMAL" property="patentAmount" />
  18. <result column="applicant" jdbcType="VARCHAR" property="applicant" />
  19. <result column="province" jdbcType="INTEGER" property="province" />
  20. <result column="contact_mobile" jdbcType="VARCHAR" property="contactMobile" />
  21. <result column="email" jdbcType="VARCHAR" property="email" />
  22. <result column="certificate_url" jdbcType="VARCHAR" property="certificateUrl" />
  23. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  24. <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
  25. <result column="aid" jdbcType="VARCHAR" property="aid" />
  26. <result column="years" jdbcType="INTEGER" property="years" />
  27. <result column="uid" jdbcType="VARCHAR" property="uid" />
  28. </resultMap>
  29. <sql id="Base_Column_List">
  30. <!--
  31. WARNING - @mbg.generated
  32. This element is automatically generated by MyBatis Generator, do not modify.
  33. This element was generated on Thu May 27 11:21:28 CST 2021.
  34. -->
  35. id, patent_no, `name`, `type`, `status`, apply_date, authorization_date, patent_amount,
  36. applicant, province, contact_mobile, email, certificate_url, create_time, update_time,
  37. aid, `years`, `uid`
  38. </sql>
  39. <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  40. <!--
  41. WARNING - @mbg.generated
  42. This element is automatically generated by MyBatis Generator, do not modify.
  43. This element was generated on Thu May 27 11:21:28 CST 2021.
  44. -->
  45. select
  46. <include refid="Base_Column_List" />
  47. from patent_new
  48. where id = #{id,jdbcType=INTEGER}
  49. </select>
  50. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
  51. <!--
  52. WARNING - @mbg.generated
  53. This element is automatically generated by MyBatis Generator, do not modify.
  54. This element was generated on Thu May 27 11:21:28 CST 2021.
  55. -->
  56. delete from patent_new
  57. where id = #{id,jdbcType=INTEGER}
  58. </delete>
  59. <insert id="insert" parameterType="com.goafanti.common.model.PatentNew">
  60. <!--
  61. WARNING - @mbg.generated
  62. This element is automatically generated by MyBatis Generator, do not modify.
  63. This element was generated on Thu May 27 11:21:28 CST 2021.
  64. -->
  65. insert into patent_new (id, patent_no, `name`,
  66. `type`, `status`, apply_date,
  67. authorization_date, patent_amount, applicant,
  68. province, contact_mobile, email,
  69. certificate_url, create_time, update_time,
  70. aid, `years`, `uid`)
  71. values (#{id,jdbcType=INTEGER}, #{patentNo,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
  72. #{type,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{applyDate,jdbcType=DATE},
  73. #{authorizationDate,jdbcType=DATE}, #{patentAmount,jdbcType=DECIMAL}, #{applicant,jdbcType=VARCHAR},
  74. #{province,jdbcType=INTEGER}, #{contactMobile,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR},
  75. #{certificateUrl,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
  76. #{aid,jdbcType=VARCHAR}, #{years,jdbcType=INTEGER}, #{uid,jdbcType=VARCHAR})
  77. </insert>
  78. <insert id="insertSelective" parameterType="com.goafanti.common.model.PatentNew">
  79. <!--
  80. WARNING - @mbg.generated
  81. This element is automatically generated by MyBatis Generator, do not modify.
  82. This element was generated on Thu May 27 11:21:28 CST 2021.
  83. -->
  84. insert into patent_new
  85. <trim prefix="(" suffix=")" suffixOverrides=",">
  86. <if test="id != null">
  87. id,
  88. </if>
  89. <if test="patentNo != null">
  90. patent_no,
  91. </if>
  92. <if test="name != null">
  93. `name`,
  94. </if>
  95. <if test="type != null">
  96. `type`,
  97. </if>
  98. <if test="status != null">
  99. `status`,
  100. </if>
  101. <if test="applyDate != null">
  102. apply_date,
  103. </if>
  104. <if test="authorizationDate != null">
  105. authorization_date,
  106. </if>
  107. <if test="patentAmount != null">
  108. patent_amount,
  109. </if>
  110. <if test="applicant != null">
  111. applicant,
  112. </if>
  113. <if test="province != null">
  114. province,
  115. </if>
  116. <if test="contactMobile != null">
  117. contact_mobile,
  118. </if>
  119. <if test="email != null">
  120. email,
  121. </if>
  122. <if test="certificateUrl != null">
  123. certificate_url,
  124. </if>
  125. <if test="createTime != null">
  126. create_time,
  127. </if>
  128. <if test="updateTime != null">
  129. update_time,
  130. </if>
  131. <if test="aid != null">
  132. aid,
  133. </if>
  134. <if test="years != null">
  135. `years`,
  136. </if>
  137. <if test="uid != null">
  138. `uid`,
  139. </if>
  140. </trim>
  141. <trim prefix="values (" suffix=")" suffixOverrides=",">
  142. <if test="id != null">
  143. #{id,jdbcType=INTEGER},
  144. </if>
  145. <if test="patentNo != null">
  146. #{patentNo,jdbcType=VARCHAR},
  147. </if>
  148. <if test="name != null">
  149. #{name,jdbcType=VARCHAR},
  150. </if>
  151. <if test="type != null">
  152. #{type,jdbcType=INTEGER},
  153. </if>
  154. <if test="status != null">
  155. #{status,jdbcType=INTEGER},
  156. </if>
  157. <if test="applyDate != null">
  158. #{applyDate,jdbcType=DATE},
  159. </if>
  160. <if test="authorizationDate != null">
  161. #{authorizationDate,jdbcType=DATE},
  162. </if>
  163. <if test="patentAmount != null">
  164. #{patentAmount,jdbcType=DECIMAL},
  165. </if>
  166. <if test="applicant != null">
  167. #{applicant,jdbcType=VARCHAR},
  168. </if>
  169. <if test="province != null">
  170. #{province,jdbcType=INTEGER},
  171. </if>
  172. <if test="contactMobile != null">
  173. #{contactMobile,jdbcType=VARCHAR},
  174. </if>
  175. <if test="email != null">
  176. #{email,jdbcType=VARCHAR},
  177. </if>
  178. <if test="certificateUrl != null">
  179. #{certificateUrl,jdbcType=VARCHAR},
  180. </if>
  181. <if test="createTime != null">
  182. #{createTime,jdbcType=TIMESTAMP},
  183. </if>
  184. <if test="updateTime != null">
  185. #{updateTime,jdbcType=TIMESTAMP},
  186. </if>
  187. <if test="aid != null">
  188. #{aid,jdbcType=VARCHAR},
  189. </if>
  190. <if test="years != null">
  191. #{years,jdbcType=INTEGER},
  192. </if>
  193. <if test="uid != null">
  194. #{uid,jdbcType=VARCHAR},
  195. </if>
  196. </trim>
  197. </insert>
  198. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.PatentNew">
  199. <!--
  200. WARNING - @mbg.generated
  201. This element is automatically generated by MyBatis Generator, do not modify.
  202. This element was generated on Thu May 27 11:21:28 CST 2021.
  203. -->
  204. update patent_new
  205. <set>
  206. <if test="patentNo != null">
  207. patent_no = #{patentNo,jdbcType=VARCHAR},
  208. </if>
  209. <if test="name != null">
  210. `name` = #{name,jdbcType=VARCHAR},
  211. </if>
  212. <if test="type != null">
  213. `type` = #{type,jdbcType=INTEGER},
  214. </if>
  215. <if test="status != null">
  216. `status` = #{status,jdbcType=INTEGER},
  217. </if>
  218. <if test="applyDate != null">
  219. apply_date = #{applyDate,jdbcType=DATE},
  220. </if>
  221. <if test="authorizationDate != null">
  222. authorization_date = #{authorizationDate,jdbcType=DATE},
  223. </if>
  224. <if test="patentAmount != null">
  225. patent_amount = #{patentAmount,jdbcType=DECIMAL},
  226. </if>
  227. <if test="applicant != null">
  228. applicant = #{applicant,jdbcType=VARCHAR},
  229. </if>
  230. <if test="province != null">
  231. province = #{province,jdbcType=INTEGER},
  232. </if>
  233. <if test="contactMobile != null">
  234. contact_mobile = #{contactMobile,jdbcType=VARCHAR},
  235. </if>
  236. <if test="email != null">
  237. email = #{email,jdbcType=VARCHAR},
  238. </if>
  239. <if test="certificateUrl != null">
  240. certificate_url = #{certificateUrl,jdbcType=VARCHAR},
  241. </if>
  242. <if test="createTime != null">
  243. create_time = #{createTime,jdbcType=TIMESTAMP},
  244. </if>
  245. <if test="updateTime != null">
  246. update_time = #{updateTime,jdbcType=TIMESTAMP},
  247. </if>
  248. <if test="aid != null">
  249. aid = #{aid,jdbcType=VARCHAR},
  250. </if>
  251. <if test="years != null">
  252. `years` = #{years,jdbcType=INTEGER},
  253. </if>
  254. <if test="uid != null">
  255. `uid` = #{uid,jdbcType=VARCHAR},
  256. </if>
  257. </set>
  258. where id = #{id,jdbcType=INTEGER}
  259. </update>
  260. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.PatentNew">
  261. <!--
  262. WARNING - @mbg.generated
  263. This element is automatically generated by MyBatis Generator, do not modify.
  264. This element was generated on Thu May 27 11:21:28 CST 2021.
  265. -->
  266. update patent_new
  267. set patent_no = #{patentNo,jdbcType=VARCHAR},
  268. `name` = #{name,jdbcType=VARCHAR},
  269. `type` = #{type,jdbcType=INTEGER},
  270. `status` = #{status,jdbcType=INTEGER},
  271. apply_date = #{applyDate,jdbcType=DATE},
  272. authorization_date = #{authorizationDate,jdbcType=DATE},
  273. patent_amount = #{patentAmount,jdbcType=DECIMAL},
  274. applicant = #{applicant,jdbcType=VARCHAR},
  275. province = #{province,jdbcType=INTEGER},
  276. contact_mobile = #{contactMobile,jdbcType=VARCHAR},
  277. email = #{email,jdbcType=VARCHAR},
  278. certificate_url = #{certificateUrl,jdbcType=VARCHAR},
  279. create_time = #{createTime,jdbcType=TIMESTAMP},
  280. update_time = #{updateTime,jdbcType=TIMESTAMP},
  281. aid = #{aid,jdbcType=VARCHAR},
  282. `years` = #{years,jdbcType=INTEGER},
  283. `uid` = #{uid,jdbcType=VARCHAR}
  284. where id = #{id,jdbcType=INTEGER}
  285. </update>
  286. <select id="selectPatentNewList" resultType="com.goafanti.patent.bo.PatentNewBo">
  287. select a.id,a.patent_no as patentNo,a.name,a.type,a.status,
  288. date_format(a.apply_date,'%Y-%m-%d') as applyDates,a.uid,
  289. date_format(a.authorization_date ,'%Y-%m-%d ')as authorizationDates,a.patent_amount as patentAmount,a.province,
  290. a.applicant,a.contact_mobile as contactMobile,a.email,a.certificate_url as certificateUrl,
  291. date_format(a.create_time,'%Y-%m-%d %H:%I:%S') as createTimeS,a.apply_date as applyDate,c.name depName,
  292. date_format(a.update_time,'%Y-%m-%d %H:%I:%S') as updateTimeS,b.name as aname,u.nickname userName
  293. from patent_new a left join admin b on a.aid=b.id
  294. left join `user` u on a.uid=u.id
  295. left join department c on b.department_id=c.id
  296. <if test="shiro ==1">
  297. left join admin e on e.department_id=c.id
  298. </if>
  299. where 1=1
  300. <if test="shiro ==0">
  301. and a.aid = #{aid,jdbcType=VARCHAR}
  302. </if>
  303. <if test="shiro ==1">
  304. and e.id = #{aid,jdbcType=VARCHAR}
  305. </if>
  306. <if test="status != null">
  307. and a.status=#{status}
  308. </if>
  309. <if test="type != null">
  310. and a.type=#{type}
  311. </if>
  312. <if test="startDate != null and endDate != null">
  313. and a.apply_date between #{startDate} and #{endDate}
  314. </if>
  315. <if test="createStart != null and createEnd != null">
  316. and a.create_time between #{createStart} and #{createEnd}
  317. </if>
  318. <if test="name != null">
  319. and a.applicant like concat('%',#{name},'%')
  320. </if>
  321. <if test="patentNo != null">
  322. and a.patent_no like concat('%',#{patentNo},'%')
  323. </if>
  324. <if test="aname != null">
  325. and b.name like concat('%',#{aname},'%')
  326. </if>
  327. <if test="departmentId != null">
  328. and b.department_id= #{departmentId}
  329. </if>
  330. order by a.status ,a.create_time
  331. <if test="page_sql!=null">
  332. ${page_sql}
  333. </if>
  334. </select>
  335. <select id="selectPatentNewCount" resultType="java.lang.Integer">
  336. select count(*)
  337. from patent_new a left join admin b on a.aid=b.id
  338. left join department c on b.department_id=c.id
  339. <if test="shiro ==1">
  340. left join admin e on e.department_id=c.id
  341. </if>
  342. where 1=1
  343. <if test="shiro ==0">
  344. and a.aid = #{aid,jdbcType=VARCHAR}
  345. </if>
  346. <if test="shiro ==1">
  347. and e.id = #{aid,jdbcType=VARCHAR}
  348. </if>
  349. <if test="status != null">
  350. and a.status=#{status}
  351. </if>
  352. <if test="type != null">
  353. and a.type=#{type}
  354. </if>
  355. <if test="startDate != null and endDate != null">
  356. and a.apply_date between #{startDate} and #{endDate}
  357. </if>
  358. <if test="createStart != null and createEnd != null">
  359. and a.create_time between #{createStart} and #{createEnd}
  360. </if>
  361. <if test="name != null">
  362. and a.applicant like concat('%',#{name},'%')
  363. </if>
  364. <if test="patentNo != null">
  365. and a.patent_no like concat('%',#{patentNo},'%')
  366. </if>
  367. <if test="aname != null">
  368. and b.name like concat('%',#{aname},'%')
  369. </if>
  370. <if test="departmentId != null">
  371. and b.department_id= #{departmentId}
  372. </if>
  373. </select>
  374. <select id="AllselectStartPatentNew" resultMap="BaseResultMap">
  375. select
  376. <include refid="Base_Column_List" />
  377. from patent_new where status &lt; 8
  378. </select>
  379. <select id="AllselectEndPatentNew" resultMap="BaseResultMap">
  380. select
  381. <include refid="Base_Column_List" />
  382. from patent_new where status =1
  383. </select>
  384. <update id="updateAdmin">
  385. update patent_new set aid= #{transferId}
  386. where aid= #{aid}
  387. </update>
  388. <insert id="insertBatch">
  389. insert into patent_new (patent_no, `name`,
  390. `type`, `status`, apply_date,
  391. authorization_date, patent_amount, applicant,
  392. province, contact_mobile, email,
  393. certificate_url, create_time, update_time,
  394. aid, `years`, `uid`)values
  395. <foreach item="item" index="index" collection="list" separator=",">
  396. ( #{item.aid,jdbcType=VARCHAR}, #{item.noticeType,jdbcType=INTEGER},
  397. #{item.content,jdbcType=VARCHAR}, #{item.createTime,jdbcType=TIMESTAMP}, #{item.readed,jdbcType=INTEGER},
  398. #{item.uid,jdbcType=VARCHAR}, #{item.pid,jdbcType=VARCHAR}, #{item.rid,jdbcType=VARCHAR},
  399. #{item.year,jdbcType=INTEGER}
  400. )
  401. </foreach>
  402. </insert>
  403. </mapper>