品类、字典、区域,feign封装
This commit is contained in:
@ -0,0 +1,31 @@
|
||||
package com.chinaunicom.mall.ebtp.common.base.client;
|
||||
|
||||
import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse;
|
||||
import com.chinaunicom.mall.ebtp.common.base.entity.CoscoCategoryMaintenance;
|
||||
import com.chinaunicom.mall.ebtp.common.base.entity.CoscoCategoryMaintenanceVO;
|
||||
import com.chinaunicom.mall.ebtp.common.base.fallback.CategoryClientFallback;
|
||||
import com.chinaunicom.mall.ebtp.common.constant.ServiceNameConstants;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@FeignClient(
|
||||
name = ServiceNameConstants.SYSTEM_SERVICE,
|
||||
fallback = CategoryClientFallback.class
|
||||
)
|
||||
public interface CategoryClient {
|
||||
|
||||
// --------------------------品类接口-----------------------
|
||||
@ApiOperation("查询品类数据详细")
|
||||
@GetMapping("/v1/coscocategorymaintenance/{id}")
|
||||
BaseResponse<CoscoCategoryMaintenance> getInfo(@PathVariable String id);
|
||||
|
||||
@ApiOperation("查询树结构数据")
|
||||
@PostMapping("/getTreeList")
|
||||
BaseResponse<List<CoscoCategoryMaintenanceVO>> getTreeList(@RequestBody CoscoCategoryMaintenanceVO coscoCategoryMaintenanceVO);
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package com.chinaunicom.mall.ebtp.common.base.client;
|
||||
|
||||
import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse;
|
||||
import com.chinaunicom.mall.ebtp.common.base.entity.DictProject;
|
||||
import com.chinaunicom.mall.ebtp.common.base.fallback.DictClientFallback;
|
||||
import com.chinaunicom.mall.ebtp.common.constant.ServiceNameConstants;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@FeignClient(
|
||||
name = ServiceNameConstants.SYSTEM_SERVICE,
|
||||
fallback = DictClientFallback.class
|
||||
)
|
||||
public interface DictClient {
|
||||
|
||||
// --------------------------字典接口-----------------------
|
||||
/**
|
||||
* 查询字典数据
|
||||
* @param parentCode 字典父类code
|
||||
* @param toParentCode 字典父类对应的父类code
|
||||
* @return 返回结果
|
||||
*/
|
||||
@ApiOperation("查询数据集合")
|
||||
@GetMapping("/v1/dictProject/getDictList")
|
||||
BaseResponse<List<DictProject>> getDictList(String parentCode, String toParentCode);
|
||||
|
||||
/**
|
||||
* 查询所有字典
|
||||
* @param dictProject
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("查询数据集合")
|
||||
@GetMapping("/v1/dictProject/selectDictList")
|
||||
BaseResponse<List<DictProject>> selectDictList(DictProject dictProject);
|
||||
}
|
||||
|
@ -0,0 +1,30 @@
|
||||
package com.chinaunicom.mall.ebtp.common.base.client;
|
||||
|
||||
import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse;
|
||||
import com.chinaunicom.mall.ebtp.common.base.entity.DictRegionInternational;
|
||||
import com.chinaunicom.mall.ebtp.common.base.fallback.DictRegionInternationalClientFallback;
|
||||
import com.chinaunicom.mall.ebtp.common.constant.ServiceNameConstants;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@FeignClient(
|
||||
name = ServiceNameConstants.SYSTEM_SERVICE,
|
||||
fallback = DictRegionInternationalClientFallback.class
|
||||
)
|
||||
public interface DictRegionInternationalClient {
|
||||
|
||||
// --------------------------全球国家信息接口-----------------------
|
||||
|
||||
@ApiOperation("查询所有数据")
|
||||
@GetMapping("/v1/dictRegionInternational/all")
|
||||
BaseResponse<List<DictRegionInternational>> listAll();
|
||||
|
||||
@ApiOperation("查询子数据")
|
||||
@GetMapping("/v1/dictRegionInternational/getChild")
|
||||
BaseResponse<List<DictRegionInternational>> getChild(@RequestParam(name = "pId") String pId);
|
||||
}
|
||||
|
@ -0,0 +1,86 @@
|
||||
package com.chinaunicom.mall.ebtp.common.base.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 实体类 CoscoCategoryMaintenance
|
||||
* @author sunyu
|
||||
* @date 2025-5-27
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel
|
||||
public class CoscoCategoryMaintenance extends BaseEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@ApiModelProperty(value = "主键ID")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 版本id
|
||||
*/
|
||||
@ApiModelProperty(value = "版本id")
|
||||
private Long versionId;
|
||||
|
||||
/**
|
||||
* 父id
|
||||
*/
|
||||
@ApiModelProperty(value = "父id")
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 路径
|
||||
*/
|
||||
@ApiModelProperty(value = "路径")
|
||||
private String path;
|
||||
|
||||
/**
|
||||
* 品类名称
|
||||
*/
|
||||
@ApiModelProperty(value = "品类名称")
|
||||
private String categoryName;
|
||||
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
@ApiModelProperty(value = "编码")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 状态(1启用 0停用)
|
||||
*/
|
||||
@ApiModelProperty(value = "状态(1启用 0停用)")
|
||||
private Integer status;
|
||||
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.time.LocalDateTime createDate;
|
||||
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.time.LocalDateTime updateDate;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package com.chinaunicom.mall.ebtp.common.base.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 实体类 CoscoCategoryMaintenance
|
||||
* @author sunyu
|
||||
* @date 2025-5-27
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel
|
||||
public class CoscoCategoryMaintenanceVO extends CoscoCategoryMaintenance implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "分页对象信息")
|
||||
private BasePageRequest basePageRequest;
|
||||
|
||||
@ApiModelProperty(value = "children")
|
||||
private List<CoscoCategoryMaintenanceVO> children;
|
||||
|
||||
@ApiModelProperty(value = "品类版本id")
|
||||
private Long versionId;
|
||||
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package com.chinaunicom.mall.ebtp.common.base.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 全球国家信息实体类 DictRegionInternational
|
||||
*
|
||||
* @author 自动生成
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel("全球国家信息实体类")
|
||||
public class DictRegionInternational implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@ApiModelProperty(value = "id")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 上级id
|
||||
*/
|
||||
@ApiModelProperty(value = "上级id")
|
||||
private String pId;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@ApiModelProperty(value = "名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 类型:0-国家
|
||||
*/
|
||||
@ApiModelProperty(value = "类型:0-国家")
|
||||
private String level;
|
||||
|
||||
/**
|
||||
* 缩写
|
||||
*/
|
||||
@ApiModelProperty(value = "缩写")
|
||||
private String ab;
|
||||
|
||||
/**
|
||||
* 英文名称
|
||||
*/
|
||||
@ApiModelProperty(value = "英文名称")
|
||||
private String enName;
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.chinaunicom.mall.ebtp.common.base.fallback;
|
||||
|
||||
import com.chinaunicom.mall.ebtp.common.base.client.CategoryClient;
|
||||
import com.chinaunicom.mall.ebtp.common.base.entity.*;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Component
|
||||
public class CategoryClientFallback implements CategoryClient {
|
||||
|
||||
@Override
|
||||
public BaseResponse<CoscoCategoryMaintenance> getInfo(String id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseResponse<List<CoscoCategoryMaintenanceVO>> getTreeList(CoscoCategoryMaintenanceVO coscoCategoryMaintenanceVO) {
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.chinaunicom.mall.ebtp.common.base.fallback;
|
||||
|
||||
import com.chinaunicom.mall.ebtp.common.base.client.DictClient;
|
||||
import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse;
|
||||
import com.chinaunicom.mall.ebtp.common.base.entity.DictProject;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Component
|
||||
public class DictClientFallback implements DictClient {
|
||||
@Override
|
||||
public BaseResponse<List<DictProject>> getDictList(String parentCode, String toParentCode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseResponse<List<DictProject>> selectDictList(DictProject dictProject) {
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.chinaunicom.mall.ebtp.common.base.fallback;
|
||||
|
||||
import com.chinaunicom.mall.ebtp.common.base.client.DictClient;
|
||||
import com.chinaunicom.mall.ebtp.common.base.client.DictRegionInternationalClient;
|
||||
import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse;
|
||||
import com.chinaunicom.mall.ebtp.common.base.entity.DictProject;
|
||||
import com.chinaunicom.mall.ebtp.common.base.entity.DictRegionInternational;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Component
|
||||
public class DictRegionInternationalClientFallback implements DictRegionInternationalClient {
|
||||
|
||||
@Override
|
||||
public BaseResponse<List<DictRegionInternational>> listAll() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseResponse<List<DictRegionInternational>> getChild(String pId) {
|
||||
return null;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user