فهرست منبع

服务商入驻V1.0.0

kaick 1 سال پیش
والد
کامیت
18288fffcf

+ 11 - 7
src/main/java/com/caimei365/user/controller/ProvidersController.java

@@ -5,12 +5,15 @@ import com.caimei365.user.model.po.CmProviders;
 import com.caimei365.user.model.vo.CmProvidersVO;
 import com.caimei365.user.model.vo.CmProvidersVO;
 import com.caimei365.user.service.CmProvidersService;
 import com.caimei365.user.service.CmProvidersService;
 import com.caimei365.user.utils.BeanUtil;
 import com.caimei365.user.utils.BeanUtil;
-import org.apache.commons.lang3.StringUtils;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
+import java.util.List;
 
 
 /**
 /**
  * 服务商入驻Controller
  * 服务商入驻Controller
@@ -29,11 +32,12 @@ public class ProvidersController {
      * 服务商入驻信息查询
      * 服务商入驻信息查询
      */
      */
     @GetMapping("/from")
     @GetMapping("/from")
-    public ResponseJson getProvidersFrom(String providersId,String providersName) {
-        if (StringUtils.isBlank(providersId)&&StringUtils.isBlank(providersName)) {
-            return ResponseJson.error("参数异常!");
-        }
-        CmProviders cmProviders = cmProvidersService.getByCmProviders(new CmProviders().setId(providersId).setName(providersName).setStatus(90));
-        return ResponseJson.success(BeanUtil.setValue(cmProviders, CmProvidersVO.class));
+    public ResponseJson getProvidersFrom(String providersId,String providersName,
+                                         @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
+                                         @RequestParam(value = "pageSize", defaultValue = "20") int pageSize
+                                         ) {
+        PageHelper.startPage(pageNum, pageSize);
+        List<CmProviders> cmProviders = cmProvidersService.getByCmProviders(new CmProviders().setId(providersId).setName(providersName).setStatus(90));
+        return ResponseJson.success(new PageInfo<>(BeanUtil.setValues(cmProviders, CmProvidersVO.class)));
     }
     }
 }
 }

+ 3 - 1
src/main/java/com/caimei365/user/service/CmProvidersService.java

@@ -2,6 +2,8 @@ package com.caimei365.user.service;
 
 
 import com.caimei365.user.model.po.CmProviders;
 import com.caimei365.user.model.po.CmProviders;
 
 
+import java.util.List;
+
 /**
 /**
  * Service接口
  * Service接口
  *
  *
@@ -18,5 +20,5 @@ public interface CmProvidersService
      * @param cmProviders
      * @param cmProviders
      * @return
      * @return
      */
      */
-    CmProviders getByCmProviders(CmProviders cmProviders);
+    List<CmProviders> getByCmProviders(CmProviders cmProviders);
 }
 }

+ 6 - 3
src/main/java/com/caimei365/user/service/impl/CmProvidersServiceImpl.java

@@ -8,6 +8,7 @@ import com.caimei365.user.service.CmProvidersService;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
+import java.util.List;
 
 
 /**
 /**
  * Service业务层处理
  * Service业务层处理
@@ -30,11 +31,13 @@ public class CmProvidersServiceImpl implements CmProvidersService
      * @return
      * @return
      */
      */
     @Override
     @Override
-    public CmProviders getByCmProviders(CmProviders cmProviders)
+    public List<CmProviders> getByCmProviders(CmProviders cmProviders)
     {
     {
-        CmProviders byCmProviders = cmProvidersMapper.getByCmProviders(cmProviders);
+        List<CmProviders> byCmProviders = cmProvidersMapper.getCmProvidersList(cmProviders);
         if(null!=byCmProviders){
         if(null!=byCmProviders){
-            byCmProviders.setTextRelateds(baseMapper.getRelatedImageList(new CmRelatedImage().setType("2").setAuthorId(byCmProviders.getId())));
+            byCmProviders.forEach(s->{
+                s.setTextRelateds(baseMapper.getRelatedImageList(new CmRelatedImage().setType("2").setAuthorId(s.getId())));
+            });
         }
         }
         return byCmProviders;
         return byCmProviders;
     }
     }

+ 1 - 1
src/main/resources/mapper/CmProvidersMapper.xml

@@ -49,7 +49,7 @@
         <where>
         <where>
             <if test="id != null  and id != ''"> and cm_providers.id = #{id}</if>
             <if test="id != null  and id != ''"> and cm_providers.id = #{id}</if>
             <if test="userId != null "> and cm_providers.userId = #{userId}</if>
             <if test="userId != null "> and cm_providers.userId = #{userId}</if>
-            <if test="name != null  and name != ''"> and cm_providers.name =#{name}</if>
+            <if test="name != null  and name != ''"> and cm_providers.name like concat('%', #{name}, '%')</if>
             <if test="serviceLevel != null "> and cm_providers.serviceLevel = #{serviceLevel}</if>
             <if test="serviceLevel != null "> and cm_providers.serviceLevel = #{serviceLevel}</if>
             <if test="serviceCategory != null "> and cm_providers.serviceCategory = #{serviceCategory}</if>
             <if test="serviceCategory != null "> and cm_providers.serviceCategory = #{serviceCategory}</if>
             <if test="address != null  and address != ''"> and cm_providers.address = #{address}</if>
             <if test="address != null  and address != ''"> and cm_providers.address = #{address}</if>