ContractMapper.xml 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750
  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.ContractMapper">
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.Contract">
  5. <!--
  6. WARNING - @mbg.generated
  7. This element is automatically generated by MyBatis Generator, do not modify.
  8. This element was generated on Thu Jan 25 20:45:00 CST 2018.
  9. -->
  10. <id column="id" jdbcType="VARCHAR" property="id" />
  11. <result column="serial_number" jdbcType="INTEGER" property="serialNumber" />
  12. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  13. <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
  14. <result column="creater" jdbcType="VARCHAR" property="creater" />
  15. <result column="name" jdbcType="VARCHAR" property="name" />
  16. <result column="type" jdbcType="INTEGER" property="type" />
  17. <result column="principal" jdbcType="VARCHAR" property="principal" />
  18. <result column="uid" jdbcType="VARCHAR" property="uid" />
  19. <result column="sign_date" jdbcType="TIMESTAMP" property="signDate" />
  20. <result column="sign_comment" jdbcType="VARCHAR" property="signComment" />
  21. <result column="complete_date" jdbcType="TIMESTAMP" property="completeDate" />
  22. <result column="complete_comment" jdbcType="VARCHAR" property="completeComment" />
  23. <result column="deleted_sign" jdbcType="INTEGER" property="deletedSign" />
  24. <result column="order_no" jdbcType="VARCHAR" property="orderNo" />
  25. <result column="status" jdbcType="INTEGER" property="status" />
  26. <result column="contacts" jdbcType="VARCHAR" property="contacts" />
  27. <result column="contact_mobile" jdbcType="VARCHAR" property="contactMobile" />
  28. </resultMap>
  29. <sql id="Example_Where_Clause">
  30. <!--
  31. WARNING - @mbg.generated
  32. This element is automatically generated by MyBatis Generator, do not modify.
  33. This element was generated on Thu Jan 25 20:45:00 CST 2018.
  34. -->
  35. <where>
  36. <foreach collection="oredCriteria" item="criteria" separator="or">
  37. <if test="criteria.valid">
  38. <trim prefix="(" prefixOverrides="and" suffix=")">
  39. <foreach collection="criteria.criteria" item="criterion">
  40. <choose>
  41. <when test="criterion.noValue">
  42. and ${criterion.condition}
  43. </when>
  44. <when test="criterion.singleValue">
  45. and ${criterion.condition} #{criterion.value}
  46. </when>
  47. <when test="criterion.betweenValue">
  48. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  49. </when>
  50. <when test="criterion.listValue">
  51. and ${criterion.condition}
  52. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  53. #{listItem}
  54. </foreach>
  55. </when>
  56. </choose>
  57. </foreach>
  58. </trim>
  59. </if>
  60. </foreach>
  61. </where>
  62. </sql>
  63. <sql id="Update_By_Example_Where_Clause">
  64. <!--
  65. WARNING - @mbg.generated
  66. This element is automatically generated by MyBatis Generator, do not modify.
  67. This element was generated on Thu Jan 25 20:45:00 CST 2018.
  68. -->
  69. <where>
  70. <foreach collection="example.oredCriteria" item="criteria" separator="or">
  71. <if test="criteria.valid">
  72. <trim prefix="(" prefixOverrides="and" suffix=")">
  73. <foreach collection="criteria.criteria" item="criterion">
  74. <choose>
  75. <when test="criterion.noValue">
  76. and ${criterion.condition}
  77. </when>
  78. <when test="criterion.singleValue">
  79. and ${criterion.condition} #{criterion.value}
  80. </when>
  81. <when test="criterion.betweenValue">
  82. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  83. </when>
  84. <when test="criterion.listValue">
  85. and ${criterion.condition}
  86. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  87. #{listItem}
  88. </foreach>
  89. </when>
  90. </choose>
  91. </foreach>
  92. </trim>
  93. </if>
  94. </foreach>
  95. </where>
  96. </sql>
  97. <sql id="Base_Column_List">
  98. <!--
  99. WARNING - @mbg.generated
  100. This element is automatically generated by MyBatis Generator, do not modify.
  101. This element was generated on Thu Jan 25 20:45:00 CST 2018.
  102. -->
  103. id, serial_number, create_time, update_time, creater, name, type, principal, uid,
  104. sign_date, sign_comment, complete_date, complete_comment, deleted_sign, order_no,
  105. status, contacts, contact_mobile
  106. </sql>
  107. <select id="selectByExample" parameterType="com.goafanti.common.model.ContractExample" resultMap="BaseResultMap">
  108. <!--
  109. WARNING - @mbg.generated
  110. This element is automatically generated by MyBatis Generator, do not modify.
  111. This element was generated on Thu Jan 25 20:45:00 CST 2018.
  112. -->
  113. select
  114. <if test="distinct">
  115. distinct
  116. </if>
  117. <include refid="Base_Column_List" />
  118. from contract
  119. <if test="_parameter != null">
  120. <include refid="Example_Where_Clause" />
  121. </if>
  122. <if test="orderByClause != null">
  123. order by ${orderByClause}
  124. </if>
  125. </select>
  126. <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
  127. <!--
  128. WARNING - @mbg.generated
  129. This element is automatically generated by MyBatis Generator, do not modify.
  130. This element was generated on Thu Jan 25 20:45:00 CST 2018.
  131. -->
  132. select
  133. <include refid="Base_Column_List" />
  134. from contract
  135. where id = #{id,jdbcType=VARCHAR}
  136. </select>
  137. <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
  138. <!--
  139. WARNING - @mbg.generated
  140. This element is automatically generated by MyBatis Generator, do not modify.
  141. This element was generated on Thu Jan 25 20:45:00 CST 2018.
  142. -->
  143. delete from contract
  144. where id = #{id,jdbcType=VARCHAR}
  145. </delete>
  146. <delete id="deleteByExample" parameterType="com.goafanti.common.model.ContractExample">
  147. <!--
  148. WARNING - @mbg.generated
  149. This element is automatically generated by MyBatis Generator, do not modify.
  150. This element was generated on Thu Jan 25 20:45:00 CST 2018.
  151. -->
  152. delete from contract
  153. <if test="_parameter != null">
  154. <include refid="Example_Where_Clause" />
  155. </if>
  156. </delete>
  157. <insert id="insert" parameterType="com.goafanti.common.model.Contract">
  158. <!--
  159. WARNING - @mbg.generated
  160. This element is automatically generated by MyBatis Generator, do not modify.
  161. This element was generated on Thu Jan 25 20:45:00 CST 2018.
  162. -->
  163. insert into contract (id, serial_number, create_time,
  164. update_time, creater, name,
  165. type, principal, uid,
  166. sign_date, sign_comment, complete_date,
  167. complete_comment, deleted_sign, order_no,
  168. status, contacts, contact_mobile
  169. )
  170. values (#{id,jdbcType=VARCHAR}, #{serialNumber,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
  171. #{updateTime,jdbcType=TIMESTAMP}, #{creater,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
  172. #{type,jdbcType=INTEGER}, #{principal,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR},
  173. #{signDate,jdbcType=TIMESTAMP}, #{signComment,jdbcType=VARCHAR}, #{completeDate,jdbcType=TIMESTAMP},
  174. #{completeComment,jdbcType=VARCHAR}, #{deletedSign,jdbcType=INTEGER}, #{orderNo,jdbcType=VARCHAR},
  175. #{status,jdbcType=INTEGER}, #{contacts,jdbcType=VARCHAR}, #{contactMobile,jdbcType=VARCHAR}
  176. )
  177. </insert>
  178. <insert id="insertSelective" parameterType="com.goafanti.common.model.Contract">
  179. <!--
  180. WARNING - @mbg.generated
  181. This element is automatically generated by MyBatis Generator, do not modify.
  182. This element was generated on Thu Jan 25 20:45:00 CST 2018.
  183. -->
  184. insert into contract
  185. <trim prefix="(" suffix=")" suffixOverrides=",">
  186. <if test="id != null">
  187. id,
  188. </if>
  189. <if test="serialNumber != null">
  190. serial_number,
  191. </if>
  192. <if test="createTime != null">
  193. create_time,
  194. </if>
  195. <if test="updateTime != null">
  196. update_time,
  197. </if>
  198. <if test="creater != null">
  199. creater,
  200. </if>
  201. <if test="name != null">
  202. name,
  203. </if>
  204. <if test="type != null">
  205. type,
  206. </if>
  207. <if test="principal != null">
  208. principal,
  209. </if>
  210. <if test="uid != null">
  211. uid,
  212. </if>
  213. <if test="signDate != null">
  214. sign_date,
  215. </if>
  216. <if test="signComment != null">
  217. sign_comment,
  218. </if>
  219. <if test="completeDate != null">
  220. complete_date,
  221. </if>
  222. <if test="completeComment != null">
  223. complete_comment,
  224. </if>
  225. <if test="deletedSign != null">
  226. deleted_sign,
  227. </if>
  228. <if test="orderNo != null">
  229. order_no,
  230. </if>
  231. <if test="status != null">
  232. status,
  233. </if>
  234. <if test="contacts != null">
  235. contacts,
  236. </if>
  237. <if test="contactMobile != null">
  238. contact_mobile,
  239. </if>
  240. </trim>
  241. <trim prefix="values (" suffix=")" suffixOverrides=",">
  242. <if test="id != null">
  243. #{id,jdbcType=VARCHAR},
  244. </if>
  245. <if test="serialNumber != null">
  246. #{serialNumber,jdbcType=INTEGER},
  247. </if>
  248. <if test="createTime != null">
  249. #{createTime,jdbcType=TIMESTAMP},
  250. </if>
  251. <if test="updateTime != null">
  252. #{updateTime,jdbcType=TIMESTAMP},
  253. </if>
  254. <if test="creater != null">
  255. #{creater,jdbcType=VARCHAR},
  256. </if>
  257. <if test="name != null">
  258. #{name,jdbcType=VARCHAR},
  259. </if>
  260. <if test="type != null">
  261. #{type,jdbcType=INTEGER},
  262. </if>
  263. <if test="principal != null">
  264. #{principal,jdbcType=VARCHAR},
  265. </if>
  266. <if test="uid != null">
  267. #{uid,jdbcType=VARCHAR},
  268. </if>
  269. <if test="signDate != null">
  270. #{signDate,jdbcType=TIMESTAMP},
  271. </if>
  272. <if test="signComment != null">
  273. #{signComment,jdbcType=VARCHAR},
  274. </if>
  275. <if test="completeDate != null">
  276. #{completeDate,jdbcType=TIMESTAMP},
  277. </if>
  278. <if test="completeComment != null">
  279. #{completeComment,jdbcType=VARCHAR},
  280. </if>
  281. <if test="deletedSign != null">
  282. #{deletedSign,jdbcType=INTEGER},
  283. </if>
  284. <if test="orderNo != null">
  285. #{orderNo,jdbcType=VARCHAR},
  286. </if>
  287. <if test="status != null">
  288. #{status,jdbcType=INTEGER},
  289. </if>
  290. <if test="contacts != null">
  291. #{contacts,jdbcType=VARCHAR},
  292. </if>
  293. <if test="contactMobile != null">
  294. #{contactMobile,jdbcType=VARCHAR},
  295. </if>
  296. </trim>
  297. </insert>
  298. <select id="countByExample" parameterType="com.goafanti.common.model.ContractExample" resultType="java.lang.Long">
  299. <!--
  300. WARNING - @mbg.generated
  301. This element is automatically generated by MyBatis Generator, do not modify.
  302. This element was generated on Thu Jan 25 20:45:00 CST 2018.
  303. -->
  304. select count(*) from contract
  305. <if test="_parameter != null">
  306. <include refid="Example_Where_Clause" />
  307. </if>
  308. </select>
  309. <update id="updateByExampleSelective" parameterType="map">
  310. <!--
  311. WARNING - @mbg.generated
  312. This element is automatically generated by MyBatis Generator, do not modify.
  313. This element was generated on Thu Jan 25 20:45:00 CST 2018.
  314. -->
  315. update contract
  316. <set>
  317. <if test="record.id != null">
  318. id = #{record.id,jdbcType=VARCHAR},
  319. </if>
  320. <if test="record.serialNumber != null">
  321. serial_number = #{record.serialNumber,jdbcType=INTEGER},
  322. </if>
  323. <if test="record.createTime != null">
  324. create_time = #{record.createTime,jdbcType=TIMESTAMP},
  325. </if>
  326. <if test="record.updateTime != null">
  327. update_time = #{record.updateTime,jdbcType=TIMESTAMP},
  328. </if>
  329. <if test="record.creater != null">
  330. creater = #{record.creater,jdbcType=VARCHAR},
  331. </if>
  332. <if test="record.name != null">
  333. name = #{record.name,jdbcType=VARCHAR},
  334. </if>
  335. <if test="record.type != null">
  336. type = #{record.type,jdbcType=INTEGER},
  337. </if>
  338. <if test="record.principal != null">
  339. principal = #{record.principal,jdbcType=VARCHAR},
  340. </if>
  341. <if test="record.uid != null">
  342. uid = #{record.uid,jdbcType=VARCHAR},
  343. </if>
  344. <if test="record.signDate != null">
  345. sign_date = #{record.signDate,jdbcType=TIMESTAMP},
  346. </if>
  347. <if test="record.signComment != null">
  348. sign_comment = #{record.signComment,jdbcType=VARCHAR},
  349. </if>
  350. <if test="record.completeDate != null">
  351. complete_date = #{record.completeDate,jdbcType=TIMESTAMP},
  352. </if>
  353. <if test="record.completeComment != null">
  354. complete_comment = #{record.completeComment,jdbcType=VARCHAR},
  355. </if>
  356. <if test="record.deletedSign != null">
  357. deleted_sign = #{record.deletedSign,jdbcType=INTEGER},
  358. </if>
  359. <if test="record.orderNo != null">
  360. order_no = #{record.orderNo,jdbcType=VARCHAR},
  361. </if>
  362. <if test="record.status != null">
  363. status = #{record.status,jdbcType=INTEGER},
  364. </if>
  365. <if test="record.contacts != null">
  366. contacts = #{record.contacts,jdbcType=VARCHAR},
  367. </if>
  368. <if test="record.contactMobile != null">
  369. contact_mobile = #{record.contactMobile,jdbcType=VARCHAR},
  370. </if>
  371. </set>
  372. <if test="_parameter != null">
  373. <include refid="Update_By_Example_Where_Clause" />
  374. </if>
  375. </update>
  376. <update id="updateByExample" parameterType="map">
  377. <!--
  378. WARNING - @mbg.generated
  379. This element is automatically generated by MyBatis Generator, do not modify.
  380. This element was generated on Thu Jan 25 20:45:00 CST 2018.
  381. -->
  382. update contract
  383. set id = #{record.id,jdbcType=VARCHAR},
  384. serial_number = #{record.serialNumber,jdbcType=INTEGER},
  385. create_time = #{record.createTime,jdbcType=TIMESTAMP},
  386. update_time = #{record.updateTime,jdbcType=TIMESTAMP},
  387. creater = #{record.creater,jdbcType=VARCHAR},
  388. name = #{record.name,jdbcType=VARCHAR},
  389. type = #{record.type,jdbcType=INTEGER},
  390. principal = #{record.principal,jdbcType=VARCHAR},
  391. uid = #{record.uid,jdbcType=VARCHAR},
  392. sign_date = #{record.signDate,jdbcType=TIMESTAMP},
  393. sign_comment = #{record.signComment,jdbcType=VARCHAR},
  394. complete_date = #{record.completeDate,jdbcType=TIMESTAMP},
  395. complete_comment = #{record.completeComment,jdbcType=VARCHAR},
  396. deleted_sign = #{record.deletedSign,jdbcType=INTEGER},
  397. order_no = #{record.orderNo,jdbcType=VARCHAR},
  398. status = #{record.status,jdbcType=INTEGER},
  399. contacts = #{record.contacts,jdbcType=VARCHAR},
  400. contact_mobile = #{record.contactMobile,jdbcType=VARCHAR}
  401. <if test="_parameter != null">
  402. <include refid="Update_By_Example_Where_Clause" />
  403. </if>
  404. </update>
  405. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.Contract">
  406. <!--
  407. WARNING - @mbg.generated
  408. This element is automatically generated by MyBatis Generator, do not modify.
  409. This element was generated on Thu Jan 25 20:45:00 CST 2018.
  410. -->
  411. update contract
  412. <set>
  413. <if test="serialNumber != null">
  414. serial_number = #{serialNumber,jdbcType=INTEGER},
  415. </if>
  416. <if test="createTime != null">
  417. create_time = #{createTime,jdbcType=TIMESTAMP},
  418. </if>
  419. <if test="updateTime != null">
  420. update_time = #{updateTime,jdbcType=TIMESTAMP},
  421. </if>
  422. <if test="creater != null">
  423. creater = #{creater,jdbcType=VARCHAR},
  424. </if>
  425. <if test="name != null">
  426. name = #{name,jdbcType=VARCHAR},
  427. </if>
  428. <if test="type != null">
  429. type = #{type,jdbcType=INTEGER},
  430. </if>
  431. <if test="principal != null">
  432. principal = #{principal,jdbcType=VARCHAR},
  433. </if>
  434. <if test="uid != null">
  435. uid = #{uid,jdbcType=VARCHAR},
  436. </if>
  437. <if test="signDate != null">
  438. sign_date = #{signDate,jdbcType=TIMESTAMP},
  439. </if>
  440. <if test="signComment != null">
  441. sign_comment = #{signComment,jdbcType=VARCHAR},
  442. </if>
  443. <if test="completeDate != null">
  444. complete_date = #{completeDate,jdbcType=TIMESTAMP},
  445. </if>
  446. <if test="completeComment != null">
  447. complete_comment = #{completeComment,jdbcType=VARCHAR},
  448. </if>
  449. <if test="deletedSign != null">
  450. deleted_sign = #{deletedSign,jdbcType=INTEGER},
  451. </if>
  452. <if test="orderNo != null">
  453. order_no = #{orderNo,jdbcType=VARCHAR},
  454. </if>
  455. <if test="status != null">
  456. status = #{status,jdbcType=INTEGER},
  457. </if>
  458. <if test="contacts != null">
  459. contacts = #{contacts,jdbcType=VARCHAR},
  460. </if>
  461. <if test="contactMobile != null">
  462. contact_mobile = #{contactMobile,jdbcType=VARCHAR},
  463. </if>
  464. </set>
  465. where id = #{id,jdbcType=VARCHAR}
  466. </update>
  467. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.Contract">
  468. <!--
  469. WARNING - @mbg.generated
  470. This element is automatically generated by MyBatis Generator, do not modify.
  471. This element was generated on Thu Jan 25 20:45:00 CST 2018.
  472. -->
  473. update contract
  474. set serial_number = #{serialNumber,jdbcType=INTEGER},
  475. create_time = #{createTime,jdbcType=TIMESTAMP},
  476. update_time = #{updateTime,jdbcType=TIMESTAMP},
  477. creater = #{creater,jdbcType=VARCHAR},
  478. name = #{name,jdbcType=VARCHAR},
  479. type = #{type,jdbcType=INTEGER},
  480. principal = #{principal,jdbcType=VARCHAR},
  481. uid = #{uid,jdbcType=VARCHAR},
  482. sign_date = #{signDate,jdbcType=TIMESTAMP},
  483. sign_comment = #{signComment,jdbcType=VARCHAR},
  484. complete_date = #{completeDate,jdbcType=TIMESTAMP},
  485. complete_comment = #{completeComment,jdbcType=VARCHAR},
  486. deleted_sign = #{deletedSign,jdbcType=INTEGER},
  487. order_no = #{orderNo,jdbcType=VARCHAR},
  488. status = #{status,jdbcType=INTEGER},
  489. contacts = #{contacts,jdbcType=VARCHAR},
  490. contact_mobile = #{contactMobile,jdbcType=VARCHAR}
  491. where id = #{id,jdbcType=VARCHAR}
  492. </update>
  493. <select id="findManageContractListByPage" parameterType="String" resultType="com.goafanti.contract.bo.ContractManageListBo">
  494. select c.id, c.uid, oi.unit_name as unitName,
  495. oi.licence_province as province, c.serial_number as serialNumber, c.type,
  496. c.sign_date as signDate, a.name as founder,
  497. c.depict, c.status, c.complete_date as completeDate, c.contacts
  498. from contract c
  499. LEFT JOIN organization_identity oi on oi.uid = c.uid
  500. LEFT JOIN admin a on a.id = c.founder
  501. <if test="principal != null">
  502. LEFT JOIN contract_log cl on cl.cid = c.id
  503. </if>
  504. where c.deleted_sign = 0
  505. <if test="principal != null">
  506. and cl.principal = #{principal,jdbcType=VARCHAR}
  507. </if>
  508. <if test="serialNumber !=null">
  509. and c.serialNumber = #{serialNumber,jdbcType=INTEGER}
  510. </if>
  511. <if test="id !=null">
  512. and c.id = #{id,jdbcType=VARCHAR}
  513. </if>
  514. <if test="type !=null">
  515. and c.type = #{type,jdbcType=INTEGER}
  516. </if>
  517. <if test="uid !=null">
  518. and c.uid = #{uid,jdbcType=INTEGER}
  519. </if>
  520. <if test="status !=null">
  521. and c.status= #{status ,jdbcType=INTEGER}
  522. </if>
  523. <if test="cStart !=null">
  524. and c.sign_date <![CDATA[ >= ]]> #{cStart,jdbcType=TIMESTAMP}
  525. </if>
  526. <if test="cEnd !=null">
  527. and c.sign_date <![CDATA[ < ]]> #{cEnd,jdbcType=TIMESTAMP}
  528. </if>
  529. <if test="province !=null">
  530. and oi.licence_province= #{province,jdbcType=INTEGER}
  531. </if>
  532. <if test="unitName !=null">
  533. and oi.unit_name= #{unitName,jdbcType=VARCAHR}
  534. </if>
  535. <if test="principal != null">
  536. group by c.id, oi.id
  537. </if>
  538. order by c.serial_number DESC
  539. <if test="page_sql!=null">
  540. ${page_sql}
  541. </if>
  542. </select>
  543. <select id="findManageContractCount" parameterType="String" resultType="java.lang.Integer">
  544. select count(distinct(c.id))
  545. from contract c
  546. LEFT JOIN organization_identity oi on oi.uid = c.uid
  547. LEFT JOIN admin a on a.id = c.founder
  548. <if test="principal != null">
  549. LEFT JOIN contract_log cl on cl.cid = c.id
  550. </if>
  551. where c.deleted_sign = 0
  552. <if test="principal != null">
  553. and cl.principal = #{principal,jdbcType=VARCHAR}
  554. </if>
  555. <if test="id !=null">
  556. and c.id = #{id,jdbcType=VARCHAR}
  557. </if>
  558. <if test="serialNumber !=null">
  559. and c.serialNumber = #{serialNumber,jdbcType=INTEGER}
  560. </if>
  561. <if test="type !=null">
  562. and c.type = #{type,jdbcType=INTEGER}
  563. </if>
  564. <if test="uid !=null">
  565. and c.uid = #{uid,jdbcType=INTEGER}
  566. </if>
  567. <if test="status !=null">
  568. and c.status= #{status ,jdbcType=INTEGER}
  569. </if>
  570. <if test="cStart !=null">
  571. and c.sign_date <![CDATA[ >= ]]> #{cStart,jdbcType=TIMESTAMP}
  572. </if>
  573. <if test="cEnd !=null">
  574. and c.sign_date <![CDATA[ < ]]> #{cEnd,jdbcType=TIMESTAMP}
  575. </if>
  576. <if test="province !=null">
  577. and oi.licence_province= #{province,jdbcType=INTEGER}
  578. </if>
  579. <if test="unitName !=null">
  580. and oi.unit_name= #{unitName,jdbcType=VARCAHR}
  581. </if>
  582. </select>
  583. <select id="selectContractDetail" parameterType="java.lang.String" resultType="com.goafanti.contract.bo.ContractDetail">
  584. select
  585. c.id, c.uid, c.serial_number as serialNumber,
  586. oi.unit_name as unitName, oi.org_code as orgCode, oi.postal_address as address,
  587. c.type, c.sign_date as signDate, a.name as founder,
  588. c.depict, c.status, c.patent_num as patentNum,
  589. c.patent_status as patentStatus, c.copyright_num as copyrightNum, c.copyright_status as copyrightStatus,
  590. c.cognizance_year as cognizanceYear, c.cognizance_status as cognizanceStatus, c.tech_project_num as techProjectNum,
  591. c.tech_project_status as techProjectStatus, c.comment, c.complete_date as completeDate,
  592. c.contacts, c.previous_fee as previousFee
  593. from contract c
  594. LEFT JOIN organization_identity oi on oi.uid = c.uid
  595. LEFT JOIN admin a on a.id = c.founder
  596. where c.deleted_sign = 0 and c.id = #{id,jdbcType=VARCHAR}
  597. </select>
  598. <select id="selectContractSerialNumber" parameterType="java.lang.String" resultType="com.goafanti.contract.bo.ContractSerialNumber">
  599. select c.id as contractId, c.serial_number as serialNumber
  600. from contract c
  601. <if test="_parameter != null">
  602. LEFT JOIN contract_log cl on cl.cid = c.id
  603. </if>
  604. where c.deleted_sign = 0
  605. <if test="_parameter !=null">
  606. and cl.principal = #{_parameter,jdbcType=VARCHAR}
  607. </if>
  608. <if test="_parameter != null">
  609. group by c.id
  610. </if>
  611. order by c.serial_number desc
  612. </select>
  613. <update id="batchDeleteByPrimaryKey" parameterType="java.util.List">
  614. update contract set deleted_sign = 1
  615. where id in
  616. <foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
  617. #{item}
  618. </foreach>
  619. </update>
  620. <select id="findClientContractListByPage" parameterType="String" resultType="com.goafanti.contract.bo.ContractClientListBo">
  621. select c.id, c.uid, c.serial_number as serialNumber, c.type,
  622. c.sign_date as signDate,
  623. c.depict, c.status, c.complete_date as completeDate, c.contacts
  624. from contract c
  625. where c.deleted_sign = 0
  626. <if test="serialNumber !=null">
  627. and c.serial_number = #{serialNumber,jdbcType=INTEGER}
  628. </if>
  629. <if test="id !=null">
  630. and c.id = #{id,jdbcType=VARCHAR}
  631. </if>
  632. <if test="type !=null">
  633. and c.type = #{type,jdbcType=INTEGER}
  634. </if>
  635. <if test="uid !=null">
  636. and c.uid = #{uid,jdbcType=INTEGER}
  637. </if>
  638. <if test="status !=null">
  639. and c.status= #{status ,jdbcType=INTEGER}
  640. </if>
  641. <if test="cStart !=null">
  642. and c.sign_date <![CDATA[ >= ]]> #{cStart,jdbcType=TIMESTAMP}
  643. </if>
  644. <if test="cEnd !=null">
  645. and c.sign_date <![CDATA[ < ]]> #{cEnd,jdbcType=TIMESTAMP}
  646. </if>
  647. <if test="lStart !=null">
  648. and c.complete_date <![CDATA[ >= ]]> #{lStart,jdbcType=TIMESTAMP}
  649. </if>
  650. <if test="lEnd !=null">
  651. and c.complete_date <![CDATA[ < ]]> #{lEnd,jdbcType=TIMESTAMP}
  652. </if>
  653. order by c.serial_number DESC
  654. <if test="page_sql!=null">
  655. ${page_sql}
  656. </if>
  657. </select>
  658. <select id="findClientContractCount" parameterType="String" resultType="java.lang.Integer">
  659. select count(1)
  660. from contract c
  661. where c.deleted_sign = 0
  662. <if test="serialNumber !=null">
  663. and c.serial_number = #{serialNumber,jdbcType=INTEGER}
  664. </if>
  665. <if test="id !=null">
  666. and c.id = #{id,jdbcType=VARCHAR}
  667. </if>
  668. <if test="type !=null">
  669. and c.type = #{type,jdbcType=INTEGER}
  670. </if>
  671. <if test="uid !=null">
  672. and c.uid = #{uid,jdbcType=INTEGER}
  673. </if>
  674. <if test="status !=null">
  675. and c.status= #{status ,jdbcType=INTEGER}
  676. </if>
  677. <if test="cStart !=null">
  678. and c.sign_date <![CDATA[ > ]]> #{cStart,jdbcType=TIMESTAMP}
  679. </if>
  680. <if test="cEnd !=null">
  681. and c.sign_date <![CDATA[ < ]]> #{cEnd,jdbcType=TIMESTAMP}
  682. </if>
  683. <if test="lStart !=null">
  684. and c.complete_date <![CDATA[ >= ]]> #{lStart,jdbcType=TIMESTAMP}
  685. </if>
  686. <if test="lEnd !=null">
  687. and c.complete_date <![CDATA[ < ]]> #{lEnd,jdbcType=TIMESTAMP}
  688. </if>
  689. </select>
  690. <select id="findByUidAndYear" resultMap="BaseResultMap">
  691. select
  692. <include refid="Base_Column_List" />
  693. from contract
  694. where uid = #{uid,jdbcType=VARCHAR}
  695. and cognizance_year = #{year,jdbcType=INTEGER}
  696. and deleted_sign = 0
  697. </select>
  698. <select id="findLatelyRecordByUid" parameterType="java.lang.String" resultMap="BaseResultMap">
  699. select
  700. <include refid="Base_Column_List" />
  701. from contract
  702. where cognizance_year =
  703. (
  704. select
  705. Max(cognizance_year)
  706. from contract
  707. where uid = #{uid,jdbcType=VARCHAR}
  708. and deleted_sign = 0
  709. )
  710. and uid = #{uid,jdbcType=VARCHAR} and deleted_sign = 0
  711. </select>
  712. <insert id="batchInsert" parameterType="com.goafanti.common.model.ContractTask">
  713. insert into contract_task(
  714. id,
  715. contract_id,
  716. commodity_id,
  717. commodity_name,
  718. commodity_mode,
  719. commodity_type,
  720. commodity_quantity,
  721. task_status,
  722. create_time
  723. )
  724. values
  725. <foreach item="item" index="index" collection="list" separator=",">
  726. (
  727. #{item.id,jdbcType=VARCHAR},
  728. #{item.contractId,jdbcType=VARCHAR},
  729. #{item.commodityId,jdbcType=VARCHAR},
  730. #{item.commodityName,jdbcType=VARCHAR},
  731. #{item.commodityMode,jdbcType=VARCHAR},
  732. #{item.commodityType,jdbcType=INTEGER},
  733. #{item.commodityQuantity,jdbcType=INTEGER},
  734. #{item.taskStatus,jdbcType=INTEGER},
  735. #{item.createTime,jdbcType=TIMESTAMP}
  736. )
  737. </foreach>
  738. </insert>
  739. </mapper>