|
@@ -0,0 +1,158 @@
|
|
|
+<?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.ruoyi.enterprise.mapper.SupplyMapper">
|
|
|
+
|
|
|
+ <resultMap type="Supply" id="SupplyResult">
|
|
|
+ <result property="sGuid" column="s_guid" />
|
|
|
+ <result property="entGuid" column="ent_guid" />
|
|
|
+ <result property="epGuid" column="ep_guid" />
|
|
|
+ <result property="spGuid" column="sp_guid" />
|
|
|
+ <result property="tenantId" column="tenantId" />
|
|
|
+ <result property="deleteAt" column="delete_at" />
|
|
|
+ <result property="updateAt" column="update_at" />
|
|
|
+ <result property="creatAt" column="creat_at" />
|
|
|
+ <result property="rowId" column="row_id" />
|
|
|
+ <result property="updId" column="upd_id" />
|
|
|
+ <result property="deleter" column="deleter" />
|
|
|
+ <result property="updator" column="updator" />
|
|
|
+ <result property="creator" column="creator" />
|
|
|
+ <result property="spName" column="sp_name" />
|
|
|
+ <result property="entName" column="ent_name" />
|
|
|
+ <result property="productName" column="product_name" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="selectSupplyVo">
|
|
|
+ select s_guid, ent_guid, ep_guid, sp_guid, tenantId, delete_at, update_at, creat_at, row_id, upd_id, deleter, updator, creator from t_supply
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <sql id="XQuery">
|
|
|
+ SELECT ROW_NUMBER() OVER (ORDER BY t_supply.s_guid) AS id, t_supply.s_guid AS s_guid, t_supply.ep_guid AS ep_guid, t_company.ent_name AS sp_name
|
|
|
+ FROM t_company
|
|
|
+ INNER JOIN t_supply ON t_supply.sp_guid = t_company.ent_guid
|
|
|
+ <where>
|
|
|
+ <if test="spGuid != null">
|
|
|
+ AND t_supply.sp_guid = #{spGuid}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <sql id="YQuery">
|
|
|
+ SELECT ROW_NUMBER() OVER (ORDER BY t_supply.s_guid) AS id, t_company.ent_name AS ent_name
|
|
|
+ FROM t_ent_products
|
|
|
+ INNER JOIN t_supply ON t_supply.ep_guid = t_ent_products.ep_guid
|
|
|
+ INNER JOIN t_company ON t_ent_products.entguid = t_company.ent_guid
|
|
|
+ <where>
|
|
|
+ <if test="spGuid != null">
|
|
|
+ AND t_supply.sp_guid = #{spGuid}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <sql id="ZQuery">
|
|
|
+ SELECT ROW_NUMBER() OVER (ORDER BY t_supply.s_guid) AS id, t_product.product_name AS product_name
|
|
|
+ FROM t_ent_products
|
|
|
+ INNER JOIN t_supply ON t_supply.ep_guid = t_ent_products.ep_guid
|
|
|
+ INNER JOIN t_product ON t_ent_products.proguid = t_product.product_guid
|
|
|
+ <where>
|
|
|
+ <if test="spGuid != null">
|
|
|
+ AND t_supply.sp_guid = #{spGuid}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectSupplyList" parameterType="Supply" resultMap="SupplyResult">
|
|
|
+ WITH X AS (
|
|
|
+ <include refid="XQuery"/>
|
|
|
+ ),
|
|
|
+ Y AS (
|
|
|
+ <include refid="YQuery"/>
|
|
|
+ ),
|
|
|
+ Z AS (
|
|
|
+ <include refid="ZQuery"/>
|
|
|
+ )
|
|
|
+ SELECT X.sp_name, X.s_guid, X.ep_guid, Y.ent_name, Z.product_name
|
|
|
+ FROM X
|
|
|
+ LEFT JOIN Y ON X.id = Y.id
|
|
|
+ LEFT JOIN Z ON X.id = Z.id
|
|
|
+ </select>
|
|
|
+
|
|
|
+<!-- <select id="selectSupplyList" parameterType="Supply" resultMap="SupplyResult">-->
|
|
|
+<!-- <include refid="selectSupplyVo"/>-->
|
|
|
+<!-- <where> -->
|
|
|
+<!-- <if test="entGuid != null and entGuid != ''"> and ent_guid = #{entGuid}</if>-->
|
|
|
+<!-- <if test="epGuid != null and epGuid != ''"> and ep_guid = #{epGuid}</if>-->
|
|
|
+<!-- <if test="spGuid != null and spGuid != ''"> and sp_guid = #{spGuid}</if>-->
|
|
|
+<!-- </where>-->
|
|
|
+<!-- </select>-->
|
|
|
+
|
|
|
+ <select id="selectSupplyBySGuid" parameterType="String" resultMap="SupplyResult">
|
|
|
+ <include refid="selectSupplyVo"/>
|
|
|
+ where s_guid = #{sGuid}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertSupply" parameterType="Supply">
|
|
|
+ insert into t_supply
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="sGuid != null">s_guid,</if>
|
|
|
+ <if test="entGuid != null">ent_guid,</if>
|
|
|
+ <if test="epGuid != null">ep_guid,</if>
|
|
|
+ <if test="spGuid != null">sp_guid,</if>
|
|
|
+ <if test="tenantId != null">tenantId,</if>
|
|
|
+ <if test="deleteAt != null">delete_at,</if>
|
|
|
+ <if test="updateAt != null">update_at,</if>
|
|
|
+ <if test="creatAt != null">creat_at,</if>
|
|
|
+ <if test="rowId != null">row_id,</if>
|
|
|
+ <if test="updId != null">upd_id,</if>
|
|
|
+ <if test="deleter != null">deleter,</if>
|
|
|
+ <if test="updator != null">updator,</if>
|
|
|
+ <if test="creator != null">creator,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="sGuid != null">#{sGuid},</if>
|
|
|
+ <if test="entGuid != null">#{entGuid},</if>
|
|
|
+ <if test="epGuid != null">#{epGuid},</if>
|
|
|
+ <if test="spGuid != null">#{spGuid},</if>
|
|
|
+ <if test="tenantId != null">#{tenantId},</if>
|
|
|
+ <if test="deleteAt != null">#{deleteAt},</if>
|
|
|
+ <if test="updateAt != null">#{updateAt},</if>
|
|
|
+ <if test="creatAt != null">#{creatAt},</if>
|
|
|
+ <if test="rowId != null">#{rowId},</if>
|
|
|
+ <if test="updId != null">#{updId},</if>
|
|
|
+ <if test="deleter != null">#{deleter},</if>
|
|
|
+ <if test="updator != null">#{updator},</if>
|
|
|
+ <if test="creator != null">#{creator},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateSupply" parameterType="Supply">
|
|
|
+ update t_supply
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="entGuid != null">ent_guid = #{entGuid},</if>
|
|
|
+ <if test="epGuid != null">ep_guid = #{epGuid},</if>
|
|
|
+ <if test="spGuid != null">sp_guid = #{spGuid},</if>
|
|
|
+ <if test="tenantId != null">tenantId = #{tenantId},</if>
|
|
|
+ <if test="deleteAt != null">delete_at = #{deleteAt},</if>
|
|
|
+ <if test="updateAt != null">update_at = #{updateAt},</if>
|
|
|
+ <if test="creatAt != null">creat_at = #{creatAt},</if>
|
|
|
+ <if test="rowId != null">row_id = #{rowId},</if>
|
|
|
+ <if test="updId != null">upd_id = #{updId},</if>
|
|
|
+ <if test="deleter != null">deleter = #{deleter},</if>
|
|
|
+ <if test="updator != null">updator = #{updator},</if>
|
|
|
+ <if test="creator != null">creator = #{creator},</if>
|
|
|
+ </trim>
|
|
|
+ where s_guid = #{sGuid}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="deleteSupplyBySGuid" parameterType="String">
|
|
|
+ delete from t_supply where s_guid = #{sGuid}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteSupplyBySGuids" parameterType="String">
|
|
|
+ delete from t_supply where s_guid in
|
|
|
+ <foreach item="sGuid" collection="array" open="(" separator="," close=")">
|
|
|
+ #{sGuid}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+</mapper>
|