提交
This commit is contained in:
@ -0,0 +1,37 @@
|
||||
package co.yixiang.yshop.module.express.controller.app.express;
|
||||
|
||||
import co.yixiang.yshop.framework.common.pojo.CommonResult;
|
||||
import co.yixiang.yshop.module.express.controller.admin.express.vo.ExpressRespVO;
|
||||
import co.yixiang.yshop.module.express.convert.express.ExpressConvert;
|
||||
import co.yixiang.yshop.module.express.dal.dataobject.express.ExpressDO;
|
||||
import co.yixiang.yshop.module.express.service.express.ExpressService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.pojo.CommonResult.success;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Tag(name = "用户 APP - 物流")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
@RequestMapping("/order/express")
|
||||
public class AppExpressController {
|
||||
|
||||
@Resource
|
||||
private ExpressService expressService;
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得快递公司列表")
|
||||
public CommonResult<List<ExpressRespVO>> getExpressList() {
|
||||
List<ExpressDO> list = expressService.getExpressList();
|
||||
return success(ExpressConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package co.yixiang.yshop.module.express.controller.app.express.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 快递公司 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class ExpressBaseVO {
|
||||
|
||||
@Schema(description = "快递公司简称", required = true)
|
||||
@NotNull(message = "快递公司简称不能为空")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "快递公司全称", required = true, example = "yshop")
|
||||
@NotNull(message = "快递公司全称不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "排序", required = true)
|
||||
@NotNull(message = "排序不能为空")
|
||||
private Integer sort;
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package co.yixiang.yshop.module.express.controller.app.express.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 快递公司 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ExpressRespVO extends ExpressBaseVO {
|
||||
|
||||
@Schema(description = "快递公司id", required = true, example = "27172")
|
||||
private Integer id;
|
||||
|
||||
@Schema(description = "添加时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
Reference in New Issue
Block a user