NewOrderChangeMapper.xml 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997
  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.NewOrderChangeMapper">
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.NewOrderChange">
  5. <id column="id" jdbcType="INTEGER" property="id" />
  6. <result column="order_no" jdbcType="VARCHAR" property="orderNo" />
  7. <result column="process_state" jdbcType="INTEGER" property="processState" />
  8. <result column="status" jdbcType="INTEGER" property="status" />
  9. <result column="type" jdbcType="INTEGER" property="type" />
  10. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  11. <result column="remarks" jdbcType="VARCHAR" property="remarks" />
  12. <result column="voucher_url" jdbcType="VARCHAR" property="voucherUrl" />
  13. <result column="total_amount" jdbcType="DECIMAL" property="totalAmount" />
  14. <result column="settlement_amount" jdbcType="DECIMAL" property="settlementAmount" />
  15. <result column="change_amount" jdbcType="DECIMAL" property="changeAmount" />
  16. <result column="applicant" jdbcType="VARCHAR" property="applicant" />
  17. <result column="dep_name" jdbcType="VARCHAR" property="depName" />
  18. <result column="project_state" jdbcType="VARCHAR" property="projectState" />
  19. <result column="zxs_cost" jdbcType="DECIMAL" property="zxsCost" />
  20. <result column="zxs_remarks" jdbcType="VARCHAR" property="zxsRemarks" />
  21. <result column="payment_time" jdbcType="TIMESTAMP" property="paymentTime" />
  22. <result column="payment_amount" jdbcType="DECIMAL" property="paymentAmount" />
  23. <result column="invoice_time" jdbcType="TIMESTAMP" property="invoiceTime" />
  24. <result column="invoice_amount" jdbcType="DECIMAL" property="invoiceAmount" />
  25. <result column="invoice_type" jdbcType="VARCHAR" property="invoiceType" />
  26. <result column="cw_cost" jdbcType="DECIMAL" property="cwCost" />
  27. <result column="refundable_amount" jdbcType="DECIMAL" property="refundableAmount" />
  28. <result column="cw_remarks" jdbcType="VARCHAR" property="cwRemarks" />
  29. <result column="estimate_cost" jdbcType="DECIMAL" property="estimateCost" />
  30. <result column="estimate_refundable" jdbcType="DECIMAL" property="estimateRefundable" />
  31. <result column="refund_Invoice" jdbcType="DECIMAL" property="refundInvoice" />
  32. <result column="used_order" jdbcType="VARCHAR" property="usedOrder" />
  33. <result column="refund_status" jdbcType="INTEGER" property="refundStatus" />
  34. <result column="refund_url" jdbcType="VARCHAR" property="refundUrl" />
  35. <result column="back_status" jdbcType="INTEGER" property="backStatus" />
  36. <result column="attachment_url" jdbcType="VARCHAR" property="attachmentUrl" />
  37. <result column="contract_picture_url" jdbcType="VARCHAR" property="contractPictureUrl" />
  38. <result column="first_amount" jdbcType="DECIMAL" property="firstAmount" />
  39. <result column="examine_name" jdbcType="VARCHAR" property="examineName" />
  40. <result column="cw_indirect_cost" jdbcType="DECIMAL" property="cwIndirectCost" />
  41. <result column="contacts" jdbcType="VARCHAR" property="contacts" />
  42. <result column="contact_mobile" jdbcType="VARCHAR" property="contactMobile" />
  43. <result column="manager_contacts" jdbcType="VARCHAR" property="managerContacts" />
  44. <result column="manager_contact_mobile" jdbcType="VARCHAR" property="managerContactMobile" />
  45. </resultMap>
  46. <sql id="Base_Column_List">
  47. id, order_no, process_state, `status`, `type`, create_time, remarks, voucher_url,
  48. total_amount, settlement_amount, change_amount, applicant, dep_name, project_state,
  49. zxs_cost, zxs_remarks, payment_time, payment_amount, invoice_time, invoice_amount,
  50. invoice_type, cw_cost, refundable_amount, cw_remarks, estimate_cost, estimate_refundable,
  51. refund_Invoice, used_order, refund_status, refund_url, back_status, attachment_url,
  52. contract_picture_url, first_amount, examine_name,cw_indirect_cost,contacts,contact_mobile,
  53. manager_contacts,manager_contact_mobile
  54. </sql>
  55. <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  56. select
  57. <include refid="Base_Column_List" />
  58. from new_order_change
  59. where id = #{id,jdbcType=INTEGER}
  60. </select>
  61. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
  62. delete from new_order_change
  63. where id = #{id,jdbcType=INTEGER}
  64. </delete>
  65. <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.NewOrderChange" useGeneratedKeys="true">
  66. insert into new_order_change (order_no, process_state, `status`,
  67. `type`, create_time, remarks,
  68. voucher_url, total_amount, settlement_amount,
  69. change_amount, applicant, dep_name,
  70. project_state, zxs_cost, zxs_remarks,
  71. payment_time, payment_amount, invoice_time,
  72. invoice_amount, invoice_type, cw_cost,
  73. refundable_amount, cw_remarks, estimate_cost,
  74. estimate_refundable, refund_Invoice, used_order,
  75. refund_status, refund_url, back_status,
  76. attachment_url, contract_picture_url, first_amount,
  77. examine_name,cw_indirect_cost,contacts,contact_mobile,
  78. manager_contacts,manager_contact_mobile)
  79. values (#{orderNo,jdbcType=VARCHAR}, #{processState,jdbcType=INTEGER}, #{status,jdbcType=INTEGER},
  80. #{type,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{remarks,jdbcType=VARCHAR},
  81. #{voucherUrl,jdbcType=VARCHAR}, #{totalAmount,jdbcType=DECIMAL}, #{settlementAmount,jdbcType=DECIMAL},
  82. #{changeAmount,jdbcType=DECIMAL}, #{applicant,jdbcType=VARCHAR}, #{depName,jdbcType=VARCHAR},
  83. #{projectState,jdbcType=VARCHAR}, #{zxsCost,jdbcType=DECIMAL}, #{zxsRemarks,jdbcType=VARCHAR},
  84. #{paymentTime,jdbcType=TIMESTAMP}, #{paymentAmount,jdbcType=DECIMAL}, #{invoiceTime,jdbcType=TIMESTAMP},
  85. #{invoiceAmount,jdbcType=DECIMAL}, #{invoiceType,jdbcType=VARCHAR}, #{cwCost,jdbcType=DECIMAL},
  86. #{refundableAmount,jdbcType=DECIMAL}, #{cwRemarks,jdbcType=VARCHAR}, #{estimateCost,jdbcType=DECIMAL},
  87. #{estimateRefundable,jdbcType=DECIMAL}, #{refundInvoice,jdbcType=DECIMAL}, #{usedOrder,jdbcType=VARCHAR},
  88. #{refundStatus,jdbcType=INTEGER}, #{refundUrl,jdbcType=VARCHAR}, #{backStatus,jdbcType=INTEGER},
  89. #{attachmentUrl,jdbcType=VARCHAR}, #{contractPictureUrl,jdbcType=VARCHAR}, #{firstAmount,jdbcType=DECIMAL},
  90. #{examineName,jdbcType=VARCHAR},#{cwIndirectCost,jdbcType=DECIMAL},#{contacts,jdbcType=VARCHAR},#{contactMobile,jdbcType=VARCHAR},
  91. #{managerContacts,jdbcType=VARCHAR},#{managerContactMobile,jdbcType=VARCHAR})
  92. </insert>
  93. <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.NewOrderChange" useGeneratedKeys="true">
  94. insert into new_order_change
  95. <trim prefix="(" suffix=")" suffixOverrides=",">
  96. <if test="orderNo != null">
  97. order_no,
  98. </if>
  99. <if test="processState != null">
  100. process_state,
  101. </if>
  102. <if test="status != null">
  103. `status`,
  104. </if>
  105. <if test="type != null">
  106. `type`,
  107. </if>
  108. <if test="createTime != null">
  109. create_time,
  110. </if>
  111. <if test="remarks != null">
  112. remarks,
  113. </if>
  114. <if test="voucherUrl != null">
  115. voucher_url,
  116. </if>
  117. <if test="totalAmount != null">
  118. total_amount,
  119. </if>
  120. <if test="settlementAmount != null">
  121. settlement_amount,
  122. </if>
  123. <if test="changeAmount != null">
  124. change_amount,
  125. </if>
  126. <if test="applicant != null">
  127. applicant,
  128. </if>
  129. <if test="depName != null">
  130. dep_name,
  131. </if>
  132. <if test="projectState != null">
  133. project_state,
  134. </if>
  135. <if test="zxsCost != null">
  136. zxs_cost,
  137. </if>
  138. <if test="zxsRemarks != null">
  139. zxs_remarks,
  140. </if>
  141. <if test="paymentTime != null">
  142. payment_time,
  143. </if>
  144. <if test="paymentAmount != null">
  145. payment_amount,
  146. </if>
  147. <if test="invoiceTime != null">
  148. invoice_time,
  149. </if>
  150. <if test="invoiceAmount != null">
  151. invoice_amount,
  152. </if>
  153. <if test="invoiceType != null">
  154. invoice_type,
  155. </if>
  156. <if test="cwCost != null">
  157. cw_cost,
  158. </if>
  159. <if test="refundableAmount != null">
  160. refundable_amount,
  161. </if>
  162. <if test="cwRemarks != null">
  163. cw_remarks,
  164. </if>
  165. <if test="estimateCost != null">
  166. estimate_cost,
  167. </if>
  168. <if test="estimateRefundable != null">
  169. estimate_refundable,
  170. </if>
  171. <if test="refundInvoice != null">
  172. refund_Invoice,
  173. </if>
  174. <if test="usedOrder != null">
  175. used_order,
  176. </if>
  177. <if test="refundStatus != null">
  178. refund_status,
  179. </if>
  180. <if test="refundUrl != null">
  181. refund_url,
  182. </if>
  183. <if test="backStatus != null">
  184. back_status,
  185. </if>
  186. <if test="attachmentUrl != null">
  187. attachment_url,
  188. </if>
  189. <if test="contractPictureUrl != null">
  190. contract_picture_url,
  191. </if>
  192. <if test="firstAmount != null">
  193. first_amount,
  194. </if>
  195. <if test="examineName != null">
  196. examine_name,
  197. </if>
  198. <if test="cwIndirectCost != null">
  199. cw_indirect_cost,
  200. </if>
  201. <if test="contacts != null">
  202. contacts,
  203. </if>
  204. <if test="contactMobile != null">
  205. contact_mobile,
  206. </if>
  207. <if test="managerContacts != null">
  208. manager_contacts,
  209. </if>
  210. <if test="managerContactMobile != null">
  211. manager_contact_mobile,
  212. </if>
  213. </trim>
  214. <trim prefix="values (" suffix=")" suffixOverrides=",">
  215. <if test="orderNo != null">
  216. #{orderNo,jdbcType=VARCHAR},
  217. </if>
  218. <if test="processState != null">
  219. #{processState,jdbcType=INTEGER},
  220. </if>
  221. <if test="status != null">
  222. #{status,jdbcType=INTEGER},
  223. </if>
  224. <if test="type != null">
  225. #{type,jdbcType=INTEGER},
  226. </if>
  227. <if test="createTime != null">
  228. #{createTime,jdbcType=TIMESTAMP},
  229. </if>
  230. <if test="remarks != null">
  231. #{remarks,jdbcType=VARCHAR},
  232. </if>
  233. <if test="voucherUrl != null">
  234. #{voucherUrl,jdbcType=VARCHAR},
  235. </if>
  236. <if test="totalAmount != null">
  237. #{totalAmount,jdbcType=DECIMAL},
  238. </if>
  239. <if test="settlementAmount != null">
  240. #{settlementAmount,jdbcType=DECIMAL},
  241. </if>
  242. <if test="changeAmount != null">
  243. #{changeAmount,jdbcType=DECIMAL},
  244. </if>
  245. <if test="applicant != null">
  246. #{applicant,jdbcType=VARCHAR},
  247. </if>
  248. <if test="depName != null">
  249. #{depName,jdbcType=VARCHAR},
  250. </if>
  251. <if test="projectState != null">
  252. #{projectState,jdbcType=VARCHAR},
  253. </if>
  254. <if test="zxsCost != null">
  255. #{zxsCost,jdbcType=DECIMAL},
  256. </if>
  257. <if test="zxsRemarks != null">
  258. #{zxsRemarks,jdbcType=VARCHAR},
  259. </if>
  260. <if test="paymentTime != null">
  261. #{paymentTime,jdbcType=TIMESTAMP},
  262. </if>
  263. <if test="paymentAmount != null">
  264. #{paymentAmount,jdbcType=DECIMAL},
  265. </if>
  266. <if test="invoiceTime != null">
  267. #{invoiceTime,jdbcType=TIMESTAMP},
  268. </if>
  269. <if test="invoiceAmount != null">
  270. #{invoiceAmount,jdbcType=DECIMAL},
  271. </if>
  272. <if test="invoiceType != null">
  273. #{invoiceType,jdbcType=VARCHAR},
  274. </if>
  275. <if test="cwCost != null">
  276. #{cwCost,jdbcType=DECIMAL},
  277. </if>
  278. <if test="refundableAmount != null">
  279. #{refundableAmount,jdbcType=DECIMAL},
  280. </if>
  281. <if test="cwRemarks != null">
  282. #{cwRemarks,jdbcType=VARCHAR},
  283. </if>
  284. <if test="estimateCost != null">
  285. #{estimateCost,jdbcType=DECIMAL},
  286. </if>
  287. <if test="estimateRefundable != null">
  288. #{estimateRefundable,jdbcType=DECIMAL},
  289. </if>
  290. <if test="refundInvoice != null">
  291. #{refundInvoice,jdbcType=DECIMAL},
  292. </if>
  293. <if test="usedOrder != null">
  294. #{usedOrder,jdbcType=VARCHAR},
  295. </if>
  296. <if test="refundStatus != null">
  297. #{refundStatus,jdbcType=INTEGER},
  298. </if>
  299. <if test="refundUrl != null">
  300. #{refundUrl,jdbcType=VARCHAR},
  301. </if>
  302. <if test="backStatus != null">
  303. #{backStatus,jdbcType=INTEGER},
  304. </if>
  305. <if test="attachmentUrl != null">
  306. #{attachmentUrl,jdbcType=VARCHAR},
  307. </if>
  308. <if test="contractPictureUrl != null">
  309. #{contractPictureUrl,jdbcType=VARCHAR},
  310. </if>
  311. <if test="firstAmount != null">
  312. #{firstAmount,jdbcType=DECIMAL},
  313. </if>
  314. <if test="examineName != null">
  315. #{examineName,jdbcType=VARCHAR},
  316. </if>
  317. <if test="cwIndirectCost != null">
  318. #{cwIndirectCost,jdbcType=DECIMAL},
  319. </if>
  320. <if test="contacts != null">
  321. #{contacts,jdbcType=VARCHAR},
  322. </if>
  323. <if test="contactMobile != null">
  324. #{contactMobile,jdbcType=VARCHAR},
  325. </if>
  326. <if test="managerContacts != null">
  327. #{managerContacts,jdbcType=VARCHAR},
  328. </if>
  329. <if test="managerContactMobile != null">
  330. #{managerContactMobile,jdbcType=VARCHAR},
  331. </if>
  332. </trim>
  333. </insert>
  334. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.NewOrderChange">
  335. update new_order_change
  336. <set>
  337. <if test="orderNo != null">
  338. order_no = #{orderNo,jdbcType=VARCHAR},
  339. </if>
  340. <if test="processState != null">
  341. process_state = #{processState,jdbcType=INTEGER},
  342. </if>
  343. <if test="status != null">
  344. `status` = #{status,jdbcType=INTEGER},
  345. </if>
  346. <if test="type != null">
  347. `type` = #{type,jdbcType=INTEGER},
  348. </if>
  349. <if test="createTime != null">
  350. create_time = #{createTime,jdbcType=TIMESTAMP},
  351. </if>
  352. <if test="remarks != null">
  353. remarks = #{remarks,jdbcType=VARCHAR},
  354. </if>
  355. <if test="voucherUrl != null">
  356. voucher_url = #{voucherUrl,jdbcType=VARCHAR},
  357. </if>
  358. <if test="totalAmount != null">
  359. total_amount = #{totalAmount,jdbcType=DECIMAL},
  360. </if>
  361. <if test="settlementAmount != null">
  362. settlement_amount = #{settlementAmount,jdbcType=DECIMAL},
  363. </if>
  364. <if test="changeAmount != null">
  365. change_amount = #{changeAmount,jdbcType=DECIMAL},
  366. </if>
  367. <if test="applicant != null">
  368. applicant = #{applicant,jdbcType=VARCHAR},
  369. </if>
  370. <if test="depName != null">
  371. dep_name = #{depName,jdbcType=VARCHAR},
  372. </if>
  373. <if test="projectState != null">
  374. project_state = #{projectState,jdbcType=VARCHAR},
  375. </if>
  376. <if test="zxsCost != null">
  377. zxs_cost = #{zxsCost,jdbcType=DECIMAL},
  378. </if>
  379. <if test="zxsRemarks != null">
  380. zxs_remarks = #{zxsRemarks,jdbcType=VARCHAR},
  381. </if>
  382. <if test="paymentTime != null">
  383. payment_time = #{paymentTime,jdbcType=TIMESTAMP},
  384. </if>
  385. <if test="paymentAmount != null">
  386. payment_amount = #{paymentAmount,jdbcType=DECIMAL},
  387. </if>
  388. <if test="invoiceTime != null">
  389. invoice_time = #{invoiceTime,jdbcType=TIMESTAMP},
  390. </if>
  391. <if test="invoiceAmount != null">
  392. invoice_amount = #{invoiceAmount,jdbcType=DECIMAL},
  393. </if>
  394. <if test="invoiceType != null">
  395. invoice_type = #{invoiceType,jdbcType=VARCHAR},
  396. </if>
  397. <if test="cwCost != null">
  398. cw_cost = #{cwCost,jdbcType=DECIMAL},
  399. </if>
  400. <if test="refundableAmount != null">
  401. refundable_amount = #{refundableAmount,jdbcType=DECIMAL},
  402. </if>
  403. <if test="cwRemarks != null">
  404. cw_remarks = #{cwRemarks,jdbcType=VARCHAR},
  405. </if>
  406. <if test="estimateCost != null">
  407. estimate_cost = #{estimateCost,jdbcType=DECIMAL},
  408. </if>
  409. <if test="estimateRefundable != null">
  410. estimate_refundable = #{estimateRefundable,jdbcType=DECIMAL},
  411. </if>
  412. <if test="refundInvoice != null">
  413. refund_Invoice = #{refundInvoice,jdbcType=DECIMAL},
  414. </if>
  415. <if test="usedOrder != null">
  416. used_order = #{usedOrder,jdbcType=VARCHAR},
  417. </if>
  418. <if test="refundStatus != null">
  419. refund_status = #{refundStatus,jdbcType=INTEGER},
  420. </if>
  421. <if test="refundUrl != null">
  422. refund_url = #{refundUrl,jdbcType=VARCHAR},
  423. </if>
  424. <if test="backStatus != null">
  425. back_status = #{backStatus,jdbcType=INTEGER},
  426. </if>
  427. <if test="attachmentUrl != null">
  428. attachment_url = #{attachmentUrl,jdbcType=VARCHAR},
  429. </if>
  430. <if test="contractPictureUrl != null">
  431. contract_picture_url = #{contractPictureUrl,jdbcType=VARCHAR},
  432. </if>
  433. <if test="firstAmount != null">
  434. first_amount = #{firstAmount,jdbcType=DECIMAL},
  435. </if>
  436. <if test="examineName != null">
  437. examine_name = #{examineName,jdbcType=VARCHAR},
  438. </if>
  439. <if test="cwIndirectCost != null">
  440. cw_indirect_cost=#{cwIndirectCost,jdbcType=DECIMAL},
  441. </if>
  442. <if test="contacts != null">
  443. contacts=#{contacts,jdbcType=VARCHAR},
  444. </if>
  445. <if test="contactMobile != null">
  446. contact_mobile=#{contactMobile,jdbcType=VARCHAR},
  447. </if>
  448. <if test="managerContacts != null">
  449. manager_contacts=#{managerContacts,jdbcType=VARCHAR},
  450. </if>
  451. <if test="managerContactMobile != null">
  452. manager_contact_mobile=#{managerContactMobile,jdbcType=VARCHAR},
  453. </if>
  454. </set>
  455. where id = #{id,jdbcType=INTEGER}
  456. </update>
  457. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.NewOrderChange">
  458. update new_order_change
  459. set order_no = #{orderNo,jdbcType=VARCHAR},
  460. process_state = #{processState,jdbcType=INTEGER},
  461. `status` = #{status,jdbcType=INTEGER},
  462. `type` = #{type,jdbcType=INTEGER},
  463. create_time = #{createTime,jdbcType=TIMESTAMP},
  464. remarks = #{remarks,jdbcType=VARCHAR},
  465. voucher_url = #{voucherUrl,jdbcType=VARCHAR},
  466. total_amount = #{totalAmount,jdbcType=DECIMAL},
  467. settlement_amount = #{settlementAmount,jdbcType=DECIMAL},
  468. change_amount = #{changeAmount,jdbcType=DECIMAL},
  469. applicant = #{applicant,jdbcType=VARCHAR},
  470. dep_name = #{depName,jdbcType=VARCHAR},
  471. project_state = #{projectState,jdbcType=VARCHAR},
  472. zxs_cost = #{zxsCost,jdbcType=DECIMAL},
  473. zxs_remarks = #{zxsRemarks,jdbcType=VARCHAR},
  474. payment_time = #{paymentTime,jdbcType=TIMESTAMP},
  475. payment_amount = #{paymentAmount,jdbcType=DECIMAL},
  476. invoice_time = #{invoiceTime,jdbcType=TIMESTAMP},
  477. invoice_amount = #{invoiceAmount,jdbcType=DECIMAL},
  478. invoice_type = #{invoiceType,jdbcType=VARCHAR},
  479. cw_cost = #{cwCost,jdbcType=DECIMAL},
  480. refundable_amount = #{refundableAmount,jdbcType=DECIMAL},
  481. cw_remarks = #{cwRemarks,jdbcType=VARCHAR},
  482. estimate_cost = #{estimateCost,jdbcType=DECIMAL},
  483. estimate_refundable = #{estimateRefundable,jdbcType=DECIMAL},
  484. refund_Invoice = #{refundInvoice,jdbcType=DECIMAL},
  485. used_order = #{usedOrder,jdbcType=VARCHAR},
  486. refund_status = #{refundStatus,jdbcType=INTEGER},
  487. refund_url = #{refundUrl,jdbcType=VARCHAR},
  488. back_status = #{backStatus,jdbcType=INTEGER},
  489. attachment_url = #{attachmentUrl,jdbcType=VARCHAR},
  490. contract_picture_url = #{contractPictureUrl,jdbcType=VARCHAR},
  491. first_amount = #{firstAmount,jdbcType=DECIMAL},
  492. examine_name = #{examineName,jdbcType=VARCHAR},
  493. cw_indirect_cost=#{cwIndirectCost,jdbcType=DECIMAL},
  494. contacts=#{contacts,jdbcType=VARCHAR},
  495. contact_mobile=#{contactMobile,jdbcType=VARCHAR},
  496. manager_contacts=#{managerContacts,jdbcType=VARCHAR},
  497. manager_contact_mobile=#{managerContactMobile,jdbcType=VARCHAR}
  498. where id = #{id,jdbcType=INTEGER}
  499. </update>
  500. <select id="selectByorderNo" resultType="com.goafanti.order.bo.NewOrderChangeBo">
  501. select
  502. a.id, a.order_no orderNo, a.process_state processState, a.status, a.`type`,a.refundable_amount refundableAmount,
  503. date_format(a.create_time, '%Y-%m-%d %H:%i:%S')createTimes, a.remarks, a.voucher_url voucherUrl,a.cw_cost cwCost,
  504. a.total_amount totalAmount, a.settlement_amount settlementAmount, (a.total_amount-a.settlement_amount) arrears,
  505. a.change_amount changeAmount, a.applicant, a.dep_name depName, a.project_state projectState, a.zxs_cost zxsCost,
  506. a.zxs_remarks zxsRemarks, date_format(a.payment_time, '%Y-%m-%d')paymentTimes, a.payment_amount paymentAmount,
  507. date_format(a. invoice_time, '%Y-%m-%d') invoiceTimes, a.invoice_amount invoiceAmount,a.invoice_type invoiceType,
  508. a.cw_remarks cwRemarks,a.contract_picture_url contractPictureUrl,a.first_amount firstAmount,a.examine_name examineName,
  509. a.cw_indirect_cost cwIndirectCost,
  510. a.contacts contacts,
  511. a.contact_mobile contactMobile,
  512. a.manager_contacts managerContacts,
  513. a.manager_contact_mobile managerContactMobile
  514. from new_order_change a where 1 = 1
  515. and a.order_no= #{orderNo}
  516. order by a.create_time desc limit 1
  517. </select>
  518. <select id="selectByChangeId" resultType="com.goafanti.order.bo.NewOrderChangeBo">
  519. select
  520. a.id, a.order_no orderNo, a.process_state processState, a.status, a.`type`,a.refundable_amount refundableAmount,
  521. date_format(a.create_time, '%Y-%m-%d %H:%i:%S')createTimes, a.remarks, a.voucher_url voucherUrl,a.cw_cost cwCost,
  522. a.total_amount totalAmount, a.settlement_amount settlementAmount, (a.total_amount-a.settlement_amount) arrears,
  523. a.change_amount changeAmount, a.applicant, a.dep_name depName, a.project_state projectState, a.zxs_cost zxsCost,
  524. a.zxs_remarks zxsRemarks, date_format(a.payment_time, '%Y-%m-%d')paymentTimes, a.payment_amount paymentAmount,
  525. date_format(a. invoice_time, '%Y-%m-%d') invoiceTimes, a.invoice_amount invoiceAmount,a.invoice_type invoiceType,
  526. a.cw_remarks cwRemarks,a.back_status backStatus ,a.contract_picture_url contractPictureUrl,a.first_amount firstAmount,
  527. a.cw_indirect_cost cwIndirectCost,
  528. a.contacts contacts,
  529. a.contact_mobile contactMobile,
  530. a.manager_contacts managerContacts,
  531. a.manager_contact_mobile managerContactMobile
  532. from new_order_change a where 1 = 1
  533. and a.id= #{ChangeId}
  534. order by a.create_time desc
  535. </select>
  536. <select id="selectByorderNoAndStatus" resultType="com.goafanti.order.bo.NewOrderChangeBo">
  537. select
  538. a.id, a.order_no orderNo, a.process_state processState, a.status, a.`type`,a.refundable_amount refundableAmount,
  539. date_format(a.create_time, '%Y-%m-%d %H:%i:%S')createTimes, a.remarks, a.voucher_url voucherUrl,a.cw_cost cwCost,
  540. a.total_amount totalAmount, a.settlement_amount settlementAmount, (a.total_amount-a.settlement_amount) arrears,
  541. a.change_amount changeAmount, a.applicant, a.dep_name depName, a.project_state projectState, a.zxs_cost zxsCost,
  542. a.zxs_remarks zxsRemarks, date_format(a.payment_time, '%Y-%m-%d')paymentTimes, a.payment_amount paymentAmount,a.first_amount firstAmount,
  543. date_format(a. invoice_time, '%Y-%m-%d') invoiceTimes, a.invoice_amount invoiceAmount,a.invoice_type invoiceType,
  544. a.cw_remarks cwRemarks,a.back_status backStatus
  545. from new_order_change a where 1 = 1 and status in (0,1,2,3)
  546. and a.order_no= #{orderNo}
  547. order by a.create_time desc
  548. </select>
  549. <select id="selectById" resultType="com.goafanti.order.bo.NewOrderChangeBo">
  550. select
  551. a.id, a.order_no orderNo, a.process_state processState, a.status, a.`type`,a.refundable_amount refundableAmount,a.refund_url refundUrl,
  552. date_format(a.create_time, '%Y-%m-%d %H:%i:%S')createTimes, a.remarks, a.voucher_url voucherUrl,a.cw_cost cwCost,a.refund_status refundStatus,
  553. a.total_amount totalAmount, a.settlement_amount settlementAmount, (a.total_amount-a.settlement_amount) arrears,a.attachment_url attachmentUrl,
  554. a.change_amount changeAmount, a.applicant, a.dep_name depName, a.project_state projectState, a.zxs_cost zxsCost,a.first_amount firstAmount,
  555. a.zxs_remarks zxsRemarks, date_format(a.payment_time, '%Y-%m-%d')paymentTimes, a.payment_amount paymentAmount,a.examine_name examineName,
  556. date_format(a. invoice_time, '%Y-%m-%d') invoiceTimes, a.invoice_amount invoiceAmount,a.invoice_type invoiceType,
  557. a.cw_remarks cwRemarks,a.estimate_cost estimateCost,estimate_refundable estimateRefundable,refund_Invoice refundInvoice,a.contract_picture_url contractPictureUrl,
  558. a.cw_indirect_cost cwIndirectCost,
  559. a.contacts contacts,
  560. a.contact_mobile contactMobile,
  561. a.manager_contacts managerContacts,
  562. a.manager_contact_mobile managerContactMobile
  563. from new_order_change a where 1 = 1 and a.id= #{id}
  564. </select>
  565. <select id="checkOderNo" resultType="java.lang.Integer">
  566. select count(*) from new_order_change
  567. where order_no= #{orderNo} and status in (0,1,2,3,6)
  568. </select>
  569. <select id="selectOrderChangeList" resultType="com.goafanti.order.bo.NewOderCahngeListBo">
  570. select a.id,a.order_no orderNo,b.contract_no contractNo, date_format(a.create_time,'%Y-%m-%d %H:%i:%S')createTimes,c.nickname,b.order_type orderType,
  571. date_format(b.create_time,'%Y-%m-%d %H:%i:%S')establishTimes, b.order_status orderStatus,b.total_amount totalAmount,a.status ,a.examine_name examineName,
  572. b.settlement_amount settlementAmount,(b.total_amount-b.settlement_amount) arrears,d.name salesmanName,e.name depName,a.`type`,
  573. a.process_state processState,a.back_status backStatus,noc.cw_indirect_cost cwIndirectCost,
  574. noc.contacts contacts,
  575. noc.contact_mobile contactMobile,
  576. noc.manager_contacts managerContacts,
  577. noc.manager_contact_mobile managerContactMobile
  578. from new_order_change noc left join new_order_change a on noc.id=a.id
  579. left join t_order_new b on a.order_no=b.order_no left join user c on b.buyer_id=c.id left join admin d on b.salesman_id=d.id
  580. left join department e on b.order_dep=e.id
  581. <if test="processState==3">
  582. left join (select order_no, aid from order_examine where`type`=0
  583. <if test="complete ==1">
  584. and status=0
  585. </if>
  586. <if test="complete ==2">
  587. and status=1
  588. </if>
  589. group by order_no,aid)x on a.order_no = x.order_no
  590. </if>
  591. <if test="processState==4">
  592. left join (select order_no, aid from order_examine where`type`=1
  593. <if test="complete ==1">
  594. and status=0
  595. </if>
  596. <if test="complete ==2">
  597. and status=1
  598. </if>
  599. group by order_no,aid)x on a.order_no = x.order_no
  600. </if>
  601. where 1=1
  602. <if test="processState==0">
  603. and b.salesman_id= #{aid}
  604. </if>
  605. <if test="processState==1">
  606. and d.manager_id= #{aid}
  607. </if>
  608. <if test="processState==3 and complete !=5">
  609. and x.aid=#{aid} and a.process_state &gt;= #{processState}
  610. </if>
  611. <if test="processState==4 and complete !=5">
  612. and x.aid=#{aid} and a.process_state &gt;= #{processState}
  613. </if>
  614. <if test="processState==3 and complete ==5">
  615. and x.aid=#{aid} and a.back_status &gt;= #{processState}
  616. </if>
  617. <if test="processState==4 and complete ==5">
  618. and x.aid=#{aid} and a.back_status &gt;= #{processState}
  619. </if>
  620. <if test="processState==6 and aid !=null">
  621. and e.finance_id =#{aid}
  622. </if>
  623. <if test="processState==6 and aids !=null">
  624. and e.finance_id in
  625. <foreach close=")" collection="aids" item="id" open="(" separator=",">
  626. #{id}
  627. </foreach>
  628. </if>
  629. <if test="processState==8 and aid !=null">
  630. and e.approval_aid =#{aid}
  631. </if>
  632. <if test="userName !=null">
  633. and c.nickname like concat('%',#{userName},'%')
  634. </if>
  635. <if test="orderNo !=null">
  636. and a.order_no like concat('%',#{orderNo},'%')
  637. </if>
  638. <if test="contractNo !=null">
  639. and b.contract_no like concat('%',#{contractNo},'%')
  640. </if>
  641. <if test="type !=null">
  642. and a.type = #{type}
  643. </if>
  644. <if test="timeType == 0 and startTime !=null and endTime !=null">
  645. and a.create_time between #{startTime} and #{endTime}
  646. </if>
  647. <if test="timeType == 1 and startTime !=null and endTime !=null">
  648. and b.create_time between #{startTime} and #{endTime}
  649. </if>
  650. <if test="deps !=null">
  651. and b.order_dep in
  652. <foreach close=")" collection="deps" item="depId" open="(" separator=",">
  653. #{depId}
  654. </foreach>
  655. </if>
  656. <if test="salesmanName !=null">
  657. and d.name like concat('%',#{salesmanName},'%')
  658. </if>
  659. <if test="complete ==0 and processState != 5 and processState &lt; 7">
  660. and ((a.process_state &gt;= #{processState} or a.back_status &gt;= #{processState}))
  661. </if>
  662. <if test="complete ==0 and (processState == 5 or processState == 7)">
  663. and ((a.process_state &gt;= #{processState} and a.process_state &lt; 10)or a.back_status &gt;= #{processState})
  664. </if>
  665. <if test="complete ==0 and processState == 8">
  666. and ((a.process_state &gt;= 8 and a.process_state &lt; 10)or a.back_status &gt;= #{processState})
  667. </if>
  668. <if test="complete ==0 and processState == 9">
  669. and ((a.process_state = 9 )or a.back_status &gt;= #{processState})
  670. </if>
  671. <if test="complete ==1 and processState &lt; 6">
  672. and a.process_state = #{processState} and a.status in (0,1,2,3)
  673. </if>
  674. <if test="complete ==1 and processState == 6">
  675. and (a.process_state in(6) and a.status in (0,1,2,3,5,6))
  676. </if>
  677. <if test="complete ==1 and processState > 6">
  678. and (a.process_state = #{processState} and a.status =1)
  679. </if>
  680. <if test="complete ==2 and processState != 6 and processState != 8 and processState != 9 and processState !=3 and processState !=4">
  681. and a.process_state &gt; #{processState}
  682. </if>
  683. <if test="complete ==2 and processState == 6">
  684. and((a.process_state &gt; 6 and a.process_state &lt; 10) or (a.process_state =6 and a.status=4))
  685. </if>
  686. <if test="complete ==2 and processState == 8">
  687. and ((a.process_state = 8 and a.status in(2,4))or a.process_state &gt; 8)
  688. </if>
  689. <if test="complete ==2 and processState == 9">
  690. and a.process_state = 9 and a.status in (2,4)
  691. </if>
  692. <if test="complete ==3">
  693. and a.status = 2
  694. </if>
  695. <if test="complete ==4">
  696. and a.status = 4
  697. </if>
  698. <if test="complete ==5 and processState != 3 and processState != 4">
  699. and a.back_status = #{processState}
  700. </if>
  701. <if test="complete ==6">
  702. and a.status = 6
  703. </if>
  704. order by a.status,a.create_time desc
  705. <if test="page_sql != null">
  706. ${page_sql}
  707. </if>
  708. </select>
  709. <select id="selectOrderChangeCount" resultType="java.lang.Integer">
  710. select count(*) from new_order_change noc left join new_order_change a on noc.id=a.id
  711. left join t_order_new b on a.order_no=b.order_no left join user c on b.buyer_id=c.id
  712. left join admin d on b.salesman_id=d.id left join department e on b.order_dep=e.id
  713. <if test="processState==3">
  714. left join (select order_no, aid from order_examine where`type`=0
  715. <if test="complete ==1">
  716. and status=0
  717. </if>
  718. <if test="complete ==2">
  719. and status=1
  720. </if>
  721. group by order_no,aid)x on a.order_no = x.order_no
  722. </if>
  723. <if test="processState==4">
  724. left join (select order_no, aid from order_examine where`type`=1
  725. <if test="complete ==1">
  726. and status=0
  727. </if>
  728. <if test="complete ==2">
  729. and status=1
  730. </if>
  731. group by order_no,aid)x on a.order_no = x.order_no
  732. </if>
  733. where 1=1
  734. <if test="processState==0">
  735. and b.salesman_id= #{aid}
  736. </if>
  737. <if test="processState==1">
  738. and d.manager_id= #{aid}
  739. </if>
  740. <if test="processState==3 and complete !=5">
  741. and x.aid=#{aid} and a.process_state &gt;= #{processState}
  742. </if>
  743. <if test="processState==4 and complete !=5">
  744. and x.aid=#{aid} and a.process_state &gt;= #{processState}
  745. </if>
  746. <if test="processState==3 and complete ==5">
  747. and x.aid=#{aid} and a.back_status &gt;= #{processState}
  748. </if>
  749. <if test="processState==4 and complete ==5">
  750. and x.aid=#{aid} and a.back_status &gt;= #{processState}
  751. </if>
  752. <if test="processState==6 and aid !=null">
  753. and e.finance_id =#{aid}
  754. </if>
  755. <if test="processState==6 and aids !=null">
  756. and e.finance_id in
  757. <foreach close=")" collection="aids" item="id" open="(" separator=",">
  758. #{id}
  759. </foreach>
  760. </if>
  761. <if test="processState==8 and aid !=null">
  762. and e.approval_aid =#{aid}
  763. </if>
  764. <if test="userName !=null">
  765. and c.nickname like concat('%',#{userName},'%')
  766. </if>
  767. <if test="orderNo !=null">
  768. and a.order_no like concat('%',#{orderNo},'%')
  769. </if>
  770. <if test="contractNo !=null">
  771. and b.contract_no like concat('%',#{contractNo},'%')
  772. </if>
  773. <if test="type !=null">
  774. and a.type = #{type}
  775. </if>
  776. <if test="timeType == 0 and startTime !=null and endTime !=null">
  777. and a.create_time between #{startTime} and #{endTime}
  778. </if>
  779. <if test="timeType == 1 and startTime !=null and endTime !=null">
  780. and b.create_time between #{startTime} and #{endTime}
  781. </if>
  782. <if test="deps !=null">
  783. and b.order_dep in
  784. <foreach close=")" collection="deps" item="depId" open="(" separator=",">
  785. #{depId}
  786. </foreach>
  787. </if>
  788. <if test="salesmanName !=null">
  789. and d.name like concat('%',#{salesmanName},'%')
  790. </if>
  791. <if test="complete ==0 and processState != 5 and processState &lt; 7">
  792. and ((a.process_state &gt;= #{processState} or a.back_status &gt;= #{processState}))
  793. </if>
  794. <if test="complete ==0 and (processState == 5 or processState == 7)">
  795. and ((a.process_state &gt;= #{processState} and a.process_state &lt; 10)or a.back_status &gt;= #{processState})
  796. </if>
  797. <if test="complete ==0 and processState == 8">
  798. and ((a.process_state &gt;= 8 and a.process_state &lt; 10)or a.back_status &gt;= #{processState})
  799. </if>
  800. <if test="complete ==0 and processState == 9">
  801. and ((a.process_state = 9 )or a.back_status &gt;= #{processState})
  802. </if>
  803. <if test="complete ==1 and processState &lt; 6">
  804. and a.process_state = #{processState} and a.status in (0,1,2,3)
  805. </if>
  806. <if test="complete ==1 and processState == 6">
  807. and (a.process_state in(6) and a.status in (0,1,2,3,5,6))
  808. </if>
  809. <if test="complete ==1 and processState > 6">
  810. and (a.process_state = #{processState} and a.status =1)
  811. </if>
  812. <if test="complete ==2 and processState != 6 and processState != 8 and processState != 9 and processState !=3 and processState !=4">
  813. and a.process_state &gt; #{processState}
  814. </if>
  815. <if test="complete ==2 and processState == 6">
  816. and((a.process_state &gt; 6 and a.process_state &lt; 10) or (a.process_state =6 and a.status=4))
  817. </if>
  818. <if test="complete ==2 and processState == 8">
  819. and ((a.process_state = 8 and a.status in(2,4))or a.process_state &gt; 8)
  820. </if>
  821. <if test="complete ==2 and processState == 9">
  822. and a.process_state = 9 and a.status in (2,4)
  823. </if>
  824. <if test="complete ==3">
  825. and a.status = 2
  826. </if>
  827. <if test="complete ==4">
  828. and a.status = 4
  829. </if>
  830. <if test="complete ==5 and processState != 3 and processState != 4">
  831. and a.back_status = #{processState}
  832. </if>
  833. <if test="complete ==6">
  834. and a.status = 6
  835. </if>
  836. </select>
  837. <update id="addRefundInvoice">
  838. update new_order_change
  839. set `refund_Invoice`=ifnull(`refund_Invoice`,0)+ #{amount}
  840. where order_no= #{orderNo}
  841. </update>
  842. <update id="subtractRefundInvoice">
  843. update new_order_change
  844. set `refund_Invoice`=ifnull(`refund_Invoice`,0)- #{amount}
  845. where order_no= #{orderNo}
  846. </update>
  847. <select id="getOrderChange" resultType="java.util.Map">
  848. select id,used_order usedOrder from new_order_change where order_no= #{orderNo} order by id desc
  849. </select>
  850. <update id="updateTaskExamineName">
  851. update new_order_change n left join (select c.id
  852. from t_order_new a left join t_order_task b on a.order_no =b.order_no
  853. left join new_order_change c on a.order_no =c.order_no
  854. where (b.consultant_id in (#{aid},#{taskReceiverId}) or b.manager_id in (#{aid},#{taskReceiverId}))
  855. and c.process_state in (#{type}) group by c.id)x on n.id =x.id
  856. left join (select a.order_no ,group_concat(DISTINCT b.name)name from order_examine a left join admin b on a.aid=b.id
  857. where 1=1
  858. <if test="type==3">
  859. and a.type=0
  860. </if>
  861. <if test="type==4">
  862. and a.type=1
  863. </if>
  864. group by a.order_no ) a on n.order_no =a.order_no
  865. set n.examine_name =a.name
  866. where n.process_state =#{type}
  867. </update>
  868. <update id="updateExamineById">
  869. update new_order_change a left join t_order_new b on a.order_no =b.order_no
  870. <if test="type==0 or type==1">
  871. left join admin c on b.salesman_id =c.id
  872. left join admin d on c.manager_id =d.id
  873. set a.examine_name=d.name
  874. where a.process_state =1 and d.id = #{id}
  875. </if>
  876. <if test="type==1">
  877. left join admin c on b.salesman_id =c.id
  878. set a.examine_name=c.name
  879. where a.process_state =1 and c.manager_id = #{id}
  880. </if>
  881. <if test="type==2">
  882. left join (select a.department_id depId,group_concat(a.name) name
  883. from admin a left join admin b on a.department_id =b.department_id
  884. left join user_role c on a.id=c.uid left join `role` d on c.rid =d.id
  885. where b.id= #{id} and d.role_type ='9996'
  886. and a.status ='0' group by b.department_id )x on b.order_dep=x.depId
  887. set a.examine_name=x.name
  888. where a.process_state =2
  889. </if>
  890. <if test="type==3">
  891. left join t_order_task c on a.order_no =c.order_no
  892. left join (select a.order_no ,a.`type` ,GROUP_CONCAT(distinct b.name) name
  893. from order_examine a left join admin b on a.aid=b.id where a.`type` =0
  894. group by order_no ,type)d on a.order_no =d.order_no
  895. set a.examine_name =d.name
  896. where a.process_state =3 and c.manager_id = #{id}
  897. </if>
  898. <if test="type==4">
  899. left join t_order_task c on a.order_no =c.order_no
  900. left join (select a.order_no ,a.`type` ,GROUP_CONCAT(distinct b.name) name
  901. from order_examine a left join admin b on a.aid=b.id where a.`type` =1
  902. group by order_no ,type)d on a.order_no =d.order_no
  903. set a.examine_name =d.name
  904. where a.process_state =3 and c.consultant_id = #{id}
  905. </if>
  906. <if test="type==6">
  907. left join department c on b.order_dep =c.id
  908. left join admin d on c.finance_id =d.id
  909. set a.examine_name=d.name
  910. where a.process_state =6 and d.id = #{id}
  911. </if>
  912. <if test="type==5 or type==7">
  913. left join (select group_concat(a.name) name
  914. from admin a left join user_role b on a.id=b.uid
  915. left join `role` c on b.rid =c.id
  916. <if test="type==5">
  917. where c.role_type in ('9998') and a.status ='0'
  918. </if>
  919. <if test="type==7">
  920. where c.role_type in ('9997') and a.status ='0'
  921. </if>
  922. )c on 1=1
  923. set a.examine_name =c.name
  924. where a.process_state = #{type}
  925. </if>
  926. </update>
  927. <select id="getProcessName" resultType="com.goafanti.order.bo.OutProcessName">
  928. select a.id,a.order_no orderNo ,a.`type`,a.change_amount changeAmount ,a.status,a.process_state processState,
  929. if(dep.province=11,1,0)isHN, da.name approvalName,dep.approval approvalStatus,
  930. c.name yxy,mg.name yxjl, yxgly.name yxgly,zxs.name zxs,zxsjl.name zxsjl, zxsgly.name zxsgly,
  931. fm.name cwzy,cwgly.name cwgly,dsz.name dsz,b.salesman_id salesmanId
  932. from new_order_change a
  933. left join t_order_new b on a.order_no =b.order_no
  934. left join admin c on b.salesman_id =c.id
  935. left join department dep on b.order_dep =dep.id
  936. left join admin da on dep.approval_aid = da.id
  937. left join admin fm on dep.finance_id =fm.id
  938. left join admin mg on c.manager_id =mg.id
  939. left join (select a.department_id depId,group_concat(a.name) name
  940. from admin a left join user_role b on a.id=b.uid
  941. left join `role` c on b.rid =c.id
  942. where c.role_type ='9996' and a.status ='0' group by a.department_id )yxgly on b.order_dep =yxgly.depId
  943. left join (select a.order_no ,a.`type` ,GROUP_CONCAT(distinct b.name) name
  944. from order_examine a left join admin b on a.aid=b.id where a.order_no = #{orderNo} and a.`type` =0
  945. group by order_no ,type)zxs on a.order_no =zxs.order_no
  946. left join (select a.order_no ,a.`type` ,GROUP_CONCAT(distinct b.name) name
  947. from order_examine a left join admin b on a.aid=b.id where a.order_no = #{orderNo} and a.`type` =1
  948. group by order_no ,type)zxsjl on a.order_no =zxsjl.order_no
  949. left join (select group_concat(a.name) name
  950. from admin a left join user_role b on a.id=b.uid
  951. left join `role` c on b.rid =c.id
  952. where c.role_type in ('99998','99988') and a.status ='0' ) zc on 1=1
  953. left join (select group_concat(a.name) name
  954. from admin a left join user_role b on a.id=b.uid
  955. left join `role` c on b.rid =c.id
  956. where c.role_type in ('99996') and a.status ='0' ) fzc on 1=1
  957. left join (select group_concat(a.name) name
  958. from admin a left join user_role b on a.id=b.uid
  959. left join `role` c on b.rid =c.id
  960. where c.role_type in ('99999','99989') and a.status ='0' ) dsz on 1=1
  961. left join (select group_concat(a.name) name
  962. from admin a left join user_role b on a.id=b.uid
  963. left join `role` c on b.rid =c.id
  964. where c.role_type in ('9998') and a.status ='0' ) zxsgly on 1=1
  965. left join (select group_concat(a.name) name
  966. from admin a left join user_role b on a.id=b.uid
  967. left join `role` c on b.rid =c.id
  968. where c.role_type in ('9997') and a.status ='0' ) cwgly on 1=1
  969. where a.id= #{id}
  970. </select>
  971. <select id="selectProcess" resultType="java.lang.Integer">
  972. select t0.id from (select x.id
  973. from (select a.id from new_order_change a left join t_order_task c on a.order_no =c.order_no
  974. where a.process_state= #{type}
  975. <if test="type==3">
  976. and c.consultant_id = #{aid}
  977. </if>
  978. <if test="type==4">
  979. and c.manager_id = #{aid}
  980. </if>
  981. group by a.id)x
  982. left join new_order_change z on x.id=z.id
  983. left join order_examine y on z.order_no=y.order_no
  984. where y.`type` =0 group by x.id)t0
  985. </select>
  986. </mapper>