ContractMapper.xml 29 KB

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