123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- <?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.GoodsMapper">
- <sql id="field">
- id,item_number,type,min_accommodate,accommodate_num,max_accommodate,supplier,storage_location,input_type,user_department,low_reserves,high_reserves,grade,packing_type,unit,name
- </sql>
- <!-- 查询货品信息 -->
- <select id="getStorage" resultType="com.tld.model.Goods">
- select
- a.id,
- a.item_number,
- a.type,
- a.min_accommodate,
- a.accommodate_num,
- a.max_accommodate,
- a.supplier,
- a.storage_location,
- a.input_type,
- a.user_department,
- a.low_reserves,
- a.high_reserves,
- a.grade,
- a. packing_type,
- a. unit,
- a.name,
- b.name as userDepartmentName,
- c.storage_location_name as storageLocationName
- from tld_goods a
- left join tld_department b on a.user_department = b.code
- left join tld_storage_location c on a.storage_location = c.id
- <trim prefix="WHERE" prefixOverrides="and |or">
- <if test="itemNumber != null and itemNumber != ''">
- and a.item_number = #{itemNumber}
- </if>
- <if test="id != null and id != ''">
- and a.id = #{id}
- </if>
- </trim>
- </select>
- <!-- 新增货品信息 -->
- <insert id="addGoods">
- insert into tld_goods(item_number,type,min_accommodate,accommodate_num,max_accommodate,supplier,storage_location,input_type,user_department,low_reserves,high_reserves,grade,packing_type,unit,name)
- values(#{itemNumber},#{type},#{minAccommodate},#{accommodateNum},#{maxAccommodate},#{supplier},#{storageLocation},#{inputType},#{userDepartment},#{lowReserves},#{highReserves},#{grade},#{packingType},#{unit},#{name})
- </insert>
- <!-- 删除货品信息 -->
- <delete id="delGoods">
- delete from tld_goods where id = #{id}
- </delete>
- <!-- 修改货品信息 -->
- <update id="updateGoods">
- update tld_goods
- <set>
- <trim suffixOverrides=",">
- <if test="itemNumber != null">
- item_number = #{itemNumber},
- </if>
- <if test="type != null">
- type = #{type},
- </if>
- <if test="minAccommodate != null">
- min_accommodate = #{minAccommodate},
- </if>
- <if test="accommodateNum != null">
- accommodate_num = #{accommodateNum},
- </if>
- <if test="maxAccommodate != null">
- max_accommodate = #{maxAccommodate},
- </if>
- <if test="supplier != null">
- supplier = #{supplier},
- </if>
- <if test="storageLocation != null">
- storage_location = #{storageLocation},
- </if>
- <if test="inputType != null">
- input_type = #{inputType},
- </if>
- <if test="userDepartment != null">
- user_department = #{userDepartment},
- </if>
- <if test="lowReserves != null">
- low_reserves = #{lowReserves},
- </if>
- <if test="highReserves != null">
- high_reserves = #{highReserves},
- </if>
- <if test="grade != null">
- grade = #{grade},
- </if>
- <if test="packingType != null">
- packing_type = #{packingType},
- </if>
- <if test="unit != null">
- unit = #{unit},
- </if>
- <if test="name != null">
- name = #{name},
- </if>
- </trim>
- </set>
- where id = #{id}
- </update>
- <!-- 导出数据查询 -->
- <select id="export" resultType="java.util.LinkedHashMap">
- select
- a.item_number,
- a.name,
- a.type,
- a.min_accommodate,
- a.accommodate_num,
- a.max_accommodate,
- a.supplier,
- c.storage_location_name,
- a.input_type,
- b.name,
- a.low_reserves,
- a.high_reserves,
- a.grade,
- a.packing_type,
- a.unit
- from tld_goods a
- left join tld_department b on a.user_department = b.code
- left join tld_storage_location c on a.storage_location = c.id
- <trim prefix="WHERE" prefixOverrides="and |or">
- <if test="itemNumber != null and itemNumber != ''">
- and item_number = #{itemNumber}
- </if>
- <if test="id != null and id != ''">
- and id = #{id}
- </if>
- </trim>
- </select>
- </mapper>
|