Jelajahi Sumber

开发服务类目-首页(h5)接口

jinshihui 2 minggu lalu
induk
melakukan
a3e2c1f8ab

+ 1 - 1
nightFragrance-framework/src/main/java/com/ylx/framework/config/SecurityConfig.java

@@ -114,7 +114,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
                         "/wx/pay/payNotify", "/wx/pay/refundNotify", "/weChat/getAccessToken","/weChat/phoneLogin","/weChat/sendMsg", "/weChat/getCode", "/weChat/verifyToken", "/sq/getAccessToken",
                         "/wx/pay/payNotify", "/wx/pay/refundNotify", "/weChat/getAccessToken","/weChat/phoneLogin","/weChat/sendMsg", "/weChat/getCode", "/weChat/verifyToken", "/sq/getAccessToken",
                         "/area/select", "/system/dept/list", "/api/xiangmu/v1/wx/recommend", "/product/category/create","/area/code","/area/city","/product/category/list",
                         "/area/select", "/system/dept/list", "/api/xiangmu/v1/wx/recommend", "/product/category/create","/area/code","/area/city","/product/category/list",
                         "/wx/pay/query/order/{outTradeNo}","/api/products/**","/api/user/point/**","/userCenter/userApp/queryBind","/weChat/uuidLogin","/couponReceive/getShareVolutionDetail",
                         "/wx/pay/query/order/{outTradeNo}","/api/products/**","/api/user/point/**","/userCenter/userApp/queryBind","/weChat/uuidLogin","/couponReceive/getShareVolutionDetail",
-                        "/userCenter/userApp/bind/update").permitAll()
+                        "/userCenter/userApp/bind/update","/serviceCategory/h5List").permitAll()
                 // 静态资源,可匿名访问
                 // 静态资源,可匿名访问
                 .antMatchers(HttpMethod.GET, "/", "/*.txt", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
                 .antMatchers(HttpMethod.GET, "/", "/*.txt", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
                 .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
                 .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()

+ 19 - 0
nightFragrance-massage/src/main/java/com/ylx/servicecategory/controller/ServiceCategoryController.java

@@ -18,6 +18,7 @@ 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;
 
 
 /**
 /**
  * 服务类目控制层
  * 服务类目控制层
@@ -31,6 +32,24 @@ public class ServiceCategoryController {
     @Resource
     @Resource
     private ServiceCategoryService serviceCategoryService;
     private ServiceCategoryService serviceCategoryService;
 
 
+    /**
+     * H5查询首页服务类目
+     *
+     * @return H5首页服务类目列表
+     */
+    @GetMapping("h5List")
+    @ApiOperation("H5查询首页服务类目")
+    public R<List<ServiceCategory>> h5List() {
+        try {
+            return R.ok(serviceCategoryService.listH5ServiceCategory());
+        } catch (ServiceException e) {
+            return R.fail(e.getMessage());
+        } catch (Exception e) {
+            log.error("H5查询首页服务类目异常", e);
+            return R.fail("H5查询首页服务类目失败");
+        }
+    }
+
     /**
     /**
      * 根据主键ID查询服务类目详情
      * 根据主键ID查询服务类目详情
      *
      *

+ 2 - 2
nightFragrance-massage/src/main/java/com/ylx/servicecategory/domain/ServiceCategory.java

@@ -40,13 +40,13 @@ public class ServiceCategory {
     private Integer sort;
     private Integer sort;
 
 
     /**
     /**
-     * 是否首页展示
+     * 是否首页展示 0-否 1-是
      */
      */
     @TableField("is_home_display")
     @TableField("is_home_display")
     private Integer isHomeDisplay;
     private Integer isHomeDisplay;
 
 
     /**
     /**
-     * 是否上线
+     * 是否上架 0-否 1-是
      */
      */
     @TableField("is_online")
     @TableField("is_online")
     private Integer isOnline;
     private Integer isOnline;

+ 12 - 0
nightFragrance-massage/src/main/java/com/ylx/servicecategory/mapper/ServiceCategoryMapper.java

@@ -5,11 +5,23 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ylx.servicecategory.domain.ServiceCategory;
 import com.ylx.servicecategory.domain.ServiceCategory;
 
 
+import java.util.List;
+
 /**
 /**
  * 服务类目数据访问层
  * 服务类目数据访问层
  */
  */
 public interface ServiceCategoryMapper extends BaseMapper<ServiceCategory> {
 public interface ServiceCategoryMapper extends BaseMapper<ServiceCategory> {
 
 
+    /**
+     * H5查询首页服务类目
+     *
+     * @param queryWrapper 查询条件
+     * @return H5首页服务类目列表
+     */
+    default List<ServiceCategory> selectH5ServiceCategoryList(LambdaQueryWrapper<ServiceCategory> queryWrapper) {
+        return selectList(queryWrapper);
+    }
+
     /**
     /**
      * 根据主键ID查询服务类目详情
      * 根据主键ID查询服务类目详情
      *
      *

+ 9 - 0
nightFragrance-massage/src/main/java/com/ylx/servicecategory/service/ServiceCategoryService.java

@@ -4,11 +4,20 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.ylx.servicecategory.domain.ServiceCategory;
 import com.ylx.servicecategory.domain.ServiceCategory;
 
 
+import java.util.List;
+
 /**
 /**
  * 服务类目服务接口
  * 服务类目服务接口
  */
  */
 public interface ServiceCategoryService extends IService<ServiceCategory> {
 public interface ServiceCategoryService extends IService<ServiceCategory> {
 
 
+    /**
+     * H5查询首页服务类目
+     *
+     * @return H5首页服务类目列表
+     */
+    List<ServiceCategory> listH5ServiceCategory();
+
     /**
     /**
      * 根据主键ID查询服务类目详情
      * 根据主键ID查询服务类目详情
      *
      *

+ 16 - 0
nightFragrance-massage/src/main/java/com/ylx/servicecategory/service/impl/ServiceCategoryServiceImpl.java

@@ -11,6 +11,7 @@ import com.ylx.servicecategory.service.ServiceCategoryService;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
 import java.time.LocalDateTime;
 import java.time.LocalDateTime;
+import java.util.List;
 
 
 /**
 /**
  * 服务类目服务实现类
  * 服务类目服务实现类
@@ -18,6 +19,21 @@ import java.time.LocalDateTime;
 @Service
 @Service
 public class ServiceCategoryServiceImpl extends ServiceImpl<ServiceCategoryMapper, ServiceCategory> implements ServiceCategoryService {
 public class ServiceCategoryServiceImpl extends ServiceImpl<ServiceCategoryMapper, ServiceCategory> implements ServiceCategoryService {
 
 
+    /**
+     * H5查询首页服务类目
+     *
+     * @return H5首页服务类目列表
+     */
+    @Override
+    public List<ServiceCategory> listH5ServiceCategory() {
+        LambdaQueryWrapper<ServiceCategory> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(ServiceCategory::getIsHomeDisplay, 1)
+                .eq(ServiceCategory::getIsOnline, 1)
+                .orderByAsc(ServiceCategory::getSort)
+                .orderByAsc(ServiceCategory::getId);
+        return this.baseMapper.selectH5ServiceCategoryList(queryWrapper);
+    }
+
     /**
     /**
      * 根据主键ID查询服务类目详情
      * 根据主键ID查询服务类目详情
      *
      *