diff --git a/src/main/java/com/kiisoo/ic/customer/CustomerService.java b/src/main/java/com/kiisoo/ic/customer/CustomerService.java index 7b4c3e3..098cb45 100644 --- a/src/main/java/com/kiisoo/ic/customer/CustomerService.java +++ b/src/main/java/com/kiisoo/ic/customer/CustomerService.java @@ -435,21 +435,21 @@ public class CustomerService { Date lastDate = dateFormat.parse(dateFormat.format(calendar.getTime())); calendar.set(Calendar.HOUR_OF_DAY, -24); Date earlyDate = dateFormat.parse(dateFormat.format(calendar.getTime())); + List stafferInfoVOS = poiStoreStaffDOMapper.selectInfoById(userId); + Long shopId = stafferInfoVOS.get(0).getStoreId(); if (roleCode.equals(RoleEnum.ROLE_CODE_DZ.getRoleCode())) { - List stafferInfoVOS = poiStoreStaffDOMapper.selectInfoById(userId); - Long shopId = stafferInfoVOS.get(0).getStoreId(); - List thisList = opSellerCustomerRelationDOMapper.selectShopListByDate(shopId, null, sellerId, search, thisDate, thisDate, type); + List thisList = opSellerCustomerRelationDOMapper.selectFriendListByShopId(shopId, sellerId, search, thisDate, thisDate, type); results.put("this", thisList); - List lastList = opSellerCustomerRelationDOMapper.selectShopListByDate(shopId, null, sellerId, search, lastDate, lastDate, type); + List lastList = opSellerCustomerRelationDOMapper.selectFriendListByShopId(shopId, sellerId, search, lastDate, lastDate, type); results.put("last", lastList); - List earlyList = opSellerCustomerRelationDOMapper.selectShopListByDate(shopId, null, sellerId, search, null, earlyDate, type); + List earlyList = opSellerCustomerRelationDOMapper.selectFriendListByShopId(shopId, sellerId, search, null, earlyDate, type); results.put("early", earlyList); } else { - List thisList = opSellerCustomerRelationDOMapper.selectShopListByDate(null, userId, null, search, thisDate, thisDate, type); + List thisList = opSellerCustomerRelationDOMapper.selectFriendListBySeller(sellerId, search, thisDate, thisDate, type); results.put("this", thisList); - List lastList = opSellerCustomerRelationDOMapper.selectShopListByDate(null, userId, null, search, lastDate, lastDate, type); + List lastList = opSellerCustomerRelationDOMapper.selectFriendListBySeller(sellerId, search, lastDate, lastDate, type); results.put("last", lastList); - List earlyList = opSellerCustomerRelationDOMapper.selectShopListByDate(null, userId, null, search, null, earlyDate, type); + List earlyList = opSellerCustomerRelationDOMapper.selectFriendListBySeller(sellerId, search, null, earlyDate, type); results.put("early", earlyList); } return results; diff --git a/src/main/java/com/kiisoo/ic/customer/mapper/OpSellerCustomerRelationDOMapper.java b/src/main/java/com/kiisoo/ic/customer/mapper/OpSellerCustomerRelationDOMapper.java index 36a70c2..a280028 100644 --- a/src/main/java/com/kiisoo/ic/customer/mapper/OpSellerCustomerRelationDOMapper.java +++ b/src/main/java/com/kiisoo/ic/customer/mapper/OpSellerCustomerRelationDOMapper.java @@ -16,10 +16,24 @@ import java.util.Map; @Repository public interface OpSellerCustomerRelationDOMapper extends BaseMapper { + /** + * 查询用户 + * @param sellerId + * @param search + * @param startDate + * @param endDate + * @param type + * @return + */ + List selectFriendListBySeller(@Param("sellerId") Long sellerId, + @Param("search") String search, + @Param("startDate") Date startDate, + @Param("endDate") Date endDate, + @Param("type") Integer type); + /** * 查询用户 * @param shopId - * @param userId * @param sellerId * @param search * @param startDate @@ -27,8 +41,7 @@ public interface OpSellerCustomerRelationDOMapper extends BaseMapper selectShopListByDate(@Param("shopId") Long shopId, - @Param("userId") Long userId, + List selectFriendListByShopId(@Param("shopId") Long shopId, @Param("sellerId") Long sellerId, @Param("search") String search, @Param("startDate") Date startDate, diff --git a/src/main/resources/mapper/OpSellerCustomerRelationDOMapper.xml b/src/main/resources/mapper/OpSellerCustomerRelationDOMapper.xml index 658f90f..065b2a4 100644 --- a/src/main/resources/mapper/OpSellerCustomerRelationDOMapper.xml +++ b/src/main/resources/mapper/OpSellerCustomerRelationDOMapper.xml @@ -1,7 +1,7 @@ - SELECT DISTINCT t2.NAME AS customerName, @@ -28,8 +28,45 @@ and t3.id is null - - and t1.user_id = #{userId} + + and t4.user_id = #{sellerId} + + + and + CONCAT(IFNULL(t2.name,''),IFNULL(t2.phone,'')) + LIKE CONCAT('%',#{search},'%') + + + and DATE_FORMAT(t1.create_time,'%Y-%m-%d') >= DATE_FORMAT(#{startDate},'%Y-%m-%d') + + + and DATE_FORMAT(t1.create_time,'%Y-%m-%d') <= DATE_FORMAT(#{endDate},'%Y-%m-%d') + + order by t1.create_time desc + + @@ -397,7 +397,7 @@ where t1.store_id = #{storeId} and t1.type = 4 - GROUP BY userId ORDER BY newCusNum, userId DESC ) a, + GROUP BY userId ORDER BY newCusNum DESC ) a, ( SELECT @rank := 0 ) b