TOrderNewMapper.xml 79 KB

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