TOrderNewMapper.xml 78 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925
  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.TOrderNewMapper">
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.TOrderNew">
  5. <id column="order_no" jdbcType="VARCHAR" property="orderNo" />
  6. <result column="order_type" jdbcType="INTEGER" property="orderType" />
  7. <result column="creater" jdbcType="VARCHAR" property="creater" />
  8. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  9. <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
  10. <result column="buyer_id" jdbcType="VARCHAR" property="buyerId" />
  11. <result column="first_amount" jdbcType="DECIMAL" property="firstAmount" />
  12. <result column="total_amount" jdbcType="DECIMAL" property="totalAmount" />
  13. <result column="settlement_amount" jdbcType="DECIMAL" property="settlementAmount" />
  14. <result column="refund_amount" jdbcType="DECIMAL" property="refundAmount" />
  15. <result column="order_status" jdbcType="INTEGER" property="orderStatus" />
  16. <result column="liquidation_status" jdbcType="INTEGER" property="liquidationStatus" />
  17. <result column="process_status" jdbcType="INTEGER" property="processStatus" />
  18. <result column="project_status" jdbcType="INTEGER" property="projectStatus" />
  19. <result column="approval" jdbcType="INTEGER" property="approval" />
  20. <result column="order_remarks" jdbcType="VARCHAR" property="orderRemarks" />
  21. <result column="delete_sign" jdbcType="INTEGER" property="deleteSign" />
  22. <result column="salesman_id" jdbcType="VARCHAR" property="salesmanId" />
  23. <result column="finance_id" jdbcType="VARCHAR" property="financeId" />
  24. <result column="technician_id" jdbcType="VARCHAR" property="technicianId" />
  25. <result column="sign_time" jdbcType="DATE" property="signTime" />
  26. <result column="settlement_time" jdbcType="DATE" property="settlementTime" />
  27. <result column="contract_picture_url" jdbcType="VARCHAR" property="contractPictureUrl" />
  28. <result column="contract_no" jdbcType="VARCHAR" property="contractNo" />
  29. <result column="contract_type" jdbcType="VARCHAR" property="contractType" />
  30. <result column="contacts" jdbcType="VARCHAR" property="contacts" />
  31. <result column="contact_mobile" jdbcType="VARCHAR" property="contactMobile" />
  32. <result column="legal_person" jdbcType="VARCHAR" property="legalPerson" />
  33. <result column="legal_person_tel" jdbcType="VARCHAR" property="legalPersonTel" />
  34. <result column="proof_count" jdbcType="FLOAT" property="proofCount" />
  35. <result column="proof_aid" jdbcType="VARCHAR" property="proofAid" />
  36. <result column="proof_time" jdbcType="TIMESTAMP" property="proofTime" />
  37. <result column="proof_status" jdbcType="INTEGER" property="proofStatus" />
  38. <result column="order_dep" jdbcType="VARCHAR" property="orderDep" />
  39. <result column="outsource" jdbcType="INTEGER" property="outsource" />
  40. <result column="additional_order" jdbcType="VARCHAR" property="additionalOrder" />
  41. <result column="primary_order" jdbcType="VARCHAR" property="primaryOrder" />
  42. <result column="old_salesman_id" jdbcType="VARCHAR" property="oldSalesmanId" />
  43. <result column="back_status" jdbcType="INTEGER" property="backStatus" />
  44. <result column="agreement_url" jdbcType="VARCHAR" property="agreementUrl" />
  45. <result column="new_user" jdbcType="INTEGER" property="newUser" />
  46. <result column="service_content" jdbcType="VARCHAR" property="serviceContent" />
  47. <result column="sales_type" jdbcType="INTEGER" property="salesType" />
  48. <result column="channel_id" jdbcType="VARCHAR" property="channelId" />
  49. <result column="other" jdbcType="VARCHAR" property="other" />
  50. <result column="user_type" jdbcType="INTEGER" property="userType" />
  51. </resultMap>
  52. <sql id="Base_Column_List">
  53. order_no, order_type, creater, create_time, update_time, buyer_id, first_amount,
  54. total_amount, settlement_amount, refund_amount, order_status, liquidation_status,
  55. process_status, project_status, approval, order_remarks, delete_sign, salesman_id,
  56. finance_id, technician_id, sign_time, settlement_time, contract_picture_url, contract_no,
  57. contract_type, contacts, contact_mobile, legal_person, legal_person_tel, proof_count,
  58. proof_aid, proof_time, proof_status, order_dep, outsource, additional_order, primary_order,
  59. old_salesman_id, back_status, agreement_url, new_user, service_content, sales_type,
  60. channel_id, other, user_type
  61. </sql>
  62. <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
  63. select
  64. <include refid="Base_Column_List" />
  65. from t_order_new
  66. where order_no = #{orderNo,jdbcType=VARCHAR}
  67. </select>
  68. <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
  69. delete from t_order_new
  70. where order_no = #{orderNo,jdbcType=VARCHAR}
  71. </delete>
  72. <insert id="insert" parameterType="com.goafanti.common.model.TOrderNew">
  73. insert into t_order_new (order_no, order_type, creater,
  74. create_time, update_time, buyer_id,
  75. first_amount, total_amount, settlement_amount,
  76. refund_amount, order_status, liquidation_status,
  77. process_status, project_status, approval,
  78. order_remarks, delete_sign, salesman_id,
  79. finance_id, technician_id, sign_time,
  80. settlement_time, contract_picture_url, contract_no,
  81. contract_type, contacts, contact_mobile,
  82. legal_person, legal_person_tel, proof_count,
  83. proof_aid, proof_time, proof_status,
  84. order_dep, outsource, additional_order,
  85. primary_order, old_salesman_id, back_status,
  86. agreement_url, new_user, service_content,
  87. sales_type, channel_id, other,
  88. user_type)
  89. values (#{orderNo,jdbcType=VARCHAR}, #{orderType,jdbcType=INTEGER}, #{creater,jdbcType=VARCHAR},
  90. #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{buyerId,jdbcType=VARCHAR},
  91. #{firstAmount,jdbcType=DECIMAL}, #{totalAmount,jdbcType=DECIMAL}, #{settlementAmount,jdbcType=DECIMAL},
  92. #{refundAmount,jdbcType=DECIMAL}, #{orderStatus,jdbcType=INTEGER}, #{liquidationStatus,jdbcType=INTEGER},
  93. #{processStatus,jdbcType=INTEGER}, #{projectStatus,jdbcType=INTEGER}, #{approval,jdbcType=INTEGER},
  94. #{orderRemarks,jdbcType=VARCHAR}, #{deleteSign,jdbcType=INTEGER}, #{salesmanId,jdbcType=VARCHAR},
  95. #{financeId,jdbcType=VARCHAR}, #{technicianId,jdbcType=VARCHAR}, #{signTime,jdbcType=DATE},
  96. #{settlementTime,jdbcType=DATE}, #{contractPictureUrl,jdbcType=VARCHAR}, #{contractNo,jdbcType=VARCHAR},
  97. #{contractType,jdbcType=VARCHAR}, #{contacts,jdbcType=VARCHAR}, #{contactMobile,jdbcType=VARCHAR},
  98. #{legalPerson,jdbcType=VARCHAR}, #{legalPersonTel,jdbcType=VARCHAR}, #{proofCount,jdbcType=FLOAT},
  99. #{proofAid,jdbcType=VARCHAR}, #{proofTime,jdbcType=TIMESTAMP}, #{proofStatus,jdbcType=INTEGER},
  100. #{orderDep,jdbcType=VARCHAR}, #{outsource,jdbcType=INTEGER}, #{additionalOrder,jdbcType=VARCHAR},
  101. #{primaryOrder,jdbcType=VARCHAR}, #{oldSalesmanId,jdbcType=VARCHAR}, #{backStatus,jdbcType=INTEGER},
  102. #{agreementUrl,jdbcType=VARCHAR}, #{newUser,jdbcType=INTEGER}, #{serviceContent,jdbcType=VARCHAR},
  103. #{salesType,jdbcType=INTEGER}, #{channelId,jdbcType=VARCHAR}, #{other,jdbcType=VARCHAR},
  104. #{userType,jdbcType=INTEGER})
  105. </insert>
  106. <insert id="insertSelective" parameterType="com.goafanti.common.model.TOrderNew">
  107. insert into t_order_new
  108. <trim prefix="(" suffix=")" suffixOverrides=",">
  109. <if test="orderNo != null">
  110. order_no,
  111. </if>
  112. <if test="orderType != null">
  113. order_type,
  114. </if>
  115. <if test="creater != null">
  116. creater,
  117. </if>
  118. <if test="createTime != null">
  119. create_time,
  120. </if>
  121. <if test="updateTime != null">
  122. update_time,
  123. </if>
  124. <if test="buyerId != null">
  125. buyer_id,
  126. </if>
  127. <if test="firstAmount != null">
  128. first_amount,
  129. </if>
  130. <if test="totalAmount != null">
  131. total_amount,
  132. </if>
  133. <if test="settlementAmount != null">
  134. settlement_amount,
  135. </if>
  136. <if test="refundAmount != null">
  137. refund_amount,
  138. </if>
  139. <if test="orderStatus != null">
  140. order_status,
  141. </if>
  142. <if test="liquidationStatus != null">
  143. liquidation_status,
  144. </if>
  145. <if test="processStatus != null">
  146. process_status,
  147. </if>
  148. <if test="projectStatus != null">
  149. project_status,
  150. </if>
  151. <if test="approval != null">
  152. approval,
  153. </if>
  154. <if test="orderRemarks != null">
  155. order_remarks,
  156. </if>
  157. <if test="deleteSign != null">
  158. delete_sign,
  159. </if>
  160. <if test="salesmanId != null">
  161. salesman_id,
  162. </if>
  163. <if test="financeId != null">
  164. finance_id,
  165. </if>
  166. <if test="technicianId != null">
  167. technician_id,
  168. </if>
  169. <if test="signTime != null">
  170. sign_time,
  171. </if>
  172. <if test="settlementTime != null">
  173. settlement_time,
  174. </if>
  175. <if test="contractPictureUrl != null">
  176. contract_picture_url,
  177. </if>
  178. <if test="contractNo != null">
  179. contract_no,
  180. </if>
  181. <if test="contractType != null">
  182. contract_type,
  183. </if>
  184. <if test="contacts != null">
  185. contacts,
  186. </if>
  187. <if test="contactMobile != null">
  188. contact_mobile,
  189. </if>
  190. <if test="legalPerson != null">
  191. legal_person,
  192. </if>
  193. <if test="legalPersonTel != null">
  194. legal_person_tel,
  195. </if>
  196. <if test="proofCount != null">
  197. proof_count,
  198. </if>
  199. <if test="proofAid != null">
  200. proof_aid,
  201. </if>
  202. <if test="proofTime != null">
  203. proof_time,
  204. </if>
  205. <if test="proofStatus != null">
  206. proof_status,
  207. </if>
  208. <if test="orderDep != null">
  209. order_dep,
  210. </if>
  211. <if test="outsource != null">
  212. outsource,
  213. </if>
  214. <if test="additionalOrder != null">
  215. additional_order,
  216. </if>
  217. <if test="primaryOrder != null">
  218. primary_order,
  219. </if>
  220. <if test="oldSalesmanId != null">
  221. old_salesman_id,
  222. </if>
  223. <if test="backStatus != null">
  224. back_status,
  225. </if>
  226. <if test="agreementUrl != null">
  227. agreement_url,
  228. </if>
  229. <if test="newUser != null">
  230. new_user,
  231. </if>
  232. <if test="serviceContent != null">
  233. service_content,
  234. </if>
  235. <if test="salesType != null">
  236. sales_type,
  237. </if>
  238. <if test="channelId != null">
  239. channel_id,
  240. </if>
  241. <if test="other != null">
  242. other,
  243. </if>
  244. <if test="userType != null">
  245. user_type,
  246. </if>
  247. </trim>
  248. <trim prefix="values (" suffix=")" suffixOverrides=",">
  249. <if test="orderNo != null">
  250. #{orderNo,jdbcType=VARCHAR},
  251. </if>
  252. <if test="orderType != null">
  253. #{orderType,jdbcType=INTEGER},
  254. </if>
  255. <if test="creater != null">
  256. #{creater,jdbcType=VARCHAR},
  257. </if>
  258. <if test="createTime != null">
  259. #{createTime,jdbcType=TIMESTAMP},
  260. </if>
  261. <if test="updateTime != null">
  262. #{updateTime,jdbcType=TIMESTAMP},
  263. </if>
  264. <if test="buyerId != null">
  265. #{buyerId,jdbcType=VARCHAR},
  266. </if>
  267. <if test="firstAmount != null">
  268. #{firstAmount,jdbcType=DECIMAL},
  269. </if>
  270. <if test="totalAmount != null">
  271. #{totalAmount,jdbcType=DECIMAL},
  272. </if>
  273. <if test="settlementAmount != null">
  274. #{settlementAmount,jdbcType=DECIMAL},
  275. </if>
  276. <if test="refundAmount != null">
  277. #{refundAmount,jdbcType=DECIMAL},
  278. </if>
  279. <if test="orderStatus != null">
  280. #{orderStatus,jdbcType=INTEGER},
  281. </if>
  282. <if test="liquidationStatus != null">
  283. #{liquidationStatus,jdbcType=INTEGER},
  284. </if>
  285. <if test="processStatus != null">
  286. #{processStatus,jdbcType=INTEGER},
  287. </if>
  288. <if test="projectStatus != null">
  289. #{projectStatus,jdbcType=INTEGER},
  290. </if>
  291. <if test="approval != null">
  292. #{approval,jdbcType=INTEGER},
  293. </if>
  294. <if test="orderRemarks != null">
  295. #{orderRemarks,jdbcType=VARCHAR},
  296. </if>
  297. <if test="deleteSign != null">
  298. #{deleteSign,jdbcType=INTEGER},
  299. </if>
  300. <if test="salesmanId != null">
  301. #{salesmanId,jdbcType=VARCHAR},
  302. </if>
  303. <if test="financeId != null">
  304. #{financeId,jdbcType=VARCHAR},
  305. </if>
  306. <if test="technicianId != null">
  307. #{technicianId,jdbcType=VARCHAR},
  308. </if>
  309. <if test="signTime != null">
  310. #{signTime,jdbcType=DATE},
  311. </if>
  312. <if test="settlementTime != null">
  313. #{settlementTime,jdbcType=DATE},
  314. </if>
  315. <if test="contractPictureUrl != null">
  316. #{contractPictureUrl,jdbcType=VARCHAR},
  317. </if>
  318. <if test="contractNo != null">
  319. #{contractNo,jdbcType=VARCHAR},
  320. </if>
  321. <if test="contractType != null">
  322. #{contractType,jdbcType=VARCHAR},
  323. </if>
  324. <if test="contacts != null">
  325. #{contacts,jdbcType=VARCHAR},
  326. </if>
  327. <if test="contactMobile != null">
  328. #{contactMobile,jdbcType=VARCHAR},
  329. </if>
  330. <if test="legalPerson != null">
  331. #{legalPerson,jdbcType=VARCHAR},
  332. </if>
  333. <if test="legalPersonTel != null">
  334. #{legalPersonTel,jdbcType=VARCHAR},
  335. </if>
  336. <if test="proofCount != null">
  337. #{proofCount,jdbcType=FLOAT},
  338. </if>
  339. <if test="proofAid != null">
  340. #{proofAid,jdbcType=VARCHAR},
  341. </if>
  342. <if test="proofTime != null">
  343. #{proofTime,jdbcType=TIMESTAMP},
  344. </if>
  345. <if test="proofStatus != null">
  346. #{proofStatus,jdbcType=INTEGER},
  347. </if>
  348. <if test="orderDep != null">
  349. #{orderDep,jdbcType=VARCHAR},
  350. </if>
  351. <if test="outsource != null">
  352. #{outsource,jdbcType=INTEGER},
  353. </if>
  354. <if test="additionalOrder != null">
  355. #{additionalOrder,jdbcType=VARCHAR},
  356. </if>
  357. <if test="primaryOrder != null">
  358. #{primaryOrder,jdbcType=VARCHAR},
  359. </if>
  360. <if test="oldSalesmanId != null">
  361. #{oldSalesmanId,jdbcType=VARCHAR},
  362. </if>
  363. <if test="backStatus != null">
  364. #{backStatus,jdbcType=INTEGER},
  365. </if>
  366. <if test="agreementUrl != null">
  367. #{agreementUrl,jdbcType=VARCHAR},
  368. </if>
  369. <if test="newUser != null">
  370. #{newUser,jdbcType=INTEGER},
  371. </if>
  372. <if test="serviceContent != null">
  373. #{serviceContent,jdbcType=VARCHAR},
  374. </if>
  375. <if test="salesType != null">
  376. #{salesType,jdbcType=INTEGER},
  377. </if>
  378. <if test="channelId != null">
  379. #{channelId,jdbcType=VARCHAR},
  380. </if>
  381. <if test="other != null">
  382. #{other,jdbcType=VARCHAR},
  383. </if>
  384. <if test="userType != null">
  385. #{userType,jdbcType=INTEGER},
  386. </if>
  387. </trim>
  388. </insert>
  389. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.TOrderNew">
  390. update t_order_new
  391. <set>
  392. <if test="orderType != null">
  393. order_type = #{orderType,jdbcType=INTEGER},
  394. </if>
  395. <if test="creater != null">
  396. creater = #{creater,jdbcType=VARCHAR},
  397. </if>
  398. <if test="createTime != null">
  399. create_time = #{createTime,jdbcType=TIMESTAMP},
  400. </if>
  401. <if test="updateTime != null">
  402. update_time = #{updateTime,jdbcType=TIMESTAMP},
  403. </if>
  404. <if test="buyerId != null">
  405. buyer_id = #{buyerId,jdbcType=VARCHAR},
  406. </if>
  407. <if test="firstAmount != null">
  408. first_amount = #{firstAmount,jdbcType=DECIMAL},
  409. </if>
  410. <if test="totalAmount != null">
  411. total_amount = #{totalAmount,jdbcType=DECIMAL},
  412. </if>
  413. <if test="settlementAmount != null">
  414. settlement_amount = #{settlementAmount,jdbcType=DECIMAL},
  415. </if>
  416. <if test="refundAmount != null">
  417. refund_amount = #{refundAmount,jdbcType=DECIMAL},
  418. </if>
  419. <if test="orderStatus != null">
  420. order_status = #{orderStatus,jdbcType=INTEGER},
  421. </if>
  422. <if test="liquidationStatus != null">
  423. liquidation_status = #{liquidationStatus,jdbcType=INTEGER},
  424. </if>
  425. <if test="processStatus != null">
  426. process_status = #{processStatus,jdbcType=INTEGER},
  427. </if>
  428. <if test="projectStatus != null">
  429. project_status = #{projectStatus,jdbcType=INTEGER},
  430. </if>
  431. <if test="approval != null">
  432. approval = #{approval,jdbcType=INTEGER},
  433. </if>
  434. <if test="orderRemarks != null">
  435. order_remarks = #{orderRemarks,jdbcType=VARCHAR},
  436. </if>
  437. <if test="deleteSign != null">
  438. delete_sign = #{deleteSign,jdbcType=INTEGER},
  439. </if>
  440. <if test="salesmanId != null">
  441. salesman_id = #{salesmanId,jdbcType=VARCHAR},
  442. </if>
  443. <if test="financeId != null">
  444. finance_id = #{financeId,jdbcType=VARCHAR},
  445. </if>
  446. <if test="technicianId != null">
  447. technician_id = #{technicianId,jdbcType=VARCHAR},
  448. </if>
  449. <if test="signTime != null">
  450. sign_time = #{signTime,jdbcType=DATE},
  451. </if>
  452. <if test="settlementTime != null">
  453. settlement_time = #{settlementTime,jdbcType=DATE},
  454. </if>
  455. <if test="contractPictureUrl != null">
  456. contract_picture_url = #{contractPictureUrl,jdbcType=VARCHAR},
  457. </if>
  458. <if test="contractNo != null">
  459. contract_no = #{contractNo,jdbcType=VARCHAR},
  460. </if>
  461. <if test="contractType != null">
  462. contract_type = #{contractType,jdbcType=VARCHAR},
  463. </if>
  464. <if test="contacts != null">
  465. contacts = #{contacts,jdbcType=VARCHAR},
  466. </if>
  467. <if test="contactMobile != null">
  468. contact_mobile = #{contactMobile,jdbcType=VARCHAR},
  469. </if>
  470. <if test="legalPerson != null">
  471. legal_person = #{legalPerson,jdbcType=VARCHAR},
  472. </if>
  473. <if test="legalPersonTel != null">
  474. legal_person_tel = #{legalPersonTel,jdbcType=VARCHAR},
  475. </if>
  476. <if test="proofCount != null">
  477. proof_count = #{proofCount,jdbcType=FLOAT},
  478. </if>
  479. <if test="proofAid != null">
  480. proof_aid = #{proofAid,jdbcType=VARCHAR},
  481. </if>
  482. <if test="proofTime != null">
  483. proof_time = #{proofTime,jdbcType=TIMESTAMP},
  484. </if>
  485. <if test="proofStatus != null">
  486. proof_status = #{proofStatus,jdbcType=INTEGER},
  487. </if>
  488. <if test="orderDep != null">
  489. order_dep = #{orderDep,jdbcType=VARCHAR},
  490. </if>
  491. <if test="outsource != null">
  492. outsource = #{outsource,jdbcType=INTEGER},
  493. </if>
  494. <if test="additionalOrder != null">
  495. additional_order = #{additionalOrder,jdbcType=VARCHAR},
  496. </if>
  497. <if test="primaryOrder != null">
  498. primary_order = #{primaryOrder,jdbcType=VARCHAR},
  499. </if>
  500. <if test="oldSalesmanId != null">
  501. old_salesman_id = #{oldSalesmanId,jdbcType=VARCHAR},
  502. </if>
  503. <if test="backStatus != null">
  504. back_status = #{backStatus,jdbcType=INTEGER},
  505. </if>
  506. <if test="agreementUrl != null">
  507. agreement_url = #{agreementUrl,jdbcType=VARCHAR},
  508. </if>
  509. <if test="newUser != null">
  510. new_user = #{newUser,jdbcType=INTEGER},
  511. </if>
  512. <if test="serviceContent != null">
  513. service_content = #{serviceContent,jdbcType=VARCHAR},
  514. </if>
  515. <if test="salesType != null">
  516. sales_type = #{salesType,jdbcType=INTEGER},
  517. </if>
  518. <if test="channelId != null">
  519. channel_id = #{channelId,jdbcType=VARCHAR},
  520. </if>
  521. <if test="other != null">
  522. other = #{other,jdbcType=VARCHAR},
  523. </if>
  524. <if test="userType != null">
  525. user_type = #{userType,jdbcType=INTEGER},
  526. </if>
  527. </set>
  528. where order_no = #{orderNo,jdbcType=VARCHAR}
  529. </update>
  530. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.TOrderNew">
  531. update t_order_new
  532. set order_type = #{orderType,jdbcType=INTEGER},
  533. creater = #{creater,jdbcType=VARCHAR},
  534. create_time = #{createTime,jdbcType=TIMESTAMP},
  535. update_time = #{updateTime,jdbcType=TIMESTAMP},
  536. buyer_id = #{buyerId,jdbcType=VARCHAR},
  537. first_amount = #{firstAmount,jdbcType=DECIMAL},
  538. total_amount = #{totalAmount,jdbcType=DECIMAL},
  539. settlement_amount = #{settlementAmount,jdbcType=DECIMAL},
  540. refund_amount = #{refundAmount,jdbcType=DECIMAL},
  541. order_status = #{orderStatus,jdbcType=INTEGER},
  542. liquidation_status = #{liquidationStatus,jdbcType=INTEGER},
  543. process_status = #{processStatus,jdbcType=INTEGER},
  544. project_status = #{projectStatus,jdbcType=INTEGER},
  545. approval = #{approval,jdbcType=INTEGER},
  546. order_remarks = #{orderRemarks,jdbcType=VARCHAR},
  547. delete_sign = #{deleteSign,jdbcType=INTEGER},
  548. salesman_id = #{salesmanId,jdbcType=VARCHAR},
  549. finance_id = #{financeId,jdbcType=VARCHAR},
  550. technician_id = #{technicianId,jdbcType=VARCHAR},
  551. sign_time = #{signTime,jdbcType=DATE},
  552. settlement_time = #{settlementTime,jdbcType=DATE},
  553. contract_picture_url = #{contractPictureUrl,jdbcType=VARCHAR},
  554. contract_no = #{contractNo,jdbcType=VARCHAR},
  555. contract_type = #{contractType,jdbcType=VARCHAR},
  556. contacts = #{contacts,jdbcType=VARCHAR},
  557. contact_mobile = #{contactMobile,jdbcType=VARCHAR},
  558. legal_person = #{legalPerson,jdbcType=VARCHAR},
  559. legal_person_tel = #{legalPersonTel,jdbcType=VARCHAR},
  560. proof_count = #{proofCount,jdbcType=FLOAT},
  561. proof_aid = #{proofAid,jdbcType=VARCHAR},
  562. proof_time = #{proofTime,jdbcType=TIMESTAMP},
  563. proof_status = #{proofStatus,jdbcType=INTEGER},
  564. order_dep = #{orderDep,jdbcType=VARCHAR},
  565. outsource = #{outsource,jdbcType=INTEGER},
  566. additional_order = #{additionalOrder,jdbcType=VARCHAR},
  567. primary_order = #{primaryOrder,jdbcType=VARCHAR},
  568. old_salesman_id = #{oldSalesmanId,jdbcType=VARCHAR},
  569. back_status = #{backStatus,jdbcType=INTEGER},
  570. agreement_url = #{agreementUrl,jdbcType=VARCHAR},
  571. new_user = #{newUser,jdbcType=INTEGER},
  572. service_content = #{serviceContent,jdbcType=VARCHAR},
  573. sales_type = #{salesType,jdbcType=INTEGER},
  574. channel_id = #{channelId,jdbcType=VARCHAR},
  575. other = #{other,jdbcType=VARCHAR},
  576. user_type = #{userType,jdbcType=INTEGER}
  577. where order_no = #{orderNo,jdbcType=VARCHAR}
  578. </update>
  579. <!-- 查看所有待财务管理员分配的订单数据 -->
  580. <select id="getAllUnassignedListOrder" parameterType="Map" resultType="com.goafanti.order.bo.OrderListBo">
  581. select o.order_no as orderNo, o.order_type orderType, o.create_time as createTime, o.process_status as processStatus,
  582. o.sign_time as signTime, u.nickname as buyerName,o.total_amount signTotalAmount, o.approval , a.name sellerName
  583. ,liquidation_status,o.finance_id as financeId,contract_no as contractNo,d.name as departmentName,e.name as outsourceName
  584. from t_order_new o left join `user` u on o.buyer_id = u.id left join admin a on o.salesman_id = a.id
  585. left join department d on o.order_dep=d.id left join (select order_no,max(name)as name from outsource_organization group by order_no) e
  586. on o.order_no=e.order_no left join t_order_outsource f on f.order_no=o.order_no where delete_sign in(0,2,3)
  587. and approval in (0,2)
  588. <if test="o.outsource != null">
  589. and o.outsource=#{o.outsource,jdbcType=INTEGER}
  590. </if>
  591. <if test="o.outsource == 1">
  592. and f.refund_status=1
  593. </if>
  594. <if test="o.processStatus == 2">
  595. and process_status = 2
  596. </if>
  597. <if test="o.processStatus == 3">
  598. and process_status &gt;= 2 and process_status &lt; 7
  599. </if>
  600. <if test="o.departmentId != null and o.departmentId != &quot;&quot;">
  601. and o.order_dep= #{o.departmentId,jdbcType=VARCHAR}
  602. </if>
  603. <if test="o.orderNo != null and o.orderNo != &quot;&quot;">
  604. and o.order_no = #{o.orderNo,jdbcType=VARCHAR}
  605. </if>
  606. <if test="o.financeId != null and o.financeId != &quot;&quot;">
  607. and o.finance_id = #{o.financeId,jdbcType=VARCHAR}
  608. </if>
  609. <if test="o.contractNo != null and o.contractNo != &quot;&quot;">
  610. and o.contract_no like CONCAT('%',#{o.contractNo,jdbcType=VARCHAR},'%')
  611. </if>
  612. <if test="o.buyerName != null and o.buyerName != &quot;&quot;">
  613. <bind name="n" value="'%' + o.buyerName + '%'" />
  614. and u.nickname like #{n,jdbcType=VARCHAR}
  615. </if>
  616. <if test="o.startTime != null and o.startTime != &quot;&quot; and o.endTime != null and o.endTime != &quot;&quot;">
  617. <bind name="a" value="o.startTime + ' 00:00:00'" />
  618. <bind name="b" value="o.endTime + ' 23:59:59'" />
  619. and o.create_time between #{a,jdbcType=VARCHAR} and #{b,jdbcType=VARCHAR}
  620. </if>
  621. order by o.process_status,o.create_time desc
  622. <if test="page_sql != null">
  623. ${page_sql}
  624. </if>
  625. </select>
  626. <select id="getAllUnassignedCountOrder" parameterType="Map" resultType="java.lang.Integer">
  627. select count(*) from t_order_new o left join `user` u on o.buyer_id = u.id left join admin a on o.salesman_id = a.id
  628. left join t_order_outsource f on f.order_no=o.order_no where delete_sign in(0,2,3) and approval in (0,2)
  629. <if test="o.outsource != null">
  630. and o.outsource=#{o.outsource,jdbcType=INTEGER}
  631. </if>
  632. <if test="o.outsource == 1">
  633. and f.refund_status=1
  634. </if>
  635. <if test="o.processStatus == 2">
  636. and process_status = 2
  637. </if>
  638. <if test="o.processStatus == 3">
  639. and process_status &gt; 2 and process_status &lt; 7
  640. </if>
  641. <if test="o.departmentId != null and o.departmentId != &quot;&quot;">
  642. and o.order_dep= #{o.departmentId,jdbcType=VARCHAR}
  643. </if>
  644. <if test="o.orderNo != null and o.orderNo != &quot;&quot;">
  645. and o.order_no = #{o.orderNo,jdbcType=VARCHAR}
  646. </if>
  647. <if test="o.financeId != null and o.financeId != &quot;&quot;">
  648. and o.finance_id = #{o.financeId,jdbcType=VARCHAR}
  649. </if>
  650. <if test="o.contractNo != null and o.contractNo != &quot;&quot;">
  651. and o.contract_no like CONCAT('%',#{o.contractNo,jdbcType=VARCHAR},'%')
  652. </if>
  653. <if test="o.buyerName != null and o.buyerName != &quot;&quot;">
  654. <bind name="n" value="'%' + o.buyerName + '%'" />
  655. and u.nickname like #{n,jdbcType=VARCHAR}
  656. </if>
  657. <if test="o.startTime != null and o.startTime != &quot;&quot; and o.endTime != null and o.endTime != &quot;&quot;">
  658. <bind name="a" value="o.startTime + ' 00:00:00'" />
  659. <bind name="b" value="o.endTime + ' 23:59:59'" />
  660. and o.create_time between #{a,jdbcType=VARCHAR} and #{b,jdbcType=VARCHAR}
  661. </if>
  662. </select>
  663. <!-- 查看某订单状态是否符合要求 -->
  664. <select id="getCountByIdAndStatus" parameterType="com.goafanti.common.model.TOrderNew" resultType="java.lang.Integer">
  665. select count(*) from t_order_new
  666. where order_no = #{orderNo,jdbcType=VARCHAR}
  667. <if test="orderType != null">
  668. and order_type = #{orderType,jdbcType=INTEGER}
  669. </if>
  670. <if test="creater != null">
  671. and creater = #{creater,jdbcType=VARCHAR}
  672. </if>
  673. <if test="buyerId != null">
  674. and buyer_id = #{buyerId,jdbcType=VARCHAR}
  675. </if>
  676. <if test="firstAmount != null">
  677. and first_amount = #{firstAmount,jdbcType=DECIMAL}
  678. </if>
  679. <if test="totalAmount != null">
  680. and total_amount = #{totalAmount,jdbcType=DECIMAL}
  681. </if>
  682. <if test="settlementAmount != null">
  683. and settlement_amount = #{settlementAmount,jdbcType=DECIMAL}
  684. </if>
  685. <if test="orderStatus != null">
  686. and order_status = #{orderStatus,jdbcType=INTEGER}
  687. </if>
  688. <if test="liquidationStatus == 1">
  689. and liquidation_status between 1 and 2
  690. </if>
  691. <if test="processStatus != null">
  692. and process_status = #{processStatus,jdbcType=INTEGER}
  693. </if>
  694. <if test="projectStatus != null">
  695. and project_status = #{projectStatus,jdbcType=INTEGER}
  696. </if>
  697. <if test="approval != null">
  698. and approval = #{approval,jdbcType=INTEGER}
  699. </if>
  700. <if test="orderRemarks != null">
  701. and order_remarks = #{orderRemarks,jdbcType=VARCHAR}
  702. </if>
  703. <if test="deleteSign != null">
  704. and delete_sign = #{deleteSign,jdbcType=INTEGER}
  705. </if>
  706. <if test="salesmanId != null">
  707. and salesman_id = #{salesmanId,jdbcType=VARCHAR}
  708. </if>
  709. <if test="financeId != null">
  710. and finance_id = #{financeId,jdbcType=VARCHAR}
  711. </if>
  712. <if test="technicianId != null">
  713. and technician_id = #{technicianId,jdbcType=VARCHAR}
  714. </if>
  715. <if test="contractNo != null">
  716. and contract_no = #{contractNo,jdbcType=VARCHAR}
  717. </if>
  718. <if test="contractType != null">
  719. and contract_type = #{contractType,jdbcType=VARCHAR}
  720. </if>
  721. <if test="contacts != null">
  722. and contacts = #{contacts,jdbcType=VARCHAR}
  723. </if>
  724. <if test="contactMobile != null">
  725. and contact_mobile = #{contactMobile,jdbcType=VARCHAR}
  726. </if>
  727. <if test="legalPerson != null">
  728. and legal_person = #{legalPerson,jdbcType=VARCHAR}
  729. </if>
  730. <if test="legalPersonTel != null">
  731. and legal_person_tel = #{legalPersonTel,jdbcType=VARCHAR}
  732. </if>
  733. </select>
  734. <!-- 财务专员查看需要待收款的数据 -->
  735. <select id="financeList" parameterType="Map" resultType="com.goafanti.order.bo.OrderListBo">
  736. select o.order_no as orderNo, o.sign_time as signTime, u.nickname as buyerName, o.order_status as orderStatus,a.finance_name financeName,
  737. a.cost_amount costAmount,a.payment_amount paymentAmount,o.process_status as processStatus, o.settlement_amount as actuallyTotalAmount,
  738. o.contract_no as contractNo, o.approval, o.back_status backStatus,a.salesman_name as sellerName, o.salesman_id as sellerId,
  739. o.buyer_id as buyerId, o.liquidation_status as liquidationStatus ,too.amount outsourceAmount, o.first_amount as signFirstPayment,
  740. o.total_amount as signTotalAmount, date_format(o.create_time, '%Y-%m-%d %H:%i:%s') as createTime, too.company_name as outsourceName,
  741. 0 as companyId, d.name as departmentName, a.final_receivables finalReceivables ,a.invoice_amount invoiceAmount ,
  742. o.order_status orderStatus,a.project_type projectType,o.sales_type salesType,o.other ,o.delete_sign deleteSign,
  743. date_format(a.`final_Receivables_time`, '%Y-%m-%d %H:%i:%s')finalReceivablesTime,a.order_receivables orderReceivables,a.order_arrears orderArrears
  744. from t_order_new o left join department d on o.order_dep = d.id left join `user` u on o.buyer_id = u.id left join t_order_mid a on o.order_no=a.order_no
  745. left join (select * from t_order_outsource where type=0) too on o.order_no=too.order_no where delete_sign in(0,2) and approval in(0,1,2,4,5)
  746. and outsource= #{o.outsource,jdbcType=INTEGER}
  747. <if test="o.processStatus == 3">
  748. and o.process_status = #{o.processStatus,jdbcType=INTEGER}
  749. </if>
  750. <if test="o.processStatus == 4" >
  751. and o.process_status &gt;= #{o.processStatus,jdbcType=INTEGER}
  752. </if>
  753. <if test="o.processStatus == 9">
  754. and o.back_status = 3
  755. </if>
  756. <if test="fids != null and fids.size() &gt; 0">
  757. and d.finance_id in
  758. <foreach close=")" collection="fids" index="" item="item" open="(" separator=",">
  759. #{item}
  760. </foreach>
  761. </if>
  762. <if test="o.orderStatus != null and o.orderStatus != &quot;&quot;">
  763. and (o.order_status >= #{o.orderStatus,jdbcType=INTEGER} or o.back_status=3)
  764. </if>
  765. <if test="deps !=null">
  766. and o.order_dep in
  767. <foreach close=")" collection="deps" item="depId" open="(" separator=",">
  768. #{depId}
  769. </foreach>
  770. </if>
  771. <if test="o.contractNo != null and o.contractNo != &quot;&quot;">
  772. and o.contract_no like CONCAT('%',#{o.contractNo,jdbcType=VARCHAR},'%')
  773. </if>
  774. <if test="o.liquidationStatus != null">
  775. and o.liquidation_status = #{o.liquidationStatus,jdbcType=INTEGER}
  776. </if>
  777. <if test="o.amountStatus == 0">
  778. and o.total_amount &lt; 10
  779. </if>
  780. <if test="o.amountStatus == 1">
  781. and o.total_amount between 10 and 20
  782. </if>
  783. <if test="o.amountStatus == 2">
  784. and o.total_amount between 20 and 30
  785. </if>
  786. <if test="o.amountStatus == 3">
  787. and o.total_amount between 30 and 40
  788. </if>
  789. <if test="o.amountStatus == 4">
  790. and o.total_amount &gt; 40
  791. </if>
  792. <if test="o.orderNo != null and o.orderNo != &quot;&quot;">
  793. and o.order_no = #{o.orderNo,jdbcType=VARCHAR}
  794. </if>
  795. <if test="o.projectType != null and o.projectType != &quot;&quot;">
  796. and a.project_type = #{o.projectType}
  797. </if>
  798. <if test="o.approval != null and o.approval ==1">
  799. and o.approval in (1,4)
  800. </if>
  801. <if test="o.approval != null and o.approval ==2">
  802. and o.approval in (2,5)
  803. </if>
  804. <if test="o.approval != null and o.approval ==4">
  805. and o.approval in (1,2,4,5)
  806. </if>
  807. <if test="o.buyerName != null and o.buyerName != &quot;&quot;">
  808. <bind name="n" value="'%' + o.buyerName + '%'" />
  809. and u.nickname like #{n,jdbcType=VARCHAR}
  810. </if>
  811. <if test="o.startTime != null and o.startTime != &quot;&quot; and o.endTime != null and o.endTime != &quot;&quot;">
  812. <bind name="a" value="o.startTime + ' 00:00:00'" />
  813. <bind name="b" value="o.endTime + ' 23:59:59'" />
  814. and o.create_time between #{a,jdbcType=VARCHAR} and #{b,jdbcType=VARCHAR}
  815. </if>
  816. <if test="o.startFinalReceivablesTime != null and o.startFinalReceivablesTime != &quot;&quot; and o.endFinalReceivablesTime != null and o.endFinalReceivablesTime != &quot;&quot;">
  817. <bind name="c" value="o.startFinalReceivablesTime + ' 00:00:00'" />
  818. <bind name="d" value="o.endFinalReceivablesTime + ' 23:59:59'" />
  819. and a.final_Receivables_time between #{c,jdbcType=VARCHAR} and #{d,jdbcType=VARCHAR}
  820. </if>
  821. order by o.liquidation_status, o.sign_time desc
  822. <if test="page_sql != null">
  823. ${page_sql}
  824. </if>
  825. </select>
  826. <select id="financeCount" parameterType="Map" resultType="java.lang.Integer">
  827. select count(*) from t_order_new o left join `user` u on o.buyer_id = u.id
  828. left join department d on o.order_dep = d.id left join t_order_mid a on o.order_no=a.order_no
  829. where delete_sign in(0,2) and approval in(0,1,2) and outsource= #{o.outsource,jdbcType=INTEGER}
  830. <if test="o.processStatus == 3">
  831. and o.process_status = #{o.processStatus,jdbcType=INTEGER}
  832. </if>
  833. <if test="o.processStatus == 4" >
  834. and o.process_status &gt;= #{o.processStatus,jdbcType=INTEGER}
  835. </if>
  836. <if test="o.processStatus == 9">
  837. and o.back_status = 3
  838. </if>
  839. <if test="fids != null and fids.size() &gt; 0">
  840. and d.finance_id in
  841. <foreach close=")" collection="fids" index="" item="item" open="(" separator=",">
  842. #{item}
  843. </foreach>
  844. </if>
  845. <if test="o.orderStatus != null and o.orderStatus != &quot;&quot;">
  846. and (o.order_status >= #{o.orderStatus,jdbcType=INTEGER} or o.back_status=3)
  847. </if>
  848. <if test="deps !=null">
  849. and o.order_dep in
  850. <foreach close=")" collection="deps" item="depId" open="(" separator=",">
  851. #{depId}
  852. </foreach>
  853. </if>
  854. <if test="o.contractNo != null and o.contractNo != &quot;&quot;">
  855. and o.contract_no like CONCAT('%',#{o.contractNo,jdbcType=VARCHAR},'%')
  856. </if>
  857. <if test="o.liquidationStatus != null">
  858. and o.liquidation_status = #{o.liquidationStatus,jdbcType=INTEGER}
  859. </if>
  860. <if test="o.amountStatus == 0">
  861. and o.total_amount &lt; 10
  862. </if>
  863. <if test="o.amountStatus == 1">
  864. and o.total_amount between 10 and 20
  865. </if>
  866. <if test="o.amountStatus == 2">
  867. and o.total_amount between 20 and 30
  868. </if>
  869. <if test="o.amountStatus == 3">
  870. and o.total_amount between 30 and 40
  871. </if>
  872. <if test="o.amountStatus == 4">
  873. and o.total_amount &gt; 40
  874. </if>
  875. <if test="o.orderNo != null and o.orderNo != &quot;&quot;">
  876. and o.order_no = #{o.orderNo,jdbcType=VARCHAR}
  877. </if>
  878. <if test="o.projectType != null and o.projectType != &quot;&quot;">
  879. and a.project_type = #{o.projectType}
  880. </if>
  881. <if test="o.approval != null and o.approval ==1">
  882. and o.approval in (1,4)
  883. </if>
  884. <if test="o.approval != null and o.approval ==2">
  885. and o.approval in (2,5)
  886. </if>
  887. <if test="o.approval != null and o.approval ==4">
  888. and o.approval in (1,2,4,5)
  889. </if>
  890. <if test="o.buyerName != null and o.buyerName != &quot;&quot;">
  891. <bind name="n" value="'%' + o.buyerName + '%'" />
  892. and u.nickname like #{n,jdbcType=VARCHAR}
  893. </if>
  894. <if test="o.startTime != null and o.startTime != &quot;&quot; and o.endTime != null and o.endTime != &quot;&quot;">
  895. <bind name="a" value="o.startTime + ' 00:00:00'" />
  896. <bind name="b" value="o.endTime + ' 23:59:59'" />
  897. and o.create_time between #{a,jdbcType=VARCHAR} and #{b,jdbcType=VARCHAR}
  898. </if>
  899. <if test="o.startFinalReceivablesTime != null and o.startFinalReceivablesTime != &quot;&quot; and o.endFinalReceivablesTime != null and o.endFinalReceivablesTime != &quot;&quot;">
  900. <bind name="c" value="o.startFinalReceivablesTime + ' 00:00:00'" />
  901. <bind name="d" value="o.endFinalReceivablesTime + ' 23:59:59'" />
  902. and a.final_Receivables_time between #{c,jdbcType=VARCHAR} and #{d,jdbcType=VARCHAR}
  903. </if>
  904. </select>
  905. <!-- 通过订单编号获得订单的负责人(营销员) -->
  906. <select id="getSaleIdByOno" parameterType="java.lang.String" resultType="com.goafanti.order.bo.TOrderNewBo">
  907. select o.order_no orderNo ,o.salesman_id as salesmanId, a.name as salesmanName,
  908. o.contract_no contractNo,a.email ,u.nickname as userName,o.order_dep orderDep,d.name departmentName,
  909. d.finance_id financeId
  910. from t_order_new o left join admin a on o.salesman_id = a.id left join `user` u on u.id = o.buyer_id
  911. left join department d on o.order_dep=d.id
  912. where order_no = #{_parameter,jdbcType=VARCHAR}
  913. </select>
  914. <select id="selectOrderNewListByPage" resultType="com.goafanti.order.bo.TOrderNewBo">
  915. select a.order_no as orderNo,a.create_time as createTime, date_format(a.sign_time,'%Y-%m-%d' ) as signDate,a.delete_sign deleteSign,
  916. a.contract_no as contractNo, b.nickname as userName ,a.process_status as processStatus,a.total_amount as totalAmount,
  917. a.order_status as orderStatus, a.liquidation_status as liquidationStatus,a.approval,c.salesman_name as salesmanName,c.project_type projectType,
  918. dep.name as depName,c.finance_name as financeName,c.invoice_amount invoiceAmount,a.settlement_amount settlementAmount,
  919. a.sales_type salesType, a.channel_id channelId ,a.other
  920. <if test="specially == 2">
  921. ,f.name as initiateName ,e.reason ,date_format(e.create_time,'%Y-%m-%d' ) as backDate,e.id as backId
  922. </if>
  923. <if test="specially == 4">
  924. ,e.receiver_name as consultantName,a.settlement_amount as settlementAmount,if(isnull(g.order_no)=0,1,0) ischange
  925. </if>
  926. from t_order_new a left join `user` b on a.buyer_id=b.id left join t_order_mid c on a.order_no=c.order_no
  927. left join department dep on a.order_dep=dep.id
  928. <if test="specially == 2">
  929. left join (select * from t_order_back a where back_status=0) e on a.order_no=e.order_no
  930. left join admin f on e.initiate=f.id
  931. </if>
  932. <if test="specially == 4">
  933. left join t_order_task e on a.order_no=e.order_no and e.main =1
  934. left join (select order_no from new_order_change group by order_no)g on a.order_no=g.order_no
  935. </if>
  936. <if test="specially == 9">
  937. left join t_order_task tot on a.order_no =tot.order_no
  938. left join business_project bp on tot.commodity_id =bp.id
  939. </if>
  940. where a.delete_sign in(0,2)
  941. <if test="specially ==7">
  942. and a.process_status > 4
  943. and a.salesman_id = #{aid,jdbcType=VARCHAR}
  944. </if>
  945. <if test="specially ==8">
  946. and a.process_status > 4
  947. <if test="uid !=null">
  948. and a.buyer_id = #{uid}
  949. </if>
  950. </if>
  951. <if test="specially ==9">
  952. and a.process_status > 4 and bp.type=5
  953. <if test="aid !=null">
  954. and a.salesman_id = #{aid,jdbcType=VARCHAR}
  955. </if>
  956. </if>
  957. <if test="outsource != null">
  958. and a.outsource= #{outsource,jdbcType=INTEGER}
  959. </if>
  960. <if test="specially == 0">
  961. <if test="approval ==null">
  962. and a.approval in(0,1,2,4,5)
  963. </if>
  964. and a.order_status in(0,1,2,4)
  965. and a.salesman_id = #{aid,jdbcType=VARCHAR}
  966. </if>
  967. <if test="specially == 1">
  968. and a.process_status = 1 and a.order_status = 1
  969. </if>
  970. <if test="specially == 2">
  971. and a.order_status in(3,5)
  972. and a.salesman_id = #{aid,jdbcType=VARCHAR}
  973. </if>
  974. <if test="specially == 3">
  975. and a.order_status=2 and a.process_status in(3)
  976. <if test="approval ==0">
  977. and a.approval = 0
  978. </if>
  979. <if test="approval ==1">
  980. and a.approval in
  981. <if test="manageType ==0">
  982. (1)
  983. </if>
  984. <if test="manageType ==1">
  985. (4)
  986. </if>
  987. </if>
  988. <if test="approval ==2">
  989. and a.approval in
  990. <if test="manageType ==0">
  991. (2)
  992. </if>
  993. <if test="manageType ==1">
  994. (5)
  995. </if>
  996. </if>
  997. </if>
  998. <if test="specially !=3 ">
  999. <if test="approval ==0">
  1000. and a.approval = 0
  1001. </if>
  1002. <if test="approval ==1">
  1003. and a.approval in (1,4)
  1004. </if>
  1005. <if test="approval ==2">
  1006. and a.approval in (2,5)
  1007. </if>
  1008. <if test="approval ==4">
  1009. and a.approval in (1,2,4,5)
  1010. </if>
  1011. </if>
  1012. <if test="specially == 4">
  1013. and a.process_status in (4,5,6,99)
  1014. and a.order_status in(1,2,3,4,6)
  1015. </if>
  1016. <if test="deps!=null">
  1017. and a.order_dep in
  1018. <foreach close=")" collection="deps" item="dep" open="(" separator=",">
  1019. #{dep}
  1020. </foreach>
  1021. </if>
  1022. <if test="distribution == 0">
  1023. and a.process_status &lt; 5
  1024. </if>
  1025. <if test="distribution == 1">
  1026. and a.process_status = 5
  1027. </if>
  1028. <if test="distribution == 2">
  1029. and a.process_status = 6
  1030. </if>
  1031. <if test="name != null">
  1032. and b.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  1033. </if>
  1034. <if test="projectType != null">
  1035. and c.project_type = #{projectType}
  1036. </if>
  1037. <if test="processStatus != null">
  1038. and a.process_status = #{processStatus}
  1039. </if>
  1040. <if test="orderNo != null">
  1041. and a.order_no like CONCAT('%',#{orderNo,jdbcType=VARCHAR},'%')
  1042. </if>
  1043. <if test="contractNo != null">
  1044. and a.contract_no like CONCAT('%',#{contractNo,jdbcType=VARCHAR},'%')
  1045. </if>
  1046. <if test="liquidationStatus != null">
  1047. and a.liquidation_status = #{liquidationStatus,jdbcType=INTEGER}
  1048. </if>
  1049. <if test="amountStatus == 0">
  1050. and a.total_amount &lt; 10
  1051. </if>
  1052. <if test="amountStatus == 1">
  1053. and a.total_amount between 10 and 20
  1054. </if>
  1055. <if test="amountStatus == 2">
  1056. and a.total_amount between 20 and 30
  1057. </if>
  1058. <if test="amountStatus == 3">
  1059. and a.total_amount between 30 and 40
  1060. </if>
  1061. <if test="amountStatus == 4">
  1062. and a.total_amount &gt; 40
  1063. </if>
  1064. <if test="starTime !=null and endTime !=null">
  1065. and a.create_time between #{starTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  1066. </if>
  1067. <if test="contractStart !=null and contractEnd !=null">
  1068. and a.sign_time between #{contractStart,jdbcType=VARCHAR} and #{contractEnd,jdbcType=VARCHAR}
  1069. </if>
  1070. order by
  1071. <if test="specially == 3">
  1072. a.approval,
  1073. </if>
  1074. <if test="specially == 4">
  1075. a.process_status,
  1076. </if>
  1077. <if test="specially != 4">
  1078. a.order_status,
  1079. </if>
  1080. a.create_time
  1081. <if test="specially != 4">
  1082. desc
  1083. </if>
  1084. <if test="page_sql!=null">
  1085. ${page_sql}
  1086. </if>
  1087. </select>
  1088. <select id="selectOrderNewListCount" resultType="java.lang.Integer">
  1089. select count(*)
  1090. from t_order_new a left join `user` b on a.buyer_id=b.id left join t_order_mid c on a.order_no=c.order_no
  1091. left join department dep on a.order_dep=dep.id
  1092. <if test="specially == 9">
  1093. left join t_order_task tot on a.order_no =tot.order_no
  1094. left join business_project bp on tot.commodity_id =bp.id
  1095. </if>
  1096. where a.delete_sign in(0,2)
  1097. <if test="specially ==7">
  1098. and a.process_status > 4
  1099. and a.salesman_id = #{aid,jdbcType=VARCHAR}
  1100. </if>
  1101. <if test="specially ==8">
  1102. and a.process_status > 4
  1103. <if test="uid !=null">
  1104. and a.buyer_id = #{uid}
  1105. </if>
  1106. </if>
  1107. <if test="specially ==9">
  1108. and a.process_status > 4 and bp.type=5
  1109. <if test="aid !=null">
  1110. and a.salesman_id = #{aid,jdbcType=VARCHAR}
  1111. </if>
  1112. </if>
  1113. <if test="outsource != null">
  1114. and a.outsource= #{outsource,jdbcType=INTEGER}
  1115. </if>
  1116. <if test="specially == 0">
  1117. <if test="approval ==null">
  1118. and a.approval in(0,1,2,4,5)
  1119. </if>
  1120. and a.order_status in(0,1,2,4)
  1121. and a.salesman_id = #{aid,jdbcType=VARCHAR}
  1122. </if>
  1123. <if test="specially == 1">
  1124. and a.process_status = 1 and a.order_status = 1
  1125. </if>
  1126. <if test="specially == 2">
  1127. and a.order_status in(3,5)
  1128. and a.salesman_id = #{aid,jdbcType=VARCHAR}
  1129. </if>
  1130. <if test="specially == 3">
  1131. and a.order_status=2 and a.process_status in(3)
  1132. <if test="approval ==0">
  1133. and a.approval = 0
  1134. </if>
  1135. <if test="approval ==1">
  1136. and a.approval in
  1137. <if test="manageType ==0">
  1138. (1)
  1139. </if>
  1140. <if test="manageType ==1">
  1141. (4)
  1142. </if>
  1143. </if>
  1144. <if test="approval ==2">
  1145. and a.approval in
  1146. <if test="manageType ==0">
  1147. (2)
  1148. </if>
  1149. <if test="manageType ==1">
  1150. (5)
  1151. </if>
  1152. </if>
  1153. </if>
  1154. <if test="specially !=3">
  1155. <if test="approval ==0">
  1156. and a.approval = 0
  1157. </if>
  1158. <if test="approval ==1">
  1159. and a.approval in (1,4)
  1160. </if>
  1161. <if test="approval ==2">
  1162. and a.approval in (2,5)
  1163. </if>
  1164. <if test="approval ==4">
  1165. and a.approval in (1,2,4,5)
  1166. </if>
  1167. </if>
  1168. <if test="specially == 4">
  1169. and a.process_status in (4,5,6,99)
  1170. and a.order_status in(1,2,3,4,6)
  1171. </if>
  1172. <if test="deps!=null">
  1173. and a.order_dep in
  1174. <foreach close=")" collection="deps" item="dep" open="(" separator=",">
  1175. #{dep}
  1176. </foreach>
  1177. </if>
  1178. <if test="distribution == 0">
  1179. and a.process_status &lt; 5
  1180. </if>
  1181. <if test="distribution == 1">
  1182. and a.process_status = 5
  1183. </if>
  1184. <if test="distribution == 2">
  1185. and a.process_status = 6
  1186. </if>
  1187. <if test="name != null">
  1188. and b.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  1189. </if>
  1190. <if test="projectType != null">
  1191. and c.project_type = #{projectType}
  1192. </if>
  1193. <if test="processStatus != null">
  1194. and a.process_status = #{processStatus}
  1195. </if>
  1196. <if test="orderNo != null">
  1197. and a.order_no like CONCAT('%',#{orderNo,jdbcType=VARCHAR},'%')
  1198. </if>
  1199. <if test="contractNo != null">
  1200. and a.contract_no like CONCAT('%',#{contractNo,jdbcType=VARCHAR},'%')
  1201. </if>
  1202. <if test="liquidationStatus != null">
  1203. and a.liquidation_status = #{liquidationStatus,jdbcType=INTEGER}
  1204. </if>
  1205. <if test="amountStatus == 0">
  1206. and a.total_amount &lt; 10
  1207. </if>
  1208. <if test="amountStatus == 1">
  1209. and a.total_amount between 10 and 20
  1210. </if>
  1211. <if test="amountStatus == 2">
  1212. and a.total_amount between 20 and 30
  1213. </if>
  1214. <if test="amountStatus == 3">
  1215. and a.total_amount between 30 and 40
  1216. </if>
  1217. <if test="amountStatus == 4">
  1218. and a.total_amount &gt; 40
  1219. </if>
  1220. <if test="starTime !=null and endTime !=null">
  1221. and a.create_time between #{starTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  1222. </if>
  1223. <if test="contractStart !=null and contractEnd !=null">
  1224. and a.sign_time between #{contractStart,jdbcType=VARCHAR} and #{contractEnd,jdbcType=VARCHAR}
  1225. </if>
  1226. </select>
  1227. <select id="selectDunOrderNewListByPage" resultType="com.goafanti.order.bo.outOrderDunListBo">
  1228. select a.id, b.contract_no contractNo,a.order_no as orderNo,c.nickname as userName,tm.salesman_name as salesmanName,e.project_status projectStatus,
  1229. b.total_amount as totalAmount,b.liquidation_status as liquidationStatus,b.settlement_amount as settlementAmount,a.money as accountsReceivable,
  1230. if((b.total_amount-b.settlement_amount) &lt; 0,0,(b.total_amount-b.settlement_amount)) as uncollectedAmount,b.order_status as orderStatus,
  1231. date_format(a.start_time, '%Y-%m-%d') as startDate,dep.name as depName,date_format(b.sign_time,'%Y-%m-%d') as signDate,
  1232. b.approval ,b.delete_sign deleteSign ,tm.project_type memberType,
  1233. <if test="newStatus == 0 ">
  1234. a.dun_subject as dunSubject,a.dun_status dunStatus
  1235. from t_order_dun a
  1236. </if>
  1237. <if test="newStatus == 1 ">
  1238. a.project_type projectType,a.status dunStatus, a.dun_type dunType,a.appropriation_ratio appropriationRatio,e.commodity_name commodityName,
  1239. e.set_up_amount setUpAmount,date_format(a.customize_time,'%Y-%m-%d') customizeTimes, a.customize_name customizeName
  1240. from new_order_dun a left join t_order_task e on a.tid=e.id
  1241. </if>
  1242. left join t_order_new b on a.order_no=b.order_no left join `user` c on b.buyer_id=c.id
  1243. left join t_order_mid tm on b.order_no=tm.order_no left join department dep on b.order_dep=dep.id
  1244. where b.delete_sign in (0,2)
  1245. <if test="shiroType == 1 and fid !=null">
  1246. and tm.finance_id= #{fid,jdbcType=VARCHAR}
  1247. </if>
  1248. <if test="shiroType == 2 and fid !=null">
  1249. and tm.finance_id in (select id from admin where superior_id= #{fid,jdbcType=VARCHAR})
  1250. </if>
  1251. <if test="amountStatus == 0">
  1252. and b.total_amount &lt; 10
  1253. </if>
  1254. <if test="amountStatus == 1">
  1255. and b.total_amount between 10 and 20
  1256. </if>
  1257. <if test="amountStatus == 2">
  1258. and b.total_amount between 20 and 30
  1259. </if>
  1260. <if test="amountStatus == 3">
  1261. and b.total_amount between 30 and 40
  1262. </if>
  1263. <if test="amountStatus == 4">
  1264. and b.total_amount &gt; 40
  1265. </if>
  1266. <if test="approval != null and approval &lt; 3">
  1267. and b.approval = #{approval}
  1268. </if>
  1269. <if test="approval != null and approval ==4">
  1270. and b.approval in (1,2)
  1271. </if>
  1272. <if test="memberType !=null">
  1273. and tm.project_type= #{memberType}
  1274. </if>
  1275. <if test="name != null">
  1276. and c.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  1277. </if>
  1278. <if test="adminName != null">
  1279. and tm.salesman_name like CONCAT('%',#{adminName,jdbcType=VARCHAR},'%')
  1280. </if>
  1281. <if test="orderNo != null">
  1282. and a.order_no like CONCAT('%',#{orderNo,jdbcType=VARCHAR},'%')
  1283. </if>
  1284. <if test="contractNo != null">
  1285. and b.contract_no like CONCAT('%',#{contractNo,jdbcType=VARCHAR},'%')
  1286. </if>
  1287. <if test="deps != null">
  1288. and b.order_dep in
  1289. <foreach close=")" collection="deps" item="depId" open="(" separator=",">
  1290. #{depId}
  1291. </foreach>
  1292. </if>
  1293. <if test="dunStatus != null">
  1294. and a.status= #{dunStatus}
  1295. </if>
  1296. <if test="aid != null">
  1297. and b.salesman_id= #{aid,jdbcType=VARCHAR}
  1298. </if>
  1299. <if test="starTime !=null and endTime !=null">
  1300. and b.sign_time between #{starTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  1301. </if>
  1302. order by b.sign_time desc,b.create_time desc
  1303. <if test="page_sql!=null">
  1304. ${page_sql}
  1305. </if>
  1306. </select>
  1307. <select id="selectDunOrderNewListCount" resultType="java.lang.Integer">
  1308. select
  1309. count(*)
  1310. <if test="newStatus == 0 ">
  1311. from t_order_dun a
  1312. </if>
  1313. <if test="newStatus == 1 ">
  1314. from new_order_dun a left join t_order_task e on a.tid=e.id
  1315. </if>
  1316. left join t_order_new b on a.order_no=b.order_no left join `user` c on b.buyer_id=c.id
  1317. left join t_order_mid tm on b.order_no=tm.order_no
  1318. where b.delete_sign in (0,2)
  1319. <if test="shiroType == 1 and fid !=null">
  1320. and tm.finance_id= #{fid,jdbcType=VARCHAR}
  1321. </if>
  1322. <if test="shiroType == 2 and fid !=null">
  1323. and tm.finance_id in (select id from admin where superior_id= #{fid,jdbcType=VARCHAR})
  1324. </if>
  1325. <if test="amountStatus == 0">
  1326. and b.total_amount &lt; 10
  1327. </if>
  1328. <if test="amountStatus == 1">
  1329. and b.total_amount between 10 and 20
  1330. </if>
  1331. <if test="amountStatus == 2">
  1332. and b.total_amount between 20 and 30
  1333. </if>
  1334. <if test="amountStatus == 3">
  1335. and b.total_amount between 30 and 40
  1336. </if>
  1337. <if test="amountStatus == 4">
  1338. and b.total_amount &gt; 40
  1339. </if>
  1340. <if test="approval != null and approval &lt; 3">
  1341. and b.approval = #{approval}
  1342. </if>
  1343. <if test="approval != null and approval ==4">
  1344. and b.approval in (1,2)
  1345. </if>
  1346. <if test="memberType !=null">
  1347. and tm.project_type= #{memberType}
  1348. </if>
  1349. <if test="name != null">
  1350. and c.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  1351. </if>
  1352. <if test="adminName != null">
  1353. and salesman_name like CONCAT('%',#{adminName,jdbcType=VARCHAR},'%')
  1354. </if>
  1355. <if test="orderNo != null">
  1356. and a.order_no like CONCAT('%',#{orderNo,jdbcType=VARCHAR},'%')
  1357. </if>
  1358. <if test="contractNo != null">
  1359. and b.contract_no like CONCAT('%',#{contractNo,jdbcType=VARCHAR},'%')
  1360. </if>
  1361. <if test="deps != null">
  1362. and b.order_dep in
  1363. <foreach close=")" collection="deps" item="depId" open="(" separator=",">
  1364. #{depId}
  1365. </foreach>
  1366. </if>
  1367. <if test="dunStatus != null">
  1368. and a.status= #{dunStatus}
  1369. </if>
  1370. <if test="aid != null">
  1371. and b.salesman_id= #{aid,jdbcType=VARCHAR}
  1372. </if>
  1373. <if test="starTime !=null and endTime !=null">
  1374. and b.sign_time between #{starTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  1375. </if>
  1376. </select>
  1377. <select id="getOrderNewDetail" parameterType="java.lang.String" resultType="com.goafanti.order.bo.TOrderNewBo">
  1378. select
  1379. a.order_no as orderNo, a.order_type as orderType, a.creater, a.create_time as createTime,a.update_time as updateTime, a.buyer_id as buyerId,a.other,
  1380. a.first_amount as firstAmount,a.total_amount as totalAmount, a.settlement_amount as settlementAmount, order_status as orderStatus,a.user_type userType,
  1381. a.liquidation_status as liquidationStatus, a.process_status as processStatus, a.project_status as projectStatus, a.approval,a.sales_type salesType,
  1382. a.order_remarks as orderRemarks, a.delete_sign as deleteSign, a.salesman_id as salesmanId, a.finance_id as financeId, technician_id as technicianId,
  1383. a.sign_time as signTime, a.settlement_time as settlementTime, a.contract_no as contractNo, a.contract_type as contractType, a.contacts,a.channel_id channelId,
  1384. a.contact_mobile as contactMobile, a.legal_person as legalPerson, a.legal_person_tel as legalPersonTel, a.proof_count as proofCount,
  1385. a.proof_aid as proofAid,contract_picture_url as contractPictureUrl, c.name as salesmanName,dep.name as depName,d.name as financeName,
  1386. c.contact_mobile as salesmanMobile,d.contact_mobile as financeMobile,b.username as userName ,b.nickname as nickname ,e.back_status as backStatus,f.name as initiateName,
  1387. e.reason,date_format(e.create_time,'%Y-%m-%d') as backDate,a.buyer_id as uid,a.order_dep as orderDep, g.location_province as locationProvince,
  1388. g.location_city as locationCity,g.location_area locationArea,g.postal_address postalAddress,outsource,a.primary_order primaryOrder,a.agreement_url agreementUrl,
  1389. h.name NowFinance,h.contact_mobile NowFinanceMobile,a.additional_order additionalOrder,i.name as oldSalesmanName, i.contact_mobile oldSalesmanMobile,
  1390. a.service_content serviceContent
  1391. from t_order_new a left join `user` b on a.buyer_id=b.id left join admin i on a.old_salesman_id=i.id
  1392. left join admin c on a.salesman_id=c.id left join department dep on a.order_dep=dep.id
  1393. left join admin d on a.finance_id=d.id left join admin h on dep.finance_id=h.id
  1394. left join t_order_back e on a.order_no=e.order_no and e.back_status=0
  1395. left join admin f on e.initiate=f.id left join organization_identity g on a.buyer_id=g.uid
  1396. where a.order_no = #{orderNo,jdbcType=VARCHAR}
  1397. </select>
  1398. <select id="selectOrderRefundListByPage" resultType="com.goafanti.order.bo.TOrderRefundBo">
  1399. select a.id, date_format(a.create_time,'%Y-%m-%d') as createDate,a.order_no as orderNo,
  1400. c.nickname as userName,b.order_status as orderStatus,a.refund_status as refundStatus,
  1401. a.reason,b.liquidation_status as liquidationStatus
  1402. from t_order_refund a left join t_order_new b on a.order_no=b.order_no
  1403. left join `user` c on b.buyer_id=c.id
  1404. where b.delete_sign in(0,2,3)
  1405. <if test="name != null">
  1406. and c.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  1407. </if>
  1408. <if test="aid != null">
  1409. and a.initiate = #{aid,jdbcType=VARCHAR}
  1410. </if>
  1411. <if test="orderNo != null">
  1412. and a.order_no = #{orderNo,jdbcType=VARCHAR}
  1413. </if>
  1414. <if test="starTime !=null and endTime !=null">
  1415. and a.create_time between #{starTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  1416. </if>
  1417. order by a.create_time desc
  1418. <if test="page_sql!=null">
  1419. ${page_sql}
  1420. </if>
  1421. </select>
  1422. <select id="selectOrderRefundListCount" resultType="java.lang.Integer">
  1423. select
  1424. count(*)
  1425. from t_order_refund a left join t_order_new b on a.order_no=b.order_no
  1426. left join `user` c on b.buyer_id=c.id
  1427. where b.delete_sign in(0,2,3)
  1428. <if test="name != null">
  1429. and c.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  1430. </if>
  1431. <if test="aid != null">
  1432. and a.initiate = #{aid,jdbcType=VARCHAR}
  1433. </if>
  1434. <if test="orderNo != null">
  1435. and a.order_no = #{orderNo,jdbcType=VARCHAR}
  1436. </if>
  1437. <if test="starTime !=null and endTime !=null">
  1438. and a.create_time between #{starTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  1439. </if>
  1440. </select>
  1441. <!-- 财务同意退款邮件通知需要的数据 -->
  1442. <select id="agreeEmailData" parameterType="java.lang.Integer" resultType="com.goafanti.order.bo.TOrderNewBo">
  1443. select u.nickname as userName, r.order_no as orderNo, o.order_status as orderStatus, o.salesman_id as salesmanId, o.technician_id as technicianId,
  1444. concat(a.email,"," , ifnull(t.email,"")) as email , concat(a.name,"," , ifnull(t.name,"")) as salesmanName
  1445. from t_order_refund r
  1446. left join t_order_new o on r.order_no = o.order_no
  1447. left join admin a on a.id = o.salesman_id
  1448. left join admin t on t.id = o.technician_id
  1449. left join `user` u on u.id = o.buyer_id
  1450. where r.id = #{id,jdbcType=INTEGER}
  1451. </select>
  1452. <select id="orderRefundDetail" resultType="com.goafanti.order.bo.OrderRefundDetailBo">
  1453. select a.id,date_format(a.create_time,'%Y-%m-%d') as createDate ,a.order_no as orderNo,
  1454. b.order_status as orderStatus,a.refund_status as refundStatus, a.application_url as applicationUrl,
  1455. a.contract_url as contractUrl,a.reason,b.liquidation_status as liquidationStatus
  1456. from t_order_refund a
  1457. left join t_order_new b on a.order_no=b.order_no
  1458. where a.id= #{id,jdbcType=INTEGER}
  1459. </select>
  1460. <update id="updateFinance" parameterType="string">
  1461. update t_order_new set finance_id= #{newFinance,jdbcType=VARCHAR}
  1462. where order_no in
  1463. <foreach close=")" collection="orderNos" item="orderNo" open="(" separator=",">
  1464. #{orderNo}
  1465. </foreach>
  1466. and finance_id= #{aid,jdbcType=VARCHAR}
  1467. </update>
  1468. <select id="checkContractNo" resultType="java.lang.Integer">
  1469. select count(contract_no) from t_order_new
  1470. where contract_no= #{0}
  1471. </select>
  1472. <select id="countTotalAndActually" parameterType="Map" resultType="java.util.Map">
  1473. select sum(o.settlement_amount) actuallyTotalAmount,sum(o.total_amount) signTotalAmount from t_order_new o
  1474. left join department d on o.order_dep=d.id left join `user` u on o.buyer_id = u.id left join t_order_mid a on o.order_no=a.order_no
  1475. where o.delete_sign in(0,2,3) and (o.approval = 0 or o.approval = 2) and outsource= #{o.outsource,jdbcType=INTEGER}
  1476. <if test="o.processStatus == 3">
  1477. and o.process_status = #{o.processStatus,jdbcType=INTEGER}
  1478. </if>
  1479. <if test="o.processStatus == 4">
  1480. and o.process_status &gt;= #{o.processStatus,jdbcType=INTEGER}
  1481. </if>
  1482. <if test="o.processStatus == 9">
  1483. and o.back_status = 3
  1484. </if>
  1485. <if test="fids != null and fids.size() &gt; 0">
  1486. and d.finance_id in
  1487. <foreach close=")" collection="fids" index="" item="item" open="(" separator=",">
  1488. #{item}
  1489. </foreach>
  1490. </if>
  1491. <if test="o.orderStatus != null and o.orderStatus != &quot;&quot;">
  1492. and (o.order_status >= #{o.orderStatus,jdbcType=INTEGER} or o.back_status=3)
  1493. </if>
  1494. <if test="deps !=null">
  1495. and o.order_dep in
  1496. <foreach close=")" collection="deps" item="depId" open="(" separator=",">
  1497. #{depId}
  1498. </foreach>
  1499. </if>
  1500. <if test="o.contractNo != null and o.contractNo != &quot;&quot;">
  1501. and o.contract_no like CONCAT('%',#{o.contractNo,jdbcType=VARCHAR},'%')
  1502. </if>
  1503. <if test="o.liquidationStatus != null">
  1504. and o.liquidation_status = #{o.liquidationStatus,jdbcType=INTEGER}
  1505. </if>
  1506. <if test="o.amountStatus == 0">
  1507. and o.total_amount &lt; 10
  1508. </if>
  1509. <if test="o.amountStatus == 1">
  1510. and o.total_amount between 10 and 20
  1511. </if>
  1512. <if test="o.amountStatus == 2">
  1513. and o.total_amount between 20 and 30
  1514. </if>
  1515. <if test="o.amountStatus == 3">
  1516. and o.total_amount between 30 and 40
  1517. </if>
  1518. <if test="o.amountStatus == 4">
  1519. and o.total_amount &gt; 40
  1520. </if>
  1521. <if test="o.orderNo != null and o.orderNo != &quot;&quot;">
  1522. and o.order_no = #{o.orderNo,jdbcType=VARCHAR}
  1523. </if>
  1524. <if test="o.projectType != null and o.projectType != &quot;&quot;">
  1525. and a.project_type = #{o.projectType}
  1526. </if>
  1527. <if test="o.approval != null and o.approval &lt; 3">
  1528. and o.approval = #{o.approval}
  1529. </if>
  1530. <if test="o.approval != null and o.approval ==4">
  1531. and o.approval in (1,2)
  1532. </if>
  1533. <if test="o.buyerName != null and o.buyerName != &quot;&quot;">
  1534. <bind name="n" value="'%' + o.buyerName + '%'" />
  1535. and u.nickname like #{n,jdbcType=VARCHAR}
  1536. </if>
  1537. <if test="o.startTime != null and o.startTime != &quot;&quot; and o.endTime != null and o.endTime != &quot;&quot;">
  1538. <bind name="a" value="o.startTime + ' 00:00:00'" />
  1539. <bind name="b" value="o.endTime + ' 23:59:59'" />
  1540. and o.create_time between #{a,jdbcType=VARCHAR} and #{b,jdbcType=VARCHAR}
  1541. </if>
  1542. <if test="o.startFinalReceivablesTime != null and o.startFinalReceivablesTime != &quot;&quot; and o.endFinalReceivablesTime != null and o.endFinalReceivablesTime != &quot;&quot;">
  1543. <bind name="c" value="o.startFinalReceivablesTime + ' 00:00:00'" />
  1544. <bind name="d" value="o.endFinalReceivablesTime + ' 23:59:59'" />
  1545. and a.final_Receivables_time between #{c,jdbcType=VARCHAR} and #{d,jdbcType=VARCHAR}
  1546. </if>
  1547. </select>
  1548. <select id="getLastPayment" resultType="com.goafanti.common.model.TOrderBillNew">
  1549. select date_format(create_time, '%Y-%m-%d %H:%i:%s') createTimes,transaction_amount transactionAmount from t_order_bill_new
  1550. where order_no= #{orderNo}
  1551. order by create_time desc limit 1;
  1552. </select>
  1553. <update id="updateSalesmanId">
  1554. update t_order_new set salesman_id= #{transferId},old_salesman_id= #{aid}
  1555. where delete_sign in(0,2,3) and salesman_id= #{aid}
  1556. </update>
  1557. <select id="selectUsedOrderByOrder" resultType="com.goafanti.order.bo.TOrderNewBo">
  1558. select
  1559. a.order_no as orderNo, a.order_type as orderType, a.creater, a.create_time as createTime,a.update_time as updateTime, a.buyer_id as buyerId,
  1560. a.first_amount as firstAmount,a.total_amount as totalAmount, a.settlement_amount as settlementAmount, order_status as orderStatus,
  1561. a.liquidation_status as liquidationStatus, a.process_status as processStatus, a.project_status as projectStatus, a.approval,
  1562. a.order_remarks as orderRemarks, a.delete_sign as deleteSign, a.salesman_id as salesmanId, a.finance_id as financeId, technician_id as technicianId,
  1563. a.sign_time as signTime, a.settlement_time as settlementTime, a.contract_no as contractNo, a.contract_type as contractType, a.contacts,
  1564. a.contact_mobile as contactMobile, a.legal_person as legalPerson, a.legal_person_tel as legalPersonTel, a.proof_count as proofCount,
  1565. a.proof_aid as proofAid,contract_picture_url as contractPictureUrl, c.name as salesmanName,dep.name as depName,d.name as financeName,
  1566. c.contact_mobile as salesmanMobile,d.contact_mobile as financeMobile,b.nickname as userName ,e.back_status as backStatus,f.name as initiateName,
  1567. e.reason,date_format(e.create_time,'%Y-%m-%d') as backDate,a.buyer_id as uid,a.order_dep as orderDep, g.location_province as locationProvince,
  1568. g.location_city as locationCity,g.location_area locationArea,g.postal_address postalAddress,outsource,a.primary_order primaryOrder,
  1569. h.name NowFinance,h.contact_mobile NowFinanceMobile,a.additional_order additionalOrder,i.name as oldSalesmanName, i.contact_mobile oldSalesmanMobile
  1570. from new_order_change noc left join t_order_new a on noc.used_order=a.order_no left join `user` b on a.buyer_id=b.id left join admin i on a.old_salesman_id=i.id
  1571. left join admin c on a.salesman_id=c.id left join department dep on a.order_dep=dep.id left join admin d on a.finance_id=d.id
  1572. left join admin h on dep.finance_id=h.id left join (select * from t_order_back a where back_status=0) e on a.order_no=e.order_no
  1573. left join admin f on e.initiate=f.id left join organization_identity g on a.buyer_id=g.uid
  1574. where noc.order_no= #{orderNo} order by noc.create_time
  1575. </select>
  1576. <update id="updaterefund" parameterType="com.goafanti.common.model.TOrderNew">
  1577. update t_order_new set settlement_amount=settlement_amount-#{refundAmount,jdbcType=DECIMAL},
  1578. refund_amount=#{refundAmount,jdbcType=DECIMAL} where order_no=#{orderNo}
  1579. </update>
  1580. <select id="selectArrearsDunListByPage" resultType="com.goafanti.order.bo.OutArrearsDunListBo">
  1581. select a.id, b.contract_no contractNo,a.order_no as orderNo,c.nickname as userName,tm.salesman_name as salesmanName,
  1582. b.project_status projectStatus, b.total_amount as totalAmount,b.liquidation_status as liquidationStatus,a.`type`,
  1583. b.settlement_amount as settlementAmount, a.order_receivables orderReceivables,a.order_arrears as orderArrears,
  1584. b.order_status as orderStatus, date_format(a.start_time, '%Y-%m-%d %H:%i:%s') as startDate,dep.name as depName,
  1585. date_format(b.sign_time,'%Y-%m-%d') as signDate,a.dun_status dunStatus,x.commodity_name commodityName
  1586. from t_arrears_dun a
  1587. left join (select order_no ,commodity_name from t_order_task where main =1)x on a.order_no =x.order_no
  1588. left join t_order_new b on a.order_no=b.order_no left join `user` c on b.buyer_id=c.id
  1589. left join t_order_mid tm on b.order_no=tm.order_no left join department dep on b.order_dep=dep.id
  1590. where b.delete_sign in(0,2,3) and dun_status in (1,2,3)
  1591. <if test="shiroType == 1 and fid !=null">
  1592. and tm.finance_id= #{fid,jdbcType=VARCHAR}
  1593. </if>
  1594. <if test="shiroType == 2 and fid !=null">
  1595. and tm.finance_id in (select id from admin where superior_id= #{fid,jdbcType=VARCHAR})
  1596. </if>
  1597. <if test="name != null">
  1598. and c.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  1599. </if>
  1600. <if test="adminName != null">
  1601. and tm.salesman_name like CONCAT('%',#{adminName,jdbcType=VARCHAR},'%')
  1602. </if>
  1603. <if test="orderNo != null">
  1604. and a.order_no like CONCAT('%',#{orderNo,jdbcType=VARCHAR},'%')
  1605. </if>
  1606. <if test="contractNo != null">
  1607. and b.contract_no like CONCAT('%',#{contractNo,jdbcType=VARCHAR},'%')
  1608. </if>
  1609. <if test="deps != null">
  1610. and b.order_dep in
  1611. <foreach close=")" collection="deps" item="dep" open="(" separator=",">
  1612. #{dep}
  1613. </foreach>
  1614. </if>
  1615. <if test="shiroType !=3 and aid != null">
  1616. and b.salesman_id= #{aid,jdbcType=VARCHAR}
  1617. </if>
  1618. <if test="starTime !=null and endTime !=null">
  1619. and b.sign_time between #{starTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  1620. </if>
  1621. <if test="tStarTime !=null and tEndTime !=null">
  1622. and a.start_time between #{tStarTime,jdbcType=VARCHAR} and #{tEndTime,jdbcType=VARCHAR}
  1623. </if>
  1624. order by dun_status,a.start_time desc
  1625. <if test="page_sql!=null">
  1626. ${page_sql}
  1627. </if>
  1628. </select>
  1629. <select id="selectArrearsDunListByCount" resultType="java.lang.Integer">
  1630. select count(*) from t_arrears_dun a
  1631. left join t_order_new b on a.order_no=b.order_no left join `user` c on b.buyer_id=c.id
  1632. left join t_order_mid tm on b.order_no=tm.order_no left join department dep on b.order_dep=dep.id
  1633. where b.delete_sign in(0,2,3) and dun_status in (1,2,3)
  1634. <if test="shiroType == 1 and fid !=null">
  1635. and tm.finance_id= #{fid,jdbcType=VARCHAR}
  1636. </if>
  1637. <if test="shiroType == 2 and fid !=null">
  1638. and tm.finance_id in (select id from admin where superior_id= #{fid,jdbcType=VARCHAR})
  1639. </if>
  1640. <if test="shiroType !=3 and aid != null">
  1641. and b.salesman_id= #{aid,jdbcType=VARCHAR}
  1642. </if>
  1643. <if test="name != null">
  1644. and c.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  1645. </if>
  1646. <if test="adminName != null">
  1647. and tm.salesman_name like CONCAT('%',#{adminName,jdbcType=VARCHAR},'%')
  1648. </if>
  1649. <if test="orderNo != null">
  1650. and a.order_no like CONCAT('%',#{orderNo,jdbcType=VARCHAR},'%')
  1651. </if>
  1652. <if test="deps != null">
  1653. and b.order_dep in
  1654. <foreach close=")" collection="deps" item="dep" open="(" separator=",">
  1655. #{dep}
  1656. </foreach>
  1657. </if>
  1658. <if test="shiroType !=3 and aid != null">
  1659. and b.salesman_id= #{aid,jdbcType=VARCHAR}
  1660. </if>
  1661. <if test="starTime !=null and endTime !=null">
  1662. and b.sign_time between #{starTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  1663. </if>
  1664. <if test="tStarTime !=null and tEndTime !=null">
  1665. and a.start_time between #{tStarTime,jdbcType=VARCHAR} and #{tEndTime,jdbcType=VARCHAR}
  1666. </if>
  1667. </select>
  1668. <select id="selectByUidAndNewUser" resultType="java.math.BigDecimal">
  1669. select total_amount from t_order_new
  1670. where process_status >4 and buyer_id = #{uid}
  1671. and salesman_id =#{aid}
  1672. and new_user = #{newUser}
  1673. and create_time between #{date} and #{now}
  1674. </select>
  1675. <select id="statisticsList" resultType="com.goafanti.order.bo.outStatisticsList">
  1676. select z.id,z.province,z.counts,z.quantity,z.total
  1677. from (select y.id,y.province,count(aid)counts,sum(quantity)quantity,sum(total)total
  1678. from (select x.id,x.province,x.aid,sum(quantity)quantity, sum(x.total)total
  1679. from (select d.id,d.name province,a.order_no,a.salesman_id aid,
  1680. if(a.total_amount>0.5,1,if(a.total_amount>0 and a.order_type=1,0.5,0))quantity,
  1681. a.total_amount total
  1682. from t_order_new a left join admin b on a.salesman_id =b.id
  1683. left join department c on b.department_id =c.id left join district_glossory d on c.province =d.id
  1684. where a.process_status >4 and a.delete_sign in(0,2)
  1685. <if test="depId !=null">
  1686. and b.department_id = #{depId}
  1687. </if>
  1688. <if test="province !=null">
  1689. and c.province = #{province}
  1690. </if>
  1691. <if test="startCreate !=null and endCreate !=null">
  1692. and a.create_time between #{startCreate} and #{endCreate}
  1693. </if>
  1694. <if test="startSign !=null and endSign !=null">
  1695. and a.sign_time between #{startSign} and #{endSign}
  1696. </if>
  1697. )x group by x.id,x.province,x.aid)y group by y.id,y.province)z
  1698. order by
  1699. <if test="sort ==0">
  1700. total
  1701. </if>
  1702. <if test="sort ==1">
  1703. quantity
  1704. </if>
  1705. <if test="sort ==2">
  1706. counts
  1707. </if>
  1708. desc
  1709. </select>
  1710. <select id="provinceStatisticsList" resultType="com.goafanti.order.bo.outProvinceStatisticsList">
  1711. select z.depName,z.aid,z.name,z.quantity,z.total
  1712. from ( select x.depName,x.aid,x.name,sum(quantity)quantity,sum(total)total
  1713. from ( select c.name depName,a.order_no,b.id aid,b.name name,
  1714. if(a.total_amount>0.5,1,if(a.total_amount>0 and a.order_type=1,0.5,0))quantity,
  1715. a.total_amount total
  1716. from t_order_new a left join admin b on a.salesman_id =b.id
  1717. left join department c on b.department_id =c.id left join district_glossory d on c.province =d.id
  1718. where a.process_status >4 and a.delete_sign in(0,2)
  1719. <if test="depId !=null">
  1720. and b.department_id = #{depId}
  1721. </if>
  1722. <if test="province !=null">
  1723. and c.province = #{province}
  1724. </if>
  1725. <if test="startCreate !=null and endCreate !=null">
  1726. and a.create_time between #{startCreate} and #{endCreate}
  1727. </if>
  1728. <if test="startSign !=null and endSign !=null">
  1729. and a.sign_time between #{startSign} and #{endSign}
  1730. </if>
  1731. )x group by x.depName,x.aid,x.name )z order by
  1732. <if test="sort ==0">
  1733. total
  1734. </if>
  1735. <if test="sort ==1">
  1736. quantity
  1737. </if>
  1738. desc
  1739. </select>
  1740. <select id="selectOrderByuid" resultType="java.util.Map">
  1741. select order_no orderNo,contract_no contractNo
  1742. from t_order_new where delete_sign in (0,2) and buyer_id = #{uid}
  1743. order by create_time desc
  1744. </select>
  1745. <select id="orderSalesSource" resultType="com.goafanti.order.bo.OutOrderSalesSource">
  1746. select y.province,dg.name ,y.total_amount totalAmount,y.counts,y.dhxkf,y.dhxkf/y.counts dhxkfl,
  1747. y.dhzdzy,y.dhzdzy/y.counts dhzdzyl,y.wl,y.wl/y.counts wll,
  1748. y.qd,y.qd/y.counts qdl,y.zjs,y.zjs/y.counts zjsl,y.qt,y.qt/y.counts qtl,
  1749. y.gxfg,y.gxfg/y.counts gxfgl,y.qtfg,y.qtfg/y.counts qtfgl
  1750. from (select x.province,sum(x.total_amount)total_amount,sum(x.counts)counts,
  1751. sum(x.dhxkf)dhxkf,sum(x.dhzdzy)dhzdzy,sum(x.wl)wl,sum(x.qd)qd, sum(x.zjs)zjs, sum(x.qt)qt,
  1752. sum(x.gxfg)gxfg, sum(x.qtfg)qtfg
  1753. from ( select b.province ,1 counts,a.total_amount,a.sales_type ,
  1754. case a.sales_type when 0 then 1 else 0 end dhxkf,
  1755. case a.sales_type when 1 then 1 else 0 end dhzdzy,
  1756. case a.sales_type when 2 then 1 else 0 end wl,
  1757. case a.sales_type when 3 then 1 else 0 end qd,
  1758. case a.sales_type when 4 then 1 else 0 end zjs,
  1759. case a.sales_type when 5 then 1 else 0 end qt,
  1760. case a.sales_type when 6 then 1 else 0 end gxfg,
  1761. case a.sales_type when 7 then 1 else 0 end qtfg
  1762. from t_order_new a left join department b on a.order_dep =b.id
  1763. where a.delete_sign in (0,2) and a.process_status &gt; 0 and a.approval in (0,1,2)
  1764. <if test=" startDate !=null and endDate != null">
  1765. and a.create_time between #{startDate} and #{endDate}
  1766. </if>
  1767. <if test=" deps !=null">
  1768. and a.order_dep in
  1769. <foreach close=")" collection="listDep" item="depId" open="(" separator=",">
  1770. #{depId}
  1771. </foreach>
  1772. </if>
  1773. <if test=" province !=null">
  1774. and b.province = #{province}
  1775. </if>
  1776. )x group by x.province)y left join district_glossory dg on y.province=dg.id
  1777. <if test=" sort ==0">
  1778. order by y.total_amount desc
  1779. </if>
  1780. <if test=" sort ==1">
  1781. order by y.counts desc
  1782. </if>
  1783. </select>
  1784. <select id="selectstatisticsOrderListPage" resultType="com.goafanti.order.bo.TOrderNewBo">
  1785. select a.order_no as orderNo,a.create_time as createTime, date_format(a.sign_time,'%Y-%m-%d' ) as signDate,a.delete_sign deleteSign,
  1786. a.contract_no as contractNo, b.nickname as userName ,a.process_status as processStatus,a.total_amount as totalAmount,
  1787. a.order_status as orderStatus, a.liquidation_status as liquidationStatus,a.approval,c.salesman_name as salesmanName,c.project_type projectType,
  1788. dep.name as depName,c.finance_name as financeName,c.invoice_amount invoiceAmount,a.settlement_amount settlementAmount,
  1789. a.sales_type salesType, a.channel_id channelId ,a.other
  1790. from t_order_new a left join `user` b on a.buyer_id=b.id left join t_order_mid c on a.order_no=c.order_no
  1791. left join department dep on a.order_dep=dep.id
  1792. where a.delete_sign in(0,2) and a.process_status >0 and a.approval in (0,1,2)
  1793. <if test="province !=null ">
  1794. and dep.province = #{province}
  1795. </if>
  1796. <if test="salesType !=null ">
  1797. and a.sales_type = #{salesType}
  1798. </if>
  1799. <if test=" startDate !=null and endDate != null">
  1800. and a.create_time between #{startDate} and #{endDate}
  1801. </if>
  1802. <if test=" depId !=null">
  1803. and a.order_dep= #{depId}
  1804. </if>
  1805. <if test="orderNo != null">
  1806. and a.order_no like CONCAT('%',#{orderNo,jdbcType=VARCHAR},'%')
  1807. </if>
  1808. <if test="name != null">
  1809. and b.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  1810. </if>
  1811. <if test="contractNo != null">
  1812. and a.contract_no like CONCAT('%',#{contractNo,jdbcType=VARCHAR},'%')
  1813. </if>
  1814. <if test="liquidationStatus != null">
  1815. and a.liquidation_status = #{liquidationStatus,jdbcType=INTEGER}
  1816. </if>
  1817. <if test="approval ==0">
  1818. and a.approval = 0
  1819. </if>
  1820. <if test="approval ==1">
  1821. and a.approval in (1,2)
  1822. </if>
  1823. <if test="amountStatus == 0">
  1824. and a.total_amount &lt; 10
  1825. </if>
  1826. <if test="amountStatus == 1">
  1827. and a.total_amount between 10 and 20
  1828. </if>
  1829. <if test="amountStatus == 2">
  1830. and a.total_amount between 20 and 30
  1831. </if>
  1832. <if test="amountStatus == 3">
  1833. and a.total_amount between 30 and 40
  1834. </if>
  1835. <if test="amountStatus == 4">
  1836. and a.total_amount &gt; 40
  1837. </if>
  1838. order by a.create_time desc
  1839. <if test="page_sql!=null">
  1840. ${page_sql}
  1841. </if>
  1842. </select>
  1843. <select id="selectstatisticsOrderListCount" resultType="integer">
  1844. select count(*)
  1845. from t_order_new a left join `user` b on a.buyer_id=b.id left join t_order_mid c on a.order_no=c.order_no
  1846. left join department dep on a.order_dep=dep.id
  1847. where a.delete_sign in(0,2) and a.process_status >0 and a.approval in (0,1,2)
  1848. <if test="province !=null ">
  1849. and dep.province = #{province}
  1850. </if>
  1851. <if test="salesType !=null ">
  1852. and a.sales_type = #{salesType}
  1853. </if>
  1854. <if test=" startDate !=null and endDate != null">
  1855. and a.create_time between #{startDate} and #{endDate}
  1856. </if>
  1857. <if test=" depId !=null">
  1858. and a.order_dep= #{depId}
  1859. </if>
  1860. <if test="orderNo != null">
  1861. and a.order_no like CONCAT('%',#{orderNo,jdbcType=VARCHAR},'%')
  1862. </if>
  1863. <if test="name != null">
  1864. and b.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  1865. </if>
  1866. <if test="contractNo != null">
  1867. and a.contract_no like CONCAT('%',#{contractNo,jdbcType=VARCHAR},'%')
  1868. </if>
  1869. <if test="liquidationStatus != null">
  1870. and a.liquidation_status = #{liquidationStatus,jdbcType=INTEGER}
  1871. </if>
  1872. <if test="approval ==0">
  1873. and a.approval = 0
  1874. </if>
  1875. <if test="approval ==1">
  1876. and a.approval in (1,2)
  1877. </if>
  1878. <if test="amountStatus == 0">
  1879. and a.total_amount &lt; 10
  1880. </if>
  1881. <if test="amountStatus == 1">
  1882. and a.total_amount between 10 and 20
  1883. </if>
  1884. <if test="amountStatus == 2">
  1885. and a.total_amount between 20 and 30
  1886. </if>
  1887. <if test="amountStatus == 3">
  1888. and a.total_amount between 30 and 40
  1889. </if>
  1890. <if test="amountStatus == 4">
  1891. and a.total_amount &gt; 40
  1892. </if>
  1893. </select>
  1894. <select id="checkOrderProcessStatus" resultMap="BaseResultMap">
  1895. select
  1896. <include refid="Base_Column_List" />
  1897. from t_order_new
  1898. where order_no = (select t_order_task.order_no from t_order_task where id=#{tid})
  1899. </select>
  1900. </mapper>