wwl пре 4 година
родитељ
комит
21bcc8b60f

+ 4 - 9
zzjs-admin/src/main/java/com/miaxis/app/controller/customer/AppletCustomerInfoController.java

@@ -5,14 +5,12 @@ import com.miaxis.common.core.controller.BaseController;
 import com.miaxis.common.core.domain.entity.UserInfo;
 import com.miaxis.common.core.page.ResponsePageInfo;
 import com.miaxis.common.utils.SecurityUtils;
+import com.miaxis.customer.dto.AppletCustomerInfoDto;
 import com.miaxis.customer.service.ICustomerInfoService;
 import com.miaxis.customer.vo.ExhibitionCustomerInfoVo;
 import io.swagger.annotations.*;
 import lombok.RequiredArgsConstructor;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
 
@@ -40,14 +38,11 @@ public class AppletCustomerInfoController extends BaseController {
             @ApiImplicitParam(name = "pageNum", value = "当前页码", dataType = "int", paramType = "query", required = false),
             @ApiImplicitParam(name = "pageSize", value = "每页数据量", dataType = "int", paramType = "query", required = false),
     })
-    public ResponsePageInfo<ExhibitionCustomerInfoVo> getCustomerListByProductId(
-            @ApiParam(name = "id", value = "品类id (0:精选列表)", required = true)
-            @PathVariable("id") Long id
-    ) {
+    public ResponsePageInfo<ExhibitionCustomerInfoVo> getCustomerListByProductId(@ModelAttribute AppletCustomerInfoDto appletCustomerInfoDto) {
         startPage();
         //获取当前用户
         UserInfo userInfo = SecurityUtils.getLoginUser().getStudent();
-        List<ExhibitionCustomerInfoVo> list = customerInfoService.getCustomerListByProductId(id,userInfo.getId());
+        List<ExhibitionCustomerInfoVo> list = customerInfoService.getCustomerListByProductId(appletCustomerInfoDto,userInfo.getId());
         return toResponsePageInfo(list);
     }
 

+ 28 - 0
zzjs-service/src/main/java/com/miaxis/customer/dto/AppletCustomerInfoDto.java

@@ -0,0 +1,28 @@
+package com.miaxis.customer.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * applet客户信息对象入参
+ *
+ * @author miaxis
+ * @date 2021-03-15
+ */
+@Data
+@ApiModel(value = "AppletCustomerInfoDto", description = "applet客户信息对象入参")
+public class AppletCustomerInfoDto implements Serializable {
+
+    @ApiModelProperty(value = "品类id(0:精选)")
+    private Long id;
+
+    @ApiModelProperty(value = "父id")
+    private Long pid;
+
+    @ApiModelProperty(value = "商家名称")
+    private String customerName;
+
+}

+ 2 - 2
zzjs-service/src/main/java/com/miaxis/customer/mapper/CustomerInfoMapper.java

@@ -4,6 +4,7 @@ import java.util.List;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.miaxis.collection.vo.CollectionCustomerVo;
 import com.miaxis.customer.domain.CustomerInfo;
+import com.miaxis.customer.dto.AppletCustomerInfoDto;
 import com.miaxis.customer.vo.BrowseRecordCustomerInfoVo;
 import com.miaxis.customer.vo.CustomerInfoVo;
 import com.miaxis.customer.vo.ExhibitionCustomerInfoVo;
@@ -34,11 +35,10 @@ public interface CustomerInfoMapper extends BaseMapper<CustomerInfo> {
 
     /**
      * 查询商家列表
-     * @param productIds
      * @param userId
      * @return
      */
-    List<ExhibitionCustomerInfoVo> getCustomerListByProductId(@Param("productIds") List<Long> productIds,@Param("userId")Long userId,@Param("productIdStatus")Long productIdStatus);
+    List<ExhibitionCustomerInfoVo> getCustomerListByProductId(@Param("userId")Long userId, @Param("customerInfoDto") AppletCustomerInfoDto customerInfoDto);
 
 
     /**

+ 3 - 2
zzjs-service/src/main/java/com/miaxis/customer/service/ICustomerInfoService.java

@@ -3,6 +3,7 @@ package com.miaxis.customer.service;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.miaxis.common.core.domain.Response;
 import com.miaxis.customer.domain.CustomerInfo;
+import com.miaxis.customer.dto.AppletCustomerInfoDto;
 import com.miaxis.customer.vo.CustomerInfoVo;
 import com.miaxis.customer.vo.ExhibitionCustomerInfoVo;
 
@@ -49,11 +50,11 @@ public interface ICustomerInfoService extends IService<CustomerInfo>{
     /**
      * applet
      * 查询商家列表
-     * @param productId
+     * @param appletCustomerInfoDto
      * @param userId
      * @return
      */
-    List<ExhibitionCustomerInfoVo> getCustomerListByProductId(Long productId,Long userId);
+    List<ExhibitionCustomerInfoVo> getCustomerListByProductId(AppletCustomerInfoDto appletCustomerInfoDto, Long userId);
 
 
 }

+ 6 - 12
zzjs-service/src/main/java/com/miaxis/customer/service/impl/CustomerInfoServiceImpl.java

@@ -2,8 +2,10 @@ package com.miaxis.customer.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.miaxis.common.core.controller.BaseController;
 import com.miaxis.common.core.domain.Response;
 import com.miaxis.customer.domain.CustomerInfo;
+import com.miaxis.customer.dto.AppletCustomerInfoDto;
 import com.miaxis.customer.mapper.CustomerInfoMapper;
 import com.miaxis.customer.service.ICustomerInfoService;
 import com.miaxis.customer.vo.CustomerInfoVo;
@@ -91,22 +93,14 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
     /**
      * applet
      * 查询商家列表
-     * @param productId
+     * @param appletCustomerInfoDto
      * @param userId
      * @return
      */
     @Override
-    public List<ExhibitionCustomerInfoVo> getCustomerListByProductId(Long productId,Long userId) {
-        List<Long> arrayList = new ArrayList<>();
-        List<ProductTypeInfo> infos = productTypeInfoMapper.selectByMap(new HashMap<String, Object>() {{
-            put("pid", productId);
-        }});
-        if (!infos.isEmpty()){
-            arrayList = infos.stream().map(s -> s.getId()).collect(Collectors.toList());
-        }else {
-            arrayList.add(productId);
-        }
-        return customerInfoMapper.getCustomerListByProductId(arrayList,userId,productId);
+    public List<ExhibitionCustomerInfoVo> getCustomerListByProductId(AppletCustomerInfoDto appletCustomerInfoDto, Long userId) {
+
+        return customerInfoMapper.getCustomerListByProductId(userId,appletCustomerInfoDto);
     }
 
 

+ 8 - 5
zzjs-service/src/main/resources/mapper/customer/CustomerInfoMapper.xml

@@ -128,14 +128,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <where>
             1=1
             <choose>
-                <when test="productIdStatus == 0">
+                <when test="customerInfoDto.customerName != null  and customerInfoDto.customerName != ''">
+                    and ci.corporate_name like concat('%', #{customerInfoDto.customerName}, '%')
+                </when>
+                <when test="customerInfoDto.id == 0">
                     ORDER BY collectionCount DESC
                 </when>
+                <when test="customerInfoDto.pid != null and customerInfoDto.pid != ''">
+                    AND ci.industry_type = #{customerInfoDto.pid}
+                </when>
                 <otherwise>
-                    and ci.industry_type in
-                    <foreach collection="productIds" item="item" open="(" separator="," close=")">
-                        #{item}
-                    </foreach>
+                    AND ci.industry_type IN ( SELECT id FROM product_type_info WHERE pid = #{customerInfoDto.id} )
                 </otherwise>
             </choose>
         </where>