DepotItemMapper.xml 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675
  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.jsh.erp.datasource.mappers.DepotItemMapper">
  4. <resultMap id="BaseResultMap" type="com.jsh.erp.datasource.entities.DepotItem">
  5. <id column="id" jdbcType="BIGINT" property="id" />
  6. <result column="header_id" jdbcType="BIGINT" property="headerId" />
  7. <result column="material_id" jdbcType="BIGINT" property="materialId" />
  8. <result column="material_extend_id" jdbcType="BIGINT" property="materialExtendId" />
  9. <result column="material_unit" jdbcType="VARCHAR" property="materialUnit" />
  10. <result column="sku" jdbcType="VARCHAR" property="sku" />
  11. <result column="oper_number" jdbcType="DECIMAL" property="operNumber" />
  12. <result column="basic_number" jdbcType="DECIMAL" property="basicNumber" />
  13. <result column="unit_price" jdbcType="DECIMAL" property="unitPrice" />
  14. <result column="purchase_unit_price" jdbcType="DECIMAL" property="purchaseUnitPrice" />
  15. <result column="tax_unit_price" jdbcType="DECIMAL" property="taxUnitPrice" />
  16. <result column="all_price" jdbcType="DECIMAL" property="allPrice" />
  17. <result column="remark" jdbcType="VARCHAR" property="remark" />
  18. <result column="depot_id" jdbcType="BIGINT" property="depotId" />
  19. <result column="another_depot_id" jdbcType="BIGINT" property="anotherDepotId" />
  20. <result column="tax_rate" jdbcType="DECIMAL" property="taxRate" />
  21. <result column="tax_money" jdbcType="DECIMAL" property="taxMoney" />
  22. <result column="tax_last_money" jdbcType="DECIMAL" property="taxLastMoney" />
  23. <result column="material_type" jdbcType="VARCHAR" property="materialType" />
  24. <result column="sn_list" jdbcType="VARCHAR" property="snList" />
  25. <result column="batch_number" jdbcType="VARCHAR" property="batchNumber" />
  26. <result column="expiration_date" jdbcType="TIMESTAMP" property="expirationDate" />
  27. <result column="link_id" jdbcType="BIGINT" property="linkId" />
  28. <result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
  29. <result column="delete_flag" jdbcType="VARCHAR" property="deleteFlag" />
  30. <result column="actual_quantity_in_storage" jdbcType="DECIMAL" property="actualQuantityInStorage" />
  31. <result column="warehousing_variance" jdbcType="DECIMAL" property="warehousingVariance" />
  32. <result column="reason_of_difference" jdbcType="VARCHAR" property="reasonOfDifference" />
  33. <result column="warehousing_user" jdbcType="VARCHAR" property="warehousingUser" />
  34. <result column="warehousing_time" jdbcType="DATE" property="warehousingTime" />
  35. </resultMap>
  36. <sql id="Example_Where_Clause">
  37. <where>
  38. <foreach collection="oredCriteria" item="criteria" separator="or">
  39. <if test="criteria.valid">
  40. <trim prefix="(" prefixOverrides="and" suffix=")">
  41. <foreach collection="criteria.criteria" item="criterion">
  42. <choose>
  43. <when test="criterion.noValue">
  44. and ${criterion.condition}
  45. </when>
  46. <when test="criterion.singleValue">
  47. and ${criterion.condition} #{criterion.value}
  48. </when>
  49. <when test="criterion.betweenValue">
  50. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  51. </when>
  52. <when test="criterion.listValue">
  53. and ${criterion.condition}
  54. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  55. #{listItem}
  56. </foreach>
  57. </when>
  58. </choose>
  59. </foreach>
  60. </trim>
  61. </if>
  62. </foreach>
  63. </where>
  64. </sql>
  65. <sql id="Update_By_Example_Where_Clause">
  66. <where>
  67. <foreach collection="example.oredCriteria" item="criteria" separator="or">
  68. <if test="criteria.valid">
  69. <trim prefix="(" prefixOverrides="and" suffix=")">
  70. <foreach collection="criteria.criteria" item="criterion">
  71. <choose>
  72. <when test="criterion.noValue">
  73. and ${criterion.condition}
  74. </when>
  75. <when test="criterion.singleValue">
  76. and ${criterion.condition} #{criterion.value}
  77. </when>
  78. <when test="criterion.betweenValue">
  79. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  80. </when>
  81. <when test="criterion.listValue">
  82. and ${criterion.condition}
  83. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  84. #{listItem}
  85. </foreach>
  86. </when>
  87. </choose>
  88. </foreach>
  89. </trim>
  90. </if>
  91. </foreach>
  92. </where>
  93. </sql>
  94. <sql id="Base_Column_List">
  95. id, header_id, material_id, material_extend_id, material_unit, sku, oper_number,
  96. basic_number, unit_price, purchase_unit_price, tax_unit_price, all_price, remark,
  97. depot_id, another_depot_id, tax_rate, tax_money, tax_last_money, material_type, sn_list,
  98. batch_number, expiration_date, link_id, tenant_id, delete_flag
  99. </sql>
  100. <select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="BaseResultMap">
  101. select
  102. <if test="distinct">
  103. distinct
  104. </if>
  105. <include refid="Base_Column_List" />
  106. from jsh_depot_item
  107. <if test="_parameter != null">
  108. <include refid="Example_Where_Clause" />
  109. </if>
  110. <if test="orderByClause != null">
  111. order by ${orderByClause}
  112. </if>
  113. </select>
  114. <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
  115. select
  116. <include refid="Base_Column_List" />
  117. from jsh_depot_item
  118. where id = #{id,jdbcType=BIGINT}
  119. </select>
  120. <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
  121. delete from jsh_depot_item
  122. where id = #{id,jdbcType=BIGINT}
  123. </delete>
  124. <delete id="deleteByExample" parameterType="com.jsh.erp.datasource.entities.DepotItemExample">
  125. delete from jsh_depot_item
  126. <if test="_parameter != null">
  127. <include refid="Example_Where_Clause" />
  128. </if>
  129. </delete>
  130. <insert id="insert" parameterType="com.jsh.erp.datasource.entities.DepotItem">
  131. insert into jsh_depot_item (id, header_id, material_id,
  132. material_extend_id, material_unit, sku,
  133. oper_number, basic_number, unit_price,
  134. purchase_unit_price, tax_unit_price, all_price,
  135. remark, depot_id, another_depot_id,
  136. tax_rate, tax_money, tax_last_money,
  137. material_type, sn_list, batch_number,
  138. expiration_date, link_id, tenant_id,
  139. delete_flag)
  140. values (#{id,jdbcType=BIGINT}, #{headerId,jdbcType=BIGINT}, #{materialId,jdbcType=BIGINT},
  141. #{materialExtendId,jdbcType=BIGINT}, #{materialUnit,jdbcType=VARCHAR}, #{sku,jdbcType=VARCHAR},
  142. #{operNumber,jdbcType=DECIMAL}, #{basicNumber,jdbcType=DECIMAL}, #{unitPrice,jdbcType=DECIMAL},
  143. #{purchaseUnitPrice,jdbcType=DECIMAL}, #{taxUnitPrice,jdbcType=DECIMAL}, #{allPrice,jdbcType=DECIMAL},
  144. #{remark,jdbcType=VARCHAR}, #{depotId,jdbcType=BIGINT}, #{anotherDepotId,jdbcType=BIGINT},
  145. #{taxRate,jdbcType=DECIMAL}, #{taxMoney,jdbcType=DECIMAL}, #{taxLastMoney,jdbcType=DECIMAL},
  146. #{materialType,jdbcType=VARCHAR}, #{snList,jdbcType=VARCHAR}, #{batchNumber,jdbcType=VARCHAR},
  147. #{expirationDate,jdbcType=TIMESTAMP}, #{linkId,jdbcType=BIGINT}, #{tenantId,jdbcType=BIGINT},
  148. #{deleteFlag,jdbcType=VARCHAR})
  149. </insert>
  150. <insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.DepotItem" useGeneratedKeys="true" keyProperty="id">
  151. insert into jsh_depot_item
  152. <trim prefix="(" suffix=")" suffixOverrides=",">
  153. <if test="id != null">
  154. id,
  155. </if>
  156. <if test="headerId != null">
  157. header_id,
  158. </if>
  159. <if test="materialId != null">
  160. material_id,
  161. </if>
  162. <if test="materialExtendId != null">
  163. material_extend_id,
  164. </if>
  165. <if test="materialUnit != null">
  166. material_unit,
  167. </if>
  168. <if test="sku != null">
  169. sku,
  170. </if>
  171. <if test="operNumber != null">
  172. oper_number,
  173. </if>
  174. <if test="basicNumber != null">
  175. basic_number,
  176. </if>
  177. <if test="unitPrice != null">
  178. unit_price,
  179. </if>
  180. <if test="purchaseUnitPrice != null">
  181. purchase_unit_price,
  182. </if>
  183. <if test="taxUnitPrice != null">
  184. tax_unit_price,
  185. </if>
  186. <if test="allPrice != null">
  187. all_price,
  188. </if>
  189. <if test="remark != null">
  190. remark,
  191. </if>
  192. <if test="depotId != null">
  193. depot_id,
  194. </if>
  195. <if test="anotherDepotId != null">
  196. another_depot_id,
  197. </if>
  198. <if test="taxRate != null">
  199. tax_rate,
  200. </if>
  201. <if test="taxMoney != null">
  202. tax_money,
  203. </if>
  204. <if test="taxLastMoney != null">
  205. tax_last_money,
  206. </if>
  207. <if test="materialType != null">
  208. material_type,
  209. </if>
  210. <if test="snList != null">
  211. sn_list,
  212. </if>
  213. <if test="batchNumber != null">
  214. batch_number,
  215. </if>
  216. <if test="expirationDate != null">
  217. expiration_date,
  218. </if>
  219. <if test="linkId != null">
  220. link_id,
  221. </if>
  222. <if test="tenantId != null">
  223. tenant_id,
  224. </if>
  225. <if test="deleteFlag != null">
  226. delete_flag,
  227. </if>
  228. <if test="actualQuantityInStorage != null">
  229. actual_quantity_in_storage,
  230. </if>
  231. <if test="warehousingVariance != null">
  232. warehousing_variance,
  233. </if>
  234. <if test="reasonOfDifference != null">
  235. reason_of_difference,
  236. </if>
  237. <if test="warehousingUser != null">
  238. warehousing_user,
  239. </if>
  240. <if test="warehousingTime != null and warehousingTime != ''">
  241. warehousing_time,
  242. </if>
  243. <if test="createTime != null">
  244. create_time,
  245. </if>
  246. <if test="productionDate != null">
  247. production_date,
  248. </if>
  249. <if test="expiryNum != null">
  250. expiry_num,
  251. </if>
  252. <if test="position != null">
  253. position,
  254. </if>
  255. <if test="wholesaleDecimal != null">
  256. wholesale_decimal,
  257. </if>
  258. </trim>
  259. <trim prefix="values (" suffix=")" suffixOverrides=",">
  260. <if test="id != null">
  261. #{id,jdbcType=BIGINT},
  262. </if>
  263. <if test="headerId != null">
  264. #{headerId,jdbcType=BIGINT},
  265. </if>
  266. <if test="materialId != null">
  267. #{materialId,jdbcType=BIGINT},
  268. </if>
  269. <if test="materialExtendId != null">
  270. #{materialExtendId,jdbcType=BIGINT},
  271. </if>
  272. <if test="materialUnit != null">
  273. #{materialUnit,jdbcType=VARCHAR},
  274. </if>
  275. <if test="sku != null">
  276. #{sku,jdbcType=VARCHAR},
  277. </if>
  278. <if test="operNumber != null">
  279. #{operNumber,jdbcType=DECIMAL},
  280. </if>
  281. <if test="basicNumber != null">
  282. #{basicNumber,jdbcType=DECIMAL},
  283. </if>
  284. <if test="unitPrice != null">
  285. #{unitPrice,jdbcType=DECIMAL},
  286. </if>
  287. <if test="purchaseUnitPrice != null">
  288. #{purchaseUnitPrice,jdbcType=DECIMAL},
  289. </if>
  290. <if test="taxUnitPrice != null">
  291. #{taxUnitPrice,jdbcType=DECIMAL},
  292. </if>
  293. <if test="allPrice != null">
  294. #{allPrice,jdbcType=DECIMAL},
  295. </if>
  296. <if test="remark != null">
  297. #{remark,jdbcType=VARCHAR},
  298. </if>
  299. <if test="depotId != null">
  300. #{depotId,jdbcType=BIGINT},
  301. </if>
  302. <if test="anotherDepotId != null">
  303. #{anotherDepotId,jdbcType=BIGINT},
  304. </if>
  305. <if test="taxRate != null">
  306. #{taxRate,jdbcType=DECIMAL},
  307. </if>
  308. <if test="taxMoney != null">
  309. #{taxMoney,jdbcType=DECIMAL},
  310. </if>
  311. <if test="taxLastMoney != null">
  312. #{taxLastMoney,jdbcType=DECIMAL},
  313. </if>
  314. <if test="materialType != null">
  315. #{materialType,jdbcType=VARCHAR},
  316. </if>
  317. <if test="snList != null">
  318. #{snList,jdbcType=VARCHAR},
  319. </if>
  320. <if test="batchNumber != null">
  321. #{batchNumber,jdbcType=VARCHAR},
  322. </if>
  323. <if test="expirationDate != null">
  324. #{expirationDate,jdbcType=TIMESTAMP},
  325. </if>
  326. <if test="linkId != null">
  327. #{linkId,jdbcType=BIGINT},
  328. </if>
  329. <if test="tenantId != null">
  330. #{tenantId,jdbcType=BIGINT},
  331. </if>
  332. <if test="deleteFlag != null">
  333. #{deleteFlag,jdbcType=VARCHAR},
  334. </if>
  335. <if test="actualQuantityInStorage != null">
  336. #{actualQuantityInStorage,jdbcType=DECIMAL},
  337. </if>
  338. <if test="warehousingVariance != null">
  339. #{warehousingVariance,jdbcType=DECIMAL},
  340. </if>
  341. <if test="reasonOfDifference != null">
  342. #{reasonOfDifference,jdbcType=VARCHAR},
  343. </if>
  344. <if test="warehousingUser != null">
  345. #{warehousingUser,jdbcType=BIGINT},
  346. </if>
  347. <if test="warehousingTime != null and warehousingTime != ''">
  348. #{warehousingTime,jdbcType=DATE},
  349. </if>
  350. <if test="createTime != null">
  351. #{createTime,jdbcType=DATE},
  352. </if>
  353. <if test="productionDate != null">
  354. #{productionDate,jdbcType=TIMESTAMP},
  355. </if>
  356. <if test="expiryNum != null">
  357. #{expiryNum,jdbcType=INTEGER},
  358. </if>
  359. <if test="position != null">
  360. #{position,jdbcType=VARCHAR},
  361. </if>
  362. <if test="wholesaleDecimal != null">
  363. #{wholesaleDecimal,jdbcType=DECIMAL},
  364. </if>
  365. </trim>
  366. </insert>
  367. <select id="countByExample" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultType="java.lang.Long">
  368. select count(*) from jsh_depot_item
  369. <if test="_parameter != null">
  370. <include refid="Example_Where_Clause" />
  371. </if>
  372. </select>
  373. <update id="updateByExampleSelective" parameterType="map">
  374. update jsh_depot_item
  375. <set>
  376. <if test="record.id != null">
  377. id = #{record.id,jdbcType=BIGINT},
  378. </if>
  379. <if test="record.headerId != null">
  380. header_id = #{record.headerId,jdbcType=BIGINT},
  381. </if>
  382. <if test="record.materialId != null">
  383. material_id = #{record.materialId,jdbcType=BIGINT},
  384. </if>
  385. <if test="record.materialExtendId != null">
  386. material_extend_id = #{record.materialExtendId,jdbcType=BIGINT},
  387. </if>
  388. <if test="record.materialUnit != null">
  389. material_unit = #{record.materialUnit,jdbcType=VARCHAR},
  390. </if>
  391. <if test="record.sku != null">
  392. sku = #{record.sku,jdbcType=VARCHAR},
  393. </if>
  394. <if test="record.operNumber != null">
  395. oper_number = #{record.operNumber,jdbcType=DECIMAL},
  396. </if>
  397. <if test="record.basicNumber != null">
  398. basic_number = #{record.basicNumber,jdbcType=DECIMAL},
  399. </if>
  400. <if test="record.unitPrice != null">
  401. unit_price = #{record.unitPrice,jdbcType=DECIMAL},
  402. </if>
  403. <if test="record.purchaseUnitPrice != null">
  404. purchase_unit_price = #{record.purchaseUnitPrice,jdbcType=DECIMAL},
  405. </if>
  406. <if test="record.taxUnitPrice != null">
  407. tax_unit_price = #{record.taxUnitPrice,jdbcType=DECIMAL},
  408. </if>
  409. <if test="record.allPrice != null">
  410. all_price = #{record.allPrice,jdbcType=DECIMAL},
  411. </if>
  412. <if test="record.remark != null">
  413. remark = #{record.remark,jdbcType=VARCHAR},
  414. </if>
  415. <if test="record.depotId != null">
  416. depot_id = #{record.depotId,jdbcType=BIGINT},
  417. </if>
  418. <if test="record.anotherDepotId != null">
  419. another_depot_id = #{record.anotherDepotId,jdbcType=BIGINT},
  420. </if>
  421. <if test="record.taxRate != null">
  422. tax_rate = #{record.taxRate,jdbcType=DECIMAL},
  423. </if>
  424. <if test="record.taxMoney != null">
  425. tax_money = #{record.taxMoney,jdbcType=DECIMAL},
  426. </if>
  427. <if test="record.taxLastMoney != null">
  428. tax_last_money = #{record.taxLastMoney,jdbcType=DECIMAL},
  429. </if>
  430. <if test="record.materialType != null">
  431. material_type = #{record.materialType,jdbcType=VARCHAR},
  432. </if>
  433. <if test="record.snList != null">
  434. sn_list = #{record.snList,jdbcType=VARCHAR},
  435. </if>
  436. <if test="record.batchNumber != null">
  437. batch_number = #{record.batchNumber,jdbcType=VARCHAR},
  438. </if>
  439. <if test="record.expirationDate != null">
  440. expiration_date = #{record.expirationDate,jdbcType=TIMESTAMP},
  441. </if>
  442. <if test="record.linkId != null">
  443. link_id = #{record.linkId,jdbcType=BIGINT},
  444. </if>
  445. <if test="record.tenantId != null">
  446. tenant_id = #{record.tenantId,jdbcType=BIGINT},
  447. </if>
  448. <if test="record.deleteFlag != null">
  449. delete_flag = #{record.deleteFlag,jdbcType=VARCHAR},
  450. </if>
  451. </set>
  452. <if test="_parameter != null">
  453. <include refid="Update_By_Example_Where_Clause" />
  454. </if>
  455. </update>
  456. <update id="updateByExample" parameterType="map">
  457. update jsh_depot_item
  458. set id = #{record.id,jdbcType=BIGINT},
  459. header_id = #{record.headerId,jdbcType=BIGINT},
  460. material_id = #{record.materialId,jdbcType=BIGINT},
  461. material_extend_id = #{record.materialExtendId,jdbcType=BIGINT},
  462. material_unit = #{record.materialUnit,jdbcType=VARCHAR},
  463. sku = #{record.sku,jdbcType=VARCHAR},
  464. oper_number = #{record.operNumber,jdbcType=DECIMAL},
  465. basic_number = #{record.basicNumber,jdbcType=DECIMAL},
  466. unit_price = #{record.unitPrice,jdbcType=DECIMAL},
  467. purchase_unit_price = #{record.purchaseUnitPrice,jdbcType=DECIMAL},
  468. tax_unit_price = #{record.taxUnitPrice,jdbcType=DECIMAL},
  469. all_price = #{record.allPrice,jdbcType=DECIMAL},
  470. remark = #{record.remark,jdbcType=VARCHAR},
  471. depot_id = #{record.depotId,jdbcType=BIGINT},
  472. another_depot_id = #{record.anotherDepotId,jdbcType=BIGINT},
  473. tax_rate = #{record.taxRate,jdbcType=DECIMAL},
  474. tax_money = #{record.taxMoney,jdbcType=DECIMAL},
  475. tax_last_money = #{record.taxLastMoney,jdbcType=DECIMAL},
  476. material_type = #{record.materialType,jdbcType=VARCHAR},
  477. sn_list = #{record.snList,jdbcType=VARCHAR},
  478. batch_number = #{record.batchNumber,jdbcType=VARCHAR},
  479. expiration_date = #{record.expirationDate,jdbcType=TIMESTAMP},
  480. link_id = #{record.linkId,jdbcType=BIGINT},
  481. tenant_id = #{record.tenantId,jdbcType=BIGINT},
  482. delete_flag = #{record.deleteFlag,jdbcType=VARCHAR}
  483. <if test="_parameter != null">
  484. <include refid="Update_By_Example_Where_Clause" />
  485. </if>
  486. </update>
  487. <update id="updateByPrimaryKeySelective" parameterType="com.jsh.erp.datasource.entities.DepotItem">
  488. update jsh_depot_item
  489. <set>
  490. <if test="headerId != null">
  491. header_id = #{headerId,jdbcType=BIGINT},
  492. </if>
  493. <if test="materialId != null">
  494. material_id = #{materialId,jdbcType=BIGINT},
  495. </if>
  496. <if test="materialExtendId != null">
  497. material_extend_id = #{materialExtendId,jdbcType=BIGINT},
  498. </if>
  499. <if test="materialUnit != null">
  500. material_unit = #{materialUnit,jdbcType=VARCHAR},
  501. </if>
  502. <if test="sku != null">
  503. sku = #{sku,jdbcType=VARCHAR},
  504. </if>
  505. <if test="operNumber != null">
  506. oper_number = #{operNumber,jdbcType=DECIMAL},
  507. </if>
  508. <if test="basicNumber != null">
  509. basic_number = #{basicNumber,jdbcType=DECIMAL},
  510. </if>
  511. <if test="unitPrice != null">
  512. unit_price = #{unitPrice,jdbcType=DECIMAL},
  513. </if>
  514. <if test="purchaseUnitPrice != null">
  515. purchase_unit_price = #{purchaseUnitPrice,jdbcType=DECIMAL},
  516. </if>
  517. <if test="taxUnitPrice != null">
  518. tax_unit_price = #{taxUnitPrice,jdbcType=DECIMAL},
  519. </if>
  520. <if test="allPrice != null">
  521. all_price = #{allPrice,jdbcType=DECIMAL},
  522. </if>
  523. <if test="remark != null">
  524. remark = #{remark,jdbcType=VARCHAR},
  525. </if>
  526. <if test="depotId != null">
  527. depot_id = #{depotId,jdbcType=BIGINT},
  528. </if>
  529. <if test="anotherDepotId != null">
  530. another_depot_id = #{anotherDepotId,jdbcType=BIGINT},
  531. </if>
  532. <if test="taxRate != null">
  533. tax_rate = #{taxRate,jdbcType=DECIMAL},
  534. </if>
  535. <if test="taxMoney != null">
  536. tax_money = #{taxMoney,jdbcType=DECIMAL},
  537. </if>
  538. <if test="taxLastMoney != null">
  539. tax_last_money = #{taxLastMoney,jdbcType=DECIMAL},
  540. </if>
  541. <if test="materialType != null">
  542. material_type = #{materialType,jdbcType=VARCHAR},
  543. </if>
  544. <if test="snList != null">
  545. sn_list = #{snList,jdbcType=VARCHAR},
  546. </if>
  547. <if test="batchNumber != null">
  548. batch_number = #{batchNumber,jdbcType=VARCHAR},
  549. </if>
  550. <if test="expirationDate != null">
  551. expiration_date = #{expirationDate,jdbcType=TIMESTAMP},
  552. </if>
  553. <if test="linkId != null">
  554. link_id = #{linkId,jdbcType=BIGINT},
  555. </if>
  556. <if test="tenantId != null">
  557. tenant_id = #{tenantId,jdbcType=BIGINT},
  558. </if>
  559. <if test="deleteFlag != null">
  560. delete_flag = #{deleteFlag,jdbcType=VARCHAR},
  561. </if>
  562. </set>
  563. where id = #{id,jdbcType=BIGINT}
  564. </update>
  565. <update id="updateByPrimaryKey" parameterType="com.jsh.erp.datasource.entities.DepotItem">
  566. update jsh_depot_item
  567. set header_id = #{headerId,jdbcType=BIGINT},
  568. material_id = #{materialId,jdbcType=BIGINT},
  569. material_extend_id = #{materialExtendId,jdbcType=BIGINT},
  570. material_unit = #{materialUnit,jdbcType=VARCHAR},
  571. sku = #{sku,jdbcType=VARCHAR},
  572. oper_number = #{operNumber,jdbcType=DECIMAL},
  573. basic_number = #{basicNumber,jdbcType=DECIMAL},
  574. unit_price = #{unitPrice,jdbcType=DECIMAL},
  575. purchase_unit_price = #{purchaseUnitPrice,jdbcType=DECIMAL},
  576. tax_unit_price = #{taxUnitPrice,jdbcType=DECIMAL},
  577. all_price = #{allPrice,jdbcType=DECIMAL},
  578. remark = #{remark,jdbcType=VARCHAR},
  579. depot_id = #{depotId,jdbcType=BIGINT},
  580. another_depot_id = #{anotherDepotId,jdbcType=BIGINT},
  581. tax_rate = #{taxRate,jdbcType=DECIMAL},
  582. tax_money = #{taxMoney,jdbcType=DECIMAL},
  583. tax_last_money = #{taxLastMoney,jdbcType=DECIMAL},
  584. material_type = #{materialType,jdbcType=VARCHAR},
  585. sn_list = #{snList,jdbcType=VARCHAR},
  586. batch_number = #{batchNumber,jdbcType=VARCHAR},
  587. expiration_date = #{expirationDate,jdbcType=TIMESTAMP},
  588. link_id = #{linkId,jdbcType=BIGINT},
  589. tenant_id = #{tenantId,jdbcType=BIGINT},
  590. delete_flag = #{deleteFlag,jdbcType=VARCHAR}
  591. where id = #{id,jdbcType=BIGINT}
  592. </update>
  593. <select id="pdaList" resultType="com.jsh.erp.datasource.pda.vo.PDADepotItemVO">
  594. SELECT
  595. di.id AS id,
  596. m.`name` AS material_name,
  597. m.standard AS material_standard,
  598. me.batch_number AS batch_number,
  599. di.production_date AS production_date,
  600. di.position AS position,
  601. me.inventory AS inventory,
  602. me.bar_code AS bar_code,
  603. di.oper_number AS oper_number,
  604. me.commodity_unit AS commodity_unit,
  605. di.material_unit AS material_unit,
  606. di.actual_quantity_in_storage AS actual_quantity_in_storage,
  607. di.material_id AS material_id,
  608. m.img_name AS img_name,
  609. di.header_id,
  610. di.material_extend_id
  611. FROM
  612. jsh_depot_item di
  613. LEFT JOIN jsh_material m ON di.material_id = m.id
  614. LEFT JOIN jsh_material_extend me ON di.material_extend_id = me.id
  615. WHERE
  616. di.delete_flag = '0'
  617. AND di.header_id = #{id}
  618. </select>
  619. <select id="pdaDetail" resultType="com.jsh.erp.datasource.pda.vo.PDADepotItemVO">
  620. SELECT
  621. di.id AS id,
  622. m.`name` AS material_name,
  623. m.standard AS material_standard,
  624. mb.batch_number AS batch_number,
  625. di.production_date AS production_date,
  626. di.position AS position,
  627. me.inventory AS inventory,
  628. me.bar_code AS bar_code,
  629. di.oper_number AS oper_number,
  630. di.material_unit AS material_unit,
  631. me.create_time AS create_time,
  632. di.material_id AS material_id,
  633. m.img_name AS img_name
  634. FROM
  635. jsh_depot_item di
  636. LEFT JOIN jsh_material m ON di.material_id = m.id
  637. LEFT JOIN jsh_material_extend me ON di.material_extend_id = me.id
  638. LEFT JOIN material_batch mb ON (SELECT id FROM jsh_depot_item WHERE link_id = di.id LIMIT 1) = mb.depot_item_id
  639. WHERE
  640. di.delete_flag = '0'
  641. AND di.id = #{id}
  642. </select>
  643. <select id="materialDepotDetail" resultType="com.jsh.erp.datasource.pda.vo.PDADepotItemVO">
  644. SELECT
  645. di.id AS id,
  646. di.material_id AS material_id,
  647. m.`name` AS material_name,
  648. d.name AS depot_name,
  649. m.standard AS material_standard,
  650. di.oper_number AS actual_quantity_in_storage,
  651. dh.create_time AS warehousing_time,
  652. me.commodity_unit AS commodity_unit,
  653. m.img_name AS img_name
  654. FROM
  655. jsh_depot_item di
  656. LEFT JOIN jsh_depot_head dh ON di.header_id = dh.id
  657. LEFT JOIN jsh_material m ON di.material_id = m.id
  658. LEFT JOIN jsh_material_extend me ON di.material_extend_id = me.id
  659. LEFT JOIN jsh_depot d ON di.depot_id = d.id
  660. WHERE
  661. di.delete_flag = '0'
  662. AND dh.delete_flag = '0'
  663. AND dh.status in ('1','2','3')
  664. AND dh.type = #{type}
  665. AND di.material_id = #{materialId}
  666. </select>
  667. </mapper>