222 lines
12 KiB
XML
222 lines
12 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.StoreProductMapper">
|
|
|
|
<resultMap type="StoreProduct" id="StoreProductResult">
|
|
<result property="id" column="id" />
|
|
<result property="storeId" column="store_id" />
|
|
<result property="prodName" column="prod_name" />
|
|
<result property="prodCateId" column="prod_cate_id" />
|
|
<result property="factoryArtNum" column="factory_art_num" />
|
|
<result property="prodArtNum" column="prod_art_num" />
|
|
<result property="prodTitle" column="prod_title" />
|
|
<result property="prodWeight" column="prod_weight" />
|
|
<result property="producePrice" column="produce_price" />
|
|
<result property="overPrice" column="over_price" />
|
|
<result property="deliveryTime" column="delivery_time" />
|
|
<result property="listingWay" column="listing_way" />
|
|
<result property="nextBarcodeNum" column="next_barcode_num" />
|
|
<result property="listingWaySchedule" column="listing_way_schedule" />
|
|
<result property="vroucherDate" column="vroucher_date" />
|
|
<result property="prodStatus" column="prod_status" />
|
|
<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="selectStoreProductVo">
|
|
select id, store_id, prod_name, prod_cate_id, factory_art_num, prod_art_num, prod_title, prod_weight, produce_price, over_price, delivery_time, listing_way, next_barcode_num, listing_way_schedule, vroucher_date, prod_status, version, del_flag, create_by, create_time, update_by, update_time from store_product
|
|
</sql>
|
|
|
|
<select id="selectStoreProductList" parameterType="StoreProduct" resultMap="StoreProductResult">
|
|
<include refid="selectStoreProductVo"/>
|
|
<where>
|
|
<if test="prodName != null and prodName != ''"> and prod_name like concat('%', #{prodName}, '%')</if>
|
|
<if test="prodCateId != null "> and prod_cate_id = #{prodCateId}</if>
|
|
<if test="factoryArtNum != null and factoryArtNum != ''"> and factory_art_num = #{factoryArtNum}</if>
|
|
<if test="prodArtNum != null and prodArtNum != ''"> and prod_art_num = #{prodArtNum}</if>
|
|
<if test="prodTitle != null and prodTitle != ''"> and prod_title = #{prodTitle}</if>
|
|
<if test="prodWeight != null "> and prod_weight = #{prodWeight}</if>
|
|
<if test="producePrice != null "> and produce_price = #{producePrice}</if>
|
|
<if test="overPrice != null "> and over_price = #{overPrice}</if>
|
|
<if test="deliveryTime != null "> and delivery_time = #{deliveryTime}</if>
|
|
<if test="listingWay != null "> and listing_way = #{listingWay}</if>
|
|
<if test="nextBarcodeNum != null "> and next_barcode_num = #{nextBarcodeNum}</if>
|
|
<if test="listingWaySchedule != null "> and listing_way_schedule = #{listingWaySchedule}</if>
|
|
<if test="vroucherDate != null "> and vroucher_date = #{vroucherDate}</if>
|
|
<if test="prodStatus != null "> and prod_status = #{prodStatus}</if>
|
|
<if test="version != null "> and version = #{version}</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectStoreProductByStoreProdId" parameterType="Long" resultMap="StoreProductResult">
|
|
<include refid="selectStoreProductVo"/>
|
|
where id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertStoreProduct" parameterType="StoreProduct" useGeneratedKeys="true" keyProperty="storeProdId">
|
|
insert into store_product
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="prodName != null and prodName != ''">prod_name,</if>
|
|
<if test="prodCateId != null">prod_cate_id,</if>
|
|
<if test="factoryArtNum != null">factory_art_num,</if>
|
|
<if test="prodArtNum != null">prod_art_num,</if>
|
|
<if test="prodTitle != null">prod_title,</if>
|
|
<if test="prodWeight != null">prod_weight,</if>
|
|
<if test="producePrice != null">produce_price,</if>
|
|
<if test="overPrice != null">over_price,</if>
|
|
<if test="deliveryTime != null">delivery_time,</if>
|
|
<if test="listingWay != null">listing_way,</if>
|
|
<if test="nextBarcodeNum != null">next_barcode_num,</if>
|
|
<if test="listingWaySchedule != null">listing_way_schedule,</if>
|
|
<if test="vroucherDate != null">vroucher_date,</if>
|
|
<if test="prodStatus != null">prod_status,</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="prodName != null and prodName != ''">#{prodName},</if>
|
|
<if test="prodCateId != null">#{prodCateId},</if>
|
|
<if test="factoryArtNum != null">#{factoryArtNum},</if>
|
|
<if test="prodArtNum != null">#{prodArtNum},</if>
|
|
<if test="prodTitle != null">#{prodTitle},</if>
|
|
<if test="prodWeight != null">#{prodWeight},</if>
|
|
<if test="producePrice != null">#{producePrice},</if>
|
|
<if test="overPrice != null">#{overPrice},</if>
|
|
<if test="deliveryTime != null">#{deliveryTime},</if>
|
|
<if test="listingWay != null">#{listingWay},</if>
|
|
<if test="nextBarcodeNum != null">#{nextBarcodeNum},</if>
|
|
<if test="listingWaySchedule != null">#{listingWaySchedule},</if>
|
|
<if test="vroucherDate != null">#{vroucherDate},</if>
|
|
<if test="prodStatus != null">#{prodStatus},</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="updateStoreProduct" parameterType="StoreProduct">
|
|
update store_product
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="prodName != null and prodName != ''">prod_name = #{prodName},</if>
|
|
<if test="prodCateId != null">prod_cate_id = #{prodCateId},</if>
|
|
<if test="factoryArtNum != null">factory_art_num = #{factoryArtNum},</if>
|
|
<if test="prodArtNum != null">prod_art_num = #{prodArtNum},</if>
|
|
<if test="prodTitle != null">prod_title = #{prodTitle},</if>
|
|
<if test="prodWeight != null">prod_weight = #{prodWeight},</if>
|
|
<if test="producePrice != null">produce_price = #{producePrice},</if>
|
|
<if test="overPrice != null">over_price = #{overPrice},</if>
|
|
<if test="deliveryTime != null">delivery_time = #{deliveryTime},</if>
|
|
<if test="listingWay != null">listing_way = #{listingWay},</if>
|
|
<if test="nextBarcodeNum != null">next_barcode_num = #{nextBarcodeNum},</if>
|
|
<if test="listingWaySchedule != null">listing_way_schedule = #{listingWaySchedule},</if>
|
|
<if test="vroucherDate != null">vroucher_date = #{vroucherDate},</if>
|
|
<if test="prodStatus != null">prod_status = #{prodStatus},</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="deleteStoreProductByStoreProdId" parameterType="Long">
|
|
delete from store_product where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteStoreProductByStoreProdIds" parameterType="String">
|
|
delete from store_product where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<select id="fuzzyQueryResPicList" resultType="com.ruoyi.xkt.dto.storeProduct.StoreProdFuzzyResPicDTO">
|
|
SELECT
|
|
sp.id AS storeProdId,
|
|
sp.store_id AS storeId,
|
|
sp.prod_art_num AS prodArtNum,
|
|
sf.file_url AS mainPicUrl
|
|
FROM
|
|
store_product sp
|
|
LEFT 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.order_num = 1
|
|
AND spf.file_type = 1
|
|
AND sp.store_id = #{storeId}
|
|
<if test="prodArtNum != null and prodArtNum != ''">
|
|
AND sp.prod_art_num like concat('%', #{prodArtNum}, '%')
|
|
</if>
|
|
</select>
|
|
|
|
<select id="selectStatusCount" resultType="com.ruoyi.xkt.dto.storeProduct.StoreProdStatusCountDTO">
|
|
SELECT
|
|
SUM( CASE WHEN prod_status = 2 THEN 1 ELSE 0 END ) AS onSaleNum,
|
|
SUM( CASE WHEN prod_status = 3 THEN 1 ELSE 0 END ) AS tailGoodsNum,
|
|
SUM( CASE WHEN prod_status = 4 THEN 1 ELSE 0 END ) AS offSaleNum
|
|
FROM
|
|
store_product
|
|
WHERE
|
|
del_flag = 0 AND store_id = #{storeId}
|
|
</select>
|
|
|
|
<select id="selectESDTOList" resultType="com.ruoyi.xkt.dto.storeProduct.ProductESDTO">
|
|
SELECT DISTINCT
|
|
sp.id,
|
|
s.store_name AS storeName,
|
|
sf.file_url AS mainPic,
|
|
spca1.dict_value AS season,
|
|
spca2.dict_value AS style,
|
|
spcp.min_price AS prodPrice,
|
|
spc1.`name` AS prodCateName,
|
|
spc2.id AS parCateId,
|
|
spc2.`name` AS parCateName
|
|
FROM
|
|
store_product sp
|
|
LEFT JOIN store s ON sp.store_id = s.id
|
|
LEFT JOIN store_product_file spf ON sp.id = spf.store_prod_id
|
|
AND spf.file_type = 1
|
|
AND spf.order_num = 1
|
|
LEFT JOIN sys_file sf ON spf.file_id = sf.id
|
|
LEFT JOIN store_product_category_attribute spca1 ON sp.id = spca1.store_prod_id
|
|
AND spca1.dict_type = 'suitable_season'
|
|
LEFT JOIN sys_product_category spc1 ON sp.prod_cate_id = spc1.id
|
|
LEFT JOIN sys_product_category spc2 ON spc1.parent_id = spc2.id
|
|
LEFT JOIN store_product_category_attribute spca2 ON sp.id = spca2.store_prod_id
|
|
AND spca2.dict_type = 'style'
|
|
LEFT JOIN ( SELECT store_prod_id, MIN( price ) AS min_price FROM store_product_color_price GROUP BY store_prod_id ) spcp ON sp.id = spcp.store_prod_id
|
|
WHERE
|
|
sp.del_flag = 0 AND sp.id IN
|
|
<foreach item="id" collection="idList" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</select>
|
|
|
|
|
|
<select id="getStyleList" >
|
|
SELECT DISTINCT
|
|
dict_value
|
|
FROM
|
|
store_product_category_attribute
|
|
WHERE
|
|
dict_type = 'style'
|
|
AND del_flag = 0
|
|
</select>
|
|
|
|
</mapper> |