Browse Source

平台端、商家端、商城端涉及会员表关联查询业务处理所属商家过滤筛选

multiwx
dy-hu 6 months ago
parent
commit
52a38c9fa9
  1. 2
      cereshop-admin/src/main/resources/mybatis/mapper/admin/CereActivitySignDAO.xml
  2. 2
      cereshop-admin/src/main/resources/mybatis/mapper/buyer/CereBuyerWithdrawalDAO.xml
  3. 1
      cereshop-admin/src/main/resources/mybatis/mapper/credit/CereCreditRecordDAO.xml
  4. 6
      cereshop-admin/src/main/resources/mybatis/mapper/order/CereShopOrderDAO.xml
  5. 2
      cereshop-admin/src/main/resources/mybatis/mapper/risk/CereRiskBlackDAO.xml
  6. 2
      cereshop-admin/src/main/resources/mybatis/mapper/shop/CereShopCommentDAO.xml
  7. 1
      cereshop-app/src/main/java/com/shop/cereshop/app/controller/distributor/DistributorController.java
  8. 2
      cereshop-business/src/main/java/com/shop/cereshop/business/dao/buyer/CereBuyerUserDAO.java
  9. 2
      cereshop-business/src/main/java/com/shop/cereshop/business/dao/distributor/CereShopDistributorDAO.java
  10. 3
      cereshop-business/src/main/java/com/shop/cereshop/business/service/buyer/impl/CereBuyerUserServiceImpl.java
  11. 4
      cereshop-business/src/main/java/com/shop/cereshop/business/service/distributor/impl/CereShopDistributorServiceImpl.java
  12. 2
      cereshop-business/src/main/resources/mybatis/mapper/buyer/CereBuyerUserDAO.xml
  13. 2
      cereshop-business/src/main/resources/mybatis/mapper/distributor/CereShopDistributorDAO.xml
  14. 2
      cereshop-business/src/main/resources/mybatis/mapper/shop/CereShopRelationshipDAO.xml
  15. 10
      cereshop-business/src/main/resources/mybatis/mapper/tool/CereShopOperateDAO.xml
  16. 2
      cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/scene/CereShopScene.java

2
cereshop-admin/src/main/resources/mybatis/mapper/admin/CereActivitySignDAO.xml

@ -5,7 +5,7 @@
<select id="selectUserCount" resultType="com.shop.cereshop.admin.param.admin.StatsByDay">
SELECT date(create_time) as statsDate, count(buyer_user_id) as totalCount
from cere_buyer_user
where create_time >= #{startTime} and create_time &lt; #{endTime}
where project = 0 and create_time >= #{startTime} and create_time &lt; #{endTime}
group by date(create_time)
</select>

2
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
<if test="name!=null and name!=''">
and IF(b.wechat_name IS NULL,b.`name`,b.wechat_name) like concat('%',#{name},'%')
</if>

1
cereshop-admin/src/main/resources/mybatis/mapper/credit/CereCreditRecordDAO.xml

@ -29,6 +29,7 @@
<if test="search != null and search != ''">
and (a.buyer_user_id = #{search} or b.name like concat('%', #{search}, '%'))
</if>
where b.project = 0
</select>

6
cereshop-admin/src/main/resources/mybatis/mapper/order/CereShopOrderDAO.xml

@ -570,19 +570,19 @@
<select id="selectChannelOrderUserCount" resultType="java.lang.Integer">
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>
<select id="selectChannelOrderCount" resultType="java.lang.Integer">
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>
<select id="selectChannelOrderAmount" resultType="java.math.BigDecimal">
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
</select>
<select id="selectSalesVolumeBySkuIdList" resultType="java.util.Map">

2
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
<if test="search != null and search != ''">
and
(

2
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
<if test="ifSensitive!=null">
and a.if_sensitive=#{ifSensitive}
</if>

1
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));
}

2
cereshop-business/src/main/java/com/shop/cereshop/business/dao/buyer/CereBuyerUserDAO.java

@ -32,7 +32,7 @@ public interface CereBuyerUserDAO extends BaseMapper<CereBuyerUser> {
List<BuyerUser> 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);

2
cereshop-business/src/main/java/com/shop/cereshop/business/dao/distributor/CereShopDistributorDAO.java

@ -55,7 +55,7 @@ public interface CereShopDistributorDAO extends BaseMapper<CereShopDistributor>
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);

3
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));

4
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 {

2
cereshop-business/src/main/resources/mybatis/mapper/buyer/CereBuyerUserDAO.xml

@ -268,7 +268,7 @@
</select>
<select id="checkPhone" parameterType="java.lang.Object" resultType="com.shop.cereshop.commons.domain.buyer.CereBuyerUser">
SELECT phone FROM cere_buyer_user where phone=#{phone}
SELECT phone FROM cere_buyer_user where project=#{project} and phone=#{phone}
</select>
<select id="getById" parameterType="java.lang.Object" resultType="com.shop.cereshop.business.page.buyer.BuyerUserDetail">

2
cereshop-business/src/main/resources/mybatis/mapper/distributor/CereShopDistributorDAO.xml

@ -258,7 +258,7 @@
</select>
<select id="checkBuyerUser" parameterType="java.lang.Object" resultType="com.shop.cereshop.commons.domain.buyer.CereBuyerUser">
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}
</select>
<update id="updateReliveBindByShopId" parameterType="java.lang.Object">

2
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}
<if test="name!=null and name!=''">
and (a.wechat_name like concat('%',#{name},'%') OR
a.`name` like concat('%',#{name},'%'))

10
cereshop-business/src/main/resources/mybatis/mapper/tool/CereShopOperateDAO.xml

@ -237,10 +237,10 @@
<select id="findNoBuy" parameterType="com.shop.cereshop.business.param.tool.CrowdCondition"
resultType="java.lang.Long">
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) &lt;= 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}
<if test="ids!=null and ids.size()>0">
and a.buyer_user_id in (
<foreach collection="ids" item="id" index="index" separator=",">
@ -253,10 +253,10 @@
<select id="findNoOrder" parameterType="com.shop.cereshop.business.param.tool.CrowdCondition"
resultType="java.lang.Long">
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) &lt;= 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}
<if test="ids!=null and ids.size()>0">
and a.buyer_user_id in (
<foreach collection="ids" item="id" index="index" separator=",">
@ -272,7 +272,7 @@
LEFT JOIN (SELECT COUNT(*) count,buyer_user_id from cere_shop_visit where DATE_SUB(CURDATE(), INTERVAL #{number}
DAY) &lt;= 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
<if test="ids!=null and ids.size()>0">
and a.buyer_user_id in (
<foreach collection="ids" item="id" index="index" separator=",">

2
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;

Loading…
Cancel
Save