<?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.matrix.system.hive.dao.ShoppingGoodsDao">
|
<cache readOnly="true"></cache>
|
<resultMap type="ShoppingGoods" id="ShoppingGoodsMap">
|
|
<id property="id" column="id" />
|
<result property="name" column="name" />
|
<result property="introduction" column="introduction" />
|
<result property="description" column="description" />
|
<result property="staus" column="staus" />
|
<result property="sealPice" column="seal_pice" />
|
<result property="referencePice" column="reference_pice" />
|
<result property="img" column="img" />
|
<result property="sealCount" column="seal_count" />
|
<result property="isAssemble" column="is_assemble" />
|
<result property="deleted" column="deleted" />
|
<result property="cateId" column="cate_id" />
|
<result property="jfPice" column="jf_pice" />
|
<result property="jfNumber" column="jf_number" />
|
<result property="goodType" column="good_type" />
|
<result property="isDel" column="is_del" />
|
|
<result property="saleOffTime" column="sale_off_time" />
|
<result property="isPresent" column="is_present" />
|
<result property="isOnce" column="is_once" />
|
<result property="salePlatform" column="sale_platform" />
|
|
<result property="weiImg" column="wei_img" />
|
<result property="weiDescription" column="wei_description" />
|
|
<result property="validity" column="validity" />
|
|
<result property="carMaxSaleCount" column="car_max_sale_count" />
|
<result property="carIsAll" column="car_is_all" />
|
<result property="carUseCount" column="car_use_count" />
|
<result property="isVipCar" column="is_vip_car" />
|
<result property="vipGradId" column="vip_grad_id" />
|
|
<result property="isIntegral" column="is_integral" />
|
<result property="commissionRate" column="commission_rate" />
|
<result property="realSealCount" column="real_seal_count" />
|
<result property="store" column="store" />
|
<result property="isCourse" column="is_course" />
|
|
<result property="isDistribution" column="is_distribution" />
|
<result property="fristCommission" column="frist_commission" />
|
<result property="secondCommission" column="second_commission" />
|
<result property="shopId" column="shop_id"/>
|
<result property="companyId" column="company_id"/>
|
<result property="createTime" column="create_time" />
|
<result property="code" column="code" />
|
<result property="zjm" column="zjm" />
|
|
|
<result property="useShop" column="use_shop" />
|
<result property="headquarters" column="headquarters" />
|
|
|
<!-- 存货属性 -->
|
<result property="goodsNo" column="GOODS_NO"/>
|
<result property="unit" column="UNIT"/>
|
<result property="deleted" column="DELETED"/>
|
<result property="goodsSortId" column="GOODS_SORT_ID"/>
|
<result property="supplierId" column="SUPPLIER_ID"/>
|
<result property="measure" column="MEASURE"/>
|
<result property="alarmNum" column="alarm_num"/>
|
<result property="volume" column="volume"/>
|
<result property="price" column="price"/>
|
<result property="wholesale" column="wholesale"/>
|
|
|
|
|
<!-- 服务项目信息 -->
|
<result property="proReward" column="proReward" />
|
<result property="timeLength" column="TIME_LENGTH" />
|
|
|
<!-- 扩展属性 -->
|
<result property="cateName" column="cate_name" />
|
<result property="shopName" column="shop_name" />
|
|
<result property="goodsSortName" column="goodsSortName" />
|
|
<result property="achieveRuleName" column="achieveRuleName" />
|
|
|
<result property="payMethods" column="pay_methods" />
|
<result property="invalidTime" column="invalid_time" />
|
<result property="useValid" column="use_valid" />
|
<result property="buyValid" column="buy_valid" />
|
<result property="isInfinite" column="is_infinite" />
|
<result property="achieveRuleId" column="achieve_rule_id" />
|
|
|
|
</resultMap>
|
|
<!-- 产品简单map无扩展对象 -->
|
<resultMap type="ShoppingGoods" id="ShoppingGoodsSimpleMap">
|
<id property="id" column="id" />
|
|
<id property="id" column="sp_id" />
|
<result property="isDel" column="is_del" />
|
<result property="name" column="name" />
|
<result property="introduction" column="introduction" />
|
<result property="description" column="description" />
|
<result property="staus" column="staus" />
|
<result property="sealPice" column="seal_pice" />
|
<result property="referencePice" column="reference_pice" />
|
<result property="img" column="img" />
|
<result property="sealCount" column="seal_count" />
|
<result property="isAssemble" column="is_assemble" />
|
<result property="deleted" column="deleted" />
|
<result property="cateId" column="cate_id" />
|
<result property="jfPice" column="jf_pice" />
|
<result property="jfNumber" column="jf_number" />
|
<result property="goodType" column="good_type" />
|
|
<result property="saleOffTime" column="sale_off_time" />
|
<result property="isPresent" column="is_present" />
|
<result property="isOnce" column="is_once" />
|
<result property="salePlatform" column="sale_platform" />
|
|
<result property="weiImg" column="wei_img" />
|
<result property="weiDescription" column="wei_description" />
|
|
<result property="validity" column="validity" />
|
<result property="carMaxSaleCount" column="car_max_sale_count" />
|
<result property="carIsAll" column="car_is_all" />
|
<result property="carUseCount" column="car_use_count" />
|
<result property="isVipCar" column="is_vip_car" />
|
<result property="vipGradId" column="vip_grad_id" />
|
<result property="isIntegral" column="is_integral" />
|
<result property="commissionRate" column="commission_rate" />
|
<result property="realSealCount" column="real_seal_count" />
|
<result property="store" column="store" />
|
<result property="isCourse" column="is_course" />
|
<result property="isDistribution" column="is_distribution" />
|
<result property="fristCommission" column="frist_commission" />
|
<result property="secondCommission" column="second_commission" />
|
<result property="shopId" column="shop_id"/>
|
<result property="companyId" column="company_id"/>
|
<result property="code" column="code" />
|
<result property="zjm" column="zjm" />
|
<result property="useShop" column="use_shop" />
|
<result property="headquarters" column="headquarters" />
|
|
<!-- 存货属性 -->
|
<result property="goodsNo" column="GOODS_NO"/>
|
<result property="unit" column="UNIT"/>
|
<result property="goodsSortId" column="GOODS_SORT_ID"/>
|
<result property="supplierId" column="SUPPLIER_ID"/>
|
<result property="measure" column="MEASURE"/>
|
<result property="alarmNum" column="alarm_num"/>
|
<result property="volume" column="volume"/>
|
<result property="price" column="price"/>
|
<result property="wholesale" column="wholesale"/>
|
|
<!-- 服务项目信息 -->
|
<result property="proReward" column="proReward" />
|
<result property="timeLength" column="TIME_LENGTH" />
|
<result property="achieveRuleId" column="achieve_rule_id" />
|
|
|
<!-- 扩展属性 -->
|
<result property="cateName" column="cate_name" />
|
<result property="goodsSortName" column="goodsSortName" />
|
<result property="achieveRuleName" column="achieveRuleName" />
|
|
|
</resultMap>
|
|
<!-- 简单map数据迁移使用 -->
|
<resultMap type="ShoppingGoods" id="ShoppingGoodsDataMap">
|
<id property="id" column="id" />
|
<result property="name" column="name" />
|
</resultMap>
|
<!-- 根据对象查询 -->
|
<select id="selectByModelData" resultMap="ShoppingGoodsDataMap">
|
select
|
id,
|
name
|
from shopping_goods
|
where 1=1
|
<if test="record!=null">
|
<if test="record.id != null and record.id !='' ">
|
and id =#{record.id}
|
</if>
|
<if test="record.name != null and record.name !='' ">
|
and (instr(name,#{record.name}) or instr(zjm,#{record.name}))
|
</if>
|
<if test="record.staus != null and record.staus !='' ">
|
and staus =#{record.staus}
|
</if>
|
|
<if test="record.zjm != null and record.zjm !='' ">
|
and instr(zjm , #{record.zjm})
|
</if>
|
|
<if test="record.isAssemble != null and record.isAssemble !='' ">
|
and is_assemble =#{record.isAssemble}
|
</if>
|
<if test="record.deleted != null and record.deleted !='' ">
|
and deleted =#{record.deleted}
|
</if>
|
<if test="record.cateId != null and record.cateId !='' ">
|
and cate_id =#{record.cateId}
|
</if>
|
|
<if test="record.goodType != null and record.goodType !='' ">
|
and good_type =#{record.goodType}
|
</if>
|
|
<if test="record.isPresent != null and record.isPresent !='' ">
|
and is_present = #{record.isPresent}
|
</if>
|
|
<if test="record.isVipCar != null and record.isVipCar !='' ">
|
and is_vip_car = #{record.isVipCar}
|
</if>
|
<if test="record.isDel != null and record.isDel !='' ">
|
and is_del = #{record.isDel}
|
</if>
|
|
|
<if test="record.isCourse != null and record.isCourse !=''">
|
and is_course = #{record.isCourse}
|
</if>
|
<if test="record.vipGradId != null and record.vipGradId !=''">
|
and vip_grad_id = #{record.vipGradId}
|
</if>
|
<if test="record.shopId != null and record.shopId !='' ">
|
<![CDATA[ and ( shop_id = #{record.shopId} or
|
( headquarters=1 and ( ISNULL(use_shop) or LENGTH(trim(use_shop))<1 or FIND_IN_SET(#{record.shopId},use_shop))))]]>
|
</if>
|
<if test="record.companyId != null and record.companyId !='' ">
|
and company_id = #{record.companyId}
|
</if>
|
</if>
|
</select>
|
|
|
|
<!-- 插入方法 -->
|
<insert id="insert" parameterType="ShoppingGoods"
|
useGeneratedKeys="true" keyProperty="id">
|
INSERT INTO shopping_goods (
|
id,
|
name,
|
introduction,
|
description,
|
staus,
|
seal_pice,
|
reference_pice,
|
img,
|
seal_count,
|
is_assemble,
|
deleted,
|
cate_id,
|
jf_pice,
|
jf_number,
|
good_type,
|
sale_off_time,
|
is_present,
|
is_once,
|
sale_platform,
|
wei_img,
|
wei_description,
|
validity,
|
car_max_sale_count,
|
car_is_all,
|
car_use_count,
|
is_vip_car,
|
vip_grad_id,
|
is_integral,
|
real_seal_count,
|
store,
|
commission_rate,
|
is_course,
|
is_distribution,
|
frist_commission,
|
second_commission,
|
create_time,
|
shop_id,
|
company_id,
|
code,
|
GOODS_NO,
|
UNIT,
|
GOODS_SORT_ID,
|
SUPPLIER_ID,
|
MEASURE,
|
alarm_num,
|
volume,
|
price,
|
wholesale,
|
proReward,
|
TIME_LENGTH,
|
use_shop,
|
headquarters,
|
is_del,
|
zjm,
|
buy_valid,
|
use_valid,
|
invalid_time,
|
pay_methods,
|
is_infinite,
|
achieve_rule_id,
|
is_cooperate
|
)
|
VALUES (
|
#{id},
|
#{name},
|
#{introduction},
|
#{description},
|
#{staus},
|
#{sealPice},
|
#{referencePice},
|
#{img},
|
#{sealCount},
|
#{isAssemble},
|
#{deleted},
|
#{cateId},
|
#{jfPice},
|
#{jfNumber},
|
#{goodType},
|
#{saleOffTime},
|
#{isPresent},
|
#{isOnce},
|
#{salePlatform},
|
#{weiImg},
|
#{weiDescription},
|
#{validity},
|
#{carMaxSaleCount},
|
#{carIsAll},
|
#{carUseCount},
|
#{isVipCar},
|
#{vipGradId},
|
#{isIntegral},
|
#{realSealCount},
|
#{store},
|
#{commissionRate},
|
#{isCourse},
|
#{isDistribution},
|
#{fristCommission},
|
#{secondCommission},
|
#{createTime},
|
#{shopId},
|
#{companyId},
|
#{code},
|
#{goodsNo},
|
#{unit},
|
#{goodsSortId},
|
#{supplierId},
|
#{measure},
|
#{alarmNum},
|
#{volume},
|
#{price},
|
#{wholesale},
|
#{proReward},
|
#{timeLength},
|
#{useShop},
|
#{headquarters},
|
#{isDel},
|
#{zjm},
|
#{buyValid},
|
#{useValid},
|
#{invalidTime},
|
#{payMethods},
|
#{isInfinite},
|
#{achieveRuleId},
|
#{isCooperate}
|
)
|
</insert>
|
|
|
<!-- 根据id更新 部分更新 -->
|
<update id="update" >
|
UPDATE shopping_goods
|
<set>
|
<if test="name != null and name !='' ">
|
name = #{name},
|
</if>
|
<if test="introduction != null and introduction !='' ">
|
introduction = #{introduction},
|
</if>
|
<if test="description != null and description !='' ">
|
description = #{description},
|
</if>
|
<if test="staus != null and staus !='' ">
|
staus = #{staus},
|
</if>
|
<if test="(sealPice != null and sealPice !='') or sealPice ==0 ">
|
seal_pice = #{sealPice},
|
</if>
|
<if test="(referencePice != null and referencePice !='') or referencePice ==0 ">
|
reference_pice = #{referencePice},
|
</if>
|
<if test="img != null and img !='' ">
|
img = #{img},
|
</if>
|
<if test="(sealCount != null) or sealCount==0">
|
seal_count = #{sealCount},
|
</if>
|
<if test="isAssemble != null and isAssemble !='' ">
|
is_assemble = #{isAssemble},
|
</if>
|
<if test="zjm != null and zjm !='' ">
|
zjm = #{zjm},
|
</if>
|
<if test="deleted != null and deleted !='' ">
|
deleted = #{deleted},
|
</if>
|
<if test="cateId != null and cateId !='' ">
|
cate_id = #{cateId},
|
</if>
|
<!-- 积分兑换价格和兑换所需要的积分是非必填的,因此,不要判断是否为空 -->
|
jf_pice = #{jfPice},
|
jf_number = #{jfNumber},
|
<if test="goodType != null and goodType !='' ">
|
good_type = #{goodType},
|
</if>
|
<if test="saleOffTime != null ">
|
sale_off_time = #{saleOffTime},
|
</if>
|
<if test="isPresent != null and isPresent !='' ">
|
is_present = #{isPresent},
|
</if>
|
<if test="isOnce != null ">
|
is_once = #{isOnce},
|
</if>
|
<if test="salePlatform != null and salePlatform !='' ">
|
sale_platform = #{salePlatform},
|
</if>
|
<if test="weiImg != null and weiImg !='' ">
|
wei_img = #{weiImg},
|
</if>
|
<if test="weiDescription != null and weiDescription !='' ">
|
wei_description = #{weiDescription},
|
</if>
|
|
<if test="validity != null ">
|
validity = #{validity},
|
</if>
|
|
<if
|
test="carMaxSaleCount != null">
|
car_max_sale_count = #{carMaxSaleCount},
|
</if>
|
<if test="carIsAll != null and carIsAll !='' ">
|
car_is_all = #{carIsAll},
|
</if>
|
<if test="carUseCount != null ">
|
car_use_count = #{carUseCount},
|
</if>
|
<if test="isVipCar != null and isVipCar !='' ">
|
is_vip_car = #{isVipCar},
|
</if>
|
<if test="vipGradId != null and vipGradId !='' ">
|
vip_grad_id = #{vipGradId},
|
</if>
|
<if test="isIntegral != null and isIntegral !='' ">
|
is_integral = #{isIntegral},
|
</if>
|
<if test="realSealCount != null and realSealCount !='' ">
|
real_seal_count = #{realSealCount},
|
</if>
|
<if test="store != null and store !='' ">
|
store = #{store},
|
</if>
|
<if test="(commissionRate != null and commissionRate !='') or commissionRate==0 ">
|
commission_rate = #{commissionRate},
|
</if>
|
<if test="isCourse != null and isCourse !='' ">
|
is_course = #{isCourse},
|
</if>
|
<if test="isDistribution != null and isDistribution !='' ">
|
is_distribution = #{isDistribution},
|
</if>
|
<if test="fristCommission != null and fristCommission !='' ">
|
frist_commission = #{fristCommission},
|
</if>
|
<if test="secondCommission != null and secondCommission !='' ">
|
second_commission = #{secondCommission},
|
</if>
|
<if test="companyId != null and companyId !='' ">
|
company_id = #{companyId},
|
</if>
|
<if test="shopId != null and shopId !='' ">
|
shop_id = #{shopId},
|
</if>
|
<if test="code != null and code !='' ">
|
code = #{code},
|
</if>
|
|
<if test="measure != null and measure !='' ">
|
MEASURE = #{measure},
|
</if>
|
<if test="goodsNo != null and goodsNo !='' ">
|
GOODS_NO = #{goodsNo},
|
</if>
|
|
<if test="unit != null and unit !='' ">
|
UNIT = #{unit},
|
</if>
|
|
<if test="goodsSortId != null and goodsSortId !='' ">
|
GOODS_SORT_ID = #{goodsSortId},
|
</if>
|
|
<if test="supplierId != null and supplierId !='' ">
|
SUPPLIER_ID = #{supplierId},
|
</if>
|
|
|
<if test="alarmNum != null and alarmNum !='' ">
|
alarm_num = #{alarmNum},
|
</if>
|
<if test="volume != null and volume !='' ">
|
volume = #{volume},
|
</if>
|
<if test="price != null and price !='' ">
|
price = #{price},
|
</if>
|
<if test="wholesale != null and wholesale !='' ">
|
wholesale = #{wholesale},
|
</if>
|
<if test="timeLength != null and timeLength !='' ">
|
TIME_LENGTH = #{timeLength},
|
</if>
|
<if test="proReward != null and proReward !='' ">
|
proReward = #{proReward},
|
</if>
|
|
<if test="useShop != null and useShop !='' ">
|
use_shop = #{useShop},
|
</if>
|
|
<if test="headquarters != null and headquarters !='' ">
|
headquarters = #{headquarters},
|
</if>
|
<if test="isDel != null and isDel !='' ">
|
is_del = #{isDel},
|
</if>
|
<if test="isInfinite != null and isInfinite !='' ">
|
is_infinite = #{isInfinite},
|
</if>
|
|
<if test="achieveRuleId != null and achieveRuleId !='' ">
|
achieve_rule_id = #{achieveRuleId},
|
</if>
|
invalid_time = #{invalidTime},
|
buy_valid = #{buyValid},
|
use_valid = #{useValid},
|
pay_methods = #{payMethods},
|
</set>
|
WHERE id=#{id}
|
</update>
|
|
|
|
<!-- 根据id更新 部分更新 -->
|
<update id="update2" >
|
UPDATE shopping_goods set is_bargain = 1
|
WHERE id=#{id}
|
</update>
|
|
|
|
<!-- 批量删除 -->
|
<delete id="deleteByIds" parameterType="java.util.List">
|
update shopping_goods set is_del=2 where id in
|
<foreach collection="list" index="index" item="item" open="("
|
separator="," close=")">
|
#{item}
|
</foreach>
|
</delete>
|
|
<!-- 根据id删除 -->
|
<update id="deleteById" >
|
update shopping_goods set is_del=2 where id=#{id}
|
</update>
|
|
|
|
<!-- 分页查询 -->
|
<select id="selectInPage" resultMap="ShoppingGoodsMap">
|
select
|
a.*,
|
(select name from achieve_rule f where f.id=a.achieve_rule_id) as achieveRuleName,
|
(select TYPE_NAME from sys_goods_type b where b.id=a.goods_sort_id) as goodsSortName,
|
(select NAME from shopping_goods_category t where t.id=a.cate_id) as cate_name,
|
(select shop_name from sys_shop_info h where a.SHOP_ID=h.ID ) as shop_name
|
from shopping_goods a
|
where 1=1
|
<if test="record!=null">
|
<if test="record.id != null and record.id !='' ">
|
and id =#{record.id}
|
</if>
|
<if test="record.queryNoGoodsype != null and record.queryNoGoodsype !='' ">
|
and good_type !=#{record.queryNoGoodsype}
|
</if>
|
|
<if test="record.name != null and record.name !='' ">
|
and (instr(name,#{record.name}) or instr(zjm,#{record.name}))
|
</if>
|
<if test="record.zjm != null and record.zjm !='' ">
|
and instr(zjm,#{record.zjm})
|
</if>
|
|
|
<if test="record.staus != null and record.staus !='' ">
|
and staus =#{record.staus}
|
</if>
|
|
<if test="record.isAssemble != null and record.isAssemble !='' ">
|
and is_assemble =#{record.isAssemble}
|
</if>
|
<if test="record.deleted != null and record.deleted !='' ">
|
and deleted =#{record.deleted}
|
</if>
|
<if test="record.cateId != null and record.cateId !='' ">
|
and cate_id =#{record.cateId}
|
</if>
|
|
<if test="record.goodType != null and record.goodType !='' ">
|
and good_type =#{record.goodType}
|
</if>
|
|
<if test="record.isPresent != null and record.isPresent !='' ">
|
and is_present = #{record.isPresent}
|
</if>
|
<if test="record.isVipCar != null and record.isVipCar !='' ">
|
and is_vip_car = #{record.isVipCar}
|
</if>
|
|
|
<if test="record.isCourse != null and record.isCourse !=''">
|
and is_course = #{record.isCourse}
|
</if>
|
|
<if test="record.code != null and record.code !=''">
|
and code = #{record.code}
|
</if>
|
|
|
<if test="record.startTime != null ">
|
and create_time <![CDATA[ >= ]]> #{record.startTime}
|
</if>
|
<if test="record.endTime != null ">
|
and create_time <![CDATA[ <= ]]> #{record.endTime}
|
|
</if>
|
<if test="record.shopId != null and record.shopId !='' ">
|
<![CDATA[ and ( shop_id = #{record.shopId} or
|
( headquarters=1 and ( ISNULL(use_shop) or LENGTH(trim(use_shop))<1 or FIND_IN_SET(#{record.shopId},use_shop))))]]>
|
</if>
|
<if test="record.companyId != null and record.companyId !='' ">
|
and company_id = #{record.companyId}
|
</if>
|
|
<if test="record.isDel != null and record.isDel !='' ">
|
and is_del = #{record.isDel}
|
</if>
|
|
|
<if test="record.achieveRuleId != null and record.achieveRuleId !='' ">
|
and achieve_rule_id = #{record.achieveRuleId}
|
</if>
|
|
|
|
<if test="record.headquarters != null and record.headquarters !='' ">
|
and headquarters = #{record.headquarters}
|
</if>
|
|
</if>
|
|
|
<if test="pageVo !=null"><!-- 判断pageVo对象是否为空 -->
|
<if test="pageVo.sort !=null and pageVo.order !=null">
|
order by
|
${pageVo.sort} ${pageVo.order}
|
</if>
|
<if test="pageVo.offset >=0 and pageVo.limit >0">
|
limit
|
#{pageVo.offset},#{pageVo.limit}
|
</if>
|
</if>
|
|
</select>
|
|
<!-- 查询总条数 -->
|
<select id="selectTotalRecord" resultType="java.lang.Integer">
|
select count(*)
|
from shopping_goods
|
where 1=1
|
<if test="record!=null">
|
<if test="record.id != null and record.id !='' ">
|
and id =#{record.id}
|
</if>
|
<if test="record.queryNoGoodsype != null and record.queryNoGoodsype !='' ">
|
and good_type !=#{record.queryNoGoodsype}
|
</if>
|
|
<if test="record.name != null and record.name !='' ">
|
and (instr(name,#{record.name}) or instr(zjm,#{record.name}))
|
</if>
|
<if test="record.zjm != null and record.zjm !='' ">
|
and instr(zjm,#{record.zjm})
|
</if>
|
|
|
<if test="record.staus != null and record.staus !='' ">
|
and staus =#{record.staus}
|
</if>
|
|
<if test="record.isAssemble != null and record.isAssemble !='' ">
|
and is_assemble =#{record.isAssemble}
|
</if>
|
<if test="record.deleted != null and record.deleted !='' ">
|
and deleted =#{record.deleted}
|
</if>
|
<if test="record.cateId != null and record.cateId !='' ">
|
and cate_id =#{record.cateId}
|
</if>
|
|
<if test="record.goodType != null and record.goodType !='' ">
|
and good_type =#{record.goodType}
|
</if>
|
|
<if test="record.isPresent != null and record.isPresent !='' ">
|
and is_present = #{record.isPresent}
|
</if>
|
<if test="record.isVipCar != null and record.isVipCar !='' ">
|
and is_vip_car = #{record.isVipCar}
|
</if>
|
<if test="record.achieveRuleId != null and record.achieveRuleId !='' ">
|
and achieve_rule_id = #{record.achieveRuleId}
|
</if>
|
|
<if test="record.isCourse != null and record.isCourse !=''">
|
and is_course = #{record.isCourse}
|
</if>
|
|
<if test="record.code != null and record.code !=''">
|
and code = #{record.code}
|
</if>
|
|
|
<if test="record.startTime != null ">
|
and create_time <![CDATA[ >= ]]> #{record.startTime}
|
</if>
|
<if test="record.endTime != null ">
|
and create_time <![CDATA[ <= ]]> #{record.endTime}
|
|
</if>
|
<if test="record.shopId != null and record.shopId !='' ">
|
<![CDATA[ and ( shop_id = #{record.shopId} or
|
( headquarters=1 and ( ISNULL(use_shop) or LENGTH(trim(use_shop))<1 or FIND_IN_SET(#{record.shopId},use_shop))))]]>
|
</if>
|
<if test="record.companyId != null and record.companyId !='' ">
|
and company_id = #{record.companyId}
|
</if>
|
|
<if test="record.isDel != null and record.isDel !='' ">
|
and is_del = #{record.isDel}
|
</if>
|
|
|
|
<if test="record.headquarters != null and record.headquarters !='' ">
|
and headquarters = #{record.headquarters}
|
</if>
|
|
</if>
|
|
|
</select>
|
|
|
<select id="selectAll" resultMap="ShoppingGoodsSimpleMap">
|
select
|
*,
|
(select name from achieve_rule f where f.id=a.achieve_rule_id) as achieveRuleName,
|
(select TYPE_NAME from sys_goods_type b where b.id=a.goods_sort_id) goodsSortName,
|
(select NAME from
|
shopping_goods_category t where t.id=cate_id)
|
cate_name
|
from shopping_goods a
|
where 1=1
|
<if test="record!=null">
|
<if test="record.id != null and record.id !='' ">
|
and id =#{record.id}
|
</if>
|
<if test="record.name != null and record.name !='' ">
|
and (instr(name,#{record.name}) or instr(zjm,#{record.name}))
|
</if>
|
<if test="record.staus != null and record.staus !='' ">
|
and staus =#{record.staus}
|
</if>
|
<if test="record.zjm != null and record.zjm !='' ">
|
and instr(zjm,#{record.zjm})
|
</if>
|
|
<if test="record.isAssemble != null and record.isAssemble !='' ">
|
and is_assemble =#{record.isAssemble}
|
</if>
|
<if test="record.deleted != null and record.deleted !='' ">
|
and deleted =#{record.deleted}
|
</if>
|
<if test="record.cateId != null and record.cateId !='' ">
|
and cate_id =#{record.cateId}
|
</if>
|
|
<if test="record.goodType != null and record.goodType !='' ">
|
and good_type =#{record.goodType}
|
</if>
|
|
<if test="record.isPresent != null and record.isPresent !='' ">
|
and is_present = #{record.isPresent}
|
</if>
|
<if test="record.isVipCar != null and record.isVipCar !='' ">
|
and is_vip_car = #{record.isVipCar}
|
</if>
|
<if test="record.code != null and record.code !=''">
|
and code = #{record.code}
|
</if>
|
|
<if test="record.isCourse != null and record.isCourse !=''">
|
and is_course = #{record.isCourse}
|
</if>
|
|
|
<if test="record.startTime != null ">
|
and create_time <![CDATA[ >= ]]> #{record.startTime}
|
</if>
|
<if test="record.endTime != null ">
|
and create_time <![CDATA[ <= ]]> #{record.endTime}
|
</if>
|
<if test="record.shopId != null and record.shopId !='' ">
|
<![CDATA[ and ( shop_id = #{record.shopId} or
|
( headquarters=1 and ( ISNULL(use_shop) or LENGTH(trim(use_shop))<1 or FIND_IN_SET(#{record.shopId},use_shop))))]]>
|
</if>
|
<if test="record.companyId != null and record.companyId !='' ">
|
and company_id = #{record.companyId}
|
</if>
|
|
<if test="record.useShop != null and record.useShop !='' ">
|
and FIND_IN_SET(#{record.useShop},use_shop)
|
</if>
|
|
<if test="record.headquarters != null and record.headquarters !='' ">
|
and headquarters = #{record.headquarters}
|
</if>
|
<if test="record.isDel != null and record.isDel !='' ">
|
and is_del = #{record.isDel}
|
</if>
|
|
|
|
</if>
|
</select>
|
<select id="selectBuyCount" resultType="java.lang.Integer">
|
SELECT COUNT(1) from sys_order_item a
|
LEFT JOIN sys_order b ON b.ID = a.ORDER_ID
|
LEFT JOIN shopping_goods c ON a.goods_id =c.id
|
WHERE c.is_once = '是' AND b.STATU != '已取消'
|
AND a.goods_id =#{goodsId} AND b.VIP_ID =#{vipId}
|
|
</select>
|
|
|
<!-- 根据id查询 -->
|
<select id="selectById" resultMap="ShoppingGoodsMap">
|
select
|
*,
|
(select TYPE_NAME from sys_goods_type b where b.id=goods_sort_id) goodsSortName,
|
(select NAME from shopping_goods_category t where
|
t.id=cate_id)
|
cate_name
|
from shopping_goods a
|
where id=#{id}
|
</select>
|
|
|
<!-- 根据code查询 -->
|
<select id="findByCode" resultMap="ShoppingGoodsMap">
|
select
|
*,
|
(select name from achieve_rule f where f.id=a.achieve_rule_id) as achieveRuleName,
|
(select TYPE_NAME from sys_goods_type b where b.id=a.goods_sort_id) goodsSortName,
|
(select NAME from shopping_goods_category t where
|
t.id=cate_id)
|
cate_name
|
from shopping_goods a
|
where a.code=#{code} and a.is_del=1
|
</select>
|
|
<!-- 根据id查询 -->
|
<select id="selectSimpleMapById" resultMap="ShoppingGoodsSimpleMap">
|
select
|
*,
|
(select name from achieve_rule f where f.id=a.achieve_rule_id) as achieveRuleName,
|
(select TYPE_NAME from sys_goods_type b where b.id=a.goods_sort_id) goodsSortName,
|
(select NAME from
|
shopping_goods_category t where t.id=cate_id)
|
cate_name
|
from shopping_goods a
|
where id=#{id}
|
</select>
|
|
|
|
|
|
|
|
|
<!-- 根据对象查询 -->
|
<select id="selectByModel" resultMap="ShoppingGoodsMap">
|
select
|
*,
|
(select name from achieve_rule f where f.id=a.achieve_rule_id) as achieveRuleName,
|
(select TYPE_NAME from sys_goods_type b where b.id=a.goods_sort_id) goodsSortName,
|
(select NAME from
|
shopping_goods_category t where t.id=cate_id)
|
cate_name
|
from shopping_goods a
|
where 1=1
|
<if test="record!=null">
|
<if test="record.id != null and record.id !='' ">
|
and id =#{record.id}
|
</if>
|
<if test="record.zjm != null and record.zjm !='' ">
|
and instr(zjm,#{record.zjm})
|
</if>
|
|
<if test="record.name != null and record.name !='' ">
|
and (instr(name,#{record.name}) or instr(zjm,#{record.name}))
|
</if>
|
<if test="record.staus != null and record.staus !='' ">
|
and staus =#{record.staus}
|
</if>
|
|
<if test="record.isAssemble != null and record.isAssemble !='' ">
|
and is_assemble =#{record.isAssemble}
|
</if>
|
<if test="record.deleted != null and record.deleted !='' ">
|
and deleted =#{record.deleted}
|
</if>
|
<if test="record.code != null and record.code !=''">
|
and code = #{record.code}
|
</if>
|
<if test="record.cateId != null and record.cateId !='' ">
|
and cate_id =#{record.cateId}
|
</if>
|
|
<if test="record.goodType != null and record.goodType !='' ">
|
and good_type =#{record.goodType}
|
</if>
|
|
<if test="record.isPresent != null and record.isPresent !='' ">
|
and is_present = #{record.isPresent}
|
</if>
|
<if test="record.isVipCar != null and record.isVipCar !='' ">
|
and is_vip_car = #{record.isVipCar}
|
</if>
|
<if test="record.isDel != null and record.isDel !='' ">
|
and is_del = #{record.isDel}
|
</if>
|
|
<if test="record.isCourse != null and record.isCourse !=''">
|
and is_course = #{record.isCourse}
|
</if>
|
<if test="record.vipGradId != null and record.vipGradId !=''">
|
and vip_grad_id = #{record.vipGradId}
|
</if>
|
|
<if test="record.shopId != null and record.shopId !='' ">
|
<![CDATA[ and ( shop_id = #{record.shopId} or
|
( headquarters=1 and ( ISNULL(use_shop) or LENGTH(trim(use_shop))<1 or FIND_IN_SET(#{record.shopId},use_shop))))]]>
|
</if>
|
<if test="record.companyId != null and record.companyId !='' ">
|
and company_id = #{record.companyId}
|
</if>
|
|
<if test="record.useShop != null and record.useShop !='' ">
|
and FIND_IN_SET(#{record.useShop},use_shop)
|
</if>
|
|
<if test="record.headquarters != null and record.headquarters !='' ">
|
and headquarters = #{record.headquarters}
|
</if>
|
|
|
</if>
|
</select>
|
|
<!-- 根据对象查询 -->
|
<select id="selectByModel1" resultMap="ShoppingGoodsMap">
|
select
|
*,
|
(select name from achieve_rule f where f.id=a.achieve_rule_id) as achieveRuleName,
|
(select TYPE_NAME from sys_goods_type b where b.id=a.goods_sort_id) goodsSortName,
|
(select NAME from
|
shopping_goods_category t where t.id=cate_id)
|
cate_name
|
|
from shopping_goods a
|
where 1=1
|
<if test="record!=null">
|
<if test="record.id != null and record.id !='' ">
|
and id =#{record.id}
|
</if>
|
<if test="record.name != null and record.name !='' ">
|
and name =#{record.name}
|
</if>
|
<if test="record.zjm != null and record.zjm !='' ">
|
and instr(zjm,#{record.zjm})
|
</if>
|
|
<if test="record.staus != null and record.staus !='' ">
|
and staus =#{record.staus}
|
</if>
|
|
<if test="record.isAssemble != null and record.isAssemble !='' ">
|
and is_assemble =#{record.isAssemble}
|
</if>
|
<if test="record.deleted != null and record.deleted !='' ">
|
and deleted =#{record.deleted}
|
</if>
|
<if test="record.cateId != null and record.cateId !='' ">
|
and cate_id =#{record.cateId}
|
</if>
|
<if test="record.code != null and record.code !=''">
|
and code = #{record.code}
|
</if>
|
<if test="record.goodType != null and record.goodType !='' ">
|
and good_type =#{record.goodType}
|
</if>
|
<if test="record.isDel != null and record.isDel !='' ">
|
and is_del = #{record.isDel}
|
</if>
|
|
<if test="record.isPresent != null and record.isPresent !='' ">
|
and is_present = #{record.isPresent}
|
</if>
|
<if test="record.isVipCar != null and record.isVipCar !='' ">
|
and is_vip_car = #{record.isVipCar}
|
</if>
|
|
|
<if test="record.isCourse != null and record.isCourse !=''">
|
and is_course = #{record.isCourse}
|
</if>
|
|
<if test="record.shopId != null and record.shopId !='' ">
|
<![CDATA[ and ( shop_id = #{record.shopId} or
|
( headquarters=1 and ( ISNULL(use_shop) or LENGTH(trim(use_shop))<1 or FIND_IN_SET(#{record.shopId},use_shop))))]]>
|
</if>
|
<if test="record.companyId != null and record.companyId !='' ">
|
and company_id = #{record.companyId}
|
</if>
|
|
<if test="record.useShop != null and record.useShop !='' ">
|
and FIND_IN_SET(#{record.useShop},use_shop)
|
</if>
|
|
<if test="record.headquarters != null and record.headquarters !='' ">
|
and headquarters = #{record.headquarters}
|
</if>
|
|
|
</if>
|
</select>
|
|
|
<!-- 分页查询 -->
|
<select id="selectInPageNoTaocan" resultMap="ShoppingGoodsMap">
|
select
|
*,
|
(select name from achieve_rule f where f.id=a.achieve_rule_id) as achieveRuleName,
|
(select TYPE_NAME from sys_goods_type b where b.id=a.goods_sort_id) goodsSortName,
|
(select NAME from
|
shopping_goods_category t where t.id=cate_id)
|
cate_name
|
from shopping_goods a
|
where goodType !='套餐'
|
<if test="record!=null">
|
<if test="record.id != null and record.id !='' ">
|
and id =#{record.id}
|
</if>
|
<if test="record.name != null and record.name !='' ">
|
and (instr(name,#{record.name}) or instr(zjm,#{record.name}))
|
</if>
|
<if test="record.staus != null and record.staus !='' ">
|
and staus =#{record.staus}
|
</if>
|
<if test="record.isDel != null and record.isDel !='' ">
|
and is_del = #{record.isDel}
|
</if>
|
<if test="record.zjm != null and record.zjm !='' ">
|
and instr(zjm,#{record.zjm})
|
</if>
|
|
<if test="record.isAssemble != null and record.isAssemble !='' ">
|
and is_assemble =#{record.isAssemble}
|
</if>
|
<if test="record.deleted != null and record.deleted !='' ">
|
and deleted =#{record.deleted}
|
</if>
|
<if test="record.cateId != null and record.cateId !='' ">
|
and cate_id =#{record.cateId}
|
</if>
|
<if test="record.code != null and record.code !=''">
|
and code = #{record.code}
|
</if>
|
<if test="record.goodType != null and record.goodType !='' ">
|
and good_type =#{record.goodType}
|
</if>
|
|
<if test="record.isPresent != null and record.isPresent !='' ">
|
and is_present = #{record.isPresent}
|
</if>
|
|
<if test="record.isVipCar != null and record.isVipCar !='' ">
|
and is_vip_car = #{record.isVipCar}
|
</if>
|
|
|
|
<if test="record.isCourse != null and record.isCourse !=''">
|
and is_course = #{record.isCourse}
|
</if>
|
|
<if test="record.shopId != null and record.shopId !='' ">
|
<![CDATA[ and ( shop_id = #{record.shopId} or
|
( headquarters=1 and ( ISNULL(use_shop) or LENGTH(trim(use_shop))<1 or FIND_IN_SET(#{record.shopId},use_shop))))]]>
|
</if>
|
<if test="record.companyId != null and record.companyId !='' ">
|
and company_id = #{record.companyId}
|
</if>
|
|
<if test="record.useShop != null and record.useShop !='' ">
|
and FIND_IN_SET(#{record.useShop},use_shop)
|
</if>
|
|
<if test="record.headquarters != null and record.headquarters !='' ">
|
and headquarters = #{record.headquarters}
|
</if>
|
|
</if>
|
<if test="pageVo !=null"><!-- 判断pageVo对象是否为空 -->
|
<if test="pageVo.sort !=null and pageVo.order !=null">
|
order by
|
${pageVo.sort} ${pageVo.order}
|
</if>
|
<if test="pageVo.offset >=0 and pageVo.limit >0">
|
limit
|
#{pageVo.offset},#{pageVo.limit}
|
</if>
|
</if>
|
|
</select>
|
|
<!-- 查询总条数 -->
|
<select id="selectTotalNoTaocan" resultType="java.lang.Integer">
|
select count(*)
|
from shopping_goods
|
where goodType !='套餐'
|
<if test="record!=null">
|
<if test="record.id != null and record.id !='' ">
|
and id =#{record.id}
|
</if>
|
<if test="record.name != null and record.name !='' ">
|
and (instr(name,#{record.name}) or instr(zjm,#{record.name}))
|
</if>
|
<if test="record.staus != null and record.staus !='' ">
|
and staus =#{record.staus}
|
</if>
|
<if test="record.code != null and record.code !=''">
|
and code = #{record.code}
|
</if>
|
<if test="record.isAssemble != null and record.isAssemble !='' ">
|
and is_assemble =#{record.isAssemble}
|
</if>
|
<if test="record.zjm != null and record.zjm !='' ">
|
and instr(zjm,#{record.zjm})
|
</if>
|
|
<if test="record.deleted != null and record.deleted !='' ">
|
and deleted =#{record.deleted}
|
</if>
|
<if test="record.cateId != null and record.cateId !='' ">
|
and cate_id =#{record.cateId}
|
</if>
|
|
<if test="record.goodType != null and record.goodType !='' ">
|
and good_type =#{record.goodType}
|
</if>
|
|
<if test="record.isPresent != null and record.isPresent !='' ">
|
and is_present = #{record.isPresent}
|
</if>
|
<if test="record.isDel != null and record.isDel !='' ">
|
and is_del = #{record.isDel}
|
</if>
|
|
<if test="record.isVipCar != null and record.isVipCar !='' ">
|
and is_vip_car = #{record.isVipCar}
|
</if>
|
|
|
|
<if test="record.isCourse != null and record.isCourse !=''">
|
and is_course = #{record.isCourse}
|
</if>
|
|
<if test="record.shopId != null and record.shopId !='' ">
|
<![CDATA[ and ( shop_id = #{record.shopId} or
|
( headquarters=1 and ( ISNULL(use_shop) or LENGTH(trim(use_shop))<1 or FIND_IN_SET(#{record.shopId},use_shop))))]]>
|
</if>
|
<if test="record.companyId != null and record.companyId !='' ">
|
and company_id = #{record.companyId}
|
</if>
|
|
<if test="record.useShop != null and record.useShop !='' ">
|
and FIND_IN_SET(#{record.useShop},use_shop)
|
</if>
|
|
<if test="record.headquarters != null and record.headquarters !='' ">
|
and headquarters = #{record.headquarters}
|
</if>
|
|
|
</if>
|
</select>
|
|
<!-- 定时器 商品自动下架-->
|
<update id="automaticUpdate">
|
UPDATE shopping_goods SET staus="下架"
|
where sale_off_time IS NOT NULL
|
AND NOW() > sale_off_time
|
</update>
|
<update id="bachUpdate">
|
|
UPDATE shopping_goods set ${filed}=#{value}
|
where id in <foreach collection="list" index="index" item="item" open="("
|
separator="," close=")">
|
#{item}
|
</foreach>
|
|
</update>
|
<update id="updateInvalidProduct">
|
update shopping_goods set staus = '下架'
|
where date_format(now(), '%Y-%m-%d') > date_format(sale_off_time, '%Y-%m-%d') and staus='上架'
|
</update>
|
|
|
<!-- 根据code查询 -->
|
<select id="selectVipCzGoods" resultMap="ShoppingGoodsMap">
|
select
|
* from shopping_goods
|
where company_id=1 and code='vipCzk';
|
</select>
|
|
|
<select id="selectShoppingGoodsApiInPage" resultType="com.matrix.system.app.vo.ShoppingGoodsListVo">
|
select
|
id id,
|
code goodsCode,
|
name name,
|
seal_pice price,
|
is_present isPresent,
|
unit unit,
|
measure measure,
|
a.good_type goodsType
|
from shopping_goods a
|
where 1=1 and staus = '上架' and a.is_del=1
|
<if test="record.queryKey != null and record.queryKey != ''">
|
and (instr(name,#{record.queryKey}) or instr(code ,#{record.queryKey}) or instr(zjm ,#{record.queryKey}))
|
</if>
|
<if test="record.cateId!=null">
|
and a.cate_id in ( select b.id from shopping_goods_category b where (b.id=#{record.cateId} or b.parent_id=#{record.cateId}))
|
</if>
|
<if test="record.shopId != null and record.shopId !='' ">
|
<![CDATA[ and ( a.shop_id = #{record.shopId} or
|
( a.headquarters=1 and ( ISNULL(a.use_shop) or LENGTH(trim(a.use_shop))<1 or FIND_IN_SET(#{record.shopId},a.use_shop))))]]>
|
</if>
|
<if test="record.companyId != null and record.companyId !='' ">
|
and a.company_id=#{record.companyId}
|
</if>
|
<if test="record.goodType!=null">
|
and a.good_type=#{record.goodType}
|
</if>
|
<if test="pageVo !=null"><!-- 判断pageVo对象是否为空 -->
|
<if test="pageVo.sort !=null and pageVo.order !=null">
|
order by ${pageVo.sort} ${pageVo.order}
|
</if>
|
<if test="pageVo.offset >=0 and pageVo.limit >0">
|
limit #{pageVo.offset},#{pageVo.limit}
|
</if>
|
</if>
|
</select>
|
|
<select id="selectShopppingGoodsAipTotal" resultType="java.lang.Integer">
|
select count(1)
|
from shopping_goods a
|
where 1=1 and staus = '上架'
|
<if test="record.queryKey != null and record.queryKey != ''">
|
and (instr(name,#{record.queryKey}) or instr(code ,#{record.queryKey}) or instr(zjm ,#{record.queryKey}))
|
</if>
|
<if test="record.cateId!=null">
|
and a.cate_id in ( select b.id from shopping_goods_category b where (b.id=#{record.cateId} or b.parent_id=#{record.cateId}))
|
</if>
|
<if test="record.shopId != null and record.shopId !='' ">
|
<![CDATA[ and ( a.shop_id = #{record.shopId} or
|
( a.headquarters=1 and ( ISNULL(a.use_shop) or LENGTH(trim(a.use_shop))<1 or FIND_IN_SET(#{record.shopId},a.use_shop))))]]>
|
</if>
|
<if test="record.companyId != null and record.companyId !='' ">
|
and a.company_id=#{record.companyId}
|
</if>
|
<if test="record.goodType!=null">
|
and a.good_type=#{record.goodType}
|
</if>
|
</select>
|
|
<select id="selectByIds" resultMap="ShoppingGoodsSimpleMap">
|
select
|
*
|
from shopping_goods
|
where id in
|
<foreach collection="ids" item="item" separator="," open="(" close=")">
|
#{item}
|
</foreach>
|
</select>
|
</mapper>
|