205 lines
8.7 KiB
XML
205 lines
8.7 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.ruoyi.xkt.mapper.StoreProductFileMapper">
|
|
|
|
<resultMap type="StoreProductFile" id="StoreProductFileResult">
|
|
<result property="id" column="id" />
|
|
<result property="storeProdId" column="store_prod_id" />
|
|
<result property="storeId" column="store_id" />
|
|
<result property="fileId" column="file_id" />
|
|
<result property="fileType" column="file_type" />
|
|
<result property="fileSize" column="file_size" />
|
|
<result property="orderNum" column="order_num" />
|
|
<result property="version" column="version" />
|
|
<result property="delFlag" column="del_flag" />
|
|
<result property="createBy" column="create_by" />
|
|
<result property="createTime" column="create_time" />
|
|
<result property="updateBy" column="update_by" />
|
|
<result property="updateTime" column="update_time" />
|
|
</resultMap>
|
|
|
|
<sql id="selectStoreProductFileVo">
|
|
select id, store_prod_id, store_id, file_id, file_type, file_size, order_num, version, del_flag, create_by, create_time, update_by, update_time from store_product_file
|
|
</sql>
|
|
|
|
<select id="selectStoreProductFileList" parameterType="StoreProductFile" resultMap="StoreProductFileResult">
|
|
<include refid="selectStoreProductFileVo"/>
|
|
<where>
|
|
<if test="storeProdId != null "> and store_prod_id = #{storeProdId}</if>
|
|
<if test="fileId != null "> and file_id = #{fileId}</if>
|
|
<if test="fileType != null "> and file_type = #{fileType}</if>
|
|
<if test="fileSize != null "> and file_size = #{fileSize}</if>
|
|
<if test="orderNum != null "> and order_num = #{orderNum}</if>
|
|
<if test="version != null "> and version = #{version}</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectStoreProductFileByStoreProdFileId" parameterType="Long" resultMap="StoreProductFileResult">
|
|
<include refid="selectStoreProductFileVo"/>
|
|
where id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertStoreProductFile" parameterType="StoreProductFile" useGeneratedKeys="true" keyProperty="storeProdFileId">
|
|
insert into store_product_file
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="storeProdId != null">store_prod_id,</if>
|
|
<if test="fileId != null">file_id,</if>
|
|
<if test="fileType != null">file_type,</if>
|
|
<if test="fileSize != null">file_size,</if>
|
|
<if test="orderNum != null">order_num,</if>
|
|
<if test="version != null">version,</if>
|
|
<if test="delFlag != null">del_flag,</if>
|
|
<if test="createBy != null">create_by,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="updateBy != null">update_by,</if>
|
|
<if test="updateTime != null">update_time,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="storeProdId != null">#{storeProdId},</if>
|
|
<if test="fileId != null">#{fileId},</if>
|
|
<if test="fileType != null">#{fileType},</if>
|
|
<if test="fileSize != null">#{fileSize},</if>
|
|
<if test="orderNum != null">#{orderNum},</if>
|
|
<if test="version != null">#{version},</if>
|
|
<if test="delFlag != null">#{delFlag},</if>
|
|
<if test="createBy != null">#{createBy},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateStoreProductFile" parameterType="StoreProductFile">
|
|
update store_product_file
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="storeProdId != null">store_prod_id = #{storeProdId},</if>
|
|
<if test="fileId != null">file_id = #{fileId},</if>
|
|
<if test="fileType != null">file_type = #{fileType},</if>
|
|
<if test="fileSize != null">file_size = #{fileSize},</if>
|
|
<if test="orderNum != null">order_num = #{orderNum},</if>
|
|
<if test="version != null">version = #{version},</if>
|
|
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteStoreProductFileByStoreProdFileId" parameterType="Long">
|
|
delete from store_product_file where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteStoreProductFileByStoreProdFileIds" parameterType="String">
|
|
delete from store_product_file where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<update id="updateDelFlagByStoreProdId" parameterType="Long">
|
|
UPDATE store_product_file SET del_flag = 2 WHERE store_prod_id = #{storeProdId}
|
|
</update>
|
|
|
|
<select id="selectListByStoreProdId" parameterType="Long" resultType="com.ruoyi.xkt.dto.storeProductFile.StoreProdFileResDTO">
|
|
SELECT
|
|
spf.store_prod_id AS storeProdId,
|
|
spf.file_id AS fileId,
|
|
sf.file_url AS fileUrl,
|
|
spf.file_type AS fileType,
|
|
sf.file_name AS fileName,
|
|
spf.file_size AS fileSize,
|
|
spf.order_num AS orderNum
|
|
FROM
|
|
store_product_file spf
|
|
LEFT JOIN sys_file sf ON spf.file_id = sf.id AND spf.del_flag = 0
|
|
WHERE spf.store_prod_id = #{storeProdId}
|
|
</select>
|
|
|
|
|
|
<select id="selectMainPicByStoreProdIdList" resultType="com.ruoyi.xkt.dto.storeProductFile.StoreProdMainPicDTO">
|
|
SELECT
|
|
spf.store_prod_id AS storeProdId,
|
|
sf.file_url AS fileUrl
|
|
FROM
|
|
store_product_file spf
|
|
LEFT JOIN sys_file sf ON spf.file_id = sf.id
|
|
WHERE
|
|
spf.del_flag = 0
|
|
<if test="storeProdIdList != null and storeProdIdList.size() > 0">
|
|
AND spf.store_prod_id in
|
|
<foreach item="storeProdId" collection="storeProdIdList" open="(" separator="," close=")">
|
|
#{storeProdId}
|
|
</foreach>
|
|
</if>
|
|
<if test="fileType != null">
|
|
AND spf.file_type = #{fileType}
|
|
</if>
|
|
<if test="orderNum != null">
|
|
AND spf.order_num = #{orderNum}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="selectPicSpaceList" >
|
|
SELECT
|
|
sp.prod_art_num AS prodArtNum,
|
|
sp.id AS storeProdId,
|
|
sf.file_url AS fileUrl
|
|
FROM
|
|
store_product_file spf
|
|
LEFT JOIN sys_file sf ON spf.file_id = sf.id
|
|
LEFT JOIN store_product sp ON spf.store_prod_id = sp.id
|
|
WHERE
|
|
spf.del_flag = 0
|
|
AND spf.file_type = #{fileType}
|
|
AND spf.store_id = #{storeId}
|
|
<if test="storeProdIdList != null and storeProdIdList.size() > 0">
|
|
AND spf.store_prod_id in
|
|
<foreach item="storeProdId" collection="storeProdIdList" open="(" separator="," close=")">
|
|
#{storeProdId}
|
|
</foreach>
|
|
</if>
|
|
</select>
|
|
|
|
|
|
<select id="selectTotalMainPicList" resultType="com.ruoyi.xkt.dto.storeProductFile.StoreProdFileResDTO">
|
|
SELECT
|
|
spf.store_prod_id AS storeProdId,
|
|
spf.file_id AS fileId,
|
|
sf.file_url AS fileUrl,
|
|
spf.file_type AS fileType,
|
|
spf.file_size AS fileSize,
|
|
sf.file_name AS fileName,
|
|
spf.order_num AS orderNum
|
|
FROM
|
|
store_product_file spf
|
|
LEFT JOIN sys_file sf ON spf.file_id = sf.id
|
|
WHERE
|
|
spf.del_flag = 0
|
|
AND spf.file_type = #{fileType}
|
|
AND spf.store_id = #{storeId}
|
|
</select>
|
|
|
|
<select id="selectMainPic" >
|
|
SELECT
|
|
sp.id,
|
|
sf.file_url
|
|
FROM
|
|
store_product sp
|
|
JOIN store_product_file spf ON sp.id = spf.store_prod_id
|
|
LEFT JOIN sys_file sf ON spf.file_id = sf.id
|
|
WHERE
|
|
sp.del_flag = 0
|
|
AND spf.file_type = 1
|
|
AND spf.order_num = 1
|
|
AND sp.id IN
|
|
<foreach item="id" collection="storeProdIdList" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</select>
|
|
|
|
|
|
</mapper> |