90 lines
4.5 KiB
XML
90 lines
4.5 KiB
XML
|
|
<?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.zg.project.information.mapper.WarehouseInfoMapper">
|
||
|
|
|
||
|
|
<resultMap type="WarehouseInfo" id="WarehouseInfoResult">
|
||
|
|
<result property="id" column="id" />
|
||
|
|
<result property="warehouseCode" column="warehouse_code" />
|
||
|
|
<result property="warehouseName" column="warehouse_name" />
|
||
|
|
<result property="address" column="address" />
|
||
|
|
<result property="status" column="status" />
|
||
|
|
<result property="sort" column="sort" />
|
||
|
|
<result property="remark" column="remark" />
|
||
|
|
<result property="createdAt" column="created_at" />
|
||
|
|
<result property="updatedAt" column="updated_at" />
|
||
|
|
</resultMap>
|
||
|
|
|
||
|
|
<sql id="selectWarehouseInfoVo">
|
||
|
|
select id, warehouse_code, warehouse_name, address, status, sort, remark, created_at, updated_at from warehouse_info
|
||
|
|
</sql>
|
||
|
|
|
||
|
|
<select id="selectWarehouseInfoList" parameterType="WarehouseInfo" resultMap="WarehouseInfoResult">
|
||
|
|
<include refid="selectWarehouseInfoVo"/>
|
||
|
|
<where>
|
||
|
|
<if test="warehouseCode != null and warehouseCode != ''"> and warehouse_code = #{warehouseCode}</if>
|
||
|
|
<if test="warehouseName != null and warehouseName != ''"> and warehouse_name like concat('%', #{warehouseName}, '%')</if>
|
||
|
|
<if test="address != null and address != ''"> and address = #{address}</if>
|
||
|
|
<if test="status != null "> and status = #{status}</if>
|
||
|
|
<if test="sort != null "> and sort = #{sort}</if>
|
||
|
|
<if test="createdAt != null "> and created_at = #{createdAt}</if>
|
||
|
|
<if test="updatedAt != null "> and updated_at = #{updatedAt}</if>
|
||
|
|
</where>
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectWarehouseInfoById" parameterType="Long" resultMap="WarehouseInfoResult">
|
||
|
|
<include refid="selectWarehouseInfoVo"/>
|
||
|
|
where id = #{id}
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<insert id="insertWarehouseInfo" parameterType="WarehouseInfo" useGeneratedKeys="true" keyProperty="id">
|
||
|
|
insert into warehouse_info
|
||
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||
|
|
<if test="warehouseCode != null and warehouseCode != ''">warehouse_code,</if>
|
||
|
|
<if test="warehouseName != null and warehouseName != ''">warehouse_name,</if>
|
||
|
|
<if test="address != null">address,</if>
|
||
|
|
<if test="status != null">status,</if>
|
||
|
|
<if test="sort != null">sort,</if>
|
||
|
|
<if test="remark != null">remark,</if>
|
||
|
|
<if test="createdAt != null">created_at,</if>
|
||
|
|
<if test="updatedAt != null">updated_at,</if>
|
||
|
|
</trim>
|
||
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||
|
|
<if test="warehouseCode != null and warehouseCode != ''">#{warehouseCode},</if>
|
||
|
|
<if test="warehouseName != null and warehouseName != ''">#{warehouseName},</if>
|
||
|
|
<if test="address != null">#{address},</if>
|
||
|
|
<if test="status != null">#{status},</if>
|
||
|
|
<if test="sort != null">#{sort},</if>
|
||
|
|
<if test="remark != null">#{remark},</if>
|
||
|
|
<if test="createdAt != null">#{createdAt},</if>
|
||
|
|
<if test="updatedAt != null">#{updatedAt},</if>
|
||
|
|
</trim>
|
||
|
|
</insert>
|
||
|
|
|
||
|
|
<update id="updateWarehouseInfo" parameterType="WarehouseInfo">
|
||
|
|
update warehouse_info
|
||
|
|
<trim prefix="SET" suffixOverrides=",">
|
||
|
|
<if test="warehouseCode != null and warehouseCode != ''">warehouse_code = #{warehouseCode},</if>
|
||
|
|
<if test="warehouseName != null and warehouseName != ''">warehouse_name = #{warehouseName},</if>
|
||
|
|
<if test="address != null">address = #{address},</if>
|
||
|
|
<if test="status != null">status = #{status},</if>
|
||
|
|
<if test="sort != null">sort = #{sort},</if>
|
||
|
|
<if test="remark != null">remark = #{remark},</if>
|
||
|
|
<if test="createdAt != null">created_at = #{createdAt},</if>
|
||
|
|
<if test="updatedAt != null">updated_at = #{updatedAt},</if>
|
||
|
|
</trim>
|
||
|
|
where id = #{id}
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<delete id="deleteWarehouseInfoById" parameterType="Long">
|
||
|
|
delete from warehouse_info where id = #{id}
|
||
|
|
</delete>
|
||
|
|
|
||
|
|
<delete id="deleteWarehouseInfoByIds" parameterType="String">
|
||
|
|
delete from warehouse_info where id in
|
||
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||
|
|
#{id}
|
||
|
|
</foreach>
|
||
|
|
</delete>
|
||
|
|
</mapper>
|