You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

180 lines
9.7 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.op.wms.mapper.BaseWarehouseMapper">
<resultMap type="BaseWarehouse" id="BaseWarehouseResult">
<result property="warehouseId" column="warehouse_id"/>
<result property="warehouseType" column="warehouse_type"/>
<result property="warehouseCode" column="warehouse_code"/>
<result property="warehouseName" column="warehouse_name"/>
<result property="factoryCode" column="factory_code"/>
<result property="factoryName" column="factory_name"/>
<result property="dataSource" column="data_source"/>
<result property="schame" column="schame"/>
<result property="activeFlag" column="active_flag"/>
<result property="userDefined1" column="user_defined1"/>
<result property="userDefined2" column="user_defined2"/>
<result property="userDefined3" column="user_defined3"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
<result property="lineFlag" column="line_flag"/>
<result property="warehouseType2" column="warehouse_type2"/>
<result property="delFlag" column="del_flag"/>
</resultMap>
<sql id="selectBaseWarehouseVo">
select warehouse_id, warehouse_type, warehouse_code, warehouse_name, factory_code, factory_name, data_source, schame, active_flag, user_defined1, user_defined2, user_defined3, create_by, create_time, update_by, update_time, remark, line_flag, warehouse_type2 ,del_flag from base_warehouse
</sql>
<select id="selectBaseWarehouseList" parameterType="BaseWarehouse" resultMap="BaseWarehouseResult">
<include refid="selectBaseWarehouseVo"/>
<where>
<if test="warehouseType != null and warehouseType != ''">and warehouse_type like concat('%',
#{warehouseType}, '%')
</if>
<if test="warehouseCode != null and warehouseCode != ''">and warehouse_code like concat('%',
#{warehouseCode}, '%')
</if>
<if test="warehouseName != null and warehouseName != ''">and warehouse_name like concat('%',
#{warehouseName}, '%')
</if>
<if test="factoryCode != null and factoryCode != ''">and factory_code = #{factoryCode}</if>
<if test="factoryName != null and factoryName != ''">and factory_name like concat('%', #{factoryName},
'%')
</if>
<if test="dataSource != null and dataSource != ''">and data_source = #{dataSource}</if>
<if test="schame != null and schame != ''">and schame = #{schame}</if>
<if test="activeFlag != null and activeFlag != ''">and active_flag = #{activeFlag}</if>
<if test="userDefined1 != null and userDefined1 != ''">and user_defined1 = #{userDefined1}</if>
<if test="userDefined2 != null and userDefined2 != ''">and user_defined2 = #{userDefined2}</if>
<if test="userDefined3 != null and userDefined3 != ''">and user_defined3 = #{userDefined3}</if>
<if test="lineFlag != null and lineFlag != ''">and line_flag = #{lineFlag}</if>
<if test="warehouseType2 != null and warehouseType2 != ''">and warehouse_type2 = #{warehouseType2}</if>
and del_flag = '0'
</where>
</select>
<select id="selectBaseWarehouseByWarehouseId" parameterType="String" resultMap="BaseWarehouseResult">
<include refid="selectBaseWarehouseVo"/>
where warehouse_id = #{warehouseId}
and del_flag = '0'
</select>
<insert id="insertBaseWarehouse" parameterType="BaseWarehouse">
insert into base_warehouse
<trim prefix="(" suffix=")" suffixOverrides=",">
<!-- <if test="warehouseId != null">warehouse_id,</if>-->
<if test="warehouseType != null">warehouse_type,</if>
<if test="warehouseCode != null and warehouseCode != ''">warehouse_code,</if>
<if test="warehouseName != null and warehouseName != ''">warehouse_name,</if>
<if test="factoryCode != null and factoryCode != ''">factory_code,</if>
<if test="factoryName != null and factoryName != ''">factory_name,</if>
<if test="dataSource != null and dataSource != ''">data_source,</if>
<if test="schame != null and schame != ''">schame,</if>
<if test="activeFlag != null and activeFlag != ''">active_flag,</if>
<if test="userDefined1 != null">user_defined1,</if>
<if test="userDefined2 != null">user_defined2,</if>
<if test="userDefined3 != null">user_defined3,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="lineFlag != null">line_flag,</if>
<if test="warehouseType2 != null">warehouse_type2,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<!-- <if test="warehouseId != null">#{warehouseId},</if>-->
<if test="warehouseType != null">#{warehouseType},</if>
<if test="warehouseCode != null and warehouseCode != ''">#{warehouseCode},</if>
<if test="warehouseName != null and warehouseName != ''">#{warehouseName},</if>
<if test="factoryCode != null and factoryCode != ''">#{factoryCode},</if>
<if test="factoryName != null and factoryName != ''">#{factoryName},</if>
<if test="dataSource != null and dataSource != ''">#{dataSource},</if>
<if test="schame != null and schame != ''">#{schame},</if>
<if test="activeFlag != null and activeFlag != ''">#{activeFlag},</if>
<if test="userDefined1 != null">#{userDefined1},</if>
<if test="userDefined2 != null">#{userDefined2},</if>
<if test="userDefined3 != null">#{userDefined3},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="lineFlag != null">#{lineFlag},</if>
<if test="warehouseType2 != null">#{warehouseType2},</if>
</trim>
</insert>
<update id="updateBaseWarehouse" parameterType="BaseWarehouse">
update base_warehouse
<trim prefix="SET" suffixOverrides=",">
<if test="warehouseType != null">warehouse_type = #{warehouseType},</if>
<if test="warehouseCode != null and warehouseCode != ''">warehouse_code = #{warehouseCode},</if>
<if test="warehouseName != null and warehouseName != ''">warehouse_name = #{warehouseName},</if>
<if test="factoryCode != null and factoryCode != ''">factory_code = #{factoryCode},</if>
<if test="factoryName != null and factoryName != ''">factory_name = #{factoryName},</if>
<if test="dataSource != null and dataSource != ''">data_source = #{dataSource},</if>
<if test="schame != null and schame != ''">schame = #{schame},</if>
<if test="activeFlag != null and activeFlag != ''">active_flag = #{activeFlag},</if>
<if test="userDefined1 != null">user_defined1 = #{userDefined1},</if>
<if test="userDefined2 != null">user_defined2 = #{userDefined2},</if>
<if test="userDefined3 != null">user_defined3 = #{userDefined3},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="lineFlag != null">line_flag = #{lineFlag},</if>
<if test="warehouseType2 != null">warehouse_type2 = #{warehouseType2},</if>
</trim>
where warehouse_id = #{warehouseId}
</update>
<update id="deleteBaseWarehouseByWarehouseId" parameterType="String">
update base_warehouse
set del_flag = '1'
where warehouse_id = #{warehouseId}
</update>
<update id="deleteBaseWarehouseByWarehouseIds" parameterType="String">
update base_warehouse
set del_flag = '1'
where warehouse_id in
<foreach item="warehouseId" collection="array" open="(" separator="," close=")">
#{warehouseId}
</foreach>
</update>
<select id="queryCount" parameterType="BaseWarehouse" resultType="java.lang.Integer">
select count(1)
from base_warehouse
and del_flag = '0'
</select>
<select id="checkWarehouseNameUnique" parameterType="BaseWarehouse" resultType="java.lang.String">
select warehouse_name
from base_warehouse
where warehouse_name = #{warehouseName}
and del_flag = '0'
</select>
<select id="checkWarehouseCodeUnique" parameterType="BaseWarehouse" resultType="java.lang.String">
select warehouse_code
from base_warehouse
where warehouse_code = #{warehouseCode}
and del_flag = '0'
</select>
<select id="selectByCode" resultType="java.lang.String">
select DISTINCT user_defined1
from base_warehouse
where warehouse_code = #{locCode}
and del_flag = '0'
</select>
</mapper>