190 lines
11 KiB
XML
190 lines
11 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.bonus.canteen.core.ims.mapper.WarehouseInfoMapper">
|
|
<resultMap type="com.bonus.canteen.core.ims.domain.WarehouseInfo" id="ImsWarehouseInfoResult">
|
|
<result property="warehouseId" column="warehouse_id" />
|
|
<result property="parentId" column="parent_id" />
|
|
<result property="categoryId" column="category_id" />
|
|
<result property="areaId" column="area_id" />
|
|
<result property="areaName" column="area_name" />
|
|
<result property="canteenId" column="canteen_id" />
|
|
<result property="canteenName" column="canteen_name" />
|
|
<result property="warehouseCode" column="warehouse_code" />
|
|
<result property="warehouseName" column="warehouse_name" />
|
|
<result property="userId" column="user_id" />
|
|
<result property="manager" column="manager" />
|
|
<result property="managerPhone" column="manager_phone" />
|
|
<result property="fetchUserId" column="fetch_user_id" />
|
|
<result property="regionProvince" column="region_province" />
|
|
<result property="regionCity" column="region_city" />
|
|
<result property="regionDistrict" column="region_district" />
|
|
<result property="address" column="address" />
|
|
<result property="warehouseType" column="warehouse_type" />
|
|
<result property="ifUseWarehouseArea" column="if_use_warehouse_area" />
|
|
<result property="ifUseWarehouseLocation" column="if_use_warehouse_location" />
|
|
<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" />
|
|
</resultMap>
|
|
|
|
<sql id="selectImsWarehouseInfoVo">
|
|
select iwi.warehouse_id, iwi.parent_id, iwi.category_id, iwi.area_id, iwi.canteen_id, iwi.warehouse_code,
|
|
iwi.warehouse_name, iwi.user_id,su.nick_name as manager, iwi.manager_phone, iwi.fetch_user_id, iwi.region_province, iwi.region_city,
|
|
iwi.region_district, iwi.address, iwi.warehouse_type, iwi.if_use_warehouse_area, iwi.if_use_warehouse_location,
|
|
iwi.del_flag, iwi.create_by, iwi.create_time, iwi.update_by, iwi.update_time, bc.canteen_name, ba.area_name
|
|
from ims_warehouse_info iwi
|
|
left join basic_canteen bc on bc.canteen_id = iwi.canteen_id
|
|
left join basic_area ba on ba.area_id = bc.area_id
|
|
LEFT JOIN sys_user su on su.user_id =iwi.manager
|
|
</sql>
|
|
|
|
<select id="selectImsWarehouseInfoList" parameterType="com.bonus.canteen.core.ims.domain.WarehouseInfo" resultMap="ImsWarehouseInfoResult">
|
|
<include refid="selectImsWarehouseInfoVo"/>
|
|
<where>
|
|
<if test="parentId != null "> and iwi.parent_id = #{parentId}</if>
|
|
<if test="categoryId != null "> and iwi.category_id = #{categoryId}</if>
|
|
<if test="areaId != null "> and iwi.area_id = #{areaId}</if>
|
|
<if test="canteenId != null "> and iwi.canteen_id = #{canteenId}</if>
|
|
<if test="warehouseCode != null and warehouseCode != ''"> and iwi.warehouse_code = #{warehouseCode}</if>
|
|
<if test="warehouseName != null and warehouseName != ''"> and iwi.warehouse_name like concat('%', #{warehouseName}, '%')</if>
|
|
<if test="userId != null "> and iwi.user_id = #{userId}</if>
|
|
<if test="manager != null and manager != ''"> and iwi.manager = #{manager}</if>
|
|
<if test="fetchUserId != null "> and iwi.fetch_user_id = #{fetchUserId}</if>
|
|
<if test="regionProvince != null and regionProvince != ''"> and iwi.region_province = #{regionProvince}</if>
|
|
<if test="regionCity != null and regionCity != ''"> and iwi.region_city = #{regionCity}</if>
|
|
<if test="regionDistrict != null and regionDistrict != ''"> and iwi.region_district = #{regionDistrict}</if>
|
|
<if test="address != null and address != ''"> and iwi.address = #{address}</if>
|
|
<if test="warehouseType != null "> and iwi.warehouse_type = #{warehouseType}</if>
|
|
<if test="ifUseWarehouseArea != null "> and iwi.if_use_warehouse_area = #{ifUseWarehouseArea}</if>
|
|
<if test="ifUseWarehouseLocation != null "> and iwi.if_use_warehouse_location = #{ifUseWarehouseLocation}</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectImsWarehouseInfoByWarehouseId" parameterType="Long" resultMap="ImsWarehouseInfoResult">
|
|
<include refid="selectImsWarehouseInfoVo"/>
|
|
where iwi.warehouse_id = #{warehouseId}
|
|
</select>
|
|
|
|
<select id="getImsWarehouseCountByAreaIds" resultType="Integer">
|
|
select count(1)
|
|
from ims_warehouse_info
|
|
where area_id in
|
|
<foreach item="areaId" collection="array" open="(" separator="," close=")">
|
|
#{areaId}
|
|
</foreach>
|
|
</select>
|
|
<select id="findWarehouseCode" resultType="java.lang.Integer">
|
|
select count(1)
|
|
from ims_warehouse_info
|
|
where warehouse_code = #{bean.warehouseCode}
|
|
<if test="isAdd">
|
|
and warehouse_id != #{bean.warehouseId}
|
|
</if>
|
|
</select>
|
|
|
|
<insert id="insertImsWarehouseInfo" parameterType="com.bonus.canteen.core.ims.domain.WarehouseInfo" useGeneratedKeys="true" keyProperty="warehouseId">
|
|
insert into ims_warehouse_info
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="parentId != null">parent_id,</if>
|
|
<if test="categoryId != null">category_id,</if>
|
|
<if test="areaId != null">area_id,</if>
|
|
<if test="canteenId != null">canteen_id,</if>
|
|
<if test="warehouseCode != null">warehouse_code,</if>
|
|
<if test="warehouseName != null and warehouseName != ''">warehouse_name,</if>
|
|
<if test="userId != null">user_id,</if>
|
|
<if test="manager != null">manager,</if>
|
|
<if test="managerPhone != null">manager_phone,</if>
|
|
<if test="fetchUserId != null">fetch_user_id,</if>
|
|
<if test="regionProvince != null">region_province,</if>
|
|
<if test="regionCity != null">region_city,</if>
|
|
<if test="regionDistrict != null">region_district,</if>
|
|
<if test="address != null">address,</if>
|
|
<if test="warehouseType != null">warehouse_type,</if>
|
|
<if test="ifUseWarehouseArea != null">if_use_warehouse_area,</if>
|
|
<if test="ifUseWarehouseLocation != null">if_use_warehouse_location,</if>
|
|
<if test="delFlag != null">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="parentId != null">#{parentId},</if>
|
|
<if test="categoryId != null">#{categoryId},</if>
|
|
<if test="areaId != null">#{areaId},</if>
|
|
<if test="canteenId != null">#{canteenId},</if>
|
|
<if test="warehouseCode != null">#{warehouseCode},</if>
|
|
<if test="warehouseName != null and warehouseName != ''">#{warehouseName},</if>
|
|
<if test="userId != null">#{userId},</if>
|
|
<if test="manager != null">#{manager},</if>
|
|
<if test="managerPhone != null">#{managerPhone},</if>
|
|
<if test="fetchUserId != null">#{fetchUserId},</if>
|
|
<if test="regionProvince != null">#{regionProvince},</if>
|
|
<if test="regionCity != null">#{regionCity},</if>
|
|
<if test="regionDistrict != null">#{regionDistrict},</if>
|
|
<if test="address != null">#{address},</if>
|
|
<if test="warehouseType != null">#{warehouseType},</if>
|
|
<if test="ifUseWarehouseArea != null">#{ifUseWarehouseArea},</if>
|
|
<if test="ifUseWarehouseLocation != null">#{ifUseWarehouseLocation},</if>
|
|
<if test="delFlag != null">#{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="updateImsWarehouseInfo" parameterType="com.bonus.canteen.core.ims.domain.WarehouseInfo">
|
|
update ims_warehouse_info
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="parentId != null">parent_id = #{parentId},</if>
|
|
<if test="categoryId != null">category_id = #{categoryId},</if>
|
|
<if test="areaId != null">area_id = #{areaId},</if>
|
|
<if test="canteenId != null">canteen_id = #{canteenId},</if>
|
|
<if test="warehouseCode != null">warehouse_code = #{warehouseCode},</if>
|
|
<if test="warehouseName != null and warehouseName != ''">warehouse_name = #{warehouseName},</if>
|
|
<if test="userId != null">user_id = #{userId},</if>
|
|
<if test="manager != null">manager = #{manager},</if>
|
|
<if test="managerPhone != null">manager_phone = #{managerPhone},</if>
|
|
<if test="fetchUserId != null">fetch_user_id = #{fetchUserId},</if>
|
|
<if test="regionProvince != null">region_province = #{regionProvince},</if>
|
|
<if test="regionCity != null">region_city = #{regionCity},</if>
|
|
<if test="regionDistrict != null">region_district = #{regionDistrict},</if>
|
|
<if test="address != null">address = #{address},</if>
|
|
<if test="warehouseType != null">warehouse_type = #{warehouseType},</if>
|
|
<if test="ifUseWarehouseArea != null">if_use_warehouse_area = #{ifUseWarehouseArea},</if>
|
|
<if test="ifUseWarehouseLocation != null">if_use_warehouse_location = #{ifUseWarehouseLocation},</if>
|
|
<if test="delFlag != null">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 warehouse_id = #{warehouseId}
|
|
</update>
|
|
|
|
<delete id="deleteImsWarehouseInfoByWarehouseId" parameterType="Long">
|
|
delete from ims_warehouse_info where warehouse_id = #{warehouseId}
|
|
</delete>
|
|
|
|
<delete id="deleteImsWarehouseInfoByWarehouseIds" parameterType="String">
|
|
delete from ims_warehouse_info where warehouse_id in
|
|
<foreach item="warehouseId" collection="array" open="(" separator="," close=")">
|
|
#{warehouseId}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<select id="findWarehouseName" resultType="int">
|
|
select count(1)
|
|
from ims_warehouse_info
|
|
where warehouse_name = #{bean.warehouseName}
|
|
<if test="isAdd">
|
|
and warehouse_id != #{bean.warehouseId}
|
|
</if>
|
|
</select>
|
|
</mapper>
|