emis-service/emis-wms/src/main/resources/mapper/WmsAreaMapper.xml

160 lines
9.1 KiB
XML
Raw Normal View History

2024-01-11 08:46:48 +00:00
<?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.xdadan.erp.wms.mapper.WmsAreaMapper">
<resultMap type="WmsArea" id="WmsAreaResult">
<result property="id" column="id" />
<result property="areaNo" column="area_no" />
<result property="areaName" column="area_name" />
<result property="warehouseId" column="warehouse_id" />
<result property="parentId" column="parent_id" />
<result property="coordinate" column="coordinate" />
<result property="ext1" column="ext1" />
<result property="ext2" column="ext2" />
<result property="ext3" column="ext3" />
<result property="ext4" column="ext4" />
<result property="ext5" column="ext5" />
<result property="ext6" column="ext6" />
<result property="remark" column="remark" />
<result property="tenantId" column="tenant_id" />
<result property="delFlag" column="del_flag" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<association property="warehouse" column="warehouse_id" select="selectWarehouseByWarehouseId"/>
</resultMap>
<resultMap id="WmsWarehouseResult" type="WmsWarehouse" >
<result property="id" column="id" />
<result property="code" column="code" />
<result property="name" column="name" />
</resultMap>
<sql id="selectWmsAreaVo">
select id, area_no, area_name, warehouse_id, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time from wms_area
</sql>
<select id="selectWarehouseByWarehouseId" parameterType="java.lang.Long" resultMap="WmsWarehouseResult">
select a.id,a.code,a.name
from wms_warehouse a
where a.id = #{warehouseId}
</select>
<select id="selectWmsAreaList" parameterType="WmsArea" resultMap="WmsAreaResult">
<include refid="selectWmsAreaVo"/>
<where>
<if test="id != null "> and id = #{id}</if>
<if test="areaNo != null and areaNo != ''"> and area_no like concat('%', #{areaNo}, '%')</if>
<if test="areaName != null and areaName != ''"> and area_name like concat('%', #{areaName}, '%')</if>
<if test="warehouseId != null "> and warehouse_id = #{warehouseId}</if>
<if test="parentId != null "> and parent_id = #{parentId}</if>
<if test="coordinate != null and coordinate != ''"> and coordinate like concat('%', #{coordinate}, '%')</if>
<if test="ext1 != null and ext1 != ''"> and ext1 like concat('%', #{ext1}, '%')</if>
<if test="ext2 != null and ext2 != ''"> and ext2 like concat('%', #{ext2}, '%')</if>
<if test="ext3 != null and ext3 != ''"> and ext3 like concat('%', #{ext3}, '%')</if>
<if test="ext4 != null and ext4 != ''"> and ext4 like concat('%', #{ext4}, '%')</if>
<if test="ext5 != null and ext5 != ''"> and ext5 like concat('%', #{ext5}, '%')</if>
<if test="ext6 != null and ext6 != ''"> and ext6 like concat('%', #{ext6}, '%')</if>
<if test="remark != null and remark != ''"> and remark like concat('%', #{remark}, '%')</if>
<if test="tenantId != null and tenantId != ''"> and tenant_id like concat('%', #{tenantId}, '%')</if>
<if test="delFlag != null and delFlag != ''"> and del_flag = #{delFlag}</if>
<if test="createBy != null and createBy != ''"> and create_by = #{createBy}</if>
<if test="createTime != null "> and create_time = #{createTime}</if>
<if test="updateBy != null and updateBy != ''"> and update_by = #{updateBy}</if>
<if test="updateTime != null "> and update_time = #{updateTime}</if>
</where>
order by create_time desc
</select>
<select id="selectWmsAreaById" parameterType="Long" resultMap="WmsAreaResult">
select id, area_no, area_name, warehouse_id, parent_id, coordinate, ext1, ext2, ext3, ext4, ext5, ext6, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time
from wms_area a
where a.id = #{id}
</select>
<insert id="insertWmsArea" parameterType="WmsArea">
insert into wms_area
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="areaNo != null and areaNo != ''">area_no,</if>
<if test="areaName != null and areaName != ''">area_name,</if>
<if test="warehouseId != null">warehouse_id,</if>
<if test="parentId != null">parent_id,</if>
<if test="coordinate != null and coordinate != ''">coordinate,</if>
<if test="ext1 != null and ext1 != ''">ext1,</if>
<if test="ext2 != null and ext2 != ''">ext2,</if>
<if test="ext3 != null and ext3 != ''">ext3,</if>
<if test="ext4 != null and ext4 != ''">ext4,</if>
<if test="ext5 != null and ext5 != ''">ext5,</if>
<if test="ext6 != null and ext6 != ''">ext6,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="tenantId != null and tenantId != ''">tenant_id,</if>
<if test="delFlag != null and delFlag != ''">del_flag,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="areaNo != null and areaNo != ''">#{areaNo},</if>
<if test="areaName != null and areaName != ''">#{areaName},</if>
<if test="warehouseId != null">#{warehouseId},</if>
<if test="parentId != null">#{parentId},</if>
<if test="coordinate != null and coordinate != ''">#{coordinate},</if>
<if test="ext1 != null and ext1 != ''">#{ext1},</if>
<if test="ext2 != null and ext2 != ''">#{ext2},</if>
<if test="ext3 != null and ext3 != ''">#{ext3},</if>
<if test="ext4 != null and ext4 != ''">#{ext4},</if>
<if test="ext5 != null and ext5 != ''">#{ext5},</if>
<if test="ext6 != null and ext6 != ''">#{ext6},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="tenantId != null and tenantId != ''">#{tenantId},</if>
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateWmsArea" parameterType="WmsArea">
update wms_area
<trim prefix="SET" suffixOverrides=",">
<if test="areaNo != null and areaNo != ''">area_no = #{areaNo},</if>
<if test="areaName != null and areaName != ''">area_name = #{areaName},</if>
<if test="warehouseId != null">warehouse_id = #{warehouseId},</if>
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="coordinate != null and coordinate != ''">coordinate = #{coordinate},</if>
<if test="ext1 != null and ext1 != ''">ext1 = #{ext1},</if>
<if test="ext2 != null and ext2 != ''">ext2 = #{ext2},</if>
<if test="ext3 != null and ext3 != ''">ext3 = #{ext3},</if>
<if test="ext4 != null and ext4 != ''">ext4 = #{ext4},</if>
<if test="ext5 != null and ext5 != ''">ext5 = #{ext5},</if>
<if test="ext6 != null and ext6 != ''">ext6 = #{ext6},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="tenantId != null and tenantId != ''">tenant_id = #{tenantId},</if>
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteWmsAreaById" parameterType="Long">
delete from wms_area where id = #{id}
</delete>
<delete id="deleteWmsAreaByIds" parameterType="String">
delete from wms_area where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>