ProdIODetailMapper.xml 30 KB

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