StorageLocationMapper.xml 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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.StorageLocationMapper">
  5. <sql id="field">
  6. id,storage_location_code,storage_location_name,warehouse_where,storage_location_type,is_not_disable,create_time
  7. </sql>
  8. <!-- 查询库位信息 -->
  9. <select id="getStorage" resultType="com.tld.model.StorageLocation">
  10. select
  11. <include refid="field"/>
  12. from
  13. tld_storage_location
  14. <trim prefix="WHERE" prefixOverrides="and |or">
  15. <if test="storageLocationCode != null and storageLocationCode != ''">
  16. and storage_location_code like CONCAT(CONCAT('%', #{storageLocationCode}), '%')
  17. </if>
  18. <if test="storageLocationName != null and storageLocationName != ''">
  19. and storage_location_name like CONCAT(CONCAT('%', #{storageLocationName}), '%')
  20. </if>
  21. <if test="storageLocationType != null and storageLocationType != ''">
  22. and storage_location_type like CONCAT(CONCAT('%', #{storageLocationType}), '%')
  23. </if>
  24. <if test="isNotDisable != null and isNotDisable != ''">
  25. and is_not_disable = #{isNotDisable}
  26. </if>
  27. <if test="id != null and id != ''">
  28. and id = #{id}
  29. </if>
  30. </trim>
  31. </select>
  32. <!-- 新增库位信息 -->
  33. <insert id="addStorage">
  34. insert into tld_storage_location(storage_location_code,storage_location_name,warehouse_where,storage_location_type,is_not_disable,create_time)
  35. values(#{storageLocationCode},#{storageLocationName},#{warehouseWhere},#{storageLocationType},#{isNotDisable},DATE_FORMAT(NOW(), '%Y-%m-%d'))
  36. </insert>
  37. <!-- 删除库位信息 -->
  38. <delete id="delStorage">
  39. delete from tld_storage_location where id = #{id}
  40. </delete>
  41. <!-- 修改库位信息 -->
  42. <update id="updateStorage">
  43. update tld_storage_location
  44. <set>
  45. <trim suffixOverrides=",">
  46. <if test="storageLocationCode != null and storageLocationCode != ''">
  47. storage_location_code = #{storageLocationCode},
  48. </if>
  49. <if test="storageLocationName != null and storageLocationName != ''">
  50. storage_location_name = #{storageLocationName},
  51. </if>
  52. <if test="warehouseWhere != null and warehouseWhere != ''">
  53. warehouse_where = #{warehouseWhere},
  54. </if>
  55. <if test="storageLocationType != null and storageLocationType != ''">
  56. storage_location_type = #{storageLocationType},
  57. </if>
  58. <if test="isNotDisable != null and isNotDisable != ''">
  59. is_not_disable = #{isNotDisable},
  60. </if>
  61. </trim>
  62. </set>
  63. where id = #{id}
  64. </update>
  65. <!-- 导出数据查询 -->
  66. <select id="export" resultType="java.util.LinkedHashMap">
  67. select storage_location_code,storage_location_name,warehouse_where,storage_location_type,is_not_disable,create_time
  68. from tld_storage_location
  69. <trim prefix="WHERE" prefixOverrides="and |or">
  70. <if test="storageLocationCode != null and storageLocationCode != ''">
  71. and storage_location_code like CONCAT(CONCAT('%', #{storageLocationCode}), '%')
  72. </if>
  73. <if test="storageLocationName != null and storageLocationName != ''">
  74. and storage_location_name like CONCAT(CONCAT('%', #{storageLocationName}), '%')
  75. </if>
  76. <if test="storageLocationType != null and storageLocationType != ''">
  77. and storage_location_type like CONCAT(CONCAT('%', #{storageLocationType}), '%')
  78. </if>
  79. <if test="isNotDisable != null and isNotDisable != ''">
  80. and is_not_disable = #{isNotDisable}
  81. </if>
  82. <if test="id != null and id != ''">
  83. and id = #{id}
  84. </if>
  85. </trim>
  86. </select>
  87. </mapper>