TOrderNewMapper.xml 77 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914
  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)
  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 &lt; 3">
  799. and o.approval = #{o.approval}
  800. </if>
  801. <if test="o.approval != null and o.approval ==4">
  802. and o.approval in (1,2)
  803. </if>
  804. <if test="o.buyerName != null and o.buyerName != &quot;&quot;">
  805. <bind name="n" value="'%' + o.buyerName + '%'" />
  806. and u.nickname like #{n,jdbcType=VARCHAR}
  807. </if>
  808. <if test="o.startTime != null and o.startTime != &quot;&quot; and o.endTime != null and o.endTime != &quot;&quot;">
  809. <bind name="a" value="o.startTime + ' 00:00:00'" />
  810. <bind name="b" value="o.endTime + ' 23:59:59'" />
  811. and o.create_time between #{a,jdbcType=VARCHAR} and #{b,jdbcType=VARCHAR}
  812. </if>
  813. <if test="o.startFinalReceivablesTime != null and o.startFinalReceivablesTime != &quot;&quot; and o.endFinalReceivablesTime != null and o.endFinalReceivablesTime != &quot;&quot;">
  814. <bind name="c" value="o.startFinalReceivablesTime + ' 00:00:00'" />
  815. <bind name="d" value="o.endFinalReceivablesTime + ' 23:59:59'" />
  816. and a.final_Receivables_time between #{c,jdbcType=VARCHAR} and #{d,jdbcType=VARCHAR}
  817. </if>
  818. order by o.liquidation_status, o.sign_time desc
  819. <if test="page_sql != null">
  820. ${page_sql}
  821. </if>
  822. </select>
  823. <select id="financeCount" parameterType="Map" resultType="java.lang.Integer">
  824. select count(*) from t_order_new o left join `user` u on o.buyer_id = u.id
  825. left join department d on o.order_dep = d.id left join t_order_mid a on o.order_no=a.order_no
  826. where delete_sign in(0,2) and approval in(0,1,2) and outsource= #{o.outsource,jdbcType=INTEGER}
  827. <if test="o.processStatus == 3">
  828. and o.process_status = #{o.processStatus,jdbcType=INTEGER}
  829. </if>
  830. <if test="o.processStatus == 4" >
  831. and o.process_status &gt;= #{o.processStatus,jdbcType=INTEGER}
  832. </if>
  833. <if test="o.processStatus == 9">
  834. and o.back_status = 3
  835. </if>
  836. <if test="fids != null and fids.size() &gt; 0">
  837. and d.finance_id in
  838. <foreach close=")" collection="fids" index="" item="item" open="(" separator=",">
  839. #{item}
  840. </foreach>
  841. </if>
  842. <if test="o.orderStatus != null and o.orderStatus != &quot;&quot;">
  843. and (o.order_status >= #{o.orderStatus,jdbcType=INTEGER} or o.back_status=3)
  844. </if>
  845. <if test="deps !=null">
  846. and o.order_dep in
  847. <foreach close=")" collection="deps" item="depId" open="(" separator=",">
  848. #{depId}
  849. </foreach>
  850. </if>
  851. <if test="o.contractNo != null and o.contractNo != &quot;&quot;">
  852. and o.contract_no like CONCAT('%',#{o.contractNo,jdbcType=VARCHAR},'%')
  853. </if>
  854. <if test="o.liquidationStatus != null">
  855. and o.liquidation_status = #{o.liquidationStatus,jdbcType=INTEGER}
  856. </if>
  857. <if test="o.amountStatus == 0">
  858. and o.total_amount &lt; 10
  859. </if>
  860. <if test="o.amountStatus == 1">
  861. and o.total_amount between 10 and 20
  862. </if>
  863. <if test="o.amountStatus == 2">
  864. and o.total_amount between 20 and 30
  865. </if>
  866. <if test="o.amountStatus == 3">
  867. and o.total_amount between 30 and 40
  868. </if>
  869. <if test="o.amountStatus == 4">
  870. and o.total_amount &gt; 40
  871. </if>
  872. <if test="o.orderNo != null and o.orderNo != &quot;&quot;">
  873. and o.order_no = #{o.orderNo,jdbcType=VARCHAR}
  874. </if>
  875. <if test="o.projectType != null and o.projectType != &quot;&quot;">
  876. and a.project_type = #{o.projectType}
  877. </if>
  878. <if test="o.approval != null and o.approval &lt; 3">
  879. and o.approval = #{o.approval}
  880. </if>
  881. <if test="o.approval != null and o.approval ==4">
  882. and o.approval in (1,2)
  883. </if>
  884. <if test="o.buyerName != null and o.buyerName != &quot;&quot;">
  885. <bind name="n" value="'%' + o.buyerName + '%'" />
  886. and u.nickname like #{n,jdbcType=VARCHAR}
  887. </if>
  888. <if test="o.startTime != null and o.startTime != &quot;&quot; and o.endTime != null and o.endTime != &quot;&quot;">
  889. <bind name="a" value="o.startTime + ' 00:00:00'" />
  890. <bind name="b" value="o.endTime + ' 23:59:59'" />
  891. and o.create_time between #{a,jdbcType=VARCHAR} and #{b,jdbcType=VARCHAR}
  892. </if>
  893. <if test="o.startFinalReceivablesTime != null and o.startFinalReceivablesTime != &quot;&quot; and o.endFinalReceivablesTime != null and o.endFinalReceivablesTime != &quot;&quot;">
  894. <bind name="c" value="o.startFinalReceivablesTime + ' 00:00:00'" />
  895. <bind name="d" value="o.endFinalReceivablesTime + ' 23:59:59'" />
  896. and a.final_Receivables_time between #{c,jdbcType=VARCHAR} and #{d,jdbcType=VARCHAR}
  897. </if>
  898. </select>
  899. <!-- 通过订单编号获得订单的负责人(营销员) -->
  900. <select id="getSaleIdByOno" parameterType="java.lang.String" resultType="com.goafanti.order.bo.TOrderNewBo">
  901. select o.order_no orderNo ,o.salesman_id as salesmanId, a.name as salesmanName,
  902. o.contract_no contractNo,a.email ,u.nickname as userName,o.order_dep orderDep,d.name departmentName,
  903. d.finance_id financeId
  904. 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
  905. left join department d on o.order_dep=d.id
  906. where order_no = #{_parameter,jdbcType=VARCHAR}
  907. </select>
  908. <select id="selectOrderNewListByPage" resultType="com.goafanti.order.bo.TOrderNewBo">
  909. 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,
  910. a.contract_no as contractNo, b.nickname as userName ,a.process_status as processStatus,a.total_amount as totalAmount,
  911. a.order_status as orderStatus, a.liquidation_status as liquidationStatus,a.approval,c.salesman_name as salesmanName,c.project_type projectType,
  912. dep.name as depName,c.finance_name as financeName,c.invoice_amount invoiceAmount,a.settlement_amount settlementAmount,
  913. a.sales_type salesType, a.channel_id channelId ,a.other
  914. <if test="specially == 2">
  915. ,f.name as initiateName ,e.reason ,date_format(e.create_time,'%Y-%m-%d' ) as backDate,e.id as backId
  916. </if>
  917. <if test="specially == 4">
  918. ,e.receiver_name as consultantName,a.settlement_amount as settlementAmount,if(isnull(g.order_no)=0,1,0) ischange
  919. </if>
  920. 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
  921. left join department dep on a.order_dep=dep.id
  922. <if test="specially == 2">
  923. left join (select * from t_order_back a where back_status=0) e on a.order_no=e.order_no
  924. left join admin f on e.initiate=f.id
  925. </if>
  926. <if test="specially == 4">
  927. left join t_order_task e on a.order_no=e.order_no and e.main =1
  928. left join (select order_no from new_order_change group by order_no)g on a.order_no=g.order_no
  929. </if>
  930. <if test="specially == 9">
  931. left join t_order_task tot on a.order_no =tot.order_no
  932. left join business_project bp on tot.commodity_id =bp.id
  933. </if>
  934. where a.delete_sign in(0,2)
  935. <if test="specially ==7">
  936. and a.process_status > 4
  937. and a.salesman_id = #{aid,jdbcType=VARCHAR}
  938. </if>
  939. <if test="specially ==8">
  940. and a.process_status > 4
  941. <if test="uid !=null">
  942. and a.buyer_id = #{uid}
  943. </if>
  944. </if>
  945. <if test="specially ==9">
  946. and a.process_status > 4 and bp.type=5
  947. <if test="aid !=null">
  948. and a.salesman_id = #{aid,jdbcType=VARCHAR}
  949. </if>
  950. </if>
  951. <if test="outsource != null">
  952. and a.outsource= #{outsource,jdbcType=INTEGER}
  953. </if>
  954. <if test="specially == 0">
  955. <if test="approval ==null">
  956. and a.approval in(0,1,2)
  957. </if>
  958. and a.order_status in(0,1,2,4)
  959. and a.salesman_id = #{aid,jdbcType=VARCHAR}
  960. </if>
  961. <if test="specially == 1">
  962. and a.process_status = 1 and a.order_status = 1
  963. and a.order_dep in
  964. <foreach close=")" collection="deps" item="depId" open="(" separator=",">
  965. #{depId}
  966. </foreach>
  967. </if>
  968. <if test="specially == 2">
  969. and a.order_status in(3,5)
  970. and a.salesman_id = #{aid,jdbcType=VARCHAR}
  971. </if>
  972. <if test="specially == 3">
  973. and a.order_status=2 and a.process_status != 99
  974. <if test="approval ==0">
  975. and a.approval = 0
  976. </if>
  977. <if test="approval ==1">
  978. and a.process_status = 7
  979. and a.approval = 1
  980. </if>
  981. <if test="approval ==2">
  982. and a.approval &gt; 1
  983. </if>
  984. </if>
  985. <if test="specially !=3">
  986. <if test="approval ==0">
  987. and a.approval = 0
  988. </if>
  989. <if test="approval ==1">
  990. and a.approval =1
  991. </if>
  992. <if test="approval ==2">
  993. and a.approval =2
  994. </if>
  995. <if test="approval ==4">
  996. and a.approval in (1,2)
  997. </if>
  998. </if>
  999. <if test="specially == 4">
  1000. and a.process_status in (4,5,6,99)
  1001. and a.order_status in(1,2,3,4,6)
  1002. <if test="deps!=null">
  1003. and a.order_dep in
  1004. <foreach close=")" collection="deps" item="deps" open="(" separator=",">
  1005. #{deps.id}
  1006. </foreach>
  1007. </if>
  1008. </if>
  1009. <if test="specially == 5">
  1010. and a.order_dep in
  1011. <foreach close=")" collection="deps" item="deps" open="(" separator=",">
  1012. #{deps.id}
  1013. </foreach>
  1014. </if>
  1015. <if test="distribution == 0">
  1016. and a.process_status &lt; 5
  1017. </if>
  1018. <if test="distribution == 1">
  1019. and a.process_status = 5
  1020. </if>
  1021. <if test="distribution == 2">
  1022. and a.process_status = 6
  1023. </if>
  1024. <if test="name != null">
  1025. and b.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  1026. </if>
  1027. <if test="projectType != null">
  1028. and c.project_type = #{projectType}
  1029. </if>
  1030. <if test="processStatus != null">
  1031. and a.process_status = #{processStatus}
  1032. </if>
  1033. <if test="orderNo != null">
  1034. and a.order_no like CONCAT('%',#{orderNo,jdbcType=VARCHAR},'%')
  1035. </if>
  1036. <if test="contractNo != null">
  1037. and a.contract_no like CONCAT('%',#{contractNo,jdbcType=VARCHAR},'%')
  1038. </if>
  1039. <if test="liquidationStatus != null">
  1040. and a.liquidation_status = #{liquidationStatus,jdbcType=INTEGER}
  1041. </if>
  1042. <if test="amountStatus == 0">
  1043. and a.total_amount &lt; 10
  1044. </if>
  1045. <if test="amountStatus == 1">
  1046. and a.total_amount between 10 and 20
  1047. </if>
  1048. <if test="amountStatus == 2">
  1049. and a.total_amount between 20 and 30
  1050. </if>
  1051. <if test="amountStatus == 3">
  1052. and a.total_amount between 30 and 40
  1053. </if>
  1054. <if test="amountStatus == 4">
  1055. and a.total_amount &gt; 40
  1056. </if>
  1057. <if test="depId != null">
  1058. and a.order_dep = #{depId,jdbcType=VARCHAR}
  1059. </if>
  1060. <if test="starTime !=null and endTime !=null">
  1061. and a.create_time between #{starTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  1062. </if>
  1063. <if test="contractStart !=null and contractEnd !=null">
  1064. and a.sign_time between #{contractStart,jdbcType=VARCHAR} and #{contractEnd,jdbcType=VARCHAR}
  1065. </if>
  1066. order by
  1067. <if test="specially == 3">
  1068. a.approval,
  1069. </if>
  1070. <if test="specially == 4">
  1071. a.process_status,
  1072. </if>
  1073. <if test="specially != 4">
  1074. a.order_status,
  1075. </if>
  1076. a.create_time
  1077. <if test="specially != 4">
  1078. desc
  1079. </if>
  1080. <if test="page_sql!=null">
  1081. ${page_sql}
  1082. </if>
  1083. </select>
  1084. <select id="selectOrderNewListCount" resultType="java.lang.Integer">
  1085. select count(*)
  1086. 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
  1087. left join department dep on a.order_dep=dep.id
  1088. <if test="specially == 9">
  1089. left join t_order_task tot on a.order_no =tot.order_no
  1090. left join business_project bp on tot.commodity_id =bp.id
  1091. </if>
  1092. where a.delete_sign in(0,2)
  1093. <if test="specially ==7">
  1094. and a.process_status > 4
  1095. and a.salesman_id = #{aid,jdbcType=VARCHAR}
  1096. </if>
  1097. <if test="specially ==8">
  1098. and a.process_status > 4
  1099. <if test="uid !=null">
  1100. and a.buyer_id = #{uid}
  1101. </if>
  1102. </if>
  1103. <if test="specially ==9">
  1104. and a.process_status > 4 and bp.type=5
  1105. <if test="aid !=null">
  1106. and a.salesman_id = #{aid,jdbcType=VARCHAR}
  1107. </if>
  1108. </if>
  1109. <if test="outsource != null">
  1110. and a.outsource= #{outsource,jdbcType=INTEGER}
  1111. </if>
  1112. <if test="specially == 0">
  1113. <if test="approval ==null">
  1114. and a.approval in(0,1,2)
  1115. </if>
  1116. and a.order_status in(0,1,2,4)
  1117. and a.salesman_id = #{aid,jdbcType=VARCHAR}
  1118. </if>
  1119. <if test="specially == 1">
  1120. and a.process_status = 1 and a.order_status = 1
  1121. <!-- and c.department_id in (#{deps,jdbcType=VARCHAR}) -->
  1122. and a.order_dep in
  1123. <foreach close=")" collection="deps" item="depId" open="(" separator=",">
  1124. #{depId}
  1125. </foreach>
  1126. </if>
  1127. <if test="specially == 2">
  1128. and a.order_status in(3,5)
  1129. and a.salesman_id = #{aid,jdbcType=VARCHAR}
  1130. </if>
  1131. <if test="specially == 3">
  1132. and a.order_status=2 and a.process_status != 99
  1133. <if test="approval ==0">
  1134. and a.approval &gt; 0
  1135. </if>
  1136. <if test="approval ==1">
  1137. and a.process_status = 7
  1138. and a.approval = 1
  1139. </if>
  1140. <if test="approval ==2">
  1141. and a.approval &gt; 1
  1142. </if>
  1143. </if>
  1144. <if test="specially !=3">
  1145. <if test="approval ==0">
  1146. and a.approval = 0
  1147. </if>
  1148. <if test="approval ==1">
  1149. and a.approval =1
  1150. </if>
  1151. <if test="approval ==2">
  1152. and a.approval =2
  1153. </if>
  1154. <if test="approval ==4">
  1155. and a.approval in (1,2)
  1156. <if test="deps!=null">
  1157. and a.order_dep in
  1158. <foreach close=")" collection="deps" item="deps" open="(" separator=",">
  1159. #{deps.id}
  1160. </foreach>
  1161. </if>
  1162. </if>
  1163. </if>
  1164. <if test="specially == 4">
  1165. and a.process_status in (4,5,6,99)
  1166. and a.order_status in(1,2,3,4,6)
  1167. <if test="deps!=null">
  1168. and a.order_dep in
  1169. <foreach close=")" collection="deps" item="deps" open="(" separator=",">
  1170. #{deps.id}
  1171. </foreach>
  1172. </if>
  1173. </if>
  1174. <if test="specially == 5">
  1175. and a.order_dep in
  1176. <foreach close=")" collection="deps" item="deps" open="(" separator=",">
  1177. #{deps.id}
  1178. </foreach>
  1179. </if>
  1180. <if test="distribution == 0">
  1181. and a.process_status &lt; 5
  1182. </if>
  1183. <if test="distribution == 1">
  1184. and a.process_status = 5
  1185. </if>
  1186. <if test="distribution == 2">
  1187. and a.process_status = 6
  1188. </if>
  1189. <if test="name != null">
  1190. and b.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  1191. </if>
  1192. <if test="projectType != null">
  1193. and c.project_type = #{projectType}
  1194. </if>
  1195. <if test="processStatus != null">
  1196. and a.process_status = #{processStatus}
  1197. </if>
  1198. <if test="orderNo != null">
  1199. and a.order_no like CONCAT('%',#{orderNo,jdbcType=VARCHAR},'%')
  1200. </if>
  1201. <if test="contractNo != null">
  1202. and a.contract_no like CONCAT('%',#{contractNo,jdbcType=VARCHAR},'%')
  1203. </if>
  1204. <if test="liquidationStatus != null">
  1205. and a.liquidation_status = #{liquidationStatus,jdbcType=INTEGER}
  1206. </if>
  1207. <if test="amountStatus == 0">
  1208. and a.total_amount &lt; 10
  1209. </if>
  1210. <if test="amountStatus == 1">
  1211. and a.total_amount between 10 and 20
  1212. </if>
  1213. <if test="amountStatus == 2">
  1214. and a.total_amount between 20 and 30
  1215. </if>
  1216. <if test="amountStatus == 3">
  1217. and a.total_amount between 30 and 40
  1218. </if>
  1219. <if test="amountStatus == 4">
  1220. and a.total_amount &gt; 40
  1221. </if>
  1222. <if test="depId != null">
  1223. and a.order_dep = #{depId,jdbcType=VARCHAR}
  1224. </if>
  1225. <if test="starTime !=null and endTime !=null">
  1226. and a.create_time between #{starTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  1227. </if>
  1228. <if test="contractStart !=null and contractEnd !=null">
  1229. and a.sign_time between #{contractStart,jdbcType=VARCHAR} and #{contractEnd,jdbcType=VARCHAR}
  1230. </if>
  1231. </select>
  1232. <select id="selectDunOrderNewListByPage" resultType="com.goafanti.order.bo.outOrderDunListBo">
  1233. 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,
  1234. b.total_amount as totalAmount,b.liquidation_status as liquidationStatus,b.settlement_amount as settlementAmount,a.money as accountsReceivable,
  1235. if((b.total_amount-b.settlement_amount) &lt; 0,0,(b.total_amount-b.settlement_amount)) as uncollectedAmount,b.order_status as orderStatus,
  1236. date_format(a.start_time, '%Y-%m-%d') as startDate,dep.name as depName,date_format(b.sign_time,'%Y-%m-%d') as signDate,
  1237. b.approval ,b.delete_sign deleteSign ,tm.project_type memberType,
  1238. <if test="newStatus == 0 ">
  1239. a.dun_subject as dunSubject,a.dun_status dunStatus
  1240. from t_order_dun a
  1241. </if>
  1242. <if test="newStatus == 1 ">
  1243. a.project_type projectType,a.status dunStatus, a.dun_type dunType,a.appropriation_ratio appropriationRatio,e.commodity_name commodityName,
  1244. e.set_up_amount setUpAmount,date_format(a.customize_time,'%Y-%m-%d') customizeTimes, a.customize_name customizeName
  1245. from new_order_dun a left join t_order_task e on a.tid=e.id
  1246. </if>
  1247. left join t_order_new b on a.order_no=b.order_no left join `user` c on b.buyer_id=c.id
  1248. left join t_order_mid tm on b.order_no=tm.order_no left join department dep on b.order_dep=dep.id
  1249. where b.delete_sign in (0,2)
  1250. <if test="shiroType == 1 and fid !=null">
  1251. and tm.finance_id= #{fid,jdbcType=VARCHAR}
  1252. </if>
  1253. <if test="shiroType == 2 and fid !=null">
  1254. and tm.finance_id in (select id from admin where superior_id= #{fid,jdbcType=VARCHAR})
  1255. </if>
  1256. <if test="amountStatus == 0">
  1257. and b.total_amount &lt; 10
  1258. </if>
  1259. <if test="amountStatus == 1">
  1260. and b.total_amount between 10 and 20
  1261. </if>
  1262. <if test="amountStatus == 2">
  1263. and b.total_amount between 20 and 30
  1264. </if>
  1265. <if test="amountStatus == 3">
  1266. and b.total_amount between 30 and 40
  1267. </if>
  1268. <if test="amountStatus == 4">
  1269. and b.total_amount &gt; 40
  1270. </if>
  1271. <if test="approval != null and approval &lt; 3">
  1272. and b.approval = #{approval}
  1273. </if>
  1274. <if test="approval != null and approval ==4">
  1275. and b.approval in (1,2)
  1276. </if>
  1277. <if test="memberType !=null">
  1278. and tm.project_type= #{memberType}
  1279. </if>
  1280. <if test="name != null">
  1281. and c.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  1282. </if>
  1283. <if test="adminName != null">
  1284. and tm.salesman_name like CONCAT('%',#{adminName,jdbcType=VARCHAR},'%')
  1285. </if>
  1286. <if test="orderNo != null">
  1287. and a.order_no like CONCAT('%',#{orderNo,jdbcType=VARCHAR},'%')
  1288. </if>
  1289. <if test="contractNo != null">
  1290. and b.contract_no like CONCAT('%',#{contractNo,jdbcType=VARCHAR},'%')
  1291. </if>
  1292. <if test="depId != null">
  1293. and b.order_dep= #{depId,jdbcType=VARCHAR}
  1294. </if>
  1295. <if test="dunStatus != null">
  1296. and a.status= #{dunStatus}
  1297. </if>
  1298. <if test="aid != null">
  1299. and b.salesman_id= #{aid,jdbcType=VARCHAR}
  1300. </if>
  1301. <if test="starTime !=null and endTime !=null">
  1302. and b.sign_time between #{starTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  1303. </if>
  1304. order by b.sign_time desc,b.create_time desc
  1305. <if test="page_sql!=null">
  1306. ${page_sql}
  1307. </if>
  1308. </select>
  1309. <select id="selectDunOrderNewListCount" resultType="java.lang.Integer">
  1310. select
  1311. count(*)
  1312. <if test="newStatus == 0 ">
  1313. from t_order_dun a
  1314. </if>
  1315. <if test="newStatus == 1 ">
  1316. from new_order_dun a left join t_order_task e on a.tid=e.id
  1317. </if>
  1318. left join t_order_new b on a.order_no=b.order_no left join `user` c on b.buyer_id=c.id
  1319. left join t_order_mid tm on b.order_no=tm.order_no
  1320. where b.delete_sign in (0,2)
  1321. <if test="shiroType == 1 and fid !=null">
  1322. and tm.finance_id= #{fid,jdbcType=VARCHAR}
  1323. </if>
  1324. <if test="shiroType == 2 and fid !=null">
  1325. and tm.finance_id in (select id from admin where superior_id= #{fid,jdbcType=VARCHAR})
  1326. </if>
  1327. <if test="amountStatus == 0">
  1328. and b.total_amount &lt; 10
  1329. </if>
  1330. <if test="amountStatus == 1">
  1331. and b.total_amount between 10 and 20
  1332. </if>
  1333. <if test="amountStatus == 2">
  1334. and b.total_amount between 20 and 30
  1335. </if>
  1336. <if test="amountStatus == 3">
  1337. and b.total_amount between 30 and 40
  1338. </if>
  1339. <if test="amountStatus == 4">
  1340. and b.total_amount &gt; 40
  1341. </if>
  1342. <if test="approval != null and approval &lt; 3">
  1343. and b.approval = #{approval}
  1344. </if>
  1345. <if test="approval != null and approval ==4">
  1346. and b.approval in (1,2)
  1347. </if>
  1348. <if test="memberType !=null">
  1349. and tm.project_type= #{memberType}
  1350. </if>
  1351. <if test="name != null">
  1352. and c.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  1353. </if>
  1354. <if test="adminName != null">
  1355. and salesman_name like CONCAT('%',#{adminName,jdbcType=VARCHAR},'%')
  1356. </if>
  1357. <if test="orderNo != null">
  1358. and a.order_no like CONCAT('%',#{orderNo,jdbcType=VARCHAR},'%')
  1359. </if>
  1360. <if test="contractNo != null">
  1361. and b.contract_no like CONCAT('%',#{contractNo,jdbcType=VARCHAR},'%')
  1362. </if>
  1363. <if test="depId != null">
  1364. and b.order_dep= #{depId,jdbcType=VARCHAR}
  1365. </if>
  1366. <if test="dunStatus != null">
  1367. and a.status= #{dunStatus}
  1368. </if>
  1369. <if test="aid != null">
  1370. and b.salesman_id= #{aid,jdbcType=VARCHAR}
  1371. </if>
  1372. <if test="starTime !=null and endTime !=null">
  1373. and b.sign_time between #{starTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  1374. </if>
  1375. </select>
  1376. <select id="getOrderNewDetail" parameterType="java.lang.String" resultType="com.goafanti.order.bo.TOrderNewBo">
  1377. select
  1378. 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,
  1379. a.first_amount as firstAmount,a.total_amount as totalAmount, a.settlement_amount as settlementAmount, order_status as orderStatus,a.user_type userType,
  1380. a.liquidation_status as liquidationStatus, a.process_status as processStatus, a.project_status as projectStatus, a.approval,a.sales_type salesType,
  1381. a.order_remarks as orderRemarks, a.delete_sign as deleteSign, a.salesman_id as salesmanId, a.finance_id as financeId, technician_id as technicianId,
  1382. 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,
  1383. a.contact_mobile as contactMobile, a.legal_person as legalPerson, a.legal_person_tel as legalPersonTel, a.proof_count as proofCount,
  1384. a.proof_aid as proofAid,contract_picture_url as contractPictureUrl, c.name as salesmanName,dep.name as depName,d.name as financeName,
  1385. 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,
  1386. 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,
  1387. g.location_city as locationCity,g.location_area locationArea,g.postal_address postalAddress,outsource,a.primary_order primaryOrder,a.agreement_url agreementUrl,
  1388. h.name NowFinance,h.contact_mobile NowFinanceMobile,a.additional_order additionalOrder,i.name as oldSalesmanName, i.contact_mobile oldSalesmanMobile,
  1389. a.service_content serviceContent
  1390. 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
  1391. left join admin c on a.salesman_id=c.id left join department dep on a.order_dep=dep.id
  1392. left join admin d on a.finance_id=d.id left join admin h on dep.finance_id=h.id
  1393. left join t_order_back e on a.order_no=e.order_no and e.back_status=0
  1394. left join admin f on e.initiate=f.id left join organization_identity g on a.buyer_id=g.uid
  1395. where a.order_no = #{orderNo,jdbcType=VARCHAR}
  1396. </select>
  1397. <select id="selectOrderRefundListByPage" resultType="com.goafanti.order.bo.TOrderRefundBo">
  1398. select a.id, date_format(a.create_time,'%Y-%m-%d') as createDate,a.order_no as orderNo,
  1399. c.nickname as userName,b.order_status as orderStatus,a.refund_status as refundStatus,
  1400. a.reason,b.liquidation_status as liquidationStatus
  1401. from t_order_refund a left join t_order_new b on a.order_no=b.order_no
  1402. left join `user` c on b.buyer_id=c.id
  1403. where b.delete_sign in(0,2,3)
  1404. <if test="name != null">
  1405. and c.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  1406. </if>
  1407. <if test="aid != null">
  1408. and a.initiate = #{aid,jdbcType=VARCHAR}
  1409. </if>
  1410. <if test="orderNo != null">
  1411. and a.order_no = #{orderNo,jdbcType=VARCHAR}
  1412. </if>
  1413. <if test="starTime !=null and endTime !=null">
  1414. and a.create_time between #{starTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  1415. </if>
  1416. order by a.create_time desc
  1417. <if test="page_sql!=null">
  1418. ${page_sql}
  1419. </if>
  1420. </select>
  1421. <select id="selectOrderRefundListCount" resultType="java.lang.Integer">
  1422. select
  1423. count(*)
  1424. from t_order_refund a left join t_order_new b on a.order_no=b.order_no
  1425. left join `user` c on b.buyer_id=c.id
  1426. where b.delete_sign in(0,2,3)
  1427. <if test="name != null">
  1428. and c.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  1429. </if>
  1430. <if test="aid != null">
  1431. and a.initiate = #{aid,jdbcType=VARCHAR}
  1432. </if>
  1433. <if test="orderNo != null">
  1434. and a.order_no = #{orderNo,jdbcType=VARCHAR}
  1435. </if>
  1436. <if test="starTime !=null and endTime !=null">
  1437. and a.create_time between #{starTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  1438. </if>
  1439. </select>
  1440. <!-- 财务同意退款邮件通知需要的数据 -->
  1441. <select id="agreeEmailData" parameterType="java.lang.Integer" resultType="com.goafanti.order.bo.TOrderNewBo">
  1442. 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,
  1443. concat(a.email,"," , ifnull(t.email,"")) as email , concat(a.name,"," , ifnull(t.name,"")) as salesmanName
  1444. from t_order_refund r
  1445. left join t_order_new o on r.order_no = o.order_no
  1446. left join admin a on a.id = o.salesman_id
  1447. left join admin t on t.id = o.technician_id
  1448. left join `user` u on u.id = o.buyer_id
  1449. where r.id = #{id,jdbcType=INTEGER}
  1450. </select>
  1451. <select id="orderRefundDetail" resultType="com.goafanti.order.bo.OrderRefundDetailBo">
  1452. select a.id,date_format(a.create_time,'%Y-%m-%d') as createDate ,a.order_no as orderNo,
  1453. b.order_status as orderStatus,a.refund_status as refundStatus, a.application_url as applicationUrl,
  1454. a.contract_url as contractUrl,a.reason,b.liquidation_status as liquidationStatus
  1455. from t_order_refund a
  1456. left join t_order_new b on a.order_no=b.order_no
  1457. where a.id= #{id,jdbcType=INTEGER}
  1458. </select>
  1459. <update id="updateFinance" parameterType="string">
  1460. update t_order_new set finance_id= #{newFinance,jdbcType=VARCHAR}
  1461. where order_no in
  1462. <foreach close=")" collection="orderNos" item="orderNo" open="(" separator=",">
  1463. #{orderNo}
  1464. </foreach>
  1465. and finance_id= #{aid,jdbcType=VARCHAR}
  1466. </update>
  1467. <select id="checkContractNo" resultType="java.lang.Integer">
  1468. select count(contract_no) from t_order_new
  1469. where contract_no= #{0}
  1470. </select>
  1471. <select id="countTotalAndActually" parameterType="Map" resultType="java.util.Map">
  1472. select sum(o.settlement_amount) actuallyTotalAmount,sum(o.total_amount) signTotalAmount from t_order_new o
  1473. 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
  1474. where o.delete_sign in(0,2,3) and (o.approval = 0 or o.approval = 2) and outsource= #{o.outsource,jdbcType=INTEGER}
  1475. <if test="o.processStatus == 3">
  1476. and o.process_status = #{o.processStatus,jdbcType=INTEGER}
  1477. </if>
  1478. <if test="o.processStatus == 4">
  1479. and o.process_status &gt;= #{o.processStatus,jdbcType=INTEGER}
  1480. </if>
  1481. <if test="o.processStatus == 9">
  1482. and o.back_status = 3
  1483. </if>
  1484. <if test="fids != null and fids.size() &gt; 0">
  1485. and d.finance_id in
  1486. <foreach close=")" collection="fids" index="" item="item" open="(" separator=",">
  1487. #{item}
  1488. </foreach>
  1489. </if>
  1490. <if test="o.orderStatus != null and o.orderStatus != &quot;&quot;">
  1491. and (o.order_status >= #{o.orderStatus,jdbcType=INTEGER} or o.back_status=3)
  1492. </if>
  1493. <if test="o.departmentId != null and o.departmentId != &quot;&quot;">
  1494. and o.order_dep = #{o.departmentId,jdbcType=INTEGER}
  1495. </if>
  1496. <if test="o.contractNo != null and o.contractNo != &quot;&quot;">
  1497. and o.contract_no like CONCAT('%',#{o.contractNo,jdbcType=VARCHAR},'%')
  1498. </if>
  1499. <if test="o.liquidationStatus != null">
  1500. and o.liquidation_status = #{o.liquidationStatus,jdbcType=INTEGER}
  1501. </if>
  1502. <if test="o.amountStatus == 0">
  1503. and o.total_amount &lt; 10
  1504. </if>
  1505. <if test="o.amountStatus == 1">
  1506. and o.total_amount between 10 and 20
  1507. </if>
  1508. <if test="o.amountStatus == 2">
  1509. and o.total_amount between 20 and 30
  1510. </if>
  1511. <if test="o.amountStatus == 3">
  1512. and o.total_amount between 30 and 40
  1513. </if>
  1514. <if test="o.amountStatus == 4">
  1515. and o.total_amount &gt; 40
  1516. </if>
  1517. <if test="o.orderNo != null and o.orderNo != &quot;&quot;">
  1518. and o.order_no = #{o.orderNo,jdbcType=VARCHAR}
  1519. </if>
  1520. <if test="o.projectType != null and o.projectType != &quot;&quot;">
  1521. and a.project_type = #{o.projectType}
  1522. </if>
  1523. <if test="o.approval != null and o.approval &lt; 3">
  1524. and o.approval = #{o.approval}
  1525. </if>
  1526. <if test="o.approval != null and o.approval ==4">
  1527. and o.approval in (1,2)
  1528. </if>
  1529. <if test="o.buyerName != null and o.buyerName != &quot;&quot;">
  1530. <bind name="n" value="'%' + o.buyerName + '%'" />
  1531. and u.nickname like #{n,jdbcType=VARCHAR}
  1532. </if>
  1533. <if test="o.startTime != null and o.startTime != &quot;&quot; and o.endTime != null and o.endTime != &quot;&quot;">
  1534. <bind name="a" value="o.startTime + ' 00:00:00'" />
  1535. <bind name="b" value="o.endTime + ' 23:59:59'" />
  1536. and o.create_time between #{a,jdbcType=VARCHAR} and #{b,jdbcType=VARCHAR}
  1537. </if>
  1538. <if test="o.startFinalReceivablesTime != null and o.startFinalReceivablesTime != &quot;&quot; and o.endFinalReceivablesTime != null and o.endFinalReceivablesTime != &quot;&quot;">
  1539. <bind name="c" value="o.startFinalReceivablesTime + ' 00:00:00'" />
  1540. <bind name="d" value="o.endFinalReceivablesTime + ' 23:59:59'" />
  1541. and a.final_Receivables_time between #{c,jdbcType=VARCHAR} and #{d,jdbcType=VARCHAR}
  1542. </if>
  1543. </select>
  1544. <select id="getLastPayment" resultType="com.goafanti.common.model.TOrderBillNew">
  1545. select date_format(create_time, '%Y-%m-%d %H:%i:%s') createTimes,transaction_amount transactionAmount from t_order_bill_new
  1546. where order_no= #{orderNo}
  1547. order by create_time desc limit 1;
  1548. </select>
  1549. <update id="updateSalesmanId">
  1550. update t_order_new set salesman_id= #{transferId},old_salesman_id= #{aid}
  1551. where delete_sign in(0,2,3) and salesman_id= #{aid}
  1552. </update>
  1553. <select id="selectUsedOrderByOrder" resultType="com.goafanti.order.bo.TOrderNewBo">
  1554. select
  1555. 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,
  1556. a.first_amount as firstAmount,a.total_amount as totalAmount, a.settlement_amount as settlementAmount, order_status as orderStatus,
  1557. a.liquidation_status as liquidationStatus, a.process_status as processStatus, a.project_status as projectStatus, a.approval,
  1558. a.order_remarks as orderRemarks, a.delete_sign as deleteSign, a.salesman_id as salesmanId, a.finance_id as financeId, technician_id as technicianId,
  1559. a.sign_time as signTime, a.settlement_time as settlementTime, a.contract_no as contractNo, a.contract_type as contractType, a.contacts,
  1560. a.contact_mobile as contactMobile, a.legal_person as legalPerson, a.legal_person_tel as legalPersonTel, a.proof_count as proofCount,
  1561. a.proof_aid as proofAid,contract_picture_url as contractPictureUrl, c.name as salesmanName,dep.name as depName,d.name as financeName,
  1562. c.contact_mobile as salesmanMobile,d.contact_mobile as financeMobile,b.nickname as userName ,e.back_status as backStatus,f.name as initiateName,
  1563. 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,
  1564. g.location_city as locationCity,g.location_area locationArea,g.postal_address postalAddress,outsource,a.primary_order primaryOrder,
  1565. h.name NowFinance,h.contact_mobile NowFinanceMobile,a.additional_order additionalOrder,i.name as oldSalesmanName, i.contact_mobile oldSalesmanMobile
  1566. 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
  1567. 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
  1568. 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
  1569. left join admin f on e.initiate=f.id left join organization_identity g on a.buyer_id=g.uid
  1570. where noc.order_no= #{orderNo} order by noc.create_time
  1571. </select>
  1572. <update id="updaterefund" parameterType="com.goafanti.common.model.TOrderNew">
  1573. update t_order_new set settlement_amount=settlement_amount-#{refundAmount,jdbcType=DECIMAL},
  1574. refund_amount=#{refundAmount,jdbcType=DECIMAL} where order_no=#{orderNo}
  1575. </update>
  1576. <select id="selectArrearsDunListByPage" resultType="com.goafanti.order.bo.OutArrearsDunListBo">
  1577. select a.id, b.contract_no contractNo,a.order_no as orderNo,c.nickname as userName,tm.salesman_name as salesmanName,
  1578. b.project_status projectStatus, b.total_amount as totalAmount,b.liquidation_status as liquidationStatus,a.`type`,
  1579. b.settlement_amount as settlementAmount, a.order_receivables orderReceivables,a.order_arrears as orderArrears,
  1580. b.order_status as orderStatus, date_format(a.start_time, '%Y-%m-%d %H:%i:%s') as startDate,dep.name as depName,
  1581. date_format(b.sign_time,'%Y-%m-%d') as signDate,a.dun_status dunStatus,x.commodity_name commodityName
  1582. from t_arrears_dun a
  1583. left join (select order_no ,commodity_name from t_order_task where main =1)x on a.order_no =x.order_no
  1584. left join t_order_new b on a.order_no=b.order_no left join `user` c on b.buyer_id=c.id
  1585. left join t_order_mid tm on b.order_no=tm.order_no left join department dep on b.order_dep=dep.id
  1586. where b.delete_sign in(0,2,3) and dun_status in (1,2,3)
  1587. <if test="shiroType == 1 and fid !=null">
  1588. and tm.finance_id= #{fid,jdbcType=VARCHAR}
  1589. </if>
  1590. <if test="shiroType == 2 and fid !=null">
  1591. and tm.finance_id in (select id from admin where superior_id= #{fid,jdbcType=VARCHAR})
  1592. </if>
  1593. <if test="name != null">
  1594. and c.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  1595. </if>
  1596. <if test="adminName != null">
  1597. and tm.salesman_name like CONCAT('%',#{adminName,jdbcType=VARCHAR},'%')
  1598. </if>
  1599. <if test="orderNo != null">
  1600. and a.order_no like CONCAT('%',#{orderNo,jdbcType=VARCHAR},'%')
  1601. </if>
  1602. <if test="contractNo != null">
  1603. and b.contract_no like CONCAT('%',#{contractNo,jdbcType=VARCHAR},'%')
  1604. </if>
  1605. <if test="deps != null">
  1606. and b.order_dep in
  1607. <foreach close=")" collection="deps" item="deps" open="(" separator=",">
  1608. #{deps.id}
  1609. </foreach>
  1610. </if>
  1611. <if test="shiroType !=3 and aid != null">
  1612. and b.salesman_id= #{aid,jdbcType=VARCHAR}
  1613. </if>
  1614. <if test="starTime !=null and endTime !=null">
  1615. and b.sign_time between #{starTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  1616. </if>
  1617. <if test="tStarTime !=null and tEndTime !=null">
  1618. and a.start_time between #{tStarTime,jdbcType=VARCHAR} and #{tEndTime,jdbcType=VARCHAR}
  1619. </if>
  1620. order by dun_status,a.start_time desc
  1621. <if test="page_sql!=null">
  1622. ${page_sql}
  1623. </if>
  1624. </select>
  1625. <select id="selectArrearsDunListByCount" resultType="java.lang.Integer">
  1626. select count(*) from t_arrears_dun a
  1627. left join t_order_new b on a.order_no=b.order_no left join `user` c on b.buyer_id=c.id
  1628. left join t_order_mid tm on b.order_no=tm.order_no left join department dep on b.order_dep=dep.id
  1629. where b.delete_sign in(0,2,3) and dun_status in (1,2,3)
  1630. <if test="shiroType == 1 and fid !=null">
  1631. and tm.finance_id= #{fid,jdbcType=VARCHAR}
  1632. </if>
  1633. <if test="shiroType == 2 and fid !=null">
  1634. and tm.finance_id in (select id from admin where superior_id= #{fid,jdbcType=VARCHAR})
  1635. </if>
  1636. <if test="shiroType !=3 and aid != null">
  1637. and b.salesman_id= #{aid,jdbcType=VARCHAR}
  1638. </if>
  1639. <if test="name != null">
  1640. and c.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  1641. </if>
  1642. <if test="adminName != null">
  1643. and tm.salesman_name like CONCAT('%',#{adminName,jdbcType=VARCHAR},'%')
  1644. </if>
  1645. <if test="orderNo != null">
  1646. and a.order_no like CONCAT('%',#{orderNo,jdbcType=VARCHAR},'%')
  1647. </if>
  1648. <if test="deps != null">
  1649. and b.order_dep in
  1650. <foreach close=")" collection="deps" item="deps" open="(" separator=",">
  1651. #{deps.id}
  1652. </foreach>
  1653. </if>
  1654. <if test="shiroType !=3 and aid != null">
  1655. and b.salesman_id= #{aid,jdbcType=VARCHAR}
  1656. </if>
  1657. <if test="starTime !=null and endTime !=null">
  1658. and b.sign_time between #{starTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  1659. </if>
  1660. <if test="tStarTime !=null and tEndTime !=null">
  1661. and a.start_time between #{tStarTime,jdbcType=VARCHAR} and #{tEndTime,jdbcType=VARCHAR}
  1662. </if>
  1663. </select>
  1664. <select id="selectByUidAndNewUser" resultType="java.math.BigDecimal">
  1665. select total_amount from t_order_new
  1666. where process_status >4 and buyer_id = #{uid}
  1667. and salesman_id =#{aid}
  1668. and new_user = #{newUser}
  1669. and create_time between #{date} and #{now}
  1670. </select>
  1671. <select id="statisticsList" resultType="com.goafanti.order.bo.outStatisticsList">
  1672. select z.id,z.province,z.counts,z.quantity,z.total
  1673. from (select y.id,y.province,count(aid)counts,sum(quantity)quantity,sum(total)total
  1674. from (select x.id,x.province,x.aid,sum(quantity)quantity, sum(x.total)total
  1675. from (select d.id,d.name province,a.order_no,a.salesman_id aid,
  1676. if(a.total_amount>0.5,1,if(a.total_amount>0 and a.order_type=1,0.5,0))quantity,
  1677. a.total_amount total
  1678. from t_order_new a left join admin b on a.salesman_id =b.id
  1679. left join department c on b.department_id =c.id left join district_glossory d on c.province =d.id
  1680. where a.process_status >4 and a.delete_sign in(0,2)
  1681. <if test="depId !=null">
  1682. and b.department_id = #{depId}
  1683. </if>
  1684. <if test="province !=null">
  1685. and c.province = #{province}
  1686. </if>
  1687. <if test="startCreate !=null and endCreate !=null">
  1688. and a.create_time between #{startCreate} and #{endCreate}
  1689. </if>
  1690. <if test="startSign !=null and endSign !=null">
  1691. and a.sign_time between #{startSign} and #{endSign}
  1692. </if>
  1693. )x group by x.id,x.province,x.aid)y group by y.id,y.province)z
  1694. order by
  1695. <if test="sort ==0">
  1696. total
  1697. </if>
  1698. <if test="sort ==1">
  1699. quantity
  1700. </if>
  1701. <if test="sort ==2">
  1702. counts
  1703. </if>
  1704. desc
  1705. </select>
  1706. <select id="provinceStatisticsList" resultType="com.goafanti.order.bo.outProvinceStatisticsList">
  1707. select z.depName,z.aid,z.name,z.quantity,z.total
  1708. from ( select x.depName,x.aid,x.name,sum(quantity)quantity,sum(total)total
  1709. from ( select c.name depName,a.order_no,b.id aid,b.name name,
  1710. if(a.total_amount>0.5,1,if(a.total_amount>0 and a.order_type=1,0.5,0))quantity,
  1711. a.total_amount total
  1712. from t_order_new a left join admin b on a.salesman_id =b.id
  1713. left join department c on b.department_id =c.id left join district_glossory d on c.province =d.id
  1714. where a.process_status >4 and a.delete_sign in(0,2)
  1715. <if test="depId !=null">
  1716. and b.department_id = #{depId}
  1717. </if>
  1718. <if test="province !=null">
  1719. and c.province = #{province}
  1720. </if>
  1721. <if test="startCreate !=null and endCreate !=null">
  1722. and a.create_time between #{startCreate} and #{endCreate}
  1723. </if>
  1724. <if test="startSign !=null and endSign !=null">
  1725. and a.sign_time between #{startSign} and #{endSign}
  1726. </if>
  1727. )x group by x.depName,x.aid,x.name )z order by
  1728. <if test="sort ==0">
  1729. total
  1730. </if>
  1731. <if test="sort ==1">
  1732. quantity
  1733. </if>
  1734. desc
  1735. </select>
  1736. <select id="selectOrderByuid" resultType="java.util.Map">
  1737. select order_no orderNo,contract_no contractNo
  1738. from t_order_new where delete_sign in (0,2) and buyer_id = #{uid}
  1739. order by create_time desc
  1740. </select>
  1741. <select id="orderSalesSource" resultType="com.goafanti.order.bo.OutOrderSalesSource">
  1742. select y.province,dg.name ,y.total_amount totalAmount,y.counts,y.dhxkf,y.dhxkf/y.counts dhxkfl,
  1743. y.dhzdzy,y.dhzdzy/y.counts dhzdzyl,y.wl,y.wl/y.counts wll,
  1744. y.qd,y.qd/y.counts qdl,y.zjs,y.zjs/y.counts zjsl,y.qt,y.qt/y.counts qtl,
  1745. y.gxfg,y.gxfg/y.counts gxfgl,y.qtfg,y.qtfg/y.counts qtfgl
  1746. from (select x.province,sum(x.total_amount)total_amount,sum(x.counts)counts,
  1747. sum(x.dhxkf)dhxkf,sum(x.dhzdzy)dhzdzy,sum(x.wl)wl,sum(x.qd)qd, sum(x.zjs)zjs, sum(x.qt)qt,
  1748. sum(x.gxfg)gxfg, sum(x.qtfg)qtfg
  1749. from ( select b.province ,1 counts,a.total_amount,a.sales_type ,
  1750. case a.sales_type when 0 then 1 else 0 end dhxkf,
  1751. case a.sales_type when 1 then 1 else 0 end dhzdzy,
  1752. case a.sales_type when 2 then 1 else 0 end wl,
  1753. case a.sales_type when 3 then 1 else 0 end qd,
  1754. case a.sales_type when 4 then 1 else 0 end zjs,
  1755. case a.sales_type when 5 then 1 else 0 end qt,
  1756. case a.sales_type when 6 then 1 else 0 end gxfg,
  1757. case a.sales_type when 7 then 1 else 0 end qtfg
  1758. from t_order_new a left join department b on a.order_dep =b.id
  1759. where a.delete_sign in (0,2) and a.process_status &gt; 0 and a.approval in (0,1,2)
  1760. <if test=" startDate !=null and endDate != null">
  1761. and a.create_time between #{startDate} and #{endDate}
  1762. </if>
  1763. <if test=" deps !=null">
  1764. and a.order_dep in
  1765. <foreach close=")" collection="deps" item="depId" open="(" separator=",">
  1766. #{depId}
  1767. </foreach>
  1768. </if>
  1769. <if test=" province !=null">
  1770. and b.province = #{province}
  1771. </if>
  1772. )x group by x.province)y left join district_glossory dg on y.province=dg.id
  1773. <if test=" sort ==0">
  1774. order by y.total_amount desc
  1775. </if>
  1776. <if test=" sort ==1">
  1777. order by y.counts desc
  1778. </if>
  1779. </select>
  1780. <select id="selectstatisticsOrderListPage" resultType="com.goafanti.order.bo.TOrderNewBo">
  1781. 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,
  1782. a.contract_no as contractNo, b.nickname as userName ,a.process_status as processStatus,a.total_amount as totalAmount,
  1783. a.order_status as orderStatus, a.liquidation_status as liquidationStatus,a.approval,c.salesman_name as salesmanName,c.project_type projectType,
  1784. dep.name as depName,c.finance_name as financeName,c.invoice_amount invoiceAmount,a.settlement_amount settlementAmount,
  1785. a.sales_type salesType, a.channel_id channelId ,a.other
  1786. 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
  1787. left join department dep on a.order_dep=dep.id
  1788. where a.delete_sign in(0,2) and a.process_status >0 and a.approval in (0,1,2)
  1789. <if test="province !=null ">
  1790. and dep.province = #{province}
  1791. </if>
  1792. <if test="salesType !=null ">
  1793. and a.sales_type = #{salesType}
  1794. </if>
  1795. <if test=" startDate !=null and endDate != null">
  1796. and a.create_time between #{startDate} and #{endDate}
  1797. </if>
  1798. <if test=" depId !=null">
  1799. and a.order_dep= #{depId}
  1800. </if>
  1801. <if test="orderNo != null">
  1802. and a.order_no like CONCAT('%',#{orderNo,jdbcType=VARCHAR},'%')
  1803. </if>
  1804. <if test="name != null">
  1805. and b.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  1806. </if>
  1807. <if test="contractNo != null">
  1808. and a.contract_no like CONCAT('%',#{contractNo,jdbcType=VARCHAR},'%')
  1809. </if>
  1810. <if test="liquidationStatus != null">
  1811. and a.liquidation_status = #{liquidationStatus,jdbcType=INTEGER}
  1812. </if>
  1813. <if test="approval ==0">
  1814. and a.approval = 0
  1815. </if>
  1816. <if test="approval ==1">
  1817. and a.approval in (1,2)
  1818. </if>
  1819. <if test="amountStatus == 0">
  1820. and a.total_amount &lt; 10
  1821. </if>
  1822. <if test="amountStatus == 1">
  1823. and a.total_amount between 10 and 20
  1824. </if>
  1825. <if test="amountStatus == 2">
  1826. and a.total_amount between 20 and 30
  1827. </if>
  1828. <if test="amountStatus == 3">
  1829. and a.total_amount between 30 and 40
  1830. </if>
  1831. <if test="amountStatus == 4">
  1832. and a.total_amount &gt; 40
  1833. </if>
  1834. order by a.create_time desc
  1835. <if test="page_sql!=null">
  1836. ${page_sql}
  1837. </if>
  1838. </select>
  1839. <select id="selectstatisticsOrderListCount" resultType="integer">
  1840. select count(*)
  1841. 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
  1842. left join department dep on a.order_dep=dep.id
  1843. where a.delete_sign in(0,2) and a.process_status >0 and a.approval in (0,1,2)
  1844. <if test="province !=null ">
  1845. and dep.province = #{province}
  1846. </if>
  1847. <if test="salesType !=null ">
  1848. and a.sales_type = #{salesType}
  1849. </if>
  1850. <if test=" startDate !=null and endDate != null">
  1851. and a.create_time between #{startDate} and #{endDate}
  1852. </if>
  1853. <if test=" depId !=null">
  1854. and a.order_dep= #{depId}
  1855. </if>
  1856. <if test="orderNo != null">
  1857. and a.order_no like CONCAT('%',#{orderNo,jdbcType=VARCHAR},'%')
  1858. </if>
  1859. <if test="name != null">
  1860. and b.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  1861. </if>
  1862. <if test="contractNo != null">
  1863. and a.contract_no like CONCAT('%',#{contractNo,jdbcType=VARCHAR},'%')
  1864. </if>
  1865. <if test="liquidationStatus != null">
  1866. and a.liquidation_status = #{liquidationStatus,jdbcType=INTEGER}
  1867. </if>
  1868. <if test="approval ==0">
  1869. and a.approval = 0
  1870. </if>
  1871. <if test="approval ==1">
  1872. and a.approval in (1,2)
  1873. </if>
  1874. <if test="amountStatus == 0">
  1875. and a.total_amount &lt; 10
  1876. </if>
  1877. <if test="amountStatus == 1">
  1878. and a.total_amount between 10 and 20
  1879. </if>
  1880. <if test="amountStatus == 2">
  1881. and a.total_amount between 20 and 30
  1882. </if>
  1883. <if test="amountStatus == 3">
  1884. and a.total_amount between 30 and 40
  1885. </if>
  1886. <if test="amountStatus == 4">
  1887. and a.total_amount &gt; 40
  1888. </if>
  1889. </select>
  1890. </mapper>