MaterialMapper.xml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524
  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.MaterialMapper">
  4. <resultMap id="BaseResultMap" type="com.jsh.erp.datasource.entities.Material">
  5. <id column="id" jdbcType="BIGINT" property="id" />
  6. <result column="category_id" jdbcType="BIGINT" property="categoryId" />
  7. <result column="name" jdbcType="VARCHAR" property="name" />
  8. <result column="model" jdbcType="VARCHAR" property="model" />
  9. <result column="standard" jdbcType="VARCHAR" property="standard" />
  10. <result column="brand" jdbcType="VARCHAR" property="brand" />
  11. <result column="mnemonic" jdbcType="VARCHAR" property="mnemonic" />
  12. <result column="color" jdbcType="VARCHAR" property="color" />
  13. <result column="unit" jdbcType="VARCHAR" property="unit" />
  14. <result column="remark" jdbcType="VARCHAR" property="remark" />
  15. <result column="img_name" jdbcType="VARCHAR" property="imgName" />
  16. <result column="unit_id" jdbcType="BIGINT" property="unitId" />
  17. <result column="weight" jdbcType="DECIMAL" property="weight" />
  18. <result column="enabled" jdbcType="BIT" property="enabled" />
  19. <result column="other_field1" jdbcType="VARCHAR" property="otherField1" />
  20. <result column="other_field2" jdbcType="VARCHAR" property="otherField2" />
  21. <result column="other_field3" jdbcType="VARCHAR" property="otherField3" />
  22. <result column="enable_serial_number" jdbcType="VARCHAR" property="enableSerialNumber" />
  23. <result column="enable_batch_number" jdbcType="VARCHAR" property="enableBatchNumber" />
  24. <result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
  25. <result column="delete_flag" jdbcType="VARCHAR" property="deleteFlag" />
  26. <result column="system_sku" jdbcType="VARCHAR" property="systemSku" />
  27. <result column="moving_pin_reminder_cycle" jdbcType="VARCHAR" property="movingPinReminderCycle" />
  28. </resultMap>
  29. <sql id="Example_Where_Clause">
  30. <where>
  31. <foreach collection="oredCriteria" item="criteria" separator="or">
  32. <if test="criteria.valid">
  33. <trim prefix="(" prefixOverrides="and" suffix=")">
  34. <foreach collection="criteria.criteria" item="criterion">
  35. <choose>
  36. <when test="criterion.noValue">
  37. and ${criterion.condition}
  38. </when>
  39. <when test="criterion.singleValue">
  40. and ${criterion.condition} #{criterion.value}
  41. </when>
  42. <when test="criterion.betweenValue">
  43. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  44. </when>
  45. <when test="criterion.listValue">
  46. and ${criterion.condition}
  47. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  48. #{listItem}
  49. </foreach>
  50. </when>
  51. </choose>
  52. </foreach>
  53. </trim>
  54. </if>
  55. </foreach>
  56. </where>
  57. </sql>
  58. <sql id="Update_By_Example_Where_Clause">
  59. <where>
  60. <foreach collection="example.oredCriteria" item="criteria" separator="or">
  61. <if test="criteria.valid">
  62. <trim prefix="(" prefixOverrides="and" suffix=")">
  63. <foreach collection="criteria.criteria" item="criterion">
  64. <choose>
  65. <when test="criterion.noValue">
  66. and ${criterion.condition}
  67. </when>
  68. <when test="criterion.singleValue">
  69. and ${criterion.condition} #{criterion.value}
  70. </when>
  71. <when test="criterion.betweenValue">
  72. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  73. </when>
  74. <when test="criterion.listValue">
  75. and ${criterion.condition}
  76. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  77. #{listItem}
  78. </foreach>
  79. </when>
  80. </choose>
  81. </foreach>
  82. </trim>
  83. </if>
  84. </foreach>
  85. </where>
  86. </sql>
  87. <sql id="Base_Column_List">
  88. id, category_id, name, model, standard, brand, mnemonic, color, unit, remark,
  89. img_name, unit_id, weight, enabled, other_field1, other_field2, other_field3,
  90. enable_serial_number, enable_batch_number, tenant_id, delete_flag
  91. </sql>
  92. <select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultMap="BaseResultMap">
  93. select
  94. <if test="distinct">
  95. distinct
  96. </if>
  97. <include refid="Base_Column_List" />
  98. from jsh_material
  99. <if test="_parameter != null">
  100. <include refid="Example_Where_Clause" />
  101. </if>
  102. <if test="orderByClause != null">
  103. order by ${orderByClause}
  104. </if>
  105. </select>
  106. <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
  107. select
  108. <include refid="Base_Column_List" />
  109. from jsh_material
  110. where id = #{id,jdbcType=BIGINT}
  111. </select>
  112. <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
  113. delete from jsh_material
  114. where id = #{id,jdbcType=BIGINT}
  115. </delete>
  116. <delete id="deleteByExample" parameterType="com.jsh.erp.datasource.entities.MaterialExample">
  117. delete from jsh_material
  118. <if test="_parameter != null">
  119. <include refid="Example_Where_Clause" />
  120. </if>
  121. </delete>
  122. <insert id="insert" parameterType="com.jsh.erp.datasource.entities.Material">
  123. insert into jsh_material (id, category_id, name,
  124. mfrs, model, standard,
  125. brand, mnemonic, color,
  126. unit, remark, img_name,
  127. unit_id, expiry_num, weight,
  128. enabled, other_field1, other_field2,
  129. other_field3, enable_serial_number, enable_batch_number,
  130. position, tenant_id, delete_flag
  131. )
  132. values (#{id,jdbcType=BIGINT}, #{categoryId,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR},
  133. #{mfrs,jdbcType=VARCHAR}, #{model,jdbcType=VARCHAR}, #{standard,jdbcType=VARCHAR},
  134. #{brand,jdbcType=VARCHAR}, #{mnemonic,jdbcType=VARCHAR}, #{color,jdbcType=VARCHAR},
  135. #{unit,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{imgName,jdbcType=VARCHAR},
  136. #{unitId,jdbcType=BIGINT}, #{expiryNum,jdbcType=INTEGER}, #{weight,jdbcType=DECIMAL},
  137. #{enabled,jdbcType=BIT}, #{otherField1,jdbcType=VARCHAR}, #{otherField2,jdbcType=VARCHAR},
  138. #{otherField3,jdbcType=VARCHAR}, #{enableSerialNumber,jdbcType=VARCHAR}, #{enableBatchNumber,jdbcType=VARCHAR},
  139. #{position,jdbcType=VARCHAR}, #{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR}
  140. )
  141. </insert>
  142. <insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.Material">
  143. insert into jsh_material
  144. <trim prefix="(" suffix=")" suffixOverrides=",">
  145. <if test="id != null">
  146. id,
  147. </if>
  148. <if test="categoryId != null">
  149. category_id,
  150. </if>
  151. <if test="name != null">
  152. name,
  153. </if>
  154. <if test="mfrs != null">
  155. mfrs,
  156. </if>
  157. <if test="model != null">
  158. model,
  159. </if>
  160. <if test="standard != null">
  161. standard,
  162. </if>
  163. <if test="brand != null">
  164. brand,
  165. </if>
  166. <if test="mnemonic != null">
  167. mnemonic,
  168. </if>
  169. <if test="color != null">
  170. color,
  171. </if>
  172. <if test="unit != null">
  173. unit,
  174. </if>
  175. <if test="remark != null">
  176. remark,
  177. </if>
  178. <if test="imgName != null">
  179. img_name,
  180. </if>
  181. <if test="unitId != null">
  182. unit_id,
  183. </if>
  184. <if test="expiryNum != null">
  185. expiry_num,
  186. </if>
  187. <if test="weight != null">
  188. weight,
  189. </if>
  190. <if test="enabled != null">
  191. enabled,
  192. </if>
  193. <if test="otherField1 != null">
  194. other_field1,
  195. </if>
  196. <if test="otherField2 != null">
  197. other_field2,
  198. </if>
  199. <if test="otherField3 != null">
  200. other_field3,
  201. </if>
  202. <if test="enableSerialNumber != null">
  203. enable_serial_number,
  204. </if>
  205. <if test="enableBatchNumber != null">
  206. enable_batch_number,
  207. </if>
  208. <if test="position != null">
  209. position,
  210. </if>
  211. <if test="tenantId != null">
  212. tenant_id,
  213. </if>
  214. <if test="deleteFlag != null">
  215. delete_flag,
  216. </if>
  217. </trim>
  218. <trim prefix="values (" suffix=")" suffixOverrides=",">
  219. <if test="id != null">
  220. #{id,jdbcType=BIGINT},
  221. </if>
  222. <if test="categoryId != null">
  223. #{categoryId,jdbcType=BIGINT},
  224. </if>
  225. <if test="name != null">
  226. #{name,jdbcType=VARCHAR},
  227. </if>
  228. <if test="mfrs != null">
  229. #{mfrs,jdbcType=VARCHAR},
  230. </if>
  231. <if test="model != null">
  232. #{model,jdbcType=VARCHAR},
  233. </if>
  234. <if test="standard != null">
  235. #{standard,jdbcType=VARCHAR},
  236. </if>
  237. <if test="brand != null">
  238. #{brand,jdbcType=VARCHAR},
  239. </if>
  240. <if test="mnemonic != null">
  241. #{mnemonic,jdbcType=VARCHAR},
  242. </if>
  243. <if test="color != null">
  244. #{color,jdbcType=VARCHAR},
  245. </if>
  246. <if test="unit != null">
  247. #{unit,jdbcType=VARCHAR},
  248. </if>
  249. <if test="remark != null">
  250. #{remark,jdbcType=VARCHAR},
  251. </if>
  252. <if test="imgName != null">
  253. #{imgName,jdbcType=VARCHAR},
  254. </if>
  255. <if test="unitId != null">
  256. #{unitId,jdbcType=BIGINT},
  257. </if>
  258. <if test="expiryNum != null">
  259. #{expiryNum,jdbcType=INTEGER},
  260. </if>
  261. <if test="weight != null">
  262. #{weight,jdbcType=DECIMAL},
  263. </if>
  264. <if test="enabled != null">
  265. #{enabled,jdbcType=BIT},
  266. </if>
  267. <if test="otherField1 != null">
  268. #{otherField1,jdbcType=VARCHAR},
  269. </if>
  270. <if test="otherField2 != null">
  271. #{otherField2,jdbcType=VARCHAR},
  272. </if>
  273. <if test="otherField3 != null">
  274. #{otherField3,jdbcType=VARCHAR},
  275. </if>
  276. <if test="enableSerialNumber != null">
  277. #{enableSerialNumber,jdbcType=VARCHAR},
  278. </if>
  279. <if test="enableBatchNumber != null">
  280. #{enableBatchNumber,jdbcType=VARCHAR},
  281. </if>
  282. <if test="position != null">
  283. #{position,jdbcType=VARCHAR},
  284. </if>
  285. <if test="tenantId != null">
  286. #{tenantId,jdbcType=BIGINT},
  287. </if>
  288. <if test="deleteFlag != null">
  289. #{deleteFlag,jdbcType=VARCHAR},
  290. </if>
  291. </trim>
  292. </insert>
  293. <select id="countByExample" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultType="java.lang.Long">
  294. select count(*) from jsh_material
  295. <if test="_parameter != null">
  296. <include refid="Example_Where_Clause" />
  297. </if>
  298. </select>
  299. <update id="updateByExampleSelective" parameterType="map">
  300. update jsh_material
  301. <set>
  302. <if test="record.id != null">
  303. id = #{record.id,jdbcType=BIGINT},
  304. </if>
  305. <if test="record.categoryId != null">
  306. category_id = #{record.categoryId,jdbcType=BIGINT},
  307. </if>
  308. <if test="record.name != null">
  309. name = #{record.name,jdbcType=VARCHAR},
  310. </if>
  311. <if test="record.mfrs != null">
  312. mfrs = #{record.mfrs,jdbcType=VARCHAR},
  313. </if>
  314. <if test="record.model != null">
  315. model = #{record.model,jdbcType=VARCHAR},
  316. </if>
  317. <if test="record.standard != null">
  318. standard = #{record.standard,jdbcType=VARCHAR},
  319. </if>
  320. <if test="record.brand != null">
  321. brand = #{record.brand,jdbcType=VARCHAR},
  322. </if>
  323. <if test="record.mnemonic != null">
  324. mnemonic = #{record.mnemonic,jdbcType=VARCHAR},
  325. </if>
  326. <if test="record.color != null">
  327. color = #{record.color,jdbcType=VARCHAR},
  328. </if>
  329. <if test="record.unit != null">
  330. unit = #{record.unit,jdbcType=VARCHAR},
  331. </if>
  332. <if test="record.remark != null">
  333. remark = #{record.remark,jdbcType=VARCHAR},
  334. </if>
  335. <if test="record.imgName != null">
  336. img_name = #{record.imgName,jdbcType=VARCHAR},
  337. </if>
  338. <if test="record.unitId != null">
  339. unit_id = #{record.unitId,jdbcType=BIGINT},
  340. </if>
  341. <if test="record.expiryNum != null">
  342. expiry_num = #{record.expiryNum,jdbcType=INTEGER},
  343. </if>
  344. <if test="record.weight != null">
  345. weight = #{record.weight,jdbcType=DECIMAL},
  346. </if>
  347. <if test="record.enabled != null">
  348. enabled = #{record.enabled,jdbcType=BIT},
  349. </if>
  350. <if test="record.otherField1 != null">
  351. other_field1 = #{record.otherField1,jdbcType=VARCHAR},
  352. </if>
  353. <if test="record.otherField2 != null">
  354. other_field2 = #{record.otherField2,jdbcType=VARCHAR},
  355. </if>
  356. <if test="record.otherField3 != null">
  357. other_field3 = #{record.otherField3,jdbcType=VARCHAR},
  358. </if>
  359. <if test="record.enableSerialNumber != null">
  360. enable_serial_number = #{record.enableSerialNumber,jdbcType=VARCHAR},
  361. </if>
  362. <if test="record.enableBatchNumber != null">
  363. enable_batch_number = #{record.enableBatchNumber,jdbcType=VARCHAR},
  364. </if>
  365. <if test="record.position != null">
  366. position = #{record.position,jdbcType=VARCHAR},
  367. </if>
  368. <if test="record.tenantId != null">
  369. tenant_id = #{record.tenantId,jdbcType=BIGINT},
  370. </if>
  371. <if test="record.deleteFlag != null">
  372. delete_flag = #{record.deleteFlag,jdbcType=VARCHAR},
  373. </if>
  374. </set>
  375. <if test="_parameter != null">
  376. <include refid="Update_By_Example_Where_Clause" />
  377. </if>
  378. </update>
  379. <update id="updateByExample" parameterType="map">
  380. update jsh_material
  381. set id = #{record.id,jdbcType=BIGINT},
  382. category_id = #{record.categoryId,jdbcType=BIGINT},
  383. name = #{record.name,jdbcType=VARCHAR},
  384. mfrs = #{record.mfrs,jdbcType=VARCHAR},
  385. model = #{record.model,jdbcType=VARCHAR},
  386. standard = #{record.standard,jdbcType=VARCHAR},
  387. brand = #{record.brand,jdbcType=VARCHAR},
  388. mnemonic = #{record.mnemonic,jdbcType=VARCHAR},
  389. color = #{record.color,jdbcType=VARCHAR},
  390. unit = #{record.unit,jdbcType=VARCHAR},
  391. remark = #{record.remark,jdbcType=VARCHAR},
  392. img_name = #{record.imgName,jdbcType=VARCHAR},
  393. unit_id = #{record.unitId,jdbcType=BIGINT},
  394. expiry_num = #{record.expiryNum,jdbcType=INTEGER},
  395. weight = #{record.weight,jdbcType=DECIMAL},
  396. enabled = #{record.enabled,jdbcType=BIT},
  397. other_field1 = #{record.otherField1,jdbcType=VARCHAR},
  398. other_field2 = #{record.otherField2,jdbcType=VARCHAR},
  399. other_field3 = #{record.otherField3,jdbcType=VARCHAR},
  400. enable_serial_number = #{record.enableSerialNumber,jdbcType=VARCHAR},
  401. enable_batch_number = #{record.enableBatchNumber,jdbcType=VARCHAR},
  402. position = #{record.position,jdbcType=VARCHAR},
  403. tenant_id = #{record.tenantId,jdbcType=BIGINT},
  404. delete_flag = #{record.deleteFlag,jdbcType=VARCHAR}
  405. <if test="_parameter != null">
  406. <include refid="Update_By_Example_Where_Clause" />
  407. </if>
  408. </update>
  409. <update id="updateByPrimaryKeySelective" parameterType="com.jsh.erp.datasource.entities.Material">
  410. update jsh_material
  411. <set>
  412. <if test="categoryId != null">
  413. category_id = #{categoryId,jdbcType=BIGINT},
  414. </if>
  415. <if test="name != null">
  416. name = #{name,jdbcType=VARCHAR},
  417. </if>
  418. <if test="model != null">
  419. model = #{model,jdbcType=VARCHAR},
  420. </if>
  421. <if test="standard != null">
  422. standard = #{standard,jdbcType=VARCHAR},
  423. </if>
  424. <if test="brand != null">
  425. brand = #{brand,jdbcType=VARCHAR},
  426. </if>
  427. <if test="mnemonic != null">
  428. mnemonic = #{mnemonic,jdbcType=VARCHAR},
  429. </if>
  430. <if test="color != null">
  431. color = #{color,jdbcType=VARCHAR},
  432. </if>
  433. <if test="unit != null">
  434. unit = #{unit,jdbcType=VARCHAR},
  435. </if>
  436. <if test="remark != null">
  437. remark = #{remark,jdbcType=VARCHAR},
  438. </if>
  439. <if test="imgName != null">
  440. img_name = #{imgName,jdbcType=VARCHAR},
  441. </if>
  442. <if test="unitId != null">
  443. unit_id = #{unitId,jdbcType=BIGINT},
  444. </if>
  445. <if test="weight != null">
  446. weight = #{weight,jdbcType=DECIMAL},
  447. </if>
  448. <if test="enabled != null">
  449. enabled = #{enabled,jdbcType=BIT},
  450. </if>
  451. <if test="otherField1 != null">
  452. other_field1 = #{otherField1,jdbcType=VARCHAR},
  453. </if>
  454. <if test="otherField2 != null">
  455. other_field2 = #{otherField2,jdbcType=VARCHAR},
  456. </if>
  457. <if test="otherField3 != null">
  458. other_field3 = #{otherField3,jdbcType=VARCHAR},
  459. </if>
  460. <if test="enableSerialNumber != null">
  461. enable_serial_number = #{enableSerialNumber,jdbcType=VARCHAR},
  462. </if>
  463. <if test="enableBatchNumber != null">
  464. enable_batch_number = #{enableBatchNumber,jdbcType=VARCHAR},
  465. </if>
  466. <if test="tenantId != null">
  467. tenant_id = #{tenantId,jdbcType=BIGINT},
  468. </if>
  469. <if test="deleteFlag != null">
  470. delete_flag = #{deleteFlag,jdbcType=VARCHAR},
  471. </if>
  472. <if test="deleteFlag != null">
  473. delete_flag = #{deleteFlag,jdbcType=VARCHAR},
  474. </if>
  475. <if test="movingPinReminderCycle != null">
  476. moving_pin_reminder_cycle = #{movingPinReminderCycle,jdbcType=VARCHAR},
  477. </if>
  478. </set>
  479. where id = #{id,jdbcType=BIGINT}
  480. </update>
  481. <update id="updateByPrimaryKey" parameterType="com.jsh.erp.datasource.entities.Material">
  482. update jsh_material
  483. set category_id = #{categoryId,jdbcType=BIGINT},
  484. name = #{name,jdbcType=VARCHAR},
  485. mfrs = #{mfrs,jdbcType=VARCHAR},
  486. model = #{model,jdbcType=VARCHAR},
  487. standard = #{standard,jdbcType=VARCHAR},
  488. brand = #{brand,jdbcType=VARCHAR},
  489. mnemonic = #{mnemonic,jdbcType=VARCHAR},
  490. color = #{color,jdbcType=VARCHAR},
  491. unit = #{unit,jdbcType=VARCHAR},
  492. remark = #{remark,jdbcType=VARCHAR},
  493. img_name = #{imgName,jdbcType=VARCHAR},
  494. unit_id = #{unitId,jdbcType=BIGINT},
  495. expiry_num = #{expiryNum,jdbcType=INTEGER},
  496. weight = #{weight,jdbcType=DECIMAL},
  497. enabled = #{enabled,jdbcType=BIT},
  498. other_field1 = #{otherField1,jdbcType=VARCHAR},
  499. other_field2 = #{otherField2,jdbcType=VARCHAR},
  500. other_field3 = #{otherField3,jdbcType=VARCHAR},
  501. enable_serial_number = #{enableSerialNumber,jdbcType=VARCHAR},
  502. enable_batch_number = #{enableBatchNumber,jdbcType=VARCHAR},
  503. position = #{position,jdbcType=VARCHAR},
  504. tenant_id = #{tenantId,jdbcType=BIGINT},
  505. delete_flag = #{deleteFlag,jdbcType=VARCHAR}
  506. where id = #{id,jdbcType=BIGINT}
  507. </update>
  508. </mapper>