LogisticsManagementMapper.xml 9.15 KB
<?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.trash.office.mapper.LogisticsManagementMapper">
    
    <resultMap type="LogisticsManagement" id="LogisticsManagementResult">
        <result property="id"    column="id"    />
        <result property="type"    column="type"    />
        <result property="deptId"    column="dept_id"    />
        <result property="deptName"    column="dept_name"    />
        <result property="sealType"    column="seal_type"    />
        <result property="sealUpdateTime"    column="seal_update_time"    />
        <result property="sealEndTime"    column="seal_end_time"    />
        <result property="purpose"    column="purpose"    />
        <result property="staff"    column="staff"    />
        <result property="useDate"    column="use_date"    />
        <result property="goodsName"    column="goods_name"    />
        <result property="quantity"    column="quantity"    />
        <result property="status"    column="status"    />
        <result property="createTime"    column="create_time"    />
        <result property="createBy"    column="create_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="updateBy"    column="update_by"    />
    </resultMap>
    <resultMap id="LogisticsManagementSealResult" type="LogisticsManagementSeal" extends="LogisticsManagementResult"></resultMap>
    <resultMap id="LogisticsManagementGoodsResult" type="LogisticsManagementGoods" extends="LogisticsManagementResult"></resultMap>


    <sql id="selectLogisticsManagementVo">
        select id, type, dept_id,dept_name, seal_type, seal_update_time, seal_end_time, purpose, staff, use_date, goods_name, quantity, status, create_time, create_by, update_time, update_by from office_logistics_management
    </sql>

    <select id="selectLogisticsManagementList" parameterType="LogisticsManagement" resultMap="LogisticsManagementResult">
        <include refid="selectLogisticsManagementVo"/>
        <where>  
            <if test="type != null "> and type = #{type}</if>
            <if test="deptName != null and deptName != ''"> and dept_name = #{deptName}</if>
            <if test="sealType != null  and sealType != ''"> and seal_type = #{sealType}</if>
            <if test="sealUpdateTime != null "> and seal_update_time = #{sealUpdateTime}</if>
            <if test="sealEndTime != null "> and seal_end_time = #{sealEndTime}</if>
            <if test="purpose != null  and purpose != ''"> and purpose = #{purpose}</if>
            <if test="staff != null  and staff != ''"> and staff like concat('%', #{staff}, '%')</if>
            <if test="useDate != null "> and use_date = #{useDate}</if>
            <if test="goodsName != null  and goodsName != ''"> and goods_name like concat('%', #{goodsName}, '%')</if>
            <if test="quantity != null "> and quantity = #{quantity}</if>
            <if test="status != null "> and status = #{status}</if>
            <if test="createTime != null "> and create_time > #{createTime}</if>
        </where>
    </select>

    <select id="selectLogisticsManagementSealList" parameterType="LogisticsManagement" resultMap="LogisticsManagementSealResult">
        <include refid="selectLogisticsManagementVo"/>
        <where>
            <if test="type != null "> and type = #{type}</if>
            <if test="deptName != null and deptName != ''"> and dept_name = #{deptName}</if>
            <if test="sealType != null  and sealType != ''"> and seal_type = #{sealType}</if>
            <if test="sealUpdateTime != null "> and seal_update_time = #{sealUpdateTime}</if>
            <if test="sealEndTime != null "> and seal_end_time = #{sealEndTime}</if>
            <if test="purpose != null  and purpose != ''"> and purpose = #{purpose}</if>
            <if test="staff != null  and staff != ''"> and staff like concat('%', #{staff}, '%')</if>
            <if test="useDate != null "> and use_date = #{useDate}</if>
            <if test="goodsName != null  and goodsName != ''"> and goods_name like concat('%', #{goodsName}, '%')</if>
            <if test="quantity != null "> and quantity = #{quantity}</if>
            <if test="status != null "> and status = #{status}</if>
        </where>
    </select>

    <select id="selectLogisticsManagementGoodsList" parameterType="LogisticsManagement" resultMap="LogisticsManagementGoodsResult">
        <include refid="selectLogisticsManagementVo"/>
        <where>
            <if test="type != null "> and type = #{type}</if>
            <if test="deptName != null and deptName != ''"> and dept_name = #{deptName} </if>
            <if test="sealType != null  and sealType != ''"> and seal_type = #{sealType}</if>
            <if test="sealUpdateTime != null "> and seal_update_time = #{sealUpdateTime}</if>
            <if test="sealEndTime != null "> and seal_end_time = #{sealEndTime}</if>
            <if test="purpose != null  and purpose != ''"> and purpose = #{purpose}</if>
            <if test="staff != null  and staff != ''"> and staff like concat('%', #{staff}, '%')</if>
            <if test="useDate != null "> and use_date = #{useDate}</if>
            <if test="goodsName != null  and goodsName != ''"> and goods_name like concat('%', #{goodsName}, '%')</if>
            <if test="quantity != null "> and quantity = #{quantity}</if>
            <if test="status != null "> and status = #{status}</if>
        </where>
    </select>
    
    <select id="selectLogisticsManagementById" parameterType="Long" resultMap="LogisticsManagementResult">
        <include refid="selectLogisticsManagementVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertLogisticsManagement" parameterType="LogisticsManagement" useGeneratedKeys="true" keyProperty="id">
        insert into office_logistics_management
        <trim prefix="(" suffix=")" suffixOverrides=",">
            create_time,
            <if test="type != null">type,</if>
            <if test="deptId != null">dept_id,</if>
            <if test="deptName != null">dept_name,</if>
            <if test="sealType != null">seal_type,</if>
            <if test="sealUpdateTime != null">seal_update_time,</if>
            <if test="sealEndTime != null">seal_end_time,</if>
            <if test="purpose != null">purpose,</if>
            <if test="staff != null">staff,</if>
            <if test="useDate != null">use_date,</if>
            <if test="goodsName != null">goods_name,</if>
            <if test="quantity != null">quantity,</if>
            <if test="status != null">status,</if>
            <if test="createBy != null">create_by,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            now(),
            <if test="type != null">#{type},</if>
            <if test="deptId != null">#{deptId},</if>
            <if test="deptName != null">#{deptName},</if>
            <if test="sealType != null">#{sealType},</if>
            <if test="sealUpdateTime != null">#{sealUpdateTime},</if>
            <if test="sealEndTime != null">#{sealEndTime},</if>
            <if test="purpose != null">#{purpose},</if>
            <if test="staff != null">#{staff},</if>
            <if test="useDate != null">#{useDate},</if>
            <if test="goodsName != null">#{goodsName},</if>
            <if test="quantity != null">#{quantity},</if>
            <if test="status != null">#{status},</if>
            <if test="createBy != null">#{createBy},</if>
         </trim>
    </insert>

    <update id="updateLogisticsManagement" parameterType="LogisticsManagement">
        update office_logistics_management
        <trim prefix="SET" suffixOverrides=",">
            update_time = now(),
            <if test="type != null">type = #{type},</if>
            <if test="deptId != null">dept_id = #{deptId},</if>
            <if test="deptName != null">dept_name = #{deptName},</if>
            <if test="sealType != null">seal_type = #{sealType},</if>
            <if test="sealUpdateTime != null">seal_update_time = #{sealUpdateTime},</if>
            <if test="sealEndTime != null">seal_end_time = #{sealEndTime},</if>
            <if test="purpose != null">purpose = #{purpose},</if>
            <if test="staff != null">staff = #{staff},</if>
            <if test="useDate != null">use_date = #{useDate},</if>
            <if test="goodsName != null">goods_name = #{goodsName},</if>
            <if test="quantity != null">quantity = #{quantity},</if>
            <if test="status != null">status = #{status},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteLogisticsManagementById" parameterType="Long">
        delete from office_logistics_management where id = #{id}
    </delete>

    <delete id="deleteLogisticsManagementByIds" parameterType="String">
        delete from office_logistics_management where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    
</mapper>