Files
zhwl/zhwl-wcsc/target/classes/mapper/wcsc/ZdyWcscGoodsMapper.xml

684 lines
25 KiB
XML
Raw Normal View History

2025-07-01 17:54:58 +08:00
<?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.zhwl.wcsc.mapper.ZdyWcscGoodsMapper">
<resultMap type="ZdyWcscGoods" id="ZdyWcscGoodsResult">
<result property="id" column="id"/>
<result property="type" column="type"/>
<result property="title" column="title"/>
<result property="subtitle" column="subtitle"/>
<result property="status" column="status"/>
<result property="weigh" column="weigh"/>
<result property="categoryIds" column="category_ids"/>
<result property="categoryName" column="category_name"/>
<result property="image" column="image"/>
<result property="images" column="images"/>
<result property="params" column="params"/>
<result property="content" column="content"/>
<result property="price" column="price"/>
<result property="originalPrice" column="original_price"/>
<result property="isSku" column="is_sku"/>
<result property="likes" column="likes"/>
<result property="views" column="views"/>
<result property="sales" column="sales"/>
<result property="showSales" column="show_sales"/>
<result property="serviceIds" column="service_ids"/>
<result property="dispatchType" column="dispatch_type"/>
<result property="dispatchIds" column="dispatch_ids"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
<result property="deletetime" column="deletetime"/>
<result property="score" column="score"/>
<result property="adminId" column="admin_id"/>
<result property="checkUid" column="check_uid"/>
<result property="checkStatus" column="check_status"/>
<result property="checkRemark" column="check_remark"/>
<result property="createBy" column="create_by"/>
<result property="updateBy" column="update_by"/>
<result property="storeId" column="store_id"/>
<result property="storeName" column="storeName"/>
<result property="address" column="address"/>
<result property="storeImage" column="storeImage"/>
<result property="dispatchName" column="dispatchName"/>
<result property="flag" column="flag"/>
<result property="storeGoodsFlag" column="store_goods_flag"/>
<result property="deptId" column="dept_id"/>
<result property="submitTime" column="submit_time"/>
<result property="auditTime" column="audit_time"/>
<result property="refundRule" column="refund_rule"/>
<result property="refundPeriodDay" column="refund_period_day"/>
</resultMap>
<sql id="selectZdyWcscGoodsVo">
SELECT g.id,
g.type,
g.title,
g.subtitle,
g.STATUS,
g.weigh,
g.category_ids,
wc.name category_name,
g.image,
g.images,
g.params,
g.content,
g.price,
g.original_price,
g.is_sku,
g.likes,
g.views,
g.sales,
g.show_sales,
g.service_ids,
g.dispatch_type,
g.dispatch_ids,
g.create_time,
g.update_time,
g.deletetime,
g.score,
g.admin_id,
g.check_uid,
g.check_status,
g.check_remark,
g.create_by,
g.update_by,
g.store_id,
g.flag,
g.store_goods_flag,
g.dept_id,
g.submit_time,
g.audit_time,
g.refund_rule,
g.refund_period_day,
sbi.`name` AS storeName,
sbi.`address` AS address,
sbi.images AS storeImage,
sbi.latitude AS latitude,
sbi.longitude AS longitude,
ex.NAME AS dispatchName
FROM zdy_wcsc_goods g
LEFT JOIN zdy_wcsc_store st ON st.id = g.store_id
LEFT JOIN zdy_wcsc_dispatch wd ON wd.id = g.dispatch_ids
LEFT JOIN zdy_wcsc_dispatch_express ex ON ex.id = wd.type_ids
LEFT JOIN zdy_wcsc_goods_sku_price gsp ON g.id = gsp.goods_id
LEFT JOIN zdy_wcsc_category wc ON g.category_ids = wc.id
LEFT JOIN zdy_store_base_info sbi ON st.store_id = sbi.id
</sql>
<select id="selectZdyWcscGoodsList" parameterType="ZdyWcscGoodsDto" resultMap="ZdyWcscGoodsResult">
<include refid="selectZdyWcscGoodsVo"/>
LEFT JOIN sys_dept d ON d.dept_id = g.dept_id
<where>
ISNULL(g.deletetime)
<if test="type != null and type != ''">
and g.type = #{type}
</if>
<if test="title != null and title != ''">
and g.title like concat('%', #{title}, '%')
</if>
<if test="subtitle != null and subtitle != ''">
and g.subtitle = #{subtitle}
</if>
<if test="status != null and status != ''">
and g.status = #{status}
</if>
<if test="checkStatus != null">
and g.check_status = #{checkStatus}
</if>
<if test="weigh != null ">
and g.weigh = #{weigh}
</if>
<if test="categoryIds != null">
and FIND_IN_SET(#{categoryIds}, g.category_ids)
</if>
<if test="categoryId != null">
and FIND_IN_SET(#{categoryId}, g.category_ids)
</if>
<if test="flag != null and flag != ''">
and FIND_IN_SET(#{flag}, g.flag)
</if>
<if test="storeId != null">
and g.store_id = #{storeId}
</if>
<if test="sn != null">
and gsp.sn = #{sn}
</if>
<if test="isSku!= null">
and g.is_sku = #{isSku}
</if>
<if test="params.submitBeginTime != null and params.submitBeginTime != ''"><!-- 开始时间检索 -->
AND date_format(g.submit_time,'%y%m%d') &gt;= date_format(#{params.submitBeginTime},'%y%m%d')
</if>
<if test="params.submitEndTime != null and params.submitEndTime != ''"><!-- 结束时间检索 -->
AND date_format(g.submit_time,'%y%m%d') &lt;= date_format(#{params.submitEndTime},'%y%m%d')
</if>
${params.dataScope}
</where>
GROUP BY
g.id order by g.weigh,g.create_time desc
</select>
<select id="appSelectZdyWcscGoodsList" parameterType="ZdyWcscGoodsDto" resultMap="ZdyWcscGoodsResult">
<include refid="selectZdyWcscGoodsVo"/>
LEFT JOIN sys_dept d ON d.dept_id = g.dept_id
<where>
ISNULL(g.deletetime)
and sbi.register_audit_status = 'APPROVED'
and sbi.grounding_status = 'up'
and st.store_type = '1'
<if test="type != null and type != ''">
and g.type = #{type}
</if>
<if test="title != null and title != ''">
and g.title like concat('%', #{title}, '%')
</if>
<if test="subtitle != null and subtitle != ''">
and g.subtitle = #{subtitle}
</if>
<if test="status != null and status != ''">
and g.status = #{status}
</if>
<if test="checkStatus != null">
and g.check_status = #{checkStatus}
</if>
<if test="weigh != null ">
and g.weigh = #{weigh}
</if>
<if test="categoryIds != null">
and FIND_IN_SET(#{categoryIds}, g.category_ids)
</if>
<if test="flag != null and flag != ''">
and FIND_IN_SET(#{flag}, g.flag)
</if>
<if test="storeGoodsFlag != null and storeGoodsFlag != ''">
and g.store_goods_flag = #{storeGoodsFlag}
</if>
<if test="storeId != null">
and g.store_id = #{storeId}
</if>
<if test="sn != null">
and gsp.sn = #{sn}
</if>
<if test="params.submitBeginTime != null and params.submitBeginTime != ''"><!-- 开始时间检索 -->
AND date_format(g.submit_time,'%y%m%d') &gt;= date_format(#{params.submitBeginTime},'%y%m%d')
</if>
<if test="params.submitEndTime != null and params.submitEndTime != ''"><!-- 结束时间检索 -->
AND date_format(g.submit_time,'%y%m%d') &lt;= date_format(#{params.submitEndTime},'%y%m%d')
</if>
<if test="params.submitEndTime != null and params.submitEndTime != ''"><!-- 结束时间检索 -->
AND date_format(g.submit_time,'%y%m%d') &lt;= date_format(#{params.submitEndTime},'%y%m%d')
</if>
<if test="params.submitEndTime != null and params.submitEndTime != ''"><!-- 结束时间检索 -->
AND date_format(g.submit_time,'%y%m%d') &lt;= date_format(#{params.submitEndTime},'%y%m%d')
</if>
<if test="noSelectId != null and noSelectId != ''">
and g.id != #{noSelectId}
</if>
${params.dataScope}
</where>
GROUP BY
g.id order by
<if test="flag != null and flag != ''">
g.flag_time,
</if>
<if test="storeGoodsFlag != null and storeGoodsFlag != ''">
g.store_goods_flag_time,
</if>
g.weigh,g.create_time desc
</select>
<select id="selectZdyWcscGoodsById" parameterType="Long"
resultMap="ZdyWcscGoodsResult">
<include refid="selectZdyWcscGoodsVo"/>
where g.id = #{id} GROUP BY
g.id
</select>
<insert id="insertZdyWcscGoods" parameterType="ZdyWcscGoods" useGeneratedKeys="true"
keyProperty="id">
insert into zdy_wcsc_goods
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="type != null and type != ''">type,
</if>
<if test="title != null and title != ''">title,
</if>
<if test="subtitle != null">subtitle,
</if>
<if test="status != null">status,
</if>
<if test="weigh != null">weigh,
</if>
<if test="categoryIds != null">category_ids,
</if>
<if test="image != null">image,
</if>
<if test="images != null">images,
</if>
<if test="params != null">params,
</if>
<if test="content != null">content,
</if>
<if test="price != null and price != ''">price,
</if>
<if test="originalPrice != null">original_price,
</if>
<if test="isSku != null">is_sku,
</if>
<if test="likes != null">likes,
</if>
<if test="views != null">views,
</if>
<if test="sales != null">sales,
</if>
<if test="showSales != null">show_sales,
</if>
<if test="serviceIds != null">service_ids,
</if>
<if test="dispatchType != null">dispatch_type,
</if>
<if test="dispatchIds != null">dispatch_ids,
</if>
create_time,
<if test="deletetime != null">deletetime,
</if>
<if test="score != null">score,
</if>
<if test="adminId != null">admin_id,
</if>
<if test="checkUid != null">check_uid,
</if>
<if test="checkStatus != null">check_status,
</if>
<if test="checkRemark != null">check_remark,
</if>
<if test="createBy != null">create_by,
</if>
<if test="updateBy != null">update_by,
</if>
<if test="storeId != null">store_id,
</if>
<if test="flag != null">flag,
</if>
<if test="deptId != null">dept_id,
</if>
<if test="submitTime != null">submit_time,
</if>
<if test="auditTime != null">audit_time,
</if>
<if test="refundRule != null">refund_rule,
</if>
<if test="refundPeriodDay != null">refund_period_day,
</if>
<if test="flagTime != null">flag_time,
</if>
<if test="storeGoodsFlag != null">store_goods_flag,
</if>
<if test="storeGoodsFlagTime != null">store_goods_flag_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="type != null and type != ''">#{type},
</if>
<if test="title != null and title != ''">#{title},
</if>
<if test="subtitle != null">#{subtitle},
</if>
<if test="status != null">#{status},
</if>
<if test="weigh != null">#{weigh},
</if>
<if test="categoryIds != null">#{categoryIds},
</if>
<if test="image != null">#{image},
</if>
<if test="images != null">#{images},
</if>
<if test="params != null">#{params},
</if>
<if test="content != null">#{content},
</if>
<if test="price != null and price != ''">#{price},
</if>
<if test="originalPrice != null">#{originalPrice},
</if>
<if test="isSku != null">#{isSku},
</if>
<if test="likes != null">#{likes},
</if>
<if test="views != null">#{views},
</if>
<if test="sales != null">#{sales},
</if>
<if test="showSales != null">#{showSales},
</if>
<if test="serviceIds != null">#{serviceIds},
</if>
<if test="dispatchType != null">#{dispatchType},
</if>
<if test="dispatchIds != null">#{dispatchIds},
</if>
sysdate(),
<if test="deletetime != null">#{deletetime},
</if>
<if test="score != null">#{score},
</if>
<if test="adminId != null">#{adminId},
</if>
<if test="checkUid != null">#{checkUid},
</if>
<if test="checkStatus != null">#{checkStatus},
</if>
<if test="checkRemark != null">#{checkRemark},
</if>
<if test="createBy != null">#{createBy},
</if>
<if test="updateBy != null">#{updateBy},
</if>
<if test="storeId != null">#{storeId},
</if>
<if test="flag != null">#{flag},
</if>
<if test="deptId != null">#{deptId},
</if>
<if test="submitTime != null">#{submitTime},
</if>
<if test="auditTime != null">#{auditTime},
</if>
<if test="refundRule != null">#{refundRule},
</if>
<if test="refundPeriodDay != null">#{refundPeriodDay},
</if>
<if test="flagTime != null">#{flagTime},
</if>
<if test="storeGoodsFlag != null">#{storeGoodsFlag},
</if>
<if test="storeGoodsFlagTime != null">#{storeGoodsFlagTime},
</if>
</trim>
</insert>
<update id="updateZdyWcscGoods" parameterType="ZdyWcscGoods">
update zdy_wcsc_goods
<trim prefix="SET" suffixOverrides=",">
<if test="type != null and type != ''">type =
#{type},
</if>
<if test="title != null and title != ''">title =
#{title},
</if>
<if test="subtitle != null">subtitle =
#{subtitle},
</if>
<if test="status != null">status =
#{status},
</if>
<if test="weigh != null">weigh =
#{weigh},
</if>
<if test="categoryIds != null">category_ids =
#{categoryIds},
</if>
<if test="image != null">image =
#{image},
</if>
<if test="images != null">images =
#{images},
</if>
<if test="params != null">params =
#{params},
</if>
<if test="content != null">content =
#{content},
</if>
<if test="price != null and price != ''">price =
#{price},
</if>
<if test="originalPrice != null">original_price =
#{originalPrice},
</if>
<if test="isSku != null">is_sku =
#{isSku},
</if>
<if test="likes != null">likes =
#{likes},
</if>
<if test="views != null">views =
#{views},
</if>
<if test="sales != null">sales =
#{sales},
</if>
<if test="showSales != null">show_sales =
#{showSales},
</if>
<if test="serviceIds != null">service_ids =
#{serviceIds},
</if>
<if test="dispatchType != null">dispatch_type =
#{dispatchType},
</if>
<if test="dispatchIds != null">dispatch_ids =
#{dispatchIds},
</if>
update_time = sysdate(),
<if test="deletetime != null">deletetime = #{deletetime},</if>
<if test="score != null">score =
#{score},
</if>
<if test="adminId != null">admin_id =
#{adminId},
</if>
<if test="checkUid != null">check_uid =
#{checkUid},
</if>
<if test="checkStatus != null">check_status =
#{checkStatus},
</if>
<if test="checkRemark != null">check_remark =
#{checkRemark},
</if>
<if test="createBy != null">create_by =
#{createBy},
</if>
<if test="updateBy != null">update_by =
#{updateBy},
</if>
<if test="storeId != null">store_id =
#{storeId},
</if>
flag =
#{flag},
<if test="flagTime != null">flag_time=
#{flagTime},
</if>
store_goods_flag=
#{storeGoodsFlag},
<if test="storeGoodsFlagTime != null">store_goods_flag_time=
#{storeGoodsFlagTime},
</if>
<if test="deptId != null">dept_id =
#{deptId},
</if>
<if test="submitTime != null">submit_time=
#{submitTime},
</if>
<if test="auditTime != null">audit_time=
#{auditTime},
</if>
<if test="refundRule != null">refund_rule =
#{refundRule},
</if>
<if test="refundPeriodDay != null">refund_period_day =
#{refundPeriodDay},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZdyWcscGoodsById" parameterType="Long">
update zdy_wcsc_goods
set deletetime = sysdate()
where id = #{id}
</delete>
<delete id="deleteZdyWcscGoodsByIds" parameterType="String">
update zdy_wcsc_goods
set deletetime = sysdate() where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<update id="editZdyWcscGoods" parameterType="ZdyWcscGoods">
update zdy_wcsc_goods
<trim prefix="SET" suffixOverrides=",">
<if test="type != null and type != ''">type =
#{type},
</if>
<if test="title != null and title != ''">title =
#{title},
</if>
<if test="subtitle != null">subtitle =
#{subtitle},
</if>
<if test="status != null">status =
#{status},
</if>
<if test="weigh != null">weigh =
#{weigh},
</if>
<if test="categoryIds != null">category_ids =
#{categoryIds},
</if>
<if test="image != null">image =
#{image},
</if>
<if test="images != null">images =
#{images},
</if>
<if test="params != null">params =
#{params},
</if>
<if test="content != null">content =
#{content},
</if>
<if test="price != null and price != ''">price =
#{price},
</if>
<if test="originalPrice != null">original_price =
#{originalPrice},
</if>
<if test="isSku != null">is_sku =
#{isSku},
</if>
<if test="likes != null">likes =
#{likes},
</if>
<if test="views != null">views =
#{views},
</if>
<if test="sales != null">sales =
#{sales},
</if>
<if test="showSales != null">show_sales =
#{showSales},
</if>
<if test="serviceIds != null">service_ids =
#{serviceIds},
</if>
<if test="dispatchType != null">dispatch_type =
#{dispatchType},
</if>
<if test="dispatchIds != null">dispatch_ids =
#{dispatchIds},
</if>
update_time = sysdate(),
<if test="deletetime != null">deletetime = #{deletetime},</if>
<if test="score != null">score =
#{score},
</if>
<if test="adminId != null">admin_id =
#{adminId},
</if>
<if test="checkUid != null">check_uid =
#{checkUid},
</if>
<if test="checkStatus != null">check_status =
#{checkStatus},
</if>
<if test="checkRemark != null">check_remark =
#{checkRemark},
</if>
<if test="createBy != null">create_by =
#{createBy},
</if>
<if test="updateBy != null">update_by =
#{updateBy},
</if>
<if test="storeId != null">store_id =
#{storeId},
</if>
<if test="flag != null">flag =
#{flag},
</if>
<if test="deptId != null">dept_id =
#{deptId},
</if>
<if test="submitTime != null">submit_time=
#{submitTime},
</if>
<if test="auditTime != null">audit_time=
#{auditTime},
</if>
<if test="refundRule != null">refund_rule =
#{refundRule},
</if>
<if test="refundPeriodDay != null">refund_period_day =
#{refundPeriodDay},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteByStoreIds" parameterType="String">
update zdy_wcsc_goods
set deletetime = sysdate() where store_id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="listGoodsByUserId" parameterType="ZdyWcscGoodsDto" resultMap="ZdyWcscGoodsResult">
<include refid="selectZdyWcscGoodsVo"/>
inner join zdy_wcsc_user_goods_collect zwgc on zwgc.goods_id = g.id
<where>
zwgc.user_id = #{userId}
and sbi.register_audit_status = 'APPROVED'
and sbi.grounding_status = 'up'
</where>
GROUP BY
g.id order by zwgc.create_time desc
</select>
<select id="selectZdyWcscGoodsListByDispatchIds" parameterType="Long"
resultMap="ZdyWcscGoodsResult">
<include refid="selectZdyWcscGoodsVo"/>
where g.dispatch_ids in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</select>
<select id="selectZdyWcscGoodsByIds" parameterType="Long"
resultMap="ZdyWcscGoodsResult">
<include refid="selectZdyWcscGoodsVo"/>
where g.id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</select>
</mapper>