Browse Source

增加小程序端的专家和品牌查询接口

zyj
sj 2 years ago
parent
commit
61eb0c7177
  1. 55
      zsw-bxg/src/main/java/co/yixiang/app/modules/expert/rest/AppStoreExpertController.java
  2. 42
      zsw-bxg/src/main/java/co/yixiang/app/modules/product/rest/AppStoreBrandController.java
  3. 8
      zsw-bxg/src/main/java/co/yixiang/modules/expert/domain/YxStoreExpert.java
  4. 3
      zsw-bxg/src/main/java/co/yixiang/modules/expert/service/YxStoreExpertService.java
  5. 20
      zsw-bxg/src/main/java/co/yixiang/modules/expert/service/impl/YxStoreExpertServiceImpl.java
  6. 2
      zsw-bxg/src/main/java/co/yixiang/modules/store/domain/YxStoreBrand.java
  7. 4
      zsw-bxg/src/main/java/co/yixiang/modules/store/service/YxStoreBrandService.java
  8. 20
      zsw-bxg/src/main/java/co/yixiang/modules/store/service/impl/YxStoreBrandServiceImpl.java
  9. 33
      zsw-bxg/src/main/java/co/yixiang/utils/location/BrandDTO.java
  10. 61
      zsw-bxg/src/main/java/co/yixiang/utils/location/ExpertDTO.java

55
zsw-bxg/src/main/java/co/yixiang/app/modules/expert/rest/AppStoreExpertController.java

@ -0,0 +1,55 @@
/**
* Copyright (C) 2018-2022
* All rights reserved, Designed By www.yixiang.co
* 注意
* 本软件为www.yixiang.co开发研制未经购买不得使用
* 购买后可获得全部源代码禁止转卖分享上传到码云github等开源平台
* 一经发现盗用分享等行为将追究法律责任后果自负
*/
package co.yixiang.app.modules.expert.rest;
import co.yixiang.annotation.AnonymousAccess;
import cn.iocoder.yudao.framework.common.pojo.ApiResult;
import co.yixiang.modules.expert.domain.YxStoreExpert;
import co.yixiang.modules.expert.service.YxStoreExpertService;
import co.yixiang.utils.CateDTO;
import co.yixiang.utils.location.ExpertDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* <p>
* 专家前端控制器
* </p>
*
* @author ssj
* @since 2022-9-20
*/
@Slf4j
@RestController
@Api(value = "店内专家", tags = "商城:专家")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class AppStoreExpertController {
private final YxStoreExpertService yxStoreExpertService;
/**
* 商品分类列表
*/
@AnonymousAccess
@GetMapping("/expert")
@ApiOperation(value = "专家列表",notes = "专家列表")
public ApiResult<List<ExpertDTO>> getYxStoreExpertPageList(){
return ApiResult.ok(yxStoreExpertService.getList());
}
}

42
zsw-bxg/src/main/java/co/yixiang/app/modules/product/rest/AppStoreBrandController.java

@ -0,0 +1,42 @@
package co.yixiang.app.modules.product.rest;
import cn.iocoder.yudao.framework.common.pojo.ApiResult;
import co.yixiang.annotation.AnonymousAccess;
import co.yixiang.modules.store.service.YxStoreBrandService;
import co.yixiang.utils.location.BrandDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* <p>
* 商品品牌前端控制器
* </p>
*
* @author ssj
* @since 2022-9-20
*/
@Slf4j
@RestController
@Api(value = "商品品牌", tags = "商城:商品品牌")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class AppStoreBrandController {
private final YxStoreBrandService yxStoreBrandService;
/**
* 商品品牌列表
*/
@AnonymousAccess
@GetMapping("/brand")
@ApiOperation(value = "商品品牌列表",notes = "商品品牌列表")
public ApiResult<List<BrandDTO>> getYxStoreBrandPageList(){
return ApiResult.ok(yxStoreBrandService.getList());
}
}

8
zsw-bxg/src/main/java/co/yixiang/modules/expert/domain/YxStoreExpert.java

@ -10,6 +10,7 @@ package co.yixiang.modules.expert.domain;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import com.baomidou.mybatisplus.annotation.TableName;
import cn.hutool.core.bean.BeanUtil;
@ -30,6 +31,13 @@ public class YxStoreExpert implements Serializable {
@TableId
private Long id;
/** 状态(0:显示,1:不显示) */
@ApiModelProperty(value = "状态(0:显示,1:隐藏)")
private Integer isShow;
/** 排序 */
@ApiModelProperty(value = "排序")
private Integer sort;
/** 商户Id(0为总后台管理员创建,不为0的时候是商户后台创建) */
private Integer merId;

3
zsw-bxg/src/main/java/co/yixiang/modules/expert/service/YxStoreExpertService.java

@ -13,6 +13,7 @@ import co.yixiang.domain.PageResult;
import co.yixiang.modules.expert.domain.YxStoreExpert;
import co.yixiang.modules.expert.service.dto.YxStoreExpertDto;
import co.yixiang.modules.expert.service.dto.YxStoreExpertQueryCriteria;
import co.yixiang.utils.location.ExpertDTO;
import org.springframework.data.domain.Pageable;
import javax.servlet.http.HttpServletResponse;
@ -24,6 +25,8 @@ import java.util.List;
*/
public interface YxStoreExpertService extends BaseService<YxStoreExpert> {
List<ExpertDTO> getList();
/**
* 查询数据分页
* @param criteria 条件

20
zsw-bxg/src/main/java/co/yixiang/modules/expert/service/impl/YxStoreExpertServiceImpl.java

@ -12,12 +12,18 @@ import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.common.utils.QueryHelpPlus;
import co.yixiang.domain.PageResult;
import co.yixiang.dozer.service.IGenerator;
import co.yixiang.enums.ShopCommonEnum;
import co.yixiang.modules.category.domain.YxStoreCategory;
import co.yixiang.modules.expert.domain.YxStoreExpert;
import co.yixiang.modules.expert.service.YxStoreExpertService;
import co.yixiang.modules.expert.service.dto.YxStoreExpertDto;
import co.yixiang.modules.expert.service.dto.YxStoreExpertQueryCriteria;
import co.yixiang.modules.expert.service.mapper.YxStoreExpertMapper;
import co.yixiang.utils.CateDTO;
import co.yixiang.utils.FileUtil;
import co.yixiang.utils.TreeUtil;
import co.yixiang.utils.location.ExpertDTO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.pagehelper.PageInfo;
import lombok.AllArgsConstructor;
import org.springframework.data.domain.Pageable;
@ -51,6 +57,20 @@ public class YxStoreExpertServiceImpl extends BaseServiceImpl<YxStoreExpertMappe
return generator.convertPageInfo(page,YxStoreExpertDto.class);
}
/**
* 获取专家列表树形列表
* @return List
*/
@Override
public List<ExpertDTO> getList() {
LambdaQueryWrapper<YxStoreExpert> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(YxStoreExpert::getIsShow, ShopCommonEnum.SHOW_1.getValue())
.orderByAsc(YxStoreExpert::getSort);
List<ExpertDTO> list = generator.convert(baseMapper.selectList(wrapper),ExpertDTO.class);
// return TreeUtil.list2TreeConverter(list,0);
return list;
}
@Override
//@Cacheable

2
zsw-bxg/src/main/java/co/yixiang/modules/store/domain/YxStoreBrand.java

@ -46,7 +46,7 @@ public class YxStoreBrand implements Serializable {
private String pic;
/** 是否推荐 */
/** 是否展示 */
private Integer isShow;

4
zsw-bxg/src/main/java/co/yixiang/modules/store/service/YxStoreBrandService.java

@ -12,6 +12,8 @@ import co.yixiang.domain.PageResult;
import co.yixiang.modules.store.domain.YxStoreBrand;
import co.yixiang.modules.store.service.dto.YxStoreBrandDto;
import co.yixiang.modules.store.service.dto.YxStoreBrandQueryCriteria;
import co.yixiang.utils.CateDTO;
import co.yixiang.utils.location.BrandDTO;
import org.springframework.data.domain.Pageable;
import java.util.Map;
import java.util.List;
@ -23,6 +25,8 @@ import javax.servlet.http.HttpServletResponse;
*/
public interface YxStoreBrandService extends BaseService<YxStoreBrand> {
List<BrandDTO> getList();
/**
* 查询数据分页
* @param criteria 条件

20
zsw-bxg/src/main/java/co/yixiang/modules/store/service/impl/YxStoreBrandServiceImpl.java

@ -12,9 +12,14 @@ import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.common.utils.QueryHelpPlus;
import co.yixiang.domain.PageResult;
import co.yixiang.dozer.service.IGenerator;
import co.yixiang.enums.ShopCommonEnum;
import co.yixiang.modules.expert.domain.YxStoreExpert;
import co.yixiang.modules.store.domain.YxStoreBrand;
import co.yixiang.modules.store.service.vo.YxStoreBrandVO;
import co.yixiang.utils.FileUtil;
import co.yixiang.utils.location.BrandDTO;
import co.yixiang.utils.location.ExpertDTO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.AllArgsConstructor;
import com.github.pagehelper.PageInfo;
import co.yixiang.modules.store.service.YxStoreBrandService;
@ -48,6 +53,21 @@ public class YxStoreBrandServiceImpl extends BaseServiceImpl<YxStoreBrandMapper,
private final IGenerator generator;
/**
* 获取商家品牌树形列表
* @return List
*/
@Override
public List<BrandDTO> getList() {
LambdaQueryWrapper<YxStoreBrand> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(YxStoreBrand::getIsShow, ShopCommonEnum.SHOW_1.getValue())
.orderByAsc(YxStoreBrand::getSort);
List<BrandDTO> list = generator.convert(baseMapper.selectList(wrapper),BrandDTO.class);
// return TreeUtil.list2TreeConverter(list,0);
return list;
}
@Override
//@Cacheable
public PageResult<YxStoreBrandDto> queryAll(YxStoreBrandQueryCriteria criteria, Pageable pageable) {

33
zsw-bxg/src/main/java/co/yixiang/utils/location/BrandDTO.java

@ -0,0 +1,33 @@
package co.yixiang.utils.location;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
* 商城品牌分类
* </p>
*
* @author ssj
* @since 2022-9-20
*/
public class BrandDTO implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
/**
* 商品分类名称
*/
private String brandName;
/**
* 缩略图url
*/
private String pic;
private List<BrandDTO> children = new ArrayList<>();
}

61
zsw-bxg/src/main/java/co/yixiang/utils/location/ExpertDTO.java

@ -0,0 +1,61 @@
/**
* Copyright (C) 2018-2022
* All rights reserved, Designed By www.yixiang.co
*/
package co.yixiang.utils.location;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
* 商城商品分类
* </p>
*
* @author hupeng
* @since 2019-09-08
*/
@Data
public class ExpertDTO implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
/**
* 专家名称
*/
private String expertName;
/**
* 专家简介
*/
private String expertInfo;
/**
* 专家的职级
*/
private String expertStatus;
/**
* 专家所属单位
*/
private String expertUnit;
/**
* 专家人像大图
*/
private String image;
private List<ExpertDTO> children = new ArrayList<>();
}
Loading…
Cancel
Save