feat: add order interface
This commit is contained in:
@@ -806,4 +806,22 @@ CREATE TABLE `u_rate_limit` (
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户平台-带宽限速表';
|
||||
|
||||
CREATE TABLE `u_order` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`user_id` bigint(20) DEFAULT NULL COMMENT '用户ID',
|
||||
`package_id` bigint(20) DEFAULT NULL COMMENT '套餐ID',
|
||||
`payment_id` bigint(20) DEFAULT NULL COMMENT '支付ID',
|
||||
`order_no` varchar(64) DEFAULT NULL COMMENT '订单编号',
|
||||
`type` int(11) DEFAULT NULL COMMENT '订单类型(0套餐 1充值)',
|
||||
`order_amount` decimal(18,4) DEFAULT NULL COMMENT '订单金额',
|
||||
`status` int(11) DEFAULT NULL COMMENT '订单状态(0待支付 1已支付 2已取消)',
|
||||
`del_flag` tinyint(1) DEFAULT '0' COMMENT '删除标志(0存在 1删除)',
|
||||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` bigint(20) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='用户平台-订单表';
|
||||
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
package org.wfc.user.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
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.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.wfc.common.core.web.controller.BaseController;
|
||||
import org.wfc.common.core.web.domain.AjaxResult;
|
||||
import org.wfc.common.core.web.page.TableDataInfo;
|
||||
import org.wfc.common.security.utils.SecurityUtils;
|
||||
import org.wfc.user.domain.UOrder;
|
||||
import org.wfc.user.service.IUOrderService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台-订单表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author sys
|
||||
* @since 2024-12-20
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/order")
|
||||
public class UOrderController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IUOrderService uOrderService;
|
||||
|
||||
@GetMapping("/page")
|
||||
public TableDataInfo page(UOrder uOrder) {
|
||||
startPage();
|
||||
List<UOrder> list = uOrderService.list();
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(UOrder uOrder) {
|
||||
List<UOrder> list = uOrderService.list();
|
||||
return success(list);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getById(@PathVariable("id") Long id) {
|
||||
return success(uOrderService.getById(id));
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody UOrder uOrder) {
|
||||
uOrder.setUserId(SecurityUtils.getUserId());
|
||||
return toAjax(uOrderService.save(uOrder));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody UOrder uOrder) {
|
||||
return toAjax(uOrderService.updateById(uOrder));
|
||||
}
|
||||
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(uOrderService.removeByIds(CollUtil.newArrayList(ids)));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package org.wfc.user.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import org.wfc.common.mybatis.domain.BaseData;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台-订单表
|
||||
* </p>
|
||||
*
|
||||
* @author sys
|
||||
* @since 2024-12-20
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("u_order")
|
||||
@Schema(name = "UOrder", description = "用户平台-订单表")
|
||||
public class UOrder extends BaseData {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "套餐ID")
|
||||
private Long packageId;
|
||||
|
||||
@Schema(description = "支付ID")
|
||||
private Long paymentId;
|
||||
|
||||
@Schema(description = "订单编号")
|
||||
private String orderNo;
|
||||
|
||||
@Schema(description = "订单类型(0套餐 1充值)")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "订单金额")
|
||||
private BigDecimal orderAmount;
|
||||
|
||||
@Schema(description = "订单状态(0待支付 1已支付 2已取消)")
|
||||
private Integer status;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.wfc.user.mapper;
|
||||
|
||||
import org.wfc.user.domain.UOrder;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台-订单表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author sys
|
||||
* @since 2024-12-20
|
||||
*/
|
||||
public interface UOrderMapper extends BaseMapper<UOrder> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.wfc.user.service;
|
||||
|
||||
import org.wfc.user.domain.UOrder;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台-订单表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author sys
|
||||
* @since 2024-12-20
|
||||
*/
|
||||
public interface IUOrderService extends IService<UOrder> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package org.wfc.user.service.impl;
|
||||
|
||||
import org.wfc.user.domain.UOrder;
|
||||
import org.wfc.user.mapper.UOrderMapper;
|
||||
import org.wfc.user.service.IUOrderService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台-订单表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author sys
|
||||
* @since 2024-12-20
|
||||
*/
|
||||
@Service
|
||||
public class UOrderServiceImpl extends ServiceImpl<UOrderMapper, UOrder> implements IUOrderService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.wfc.user.mapper.UOrderMapper">
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user