You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			254 lines
		
	
	
		
			9.0 KiB
		
	
	
	
		
			XML
		
	
			
		
		
	
	
			254 lines
		
	
	
		
			9.0 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.glxp.api.admin.dao.inventory.InvWarehouseDao">
 | 
						|
 | 
						|
    <select id="filterInvWarehouse" parameterType="com.glxp.api.admin.req.inventory.FilterInvWarehouseRequest"
 | 
						|
            resultType="com.glxp.api.admin.entity.inventory.InvWarehouseEntity">
 | 
						|
        select * ,(select name from inv_warehouse WHERE a.pcode = code) pName
 | 
						|
        FROM inv_warehouse a
 | 
						|
        <where>
 | 
						|
            <if test="id != '' and id != null">
 | 
						|
                AND a.id = #{id}
 | 
						|
            </if>
 | 
						|
            <if test="pid != '' and pid != null">
 | 
						|
                AND a.pid = #{pid}
 | 
						|
            </if>
 | 
						|
            <if test="code != '' and code != null">
 | 
						|
                AND a.code = #{code}
 | 
						|
            </if>
 | 
						|
            <if test="name != '' and name != null">
 | 
						|
                AND a.name like concat('%',#{name},'%')
 | 
						|
            </if>
 | 
						|
            <if test="advanceType != null">
 | 
						|
                AND a.advanceType = #{advanceType}
 | 
						|
            </if>
 | 
						|
            <if test="status != null">
 | 
						|
                AND a.status = #{status}
 | 
						|
            </if>
 | 
						|
            <if test="isDefault != null">
 | 
						|
                AND a.isDefault = #{isDefault}
 | 
						|
            </if>
 | 
						|
            <if test="pcode != null">
 | 
						|
                AND a.pcode = #{pcode}
 | 
						|
            </if>
 | 
						|
            <if test="level != null">
 | 
						|
                AND a.level = #{level}
 | 
						|
            </if>
 | 
						|
            <if test="spUse != null">
 | 
						|
                AND a.spUse = #{spUse}
 | 
						|
            </if>
 | 
						|
        </where>
 | 
						|
 | 
						|
    </select>
 | 
						|
 | 
						|
    <select id="filterAllByUser" parameterType="com.glxp.api.admin.req.inventory.FilterInvWarehouseRequest"
 | 
						|
            resultType="com.glxp.api.admin.entity.inventory.InvWarehouseEntity">
 | 
						|
        select inv_warehouse.* from inv_warehouse INNER JOIN inv_warehouse_user
 | 
						|
        on inv_warehouse.`code` =inv_warehouse_user.code
 | 
						|
        <where>
 | 
						|
            <if test="id != '' and id != null">
 | 
						|
                AND id = #{id}
 | 
						|
            </if>
 | 
						|
            <if test="pid != '' and pid != null">
 | 
						|
                AND pid = #{pid}
 | 
						|
            </if>
 | 
						|
            <if test="code != '' and code != null">
 | 
						|
                AND inv_warehouse.code = #{code}
 | 
						|
            </if>
 | 
						|
            <if test="name != '' and name != null">
 | 
						|
                AND name = #{name}
 | 
						|
            </if>
 | 
						|
            <if test=" advanceType != null">
 | 
						|
                AND advanceType = #{advanceType}
 | 
						|
            </if>
 | 
						|
            <if test="isDefault != null">
 | 
						|
                AND isDefault = #{isDefault}
 | 
						|
            </if>
 | 
						|
            <if test="pcode != null">
 | 
						|
                AND pcode = #{pcode}
 | 
						|
            </if>
 | 
						|
            <if test="userId != null">
 | 
						|
                AND inv_warehouse_user.userId = #{userId}
 | 
						|
            </if>
 | 
						|
 | 
						|
            <if test="level != null">
 | 
						|
                AND `level` = #{level}
 | 
						|
            </if>
 | 
						|
            <if test="spUse != null">
 | 
						|
                AND spUse = #{spUse}
 | 
						|
            </if>
 | 
						|
        </where>
 | 
						|
        group by inv_warehouse.code
 | 
						|
    </select>
 | 
						|
 | 
						|
 | 
						|
    <select id="selectById" parameterType="Map"
 | 
						|
            resultType="com.glxp.api.admin.entity.inventory.InvWarehouseEntity">
 | 
						|
        SELECT *
 | 
						|
        FROM inv_warehouse
 | 
						|
        WHERE id = #{id}
 | 
						|
 | 
						|
    </select>
 | 
						|
 | 
						|
    <select id="selectMaxCode" parameterType="com.glxp.api.admin.req.inventory.FilterInvWarehouseRequest"
 | 
						|
            resultType="com.glxp.api.admin.entity.inventory.InvWarehouseEntity">
 | 
						|
        select max(code) as code from inv_warehouse
 | 
						|
        <where>
 | 
						|
            <if test="id != '' and id != null">
 | 
						|
                AND id = #{id}
 | 
						|
            </if>
 | 
						|
            <if test="pid != '' and pid != null">
 | 
						|
                AND pid = #{pid}
 | 
						|
            </if>
 | 
						|
            <if test="code != '' and code != null">
 | 
						|
                AND code = #{code}
 | 
						|
            </if>
 | 
						|
            <if test="name != '' and name != null">
 | 
						|
                AND name = #{name}
 | 
						|
            </if>
 | 
						|
            <if test=" advanceType != null">
 | 
						|
                AND advanceType = #{advanceType}
 | 
						|
            </if>
 | 
						|
            <if test="isDefault != null">
 | 
						|
                AND isDefault = #{isDefault}
 | 
						|
            </if>
 | 
						|
            <if test="pcode != null">
 | 
						|
                AND pcode = #{pcode}
 | 
						|
            </if>
 | 
						|
            <if test="level != null">
 | 
						|
                AND `level` = #{level}
 | 
						|
            </if>
 | 
						|
        </where>
 | 
						|
 | 
						|
    </select>
 | 
						|
 | 
						|
 | 
						|
    <select id="filterGroupInvWarehouse" parameterType="com.glxp.api.admin.req.inventory.FilterInvWarehouseRequest"
 | 
						|
            resultType="com.glxp.api.admin.res.inventory.InvProductResponse">
 | 
						|
        SELECT * FROM inv_warehouse
 | 
						|
        <where>
 | 
						|
            <if test="id != '' and id != null">
 | 
						|
                AND id = #{id}
 | 
						|
            </if>
 | 
						|
            <if test="pid != '' and pid != null">
 | 
						|
                AND pid = #{pid}
 | 
						|
            </if>
 | 
						|
            <if test="code != '' and code != null">
 | 
						|
                AND code = #{code}
 | 
						|
            </if>
 | 
						|
            <if test="name != '' and name != null">
 | 
						|
                AND name = #{name}
 | 
						|
            </if>
 | 
						|
            <if test="advanceType != '' and advanceType != null">
 | 
						|
                AND advanceType = #{advanceType}
 | 
						|
            </if>
 | 
						|
            <if test="isDefault != '' and isDefault != null">
 | 
						|
                AND isDefault = #{isDefault}
 | 
						|
            </if>
 | 
						|
            <if test="pcode != null">
 | 
						|
                AND pcode = #{pcode}
 | 
						|
            </if>
 | 
						|
            <if test="spUse != null">
 | 
						|
                AND spUse = #{spUse}
 | 
						|
            </if>
 | 
						|
            <if test="updateTime!=null and updateTime!=''">
 | 
						|
                <![CDATA[   and DATE_FORMAT(updateTime, '%Y-%m-%d %H:%i:%S')>=  DATE_FORMAT(#{updateTime}, '%Y-%m-%d %H:%i:%S')   ]]>
 | 
						|
            </if>
 | 
						|
            <if test="lastUpdateTime!=null and lastUpdateTime!=''">
 | 
						|
                <![CDATA[   and DATE_FORMAT(updateTime, '%Y-%m-%d %H:%i:%S')>=  DATE_FORMAT(#{lastUpdateTime}, '%Y-%m-%d %H:%i:%S')   ]]>
 | 
						|
            </if>
 | 
						|
        </where>
 | 
						|
 | 
						|
    </select>
 | 
						|
 | 
						|
    <select id="getNameByCode" resultType="java.lang.String">
 | 
						|
        select name
 | 
						|
        from inv_warehouse
 | 
						|
        where code = #{fromCorpId}
 | 
						|
    </select>
 | 
						|
 | 
						|
 | 
						|
    <insert id="insertInvWarehouse" keyProperty="id"
 | 
						|
            parameterType="com.glxp.api.admin.entity.inventory.InvWarehouseEntity">
 | 
						|
        replace
 | 
						|
        INTO inv_warehouse
 | 
						|
        (pid, code, name, advanceType, isDefault,
 | 
						|
         status, updateTime, remark,`level`,pcode, spUse,thirdId, thirdId1, thirdId2, thirdId3, thirdId4)
 | 
						|
        values (
 | 
						|
        #{pid},
 | 
						|
        #{code},
 | 
						|
        #{name},
 | 
						|
        #{advanceType},
 | 
						|
        #{isDefault},
 | 
						|
        #{status},
 | 
						|
        #{updateTime},
 | 
						|
        #{remark},
 | 
						|
        #{level},
 | 
						|
        #{pcode},
 | 
						|
        #{spUse},
 | 
						|
        #{thirdId},
 | 
						|
        #{thirdId1},
 | 
						|
        #{thirdId2},
 | 
						|
        #{thirdId3},
 | 
						|
        #{thirdId4}
 | 
						|
        )
 | 
						|
    </insert>
 | 
						|
 | 
						|
 | 
						|
    <delete id="deleteById" parameterType="Map">
 | 
						|
        DELETE
 | 
						|
        FROM inv_warehouse
 | 
						|
        WHERE id = #{id}
 | 
						|
    </delete>
 | 
						|
 | 
						|
    <update id="updateInvWarehouse" parameterType="com.glxp.api.admin.entity.inventory.InvWarehouseEntity">
 | 
						|
        UPDATE inv_warehouse
 | 
						|
        <trim prefix="set" suffixOverrides=",">
 | 
						|
            <if test="pid != null">pid=#{pid},</if>
 | 
						|
            <if test="name != null">name=#{name},</if>
 | 
						|
            <if test="code != null">code=#{code},</if>
 | 
						|
            <if test="advanceType != null">advanceType=#{advanceType},</if>
 | 
						|
            <if test="isDefault != null">isDefault=#{isDefault},</if>
 | 
						|
            <if test="status != null">status=#{status},</if>
 | 
						|
            <if test="updateTime != null">updateTime=#{updateTime},</if>
 | 
						|
            <if test="remark != null">remark=#{remark},</if>
 | 
						|
            <if test="thirdId != null">remark=#{thirdId},</if>
 | 
						|
            <if test="thirdId1 != null">remark=#{thirdId1},</if>
 | 
						|
            <if test="thirdId2 != null">remark=#{thirdId2},</if>
 | 
						|
            <if test="thirdId3 != null">remark=#{thirdId3},</if>
 | 
						|
            <if test="thirdId4 != null">remark=#{thirdId4},</if>
 | 
						|
            <if test="level != null">`level`=#{level},</if>
 | 
						|
            <if test="pcode != null">pcode=#{pcode},</if>
 | 
						|
            <if test="spUse != null">spUse=#{spUse},</if>
 | 
						|
        </trim>
 | 
						|
        WHERE id = #{id}
 | 
						|
    </update>
 | 
						|
 | 
						|
    <update id="updateThridId"  parameterType="Map">
 | 
						|
        update inv_warehouse
 | 
						|
        set ${sysId} = ${thridWarehouseId,jdbcType=VARCHAR}
 | 
						|
        where id = ${id}
 | 
						|
    </update>
 | 
						|
    <insert id="importInvWarehouse" parameterType="java.util.List">
 | 
						|
        replace into inv_warehouse (id, pid, code, `name`, advanceType, isDefault, status,
 | 
						|
        updateTime, remark, `level`, pcode, thirdId, thirdId1, thirdId2, thirdId3,
 | 
						|
        thirdId4,spUse) values
 | 
						|
        <foreach collection="invWarehouseEntities" item="item" index="index" separator=",">
 | 
						|
            (#{item.id},
 | 
						|
            #{item.pid},
 | 
						|
            #{item.code},
 | 
						|
            #{item.name},
 | 
						|
            #{item.advanceType},
 | 
						|
            #{item.isDefault},
 | 
						|
            #{item.status},
 | 
						|
            #{item.updateTime},
 | 
						|
            #{item.remark}, #{item.level},
 | 
						|
            #{item.pcode}, #{item.thirdId},
 | 
						|
            #{item.thirdId1}, #{item.thirdId2},
 | 
						|
            #{item.thirdId3}, #{item.thirdId4},#{item.spUse})
 | 
						|
        </foreach>
 | 
						|
    </insert>
 | 
						|
 | 
						|
 | 
						|
</mapper> |