TOrderDunMapper.xml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  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.TOrderDunMapper">
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.TOrderDun">
  5. <!--
  6. WARNING - @mbg.generated
  7. This element is automatically generated by MyBatis Generator, do not modify.
  8. This element was generated on Mon Nov 19 16:53:48 CST 2018.
  9. -->
  10. <id column="id" jdbcType="VARCHAR" property="id" />
  11. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  12. <result column="start_time" jdbcType="DATE" property="startTime" />
  13. <result column="end_time" jdbcType="DATE" property="endTime" />
  14. <result column="order_no" jdbcType="VARCHAR" property="orderNo" />
  15. <result column="dun_subject" jdbcType="INTEGER" property="dunSubject" />
  16. <result column="dun_status" jdbcType="INTEGER" property="dunStatus" />
  17. <result column="dun_by" jdbcType="VARCHAR" property="dunBy" />
  18. <result column="dun_target" jdbcType="VARCHAR" property="dunTarget" />
  19. <result column="money" jdbcType="DECIMAL" property="money" />
  20. </resultMap>
  21. <sql id="Example_Where_Clause">
  22. <!--
  23. WARNING - @mbg.generated
  24. This element is automatically generated by MyBatis Generator, do not modify.
  25. This element was generated on Mon Nov 19 16:53:48 CST 2018.
  26. -->
  27. <where>
  28. <foreach collection="oredCriteria" item="criteria" separator="or">
  29. <if test="criteria.valid">
  30. <trim prefix="(" prefixOverrides="and" suffix=")">
  31. <foreach collection="criteria.criteria" item="criterion">
  32. <choose>
  33. <when test="criterion.noValue">
  34. and ${criterion.condition}
  35. </when>
  36. <when test="criterion.singleValue">
  37. and ${criterion.condition} #{criterion.value}
  38. </when>
  39. <when test="criterion.betweenValue">
  40. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  41. </when>
  42. <when test="criterion.listValue">
  43. and ${criterion.condition}
  44. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  45. #{listItem}
  46. </foreach>
  47. </when>
  48. </choose>
  49. </foreach>
  50. </trim>
  51. </if>
  52. </foreach>
  53. </where>
  54. </sql>
  55. <sql id="Update_By_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 Mon Nov 19 16:53:48 CST 2018.
  60. -->
  61. <where>
  62. <foreach collection="example.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="Base_Column_List">
  90. <!--
  91. WARNING - @mbg.generated
  92. This element is automatically generated by MyBatis Generator, do not modify.
  93. This element was generated on Mon Nov 19 16:53:48 CST 2018.
  94. -->
  95. id, create_time, start_time, end_time, order_no, dun_subject, dun_status, dun_by,
  96. dun_target,money
  97. </sql>
  98. <select id="selectByExample" parameterType="com.goafanti.common.model.TOrderDunExample" resultMap="BaseResultMap">
  99. <!--
  100. WARNING - @mbg.generated
  101. This element is automatically generated by MyBatis Generator, do not modify.
  102. This element was generated on Mon Nov 19 16:53:48 CST 2018.
  103. -->
  104. select
  105. <if test="distinct">
  106. distinct
  107. </if>
  108. <include refid="Base_Column_List" />
  109. from t_order_dun
  110. <if test="_parameter != null">
  111. <include refid="Example_Where_Clause" />
  112. </if>
  113. <if test="orderByClause != null">
  114. order by ${orderByClause}
  115. </if>
  116. </select>
  117. <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
  118. <!--
  119. WARNING - @mbg.generated
  120. This element is automatically generated by MyBatis Generator, do not modify.
  121. This element was generated on Mon Nov 19 16:53:48 CST 2018.
  122. -->
  123. select
  124. <include refid="Base_Column_List" />
  125. from t_order_dun
  126. where id = #{id,jdbcType=VARCHAR}
  127. </select>
  128. <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
  129. <!--
  130. WARNING - @mbg.generated
  131. This element is automatically generated by MyBatis Generator, do not modify.
  132. This element was generated on Mon Nov 19 16:53:48 CST 2018.
  133. -->
  134. delete from t_order_dun
  135. where id = #{id,jdbcType=VARCHAR}
  136. </delete>
  137. <delete id="deleteByExample" parameterType="com.goafanti.common.model.TOrderDunExample">
  138. <!--
  139. WARNING - @mbg.generated
  140. This element is automatically generated by MyBatis Generator, do not modify.
  141. This element was generated on Mon Nov 19 16:53:48 CST 2018.
  142. -->
  143. delete from t_order_dun
  144. <if test="_parameter != null">
  145. <include refid="Example_Where_Clause" />
  146. </if>
  147. </delete>
  148. <insert id="insert" parameterType="com.goafanti.common.model.TOrderDun">
  149. <!--
  150. WARNING - @mbg.generated
  151. This element is automatically generated by MyBatis Generator, do not modify.
  152. This element was generated on Mon Nov 19 16:53:48 CST 2018.
  153. -->
  154. insert into t_order_dun (id, create_time, start_time,
  155. end_time, order_no, dun_subject,
  156. dun_status, dun_by, dun_target,money
  157. )
  158. values (#{id,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{startTime,jdbcType=DATE},
  159. #{endTime,jdbcType=DATE}, #{orderNo,jdbcType=VARCHAR}, #{dunSubject,jdbcType=INTEGER},
  160. #{dunStatus,jdbcType=INTEGER}, #{dunBy,jdbcType=VARCHAR}, #{dunTarget,jdbcType=VARCHAR},
  161. #{money,jdbcType=DECIMAL}
  162. )
  163. </insert>
  164. <insert id="insertSelective" parameterType="com.goafanti.common.model.TOrderDun">
  165. <!--
  166. WARNING - @mbg.generated
  167. This element is automatically generated by MyBatis Generator, do not modify.
  168. This element was generated on Mon Nov 19 16:53:48 CST 2018.
  169. -->
  170. insert into t_order_dun
  171. <trim prefix="(" suffix=")" suffixOverrides=",">
  172. <if test="id != null">
  173. id,
  174. </if>
  175. <if test="createTime != null">
  176. create_time,
  177. </if>
  178. <if test="startTime != null">
  179. start_time,
  180. </if>
  181. <if test="endTime != null">
  182. end_time,
  183. </if>
  184. <if test="orderNo != null">
  185. order_no,
  186. </if>
  187. <if test="dunSubject != null">
  188. dun_subject,
  189. </if>
  190. <if test="dunStatus != null">
  191. dun_status,
  192. </if>
  193. <if test="dunBy != null">
  194. dun_by,
  195. </if>
  196. <if test="dunTarget != null">
  197. dun_target,
  198. </if>
  199. <if test="money != null">
  200. money,
  201. </if>
  202. </trim>
  203. <trim prefix="values (" suffix=")" suffixOverrides=",">
  204. <if test="id != null">
  205. #{id,jdbcType=VARCHAR},
  206. </if>
  207. <if test="createTime != null">
  208. #{createTime,jdbcType=TIMESTAMP},
  209. </if>
  210. <if test="startTime != null">
  211. #{startTime,jdbcType=DATE},
  212. </if>
  213. <if test="endTime != null">
  214. #{endTime,jdbcType=DATE},
  215. </if>
  216. <if test="orderNo != null">
  217. #{orderNo,jdbcType=VARCHAR},
  218. </if>
  219. <if test="dunSubject != null">
  220. #{dunSubject,jdbcType=INTEGER},
  221. </if>
  222. <if test="dunStatus != null">
  223. #{dunStatus,jdbcType=INTEGER},
  224. </if>
  225. <if test="dunBy != null">
  226. #{dunBy,jdbcType=VARCHAR},
  227. </if>
  228. <if test="dunTarget != null">
  229. #{dunTarget,jdbcType=VARCHAR},
  230. </if>
  231. <if test="money != null">
  232. #{money,jdbcType=DECIMAL},
  233. </if>
  234. </trim>
  235. </insert>
  236. <select id="countByExample" parameterType="com.goafanti.common.model.TOrderDunExample" resultType="java.lang.Long">
  237. <!--
  238. WARNING - @mbg.generated
  239. This element is automatically generated by MyBatis Generator, do not modify.
  240. This element was generated on Mon Nov 19 16:53:48 CST 2018.
  241. -->
  242. select count(*) from t_order_dun
  243. <if test="_parameter != null">
  244. <include refid="Example_Where_Clause" />
  245. </if>
  246. </select>
  247. <update id="updateByExampleSelective" parameterType="map">
  248. <!--
  249. WARNING - @mbg.generated
  250. This element is automatically generated by MyBatis Generator, do not modify.
  251. This element was generated on Mon Nov 19 16:53:48 CST 2018.
  252. -->
  253. update t_order_dun
  254. <set>
  255. <if test="record.id != null">
  256. id = #{record.id,jdbcType=VARCHAR},
  257. </if>
  258. <if test="record.createTime != null">
  259. create_time = #{record.createTime,jdbcType=TIMESTAMP},
  260. </if>
  261. <if test="record.startTime != null">
  262. start_time = #{record.startTime,jdbcType=DATE},
  263. </if>
  264. <if test="record.endTime != null">
  265. end_time = #{record.endTime,jdbcType=DATE},
  266. </if>
  267. <if test="record.orderNo != null">
  268. order_no = #{record.orderNo,jdbcType=VARCHAR},
  269. </if>
  270. <if test="record.dunSubject != null">
  271. dun_subject = #{record.dunSubject,jdbcType=INTEGER},
  272. </if>
  273. <if test="record.dunStatus != null">
  274. dun_status = #{record.dunStatus,jdbcType=INTEGER},
  275. </if>
  276. <if test="record.dunBy != null">
  277. dun_by = #{record.dunBy,jdbcType=VARCHAR},
  278. </if>
  279. <if test="record.dunTarget != null">
  280. dun_target = #{record.dunTarget,jdbcType=VARCHAR},
  281. </if>
  282. <if test="record.money != null">
  283. money = #{money,jdbcType=DECIMAL},
  284. </if>
  285. </set>
  286. <if test="_parameter != null">
  287. <include refid="Update_By_Example_Where_Clause" />
  288. </if>
  289. </update>
  290. <update id="updateByExample" parameterType="map">
  291. <!--
  292. WARNING - @mbg.generated
  293. This element is automatically generated by MyBatis Generator, do not modify.
  294. This element was generated on Mon Nov 19 16:53:48 CST 2018.
  295. -->
  296. update t_order_dun
  297. set id = #{record.id,jdbcType=VARCHAR},
  298. create_time = #{record.createTime,jdbcType=TIMESTAMP},
  299. start_time = #{record.startTime,jdbcType=DATE},
  300. end_time = #{record.endTime,jdbcType=DATE},
  301. order_no = #{record.orderNo,jdbcType=VARCHAR},
  302. dun_subject = #{record.dunSubject,jdbcType=INTEGER},
  303. dun_status = #{record.dunStatus,jdbcType=INTEGER},
  304. dun_by = #{record.dunBy,jdbcType=VARCHAR},
  305. dun_target = #{record.dunTarget,jdbcType=VARCHAR},
  306. money = #{money,jdbcType=DECIMAL}
  307. <if test="_parameter != null">
  308. <include refid="Update_By_Example_Where_Clause" />
  309. </if>
  310. </update>
  311. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.TOrderDun">
  312. <!--
  313. WARNING - @mbg.generated
  314. This element is automatically generated by MyBatis Generator, do not modify.
  315. This element was generated on Mon Nov 19 16:53:48 CST 2018.
  316. -->
  317. update t_order_dun
  318. <set>
  319. <if test="createTime != null">
  320. create_time = #{createTime,jdbcType=TIMESTAMP},
  321. </if>
  322. <if test="startTime != null">
  323. start_time = #{startTime,jdbcType=DATE},
  324. </if>
  325. <if test="endTime != null">
  326. end_time = #{endTime,jdbcType=DATE},
  327. </if>
  328. <if test="orderNo != null">
  329. order_no = #{orderNo,jdbcType=VARCHAR},
  330. </if>
  331. <if test="dunSubject != null">
  332. dun_subject = #{dunSubject,jdbcType=INTEGER},
  333. </if>
  334. <if test="dunStatus != null">
  335. dun_status = #{dunStatus,jdbcType=INTEGER},
  336. </if>
  337. <if test="dunBy != null">
  338. dun_by = #{dunBy,jdbcType=VARCHAR},
  339. </if>
  340. <if test="dunTarget != null">
  341. dun_target = #{dunTarget,jdbcType=VARCHAR},
  342. </if>
  343. <if test="money != null">
  344. money = #{money,jdbcType=DECIMAL},
  345. </if>
  346. </set>
  347. where id = #{id,jdbcType=VARCHAR}
  348. </update>
  349. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.TOrderDun">
  350. <!--
  351. WARNING - @mbg.generated
  352. This element is automatically generated by MyBatis Generator, do not modify.
  353. This element was generated on Mon Nov 19 16:53:48 CST 2018.
  354. -->
  355. update t_order_dun
  356. set create_time = #{createTime,jdbcType=TIMESTAMP},
  357. start_time = #{startTime,jdbcType=DATE},
  358. end_time = #{endTime,jdbcType=DATE},
  359. order_no = #{orderNo,jdbcType=VARCHAR},
  360. dun_subject = #{dunSubject,jdbcType=INTEGER},
  361. dun_status = #{dunStatus,jdbcType=INTEGER},
  362. dun_by = #{dunBy,jdbcType=VARCHAR},
  363. dun_target = #{dunTarget,jdbcType=VARCHAR},
  364. money = #{money,jdbcType=DECIMAL},
  365. where id = #{id,jdbcType=VARCHAR}
  366. </update>
  367. <select id="selectByOrderNoDunSubject" resultType="com.goafanti.common.model.TOrderDun">
  368. select id,dun_subject as dunSubject,money,order_no as orderNo,dun_status as dunStatus from t_order_dun
  369. where order_no= #{orderNo,jdbcType=VARCHAR} order by dun_subject
  370. </select>
  371. <select id="selectByOrderNo" parameterType="java.lang.String" resultMap="BaseResultMap">
  372. select
  373. <include refid="Base_Column_List" />
  374. from t_order_dun
  375. where order_no= #{orderNo,jdbcType=VARCHAR} order by dun_subject
  376. </select>
  377. <select id="getOrderDunData" resultType="com.goafanti.order.bo.TOrderNewBo">
  378. select a.id,a.order_no as orderNo,date_format(b.sign_time,'%Y-%m-%d') as signDate,
  379. c.nickname as userName,b.order_status as orderStatus,b.total_amount as totalAmount,
  380. b.project_status as projectStatus,b.liquidation_status as liquidationStatus,
  381. b.settlement_amount as settlementAmount,d.name as salesmanName,a.dun_subject as dunSubject,
  382. date_format(a.start_time, '%Y-%m-%d') as startDate,dep.name as depName,
  383. a.money as accountsReceivable,(a.money-b.settlement_amount) as uncollectedAmount
  384. from t_order_dun a left join t_order_new b on a.order_no=b.order_no
  385. left join `user` c on b.buyer_id=c.id
  386. left join admin d on b.salesman_id=d.id
  387. left join department dep on d.department_id=dep.id
  388. where a.start_time is not null and b.delete_sign = 0
  389. <if test="name != null and name != ''">
  390. and c.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  391. </if>
  392. <if test="adminName != null">
  393. and d.name like CONCAT('%',#{adminName,jdbcType=VARCHAR},'%')
  394. </if>
  395. <if test="depId != null">
  396. and dep.id= #{depId,jdbcType=VARCHAR}
  397. </if>
  398. <if test="orderNo != null and orderNo != ''">
  399. and a.order_no = #{orderNo,jdbcType=VARCHAR}
  400. </if>
  401. <if test="starTime !=null and endTime !=null and starTime !='' and endTime != '' ">
  402. and b.sign_time between #{starTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  403. </if>
  404. order by b.sign_time desc
  405. </select>
  406. <select id="getTaskAllOrderDun" resultType="com.goafanti.order.bo.OrderDunTaskBo">
  407. select a.id,a.order_no as orderNo,a.dun_subject as dunSubject,a.money,settlement_amount as settlementAmount,
  408. b.project_status as projectStatus,b.order_status as orderStatus from t_order_dun a
  409. left join t_order_new b on a.order_no=b.order_no
  410. where a.dun_status=0 and b.delete_sign=0
  411. </select>
  412. <select id="checkOrderDun" resultType="java.lang.Integer">
  413. select count(*) from t_order_dun
  414. where order_no= #{orderNo,jdbcType=VARCHAR}
  415. and dun_subject= #{dunSubject,jdbcType=VARCHAR}
  416. </select>
  417. </mapper>