TOrderNewMapper.xml 68 KB

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