diff --git a/cereshop-admin/src/main/resources/mybatis/mapper/admin/CereActivitySignDAO.xml b/cereshop-admin/src/main/resources/mybatis/mapper/admin/CereActivitySignDAO.xml
index 0bf2255..2479ea7 100644
--- a/cereshop-admin/src/main/resources/mybatis/mapper/admin/CereActivitySignDAO.xml
+++ b/cereshop-admin/src/main/resources/mybatis/mapper/admin/CereActivitySignDAO.xml
@@ -5,7 +5,7 @@
SELECT date(create_time) as statsDate, count(buyer_user_id) as totalCount
from cere_buyer_user
- where create_time >= #{startTime} and create_time < #{endTime}
+ where project = 0 and create_time >= #{startTime} and create_time < #{endTime}
group by date(create_time)
diff --git a/cereshop-admin/src/main/resources/mybatis/mapper/buyer/CereBuyerWithdrawalDAO.xml b/cereshop-admin/src/main/resources/mybatis/mapper/buyer/CereBuyerWithdrawalDAO.xml
index d251580..8fc916b 100644
--- a/cereshop-admin/src/main/resources/mybatis/mapper/buyer/CereBuyerWithdrawalDAO.xml
+++ b/cereshop-admin/src/main/resources/mybatis/mapper/buyer/CereBuyerWithdrawalDAO.xml
@@ -117,7 +117,7 @@
SELECT a.withdrawal_id,a.withdrawal_money,a.state,
IF(b.wechat_name IS NULL,b.`name`,b.wechat_name) `name`,b.phone from cere_buyer_withdrawal a
LEFT JOIN cere_buyer_user b ON a.buyer_user_id=b.buyer_user_id
- where 1=1
+ where b.project = 0
and IF(b.wechat_name IS NULL,b.`name`,b.wechat_name) like concat('%',#{name},'%')
diff --git a/cereshop-admin/src/main/resources/mybatis/mapper/credit/CereCreditRecordDAO.xml b/cereshop-admin/src/main/resources/mybatis/mapper/credit/CereCreditRecordDAO.xml
index ea587f3..ebc7ceb 100644
--- a/cereshop-admin/src/main/resources/mybatis/mapper/credit/CereCreditRecordDAO.xml
+++ b/cereshop-admin/src/main/resources/mybatis/mapper/credit/CereCreditRecordDAO.xml
@@ -29,6 +29,7 @@
and (a.buyer_user_id = #{search} or b.name like concat('%', #{search}, '%'))
+ where b.project = 0
diff --git a/cereshop-admin/src/main/resources/mybatis/mapper/order/CereShopOrderDAO.xml b/cereshop-admin/src/main/resources/mybatis/mapper/order/CereShopOrderDAO.xml
index d58faa7..90c4f55 100644
--- a/cereshop-admin/src/main/resources/mybatis/mapper/order/CereShopOrderDAO.xml
+++ b/cereshop-admin/src/main/resources/mybatis/mapper/order/CereShopOrderDAO.xml
@@ -570,19 +570,19 @@
select count(distinct a.buyer_user_id) from cere_shop_order a
join cere_buyer_user b on b.buyer_user_id = a.buyer_user_id
- where b.channel_code = #{channelCode} and a.payment_state = 1
+ where b.project = 0 and b.channel_code = #{channelCode} and a.payment_state = 1
select count(distinct a.order_id) from cere_shop_order a
join cere_buyer_user b on b.buyer_user_id = a.buyer_user_id
- where b.channel_code = #{channelCode} and a.payment_state = 1
+ where b.project = 0 and b.channel_code = #{channelCode} and a.payment_state = 1
select ifnull(sum(price), 0) from cere_shop_order a
join cere_buyer_user b on b.buyer_user_id = a.buyer_user_id
- where b.channel_code = #{channelCode} and a.payment_state = 1
+ where b.project=0 and b.channel_code = #{channelCode} and a.payment_state = 1
diff --git a/cereshop-admin/src/main/resources/mybatis/mapper/risk/CereRiskBlackDAO.xml b/cereshop-admin/src/main/resources/mybatis/mapper/risk/CereRiskBlackDAO.xml
index ac6e011..ff80e56 100644
--- a/cereshop-admin/src/main/resources/mybatis/mapper/risk/CereRiskBlackDAO.xml
+++ b/cereshop-admin/src/main/resources/mybatis/mapper/risk/CereRiskBlackDAO.xml
@@ -22,7 +22,7 @@
select a.id, a.type, a.buyer_user_id, a.state, a.create_time, a.update_time,
b.name, b.phone, b.wechat_open_id as openId
from cere_risk_black a left join cere_buyer_user b on a.buyer_user_id = b.buyer_user_id
- where a.type = 2
+ where a.type = 2 and b.project = 0
and
(
diff --git a/cereshop-admin/src/main/resources/mybatis/mapper/shop/CereShopCommentDAO.xml b/cereshop-admin/src/main/resources/mybatis/mapper/shop/CereShopCommentDAO.xml
index 16a77e8..12fddd9 100644
--- a/cereshop-admin/src/main/resources/mybatis/mapper/shop/CereShopCommentDAO.xml
+++ b/cereshop-admin/src/main/resources/mybatis/mapper/shop/CereShopCommentDAO.xml
@@ -128,7 +128,7 @@
SELECT a.comment_id,a.shop_name,a.shop_code,a.product_id,a.state
,IF(b.wechat_name IS NULL,b.`name`,b.wechat_name) `name`,a.create_time from cere_shop_comment a
LEFT JOIN cere_buyer_user b ON a.buyer_user_id=b.buyer_user_id
- where 1=1
+ where b.project = 0
and a.if_sensitive=#{ifSensitive}
diff --git a/cereshop-app/src/main/java/com/shop/cereshop/app/controller/distributor/DistributorController.java b/cereshop-app/src/main/java/com/shop/cereshop/app/controller/distributor/DistributorController.java
index 2948244..71d9a8a 100644
--- a/cereshop-app/src/main/java/com/shop/cereshop/app/controller/distributor/DistributorController.java
+++ b/cereshop-app/src/main/java/com/shop/cereshop/app/controller/distributor/DistributorController.java
@@ -238,6 +238,7 @@ public class DistributorController {
public Result addDistributor(@RequestBody ShopDistributorParam param,HttpServletRequest request) throws CoBusinessException{
//获取当前登录账户
CereBuyerUser user = (CereBuyerUser) request.getAttribute("user");
+ param.setShopId(Long.valueOf(user.getProject()));
cereShopDistributorService.addDistributor(param);
return new Result(CoReturnFormat.SUCCESS,user.getWechatName(),"申请分销员", GsonUtil.objectToGson(param));
}
diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/dao/buyer/CereBuyerUserDAO.java b/cereshop-business/src/main/java/com/shop/cereshop/business/dao/buyer/CereBuyerUserDAO.java
index f8eacf1..01ee516 100644
--- a/cereshop-business/src/main/java/com/shop/cereshop/business/dao/buyer/CereBuyerUserDAO.java
+++ b/cereshop-business/src/main/java/com/shop/cereshop/business/dao/buyer/CereBuyerUserDAO.java
@@ -32,7 +32,7 @@ public interface CereBuyerUserDAO extends BaseMapper {
List getAll(BuyerUserGetAllParam param);
- CereBuyerUser checkPhone(@Param("phone") String phone);
+ CereBuyerUser checkPhone(@Param("project") String project, @Param("phone") String phone);
BuyerUserDetail getById(@Param("shopId") Long shopId, @Param("buyerUserId") Long buyerUserId);
diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/dao/distributor/CereShopDistributorDAO.java b/cereshop-business/src/main/java/com/shop/cereshop/business/dao/distributor/CereShopDistributorDAO.java
index 5e5ef33..273fe9a 100644
--- a/cereshop-business/src/main/java/com/shop/cereshop/business/dao/distributor/CereShopDistributorDAO.java
+++ b/cereshop-business/src/main/java/com/shop/cereshop/business/dao/distributor/CereShopDistributorDAO.java
@@ -55,7 +55,7 @@ public interface CereShopDistributorDAO extends BaseMapper
CereShopDistributor checkPhone(@Param("distributorPhone") String distributorPhone,
@Param("distributorId") Long distributorId,@Param("shopId") Long shopId);
- CereBuyerUser checkBuyerUser(@Param("distributorPhone") String distributorPhone);
+ CereBuyerUser checkBuyerUser(@Param("project") String project, @Param("distributorPhone") String distributorPhone);
void updateReliveBindByShopId(@Param("shopId") Long shopId,@Param("time") String time);
diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/service/buyer/impl/CereBuyerUserServiceImpl.java b/cereshop-business/src/main/java/com/shop/cereshop/business/service/buyer/impl/CereBuyerUserServiceImpl.java
index afe2892..6d15252 100644
--- a/cereshop-business/src/main/java/com/shop/cereshop/business/service/buyer/impl/CereBuyerUserServiceImpl.java
+++ b/cereshop-business/src/main/java/com/shop/cereshop/business/service/buyer/impl/CereBuyerUserServiceImpl.java
@@ -96,11 +96,12 @@ public class CereBuyerUserServiceImpl implements CereBuyerUserService {
public void save(UserSaveParam param, CerePlatformBusinessUser user) throws CoBusinessException {
String time = TimeUtils.yyMMddHHmmss();
//校验手机号是否存在
- CereBuyerUser cereBuyerUser=cereBuyerUserDAO.checkPhone(param.getPhone());
+ CereBuyerUser cereBuyerUser=cereBuyerUserDAO.checkPhone(String.valueOf(user.getBusinessId()), param.getPhone());
if(cereBuyerUser!=null){
throw new CoBusinessException(CoReturnFormat.PHONE_ALREADY);
}
cereBuyerUser=new CereBuyerUser();
+ cereBuyerUser.setProject(String.valueOf(user.getBusinessId()));
cereBuyerUser.setCreateTime(time);
cereBuyerUser.setBirthday(param.getBirthday());
cereBuyerUser.setName("MJ"+RandomStringUtil.getRandomCode(4,0));
diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/service/distributor/impl/CereShopDistributorServiceImpl.java b/cereshop-business/src/main/java/com/shop/cereshop/business/service/distributor/impl/CereShopDistributorServiceImpl.java
index 1176e4e..ed9294b 100644
--- a/cereshop-business/src/main/java/com/shop/cereshop/business/service/distributor/impl/CereShopDistributorServiceImpl.java
+++ b/cereshop-business/src/main/java/com/shop/cereshop/business/service/distributor/impl/CereShopDistributorServiceImpl.java
@@ -55,7 +55,7 @@ public class CereShopDistributorServiceImpl implements CereShopDistributorServic
throw new CoBusinessException(CoReturnFormat.DISTRIBUTOR_PHONE_ALREADY_ADD);
}
//校验客户是否有效
- CereBuyerUser buyerUser=cereShopDistributorDAO.checkBuyerUser(param.getDistributorPhone());
+ CereBuyerUser buyerUser=cereShopDistributorDAO.checkBuyerUser(String.valueOf(user.getBusinessId()), param.getDistributorPhone());
if(buyerUser==null){
throw new CoBusinessException(CoReturnFormat.USER_NOT_BUYER);
}else {
@@ -108,7 +108,7 @@ public class CereShopDistributorServiceImpl implements CereShopDistributorServic
throw new CoBusinessException(CoReturnFormat.DISTRIBUTOR_NOT_SELF);
}
//校验客户是否有效
- CereBuyerUser buyerUser=cereShopDistributorDAO.checkBuyerUser(param.getDistributorPhone());
+ CereBuyerUser buyerUser=cereShopDistributorDAO.checkBuyerUser(String.valueOf(user.getBusinessId()), param.getDistributorPhone());
if(buyerUser==null){
throw new CoBusinessException(CoReturnFormat.USER_NOT_BUYER);
}else {
diff --git a/cereshop-business/src/main/resources/mybatis/mapper/buyer/CereBuyerUserDAO.xml b/cereshop-business/src/main/resources/mybatis/mapper/buyer/CereBuyerUserDAO.xml
index 4f2e4ad..6e888ac 100644
--- a/cereshop-business/src/main/resources/mybatis/mapper/buyer/CereBuyerUserDAO.xml
+++ b/cereshop-business/src/main/resources/mybatis/mapper/buyer/CereBuyerUserDAO.xml
@@ -268,7 +268,7 @@
- SELECT phone FROM cere_buyer_user where phone=#{phone}
+ SELECT phone FROM cere_buyer_user where project=#{project} and phone=#{phone}
diff --git a/cereshop-business/src/main/resources/mybatis/mapper/distributor/CereShopDistributorDAO.xml b/cereshop-business/src/main/resources/mybatis/mapper/distributor/CereShopDistributorDAO.xml
index 112a456..d90d55a 100644
--- a/cereshop-business/src/main/resources/mybatis/mapper/distributor/CereShopDistributorDAO.xml
+++ b/cereshop-business/src/main/resources/mybatis/mapper/distributor/CereShopDistributorDAO.xml
@@ -258,7 +258,7 @@
- SELECT buyer_user_id,state,if_black FROM cere_buyer_user where phone=#{distributorPhone}
+ SELECT buyer_user_id,state,if_black FROM cere_buyer_user where project=#{project} and phone=#{distributorPhone}
diff --git a/cereshop-business/src/main/resources/mybatis/mapper/shop/CereShopRelationshipDAO.xml b/cereshop-business/src/main/resources/mybatis/mapper/shop/CereShopRelationshipDAO.xml
index 8d4ff83..cfa0834 100644
--- a/cereshop-business/src/main/resources/mybatis/mapper/shop/CereShopRelationshipDAO.xml
+++ b/cereshop-business/src/main/resources/mybatis/mapper/shop/CereShopRelationshipDAO.xml
@@ -91,7 +91,7 @@
b.if_bind,b.update_time,b.distributor_id FROM cere_buyer_user a
LEFT JOIN cere_distributor_buyer b ON a.buyer_user_id=b.buyer_user_id and b.shop_id=#{shopId}
LEFT JOIN cere_shop_distributor c ON b.distributor_id=c.distributor_id
- where 1=1
+ where a.project = #{shopId}
and (a.wechat_name like concat('%',#{name},'%') OR
a.`name` like concat('%',#{name},'%'))
diff --git a/cereshop-business/src/main/resources/mybatis/mapper/tool/CereShopOperateDAO.xml b/cereshop-business/src/main/resources/mybatis/mapper/tool/CereShopOperateDAO.xml
index 099d9a7..82a5daf 100644
--- a/cereshop-business/src/main/resources/mybatis/mapper/tool/CereShopOperateDAO.xml
+++ b/cereshop-business/src/main/resources/mybatis/mapper/tool/CereShopOperateDAO.xml
@@ -237,10 +237,10 @@
SELECT a.buyer_user_id from cere_buyer_user a
- LEFT JOIN (SELECT COUNT(*) count,buyer_user_id,shop_id from cere_shop_order where DATE_SUB(CURDATE(), INTERVAL
+ LEFT JOIN (SELECT COUNT(*) count,buyer_user_id,shop_id,project from cere_shop_order where DATE_SUB(CURDATE(), INTERVAL
#{number} DAY) <= date(payment_time)
GROUP BY buyer_user_id) b ON a.buyer_user_id=b.buyer_user_id
- where b.shop_id=#{shopId} and b.count=0
+ where b.project=#{shopId} and b.count=0 and a.project=#{shopId}
and a.buyer_user_id in (
@@ -253,10 +253,10 @@
SELECT a.buyer_user_id from cere_buyer_user a
- LEFT JOIN (SELECT COUNT(*) count,buyer_user_id,shop_id from cere_shop_order where DATE_SUB(CURDATE(), INTERVAL
+ LEFT JOIN (SELECT COUNT(*) count,buyer_user_id,shop_id,project from cere_shop_order where DATE_SUB(CURDATE(), INTERVAL
#{number} DAY) <= date(create_time)
GROUP BY buyer_user_id) b ON a.buyer_user_id=b.buyer_user_id
- where b.shop_id=#{shopId} and b.count=0
+ where b.project=#{shopId} and b.count=0 and a.project=#{shopId}
and a.buyer_user_id in (
@@ -272,7 +272,7 @@
LEFT JOIN (SELECT COUNT(*) count,buyer_user_id from cere_shop_visit where DATE_SUB(CURDATE(), INTERVAL #{number}
DAY) <= date(visit_time)
GROUP BY buyer_user_id) b ON a.buyer_user_id=b.buyer_user_id
- where b.count=0
+ where a.project=#{shopId} and b.count=0
and a.buyer_user_id in (
diff --git a/cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/scene/CereShopScene.java b/cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/scene/CereShopScene.java
index 51b7477..907a7d7 100644
--- a/cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/scene/CereShopScene.java
+++ b/cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/scene/CereShopScene.java
@@ -24,7 +24,7 @@ public class CereShopScene implements Serializable {
private Long sceneId;
/**
- * 店铺id
+ * 店铺id(存的是商家id)
*/
private Long shopId;