TOrderNewMapper.xml 78 KB

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