ContractServiceDaoImplMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="contractServiceDaoImpl">
  6. <!-- 保存合同管理信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveContractInfo" parameterType="Map">
  8. insert into contract(
  9. a_link,a_contacts,amount,contract_type,store_id,operator,signing_time,b_contacts,party_a,b_link,party_b,
  10. contract_id,obj_id,contract_name,start_time,end_time,state,contract_code,obj_type,operator_link,contract_parent_id,
  11. obj_name, obj_person_name, obj_person_id,start_user_id
  12. ) values (
  13. #{aLink},#{aContacts},#{amount},#{contractType},#{storeId},#{operator},#{signingTime},#{bContacts},#{partyA},#{bLink},#{partyB},
  14. #{contractId},#{objId},#{contractName},#{startTime},#{endTime},#{state},#{contractCode},#{objType},#{operatorLink},#{contractParentId},
  15. #{objName}, #{objPersonName}, #{objPersonId},#{startUserId}
  16. )
  17. </insert>
  18. <!-- 查询合同管理信息 add by wuxw 2018-07-03 -->
  19. <select id="getContractInfo" parameterType="Map" resultType="Map">
  20. select t.a_link,t.a_link aLink,t.a_contacts,t.a_contacts aContacts,t.amount,t.contract_type,t.contract_type
  21. contractType,t.status_cd,t.status_cd statusCd,t.store_id,t.store_id
  22. storeId,t.operator,t.signing_time,t.signing_time signingTime,t.b_contacts,t.b_contacts
  23. bContacts,t.party_a,t.party_a partyA,t.b_link,t.b_link bLink,t.party_b,t.party_b
  24. partyB,t.contract_id,t.contract_id contractId,t.obj_id,t.obj_id objId,t.contract_name,t.contract_name
  25. contractName,t.start_time,t.start_time startTime,t.end_time,t.end_time
  26. endTime,t.state,t.contract_code,t.contract_code contractCode,t.obj_type,t.obj_type
  27. objType,t.operator_link,t.operator_link operatorLink,ct.type_name contractTypeName,td.`name`
  28. stateName,t.state_desc stateDesc,t.contract_parent_id contractParentId,tt.contract_code parentContractCode,
  29. tt.contract_name parentContractName,t.obj_name objName, t.obj_person_name objPersonName, t.obj_person_id objPersonId,
  30. t.start_user_id startUserId
  31. from contract t
  32. LEFT JOIN contract_type ct on t.contract_type = ct.contract_type_id and ct.status_cd = '0' and ct.store_id =
  33. t.store_id
  34. LEFT JOIN t_dict td on td.status_cd = t.state and td.table_name = 'contract' and td.table_columns = 'state'
  35. left join contract tt on t.contract_parent_id = tt.contract_id and tt.status_cd = '0' and tt.store_id = t.store_id
  36. where 1 =1
  37. <if test="aLink !=null and aLink != ''">
  38. and t.a_link= #{aLink}
  39. </if>
  40. <if test="aContacts !=null and aContacts != ''">
  41. and t.a_contacts= #{aContacts}
  42. </if>
  43. <if test="amount !=null and amount != ''">
  44. and t.amount= #{amount}
  45. </if>
  46. <if test="contractType !=null and contractType != ''">
  47. and t.contract_type= #{contractType}
  48. </if>
  49. <if test="statusCd !=null and statusCd != ''">
  50. and t.status_cd= #{statusCd}
  51. </if>
  52. <if test="storeId !=null and storeId != ''">
  53. and t.store_id= #{storeId}
  54. </if>
  55. <if test="operator !=null and operator != ''">
  56. and t.operator= #{operator}
  57. </if>
  58. <if test="signingTime !=null and signingTime != ''">
  59. and t.signing_time= #{signingTime}
  60. </if>
  61. <if test="bContacts !=null and bContacts != ''">
  62. and t.b_contacts= #{bContacts}
  63. </if>
  64. <if test="partyA !=null and partyA != ''">
  65. and t.party_a= #{partyA}
  66. </if>
  67. <if test="bLink !=null and bLink != ''">
  68. and t.b_link= #{bLink}
  69. </if>
  70. <if test="partyB !=null and partyB != ''">
  71. and t.party_b= #{partyB}
  72. </if>
  73. <if test="contractId !=null and contractId != ''">
  74. and t.contract_id= #{contractId}
  75. </if>
  76. <if test="contractIds !=null">
  77. and t.contract_id in
  78. <foreach collection="contractIds" item="item" index="index" open="(" close=")" separator=",">
  79. #{item}
  80. </foreach>
  81. </if>
  82. <if test="objId !=null and objId != ''">
  83. and t.obj_id= #{objId}
  84. </if>
  85. <if test="objPersonId !=null and objPersonId != ''">
  86. and t.obj_person_id= #{objPersonId}
  87. </if>
  88. <if test="contractName !=null and contractName != ''">
  89. and t.contract_name= #{contractName}
  90. </if>
  91. <if test="startTime !=null">
  92. and t.start_time= #{startTime}
  93. </if>
  94. <if test="endTime !=null ">
  95. and t.end_time &lt;= #{endTime}
  96. </if>
  97. <if test="state !=null and state != ''">
  98. and t.state= #{state}
  99. </if>
  100. <if test="noStates !=null ">
  101. and t.state not in
  102. <foreach collection="noStates" item="item" index="index" open="(" close=")" separator=",">
  103. #{item}
  104. </foreach>
  105. </if>
  106. <if test="contractCode !=null and contractCode != ''">
  107. and t.contract_code= #{contractCode}
  108. </if>
  109. <if test="objType !=null and objType != ''">
  110. and t.obj_type= #{objType}
  111. </if>
  112. <if test="operatorLink !=null and operatorLink != ''">
  113. and t.operator_link= #{operatorLink}
  114. </if>
  115. <if test="contractParentId !=null and contractParentId != ''">
  116. and t.contract_parent_id= #{contractParentId}
  117. </if>
  118. order by t.create_time desc
  119. <if test="page != -1 and page != null ">
  120. limit #{page}, #{row}
  121. </if>
  122. </select>
  123. <!-- 修改合同管理信息 add by wuxw 2018-07-03 -->
  124. <update id="updateContractInfo" parameterType="Map">
  125. update contract t set t.status_cd = #{statusCd}
  126. <if test="newBId != null and newBId != ''">
  127. ,t.b_id = #{newBId}
  128. </if>
  129. <if test="aLink !=null and aLink != ''">
  130. , t.a_link= #{aLink}
  131. </if>
  132. <if test="aContacts !=null and aContacts != ''">
  133. , t.a_contacts= #{aContacts}
  134. </if>
  135. <if test="amount !=null and amount != ''">
  136. , t.amount= #{amount}
  137. </if>
  138. <if test="contractType !=null and contractType != ''">
  139. , t.contract_type= #{contractType}
  140. </if>
  141. <if test="storeId !=null and storeId != ''">
  142. , t.store_id= #{storeId}
  143. </if>
  144. <if test="operator !=null and operator != ''">
  145. , t.operator= #{operator}
  146. </if>
  147. <if test="signingTime !=null and signingTime != ''">
  148. , t.signing_time= #{signingTime}
  149. </if>
  150. <if test="bContacts !=null and bContacts != ''">
  151. , t.b_contacts= #{bContacts}
  152. </if>
  153. <if test="partyA !=null and partyA != ''">
  154. , t.party_a= #{partyA}
  155. </if>
  156. <if test="bLink !=null and bLink != ''">
  157. , t.b_link= #{bLink}
  158. </if>
  159. <if test="partyB !=null and partyB != ''">
  160. , t.party_b= #{partyB}
  161. </if>
  162. <if test="objId !=null and objId != ''">
  163. , t.obj_id= #{objId}
  164. </if>
  165. <if test="objName !=null and objName != ''">
  166. , t.obj_name= #{objName}
  167. </if>
  168. <if test="objPersonId !=null and objPersonId != ''">
  169. , t.obj_person_id= #{objPersonId}
  170. </if>
  171. <if test="objPersonName !=null and objPersonName != ''">
  172. , t.obj_person_name= #{objPersonName}
  173. </if>
  174. <if test="contractName !=null and contractName != ''">
  175. , t.contract_name= #{contractName}
  176. </if>
  177. <if test="startTime !=null and startTime != ''">
  178. , t.start_time= #{startTime}
  179. </if>
  180. <if test="endTime !=null and endTime != ''">
  181. , t.end_time= #{endTime}
  182. </if>
  183. <if test="state !=null and state != ''">
  184. , t.state= #{state}
  185. </if>
  186. <if test="stateDesc !=null and stateDesc != ''">
  187. , t.state_desc= #{stateDesc}
  188. </if>
  189. <if test="contractCode !=null and contractCode != ''">
  190. , t.contract_code= #{contractCode}
  191. </if>
  192. <if test="objType !=null and objType != ''">
  193. , t.obj_type= #{objType}
  194. </if>
  195. <if test="operatorLink !=null and operatorLink != ''">
  196. , t.operator_link= #{operatorLink}
  197. </if>
  198. where 1=1
  199. <if test="contractId !=null and contractId != ''">
  200. and t.contract_id= #{contractId}
  201. </if>
  202. </update>
  203. <!-- 查询合同管理数量 add by wuxw 2018-07-03 -->
  204. <select id="queryContractsCount" parameterType="Map" resultType="Map">
  205. select count(1) count
  206. from contract t
  207. where 1 =1
  208. <if test="aLink !=null and aLink != ''">
  209. and t.a_link= #{aLink}
  210. </if>
  211. <if test="aContacts !=null and aContacts != ''">
  212. and t.a_contacts= #{aContacts}
  213. </if>
  214. <if test="amount !=null and amount != ''">
  215. and t.amount= #{amount}
  216. </if>
  217. <if test="contractType !=null and contractType != ''">
  218. and t.contract_type= #{contractType}
  219. </if>
  220. <if test="statusCd !=null and statusCd != ''">
  221. and t.status_cd= #{statusCd}
  222. </if>
  223. <if test="storeId !=null and storeId != ''">
  224. and t.store_id= #{storeId}
  225. </if>
  226. <if test="operator !=null and operator != ''">
  227. and t.operator= #{operator}
  228. </if>
  229. <if test="signingTime !=null and signingTime != ''">
  230. and t.signing_time= #{signingTime}
  231. </if>
  232. <if test="bContacts !=null and bContacts != ''">
  233. and t.b_contacts= #{bContacts}
  234. </if>
  235. <if test="partyA !=null and partyA != ''">
  236. and t.party_a= #{partyA}
  237. </if>
  238. <if test="bLink !=null and bLink != ''">
  239. and t.b_link= #{bLink}
  240. </if>
  241. <if test="partyB !=null and partyB != ''">
  242. and t.party_b= #{partyB}
  243. </if>
  244. <if test="contractId !=null and contractId != ''">
  245. and t.contract_id= #{contractId}
  246. </if>
  247. <if test="objId !=null and objId != ''">
  248. and t.obj_id= #{objId}
  249. </if>
  250. <if test="objPersonId !=null and objPersonId != ''">
  251. and t.obj_person_id= #{objPersonId}
  252. </if>
  253. <if test="contractName !=null and contractName != ''">
  254. and t.contract_name= #{contractName}
  255. </if>
  256. <if test="startTime !=null ">
  257. and t.start_time= #{startTime}
  258. </if>
  259. <if test="endTime !=null ">
  260. and t.end_time &lt;= #{endTime}
  261. </if>
  262. <if test="state !=null and state != ''">
  263. and t.state= #{state}
  264. </if>
  265. <if test="noStates !=null ">
  266. and t.state not in
  267. <foreach collection="noStates" item="item" index="index" open="(" close=")" separator=",">
  268. #{item}
  269. </foreach>
  270. </if>
  271. <if test="contractCode !=null and contractCode != ''">
  272. and t.contract_code= #{contractCode}
  273. </if>
  274. <if test="objType !=null and objType != ''">
  275. and t.obj_type= #{objType}
  276. </if>
  277. <if test="operatorLink !=null and operatorLink != ''">
  278. and t.operator_link= #{operatorLink}
  279. </if>
  280. <if test="contractParentId !=null and contractParentId != ''">
  281. and t.contract_parent_id= #{contractParentId}
  282. </if>
  283. </select>
  284. </mapper>