MaterialClassMapper.xml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  4. <mapper namespace="com.tld.mapper.MaterialClassMapper">
  5. <!-- 查询物料类别 -->
  6. <select id="getMaterialClass" resultType="com.tld.model.MaterialClass">
  7. select
  8. a.wllb_code,
  9. a.storage_location_code,
  10. b.storage_location_name as storageLocationName,
  11. c.name as wllbName,
  12. a.id
  13. from tld_material_class a
  14. left join tld_storage_location b on a.storage_location_code = b.storage_location_code
  15. left join tld_material c on a.wllb_code = c.tld_id
  16. <trim prefix="WHERE" prefixOverrides="and |or">
  17. <if test="storageLocationCode != null and storageLocationCode != ''">
  18. and a.storage_location_code = #{storageLocationCode}
  19. </if>
  20. <if test="id != null and id != ''">
  21. and a.id = #{id}
  22. </if>
  23. <if test="wllbCode != null and wllbCode != ''">
  24. and a.wllb_code = #{wllbCode}
  25. </if>
  26. </trim>
  27. </select>
  28. <!-- 删除类别表 -->
  29. <delete id="delMaterialClass">
  30. delete from tld_material_class where id = #{id}
  31. </delete>
  32. <!-- 新增类别表 -->
  33. <insert id="addMaterialClass">
  34. insert into tld_material_class(storage_location_code,wllb_code) values(#{storageLocationCode}, #{wllbCode})
  35. </insert>
  36. <!-- 修改类别表 -->
  37. <update id="updateMaterialClass">
  38. update tld_material_class
  39. <set>
  40. <trim suffixOverrides=",">
  41. <if test="storageLocationCode != null and storageLocationCode != ''">
  42. storage_location_code = #{storageLocationCode},
  43. </if>
  44. <if test="wllbCode != null and wllbCode != ''">
  45. wllb_code = #{wllbCode},
  46. </if>
  47. </trim>
  48. </set>
  49. where id = #{id}
  50. </update>
  51. <!-- 修改物料字典内容 -->
  52. <update id="updateMaterial">
  53. update tld_material
  54. <set>
  55. <trim suffixOverrides=",">
  56. <if test="size != null and size != ''">
  57. size = #{size},
  58. </if>
  59. <if test="materialType != null and materialType != ''">
  60. wllb_class = #{materialType},
  61. </if>
  62. <if test="isNotDisable != null and isNotDisable != ''">
  63. is_not_disable = #{isNotDisable},
  64. </if>
  65. <if test="isRecommend != null and isRecommend != ''">
  66. is_recommend = #{isRecommend},
  67. </if>
  68. <if test="partType != null and partType != ''">
  69. part_type = #{partType},
  70. </if>
  71. </trim>
  72. </set>
  73. where tld_id = #{id}
  74. </update>
  75. </mapper>