ProdIODetailMapper.xml 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679
  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.usoftchina.saas.purchase.mapper.ProdIODetailMapper">
  4. <resultMap id="BaseResultMap" type="com.usoftchina.saas.purchase.po.ProdIODetail">
  5. <id column="pd_id" jdbcType="INTEGER" property="id" />
  6. <result column="pd_piid" jdbcType="INTEGER" property="pd_piid" />
  7. <result column="pd_inoutno" jdbcType="VARCHAR" property="pd_inoutno" />
  8. <result column="pd_piclass" jdbcType="VARCHAR" property="pd_piclass" />
  9. <result column="pd_pdno" jdbcType="INTEGER" property="pd_pdno" />
  10. <result column="pd_ordercode" jdbcType="VARCHAR" property="pd_ordercode" />
  11. <result column="pd_orderdetno" jdbcType="INTEGER" property="pd_orderdetno" />
  12. <result column="pd_prodid" jdbcType="INTEGER" property="pd_prodid" />
  13. <result column="pd_prodcode" jdbcType="VARCHAR" property="pd_prodcode" />
  14. <result column="pd_unit" jdbcType="VARCHAR" property="pd_unit" />
  15. <result column="pd_inqty" jdbcType="DOUBLE" property="pd_inqty" />
  16. <result column="pd_outqty" jdbcType="DOUBLE" property="pd_outqty" />
  17. <result column="pd_orderprice" jdbcType="DOUBLE" property="pd_orderprice" />
  18. <result column="pd_sendprice" jdbcType="DOUBLE" property="pd_sendprice" />
  19. <result column="pd_price" jdbcType="DOUBLE" property="pd_price" />
  20. <result column="pd_total" jdbcType="DOUBLE" property="pd_total" />
  21. <result column="pd_taxrate" jdbcType="DOUBLE" property="pd_taxrate" />
  22. <result column="pd_netprice" jdbcType="DOUBLE" property="pd_netprice" />
  23. <result column="pd_nettotal" jdbcType="DOUBLE" property="pd_nettotal" />
  24. <result column="pd_ordertotal" jdbcType="DOUBLE" property="pd_ordertotal" />
  25. <result column="pd_whid" jdbcType="INTEGER" property="pd_whid" />
  26. <result column="pd_whcode" jdbcType="VARCHAR" property="pd_whcode" />
  27. <result column="pd_whname" jdbcType="VARCHAR" property="pd_whname" />
  28. <result column="pd_inwhid" jdbcType="INTEGER" property="pd_inwhid" />
  29. <result column="pd_inwhcode" jdbcType="VARCHAR" property="pd_inwhcode" />
  30. <result column="pd_inwhname" jdbcType="VARCHAR" property="pd_inwhname" />
  31. <result column="pd_orderid" jdbcType="INTEGER" property="pd_orderid" />
  32. <result column="pd_sdid" jdbcType="INTEGER" property="pd_sdid" />
  33. <result column="pd_status" jdbcType="INTEGER" property="pd_status" />
  34. <result column="companyid" jdbcType="INTEGER" property="companyId" />
  35. <result column="updaterid" jdbcType="INTEGER" property="updaterId" />
  36. <result column="updatetime" jdbcType="TIMESTAMP" property="updateTime" />
  37. <result column="pd_text1" jdbcType="VARCHAR" property="pd_text1" />
  38. <result column="pd_text2" jdbcType="VARCHAR" property="pd_text2" />
  39. <result column="pd_text3" jdbcType="VARCHAR" property="pd_text3" />
  40. <result column="pd_text4" jdbcType="VARCHAR" property="pd_text4" />
  41. <result column="pd_text5" jdbcType="VARCHAR" property="pd_text5" />
  42. <result column="pd_remark" jdbcType="VARCHAR" property="pd_remark" />
  43. <result column="pd_ym" jdbcType="INTEGER" property="pd_ym" />
  44. <result column="pd_yqty" jdbcType="DOUBLE" property="pd_yqty" />
  45. <result column="pd_ioid" jdbcType="INTEGER" property="pd_ioid" />
  46. <association property="productDTO" javaType="com.usoftchina.saas.document.dto.ProductDTO">
  47. <id column="pr_id" property="id"/>
  48. <result column="pr_code" property="pr_code"/>
  49. <result column="pr_detail" property="pr_detail"/>
  50. <result column="pr_spec" property="pr_spec"/>
  51. <result column="pr_unit" property="pr_unit"/>
  52. <result column="pr_kind" property="pr_kind"/>
  53. <result column="pr_orispeccode" property="pr_orispeccode"/>
  54. <result column="pr_whid" property="pr_whid"/>
  55. <result column="pr_whcode" property="pr_whcode"/>
  56. <result column="pr_whname" property="pr_whname"/>
  57. <result column="pr_zxbzs" property="pr_zxbzs"/>
  58. <result column="pr_leadtime" property="pr_leadtime"/>
  59. <result column="pr_brand" property="pr_brand"/>
  60. <result column="pr_standardprice" property="pr_standardprice"/>
  61. <result column="pr_purcprice" property="pr_purcprice"/>
  62. <result column="pr_saleprice" property="pr_saleprice"/>
  63. <result column="pr_vendid" property="pr_vendid"/>
  64. <result column="pr_vendname" property="pr_vendname"/>
  65. <result column="pr_vendcode" property="pr_vendcode"/>
  66. <result column="pr_status" property="pr_status"/>
  67. <result column="pr_statuscode" property="pr_statuscode"/>
  68. <result column="pr_text1" property="pr_text1"/>
  69. <result column="pr_text2" property="pr_text2"/>
  70. <result column="pr_text3" property="pr_text3"/>
  71. <result column="pr_text4" property="pr_text4"/>
  72. </association>
  73. </resultMap>
  74. <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.usoftchina.saas.purchase.po.ProdIODetail">
  75. <result column="pd_remark" jdbcType="LONGVARCHAR" property="pd_remark" />
  76. </resultMap>
  77. <sql id="Base_Column_List">
  78. pd_id, pd_piid, pd_inoutno, pd_piclass, pd_pdno, pd_ordercode, pd_orderdetno, pd_prodid,
  79. pd_prodcode, pd_unit, pd_inqty, pd_outqty, pd_orderprice, pd_sendprice, pd_price,
  80. pd_total, pd_taxrate, pd_netprice, pd_nettotal, pd_whid, pd_whcode, pd_whname, pd_inwhid,
  81. pd_inwhcode, pd_inwhname, pd_orderid, pd_sdid, pd_status, companyid, updaterid, updatetime,
  82. pd_text1, pd_text2, pd_text3, pd_text4, pd_text5, pd_ym, pd_yqty,pd_ioid
  83. </sql>
  84. <sql id="Blob_Column_List">
  85. pd_remark
  86. </sql>
  87. <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="ResultMapWithBLOBs">
  88. select
  89. <include refid="Base_Column_List" />
  90. ,
  91. <include refid="Blob_Column_List" />
  92. from prodiodetail
  93. where pd_id = #{pd_id,jdbcType=INTEGER}
  94. </select>
  95. <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
  96. delete from prodiodetail
  97. where pd_id = #{pd_id,jdbcType=INTEGER}
  98. </delete>
  99. <insert id="insertSelective" parameterType="com.usoftchina.saas.purchase.po.ProdIODetail">
  100. <selectKey resultType="java.lang.Long" keyProperty="id">
  101. SELECT LAST_INSERT_ID() AS ID
  102. </selectKey>
  103. insert into prodiodetail
  104. <trim prefix="(" suffix=")" suffixOverrides=",">
  105. <if test="pd_piid != null">
  106. pd_piid,
  107. </if>
  108. <if test="pd_inoutno != null">
  109. pd_inoutno,
  110. </if>
  111. <if test="pd_piclass != null">
  112. pd_piclass,
  113. </if>
  114. <if test="pd_pdno != null">
  115. pd_pdno,
  116. </if>
  117. <if test="pd_ordercode != null">
  118. pd_ordercode,
  119. </if>
  120. <if test="pd_orderdetno != null">
  121. pd_orderdetno,
  122. </if>
  123. <if test="pd_prodid != null">
  124. pd_prodid,
  125. </if>
  126. <if test="pd_prodcode != null">
  127. pd_prodcode,
  128. </if>
  129. <if test="pd_unit != null">
  130. pd_unit,
  131. </if>
  132. <if test="pd_inqty != null">
  133. pd_inqty,
  134. </if>
  135. <if test="pd_outqty != null">
  136. pd_outqty,
  137. </if>
  138. <if test="pd_orderprice != null">
  139. pd_orderprice,
  140. </if>
  141. <if test="pd_sendprice != null">
  142. pd_sendprice,
  143. </if>
  144. <if test="pd_price != null">
  145. pd_price,
  146. </if>
  147. <if test="pd_total != null">
  148. pd_total,
  149. </if>
  150. <if test="pd_taxrate != null">
  151. pd_taxrate,
  152. </if>
  153. <if test="pd_netprice != null">
  154. pd_netprice,
  155. </if>
  156. <if test="pd_nettotal != null">
  157. pd_nettotal,
  158. </if>
  159. <if test="pd_whid != null">
  160. pd_whid,
  161. </if>
  162. <if test="pd_whcode != null">
  163. pd_whcode,
  164. </if>
  165. <if test="pd_whname != null">
  166. pd_whname,
  167. </if>
  168. <if test="pd_inwhid != null">
  169. pd_inwhid,
  170. </if>
  171. <if test="pd_inwhcode != null">
  172. pd_inwhcode,
  173. </if>
  174. <if test="pd_inwhname != null">
  175. pd_inwhname,
  176. </if>
  177. <if test="pd_orderid != null">
  178. pd_orderid,
  179. </if>
  180. <if test="pd_sdid != null">
  181. pd_sdid,
  182. </if>
  183. <if test="pd_status != null">
  184. pd_status,
  185. </if>
  186. <if test="companyId != null">
  187. companyid,
  188. </if>
  189. <if test="updaterId != null">
  190. updaterid,
  191. </if>
  192. <if test="updateTime != null">
  193. updatetime,
  194. </if>
  195. <if test="pd_text1 != null">
  196. pd_text1,
  197. </if>
  198. <if test="pd_text2 != null">
  199. pd_text2,
  200. </if>
  201. <if test="pd_text3 != null">
  202. pd_text3,
  203. </if>
  204. <if test="pd_text4 != null">
  205. pd_text4,
  206. </if>
  207. <if test="pd_text5 != null">
  208. pd_text5,
  209. </if>
  210. <if test="pd_ym != null">
  211. pd_ym,
  212. </if>
  213. <if test="pd_yqty != null">
  214. pd_yqty,
  215. </if>
  216. <if test="pd_remark != null">
  217. pd_remark,
  218. </if>
  219. <if test="pd_ioid != null">
  220. pd_ioid,
  221. </if>
  222. </trim>
  223. <trim prefix="values (" suffix=")" suffixOverrides=",">
  224. <if test="pd_piid != null">
  225. #{pd_piid,jdbcType=INTEGER},
  226. </if>
  227. <if test="pd_inoutno != null">
  228. #{pd_inoutno,jdbcType=VARCHAR},
  229. </if>
  230. <if test="pd_piclass != null">
  231. #{pd_piclass,jdbcType=VARCHAR},
  232. </if>
  233. <if test="pd_pdno != null">
  234. #{pd_pdno,jdbcType=INTEGER},
  235. </if>
  236. <if test="pd_ordercode != null">
  237. #{pd_ordercode,jdbcType=VARCHAR},
  238. </if>
  239. <if test="pd_orderdetno != null">
  240. #{pd_orderdetno,jdbcType=INTEGER},
  241. </if>
  242. <if test="pd_prodid != null">
  243. #{pd_prodid,jdbcType=INTEGER},
  244. </if>
  245. <if test="pd_prodcode != null">
  246. #{pd_prodcode,jdbcType=VARCHAR},
  247. </if>
  248. <if test="pd_unit != null">
  249. #{pd_unit,jdbcType=VARCHAR},
  250. </if>
  251. <if test="pd_inqty != null">
  252. #{pd_inqty,jdbcType=DOUBLE},
  253. </if>
  254. <if test="pd_outqty != null">
  255. #{pd_outqty,jdbcType=DOUBLE},
  256. </if>
  257. <if test="pd_orderprice != null">
  258. #{pd_orderprice,jdbcType=DOUBLE},
  259. </if>
  260. <if test="pd_sendprice != null">
  261. #{pd_sendprice,jdbcType=DOUBLE},
  262. </if>
  263. <if test="pd_price != null">
  264. #{pd_price,jdbcType=DOUBLE},
  265. </if>
  266. <if test="pd_total != null">
  267. #{pd_total,jdbcType=DOUBLE},
  268. </if>
  269. <if test="pd_taxrate != null">
  270. #{pd_taxrate,jdbcType=DOUBLE},
  271. </if>
  272. <if test="pd_netprice != null">
  273. #{pd_netprice,jdbcType=DOUBLE},
  274. </if>
  275. <if test="pd_nettotal != null">
  276. #{pd_nettotal,jdbcType=DOUBLE},
  277. </if>
  278. <if test="pd_whid != null">
  279. #{pd_whid,jdbcType=INTEGER},
  280. </if>
  281. <if test="pd_whcode != null">
  282. #{pd_whcode,jdbcType=VARCHAR},
  283. </if>
  284. <if test="pd_whname != null">
  285. #{pd_whname,jdbcType=VARCHAR},
  286. </if>
  287. <if test="pd_inwhid != null">
  288. #{pd_inwhid,jdbcType=INTEGER},
  289. </if>
  290. <if test="pd_inwhcode != null">
  291. #{pd_inwhcode,jdbcType=VARCHAR},
  292. </if>
  293. <if test="pd_inwhname != null">
  294. #{pd_inwhname,jdbcType=VARCHAR},
  295. </if>
  296. <if test="pd_orderid != null">
  297. #{pd_orderid,jdbcType=INTEGER},
  298. </if>
  299. <if test="pd_sdid != null">
  300. #{pd_sdid,jdbcType=INTEGER},
  301. </if>
  302. <if test="pd_status != null">
  303. #{pd_status,jdbcType=INTEGER},
  304. </if>
  305. <if test="companyId != null">
  306. #{companyId,jdbcType=INTEGER},
  307. </if>
  308. <if test="updaterId != null">
  309. #{updaterId,jdbcType=INTEGER},
  310. </if>
  311. <if test="updateTime != null">
  312. #{updateTime,jdbcType=TIMESTAMP},
  313. </if>
  314. <if test="pd_text1 != null">
  315. #{pd_text1,jdbcType=VARCHAR},
  316. </if>
  317. <if test="pd_text2 != null">
  318. #{pd_text2,jdbcType=VARCHAR},
  319. </if>
  320. <if test="pd_text3 != null">
  321. #{pd_text3,jdbcType=VARCHAR},
  322. </if>
  323. <if test="pd_text4 != null">
  324. #{pd_text4,jdbcType=VARCHAR},
  325. </if>
  326. <if test="pd_text5 != null">
  327. #{pd_text5,jdbcType=VARCHAR},
  328. </if>
  329. <if test="pd_ym != null">
  330. #{pd_ym,jdbcType=INTEGER},
  331. </if>
  332. <if test="pd_yqty != null">
  333. #{pd_yqty,jdbcType=DOUBLE},
  334. </if>
  335. <if test="pd_remark != null">
  336. #{pd_remark,jdbcType=LONGVARCHAR},
  337. </if>
  338. <if test="pd_ioid != null">
  339. #{pd_ioid,jdbcType=INTEGER},
  340. </if>
  341. </trim>
  342. </insert>
  343. <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.purchase.po.ProdIODetail">
  344. update prodiodetail
  345. <set>
  346. <if test="pd_piid != null">
  347. pd_piid = #{pd_piid,jdbcType=INTEGER},
  348. </if>
  349. <if test="pd_inoutno != null">
  350. pd_inoutno = #{pd_inoutno,jdbcType=VARCHAR},
  351. </if>
  352. <if test="pd_piclass != null">
  353. pd_piclass = #{pd_piclass,jdbcType=VARCHAR},
  354. </if>
  355. <if test="pd_pdno != null">
  356. pd_pdno = #{pd_pdno,jdbcType=INTEGER},
  357. </if>
  358. <if test="pd_ordercode != null">
  359. pd_ordercode = #{pd_ordercode,jdbcType=VARCHAR},
  360. </if>
  361. <if test="pd_orderdetno != null">
  362. pd_orderdetno = #{pd_orderdetno,jdbcType=INTEGER},
  363. </if>
  364. <if test="pd_prodid != null">
  365. pd_prodid = #{pd_prodid,jdbcType=INTEGER},
  366. </if>
  367. <if test="pd_prodcode != null">
  368. pd_prodcode = #{pd_prodcode,jdbcType=VARCHAR},
  369. </if>
  370. <if test="pd_unit != null">
  371. pd_unit = #{pd_unit,jdbcType=VARCHAR},
  372. </if>
  373. <if test="pd_inqty != null">
  374. pd_inqty = #{pd_inqty,jdbcType=DOUBLE},
  375. </if>
  376. <if test="pd_outqty != null">
  377. pd_outqty = #{pd_outqty,jdbcType=DOUBLE},
  378. </if>
  379. <if test="pd_orderprice != null">
  380. pd_orderprice = #{pd_orderprice,jdbcType=DOUBLE},
  381. </if>
  382. <if test="pd_sendprice != null">
  383. pd_sendprice = #{pd_sendprice,jdbcType=DOUBLE},
  384. </if>
  385. <if test="pd_price != null">
  386. pd_price = #{pd_price,jdbcType=DOUBLE},
  387. </if>
  388. <if test="pd_total != null">
  389. pd_total = #{pd_total,jdbcType=DOUBLE},
  390. </if>
  391. <if test="pd_taxrate != null">
  392. pd_taxrate = #{pd_taxrate,jdbcType=DOUBLE},
  393. </if>
  394. <if test="pd_netprice != null">
  395. pd_netprice = #{pd_netprice,jdbcType=DOUBLE},
  396. </if>
  397. <if test="pd_nettotal != null">
  398. pd_nettotal = #{pd_nettotal,jdbcType=DOUBLE},
  399. </if>
  400. <if test="pd_whid != null">
  401. pd_whid = #{pd_whid,jdbcType=INTEGER},
  402. </if>
  403. <if test="pd_whcode != null">
  404. pd_whcode = #{pd_whcode,jdbcType=VARCHAR},
  405. </if>
  406. <if test="pd_whname != null">
  407. pd_whname = #{pd_whname,jdbcType=VARCHAR},
  408. </if>
  409. <if test="pd_inwhid != null">
  410. pd_inwhid = #{pd_inwhid,jdbcType=INTEGER},
  411. </if>
  412. <if test="pd_inwhcode != null">
  413. pd_inwhcode = #{pd_inwhcode,jdbcType=VARCHAR},
  414. </if>
  415. <if test="pd_inwhname != null">
  416. pd_inwhname = #{pd_inwhname,jdbcType=VARCHAR},
  417. </if>
  418. <if test="pd_orderid != null">
  419. pd_orderid = #{pd_orderid,jdbcType=INTEGER},
  420. </if>
  421. <if test="pd_sdid != null">
  422. pd_sdid = #{pd_sdid,jdbcType=INTEGER},
  423. </if>
  424. <if test="pd_status != null">
  425. pd_status = #{pd_status,jdbcType=INTEGER},
  426. </if>
  427. <if test="companyId != null">
  428. companyid = #{companyId,jdbcType=INTEGER},
  429. </if>
  430. <if test="updaterId != null">
  431. updaterid = #{updaterId,jdbcType=INTEGER},
  432. </if>
  433. <if test="updateTime != null">
  434. updatetime = #{updateTime,jdbcType=TIMESTAMP},
  435. </if>
  436. <if test="pd_text1 != null">
  437. pd_text1 = #{pd_text1,jdbcType=VARCHAR},
  438. </if>
  439. <if test="pd_text2 != null">
  440. pd_text2 = #{pd_text2,jdbcType=VARCHAR},
  441. </if>
  442. <if test="pd_text3 != null">
  443. pd_text3 = #{pd_text3,jdbcType=VARCHAR},
  444. </if>
  445. <if test="pd_text4 != null">
  446. pd_text4 = #{pd_text4,jdbcType=VARCHAR},
  447. </if>
  448. <if test="pd_text5 != null">
  449. pd_text5 = #{pd_text5,jdbcType=VARCHAR},
  450. </if>
  451. <if test="pd_ym != null">
  452. pd_ym = #{pd_ym,jdbcType=INTEGER},
  453. </if>
  454. <if test="pd_yqty != null">
  455. pd_yqty = #{pd_yqty,jdbcType=DOUBLE},
  456. </if>
  457. <if test="pd_remark != null">
  458. pd_remark = #{pd_remark,jdbcType=LONGVARCHAR},
  459. </if>
  460. <if test="pd_ioid != null">
  461. pd_ioid = #{pd_ioid,jdbcType=LONGVARCHAR},
  462. </if>
  463. </set>
  464. where pd_id = #{id,jdbcType=INTEGER}
  465. </update>
  466. <insert id="batchInsert" parameterType="java.util.List" >
  467. insert into prodiodetail (pd_piid, pd_inoutno,
  468. pd_piclass, pd_pdno, pd_ordercode,
  469. pd_orderdetno, pd_prodid, pd_prodcode,
  470. pd_unit, pd_inqty, pd_outqty,
  471. pd_orderprice, pd_sendprice, pd_price,
  472. pd_total, pd_taxrate, pd_netprice,
  473. pd_nettotal, pd_whid, pd_whcode,
  474. pd_whname, pd_inwhid, pd_inwhcode,
  475. pd_inwhname, pd_orderid, pd_sdid,
  476. pd_status, companyid, updaterid,
  477. updatetime, pd_text1, pd_text2,
  478. pd_text3, pd_text4, pd_text5,
  479. pd_ym, pd_yqty, pd_ioid,
  480. pd_remark) VALUES
  481. <foreach collection="list" item="item" index="index" open="" close="" separator=",">
  482. (
  483. #{item.pd_piid,jdbcType=INTEGER},
  484. #{item.pd_inoutno,jdbcType=VARCHAR},
  485. #{item.pd_piclass,jdbcType=VARCHAR},
  486. #{item.pd_pdno,jdbcType=INTEGER},
  487. #{item.pd_ordercode,jdbcType=VARCHAR},
  488. #{item.pd_orderdetno,jdbcType=INTEGER},
  489. #{item.pd_prodid,jdbcType=INTEGER},
  490. #{item.pd_prodcode,jdbcType=VARCHAR},
  491. #{item.pd_unit,jdbcType=VARCHAR},
  492. #{item.pd_inqty,jdbcType=DOUBLE},
  493. #{item.pd_outqty,jdbcType=DOUBLE},
  494. #{item.pd_orderprice,jdbcType=DOUBLE},
  495. #{item.pd_sendprice,jdbcType=DOUBLE},
  496. #{item.pd_price,jdbcType=DOUBLE},
  497. #{item.pd_total,jdbcType=DOUBLE},
  498. #{item.pd_taxrate,jdbcType=DOUBLE},
  499. #{item.pd_netprice,jdbcType=DOUBLE},
  500. #{item.pd_nettotal,jdbcType=DOUBLE},
  501. #{item.pd_whid,jdbcType=INTEGER},
  502. #{item.pd_whcode,jdbcType=VARCHAR},
  503. #{item.pd_whname,jdbcType=VARCHAR},
  504. #{item.pd_inwhid,jdbcType=INTEGER},
  505. #{item.pd_inwhcode,jdbcType=VARCHAR},
  506. #{item.pd_inwhname,jdbcType=VARCHAR},
  507. #{item.pd_orderid,jdbcType=INTEGER},
  508. #{item.pd_sdid,jdbcType=INTEGER},
  509. #{item.pd_status,jdbcType=INTEGER},
  510. #{item.companyId,jdbcType=INTEGER},
  511. #{item.updaterId,jdbcType=INTEGER},
  512. #{item.updateTime,jdbcType=TIMESTAMP},
  513. #{item.pd_text1,jdbcType=VARCHAR},
  514. #{item.pd_text2,jdbcType=VARCHAR},
  515. #{item.pd_text3,jdbcType=VARCHAR},
  516. #{item.pd_text4,jdbcType=VARCHAR},
  517. #{item.pd_text5,jdbcType=VARCHAR},
  518. #{item.pd_ym,jdbcType=INTEGER},
  519. #{item.pd_yqty,jdbcType=DOUBLE},
  520. #{item.pd_ioid,jdbcType=INTEGER},
  521. #{item.pd_remark,jdbcType=LONGVARCHAR}
  522. )
  523. </foreach>
  524. </insert>
  525. <update id="batchUpdate" parameterType="com.usoftchina.saas.purchase.po.ProdIODetail" >
  526. <foreach collection="list" item="item" index="index" open="" close="" separator=";">
  527. update prodiodetail <set>
  528. <if test="item.pd_piid !=null">
  529. pd_piid = #{item.pd_piid},
  530. </if>
  531. <if test="item.pd_inoutno !=null">
  532. pd_inoutno = #{item.pd_inoutno},
  533. </if>
  534. <if test="item.pd_piclass !=null">
  535. pd_piclass = #{item.pd_piclass},
  536. </if>
  537. <if test="item.pd_pdno !=null">
  538. pd_pdno = #{item.pd_pdno},
  539. </if>
  540. <if test="item.pd_ordercode !=null">
  541. pd_ordercode = #{item.pd_ordercode},
  542. </if>
  543. <if test="item.pd_orderdetno !=null">
  544. pd_orderdetno = #{item.pd_orderdetno},
  545. </if>
  546. <if test="item.pd_prodid !=null">
  547. pd_prodid = #{item.pd_prodid},
  548. </if>
  549. <if test="item.pd_prodcode !=null">
  550. pd_prodcode = #{item.pd_prodcode},
  551. </if>
  552. <if test="item.pd_unit !=null">
  553. pd_unit = #{item.pd_unit},
  554. </if>
  555. <if test="item.pd_inqty !=null">
  556. pd_inqty = #{item.pd_inqty},
  557. </if>
  558. <if test="item.pd_outqty !=null">
  559. pd_outqty = #{item.pd_outqty},
  560. </if>
  561. <if test="item.pd_orderprice !=null">
  562. pd_orderprice = #{item.pd_orderprice},
  563. </if>
  564. <if test="item.pd_sendprice !=null">
  565. pd_sendprice = #{item.pd_sendprice},
  566. </if>
  567. <if test="item.pd_price !=null">
  568. pd_price = #{item.pd_price},
  569. </if>
  570. <if test="item.pd_total !=null">
  571. pd_total = #{item.pd_total},
  572. </if>
  573. <if test="item.pd_taxrate !=null">
  574. pd_taxrate = #{item.pd_taxrate},
  575. </if>
  576. <if test="item.pd_netprice !=null">
  577. pd_netprice = #{item.pd_netprice},
  578. </if>
  579. <if test="item.pd_nettotal !=null">
  580. pd_nettotal = #{item.pd_nettotal},
  581. </if>
  582. <if test="item.pd_whid !=null">
  583. pd_whid = #{item.pd_whid},
  584. </if>
  585. <if test="item.pd_whcode !=null">
  586. pd_whcode = #{item.pd_whcode},
  587. </if>
  588. <if test="item.pd_whname !=null">
  589. pd_whname = #{item.pd_whname},
  590. </if>
  591. <if test="item.pd_inwhid !=null">
  592. pd_inwhid = #{item.pd_inwhid},
  593. </if>
  594. <if test="item.pd_inwhcode !=null">
  595. pd_inwhcode = #{item.pd_inwhcode},
  596. </if>
  597. <if test="item.pd_inwhname !=null">
  598. pd_inwhname = #{item.pd_inwhname},
  599. </if>
  600. <if test="item.pd_orderid !=null">
  601. pd_orderid = #{item.pd_orderid},
  602. </if>
  603. <if test="item.pd_sdid !=null">
  604. pd_sdid = #{item.pd_sdid},
  605. </if>
  606. <if test="item.pd_status !=null">
  607. pd_status = #{item.pd_status},
  608. </if>
  609. <if test="item.pd_remark !=null">
  610. pd_remark = #{item.pd_remark},
  611. </if>
  612. <if test="item.companyId!=null">
  613. companyId = #{item.companyId},
  614. </if>
  615. <if test="item.updaterId!=null">
  616. updaterId = #{item.updaterId},
  617. </if>
  618. <if test="item.updateTime!=null">
  619. updateTime = #{item.updateTime},
  620. </if>
  621. pd_text1 = #{item.pd_text1},
  622. pd_text2 = #{item.pd_text2},
  623. pd_text3 = #{item.pd_text3},
  624. pd_text4 = #{item.pd_text4},
  625. pd_text5 = #{item.pd_text5},
  626. <if test="item.pd_ym!=null">
  627. pd_ym = #{item.pd_ym},
  628. </if>
  629. <if test="item.pd_yqty!=null">
  630. pd_yqty = #{item.pd_yqty},
  631. </if>
  632. </set>
  633. where PD_ID = #{item.id,jdbcType=INTEGER}
  634. </foreach>
  635. </update>
  636. <update id="updatePurchaseYqty" parameterType="long">
  637. update prodiodetail a
  638. set a.pd_yqty =ifnull((select b.pd_outqty from (select pd_ioid,sum(pd_outqty) pd_outqty from prodiodetail left join prodinout on pd_piid = pi_id where pd_piclass='采购验退单'
  639. and pi_ioid=#{id,jdbcType=INTEGER} GROUP BY pd_ioid) b where ifnull(b.pd_ioid ,0)= a.pd_id ),0)
  640. where a.pd_piid = #{id,jdbcType=INTEGER}
  641. </update>
  642. <select id="selectByFK" parameterType="long" resultMap="BaseResultMap">
  643. select * from prodiodetail a left join product b on b.pr_id= a.pd_prodid and a.companyid = b.companyid
  644. where pd_piid=#{id} order by pd_pdno
  645. </select>
  646. <delete id="deleteByFK" parameterType="java.lang.Long">
  647. delete from prodiodetail
  648. where pd_piid = #{id,jdbcType=INTEGER}
  649. </delete>
  650. <update id="calcProdIn">
  651. update prodiodetail set pd_netprice = ifnull(pd_orderprice,0)/(1+ifnull(pd_taxrate,0)/100) where pd_piid = #{pi_id,jdbcType=INTEGER};
  652. update prodiodetail set pd_ordertotal = round(ifnull(pd_orderprice,0)*ifnull(pd_inqty,0),2),pd_nettotal = round(pd_netprice*ifnull(pd_inqty,0),2) where pd_piid = #{pi_id,jdbcType=INTEGER};
  653. update prodinout set pi_total = round((select sum(pd_ordertotal) from prodiodetail where pd_piid = #{pi_id,jdbcType=INTEGER} ),2) where pi_id = #{pi_id,jdbcType=INTEGER};
  654. update prodinout set pi_nettotal = round((select sum(pd_nettotal) from prodiodetail where pd_piid = #{pi_id,jdbcType=INTEGER} ),2) where pi_id = #{pi_id,jdbcType=INTEGER};
  655. </update>
  656. <update id="calcProdOut">
  657. update prodiodetail set pd_netprice = ifnull(pd_orderprice,0)/(1+ifnull(pd_taxrate,0)/100) where pd_piid = #{pi_id,jdbcType=INTEGER};
  658. update prodiodetail set pd_ordertotal = round(ifnull(pd_orderprice,0)*ifnull(pd_outqty,0),2),pd_nettotal = round(pd_netprice*ifnull(pd_outqty,0),2) where pd_piid = #{pi_id,jdbcType=INTEGER};
  659. update prodinout set pi_total = round((select sum(pd_ordertotal) from prodiodetail where pd_piid = #{pi_id,jdbcType=INTEGER} ),2) where pi_id = #{pi_id,jdbcType=INTEGER};
  660. update prodinout set pi_nettotal = round((select sum(pd_nettotal) from prodiodetail where pd_piid = #{pi_id,jdbcType=INTEGER} ),2) where pi_id = #{pi_id,jdbcType=INTEGER};
  661. </update>
  662. <update id="getDefaultWarehouseByProduct">
  663. update prodiodetail
  664. set pd_whid=(select pr_whid from product where pd_prodid = pr_id),
  665. pd_whcode=(select pr_whcode from product where pd_prodid = pr_id),
  666. pd_whname=(select pr_whname from product where pd_prodid = pr_id)
  667. where pd_piid = #{pi_id,jdbcType=INTEGER};
  668. </update>
  669. </mapper>