FinancialPaymentMapper.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  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.FinancialPaymentMapper">
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.FinancialPayment">
  5. <!--
  6. WARNING - @mbg.generated
  7. This element is automatically generated by MyBatis Generator, do not modify.
  8. This element was generated on Tue Jun 16 16:45:09 CST 2020.
  9. -->
  10. <id column="id" jdbcType="INTEGER" property="id" />
  11. <result column="pid" jdbcType="INTEGER" property="pid" />
  12. <result column="party_amount" jdbcType="DECIMAL" property="partyAmount" />
  13. <result column="payment_time" jdbcType="TIMESTAMP" property="paymentTime" />
  14. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  15. </resultMap>
  16. <sql id="Example_Where_Clause">
  17. <!--
  18. WARNING - @mbg.generated
  19. This element is automatically generated by MyBatis Generator, do not modify.
  20. This element was generated on Tue Jun 16 16:45:09 CST 2020.
  21. -->
  22. <where>
  23. <foreach collection="oredCriteria" item="criteria" separator="or">
  24. <if test="criteria.valid">
  25. <trim prefix="(" prefixOverrides="and" suffix=")">
  26. <foreach collection="criteria.criteria" item="criterion">
  27. <choose>
  28. <when test="criterion.noValue">
  29. and ${criterion.condition}
  30. </when>
  31. <when test="criterion.singleValue">
  32. and ${criterion.condition} #{criterion.value}
  33. </when>
  34. <when test="criterion.betweenValue">
  35. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  36. </when>
  37. <when test="criterion.listValue">
  38. and ${criterion.condition}
  39. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  40. #{listItem}
  41. </foreach>
  42. </when>
  43. </choose>
  44. </foreach>
  45. </trim>
  46. </if>
  47. </foreach>
  48. </where>
  49. </sql>
  50. <sql id="Update_By_Example_Where_Clause">
  51. <!--
  52. WARNING - @mbg.generated
  53. This element is automatically generated by MyBatis Generator, do not modify.
  54. This element was generated on Tue Jun 16 16:45:09 CST 2020.
  55. -->
  56. <where>
  57. <foreach collection="example.oredCriteria" item="criteria" separator="or">
  58. <if test="criteria.valid">
  59. <trim prefix="(" prefixOverrides="and" suffix=")">
  60. <foreach collection="criteria.criteria" item="criterion">
  61. <choose>
  62. <when test="criterion.noValue">
  63. and ${criterion.condition}
  64. </when>
  65. <when test="criterion.singleValue">
  66. and ${criterion.condition} #{criterion.value}
  67. </when>
  68. <when test="criterion.betweenValue">
  69. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  70. </when>
  71. <when test="criterion.listValue">
  72. and ${criterion.condition}
  73. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  74. #{listItem}
  75. </foreach>
  76. </when>
  77. </choose>
  78. </foreach>
  79. </trim>
  80. </if>
  81. </foreach>
  82. </where>
  83. </sql>
  84. <sql id="Base_Column_List">
  85. <!--
  86. WARNING - @mbg.generated
  87. This element is automatically generated by MyBatis Generator, do not modify.
  88. This element was generated on Tue Jun 16 16:45:09 CST 2020.
  89. -->
  90. id, pid, party_amount, payment_time, create_time
  91. </sql>
  92. <select id="selectByExample" parameterType="com.goafanti.common.model.FinancialPaymentExample" resultMap="BaseResultMap">
  93. <!--
  94. WARNING - @mbg.generated
  95. This element is automatically generated by MyBatis Generator, do not modify.
  96. This element was generated on Tue Jun 16 16:45:09 CST 2020.
  97. -->
  98. select
  99. <if test="distinct">
  100. distinct
  101. </if>
  102. <include refid="Base_Column_List" />
  103. from financial_payment
  104. <if test="_parameter != null">
  105. <include refid="Example_Where_Clause" />
  106. </if>
  107. <if test="orderByClause != null">
  108. order by ${orderByClause}
  109. </if>
  110. </select>
  111. <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  112. <!--
  113. WARNING - @mbg.generated
  114. This element is automatically generated by MyBatis Generator, do not modify.
  115. This element was generated on Tue Jun 16 16:45:09 CST 2020.
  116. -->
  117. select
  118. <include refid="Base_Column_List" />
  119. from financial_payment
  120. where id = #{id,jdbcType=INTEGER}
  121. </select>
  122. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
  123. <!--
  124. WARNING - @mbg.generated
  125. This element is automatically generated by MyBatis Generator, do not modify.
  126. This element was generated on Tue Jun 16 16:45:09 CST 2020.
  127. -->
  128. delete from financial_payment
  129. where id = #{id,jdbcType=INTEGER}
  130. </delete>
  131. <delete id="deleteByExample" parameterType="com.goafanti.common.model.FinancialPaymentExample">
  132. <!--
  133. WARNING - @mbg.generated
  134. This element is automatically generated by MyBatis Generator, do not modify.
  135. This element was generated on Tue Jun 16 16:45:09 CST 2020.
  136. -->
  137. delete from financial_payment
  138. <if test="_parameter != null">
  139. <include refid="Example_Where_Clause" />
  140. </if>
  141. </delete>
  142. <insert id="insert" parameterType="com.goafanti.common.model.FinancialPayment">
  143. <!--
  144. WARNING - @mbg.generated
  145. This element is automatically generated by MyBatis Generator, do not modify.
  146. This element was generated on Tue Jun 16 16:45:09 CST 2020.
  147. -->
  148. insert into financial_payment (id, pid, party_amount,
  149. payment_time, create_time)
  150. values (#{id,jdbcType=INTEGER}, #{pid,jdbcType=INTEGER}, #{partyAmount,jdbcType=DECIMAL},
  151. #{paymentTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP})
  152. </insert>
  153. <insert id="insertSelective" parameterType="com.goafanti.common.model.FinancialPayment">
  154. <!--
  155. WARNING - @mbg.generated
  156. This element is automatically generated by MyBatis Generator, do not modify.
  157. This element was generated on Tue Jun 16 16:45:09 CST 2020.
  158. -->
  159. insert into financial_payment
  160. <trim prefix="(" suffix=")" suffixOverrides=",">
  161. <if test="id != null">
  162. id,
  163. </if>
  164. <if test="pid != null">
  165. pid,
  166. </if>
  167. <if test="partyAmount != null">
  168. party_amount,
  169. </if>
  170. <if test="paymentTime != null">
  171. payment_time,
  172. </if>
  173. <if test="createTime != null">
  174. create_time,
  175. </if>
  176. </trim>
  177. <trim prefix="values (" suffix=")" suffixOverrides=",">
  178. <if test="id != null">
  179. #{id,jdbcType=INTEGER},
  180. </if>
  181. <if test="pid != null">
  182. #{pid,jdbcType=INTEGER},
  183. </if>
  184. <if test="partyAmount != null">
  185. #{partyAmount,jdbcType=DECIMAL},
  186. </if>
  187. <if test="paymentTime != null">
  188. #{paymentTime,jdbcType=TIMESTAMP},
  189. </if>
  190. <if test="createTime != null">
  191. #{createTime,jdbcType=TIMESTAMP},
  192. </if>
  193. </trim>
  194. </insert>
  195. <insert id="insertSelectiveGetId" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.FinancialPayment" useGeneratedKeys="true">
  196. insert into financial_payment
  197. <trim prefix="(" suffix=")" suffixOverrides=",">
  198. <if test="id != null">
  199. id,
  200. </if>
  201. <if test="pid != null">
  202. pid,
  203. </if>
  204. <if test="partyAmount != null">
  205. party_amount,
  206. </if>
  207. <if test="paymentTime != null">
  208. payment_time,
  209. </if>
  210. <if test="createTime != null">
  211. create_time,
  212. </if>
  213. </trim>
  214. <trim prefix="values (" suffix=")" suffixOverrides=",">
  215. <if test="id != null">
  216. #{id,jdbcType=INTEGER},
  217. </if>
  218. <if test="pid != null">
  219. #{pid,jdbcType=INTEGER},
  220. </if>
  221. <if test="partyAmount != null">
  222. #{partyAmount,jdbcType=DECIMAL},
  223. </if>
  224. <if test="paymentTime != null">
  225. #{paymentTime,jdbcType=TIMESTAMP},
  226. </if>
  227. <if test="createTime != null">
  228. #{createTime,jdbcType=TIMESTAMP},
  229. </if>
  230. </trim>
  231. <selectKey keyProperty="id" order="AFTER" resultType="int">
  232. SELECT LAST_INSERT_ID()
  233. </selectKey>
  234. </insert>
  235. <select id="countByExample" parameterType="com.goafanti.common.model.FinancialPaymentExample" resultType="java.lang.Long">
  236. <!--
  237. WARNING - @mbg.generated
  238. This element is automatically generated by MyBatis Generator, do not modify.
  239. This element was generated on Tue Jun 16 16:45:09 CST 2020.
  240. -->
  241. select count(*) from financial_payment
  242. <if test="_parameter != null">
  243. <include refid="Example_Where_Clause" />
  244. </if>
  245. </select>
  246. <update id="updateByExampleSelective" parameterType="map">
  247. <!--
  248. WARNING - @mbg.generated
  249. This element is automatically generated by MyBatis Generator, do not modify.
  250. This element was generated on Tue Jun 16 16:45:09 CST 2020.
  251. -->
  252. update financial_payment
  253. <set>
  254. <if test="record.id != null">
  255. id = #{record.id,jdbcType=INTEGER},
  256. </if>
  257. <if test="record.pid != null">
  258. pid = #{record.pid,jdbcType=INTEGER},
  259. </if>
  260. <if test="record.partyAmount != null">
  261. party_amount = #{record.partyAmount,jdbcType=DECIMAL},
  262. </if>
  263. <if test="record.paymentTime != null">
  264. payment_time = #{record.paymentTime,jdbcType=TIMESTAMP},
  265. </if>
  266. <if test="record.createTime != null">
  267. create_time = #{record.createTime,jdbcType=TIMESTAMP},
  268. </if>
  269. </set>
  270. <if test="_parameter != null">
  271. <include refid="Update_By_Example_Where_Clause" />
  272. </if>
  273. </update>
  274. <update id="updateByExample" parameterType="map">
  275. <!--
  276. WARNING - @mbg.generated
  277. This element is automatically generated by MyBatis Generator, do not modify.
  278. This element was generated on Tue Jun 16 16:45:09 CST 2020.
  279. -->
  280. update financial_payment
  281. set id = #{record.id,jdbcType=INTEGER},
  282. pid = #{record.pid,jdbcType=INTEGER},
  283. party_amount = #{record.partyAmount,jdbcType=DECIMAL},
  284. payment_time = #{record.paymentTime,jdbcType=TIMESTAMP},
  285. create_time = #{record.createTime,jdbcType=TIMESTAMP}
  286. <if test="_parameter != null">
  287. <include refid="Update_By_Example_Where_Clause" />
  288. </if>
  289. </update>
  290. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.FinancialPayment">
  291. <!--
  292. WARNING - @mbg.generated
  293. This element is automatically generated by MyBatis Generator, do not modify.
  294. This element was generated on Tue Jun 16 16:45:09 CST 2020.
  295. -->
  296. update financial_payment
  297. <set>
  298. <if test="pid != null">
  299. pid = #{pid,jdbcType=INTEGER},
  300. </if>
  301. <if test="partyAmount != null">
  302. party_amount = #{partyAmount,jdbcType=DECIMAL},
  303. </if>
  304. <if test="paymentTime != null">
  305. payment_time = #{paymentTime,jdbcType=TIMESTAMP},
  306. </if>
  307. <if test="createTime != null">
  308. create_time = #{createTime,jdbcType=TIMESTAMP},
  309. </if>
  310. </set>
  311. where id = #{id,jdbcType=INTEGER}
  312. </update>
  313. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.FinancialPayment">
  314. <!--
  315. WARNING - @mbg.generated
  316. This element is automatically generated by MyBatis Generator, do not modify.
  317. This element was generated on Tue Jun 16 16:45:09 CST 2020.
  318. -->
  319. update financial_payment
  320. set pid = #{pid,jdbcType=INTEGER},
  321. party_amount = #{partyAmount,jdbcType=DECIMAL},
  322. payment_time = #{paymentTime,jdbcType=TIMESTAMP},
  323. create_time = #{createTime,jdbcType=TIMESTAMP}
  324. where id = #{id,jdbcType=INTEGER}
  325. </update>
  326. <select id="selectByPid" resultType="com.goafanti.organization.bo.outFinancialPayment">
  327. select id,pid,party_amount partyAmount,date_format(payment_time,'%Y-%m-%d') paymentTimes
  328. from financial_payment where pid= #{id}
  329. </select>
  330. <select id="selectBypidGetNotice" resultType="com.goafanti.organization.bo.NoticeInformationBo">
  331. select b.id pid,d.order_no orderNo,d.salesman_id salesmanId,d.salesman_name salesmanName , d.buyer_name buyerName,
  332. d.finance_id financeId,d.finance_name financeName,ta.name techName ,sa.email salesmanEmail,fa.email financeEmail,
  333. ta.email techEmail,ta.id techId from t_order_payment b left join t_order_task c on b.tid=c.id
  334. left join t_order_mid d on c.order_no=d.order_no left join admin sa on d.salesman_id=sa.id
  335. left join admin fa on d.finance_id=fa.id left join admin ta on c.task_receiver=ta.id
  336. where b.id= #{pid}
  337. </select>
  338. <select id="updateOrderCost">
  339. update t_order_payment a,t_task_mid z,t_order_task b,t_order_new c,t_order_mid d
  340. set z.party_amount=z.party_amount+ #{partyAmount} ,d.expect_profit =c.total_amount -d.cost_amount,
  341. d.actual_profit =c.total_amount -d.payment_amount
  342. where a.id=#{pid} and a.tid=z.tid and a.tid=b.id and b.order_no =c.order_no and c.order_no =d.order_no
  343. </select>
  344. </mapper>