Browse Source

修改bug

multiwx
xh-pan1 2 years ago
parent
commit
383439e550
  1. 3
      cereshop-app/src/main/java/com/shop/cereshop/app/controller/canvas/CanvasController.java
  2. 19
      cereshop-app/src/main/java/com/shop/cereshop/app/param/canvas/CanvasAppProductParam.java
  3. 30
      cereshop-app/src/main/java/com/shop/cereshop/app/service/product/impl/CereShopProductServiceImpl.java
  4. 61
      cereshop-app/src/main/resources/mybatis/mapper/product/CereShopProductDAO.xml
  5. 5
      cereshop-business/src/main/java/com/shop/cereshop/business/dao/product/CereShopProductDAO.java
  6. 15
      cereshop-business/src/main/java/com/shop/cereshop/business/page/canvas/CanvasProductParam.java
  7. 2
      cereshop-business/src/main/java/com/shop/cereshop/business/service/product/impl/CereProductClassifyServiceImpl.java
  8. 22
      cereshop-business/src/main/java/com/shop/cereshop/business/service/product/impl/CereShopProductServiceImpl.java
  9. 2
      cereshop-business/src/main/resources/mybatis/mapper/product/CereProductClassifyDAO.xml
  10. 197
      cereshop-business/src/main/resources/mybatis/mapper/product/CereShopProductDAO.xml
  11. 4
      cereshop-commons/src/main/java/com/shop/cereshop/commons/constant/IntegerEnum.java

3
cereshop-app/src/main/java/com/shop/cereshop/app/controller/canvas/CanvasController.java

@ -30,6 +30,7 @@ import com.shop.cereshop.app.service.platformtool.CerePlatformSeckillService;
import com.shop.cereshop.app.service.price.CereShopPriceService;
import com.shop.cereshop.app.service.product.CereProductMemberService;
import com.shop.cereshop.app.service.product.CereShopProductService;
import com.shop.cereshop.app.utils.ContextUtil;
import com.shop.cereshop.commons.constant.CoReturnFormat;
import com.shop.cereshop.commons.domain.buyer.CereBuyerUser;
import com.shop.cereshop.commons.domain.canvas.CerePlatformCanvas;
@ -103,6 +104,7 @@ public class CanvasController {
@GetMapping("getProducts")
@ApiOperation(value = "商家编辑查询")
public Result<Page<CanvasProduct>> getProducts(CanvasAppProductParam param) throws CoBusinessException,Exception{
param.setProject(ContextUtil.getProject());
Page page=cereShopProductService.getCanvasProducts(param);
return new Result(page, CoReturnFormat.SUCCESS);
}
@ -115,6 +117,7 @@ public class CanvasController {
@GetMapping("getProducts2")
@ApiOperation(value = "商家编辑查询新接口")
public Result<Page<CanvasProduct>> getProducts2(CanvasAppProductParam param) throws CoBusinessException,Exception{
param.setProject(ContextUtil.getProject());
Page page=cereShopProductService.getProducts2(param);
return new Result(page, CoReturnFormat.SUCCESS);
}

19
cereshop-app/src/main/java/com/shop/cereshop/app/param/canvas/CanvasAppProductParam.java

@ -20,6 +20,12 @@ import java.util.List;
public class CanvasAppProductParam extends PageParam {
/**
* 所属项目
*/
@ApiModelProperty(value = "所属项目",hidden = true)
private String project;
/**
* 搜索字段
*/
@ApiModelProperty(value = "搜索字段")
@ -44,9 +50,9 @@ public class CanvasAppProductParam extends PageParam {
private Long shopId;
/**
* 活动类型 1-拼团活动 2-秒杀活动 3-限时折扣活动
* 活动类型 1-拼团活动 2-秒杀活动 3-限时折扣活动 4-新品推荐 5-低价优选 6-尖端首发 7-热销排行
*/
@ApiModelProperty(value = "活动类型 1-拼团活动 2-秒杀活动 3-限时折扣活动")
@ApiModelProperty(value = "活动类型 1-拼团活动 2-秒杀活动 3-限时折扣活动 4-新品推荐 5-低价优选 6-尖端首发 7-热销排行")
private Integer type;
/**
@ -54,4 +60,13 @@ public class CanvasAppProductParam extends PageParam {
*/
@ApiModelProperty(value = "商品id数组")
private List<Long> ids;
@ApiModelProperty("是否新品")
private Integer ifNew;
@ApiModelProperty("是否首发")
private Integer ifFirst;
@ApiModelProperty("是否低价")
private Integer ifLowPrice;
}

30
cereshop-app/src/main/java/com/shop/cereshop/app/service/product/impl/CereShopProductServiceImpl.java

@ -923,6 +923,17 @@ public class CereShopProductServiceImpl implements CereShopProductService {
list=cereShopProductDAO.getSeckillProducts(param);
}else if(IntegerEnum.CANVAS_ACTIVITY_DISCOUNT.getCode().equals(param.getType())){
list=cereShopProductDAO.getDiscountProducts(param);
}else if(IntegerEnum.CANVAS_ACTIVITY_XPTJ.getCode().equals(param.getType())){
param.setIfNew(1);
list=cereShopProductDAO.getCanvasProducts(param);
}else if(IntegerEnum.CANVAS_ACTIVITY_DJYX.getCode().equals(param.getType())){
param.setIfLowPrice(1);
list=cereShopProductDAO.getCanvasProducts(param);
}else if(IntegerEnum.CANVAS_ACTIVITY_JDSF.getCode().equals(param.getType())){
param.setIfFirst(1);
list=cereShopProductDAO.getCanvasProducts(param);
}else if(IntegerEnum.CANVAS_ACTIVITY_RXPH.getCode().equals(param.getType())){
list=cereShopProductDAO.getCanvasProducts(param);
}else {
list=cereShopProductDAO.getCanvasProducts(param);
}
@ -975,14 +986,29 @@ public class CereShopProductServiceImpl implements CereShopProductService {
list=cereShopProductDAO.getSeckillProducts(param);
}else if(IntegerEnum.CANVAS_ACTIVITY_DISCOUNT.getCode().equals(param.getType())){
list=cereShopProductDAO.getDiscountProducts(param);
}else if(IntegerEnum.CANVAS_ACTIVITY_XPTJ.getCode().equals(param.getType())){
param.setIfNew(1);
list=cereShopProductDAO.getCanvasProducts2(param);
}else if(IntegerEnum.CANVAS_ACTIVITY_DJYX.getCode().equals(param.getType())){
param.setIfLowPrice(1);
list=cereShopProductDAO.getCanvasProducts2(param);
}else if(IntegerEnum.CANVAS_ACTIVITY_JDSF.getCode().equals(param.getType())){
param.setIfFirst(1);
list=cereShopProductDAO.getCanvasProducts2(param);
}else if(IntegerEnum.CANVAS_ACTIVITY_RXPH.getCode().equals(param.getType())){
list=cereShopProductDAO.getCanvasProducts2(param);
}else {
list= cereShopProductDAO.getCanvasProducts2(param);
}
if(!IntegerEnum.CANVAS_ACTIVITY_GROUP_WORK.getCode().equals(param.getType()) &&
!IntegerEnum.CANVAS_ACTIVITY_SECKILL.getCode().equals(param.getType()) &&
!IntegerEnum.CANVAS_ACTIVITY_DISCOUNT.getCode().equals(param.getType())) {
//补充查询产品付款人数
productUsersMap = cereShopProductDAO.getProductUsers(param);
//补充查询产品sku信息
productSkuMap = cereShopProductDAO.getProductSku(param);
productSkuMap = cereShopProductDAO.getProductSku(param);
//补充查询产品购买数据
productNumberMap = cereShopProductDAO.getProductNumber(param);
productNumberMap = cereShopProductDAO.getProductNumber(param);
}
//填充产品属性
fillProductProperties(list, productUsersMap, productSkuMap, productNumberMap);

61
cereshop-app/src/main/resources/mybatis/mapper/product/CereShopProductDAO.xml

@ -389,12 +389,13 @@
<select id="getCanvasProducts" parameterType="com.shop.cereshop.app.param.canvas.CanvasAppProductParam" resultType="com.shop.cereshop.app.page.canvas.CanvasProduct">
SELECT a.shop_id,d.shop_name,d.shop_logo,a.product_id,a.product_name, ifnull(x.users, 0) + a.fictitious_number as users,
IF(h.image IS NULL OR h.image='',c.product_image,h.image) image,
b.price,b.sku_id,b.original_price,IF(f.number IS NULL, a.fictitious_number, f.number + a.fictitious_number) number,b.stock_number from cere_shop_product a
b.price,b.sku_id,b.original_price,IF(f.number IS NULL, a.fictitious_number, f.number + a.fictitious_number) number,b.stock_number
from cere_shop_product a
LEFT JOIN (SELECT a.product_id,a.price,a.sku_id,a.original_price,a.stock_number from cere_product_sku a,cere_shop_product b
where a.product_id=b.product_id GROUP BY a.product_id) b ON a.product_id=b.product_id
LEFT JOIN (SELECT a.product_id,a.product_image from cere_product_image a,cere_shop_product b
where a.product_id=b.product_id GROUP BY a.product_id) c ON a.product_id=c.product_id
LEFT JOIN cere_platform_shop d ON a.shop_id=d.shop_id
INNER JOIN cere_platform_shop d ON a.shop_id=d.shop_id
LEFT JOIN cere_product_classify e ON a.classify_id=e.classify_id
LEFT JOIN cere_product_classify cpcb ON a.classify_business_id=cpcb.classify_id
LEFT JOIN (SELECT SUM(number) number,sku_id,order_id from cere_order_product GROUP BY sku_id) f ON b.sku_id=f.sku_id
@ -415,6 +416,9 @@
and (a.classify_id=#{classifyId} OR e.classify_level_hierarchy like concat('%/',#{classifyId},'%')
OR a.classify_business_id=#{classifyId} OR cpcb.classify_level_hierarchy like concat('%/',#{classifyId},'%'))
</if>
<if test="project!=null and project!=''">
AND d.business_id=#{project}
</if>
<if test="ids!=null and ids.size()>0">
and a.product_id in (
<foreach collection="ids" item="id" index="index" separator=",">
@ -422,16 +426,36 @@
</foreach>
)
</if>
ORDER BY a.create_time DESC
<if test="ifNew!=null">
and a.if_new=#{ifNew}
</if>
<if test="ifFirst!=null">
and a.if_first=#{ifFirst}
</if>
<if test="ifLowPrice!=null">
and a.if_low_price=#{ifLowPrice}
</if>
<if test="type==7">
order by number desc
</if>
<if test="type!=7">
ORDER BY a.create_time DESC
</if>
</select>
<select id="getCanvasProducts2" parameterType="com.shop.cereshop.app.param.canvas.CanvasAppProductParam" resultType="com.shop.cereshop.app.page.canvas.CanvasProduct">
SELECT a.shop_id,d.shop_name,d.shop_logo,a.product_id,a.product_name,a.fictitious_number
SELECT a.shop_id,d.shop_name,d.shop_logo,a.product_id,a.product_name,a.fictitious_number,
IF(f.number IS NULL, a.fictitious_number, f.number + a.fictitious_number) number
from cere_shop_product a
INNER JOIN cere_platform_shop d ON a.shop_id=d.shop_id
LEFT JOIN cere_product_classify e ON a.classify_id=e.classify_id
LEFT JOIN cere_product_classify cpcb ON a.classify_business_id=cpcb.classify_id
LEFT JOIN (SELECT SUM(number) number,product_id,order_id from cere_order_product GROUP BY product_id) f ON a.product_id=f.product_id
where a.shelve_state=1 and d.state=1
<if test="project!=null and project!=''">
AND d.business_id=#{project}
</if>
<if test="search!=null and search!=''">
and (d.shop_name like concat('%',#{search},'%') OR
a.product_id like concat('%',#{search},'%') OR
@ -453,7 +477,22 @@
</foreach>
)
</if>
ORDER BY a.update_time DESC, a.create_time DESC, a.product_id ASC
<if test="ifNew!=null">
and a.if_new=#{ifNew}
</if>
<if test="ifFirst!=null">
and a.if_first=#{ifFirst}
</if>
<if test="ifLowPrice!=null">
and a.if_low_price=#{ifLowPrice}
</if>
<if test="type==7">
order by number desc,a.update_time DESC, a.create_time DESC, a.product_id ASC
</if>
<if test="type!=7">
ORDER BY a.update_time DESC, a.create_time DESC, a.product_id ASC
</if>
</select>
<select id="getProductUsers" parameterType="com.shop.cereshop.app.param.canvas.CanvasAppProductParam"
@ -644,9 +683,15 @@
</select>
<select id="getSeckillProducts" parameterType="com.shop.cereshop.app.param.canvas.CanvasAppProductParam" resultType="com.shop.cereshop.app.page.canvas.CanvasProduct">
SELECT b.shop_id,d.shop_name,d.shop_logo,a.product_id,b.product_name, ifnull(x.users, 0) + b.fictitious_number as users, h.effective_start start_time,h.effective_end end_time,h.state,
IF(m.image IS NULL OR m.image='',c.product_image,m.image) image,h.if_enable,h.enable_time,
a.seckill_price price,a.sku_id,n.price original_price,IF(f.number IS NULL, b.fictitious_number, f.number + b.fictitious_number) number,n.stock_number FROM cere_shop_seckill_detail a
SELECT b.shop_id,d.shop_name,d.shop_logo,a.product_id,b.product_name,
ifnull(x.users, 0) + b.fictitious_number as users, h.effective_start start_time,
h.effective_end end_time,h.state,
IF(m.image IS NULL OR m.image='',c.product_image,m.image) image,
h.if_enable,h.enable_time,
a.seckill_price price,a.sku_id,n.price original_price,
IF(f.number IS NULL, b.fictitious_number, f.number + b.fictitious_number) number,
n.stock_number
FROM cere_shop_seckill_detail a
LEFT JOIN cere_shop_product b ON a.product_id=b.product_id
LEFT JOIN (SELECT a.product_id,a.product_image from cere_product_image a,cere_shop_product b
where a.product_id=b.product_id GROUP BY a.product_id) c ON a.product_id=c.product_id

5
cereshop-business/src/main/java/com/shop/cereshop/business/dao/product/CereShopProductDAO.java

@ -32,6 +32,11 @@ public interface CereShopProductDAO extends BaseMapper<CereShopProduct> {
CereShopProduct checkName(@Param("shopId") Long shopId,@Param("classifyId") Long classifyId,@Param("productName") String productName);
List<CanvasProduct> getGroupWorkProducts(CanvasProductParam param);
List<CanvasProduct> getSeckillProducts(CanvasProductParam param);
List<CanvasProduct> getDiscountProducts(CanvasProductParam param);
List<CanvasProduct> getProducts(CanvasProductParam param);
List<CanvasShop> getShops(CanvasProductParam param);

15
cereshop-business/src/main/java/com/shop/cereshop/business/page/canvas/CanvasProductParam.java

@ -66,4 +66,19 @@ public class CanvasProductParam extends PageParam {
*/
@ApiModelProperty(value = "商家优惠券id")
private Long shopCouponId;
/**
* 活动类型 1-拼团活动 2-秒杀活动 3-限时折扣活动 4-新品推荐 5-低价优选 6-尖端首发 7-热销排行
*/
@ApiModelProperty(value = "活动类型 1-拼团活动 2-秒杀活动 3-限时折扣活动 4-新品推荐 5-低价优选 6-尖端首发 7-热销排行")
private Integer type;
@ApiModelProperty("是否新品")
private Integer ifNew;
@ApiModelProperty("是否首发")
private Integer ifFirst;
@ApiModelProperty("是否低价")
private Integer ifLowPrice;
}

2
cereshop-business/src/main/java/com/shop/cereshop/business/service/product/impl/CereProductClassifyServiceImpl.java

@ -367,7 +367,7 @@ public class CereProductClassifyServiceImpl implements CereProductClassifyServic
secondClassify.initMap(cereProductClassifyLangInfoList);
secondClassify.initData();
if(CollectionUtils.isNotEmpty(secondClassify.getChilds())) {
for (CereProductClassify thirdClassify : classify.getChilds()) {
for (CereProductClassify thirdClassify : secondClassify.getChilds()) {
thirdClassify.initMap(cereProductClassifyLangInfoList);
thirdClassify.initData();
}

22
cereshop-business/src/main/java/com/shop/cereshop/business/service/product/impl/CereShopProductServiceImpl.java

@ -789,7 +789,27 @@ public class CereShopProductServiceImpl implements CereShopProductService {
@Override
public Page getProducts(CanvasProductParam param) throws CoBusinessException {
PageHelper.startPage(param.getPage(),param.getPageSize());
List<CanvasProduct> list=cereShopProductDAO.getProducts(param);
List<CanvasProduct> list=null;
if(IntegerEnum.CANVAS_ACTIVITY_GROUP_WORK.getCode().equals(param.getType())){
list=cereShopProductDAO.getGroupWorkProducts(param);
}else if(IntegerEnum.CANVAS_ACTIVITY_SECKILL.getCode().equals(param.getType())){
list=cereShopProductDAO.getSeckillProducts(param);
}else if(IntegerEnum.CANVAS_ACTIVITY_DISCOUNT.getCode().equals(param.getType())){
list=cereShopProductDAO.getDiscountProducts(param);
}else if(IntegerEnum.CANVAS_ACTIVITY_XPTJ.getCode().equals(param.getType())){
param.setIfNew(1);
list=cereShopProductDAO.getProducts(param);
}else if(IntegerEnum.CANVAS_ACTIVITY_DJYX.getCode().equals(param.getType())){
param.setIfLowPrice(1);
list=cereShopProductDAO.getProducts(param);
}else if(IntegerEnum.CANVAS_ACTIVITY_JDSF.getCode().equals(param.getType())){
param.setIfFirst(1);
list=cereShopProductDAO.getProducts(param);
}else if(IntegerEnum.CANVAS_ACTIVITY_RXPH.getCode().equals(param.getType())){
list=cereShopProductDAO.getProducts(param);
}else {
list=cereShopProductDAO.getProducts(param);
}
List<Long> classifyIdList = new ArrayList<>();
classifyIdList.addAll(list.stream().map(CanvasProduct::getProductId).collect(Collectors.toList()));

2
cereshop-business/src/main/resources/mybatis/mapper/product/CereProductClassifyDAO.xml

@ -170,7 +170,7 @@
</select>
<select id="findAll" resultType="com.shop.cereshop.commons.domain.product.Classify">
SELECT classify_id id,classify_pid parentId,classify_name categoryName, classify_level depth
SELECT classify_id id,classify_pid parentId,classify_name categoryName, classify_level depth,classify_image
FROM cere_product_classify where classify_level=1 AND project=#{project}
</select>

197
cereshop-business/src/main/resources/mybatis/mapper/product/CereShopProductDAO.xml

@ -246,17 +246,17 @@
<select id="getProducts" parameterType="com.shop.cereshop.business.page.canvas.CanvasProductParam"
resultType="com.shop.cereshop.business.page.canvas.CanvasProduct">
SELECT
a.shop_id,
csp.shop_id,
d.shop_name,
a.product_id,
a.product_name,
csp.product_id,
csp.product_name,
IFNULL(
(SELECT SUM(cso.buyer_user_id) number from cere_order_product cop
INNER JOIN cere_shop_order cso ON cop.order_id=cso.order_id and cso.state in (2,3,4)
<if test="project!=null and project != ''">
AND cso.project = #{project}
</if>
WHERE cop.product_id = a.product_id), 0) users,
WHERE cop.product_id = csp.product_id), 0) users,
d.shop_logo,
IF(b.image IS NULL OR b.image='',c.product_image,b.image) image,
b.price,
@ -268,9 +268,9 @@
<if test="project!=null and project != ''">
AND cso.project = #{project}
</if>
WHERE cop.product_id = a.product_id), 0) number,
WHERE cop.product_id = csp.product_id), 0) number,
b.stock_number
from cere_shop_product a
from cere_shop_product csp
LEFT JOIN (
SELECT
a.product_id,
@ -294,7 +294,7 @@
<if test="businessId!=null and businessId > 0">
AND d.business_id = #{businessId}
</if>
GROUP BY a.product_id) b ON a.product_id=b.product_id
GROUP BY a.product_id) b ON csp.product_id=b.product_id
LEFT JOIN (
SELECT
a.product_id,
@ -312,39 +312,200 @@
<if test="businessId!=null and businessId > 0">
AND d.business_id = #{businessId}
</if>
GROUP BY a.product_id) c ON a.product_id=c.product_id
INNER JOIN cere_platform_shop d ON a.shop_id=d.shop_id
LEFT JOIN cere_product_classify e ON a.classify_id=e.classify_id OR a.classify_business_id=e.classify_id
GROUP BY a.product_id) c ON csp.product_id=c.product_id
INNER JOIN cere_platform_shop d ON csp.shop_id=d.shop_id
LEFT JOIN cere_product_classify e ON (csp.classify_id=e.classify_id OR csp.classify_business_id=e.classify_id)
<if test="shopCouponId != null">
JOIN cere_shop_coupon_detail cscd ON cscd.shop_coupon_id = #{shopCouponId}
AND cscd.product_id = a.product_id
AND cscd.product_id = csp.product_id
</if>
where a.shelve_state=1
where csp.shelve_state=1
<if test="shopId!=null">
and a.shop_id=#{shopId}
and csp.shop_id=#{shopId}
</if>
<if test="businessId!=null and businessId > 0">
AND d.business_id = #{businessId}
</if>
<if test="search!=null and search!=''">
and (d.shop_name like concat('%',#{search},'%') OR
a.product_id like concat('%',#{search},'%') OR
a.product_name like concat('%',#{search},'%'))
csp.product_id like concat('%',#{search},'%') OR
csp.product_name like concat('%',#{search},'%'))
</if>
<if test="shelveState!=null">
and a.shelve_state=#{shelveState}
and csp.shelve_state=#{shelveState}
</if>
<if test="ifNew!=null">
and csp.if_new=#{ifNew}
</if>
<if test="ifFirst!=null">
and csp.if_first=#{ifFirst}
</if>
<if test="ifLowPrice!=null">
and csp.if_low_price=#{ifLowPrice}
</if>
<if test="classifyId!=null">
and (a.classify_id=#{classifyId} OR e.classify_level_hierarchy like concat('%/',#{classifyId},'%'))
and (csp.classify_id=#{classifyId} OR e.classify_level_hierarchy like concat('%/',#{classifyId},'%'))
</if>
<if test="ids!=null and ids.size()>0">
and a.product_id in (
and csp.product_id in (
<foreach collection="ids" item="id" index="index" separator=",">
#{id}
</foreach>
)
</if>
<if test="type==7">
order by number desc
</if>
</select>
<select id="getGroupWorkProducts" parameterType="com.shop.cereshop.business.page.canvas.CanvasProductParam"
resultType="com.shop.cereshop.business.page.canvas.CanvasProduct">
SELECT b.shop_id,d.shop_name,d.shop_logo,
a.product_id,b.product_name,
ifnull(x.users, 0) + b.fictitious_number as users,
h.start_time,h.end_time,h.state,
IF(m.image IS NULL OR m.image='',c.product_image,m.image) image,
h.if_enable,
h.enable_time,
a.price,a.sku_id,n.price original_price,
IF(f.number IS NULL, b.fictitious_number, f.number + b.fictitious_number) number,
n.stock_number
FROM cere_shop_group_work_detail a
INNER JOIN cere_shop_product b ON a.product_id=b.product_id
LEFT JOIN (SELECT a.product_id,a.product_image from cere_product_image a,cere_shop_product b
where a.product_id=b.product_id GROUP BY a.product_id) c ON a.product_id=c.product_id
INNER JOIN cere_platform_shop d ON b.shop_id=d.shop_id
LEFT JOIN cere_product_classify e ON b.classify_id=e.classify_id
LEFT JOIN cere_product_classify cpcb ON b.classify_business_id=cpcb.classify_id
LEFT JOIN (SELECT SUM(number) number,sku_id,order_id from cere_order_product GROUP BY sku_id) f ON a.sku_id=f.sku_id
LEFT JOIN cere_shop_order g ON f.order_id=g.order_id and g.state in (2,3,4)
LEFT JOIN (SELECT COUNT(a.buyer_user_id) users,a.product_id FROM (SELECT b.buyer_user_id,a.product_id FROM cere_order_product a,cere_shop_order b
where a.order_id=b.order_id and b.state in (2,3,4) GROUP BY a.product_id,b.buyer_user_id) a GROUP BY a.product_id) x ON a.product_id=x.product_id
LEFT JOIN cere_shop_group_work h ON a.shop_group_work_id=h.shop_group_work_id
LEFT JOIN (SELECT a.sku_id,a.image from cere_sku_name a,cere_product_sku b where a.sku_id=b.sku_id LIMIT 1) m ON a.sku_id=m.sku_id
LEFT JOIN cere_product_sku n ON a.sku_id=n.sku_id
where b.shelve_state=1 and h.state=1 and d.state=1
<if test="shopId!=null">
and b.shop_id=#{shopId}
</if>
<if test="search!=null and search!=''">
and (d.shop_name like concat('%',#{search},'%') OR
a.product_id like concat('%',#{search},'%') OR
b.product_name like concat('%',#{search},'%'))
</if>
<if test="shelveState!=null">
and b.shelve_state=#{shelveState}
</if>
<if test="classifyId!=null">
and (b.classify_id=#{classifyId} OR e.classify_level_hierarchy like concat('%/',#{classifyId},'%')
OR b.classify_business_id=#{classifyId} OR cpcb.classify_level_hierarchy like concat('%/',#{classifyId},'%'))
</if>
<if test="ids!=null and ids.size()>0">
and a.product_id in (
<foreach collection="ids" item="id" index="index" separator=",">
#{id}
</foreach>
)
</if>
GROUP BY a.product_id
ORDER BY b.create_time DESC
</select>
<select id="getSeckillProducts" parameterType="com.shop.cereshop.business.page.canvas.CanvasProductParam"
resultType="com.shop.cereshop.business.page.canvas.CanvasProduct">
SELECT b.shop_id,d.shop_name,d.shop_logo,a.product_id,b.product_name,
ifnull(x.users, 0) + b.fictitious_number as users, h.effective_start start_time,
h.effective_end end_time,h.state,
IF(m.image IS NULL OR m.image='',c.product_image,m.image) image,
h.if_enable,h.enable_time,
a.seckill_price price,a.sku_id,n.price original_price,
IF(f.number IS NULL, b.fictitious_number, f.number + b.fictitious_number) number,
n.stock_number
FROM cere_shop_seckill_detail a
LEFT JOIN cere_shop_product b ON a.product_id=b.product_id
LEFT JOIN (SELECT a.product_id,a.product_image from cere_product_image a,cere_shop_product b
where a.product_id=b.product_id GROUP BY a.product_id) c ON a.product_id=c.product_id
LEFT JOIN cere_platform_shop d ON b.shop_id=d.shop_id
LEFT JOIN cere_product_classify e ON b.classify_id=e.classify_id
LEFT JOIN cere_product_classify cpcb ON b.classify_business_id=cpcb.classify_id
LEFT JOIN (SELECT SUM(number) number,sku_id,order_id from cere_order_product GROUP BY sku_id) f ON a.sku_id=f.sku_id
LEFT JOIN cere_shop_order g ON f.order_id=g.order_id and g.state in (2,3,4)
LEFT JOIN (SELECT COUNT(a.buyer_user_id) users,a.product_id FROM (SELECT b.buyer_user_id,a.product_id FROM cere_order_product a,cere_shop_order b
where a.order_id=b.order_id and b.state in (2,3,4) GROUP BY a.product_id,b.buyer_user_id) a GROUP BY a.product_id) x ON a.product_id=x.product_id
LEFT JOIN cere_shop_seckill h ON a.shop_seckill_id=h.shop_seckill_id
LEFT JOIN (SELECT a.sku_id,a.image from cere_sku_name a,cere_product_sku b where a.sku_id=b.sku_id LIMIT 1) m ON a.sku_id=m.sku_id
LEFT JOIN cere_product_sku n ON a.sku_id=n.sku_id
where b.shelve_state=1 and h.state=1 and d.state=1
<if test="shopId!=null">
and b.shop_id=#{shopId}
</if>
<if test="search!=null and search!=''">
and (d.shop_name like concat('%',#{search},'%') OR
a.product_id like concat('%',#{search},'%') OR
b.product_name like concat('%',#{search},'%'))
</if>
<if test="shelveState!=null">
and b.shelve_state=#{shelveState}
</if>
<if test="classifyId!=null">
and (b.classify_id=#{classifyId} OR e.classify_level_hierarchy like concat('%/',#{classifyId},'%')
OR b.classify_business_id=#{classifyId} OR cpcb.classify_level_hierarchy like concat('%/',#{classifyId},'%'))
</if>
<if test="ids!=null and ids.size()>0">
and a.product_id in (
<foreach collection="ids" item="id" index="index" separator=",">
#{id}
</foreach>
)
</if>
GROUP BY a.product_id
ORDER BY b.create_time DESC
</select>
<select id="getDiscountProducts" parameterType="com.shop.cereshop.business.page.canvas.CanvasProductParam"
resultType="com.shop.cereshop.business.page.canvas.CanvasProduct">
SELECT b.shop_id,d.shop_name,d.shop_logo,a.product_id,b.product_name, ifnull(x.users, 0) + b.fictitious_number as users, h.start_time,h.end_time,h.state,
IF(m.image IS NULL OR m.image='',c.product_image,m.image) image,h.if_enable,h.enable_time,
a.price,a.sku_id,n.price original_price,IF(f.number IS NULL, b.fictitious_number, f.number + b.fictitious_number) number,n.stock_number FROM cere_shop_discount_detail a
LEFT JOIN cere_shop_product b ON a.product_id=b.product_id
LEFT JOIN (SELECT a.product_id,a.product_image from cere_product_image a,cere_shop_product b
where a.product_id=b.product_id GROUP BY a.product_id) c ON a.product_id=c.product_id
LEFT JOIN cere_platform_shop d ON b.shop_id=d.shop_id
LEFT JOIN cere_product_classify e ON b.classify_id=e.classify_id
LEFT JOIN cere_product_classify cpcb ON b.classify_business_id=cpcb.classify_id
LEFT JOIN (SELECT SUM(number) number,sku_id,order_id from cere_order_product GROUP BY sku_id) f ON a.sku_id=f.sku_id
LEFT JOIN cere_shop_order g ON f.order_id=g.order_id and g.state in (2,3,4)
LEFT JOIN (SELECT COUNT(a.buyer_user_id) users,a.product_id FROM (SELECT b.buyer_user_id,a.product_id FROM cere_order_product a,cere_shop_order b
where a.order_id=b.order_id and b.state in (2,3,4) GROUP BY a.product_id,b.buyer_user_id) a GROUP BY a.product_id) x ON a.product_id=x.product_id
LEFT JOIN cere_shop_discount h ON a.shop_discount_id=h.shop_discount_id
LEFT JOIN (SELECT a.sku_id,a.image from cere_sku_name a,cere_product_sku b where a.sku_id=b.sku_id LIMIT 1) m ON a.sku_id=m.sku_id
LEFT JOIN cere_product_sku n ON a.sku_id=n.sku_id
where b.shelve_state=1 and h.state=1 and d.state=1
<if test="shopId!=null">
and b.shop_id=#{shopId}
</if>
<if test="search!=null and search!=''">
and (d.shop_name like concat('%',#{search},'%') OR
a.product_id like concat('%',#{search},'%') OR
b.product_name like concat('%',#{search},'%'))
</if>
<if test="shelveState!=null">
and b.shelve_state=#{shelveState}
</if>
<if test="classifyId!=null">
and (b.classify_id=#{classifyId} OR e.classify_level_hierarchy like concat('%/',#{classifyId},'%')
OR b.classify_business_id=#{classifyId} OR cpcb.classify_level_hierarchy like concat('%/',#{classifyId},'%'))
</if>
<if test="ids!=null and ids.size()>0">
and a.product_id in (
<foreach collection="ids" item="id" index="index" separator=",">
#{id}
</foreach>
)
</if>
GROUP BY a.product_id
ORDER BY b.create_time DESC
</select>
<select id="getShops" parameterType="com.shop.cereshop.business.page.canvas.CanvasProductParam"

4
cereshop-commons/src/main/java/com/shop/cereshop/commons/constant/IntegerEnum.java

@ -74,6 +74,10 @@ public enum IntegerEnum {
CANVAS_ACTIVITY_GROUP_WORK("画布活动类型条件-拼团",1),
CANVAS_ACTIVITY_SECKILL("画布活动类型条件-秒杀",2),
CANVAS_ACTIVITY_DISCOUNT("画布活动类型条件-限时折扣",3),
CANVAS_ACTIVITY_XPTJ("画布活动类型条件-新品推荐",4),
CANVAS_ACTIVITY_DJYX("画布活动类型条件-低价优选",5),
CANVAS_ACTIVITY_JDSF("画布活动类型条件-尖端首发",6),
CANVAS_ACTIVITY_RXPH("画布活动类型条件-热销排行",7),
PERSONAL("主体类型-个人",1),
INDIVIDUAL("主体类型-个体工商户",2),
ENTERPRICE("主体类型-企业",3),

Loading…
Cancel
Save