Merge remote-tracking branch 'origin/master'
commit
3d8d34671f
@ -0,0 +1,44 @@
|
||||
package cn.iocoder.yudao.module.pay.controller.admin.demo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.PayDemoOrderCreateReqVO;
|
||||
import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.PayDemoOrderRespVO;
|
||||
import cn.iocoder.yudao.module.pay.convert.demo.PayDemoOrderConvert;
|
||||
import cn.iocoder.yudao.module.pay.dal.dataobject.demo.PayDemoOrderDO;
|
||||
import cn.iocoder.yudao.module.pay.service.demo.PayDemoOrderService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
@Tag(name = "管理后台 - 示例订单")
|
||||
@RestController
|
||||
@RequestMapping("/pay/demo-order")
|
||||
@Validated
|
||||
public class PayDemoOrderController {
|
||||
|
||||
@Resource
|
||||
private PayDemoOrderService payDemoOrderService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建示例订单")
|
||||
public CommonResult<Long> createDemoOrder(@Valid @RequestBody PayDemoOrderCreateReqVO createReqVO) {
|
||||
return success(payDemoOrderService.createDemoOrder(getLoginUserId(), createReqVO));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得示例订单分页")
|
||||
public CommonResult<PageResult<PayDemoOrderRespVO>> getDemoOrderPage(@Valid PageParam pageVO) {
|
||||
PageResult<PayDemoOrderDO> pageResult = payDemoOrderService.getDemoOrderPage(pageVO);
|
||||
return success(PayDemoOrderConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package cn.iocoder.yudao.module.pay.controller.admin.demo.vo;
|
||||
|
||||
import lombok.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Schema(description = "管理后台 - 示例订单创建 Request VO")
|
||||
@Data
|
||||
public class PayDemoOrderCreateReqVO {
|
||||
|
||||
@Schema(description = "商品编号", required = true, example = "17682")
|
||||
@NotNull(message = "商品编号不能为空")
|
||||
private Long spuId;
|
||||
|
||||
}
|
||||
@ -1 +0,0 @@
|
||||
package cn.iocoder.yudao.module.pay.controller.app;
|
||||
@ -0,0 +1,26 @@
|
||||
package cn.iocoder.yudao.module.pay.convert.demo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.PayDemoOrderCreateReqVO;
|
||||
import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.PayDemoOrderRespVO;
|
||||
import cn.iocoder.yudao.module.pay.dal.dataobject.demo.PayDemoOrderDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* 示例订单 Convert
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface PayDemoOrderConvert {
|
||||
|
||||
PayDemoOrderConvert INSTANCE = Mappers.getMapper(PayDemoOrderConvert.class);
|
||||
|
||||
PayDemoOrderDO convert(PayDemoOrderCreateReqVO bean);
|
||||
|
||||
PayDemoOrderRespVO convert(PayDemoOrderDO bean);
|
||||
|
||||
PageResult<PayDemoOrderRespVO> convertPage(PageResult<PayDemoOrderDO> page);
|
||||
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
package cn.iocoder.yudao.module.pay.dal.mysql.demo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.pay.dal.dataobject.demo.PayDemoOrderDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 示例订单 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface PayDemoOrderMapper extends BaseMapperX<PayDemoOrderDO> {
|
||||
|
||||
default PageResult<PayDemoOrderDO> selectPage(PageParam reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<PayDemoOrderDO>()
|
||||
.orderByDesc(PayDemoOrderDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
package cn.iocoder.yudao.module.pay.service.demo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.PayDemoOrderCreateReqVO;
|
||||
import cn.iocoder.yudao.module.pay.dal.dataobject.demo.PayDemoOrderDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 示例订单 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface PayDemoOrderService {
|
||||
|
||||
/**
|
||||
* 创建示例订单
|
||||
*
|
||||
* @param userId 用户编号
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createDemoOrder(Long userId, @Valid PayDemoOrderCreateReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 获得示例订单
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 示例订单
|
||||
*/
|
||||
PayDemoOrderDO getDemoOrder(Long id);
|
||||
|
||||
/**
|
||||
* 获得示例订单分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 示例订单分页
|
||||
*/
|
||||
PageResult<PayDemoOrderDO> getDemoOrderPage(PageParam pageReqVO);
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue