123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.tld.mapper.StorageLocationMapper">
- <sql id="field">
- id,storage_location_code,storage_location_name,warehouse_where,storage_location_type,is_not_disable,storage_location_capacity,create_time
- </sql>
- <!-- 查询库位信息 -->
- <select id="getStorage" resultType="com.tld.model.StorageLocation">
- select
- a.id,
- a.storage_location_code,
- a.storage_location_name,
- a.warehouse_where,
- a.storage_location_type,
- a.is_not_disable,
- a.storage_location_capacity,
- a.create_time,
- b.name as materialName
- from
- tld_storage_location a
- left join tld_material_type b on a.storage_location_type = b.tld_id
- <trim prefix="WHERE" prefixOverrides="and |or">
- <if test="storageLocationCode != null and storageLocationCode != ''">
- and a.storage_location_code like CONCAT(CONCAT('%', #{storageLocationCode}), '%')
- </if>
- <if test="storageLocationName != null and storageLocationName != ''">
- and a.storage_location_name like CONCAT(CONCAT('%', #{storageLocationName}), '%')
- </if>
- <if test="storageLocationType != null and storageLocationType != ''">
- and a.storage_location_type like CONCAT(CONCAT('%', #{storageLocationType}), '%')
- </if>
- <if test="isNotDisable != null and isNotDisable != ''">
- and a.is_not_disable = #{isNotDisable}
- </if>
- <if test="id != null and id != ''">
- and a.id = #{id}
- </if>
- </trim>
- order by a.id desc
- </select>
- <!-- 新增库位信息 -->
- <insert id="addStorage">
- insert into tld_storage_location(storage_location_code,storage_location_name,warehouse_where,storage_location_type,is_not_disable,storage_location_capacity,create_time)
- values(#{storageLocationCode},#{storageLocationName},#{warehouseWhere},#{storageLocationType},#{isNotDisable},#{storageLocationCapacity},DATE_FORMAT(NOW(), '%Y-%m-%d'))
- </insert>
- <!-- 删除库位信息 -->
- <delete id="delStorage">
- delete from tld_storage_location where id = #{id}
- </delete>
- <!-- 修改库位信息 -->
- <update id="updateStorage">
- update tld_storage_location
- <set>
- <trim suffixOverrides=",">
- <if test="storageLocationCode != null and storageLocationCode != ''">
- storage_location_code = #{storageLocationCode},
- </if>
- <if test="storageLocationName != null and storageLocationName != ''">
- storage_location_name = #{storageLocationName},
- </if>
- <if test="warehouseWhere != null and warehouseWhere != ''">
- warehouse_where = #{warehouseWhere},
- </if>
- <if test="storageLocationType != null and storageLocationType != ''">
- storage_location_type = #{storageLocationType},
- </if>
- <if test="storageLocationCapacity != null and storageLocationCapacity != ''">
- storage_location_capacity = #{storageLocationCapacity},
- </if>
- <if test="isNotDisable != null and isNotDisable != ''">
- is_not_disable = #{isNotDisable},
- </if>
- </trim>
- </set>
- where id = #{id}
- </update>
- <!-- 导出数据查询 -->
- <select id="export" resultType="java.util.LinkedHashMap">
- select
- storage_location_code,
- storage_location_name,
- warehouse_where,
- storage_location_type,
- storage_location_capacity,
- case is_not_disable when '1' then '是' when '0' then '不是' END as isNotDisable,
- create_time
- from tld_storage_location
- <trim prefix="WHERE" prefixOverrides="and |or">
- <if test="storageLocationCode != null and storageLocationCode != ''">
- and storage_location_code like CONCAT(CONCAT('%', #{storageLocationCode}), '%')
- </if>
- <if test="storageLocationName != null and storageLocationName != ''">
- and storage_location_name like CONCAT(CONCAT('%', #{storageLocationName}), '%')
- </if>
- <if test="storageLocationType != null and storageLocationType != ''">
- and storage_location_type like CONCAT(CONCAT('%', #{storageLocationType}), '%')
- </if>
- <if test="isNotDisable != null and isNotDisable != ''">
- and is_not_disable = #{isNotDisable}
- </if>
- <if test="id != null and id != ''">
- and id = #{id}
- </if>
- </trim>
- order by a.id desc
- </select>
- <!-- 查询编号是否存在 -->
- <select id="getStorageCount" resultType="int">
- select count(*) from tld_storage_location where storage_location_code = #{storageLocationCode}
- </select>
- </mapper>
|