浏览代码

门店列表增加查询条件

wangtao 3 年之前
父节点
当前提交
8c3ce7f370

+ 5 - 3
lb-app/src/main/java/com/ydd/app/controller/ShopApi.java

@@ -49,7 +49,7 @@ public class ShopApi extends BaseController {
     @AccessToken
     public BaseResult<PageResult> findList() {
         startPage();
-        return BaseResult.success(new PageResult(apiShopService.findList(getLoginId())));
+        return BaseResult.success(new PageResult(apiShopService.findList(getLoginId(),null,null,null)));
     }
 
     /**
@@ -59,8 +59,10 @@ public class ShopApi extends BaseController {
     @RequestMapping(value = "/list", method = RequestMethod.GET)
     @AccessToken
    // @ControllerLog("门店列表")
-    public BaseResult<List<ShopDto>> list() {
-        return BaseResult.success(apiShopService.findList(getLoginId()));
+    public BaseResult<List<ShopDto>> list(@RequestParam(value ="cityName",required = false) String  cityName,
+                                          @RequestParam(value ="shopName",required = false) String   shopName,
+                                          @RequestParam(value ="mobile",required = false) String  mobile) {
+        return BaseResult.success(apiShopService.findList(getLoginId(),cityName,shopName,mobile));
     }
 
     /**

+ 1 - 1
lb-app/src/main/java/com/ydd/app/service/ApiShopService.java

@@ -24,7 +24,7 @@ public interface ApiShopService {
      * @param loginId 登录用户id
      * @return
      */
-    List<ShopDto> findList(Long loginId);
+    List<ShopDto> findList(Long loginId,String  cityName,String  shopName,String  mobile);
 
     /**
      * 新增门店

+ 2 - 2
lb-app/src/main/java/com/ydd/app/service/impl/ApiShopServiceImpl.java

@@ -77,7 +77,7 @@ public class ApiShopServiceImpl implements ApiShopService {
     private final IShopDeliveryBindService iShopDeliveryBindService;
 
     @Override
-    public List<ShopDto> findList(Long loginId) {
+    public List<ShopDto> findList(Long loginId,String  cityName,String  shopName,String  mobile) {
         Member member = iMemberService.getById(loginId);
         if (member.getMerchantId() == null) {
             throw new CustomAppException("请先申请成为商家!");
@@ -89,7 +89,7 @@ public class ApiShopServiceImpl implements ApiShopService {
                 list.add(shopDto);
             }
         } else {
-            list = iShopService.findList(member.getMerchantId(), null);
+            list = iShopService.findList(member.getMerchantId(), null,cityName,shopName,mobile);
         }
         for (ShopDto dto : list) {
             List<DeliveryDto> deliveryList = iShopService.findDeliveryList(dto.getId());

+ 1 - 1
lb-app/src/main/java/com/ydd/app/service/impl/ApiWaimaiPlatformServiceImpl.java

@@ -185,7 +185,7 @@ public class ApiWaimaiPlatformServiceImpl implements ApiWaimaiPlatformService {
         if (member.getMemberType().equals(MemberTypeEnum.SHOP.type)) {
             shopId = member.getShopId();
         }
-        List<ShopDto> list = iShopService.findList(merchantId, shopId);
+        List<ShopDto> list = iShopService.findList(merchantId, shopId,null,null,null);
         map.put("shopCode", code);
         map.put("shopList", list);
         return map;

+ 2 - 1
lb-module/src/main/java/com/ydd/module/mapper/ShopMapper.java

@@ -18,7 +18,8 @@ import java.util.List;
  */
 public interface ShopMapper extends BaseMapper<Shop> {
 
-    List<ShopDto> findList(@Param("merchantId") Long merchantId,@Param("shopId")Long shopId);
+    List<ShopDto> findList(@Param("merchantId") Long merchantId,@Param("shopId")Long shopId,
+                           @Param("cityName")String  cityName,@Param("shopName")String  shopName,@Param("mobile")String  mobile);
 
     List<DeliveryDto> findDeliveryList(@Param("shopId")Long shopId);
 

+ 1 - 1
lb-module/src/main/java/com/ydd/module/service/IShopService.java

@@ -27,7 +27,7 @@ public interface IShopService extends IService<Shop> {
      */
     List<Shop> queryList(Shop shop);
 
-    List<ShopDto> findList(Long merchantId,Long shopId);
+    List<ShopDto> findList(Long merchantId,Long shopId,String  cityName,String  shopName,String  mobile);
 
     List<DeliveryDto> findDeliveryList(Long id);
 

+ 2 - 2
lb-module/src/main/java/com/ydd/module/service/impl/ShopServiceImpl.java

@@ -191,8 +191,8 @@ public class ShopServiceImpl extends ServiceImpl<ShopMapper, Shop> implements IS
     }
 
     @Override
-    public List<ShopDto> findList(Long merchantId,Long shopId) {
-        return baseMapper.findList(merchantId,shopId);
+    public List<ShopDto> findList(Long merchantId,Long shopId,String  cityName,String  shopName,String  mobile) {
+        return baseMapper.findList(merchantId,shopId,cityName,shopName,mobile);
     }
 
     @Override

+ 10 - 0
lb-module/src/main/resources/mapper/module/shopMapper.xml

@@ -39,7 +39,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="shopId != null">
             and id = #{shopId}
         </if>
+        <if test="shopName != null andshopName != ''">
+            and name like concat('%', #{shopName}, '%')
+        </if>
+        <if test="cityName != null and cityName != ''">
+            and city_name like concat('%', #{cityName}, '%')
+        </if>
+        <if test="mobile != null and mobile != ''">
+            and mobile like concat('%', #{params.mobile}, '%')
+        </if>
         and deleted = 0 and status = 1
+        order by create_time desc
     </select>
     <select id="findDeliveryList" resultType="com.ydd.module.dto.DeliveryDto">
         select