<?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.gkhy.hazmat.system.mapper.HzWarehouseMapper">
|
<resultMap type="com.gkhy.hazmat.system.domain.HzWarehouse" id="HzWarehouseResult">
|
<result property="id" column="id" />
|
<result property="name" column="name" />
|
<result property="address" column="address" />
|
<result property="companyId" column="company_id" />
|
<result property="delFlag" column="del_flag" />
|
<result property="version" column="version" />
|
<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="companyName" column="company_name"/>
|
</resultMap>
|
|
<sql id="selectWarehouseVo">
|
select a.id, a.name, a.address, a.version, a.company_id,a.del_flag,a.create_by, a.create_time, a.update_by, a.update_time, a.remark,
|
b.name as company_name
|
from hz_warehouse a
|
left join sys_company b on b.id=a.company_id
|
</sql>
|
<insert id="insertCupboard">
|
insert into hz_warehouse_cupboard
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="warehouseId != null">warehouse_id,</if>
|
<if test="cupboardName != null and cupboardName != ''">cupboard_name,</if>
|
<if test="mess != null and mess != ''">mess,</if>
|
<if test="createBy != null">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>
|
<if test="delFlag != null">del_flag,</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="warehouseId != null">#{warehouseId},</if>
|
<if test="cupboardName != null and cupboardName != ''">#{cupboardName},</if>
|
<if test="mess != null and mess != ''">#{mess},</if>
|
<if test="createBy != null">#{createBy},</if>
|
<if test="createTime != null">#{createTime},</if>
|
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
|
<if test="updateTime != null">#{updateTime},</if>
|
<if test="delFlag != null">#{delFlag},</if>
|
</trim>
|
</insert>
|
<update id="deleteWarehouseById" parameterType="java.lang.Long">
|
update hz_warehouse set del_flag=1 where id=#{warehouseId}
|
</update>
|
<update id="updateCupboard">
|
update hz_warehouse_cupboard
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="cupboardName != null">cupboard_name = #{cupboardName},</if>
|
<if test="mess != null and mess != ''">mess = #{mess},</if>
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
</trim>
|
where id = #{id}
|
</update>
|
<delete id="deleteByCupboardId">
|
delete from hz_warehouse_cupboard where id = #{cupboardId}
|
</delete>
|
|
<select id="checkNameUnique" resultType="com.gkhy.hazmat.system.domain.HzWarehouse">
|
select id,name from hz_warehouse where name=#{name} and company_id=#{companyId} and del_flag=0 limit 1
|
</select>
|
|
<select id="selectWarehouseList" resultMap="HzWarehouseResult"
|
parameterType="com.gkhy.hazmat.system.domain.HzWarehouse">
|
<include refid="selectWarehouseVo"/>
|
<where>
|
and a.del_flag=0
|
<if test="name != null and name != ''">
|
AND a.name like concat('%', #{name}, '%')
|
</if>
|
<if test="companyId != null">
|
AND a.company_id= #{companyId}
|
</if>
|
</where>
|
order by a.id desc
|
</select>
|
|
<select id="selectWarehouseListByIds" resultType="com.gkhy.hazmat.system.domain.HzWarehouse">
|
select id,name from hz_warehouse where del_flag=0 and id in
|
<foreach collection="warehouseIds" item="warehouse" open="(" separator="," close=")">
|
#{warehouse}
|
</foreach>
|
</select>
|
<select id="selectByWarehouseIdAndCupboardName" resultType="com.gkhy.hazmat.system.domain.HzWarehouseCupboard">
|
SELECT
|
id,
|
warehouse_id,
|
cupboard_name,
|
mess,
|
create_by,
|
create_time,
|
update_by,
|
update_time,
|
del_flag
|
FROM
|
hz_warehouse_cupboard
|
WHERE
|
warehouse_id = #{id} and cupboard_name =#{cupboardName}
|
AND del_flag = 0
|
</select>
|
<select id="selectByWarehouseId" resultType="com.gkhy.hazmat.system.domain.HzWarehouseCupboard">
|
SELECT
|
id,
|
warehouse_id,
|
cupboard_name,
|
mess,
|
create_by,
|
create_time,
|
update_by,
|
update_time,
|
del_flag
|
FROM
|
hz_warehouse_cupboard
|
WHERE
|
warehouse_id = #{id}
|
AND del_flag = 0
|
</select>
|
</mapper>
|