危化品全生命周期管理后端
“djh”
2025-02-24 34f448ffe2aacb496c15ab5da44a24128e0682be
hazmat-system/src/main/resources/mapper/system/HzWarehouseMapper.xml
@@ -22,9 +22,46 @@
        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
@@ -51,4 +88,38 @@
            #{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>