将 onemall 老代码,统一到归档目录,后续不断迁移移除

This commit is contained in:
YunaiV
2022-06-16 09:06:44 +08:00
parent 64c478a45b
commit 71930d492e
1095 changed files with 0 additions and 16 deletions

View File

@@ -0,0 +1,18 @@
package cn.iocoder.mall.managementweb;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients(basePackages = {"cn.iocoder.mall.productservice.rpc","cn.iocoder.mall.payservice.rpc"
,"cn.iocoder.mall.promotion.api.rpc","cn.iocoder.mall.systemservice.rpc","cn.iocoder.mall.userservice.rpc"})
public class ManagementWebApplication {
public static void main(String[] args) {
SpringApplication.run(ManagementWebApplication.class, args);
}
}

View File

@@ -0,0 +1,23 @@
package cn.iocoder.mall.managementweb.client.pay.transaction;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.common.framework.vo.PageResult;
import cn.iocoder.mall.payservice.rpc.transaction.PayTransactionFeign;
import cn.iocoder.mall.payservice.rpc.transaction.dto.PayTransactionPageReqDTO;
import cn.iocoder.mall.payservice.rpc.transaction.dto.PayTransactionRespDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class PayTransactionClient {
@Autowired
private PayTransactionFeign payTransactionFeign;
public PageResult<PayTransactionRespDTO> pagePayTransaction(PayTransactionPageReqDTO pageReqDTO) {
CommonResult<PageResult<PayTransactionRespDTO>> pagePayTransactionResult = payTransactionFeign.pagePayTransaction(pageReqDTO);
pagePayTransactionResult.checkError();
return pagePayTransactionResult.getData();
}
}

View File

@@ -0,0 +1,41 @@
### /admin/page 成功
GET http://127.0.0.1:18083/management-api/admin/page?pageNo=1&pageSize=10
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
### /admin/create 成功
POST http://127.0.0.1:18083/management-api/admin/create
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
username=admin02&password=buzhidao&name=测试管理员&departmentId=1
### /admin/update 成功
POST http://127.0.0.1:18083/management-api/admin/update
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
id=31&username=admin02&password=buzhidao&name=测试管理员&departmentId=1
### /admin/update-status 成功
POST http://127.0.0.1:18083/management-api/admin/update-status
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
adminId=31&status=1
### /admin/update-status 失败,参数缺失
POST http://127.0.0.1:18083/management-api/admin/update-status
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
adminId=31
### admin/update-status 失败,地址不存在
GET http://127.0.0.1:18083/management-api/admin/update-status---
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
adminId=31&status=sss
###

View File

@@ -0,0 +1,67 @@
package cn.iocoder.mall.managementweb.controller.admin;
import cn.iocoder.common.framework.util.HttpUtil;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.common.framework.vo.PageResult;
import cn.iocoder.mall.managementweb.controller.admin.dto.AdminCreateDTO;
import cn.iocoder.mall.managementweb.controller.admin.dto.AdminPageDTO;
import cn.iocoder.mall.managementweb.controller.admin.dto.AdminUpdateInfoDTO;
import cn.iocoder.mall.managementweb.controller.admin.dto.AdminUpdateStatusDTO;
import cn.iocoder.mall.managementweb.controller.admin.vo.AdminPageItemVO;
import cn.iocoder.mall.managementweb.manager.admin.AdminManager;
import cn.iocoder.mall.security.admin.core.context.AdminSecurityContextHolder;
import cn.iocoder.security.annotations.RequiresPermissions;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import static cn.iocoder.common.framework.vo.CommonResult.success;
@Api(tags = "管理员 API")
@RestController
@RequestMapping("/admin")
@Validated
public class AdminController {
@Autowired
private AdminManager adminManager;
@ApiOperation(value = "管理员分页")
@GetMapping("/page")
@RequiresPermissions("system:admin:page")
public CommonResult<PageResult<AdminPageItemVO>> page(AdminPageDTO adminPageDTO) {
return success(adminManager.pageAdmin(adminPageDTO));
}
@ApiOperation(value = "创建管理员")
@PostMapping("/create")
@RequiresPermissions("system:admin:create")
public CommonResult<Integer> createAdmin(AdminCreateDTO createDTO, HttpServletRequest request) {
return success(adminManager.createAdmin(createDTO, AdminSecurityContextHolder.getAdminId(), HttpUtil.getIp(request)));
}
@PostMapping("/update")
@ApiOperation(value = "更新管理员")
@RequiresPermissions("system:admin:update")
public CommonResult<Boolean> updateAdmin(AdminUpdateInfoDTO updateInfoDTO) {
adminManager.updateAdmin(updateInfoDTO);
return success(true);
}
@PostMapping("/update-status")
@ApiOperation(value = "更新管理员状态")
@RequiresPermissions("system:admin:update-status")
public CommonResult<Boolean> updateAdminStatus(@Valid AdminUpdateStatusDTO updateStatusDTO) {
adminManager.updateAdminStatus(updateStatusDTO);
return success(true);
}
}

View File

@@ -0,0 +1,39 @@
### /department/create 成功
POST http://127.0.0.1:18083/management-api/department/create
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
dubbo-tag: {{dubboTag}}
name=测试部门&pid=0&sort=0
### /department/update 成功
POST http://127.0.0.1:18083/management-api/department/update
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
id=1&name=测试部门&pid=0&sort=0
### /resource/delete 成功
POST http://127.0.0.1:18083/management-api/department/delete
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
id=1
### /department/get 成功
GET http://127.0.0.1:18083/management-api/department/get?departmentId=1
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
### /department/list 成功
GET http://127.0.0.1:18083/management-api/department/list?departmentIds=1,13
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
### /department/tree 成功
GET http://127.0.0.1:18083/management-api/department/tree
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
###

View File

@@ -0,0 +1,81 @@
package cn.iocoder.mall.managementweb.controller.admin;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.managementweb.controller.admin.dto.DepartmentCreateDTO;
import cn.iocoder.mall.managementweb.controller.admin.dto.DepartmentUpdateDTO;
import cn.iocoder.mall.managementweb.controller.admin.vo.DepartmentTreeNodeVO;
import cn.iocoder.mall.managementweb.controller.admin.vo.DepartmentVO;
import cn.iocoder.mall.managementweb.manager.admin.DepartmentManager;
import cn.iocoder.security.annotations.RequiresPermissions;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
import static cn.iocoder.common.framework.vo.CommonResult.success;
/**
* 部门 Controller
*/
@RestController
@RequestMapping("/department")
@Api(tags = "部门")
@Validated
public class DepartmentController {
@Autowired
private DepartmentManager departmentManager;
@PostMapping("/create")
@ApiOperation("创建部门")
@RequiresPermissions("system:department:create")
public CommonResult<Integer> createDepartment(@Valid DepartmentCreateDTO createDTO) {
return success(departmentManager.createDepartment(createDTO));
}
@PostMapping("/update")
@ApiOperation("更新部门")
@RequiresPermissions("system:department:update")
public CommonResult<Boolean> updateDepartment(@Valid DepartmentUpdateDTO updateDTO) {
departmentManager.updateDepartment(updateDTO);
return success(true);
}
@PostMapping("/delete")
@ApiOperation("删除部门")
@ApiImplicitParam(name = "departmentId", value = "部门编号", required = true)
@RequiresPermissions("system:department:delete")
public CommonResult<Boolean> deleteDepartment(@RequestParam("departmentId") Integer departmentId) {
departmentManager.deleteDepartment(departmentId);
return success(true);
}
@GetMapping("/get")
@ApiOperation("获得部门")
@ApiImplicitParam(name = "departmentId", value = "部门编号", required = true)
@RequiresPermissions("system:department:tree")
public CommonResult<DepartmentVO> getDepartment(@RequestParam("departmentId") Integer departmentId) {
return success(departmentManager.getDepartment(departmentId));
}
@GetMapping("/list")
@ApiOperation("获得部门列表")
@ApiImplicitParam(name = "departmentIds", value = "部门编号列表", required = true)
@RequiresPermissions("system:department:tree")
public CommonResult<List<DepartmentVO>> listDepartments(@RequestParam("departmentIds") List<Integer> departmentIds) {
return success(departmentManager.listDepartments(departmentIds));
}
@GetMapping("/tree")
@ApiOperation("获得部门树")
@RequiresPermissions("system:department:tree")
public CommonResult<List<DepartmentTreeNodeVO>> treeDepartment() {
return success(departmentManager.treeDepartment());
}
}

View File

@@ -0,0 +1,38 @@
package cn.iocoder.mall.managementweb.controller.admin.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
@ApiModel("管理员创建 DTO")
@Data
@Accessors(chain = true)
public class AdminCreateDTO {
@ApiModelProperty(value = "真实名字", required = true, example = "小王")
@NotEmpty(message = "真实名字不能为空")
@Length(max = 10, message = "真实名字长度最大为 10 位")
private String name;
@ApiModelProperty(value = "部门编号", required = true, example = "1")
@NotNull(message = "部门不能为空")
private Integer departmentId;
@ApiModelProperty(value = "登陆账号", required = true, example = "15601691300")
@NotEmpty(message = "登陆账号不能为空")
@Length(min = 5, max = 16, message = "账号长度为 5-16 位")
@Pattern(regexp = "^[A-Za-z0-9]+$", message = "账号格式为数字以及字母")
private String username;
@ApiModelProperty(value = "密码", required = true, example = "buzhidao")
@NotEmpty(message = "密码不能为空")
@Length(min = 4, max = 16, message = "密码长度为 4-16 位")
private String password;
}

View File

@@ -0,0 +1,22 @@
package cn.iocoder.mall.managementweb.controller.admin.dto;
import cn.iocoder.common.framework.vo.PageParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
@ApiModel("管理员分页查询 DTO")
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
public class AdminPageDTO extends PageParam {
@ApiModelProperty(value = "真实名字,模糊匹配", example = "小王")
private String name;
@ApiModelProperty(value = "部门编号")
private Integer departmentId;
}

View File

@@ -0,0 +1,42 @@
package cn.iocoder.mall.managementweb.controller.admin.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
@ApiModel("管理员更新信息 DTO")
@Data
@Accessors(chain = true)
public class AdminUpdateInfoDTO {
@ApiModelProperty(value = "管理员编号", required = true, example = "1")
@NotNull(message = "管理员编号不能为空")
private Integer id;
@ApiModelProperty(value = "登陆账号", required = true, example = "15601691300")
@NotEmpty(message = "登陆账号不能为空")
@Length(min = 5, max = 16, message = "账号长度为 5-16 位")
@Pattern(regexp = "^[A-Za-z0-9]+$", message = "账号格式为数字以及字母")
private String username;
@ApiModelProperty(value = "密码", required = true, example = "buzhidao")
@NotEmpty(message = "密码不能为空")
@Length(min = 4, max = 16, message = "密码长度为 4-16 位")
private String password;
@ApiModelProperty(value = "真实名字", required = true, example = "小王")
@NotEmpty(message = "真实名字不能为空")
@Length(max = 10, message = "真实名字长度最大为 10 位")
private String name;
@ApiModelProperty(value = "部门编号", required = true, example = "1")
@NotNull(message = "部门不能为空")
private Integer departmentId;
}

View File

@@ -0,0 +1,26 @@
package cn.iocoder.mall.managementweb.controller.admin.dto;
import cn.iocoder.common.framework.enums.CommonStatusEnum;
import cn.iocoder.common.framework.validator.InEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull;
@ApiModel("管理员更新状态 DTO")
@Data
@Accessors(chain = true)
public class AdminUpdateStatusDTO {
@ApiModelProperty(value = "管理员编号", required = true, example = "1")
@NotNull(message = "管理员编号不能为空")
private Integer adminId;
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举")
@NotNull(message = "状态不能为空")
@InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")
private Integer status;
}

View File

@@ -0,0 +1,24 @@
package cn.iocoder.mall.managementweb.controller.admin.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
@ApiModel("部门创建 DTO")
@Data
public class DepartmentCreateDTO {
@ApiModelProperty(value = "部门名称", required = true, example = "技术部")
@NotEmpty(message = "部门名称不能为空")
private String name;
@ApiModelProperty(value = "排序字段", required = true, example = "1024")
@NotNull(message = "排序字段不能为空")
private Integer sort;
@ApiModelProperty(value = "父级部门编号", required = true, example = "2048")
@NotNull(message = "父级部门编号不能为空")
private Integer pid;
}

View File

@@ -0,0 +1,27 @@
package cn.iocoder.mall.managementweb.controller.admin.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
@ApiModel("部门更新 DTO")
@Data
public class DepartmentUpdateDTO {
@ApiModelProperty(value = "部门编号", required = true, example = "1")
@NotNull(message = "部门编号不能为空")
private Integer id;
@ApiModelProperty(value = "部门名称", required = true, example = "技术部")
@NotEmpty(message = "部门名称不能为空")
private String name;
@ApiModelProperty(value = "排序字段", required = true, example = "1024")
@NotNull(message = "排序字段不能为空")
private Integer sort;
@ApiModelProperty(value = "父级部门编号", required = true, example = "2048")
@NotNull(message = "父级部门编号不能为空")
private Integer pid;
}

View File

@@ -0,0 +1,62 @@
package cn.iocoder.mall.managementweb.controller.admin.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Date;
import java.util.List;
@ApiModel(value = "分页时,管理员的信息 VO")
@Data
@Accessors(chain = true)
public class AdminPageItemVO {
@ApiModel("角色")
@Data
@Accessors(chain = true)
public static class Role {
@ApiModelProperty(value = "角色编号", required = true, example = "1")
private Integer id;
@ApiModelProperty(value = "角色名", required = true, example = "码神")
private String name;
}
@ApiModel("部门")
@Data
@Accessors(chain = true)
public static class Department {
@ApiModelProperty(value = "部门编号", required = true, example = "1")
private Integer id;
@ApiModelProperty(value = "部门名称", required = true, example = "研发部")
private String name;
}
@ApiModelProperty(value = "管理员编号", required = true, example = "1")
private Integer id;
@ApiModelProperty(value = "真实名字", required = true, example = "小王")
private String name;
@ApiModelProperty(value = "创建时间", required = true, example = "时间戳格式")
private Date createTime;
@ApiModelProperty(value = "在职状态", required = true, example = "1", notes = "见 AdminStatusEnum 枚举")
private Integer status;
@ApiModelProperty(value = "登陆账号", required = true, example = "15601691300")
private String username;
/**
* 角色列表
*/
private List<Role> roles;
/**
* 所在部门
*/
private Department department;
}

View File

@@ -0,0 +1,26 @@
package cn.iocoder.mall.managementweb.controller.admin.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Date;
@ApiModel(value = "管理员 VO")
@Data
@Accessors(chain = true)
public class AdminVO {
@ApiModelProperty(value = "管理员编号", required = true, example = "1")
private Integer id;
@ApiModelProperty(value = "真实名字", required = true, example = "小王")
private String name;
@ApiModelProperty(value = "创建时间", required = true, example = "时间戳格式")
private Date createTime;
@ApiModelProperty(value = "在职状态", required = true, example = "1", notes = "见 AdminStatusEnum 枚举")
private Integer status;
@ApiModelProperty(value = "登陆账号", required = true, example = "15601691300")
private String username;
}

View File

@@ -0,0 +1,30 @@
package cn.iocoder.mall.managementweb.controller.admin.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
@ApiModel("部门树节点 VO")
@Data
public class DepartmentTreeNodeVO {
@ApiModelProperty(value = "部门编号", required = true, example = "1")
private Integer id;
@ApiModelProperty(value = "部门名称", required = true, example = "技术部")
private String name;
@ApiModelProperty(value = "排序字段", required = true, example = "1024")
private Integer sort;
@ApiModelProperty(value = "父级部门编号", required = true, example = "2048")
private Integer pid;
@ApiModelProperty(value = "创建时间", required = true)
private Date createTime;
/**
* 子节点
*/
private List<DepartmentTreeNodeVO> children;
}

View File

@@ -0,0 +1,22 @@
package cn.iocoder.mall.managementweb.controller.admin.vo;
import lombok.*;
import io.swagger.annotations.*;
import java.util.*;
@ApiModel("部门 VO")
@Data
public class DepartmentVO {
@ApiModelProperty(value = "部门编号", required = true, example = "1")
private Integer id;
@ApiModelProperty(value = "部门名称", required = true, example = "技术部")
private String name;
@ApiModelProperty(value = "排序字段", required = true, example = "1024")
private Integer sort;
@ApiModelProperty(value = "父级部门编号", required = true, example = "2048")
private Integer pid;
@ApiModelProperty(value = "创建时间", required = true)
private Date createTime;
}

View File

@@ -0,0 +1,88 @@
package cn.iocoder.mall.managementweb.controller.datadict;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.managementweb.controller.datadict.dto.DataDictCreateDTO;
import cn.iocoder.mall.managementweb.controller.datadict.dto.DataDictUpdateDTO;
import cn.iocoder.mall.managementweb.controller.datadict.vo.DataDictSimpleVO;
import cn.iocoder.mall.managementweb.controller.datadict.vo.DataDictVO;
import cn.iocoder.mall.managementweb.manager.datadict.DataDictManager;
import cn.iocoder.security.annotations.RequiresPermissions;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
import static cn.iocoder.common.framework.vo.CommonResult.success;
/**
* 数据字典 Controller
*/
@RestController
@RequestMapping("/data-dict")
@Api(tags = "数据字典")
@Validated
public class DataDictController {
@Autowired
private DataDictManager dataDictManager;
@PostMapping("/create")
@ApiOperation("创建数据字典")
@RequiresPermissions("system:data-dict:create")
public CommonResult<Integer> createDataDict(@Valid DataDictCreateDTO createDTO) {
return success(dataDictManager.createDataDict(createDTO));
}
@PostMapping("/update")
@ApiOperation("更新数据字典")
@RequiresPermissions("system:data-dict:update")
public CommonResult<Boolean> updateDataDict(@Valid DataDictUpdateDTO updateDTO) {
dataDictManager.updateDataDict(updateDTO);
return success(true);
}
@PostMapping("/delete")
@ApiOperation("删除数据字典")
@ApiImplicitParam(name = "dataDictId", value = "数据字典编号", required = true)
@RequiresPermissions("system:data-dict:delete")
public CommonResult<Boolean> deleteDataDict(@RequestParam("dataDictId") Integer dataDictId) {
dataDictManager.deleteDataDict(dataDictId);
return success(true);
}
@GetMapping("/get")
@ApiOperation("获得数据字典")
@ApiImplicitParam(name = "dataDictId", value = "数据字典编号", required = true)
@RequiresPermissions("system:data-dict:list")
public CommonResult<DataDictVO> getDataDict(@RequestParam("dataDictId") Integer dataDictId) {
return success(dataDictManager.getDataDict(dataDictId));
}
@GetMapping("/list")
@ApiOperation("获得数据字典列表")
@ApiImplicitParam(name = "dataDictIds", value = "数据字典编号列表", required = true)
@RequiresPermissions("system:data-dict:list")
public CommonResult<List<DataDictVO>> listDataDicts(@RequestParam("dataDictIds") List<Integer> dataDictIds) {
return success(dataDictManager.listDataDicts(dataDictIds));
}
@GetMapping("/list-all")
@ApiOperation("获得全部数据字典列表")
@RequiresPermissions("system:data-dict:list")
public CommonResult<List<DataDictVO>> listDataDicts() {
return success(dataDictManager.listDataDicts());
}
@GetMapping("/list-all-simple")
@ApiOperation(value = "获得全部数据字典列表", notes = "一般用于管理后台缓存数据字典在本地")
// 无需添加权限认证,因为前端全局都需要
public CommonResult<List<DataDictSimpleVO>> listSimpleDataDicts() {
return success(dataDictManager.listSimpleDataDicts());
}
}

View File

@@ -0,0 +1,29 @@
package cn.iocoder.mall.managementweb.controller.datadict.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
@ApiModel("数据字典创建 DTO")
@Data
public class DataDictCreateDTO {
@ApiModelProperty(value = "大类枚举值", required = true, example = "gender")
@NotEmpty(message = "大类枚举值不能为空")
private String enumValue;
@ApiModelProperty(value = "小类数值", required = true, example = "1")
@NotEmpty(message = "小类数值不能为空")
private String value;
@ApiModelProperty(value = "展示名", required = true, example = "")
@NotEmpty(message = "展示名不能为空")
private String displayName;
@ApiModelProperty(value = "排序值", required = true, example = "1")
@NotNull(message = "排序值不能为空")
private Integer sort;
@ApiModelProperty(value = "备注", example = "性别 - 男(嗨)")
private String memo;
}

View File

@@ -0,0 +1,32 @@
package cn.iocoder.mall.managementweb.controller.datadict.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
@ApiModel("数据字典更新 DTO")
@Data
public class DataDictUpdateDTO {
@ApiModelProperty(value = "编号", required = true, example = "1024")
@NotNull(message = "编号不能为空")
private Integer id;
@ApiModelProperty(value = "大类枚举值", required = true, example = "gender")
@NotEmpty(message = "大类枚举值不能为空")
private String enumValue;
@ApiModelProperty(value = "小类数值", required = true, example = "1")
@NotEmpty(message = "小类数值不能为空")
private String value;
@ApiModelProperty(value = "展示名", required = true, example = "")
@NotEmpty(message = "展示名不能为空")
private String displayName;
@ApiModelProperty(value = "排序值", required = true, example = "1")
@NotNull(message = "排序值不能为空")
private Integer sort;
@ApiModelProperty(value = "备注", example = "性别 - 男(嗨)")
private String memo;
}

View File

@@ -0,0 +1,20 @@
package cn.iocoder.mall.managementweb.controller.datadict.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
@ApiModel("数据字典精简 VO")
@Data
public class DataDictSimpleVO {
@ApiModelProperty(value = "大类枚举值", required = true, example = "gender")
private String enumValue;
@ApiModelProperty(value = "小类数值", required = true, example = "1")
private String value;
@ApiModelProperty(value = "展示名", required = true, example = "")
private String displayName;
}

View File

@@ -0,0 +1,34 @@
package cn.iocoder.mall.managementweb.controller.datadict.vo;
import lombok.*;
import io.swagger.annotations.*;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.*;
@ApiModel("数据字典 VO")
@Data
public class DataDictVO {
@ApiModelProperty(value = "编号", required = true, example = "1024")
@NotNull(message = "编号不能为空")
private Integer id;
@ApiModelProperty(value = "大类枚举值", required = true, example = "gender")
@NotEmpty(message = "大类枚举值不能为空")
private String enumValue;
@ApiModelProperty(value = "小类数值", required = true, example = "1")
@NotEmpty(message = "小类数值不能为空")
private String value;
@ApiModelProperty(value = "展示名", required = true, example = "")
@NotEmpty(message = "展示名不能为空")
private String displayName;
@ApiModelProperty(value = "排序值", required = true, example = "1")
@NotNull(message = "排序值不能为空")
private Integer sort;
@ApiModelProperty(value = "备注", example = "性别 - 男(嗨)")
private String memo;
@ApiModelProperty(value = "创建时间", required = true)
private Date createTime;
}

View File

@@ -0,0 +1,73 @@
package cn.iocoder.mall.managementweb.controller.errorcode;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.common.framework.vo.PageResult;
import cn.iocoder.mall.managementweb.controller.errorcode.dto.ErrorCodeCreateDTO;
import cn.iocoder.mall.managementweb.controller.errorcode.dto.ErrorCodePageDTO;
import cn.iocoder.mall.managementweb.controller.errorcode.dto.ErrorCodeUpdateDTO;
import cn.iocoder.mall.managementweb.controller.errorcode.vo.ErrorCodeVO;
import cn.iocoder.mall.managementweb.manager.errorcode.ErrorCodeManager;
import cn.iocoder.security.annotations.RequiresPermissions;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import static cn.iocoder.common.framework.vo.CommonResult.success;
/**
* 错误码 Controller
*/
@RestController
@RequestMapping("/error-code")
@Api(tags = "错误码")
@Validated
public class ErrorCodeController {
@Autowired
private ErrorCodeManager errorCodeManager;
@PostMapping("/create")
@ApiOperation("创建错误码")
@RequiresPermissions("system:error-code:create")
public CommonResult<Integer> createErrorCode(@Valid ErrorCodeCreateDTO createDTO) {
return success(errorCodeManager.createErrorCode(createDTO));
}
@PostMapping("/update")
@ApiOperation("更新错误码")
@RequiresPermissions("system:error-code:update")
public CommonResult<Boolean> updateErrorCode(@Valid ErrorCodeUpdateDTO updateDTO) {
errorCodeManager.updateErrorCode(updateDTO);
return success(true);
}
@PostMapping("/delete")
@ApiOperation("删除错误码")
@ApiImplicitParam(name = "errorCodeId", value = "错误码编号", required = true)
@RequiresPermissions("system:error-code:delete")
public CommonResult<Boolean> deleteErrorCode(@RequestParam("errorCodeId") Integer errorCodeId) {
errorCodeManager.deleteErrorCode(errorCodeId);
return success(true);
}
@GetMapping("/get")
@ApiOperation("获得错误码")
@ApiImplicitParam(name = "errorCodeId", value = "错误码编号", required = true)
@RequiresPermissions("system:error-code:page")
public CommonResult<ErrorCodeVO> getErrorCode(@RequestParam("errorCodeId") Integer errorCodeId) {
return success(errorCodeManager.getErrorCode(errorCodeId));
}
@GetMapping("/page")
@ApiOperation("获得错误码分页")
@RequiresPermissions("system:error-code:page")
public CommonResult<PageResult<ErrorCodeVO>> pageErrorCode(ErrorCodePageDTO pageDTO) {
return success(errorCodeManager.pageErrorCode(pageDTO));
}
}

View File

@@ -0,0 +1,26 @@
package cn.iocoder.mall.managementweb.controller.errorcode.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
@ApiModel("错误码创建 DTO")
@Data
public class ErrorCodeCreateDTO {
@ApiModelProperty(value = "错误码编码", required = true, example = "10086")
@NotNull(message = "错误码编码不能为空")
private Integer code;
@ApiModelProperty(value = "错误码错误提示", required = true, example = "艿艿长的丑")
@NotEmpty(message = "错误码错误提示不能为空")
private String message;
@ApiModelProperty(value = "错误码分组", required = true, example = "user-service")
@NotEmpty(message = "错误码分组不能为空")
private String group;
@ApiModelProperty(value = "错误码备注", example = "我就是一个备注")
private String memo;
}

View File

@@ -0,0 +1,21 @@
package cn.iocoder.mall.managementweb.controller.errorcode.dto;
import cn.iocoder.common.framework.vo.PageParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ApiModel("错误码分页 DTO")
@Data
@EqualsAndHashCode(callSuper = true)
public class ErrorCodePageDTO extends PageParam {
@ApiModelProperty(value = "错误码编码", required = true)
private Integer code;
@ApiModelProperty(value = "错误码错误提示", required = true)
private String message;
@ApiModelProperty(value = "错误码分组", required = true)
private String group;
}

View File

@@ -0,0 +1,29 @@
package cn.iocoder.mall.managementweb.controller.errorcode.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
@ApiModel("错误码更新 DTO")
@Data
public class ErrorCodeUpdateDTO {
@ApiModelProperty(value = "错误码编号", required = true, example = "1")
@NotNull(message = "错误码编号不能为空")
private Integer id;
@ApiModelProperty(value = "错误码编码", required = true, example = "10086")
@NotNull(message = "错误码编码不能为空")
private Integer code;
@ApiModelProperty(value = "错误码错误提示", required = true, example = "艿艿长的丑")
@NotEmpty(message = "错误码错误提示不能为空")
private String message;
@ApiModelProperty(value = "错误码分组", required = true, example = "user-service")
@NotEmpty(message = "错误码分组不能为空")
private String group;
@ApiModelProperty(value = "错误码备注", example = "我就是一个备注")
private String memo;
}

View File

@@ -0,0 +1,28 @@
package cn.iocoder.mall.managementweb.controller.errorcode.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@ApiModel("错误码 VO")
@Data
public class ErrorCodeVO {
@ApiModelProperty(value = "错误码编号", required = true, example = "1")
private Integer id;
@ApiModelProperty(value = "错误码编码", required = true, example = "10086")
private Integer code;
@ApiModelProperty(value = "错误码错误提示", required = true, example = "艿艿长的丑")
private String message;
@ApiModelProperty(value = "错误码类型", required = true, notes = "见 ErrorCodeTypeEnum 枚举", example = "1")
private Integer type;
@ApiModelProperty(value = "错误码分组", required = true, example = "user-service")
private String group;
@ApiModelProperty(value = "错误码备注", example = "我就是一个备注")
private String memo;
@ApiModelProperty(value = "创建时间", required = true)
private Date createTime;
}

View File

@@ -0,0 +1,34 @@
### /passport/login 成功
POST http://127.0.0.1:18083/management-api/passport/login
Content-Type: application/x-www-form-urlencoded
username=admin&password=buzhidao
### /passport/login 密码不正确
POST http://127.0.0.1:18083/management-api/passport/login
Content-Type: application/x-www-form-urlencoded
username=admin&password=1024
### /passport/login 少传参数
POST http://127.0.0.1:18083/management-api/passport/login
Content-Type: application/x-www-form-urlencoded
username=admin
### /passport/info 成功
GET http://127.0.0.1:18083/management-api/passport/info
Authorization: Bearer yudaoyuanma
### /passport/tree-admin-menu 成功
GET http://127.0.0.1:18083/management-api/passport/tree-admin-menu
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
### /passport/list-admin-permission 成功
GET http://127.0.0.1:18083/management-api/passport/list-admin-permission
Content-Type: application/x-www-form-urlencoded
#Authorization: Bearer yudaoyuanma
Authorization: Bearer 36dce986276b4d6c8f9f4f3b89b22810
###

View File

@@ -0,0 +1,67 @@
package cn.iocoder.mall.managementweb.controller.passport;
import cn.iocoder.common.framework.util.HttpUtil;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.managementweb.controller.passport.dto.PassportLoginDTO;
import cn.iocoder.mall.managementweb.controller.passport.vo.PassportAccessTokenVO;
import cn.iocoder.mall.managementweb.controller.passport.vo.PassportAdminMenuTreeNodeVO;
import cn.iocoder.mall.managementweb.controller.passport.vo.PassportAdminVO;
import cn.iocoder.mall.managementweb.manager.passport.PassportManager;
import cn.iocoder.mall.security.admin.core.context.AdminSecurityContextHolder;
import cn.iocoder.security.annotations.RequiresNone;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Set;
import static cn.iocoder.common.framework.vo.CommonResult.success;
@Api(tags = "管理员 Passport API")
@RestController
@RequestMapping("/passport")
public class PassportController {
@Autowired
private PassportManager passportManager;
@PostMapping("/login")
@ApiOperation("账号密码登陆")
@RequiresNone
public CommonResult<PassportAccessTokenVO> login(PassportLoginDTO loginDTO,
HttpServletRequest request) {
return success(passportManager.login(loginDTO, HttpUtil.getIp(request)));
}
@GetMapping("/info")
@ApiOperation(value = "获得当前管理员信息")
public CommonResult<PassportAdminVO> getInfo() {
return success(passportManager.getAdmin(AdminSecurityContextHolder.getAdminId()));
}
@PostMapping("/refresh-token")
@ApiOperation("刷新令牌")
@RequiresNone
public CommonResult<PassportAccessTokenVO> refreshToken(@RequestParam("refreshToken") String refreshToken,
HttpServletRequest request) {
return success(passportManager.refreshToken(refreshToken, HttpUtil.getIp(request)));
}
// TODO 优化点:迁移到 PermissionController
@GetMapping("/tree-admin-menu")
@ApiOperation("获得当前管理员的菜单树")
public CommonResult<List<PassportAdminMenuTreeNodeVO>> treeAdminMenu() {
return success(passportManager.treeAdminMenu(AdminSecurityContextHolder.getAdminId()));
}
// TODO 优化点:迁移到 PermissionController
@GetMapping("/list-admin-permission")
@ApiOperation("获得当前管理员的权限列表")
public CommonResult<Set<String>> listAdminPermission() {
return success(passportManager.listAdminPermission(AdminSecurityContextHolder.getAdminId()));
}
}

View File

@@ -0,0 +1,29 @@
package cn.iocoder.mall.managementweb.controller.passport.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
@ApiModel("管理登录 DTO")
@Data
@Accessors(chain = true)
public class PassportLoginDTO implements Serializable {
@ApiModelProperty(value = "用户名", required = true, example = "yudaoyuanma")
@NotEmpty(message = "登陆账号不能为空")
@Length(min = 5, max = 16, message = "账号长度为 5-16 位")
@Pattern(regexp = "^[A-Za-z0-9]+$", message = "账号格式为数字以及字母")
private String username;
@ApiModelProperty(value = "密码", required = true, example = "buzhidao")
@NotEmpty(message = "密码不能为空")
@Length(min = 4, max = 16, message = "密码长度为 4-16 位")
private String password;
}

View File

@@ -0,0 +1,22 @@
package cn.iocoder.mall.managementweb.controller.passport.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Date;
@ApiModel("访问令牌信息 VO")
@Data
@Accessors(chain = true)
public class PassportAccessTokenVO {
@ApiModelProperty(value = "访问令牌", required = true, example = "001e8f49b20e47f7b3a2de774497cd50")
private String accessToken;
@ApiModelProperty(value = "刷新令牌", required = true, example = "001e8f49b20e47f7b3a2de774497cd50")
private String refreshToken;
@ApiModelProperty(value = "过期时间", required = true)
private Date expiresTime;
}

View File

@@ -0,0 +1,33 @@
package cn.iocoder.mall.managementweb.controller.passport.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.List;
@ApiModel(value = "管理员拥有的菜单树", description = "一般用于首页菜单")
@Data
@Accessors(chain = true)
public class PassportAdminMenuTreeNodeVO {
@ApiModelProperty(value = "菜单编号", required = true, example = "1")
private Integer id;
@ApiModelProperty(value = "菜单名", required = true, example = "商品管理")
private String name;
@ApiModelProperty(value = "前端路由", required = true, example = "/order/list")
private String route;
@ApiModelProperty(value = "菜单图标", required = true, example = "user")
private String icon;
@ApiModelProperty(value = "前端界面", example = "@/views/example/edit")
private String view;
@ApiModelProperty(value = "父级资源编号", required = true, example = "1", notes = "如果无父资源,则值为 0")
private Integer pid;
/**
* 子节点数组
*/
private List<PassportAdminMenuTreeNodeVO> children;
}

View File

@@ -0,0 +1,18 @@
package cn.iocoder.mall.managementweb.controller.passport.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
@ApiModel("管理员信息 VO")
@Data
@Accessors(chain = true)
public class PassportAdminVO {
@ApiModelProperty(value = "真实名字", required = true, example = "小王")
private String name;
@ApiModelProperty(value = "头像", required = true, example = "http://www.iocoder.cn/xxx.jpg")
private String avatar;
}

View File

@@ -0,0 +1,7 @@
### /product-spu/page 成功(全部)
GET http://127.0.0.1:18083/management-api/pay/transaction/page?pageNo=1&pageSize=10
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
dubbo-tag: {{dubboTag}}
###

View File

@@ -0,0 +1,38 @@
package cn.iocoder.mall.managementweb.controller.pay;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.common.framework.vo.PageResult;
import cn.iocoder.mall.managementweb.controller.pay.vo.transaction.PayTransactionPageReqVO;
import cn.iocoder.mall.managementweb.controller.pay.vo.transaction.PayTransactionRespVO;
import cn.iocoder.mall.managementweb.service.pay.transaction.PayTransactionService;
import cn.iocoder.security.annotations.RequiresPermissions;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import static cn.iocoder.common.framework.vo.CommonResult.success;
@Api("支付交易单 API")
@RestController
@RequestMapping("/pay/transaction")
@Validated
@Slf4j
public class PayTransactionController {
@Autowired
private PayTransactionService payTransactionService;
@GetMapping("/page")
@RequiresPermissions("pay:transaction:page")
@ApiOperation("获得交易支付单分页")
public CommonResult<PageResult<PayTransactionRespVO>> pagePayTransaction(PayTransactionPageReqVO pageReqVO) {
// 执行查询
return success(payTransactionService.pagePayTransaction(pageReqVO));
}
}

View File

@@ -0,0 +1,44 @@
package cn.iocoder.mall.managementweb.controller.pay.vo.transaction;
import cn.iocoder.common.framework.vo.PageParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@ApiModel("支付交易分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
public class PayTransactionPageReqVO extends PageParam {
@ApiModelProperty(value = "创建时间(开始)", example = "2019-10-10 11:12:13")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createBeginTime;
@ApiModelProperty(value = "创建时间(结束)", example = "2019-10-10 11:12:13")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createEndTime;
@ApiModelProperty(value = "创建时间()", example = "2019-10-10 11:12:13")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date paymentBeginTime;
@ApiModelProperty(value = "创建时间()", example = "2019-10-10 11:12:13")
private Date paymentEndTime;
@ApiModelProperty(value = "支付状态", example = "1", notes = "参见 PayTransactionStatusEnum 枚举")
private Integer status;
@ApiModelProperty(value = "是否退款", example = "true")
private Boolean hasRefund;
@ApiModelProperty(value = "支付渠道", example = "1", notes = "参见 PayChannelEnum 枚举")
private Integer payChannel;
@ApiModelProperty(value = "商品标题", example = "芋头")
private String orderSubject;
}

View File

@@ -0,0 +1,74 @@
package cn.iocoder.mall.managementweb.controller.pay.vo.transaction;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Date;
@ApiModel("支付交易单 Response VO")
@Data
@Accessors(chain = true)
public class PayTransactionRespVO {
@ApiModelProperty(value = "交易编号", required = true, example = "POd4RC6a")
private Integer id;
@ApiModelProperty(value = "用户编号", required = true, example = "1024")
private Integer userId;
@ApiModelProperty(value = "应用编号", required = true, example = "POd4RC6a")
private String appId;
@ApiModelProperty(value = "发起交易的 IP", required = true, example = "192.168.10.1")
private String createIp;
@ApiModelProperty(value = "订单号不能为空", required = true, example = "1024")
private String orderId;
@ApiModelProperty(value = "商品名", required = true, example = "芋道源码")
private String orderSubject;
@ApiModelProperty(value = "订单商品描述", required = true, example = "绵啾啾的")
private String orderDescription;
@ApiModelProperty(value = "订单商品备注", example = "绵啾啾的")
private String orderMemo;
@ApiModelProperty(value = "支付金额,单位:分。", required = true, example = "10")
private Integer price;
@ApiModelProperty(value = "订单状态", required = true, example = "1", notes = "参见 PayTransactionStatusEnum 枚举")
private Integer status;
@ApiModelProperty(value = "交易过期时间", required = true)
private Date expireTime;
@ApiModelProperty(value = "回调业务线完成时间")
private Date finishTime;
@ApiModelProperty(value = "成功支付的交易拓展编号", example = "1024")
private Integer extensionId;
@ApiModelProperty(value = "支付成功的支付渠道", example = "1", notes = "参见 PayChannelEnum 枚举")
private Integer payChannel;
@ApiModelProperty(value = "第三方支付成功的时间")
private Date paymentTime;
@ApiModelProperty(value = "收到第三方系统通知的时间")
private Date notifyTime;
@ApiModelProperty(value = "第三方的流水号", example = "11122233344444")
private String tradeNo;
@ApiModelProperty(value = "添加时间", required = true)
private Date createTime;
// ========== 退款相关 ==========
@ApiModelProperty(value = "退款总金额,单位:分", example = "100")
private Integer refundTotal;
}

View File

@@ -0,0 +1,11 @@
### /permission/list 成功
GET http://127.0.0.1:18083/management-api/permission/list-role-resource?roleId=1
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
### /permission/list-admin-roles 成功
GET http://127.0.0.1:18083/management-api/permission/list-admin-roles?adminId=1
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
###

View File

@@ -0,0 +1,66 @@
package cn.iocoder.mall.managementweb.controller.permission;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.managementweb.controller.permission.dto.PermissionAssignAdminRoleDTO;
import cn.iocoder.mall.managementweb.controller.permission.dto.PermissionAssignRoleResourceDTO;
import cn.iocoder.mall.managementweb.manager.permission.PermissionManager;
import cn.iocoder.security.annotations.RequiresPermissions;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Set;
import static cn.iocoder.common.framework.vo.CommonResult.success;
/**
* 权限 Controller
*/
@RestController
@RequestMapping("/permission")
@Api(tags = "权限")
@Validated
public class PermissionController {
@Autowired
private PermissionManager permissionManager;
@GetMapping("/list-role-resources")
@ApiOperation("获得角色拥有的资源编号")
@ApiImplicitParam(name = "roleId", value = "角色编号", required = true)
@RequiresPermissions("system:permission:assign-role-resource")
public CommonResult<Set<Integer>> listRoleResources(Integer roleId) {
return success(permissionManager.listRoleResources(roleId));
}
@PostMapping("/assign-role-resource")
@ApiOperation("赋予角色资源")
@RequiresPermissions("system:permission:assign-role-resource")
public CommonResult<Boolean> assignRoleResource(PermissionAssignRoleResourceDTO assignRoleResourceDTO) {
permissionManager.assignRoleResource(assignRoleResourceDTO);
return success(true);
}
@GetMapping("/list-admin-roles")
@ApiOperation("获得管理员拥有的角色编号列表")
@RequiresPermissions("system:permission:assign-admin-role")
@ApiImplicitParam(name = "adminId", value = "管理员编号", required = true)
public CommonResult<Set<Integer>> listAdminRoles(Integer adminId) {
return success(permissionManager.listAdminRoles(adminId));
}
@PostMapping("/assign-admin-role")
@ApiOperation("赋予用户角色")
@RequiresPermissions("system:permission:assign-admin-role")
public CommonResult<Boolean> assignAdminRole(PermissionAssignAdminRoleDTO assignAdminRoleDTO) {
permissionManager.assignAdminRole(assignAdminRoleDTO);
return success(true);
}
}

View File

@@ -0,0 +1,37 @@
### /resource/create 成功
POST http://127.0.0.1:18083/management-api/resource/create
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
name=测试菜单&permission=resource:add&type=1&sort=1&pid=0&route=/resource/list&icon=test
### /admin/update 成功
POST http://127.0.0.1:18083/management-api/resource/update
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
id=61&name=测试菜单2&permission=resource:add&type=1&sort=1&pid=0&route=/resource/list&icon=test
### /resource/delete 成功
POST http://127.0.0.1:18083/management-api/resource/delete
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
resourceId=61
### /resource/get 成功
GET http://127.0.0.1:18083/management-api/resource/get?resourceId=61
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
### /resource/list 成功
GET http://127.0.0.1:18083/management-api/resource/list?resourceIds=61,63
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
### /resource/tree 成功
GET http://127.0.0.1:18083/management-api/resource/tree
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
###

View File

@@ -0,0 +1,81 @@
package cn.iocoder.mall.managementweb.controller.permission;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.managementweb.controller.permission.dto.ResourceCreateDTO;
import cn.iocoder.mall.managementweb.controller.permission.dto.ResourceUpdateDTO;
import cn.iocoder.mall.managementweb.controller.permission.vo.ResourceTreeNodeVO;
import cn.iocoder.mall.managementweb.controller.permission.vo.ResourceVO;
import cn.iocoder.mall.managementweb.manager.permission.ResourceManager;
import cn.iocoder.mall.security.admin.core.context.AdminSecurityContextHolder;
import cn.iocoder.security.annotations.RequiresPermissions;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
import static cn.iocoder.common.framework.vo.CommonResult.success;
/**
* 资源 Controller
*/
@RestController
@RequestMapping("/resource")
@Api(tags = "资源")
@Validated
public class ResourceController {
@Autowired
private ResourceManager resourceManager;
@PostMapping("/create")
@ApiOperation("创建资源")
@RequiresPermissions("system:resource:create")
public CommonResult<Integer> createResource(@Valid ResourceCreateDTO createDTO) {
return success(resourceManager.createResource(createDTO, AdminSecurityContextHolder.getAdminId()));
}
@PostMapping("/update")
@ApiOperation("更新资源")
@RequiresPermissions("system:resource:update")
public CommonResult<Boolean> updateResource(@Valid ResourceUpdateDTO updateDTO) {
resourceManager.updateResource(updateDTO);
return success(true);
}
@PostMapping("/delete")
@ApiOperation("删除资源")
@ApiImplicitParam(name = "resourceId", value = "资源编号", required = true)
@RequiresPermissions("system:resource:delete")
public CommonResult<Boolean> deleteResource(@RequestParam("resourceId") Integer resourceId) {
resourceManager.deleteResource(resourceId);
return success(true);
}
@GetMapping("/get")
@ApiOperation("获得资源")
@RequiresPermissions("system:resource:tree")
public CommonResult<ResourceVO> getResource(@RequestParam("resourceId") Integer resourceId) {
return success(resourceManager.getResource(resourceId));
}
@GetMapping("/list")
@ApiOperation("获得资源列表")
@ApiImplicitParam(name = "resourceIds", value = "资源编号列表", required = true)
@RequiresPermissions("system:resource:tree")
public CommonResult<List<ResourceVO>> listResources(@RequestParam("resourceIds") List<Integer> resourceIds) {
return success(resourceManager.listResources(resourceIds));
}
@GetMapping("/tree")
@ApiOperation("获得资源树")
@RequiresPermissions("system:resource:tree")
public CommonResult<List<ResourceTreeNodeVO>> treeResource() {
return success(resourceManager.treeResource());
}
}

View File

@@ -0,0 +1,44 @@
### /role/create 成功
POST http://127.0.0.1:18083/management-api/role/create
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
#Authorization: Bearer 9d250d9b6c034a6c88bf4034cdf1d4cc
name=测试角色
### /role/update 成功
POST http://127.0.0.1:18083/management-api/role/update
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
id=14&name=test
### /resource/delete 成功
POST http://127.0.0.1:18083/management-api/role/delete
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
roleId=14
### /role/get 成功
GET http://127.0.0.1:18083/management-api/role/get?roleId=13
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
### /role/list-all 成功
GET http://127.0.0.1:18083/management-api/role/list-all
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
### /role/list 成功
GET http://127.0.0.1:18083/management-api/role/list?roleIds=1,13
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
### /role/page 成功
GET http://127.0.0.1:18083/management-api/role/page?pageNo=1&pageSize=10
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
###

View File

@@ -0,0 +1,90 @@
package cn.iocoder.mall.managementweb.controller.permission;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.common.framework.vo.PageResult;
import cn.iocoder.mall.managementweb.controller.permission.dto.RoleCreateDTO;
import cn.iocoder.mall.managementweb.controller.permission.dto.RolePageDTO;
import cn.iocoder.mall.managementweb.controller.permission.dto.RoleUpdateDTO;
import cn.iocoder.mall.managementweb.controller.permission.vo.RoleVO;
import cn.iocoder.mall.managementweb.manager.permission.RoleManager;
import cn.iocoder.mall.security.admin.core.context.AdminSecurityContextHolder;
import cn.iocoder.security.annotations.RequiresPermissions;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
import static cn.iocoder.common.framework.vo.CommonResult.success;
/**
* 角色 Controller
*/
@RestController
@RequestMapping("/role")
@Api(tags = "角色")
@Validated
public class RoleController {
@Autowired
private RoleManager roleManager;
@PostMapping("/create")
@ApiOperation("创建角色")
@RequiresPermissions("system:role:create")
public CommonResult<Integer> createRole(@Valid RoleCreateDTO createDTO) {
return success(roleManager.createRole(createDTO, AdminSecurityContextHolder.getAdminId()));
}
@PostMapping("/update")
@ApiOperation("更新角色")
@RequiresPermissions("system:role:update")
public CommonResult<Boolean> updateRole(@Valid RoleUpdateDTO updateDTO) {
roleManager.updateRole(updateDTO);
return success(true);
}
@PostMapping("/delete")
@ApiOperation("删除角色")
@ApiImplicitParam(name = "roleId", value = "角色编号", required = true)
@RequiresPermissions("system:role:delete")
public CommonResult<Boolean> deleteRole(@RequestParam("roleId") Integer roleId) {
roleManager.deleteRole(roleId);
return success(true);
}
@GetMapping("/get")
@ApiOperation("获得角色")
@ApiImplicitParam(name = "roleId", value = "角色编号", required = true)
@RequiresPermissions("system:admin:page")
public CommonResult<RoleVO> role(@RequestParam("roleId") Integer roleId) {
return success(roleManager.getRole(roleId));
}
@GetMapping("/list-all")
@ApiOperation("获得所有角色列表")
@RequiresPermissions("system:role:page")
public CommonResult<List<RoleVO>> listAllRoles() {
return success(roleManager.listAllRoles());
}
@GetMapping("/list")
@ApiOperation("获得角色列表")
@ApiImplicitParam(name = "roleIds", value = "角色编号列表", required = true)
@RequiresPermissions("system:role:page")
public CommonResult<List<RoleVO>> listRoles(@RequestParam("roleIds") List<Integer> roleIds) {
return success(roleManager.listRoles(roleIds));
}
@GetMapping("/page")
@ApiOperation("获得角色分页")
@RequiresPermissions("system:role:page")
public CommonResult<PageResult<RoleVO>> pageRole(RolePageDTO pageDTO) {
return success(roleManager.pageRole(pageDTO));
}
}

View File

@@ -0,0 +1,20 @@
package cn.iocoder.mall.managementweb.controller.permission.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.Set;
@ApiModel("赋予用户角色 DTO")
@Data
public class PermissionAssignAdminRoleDTO {
@ApiModelProperty(value = "管理员编号", required = true, example = "1")
@NotNull(message = "管理员编号不能为空")
private Integer adminId;
@ApiModelProperty(value = "角色编号列表", example = "1,3,5")
private Set<Integer> roleIds;
}

View File

@@ -0,0 +1,20 @@
package cn.iocoder.mall.managementweb.controller.permission.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.Set;
@ApiModel("赋予角色资源 DTO")
@Data
public class PermissionAssignRoleResourceDTO {
@ApiModelProperty(value = "角色名", required = true, example = "1")
@NotNull(message = "角色编号不能为空")
private Integer roleId;
@ApiModelProperty(value = "资源编号列表", example = "1,3,5")
private Set<Integer> resourceIds;
}

View File

@@ -0,0 +1,38 @@
package cn.iocoder.mall.managementweb.controller.permission.dto;
import cn.iocoder.common.framework.validator.InEnum;
import cn.iocoder.mall.systemservice.enums.permission.ResourceTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
@ApiModel("资源创建 DTO")
@Data
public class ResourceCreateDTO {
@ApiModelProperty(value = "菜单名", required = true, example = "商品管理")
@NotEmpty(message = "菜单名不能为空")
private String name;
@ApiModelProperty(value = "权限标识", example = "resource:add")
private String permission;
@ApiModelProperty(value = "资源类型", required = true, example = "1")
@NotNull(message = "资源类型不能为空")
@InEnum(value = ResourceTypeEnum.class, message = "资源类型必须是 {value}")
private Integer type;
@ApiModelProperty(value = "排序", required = true, example = "1")
@NotNull(message = "排序不能为空")
private Integer sort;
@ApiModelProperty(value = "父级资源编号", required = true, example = "1", notes = "如果无父资源,则值为 0")
@NotNull(message = "父级资源编号不能为空")
private Integer pid;
@ApiModelProperty(value = "前端路由", example = "/resource/list")
private String route;
@ApiModelProperty(value = "菜单图标", example = "add")
private String icon;
@ApiModelProperty(value = "前端界面", example = "@/views/example/edit")
private String view;
}

View File

@@ -0,0 +1,41 @@
package cn.iocoder.mall.managementweb.controller.permission.dto;
import cn.iocoder.common.framework.validator.InEnum;
import cn.iocoder.mall.systemservice.enums.permission.ResourceTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
@ApiModel("资源创建 DTO")
@Data
public class ResourceUpdateDTO {
@ApiModelProperty(value = "资源编号", required = true, example = "1")
@NotNull(message = "资源编号不能为空")
private Integer id;
@ApiModelProperty(value = "菜单名", required = true, example = "商品管理")
@NotEmpty(message = "菜单名不能为空")
private String name;
@ApiModelProperty(value = "权限标识", example = "resource:add")
private String permission;
@ApiModelProperty(value = "资源类型", required = true, example = "1")
@NotNull(message = "资源类型不能为空")
@InEnum(value = ResourceTypeEnum.class, message = "资源类型必须是 {value}")
private Integer type;
@ApiModelProperty(value = "排序", required = true, example = "1")
@NotNull(message = "排序不能为空")
private Integer sort;
@ApiModelProperty(value = "父级资源编号", required = true, example = "1", notes = "如果无父资源,则值为 0")
@NotNull(message = "父级资源编号不能为空")
private Integer pid;
@ApiModelProperty(value = "前端路由", example = "/resource/list")
private String route;
@ApiModelProperty(value = "菜单图标", example = "add")
private String icon;
@ApiModelProperty(value = "前端界面", example = "@/views/example/edit")
private String view;
}

View File

@@ -0,0 +1,19 @@
package cn.iocoder.mall.managementweb.controller.permission.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
@ApiModel("角色创建 DTO")
@Data
public class RoleCreateDTO {
@ApiModelProperty(value = "角色名", required = true, example = "管理员")
@NotEmpty(message = "角色名不能为空")
private String name;
@ApiModelProperty(value = "角色编码", example = "ADMIN")
private String code;
}

View File

@@ -0,0 +1,15 @@
package cn.iocoder.mall.managementweb.controller.permission.dto;
import cn.iocoder.common.framework.vo.PageParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel("角色分页 DTO")
@Data
public class RolePageDTO extends PageParam {
@ApiModelProperty(value = "角色名", example = "管理", notes = "模糊匹配")
private String name;
}

View File

@@ -0,0 +1,23 @@
package cn.iocoder.mall.managementweb.controller.permission.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
@ApiModel("角色更新 DTO")
@Data
public class RoleUpdateDTO {
@ApiModelProperty(value = "角色编号", required = true, example = "1")
@NotNull(message = "角色编号不能为空")
private Integer id;
@ApiModelProperty(value = "角色名", required = true, example = "管理员")
@NotEmpty(message = "角色名不能为空")
private String name;
@ApiModelProperty(value = "角色编码", example = "ADMIN")
private String code;
}

View File

@@ -0,0 +1,50 @@
package cn.iocoder.mall.managementweb.controller.permission.vo;
import cn.iocoder.common.framework.validator.InEnum;
import cn.iocoder.mall.systemservice.enums.permission.ResourceTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;
@ApiModel("资源树节点 VO")
@Data
public class ResourceTreeNodeVO {
@ApiModelProperty(value = "资源编号", required = true, example = "1")
@NotNull(message = "资源编号不能为空")
private Integer id;
@ApiModelProperty(value = "菜单名", required = true, example = "商品管理")
@NotEmpty(message = "菜单名不能为空")
private String name;
@ApiModelProperty(value = "权限标识", example = "resource:add")
private String permission;
@ApiModelProperty(value = "资源类型", required = true, example = "1")
@NotNull(message = "资源类型不能为空")
@InEnum(value = ResourceTypeEnum.class, message = "资源类型必须是 {value}")
private Integer type;
@ApiModelProperty(value = "排序", required = true, example = "1")
@NotNull(message = "排序不能为空")
private Integer sort;
@ApiModelProperty(value = "父级资源编号", required = true, example = "1", notes = "如果无父资源,则值为 0")
@NotNull(message = "父级资源编号不能为空")
private Integer pid;
@ApiModelProperty(value = "前端路由", example = "/resource/list")
private String route;
@ApiModelProperty(value = "菜单图标", example = "add")
private String icon;
@ApiModelProperty(value = "前端界面", example = "@/views/example/edit")
private String view;
@ApiModelProperty(value = "添加时间", required = true)
private Date createTime;
/**
* 子节点
*/
private List<ResourceTreeNodeVO> children;
}

View File

@@ -0,0 +1,43 @@
package cn.iocoder.mall.managementweb.controller.permission.vo;
import cn.iocoder.common.framework.validator.InEnum;
import cn.iocoder.mall.systemservice.enums.permission.ResourceTypeEnum;
import lombok.*;
import io.swagger.annotations.*;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.*;
@ApiModel("资源 VO")
@Data
public class ResourceVO {
@ApiModelProperty(value = "资源编号", required = true, example = "1")
@NotNull(message = "资源编号不能为空")
private Integer id;
@ApiModelProperty(value = "菜单名", required = true, example = "商品管理")
@NotEmpty(message = "菜单名不能为空")
private String name;
@ApiModelProperty(value = "权限标识", example = "resource:add")
private String permission;
@ApiModelProperty(value = "资源类型", required = true, example = "1")
@NotNull(message = "资源类型不能为空")
@InEnum(value = ResourceTypeEnum.class, message = "资源类型必须是 {value}")
private Integer type;
@ApiModelProperty(value = "排序", required = true, example = "1")
@NotNull(message = "排序不能为空")
private Integer sort;
@ApiModelProperty(value = "父级资源编号", required = true, example = "1", notes = "如果无父资源,则值为 0")
@NotNull(message = "父级资源编号不能为空")
private Integer pid;
@ApiModelProperty(value = "前端路由", example = "/resource/list")
private String route;
@ApiModelProperty(value = "菜单图标", example = "add")
private String icon;
@ApiModelProperty(value = "前端界面", example = "@/views/example/edit")
private String view;
@ApiModelProperty(value = "添加时间", required = true)
private Date createTime;
}

View File

@@ -0,0 +1,26 @@
package cn.iocoder.mall.managementweb.controller.permission.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@ApiModel("角色 VO")
@Data
public class RoleVO {
@ApiModelProperty(value = "角色编号", required = true, example = "1")
private Integer id;
@ApiModelProperty(value = "角色名", required = true, example = "管理员")
private String name;
@ApiModelProperty(value = "角色编码", example = "ADMIN")
private String code;
@ApiModelProperty(value = "角色类型", required = true, example = "1", notes = "见 RoleTypeEnum 枚举")
private Integer type;
@ApiModelProperty(value = "创建管理员编号", required = true, example = "1")
private Integer createAdminId;
@ApiModelProperty(value = "创建时间", required = true)
private Date createTime;
}

View File

@@ -0,0 +1,21 @@
### /product-attr/page 成功(全部)
GET http://127.0.0.1:18083/management-api/product-attr/key/page?pageNo=1&pageSize=10
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
###
POST http://127.0.0.1:18083/management-api/product-attr/key/create
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
name=桶&status=1
###
POST http://127.0.0.1:18083/management-api/product-attr/value/create
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
attrKeyId=12&name=大桶&status=1
###

View File

@@ -0,0 +1,100 @@
package cn.iocoder.mall.managementweb.controller.product;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.common.framework.vo.PageResult;
import cn.iocoder.mall.managementweb.controller.product.vo.attr.*;
import cn.iocoder.mall.managementweb.manager.product.ProductAttrKeyManager;
import cn.iocoder.security.annotations.RequiresPermissions;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
import static cn.iocoder.common.framework.vo.CommonResult.success;
/**
* 商品规格键 Controller
*/
@RestController
@RequestMapping("/product-attr/")
@Api(tags = "商品规格")
@Validated
public class ProductAttrController {
@Autowired
private ProductAttrKeyManager productAttrKeyManager;
@PostMapping("/key/create")
@ApiOperation("创建商品规格键")
@RequiresPermissions("product:attr-key:create")
public CommonResult<Integer> createProductAttrKey(@Valid ProductAttrKeyCreateReqVO createVO) {
return success(productAttrKeyManager.createProductAttrKey(createVO));
}
@PostMapping("/key/update")
@ApiOperation("更新商品规格键")
@RequiresPermissions("product:attr-key:update")
public CommonResult<Boolean> updateProductAttrKey(@Valid ProductAttrKeyUpdateReqVO updateVO) {
productAttrKeyManager.updateProductAttrKey(updateVO);
return success(true);
}
@GetMapping("/key/get")
@ApiOperation("获得商品规格键")
@ApiImplicitParam(name = "productAttrKeyId", value = "商品规格键编号", required = true, example = "1")
@RequiresPermissions("product:attr-key:page")
public CommonResult<ProductAttrKeyRespVO> getProductAttrKey(@RequestParam("productAttrKeyId") Integer productAttrKeyId) {
return success(productAttrKeyManager.getProductAttrKey(productAttrKeyId));
}
@GetMapping("/key/list")
@ApiOperation("获得商品规格键列表")
@ApiImplicitParam(name = "productAttrKeyIds", value = "商品规格键编号列表", required = true, example = "1,3")
@RequiresPermissions("product:attr-key:page")
public CommonResult<List<ProductAttrKeyRespVO>> listProductAttrKeys(@RequestParam("productAttrKeyIds") List<Integer> productAttrKeyIds) {
return success(productAttrKeyManager.listProductAttrKeys(productAttrKeyIds));
}
@GetMapping("/key/page")
@ApiOperation("获得商品规格键分页")
@RequiresPermissions("product:attr-key:page")
public CommonResult<PageResult<ProductAttrKeyRespVO>> pageProductAttrKey(ProductAttrKeyPageReqVO pageVO) {
return success(productAttrKeyManager.pageProductAttrKey(pageVO));
}
@PostMapping("/value/create")
@ApiOperation("创建商品规格值")
@RequiresPermissions("product:attr-value:create")
public CommonResult<Integer> createProductAttrValue(@Valid ProductAttrValueCreateReqVO createVO) {
return success(productAttrKeyManager.createProductAttrValue(createVO));
}
@PostMapping("/value/update")
@ApiOperation("更新商品规格值")
@RequiresPermissions("product:attr-value:update")
public CommonResult<Boolean> updateProductAttrValue(@Valid ProductAttrValueUpdateReqVO updateVO) {
productAttrKeyManager.updateProductAttrValue(updateVO);
return success(true);
}
@GetMapping("/value/get")
@ApiOperation("获得商品规格值")
@ApiImplicitParam(name = "productAttrValueId", value = "商品规格值编号", required = true)
@RequiresPermissions("product:attr-value:list")
public CommonResult<ProductAttrValueRespVO> getProductAttrValue(@RequestParam("productAttrValueId") Integer productAttrValueId) {
return success(productAttrKeyManager.getProductAttrValue(productAttrValueId));
}
@GetMapping("/value/list")
@ApiOperation("获得商品规格值列表")
@RequiresPermissions("product:attr-value:list")
public CommonResult<List<ProductAttrValueRespVO>> listProductAttrValues(@Valid ProductAttrValueListQueryReqVO queryReqVO) {
return success(productAttrKeyManager.listProductAttrValues(queryReqVO));
}
}

View File

@@ -0,0 +1,20 @@
### /product-attr/page 成功(全部)
GET http://127.0.0.1:18083/management-api/product-attr/key/page?pageNo=1&pageSize=10
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
###
POST http://127.0.0.1:18083/management-api/product-brand/create
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
name=光明牌&description=光明牌电灯泡&status=1
###
GET http://127.0.0.1:18083/management-api/product-brand/get?productBrandId=3
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
###

View File

@@ -0,0 +1,82 @@
package cn.iocoder.mall.managementweb.controller.product;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.common.framework.vo.PageResult;
import cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandCreateReqVO;
import cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandPageReqVO;
import cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandRespVO;
import cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandUpdateReqVO;
import cn.iocoder.mall.managementweb.manager.product.ProductBrandManager;
import cn.iocoder.security.annotations.RequiresPermissions;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
import static cn.iocoder.common.framework.vo.CommonResult.success;
/**
* 商品品牌 Controller
*/
@RestController
@RequestMapping("/product-brand")
@Api(tags = "商品品牌")
@Validated
public class ProductBrandController {
@Autowired
private ProductBrandManager productBrandManager;
@PostMapping("/create")
@ApiOperation("创建商品品牌")
@RequiresPermissions("product:brand:create")
public CommonResult<Integer> createProductBrand(@Valid ProductBrandCreateReqVO createVO) {
return success(productBrandManager.createProductBrand(createVO));
}
@PostMapping("/update")
@ApiOperation("更新商品品牌")
@RequiresPermissions("product:brand:update")
public CommonResult<Boolean> updateProductBrand(@Valid ProductBrandUpdateReqVO updateVO) {
productBrandManager.updateProductBrand(updateVO);
return success(true);
}
@PostMapping("/delete")
@ApiOperation("删除商品品牌")
@ApiImplicitParam(name = "productBrandId", value = "商品品牌编号", required = true)
@RequiresPermissions("product:brand:delete")
public CommonResult<Boolean> deleteProductBrand(@RequestParam("productBrandId") Integer productBrandId) {
productBrandManager.deleteProductBrand(productBrandId);
return success(true);
}
@GetMapping("/get")
@ApiOperation("获得商品品牌")
@ApiImplicitParam(name = "productBrandId", value = "商品品牌编号", required = true)
@RequiresPermissions("product:brand:page")
public CommonResult<ProductBrandRespVO> getProductBrand(@RequestParam("productBrandId") Integer productBrandId) {
return success(productBrandManager.getProductBrand(productBrandId));
}
@GetMapping("/list")
@ApiOperation("获得商品品牌列表")
@ApiImplicitParam(name = "productBrandIds", value = "商品品牌编号列表", required = true)
@RequiresPermissions("product:brand:page")
public CommonResult<List<ProductBrandRespVO>> listProductBrands(@RequestParam("productBrandIds") List<Integer> productBrandIds) {
return success(productBrandManager.listProductBrands(productBrandIds));
}
@GetMapping("/page")
@ApiOperation("获得商品品牌分页")
@RequiresPermissions("product:brand:page")
public CommonResult<PageResult<ProductBrandRespVO>> pageProductBrand(ProductBrandPageReqVO pageVO) {
return success(productBrandManager.pageProductBrand(pageVO));
}
}

View File

@@ -0,0 +1,15 @@
### /product-category/tree 成功
GET http://127.0.0.1:18083/management-api/product-category/tree
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
###
POST http://127.0.0.1:18083/management-api/product-category/create
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
pid=0&name=美食&description=吃喝拉撒&sort=7&status=1
###

View File

@@ -0,0 +1,64 @@
package cn.iocoder.mall.managementweb.controller.product;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.managementweb.controller.product.vo.category.ProductCategoryCreateReqVO;
import cn.iocoder.mall.managementweb.controller.product.vo.category.ProductCategoryTreeNodeRespVO;
import cn.iocoder.mall.managementweb.controller.product.vo.category.ProductCategoryUpdateReqVO;
import cn.iocoder.mall.managementweb.manager.product.ProductCategoryManager;
import cn.iocoder.security.annotations.RequiresPermissions;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
import static cn.iocoder.common.framework.vo.CommonResult.success;
/**
* 商品分类 Controller
*/
@RestController
@RequestMapping("/product-category")
@Api(tags = "商品分类")
@Validated
public class ProductCategoryController {
@Autowired
private ProductCategoryManager productCategoryManager;
@PostMapping("/create")
@ApiOperation("创建商品分类")
@RequiresPermissions("product:category:create")
public CommonResult<Integer> createProductCategory(@Valid ProductCategoryCreateReqVO createVO) {
return success(productCategoryManager.createProductCategory(createVO));
}
@PostMapping("/update")
@ApiOperation("更新商品分类")
@RequiresPermissions("product:category:update")
public CommonResult<Boolean> updateProductCategory(@Valid ProductCategoryUpdateReqVO updateVO) {
productCategoryManager.updateProductCategory(updateVO);
return success(true);
}
@PostMapping("/delete")
@ApiOperation("删除商品分类")
@RequiresPermissions("product:category:delete")
@ApiImplicitParam(name = "productCategoryId", value = "商品分类编号", required = true)
public CommonResult<Boolean> deleteProductCategory(@RequestParam("productCategoryId") Integer productCategoryId) {
productCategoryManager.deleteProductCategory(productCategoryId);
return success(true);
}
@GetMapping("/tree")
@ApiOperation("获得资源树")
@RequiresPermissions("product:category:tree")
public CommonResult<List<ProductCategoryTreeNodeRespVO>> treeProductCategory() {
return success(productCategoryManager.treeProductCategory());
}
}

View File

@@ -0,0 +1,65 @@
### /product-spu/page 成功(全部)
GET http://127.0.0.1:18083/management-api/product-spu/page?pageNo=1&pageSize=100
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
### /product-spu/page 成功(有库存 + 上架)
GET http://127.0.0.1:18083/management-api/product-spu/page?pageNo=1&pageSize=10&hasQuantity=true&visible=true
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
### /product-spu/page 成功(无库存 + 下架)
GET http://127.0.0.1:18083/management-api/product-spu/page?pageNo=1&pageSize=10&hasQuantity=false&visible=false
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
### /product-spu/create 成功
POST http://127.0.0.1:18083/management-api/product-spu/create
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
name=新商品&description=新商品描述&cid=637&sellPoint=丑&picUrls=1,2,3&visible=true
&skus[0].price=1&skus[0].quantity=100&skus[0].attrValueIds=1,3
&skus[1].price=2&skus[1].quantity=50&skus[1].attrValueIds=2,4
### /product-spu/create 失败(规格不存在)
POST http://127.0.0.1:18083/management-api/product-spu/create
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
name=测试商品标题&description=测试商品描述&cid=637&sellPoint=丑&picUrls=1,2,3&visible=true
&skus[0].price=1&skus[0].quantity=100&skus[0].attrValueIds=1,0
### /product-spu/create 失败(规格数量不匹配)
POST http://127.0.0.1:18083/management-api/product-spu/create
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
name=测试商品标题&description=测试商品描述&cid=637&sellPoint=丑&picUrls=1,2,3&visible=true
&skus[0].price=1&skus[0].quantity=100&skus[0].attrValueIds=1,3
&skus[1].price=2&skus[1].quantity=50&skus[1].attrValueIds=1,2,4
### /product-spu/update 成功
POST http://127.0.0.1:18083/management-api/product-spu/update
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
id=64&name=新商品测试&description=新商品测试&cid=637&sellPoint=丑&picUrls=1,2,3&visible=true
&skus[0].price=1&skus[0].quantity=100&skus[0].attrValueIds=1,3
&skus[1].price=2&skus[1].quantity=50&skus[1].attrValueIds=2,4
###
### /product-spu/get
GET http://127.0.0.1:18083/management-api/product-spu/get?productSpuId=32
Content-Type: application/x-www-form-urlencoded
Authorization:Bearer yudaoyuanma
###
### /product-spu/get
GET http://127.0.0.1:18083/management-api/product-spu/list?productSpuIds=32,33,34
Content-Type: application/x-www-form-urlencoded
Authorization:Bearer yudaoyuanma
###

View File

@@ -0,0 +1,74 @@
package cn.iocoder.mall.managementweb.controller.product;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.common.framework.vo.PageResult;
import cn.iocoder.mall.managementweb.controller.product.vo.spu.ProductSpuCreateReqVO;
import cn.iocoder.mall.managementweb.controller.product.vo.spu.ProductSpuPageReqVO;
import cn.iocoder.mall.managementweb.controller.product.vo.spu.ProductSpuRespVO;
import cn.iocoder.mall.managementweb.controller.product.vo.spu.ProductSpuUpdateReqVO;
import cn.iocoder.mall.managementweb.manager.product.ProductSpuManager;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
import static cn.iocoder.common.framework.vo.CommonResult.success;
/**
* 商品 SPU Controller
*/
@RestController
@RequestMapping("/product-spu")
@Api(tags = "商品 SPU")
@Validated
public class ProductSpuController {
@Autowired
private ProductSpuManager productSpuManager;
@PostMapping("/create")
@ApiOperation("创建商品 SPU")
public CommonResult<Integer> createProductSpu(@Valid ProductSpuCreateReqVO createVO) {
return success(productSpuManager.createProductSpu(createVO));
}
@PostMapping("/update")
@ApiOperation("更新商品 SPU")
public CommonResult<Boolean> updateProductSpu(@Valid ProductSpuUpdateReqVO updateVO) {
productSpuManager.updateProductSpu(updateVO);
return success(true);
}
@GetMapping("/get")
@ApiOperation("获得商品 SPU")
@ApiImplicitParam(name = "productSpuId", value = "商品 SPU 编号", required = true)
public CommonResult<ProductSpuRespVO> getProductSpu(@RequestParam("productSpuId") Integer productSpuId) {
return success(productSpuManager.getProductSpu(productSpuId));
}
@GetMapping("/list")
@ApiOperation("获得商品 SPU 列表")
@ApiImplicitParam(name = "productSpuIds", value = "商品 SPU 编号列表", required = true)
public CommonResult<List<ProductSpuRespVO>> listProductSpus(@RequestParam("productSpuIds") List<Integer> productSpuIds) {
return success(productSpuManager.listProductSpus(productSpuIds));
}
@GetMapping("/page")
@ApiOperation("获得商品 SPU 分页")
public CommonResult<PageResult<ProductSpuRespVO>> pageProductSpu(ProductSpuPageReqVO pageVO) {
// 全部:无搜索条件
// 在售中visible = true && hasQuantity = true
// 已售罄visible = true && hasQuantity = false
// 仓库中visible = false
return success(productSpuManager.pageProductSpu(pageVO));
}
// TODO 芋艿,删除功能暂时不做。主要原因是,关联的数据太多。删除带来的问题会比较大
}

View File

@@ -0,0 +1,24 @@
package cn.iocoder.mall.managementweb.controller.product.vo.attr;
import cn.iocoder.common.framework.enums.CommonStatusEnum;
import cn.iocoder.common.framework.validator.InEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
@ApiModel("商品规格键创建 Request VO")
@Data
public class ProductAttrKeyCreateReqVO {
@ApiModelProperty(value = "规格键名称", required = true, example = "尺寸")
@NotEmpty(message = "规格键名称不能为空")
private String name;
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举")
@NotNull(message = "状态不能为空")
@InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")
private Integer status;
}

View File

@@ -0,0 +1,22 @@
package cn.iocoder.mall.managementweb.controller.product.vo.attr;
import cn.iocoder.common.framework.enums.CommonStatusEnum;
import cn.iocoder.common.framework.validator.InEnum;
import cn.iocoder.common.framework.vo.PageParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ApiModel("商品规格键分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
public class ProductAttrKeyPageReqVO extends PageParam {
@ApiModelProperty(value = "规格键名称", required = true, example = "尺寸", notes = "模糊匹配")
private String name;
@ApiModelProperty(value = "状态", example = "1", notes = "见 CommonStatusEnum 枚举")
@InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")
private Integer status;
}

View File

@@ -0,0 +1,20 @@
package cn.iocoder.mall.managementweb.controller.product.vo.attr;
import lombok.*;
import io.swagger.annotations.*;
import java.util.*;
@ApiModel("商品规格键 Response VO")
@Data
public class ProductAttrKeyRespVO {
@ApiModelProperty(value = "规格键编号", required = true, example = "1")
private Integer id;
@ApiModelProperty(value = "规格键名称", required = true, example = "尺寸")
private String name;
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举")
private Integer status;
@ApiModelProperty(value = "创建时间", required = true)
private Date createTime;
}

View File

@@ -0,0 +1,27 @@
package cn.iocoder.mall.managementweb.controller.product.vo.attr;
import cn.iocoder.common.framework.enums.CommonStatusEnum;
import cn.iocoder.common.framework.validator.InEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
@ApiModel("商品规格键更新 Request VO")
@Data
public class ProductAttrKeyUpdateReqVO {
@ApiModelProperty(value = "规格键编号", required = true, example = "1")
@NotNull(message = "规格键编号不能为空")
private Integer id;
@ApiModelProperty(value = "规格键名称", required = true, example = "尺寸")
@NotEmpty(message = "规格键名称不能为空")
private String name;
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举")
@NotNull(message = "状态不能为空")
@InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")
private Integer status;
}

View File

@@ -0,0 +1,28 @@
package cn.iocoder.mall.managementweb.controller.product.vo.attr;
import cn.iocoder.common.framework.enums.CommonStatusEnum;
import cn.iocoder.common.framework.validator.InEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
@ApiModel("商品规格值创建 Request VO")
@Data
public class ProductAttrValueCreateReqVO {
@ApiModelProperty(value = "规格键编号", required = true, example = "2")
@NotNull(message = "规格键编号不能为空")
private Integer attrKeyId;
@ApiModelProperty(value = "规格值名字", required = true, example = "XXL")
@NotEmpty(message = "规格值名字不能为空")
private String name;
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举")
@NotNull(message = "状态不能为空")
@InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")
private Integer status;
}

View File

@@ -0,0 +1,21 @@
package cn.iocoder.mall.managementweb.controller.product.vo.attr;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.List;
@ApiModel("商品规格值的列表查询条件 Request VO")
@Data
@Accessors(chain = true)
public class ProductAttrValueListQueryReqVO {
@ApiModelProperty(value = "商品规格值编号列表", example = "1, 3")
private List<Integer> productAttrValueIds;
@ApiModelProperty(value = "规格键编号", required = true, example = "2")
private Integer productAttrKeyId;
}

View File

@@ -0,0 +1,22 @@
package cn.iocoder.mall.managementweb.controller.product.vo.attr;
import lombok.*;
import io.swagger.annotations.*;
import java.util.*;
@ApiModel("商品规格值 Response VO")
@Data
public class ProductAttrValueRespVO {
@ApiModelProperty(value = "规格值编号", required = true, example = "1")
private Integer id;
@ApiModelProperty(value = "规格键编号", required = true, example = "2")
private Integer attrKeyId;
@ApiModelProperty(value = "规格值名字", required = true, example = "XXL")
private String name;
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举")
private Integer status;
@ApiModelProperty(value = "创建时间", required = true)
private Date createTime;
}

View File

@@ -0,0 +1,28 @@
package cn.iocoder.mall.managementweb.controller.product.vo.attr;
import cn.iocoder.common.framework.enums.CommonStatusEnum;
import cn.iocoder.common.framework.validator.InEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
@ApiModel("商品规格值更新 Request VO")
@Data
public class ProductAttrValueUpdateReqVO {
@ApiModelProperty(value = "规格值编号", required = true, example = "1")
@NotNull(message = "规格值编号不能为空")
private Integer id;
@ApiModelProperty(value = "规格值名字", required = true, example = "XXL")
@NotEmpty(message = "规格值名字不能为空")
private String name;
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举")
@NotNull(message = "状态不能为空")
@InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")
private Integer status;
}

View File

@@ -0,0 +1,20 @@
package cn.iocoder.mall.managementweb.controller.product.vo.brand;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel("商品品牌创建 Request VO")
@Data
public class ProductBrandCreateReqVO {
@ApiModelProperty(value = "品牌名称", required = true, example = "这个商品品牌很吊")
private String name;
@ApiModelProperty(value = "品牌描述", example = "这个商品描述很吊")
private String description;
@ApiModelProperty(value = "品牌名图片", example = "http://www.iocoder.cn/xx.jpg")
private String picUrl;
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举")
private Integer status;
}

View File

@@ -0,0 +1,19 @@
package cn.iocoder.mall.managementweb.controller.product.vo.brand;
import cn.iocoder.common.framework.vo.PageParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ApiModel("商品品牌分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
public class ProductBrandPageReqVO extends PageParam {
@ApiModelProperty(value = "品牌名称", required = true, notes = "模糊匹配", example = "这个商品品牌很吊")
private String name;
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举")
private Integer status;
}

View File

@@ -0,0 +1,24 @@
package cn.iocoder.mall.managementweb.controller.product.vo.brand;
import lombok.*;
import io.swagger.annotations.*;
import java.util.*;
@ApiModel("商品品牌 Response VO")
@Data
public class ProductBrandRespVO {
@ApiModelProperty(value = "品牌编号", required = true, example = "1024")
private Integer id;
@ApiModelProperty(value = "品牌名称", required = true, example = "这个商品品牌很吊")
private String name;
@ApiModelProperty(value = "品牌描述", example = "这个商品描述很吊")
private String description;
@ApiModelProperty(value = "品牌名图片", example = "http://www.iocoder.cn/xx.jpg")
private String picUrl;
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举")
private Integer status;
@ApiModelProperty(value = "创建时间", required = true)
private Date createTime;
}

View File

@@ -0,0 +1,22 @@
package cn.iocoder.mall.managementweb.controller.product.vo.brand;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel("商品品牌更新 Request VO")
@Data
public class ProductBrandUpdateReqVO {
@ApiModelProperty(value = "品牌编号", required = true, example = "1024")
private Integer id;
@ApiModelProperty(value = "品牌名称", required = true, example = "这个商品品牌很吊")
private String name;
@ApiModelProperty(value = "品牌描述", example = "这个商品描述很吊")
private String description;
@ApiModelProperty(value = "品牌名图片", example = "http://www.iocoder.cn/xx.jpg")
private String picUrl;
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举")
private Integer status;
}

View File

@@ -0,0 +1,34 @@
package cn.iocoder.mall.managementweb.controller.product.vo.category;
import cn.iocoder.common.framework.enums.CommonStatusEnum;
import cn.iocoder.common.framework.validator.InEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
@ApiModel("商品分类创建 Request VO")
@Data
public class ProductCategoryCreateReqVO {
@ApiModelProperty(value = "父分类编号", required = true, example = "0")
@NotNull(message = "父分类编号不能为空")
private Integer pid;
@ApiModelProperty(value = "分类名称", required = true, example = "手机")
@NotEmpty(message = "分类名称不能为空")
private String name;
@ApiModelProperty(value = "分类描述", required = true, example = "这个商品很吊")
private String description;
@ApiModelProperty(value = "分类图片", notes = "一般情况下,只有根分类才有图片", example = "http://www.iocoder.cn/xx.jpg")
private String picUrl;
@ApiModelProperty(value = "分类排序", required = true, example = "10")
@NotNull(message = "分类排序不能为空")
private Integer sort;
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举")
@NotNull(message = "状态不能为空")
@InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")
private Integer status;
}

View File

@@ -0,0 +1,30 @@
package cn.iocoder.mall.managementweb.controller.product.vo.category;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@ApiModel("商品分类 Response VO")
@Data
public class ProductCategoryRespVO {
@ApiModelProperty(value = "分类编号", required = true, example = "1")
private Integer id;
@ApiModelProperty(value = "父分类编号", required = true, example = "0")
private Integer pid;
@ApiModelProperty(value = "分类名称", required = true, example = "手机")
private String name;
@ApiModelProperty(value = "分类描述", required = true, example = "这个商品分类很吊")
private String description;
@ApiModelProperty(value = "分类图片", notes = "一般情况下,只有根分类才有图片", example = "http://www.iocoder.cn/xx.jpg")
private String picUrl;
@ApiModelProperty(value = "分类排序", required = true, example = "10")
private Integer sort;
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举")
private Integer status;
@ApiModelProperty(value = "创建时间", required = true)
private Date createTime;
}

View File

@@ -0,0 +1,36 @@
package cn.iocoder.mall.managementweb.controller.product.vo.category;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
@ApiModel("商品分类 Response VO")
@Data
public class ProductCategoryTreeNodeRespVO {
@ApiModelProperty(value = "分类编号", required = true, example = "1")
private Integer id;
@ApiModelProperty(value = "父分类编号", required = true, example = "0")
private Integer pid;
@ApiModelProperty(value = "分类名称", required = true, example = "手机")
private String name;
@ApiModelProperty(value = "分类描述", required = true, example = "这个商品很吊")
private String description;
@ApiModelProperty(value = "分类图片", notes = "一般情况下,只有根分类才有图片", example = "http://www.iocoder.cn/xx.jpg")
private String picUrl;
@ApiModelProperty(value = "分类排序", required = true, example = "10")
private Integer sort;
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举")
private Integer status;
@ApiModelProperty(value = "创建时间", required = true)
private Date createTime;
/**
* 子节点
*/
private List<ProductCategoryTreeNodeRespVO> children;
}

View File

@@ -0,0 +1,37 @@
package cn.iocoder.mall.managementweb.controller.product.vo.category;
import cn.iocoder.common.framework.enums.CommonStatusEnum;
import cn.iocoder.common.framework.validator.InEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
@ApiModel("商品分类更新 Request VO")
@Data
public class ProductCategoryUpdateReqVO {
@ApiModelProperty(value = "分类编号", required = true, example = "1")
@NotNull(message = "分类编号不能为空")
private Integer id;
@ApiModelProperty(value = "父分类编号", required = true, example = "0")
@NotNull(message = "父分类编号不能为空")
private Integer pid;
@ApiModelProperty(value = "分类名称", required = true, example = "手机")
@NotEmpty(message = "分类名称不能为空")
private String name;
@ApiModelProperty(value = "分类描述", required = true, example = "这个商品很吊")
private String description;
@ApiModelProperty(value = "分类图片", notes = "一般情况下,只有根分类才有图片", example = "http://www.iocoder.cn/xx.jpg")
private String picUrl;
@ApiModelProperty(value = "分类排序", required = true, example = "10")
@NotNull(message = "分类排序不能为空")
private Integer sort;
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举")
@NotNull(message = "状态不能为空")
@InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")
private Integer status;
}

View File

@@ -0,0 +1,73 @@
package cn.iocoder.mall.managementweb.controller.product.vo.spu;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.Valid;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;
@ApiModel("商品 SPU 创建 Request VO")
@Data
public class ProductSpuCreateReqVO {
/**
* SKU 信息
*/
@Data
@Accessors(chain = true)
public static class Sku {
/**
* 规格值数组
*/
@NotNull(message = "规格值数组不能为空")
private List<Integer> attrValueIds;
/**
* 价格,单位:分
*/
@NotNull(message = "价格不能为空")
@Min(value = 1L, message = "最小价格为 1")
private Integer price;
/**
* 库存数量
*/
@NotNull(message = "库存数量不能为空")
@Min(value = 1L, message = "最小库存为 1")
private Integer quantity;
}
@ApiModelProperty(value = "SPU 名字", required = true, example = "芋艿")
@NotEmpty(message = "SPU 名字不能为空")
private String name;
@ApiModelProperty(value = "卖点", required = true, example = "好吃好玩")
@NotEmpty(message = "卖点不能为空")
private String sellPoint;
@ApiModelProperty(value = "描述", required = true, example = "我是哈哈哈")
@NotEmpty(message = "描述不能为空")
private String description;
@ApiModelProperty(value = "分类编号", required = true, example = "1")
@NotNull(message = "分类编号不能为空")
private Integer cid;
@ApiModelProperty(value = "商品主图地址", required = true, example = "http://www.iocoder.cn/xxx.jpg", notes = "多个之间,使用逗号分隔")
@NotEmpty(message = "商品主图地址不能为空")
private List<String> picUrls;
@ApiModelProperty(value = "是否上架商品", required = true, example = "true")
@NotNull(message = "是否上架商品不能为空")
private Boolean visible;
// ========== SKU =========
/**
* SKU 数组
*/
@NotNull(message = "SKU 不能为空")
@Valid
private List<Sku> skus;
}

View File

@@ -0,0 +1,23 @@
package cn.iocoder.mall.managementweb.controller.product.vo.spu;
import cn.iocoder.common.framework.vo.PageParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ApiModel("商品 SPU分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
public class ProductSpuPageReqVO extends PageParam {
@ApiModelProperty(value = "SPU 名字", notes = "模糊匹配", example = "艿艿")
private String name;
@ApiModelProperty(value = "分类编号", example = "1024")
private Integer cid;
@ApiModelProperty(value = "是否上架商品", example = "true")
private Boolean visible;
@ApiModelProperty(value = "是否有库存", example = "true")
private Boolean hasQuantity;
}

View File

@@ -0,0 +1,34 @@
package cn.iocoder.mall.managementweb.controller.product.vo.spu;
import lombok.*;
import io.swagger.annotations.*;
import java.util.*;
@ApiModel("商品 SPU Response VO")
@Data
public class ProductSpuRespVO {
@ApiModelProperty(value = "SPU 编号", required = true)
private Integer id;
@ApiModelProperty(value = "SPU 名字", required = true, example = "芋艿")
private String name;
@ApiModelProperty(value = "卖点", required = true, example = "好吃好玩")
private String sellPoint;
@ApiModelProperty(value = "描述", required = true, example = "我是哈哈哈")
private String description;
@ApiModelProperty(value = "分类编号", required = true, example = "1")
private Integer cid;
@ApiModelProperty(value = "商品主图地址", required = true, example = "http://www.iocoder.cn/xxx.jpg", notes = "多个之间,使用逗号分隔")
private List<String> picUrls;
@ApiModelProperty(value = "是否上架商品", required = true, example = "true")
private Boolean visible;
@ApiModelProperty(value = "排序字段", required = true, example = "1024")
private Integer sort;
@ApiModelProperty(value = "价格", required = true, example = "233", notes = "单位:分")
private Integer price;
@ApiModelProperty(value = "库存数量", required = true, example = "1024")
private Integer quantity;
@ApiModelProperty(value = "创建时间", required = true)
private Date createTime;
}

View File

@@ -0,0 +1,77 @@
package cn.iocoder.mall.managementweb.controller.product.vo.spu;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.Valid;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;
@ApiModel("商品 SPU 更新 Request VO")
@Data
public class ProductSpuUpdateReqVO {
/**
* SKU 信息
*/
@Data
@Accessors(chain = true)
public static class Sku {
/**
* 规格值数组
*/
@NotNull(message = "规格值数组不能为空")
private List<Integer> attrValueIds;
/**
* 价格,单位:分
*/
@NotNull(message = "价格不能为空")
@Min(value = 1L, message = "最小价格为 1")
private Integer price;
/**
* 库存数量
*/
@NotNull(message = "库存数量不能为空")
@Min(value = 1L, message = "最小库存为 1")
private Integer quantity;
}
@ApiModelProperty(value = "SPU 编号", required = true)
@NotNull(message = "SPU 编号不能为空")
private Integer id;
@ApiModelProperty(value = "SPU 名字", required = true, example = "芋艿")
@NotEmpty(message = "SPU 名字不能为空")
private String name;
@ApiModelProperty(value = "卖点", required = true, example = "好吃好玩")
@NotEmpty(message = "卖点不能为空")
private String sellPoint;
@ApiModelProperty(value = "描述", required = true, example = "我是哈哈哈")
@NotEmpty(message = "描述不能为空")
private String description;
@ApiModelProperty(value = "分类编号", required = true, example = "1")
@NotNull(message = "分类编号不能为空")
private Integer cid;
@ApiModelProperty(value = "商品主图地址", required = true, example = "http://www.iocoder.cn/xxx.jpg", notes = "多个之间,使用逗号分隔")
@NotEmpty(message = "商品主图地址不能为空")
private List<String> picUrls;
@ApiModelProperty(value = "是否上架商品", required = true, example = "true")
@NotNull(message = "是否上架商品不能为空")
private Boolean visible;
// ========== SKU =========
/**
* SKU 数组
*/
@NotNull(message = "SKU 不能为空")
@Valid
private List<ProductSpuCreateReqVO.Sku> skus;
}

View File

@@ -0,0 +1,36 @@
package cn.iocoder.mall.managementweb.controller.promotion.activity;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.common.framework.vo.PageResult;
import cn.iocoder.mall.managementweb.controller.promotion.activity.vo.PromotionActivityPageReqVO;
import cn.iocoder.mall.managementweb.manager.promotion.activity.PromotionActivityManager;
import cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityRespDTO;
import cn.iocoder.security.annotations.RequiresPermissions;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import static cn.iocoder.common.framework.vo.CommonResult.success;
@RestController
@RequestMapping("/promotion/activity")
@Api(tags = "促销活动 API")
@Validated
public class PromotionActivityController {
@Autowired
private PromotionActivityManager promotionActivityManager;
// TODO 芋艿DTO => VO
@GetMapping("/page")
@ApiOperation("获得促销活动分页")
@RequiresPermissions("promotion:activity:page")
public CommonResult<PageResult<PromotionActivityRespDTO>> pagePromotionActivity(PromotionActivityPageReqVO pageReqVO) {
return success(promotionActivityManager.pagePromotionActivity(pageReqVO));
}
}

View File

@@ -0,0 +1,26 @@
package cn.iocoder.mall.managementweb.controller.promotion.activity.vo;
import cn.iocoder.common.framework.vo.PageParam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Collection;
/**
* 促销活动分页 Request DTO
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
public class PromotionActivityPageReqVO extends PageParam {
@ApiModelProperty(value = "标题", example = "优惠劵牛逼")
private String title;
@ApiModelProperty(value = "活动类型", example = "1", notes = "参见 PromotionActivityTypeEnum 枚举")
private Integer activityType;
@ApiModelProperty(value = "状态数组", example = "1,2", notes = "参考 PromotionActivityStatusEnum 枚举")
private Collection<Integer> statuses;
}

View File

@@ -0,0 +1,65 @@
package cn.iocoder.mall.managementweb.controller.promotion.brand;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.common.framework.vo.PageResult;
import cn.iocoder.mall.managementweb.controller.promotion.brand.vo.BannerCreateReqVO;
import cn.iocoder.mall.managementweb.controller.promotion.brand.vo.BannerPageReqVO;
import cn.iocoder.mall.managementweb.controller.promotion.brand.vo.BannerRespVO;
import cn.iocoder.mall.managementweb.controller.promotion.brand.vo.BannerUpdateReqVO;
import cn.iocoder.mall.managementweb.manager.promotion.brand.BannerManager;
import cn.iocoder.security.annotations.RequiresPermissions;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import static cn.iocoder.common.framework.vo.CommonResult.success;
/**
* Banner Controller
*/
@RestController
@RequestMapping("/promotion/banner")
@Api(tags = "Banner API")
@Validated
public class BannerController {
@Autowired
private BannerManager bannerManager;
@PostMapping("/create")
@ApiOperation("创建 Banner")
@RequiresPermissions("promotion:banner:create")
public CommonResult<Integer> createBanner(@Valid BannerCreateReqVO createVO) {
return success(bannerManager.createBanner(createVO));
}
@PostMapping("/update")
@ApiOperation("更新 Banner")
@RequiresPermissions("promotion:banner:update")
public CommonResult<Boolean> updateBanner(@Valid BannerUpdateReqVO updateVO) {
bannerManager.updateBanner(updateVO);
return success(true);
}
@PostMapping("/delete")
@ApiOperation("删除 Banner")
@ApiImplicitParam(name = "bannerId", value = " Banner 编号", required = true)
@RequiresPermissions("promotion:banner:delete")
public CommonResult<Boolean> deleteBanner(@RequestParam("bannerId") Integer bannerId) {
bannerManager.deleteBanner(bannerId);
return success(true);
}
@GetMapping("/page")
@ApiOperation("获得 Banner 分页")
@RequiresPermissions("promotion:banner:page")
public CommonResult<PageResult<BannerRespVO>> pageBanner(BannerPageReqVO pageVO) {
return success(bannerManager.pageBanner(pageVO));
}
}

View File

@@ -0,0 +1,43 @@
package cn.iocoder.mall.managementweb.controller.promotion.brand.vo;
import cn.iocoder.common.framework.enums.CommonStatusEnum;
import cn.iocoder.common.framework.validator.InEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.URL;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
@ApiModel("Banner 创建 Request VO")
@Data
public class BannerCreateReqVO {
@ApiModelProperty(value = "标题", required = true, example = "活动 A")
@NotEmpty(message = "标题不能为空")
@Length(min = 2, max = 32, message = "标题长度为 2-32 位")
private String title;
@ApiModelProperty(value = "跳转链接", required = true, example = "http://www.baidu.com")
@NotEmpty(message = "跳转链接不能为空")
@URL(message = "跳转链接格式不正确")
@Length(max = 255, message = "跳转链接最大长度为 255 位")
private String url;
@ApiModelProperty(value = "跳转链接", required = true, example = "http://www.iocoder.cn/01.jpg")
@NotEmpty(message = "跳转链接不能为空")
@URL(message = "图片链接格式不正确")
@Length(max = 255, message = "图片链接最大长度为 255 位")
private String picUrl;
@ApiModelProperty(value = "排序", required = true, example = "10")
@NotNull(message = "排序不能为空")
private Integer sort;
@ApiModelProperty(value = "状态", required = true, example = "1")
@NotNull(message = "状态不能为空")
@InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")
private Integer status;
@ApiModelProperty(value = "备注", example = "这个活动很牛逼")
@Length(max = 255, message = "备注最大长度为 255 位")
private String memo;
}

View File

@@ -0,0 +1,17 @@
package cn.iocoder.mall.managementweb.controller.promotion.brand.vo;
import cn.iocoder.common.framework.vo.PageParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ApiModel("Banner 分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
public class BannerPageReqVO extends PageParam {
@ApiModelProperty(value = "标题", required = true, example = "活动 A")
private String title;
}

View File

@@ -0,0 +1,32 @@
package cn.iocoder.mall.managementweb.controller.promotion.brand.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Date;
@ApiModel("Banner VO")
@Data
@Accessors(chain = true)
public class BannerRespVO {
@ApiModelProperty(value = "Banner 编号", required = true, example = "1")
private Integer id;
@ApiModelProperty(value = "标题", required = true, example = "活动 A")
private String title;
@ApiModelProperty(value = "跳转链接", required = true, example = "http://www.baidu.com")
private String url;
@ApiModelProperty(value = "图片链接", required = true, example = "http://www.iocoder.cn/01.jpg")
private String picUrl;
@ApiModelProperty(value = "排序", required = true, example = "10")
private Integer sort;
@ApiModelProperty(value = "状态", required = true, example = "1")
private Integer status;
@ApiModelProperty(value = "备注", example = "这个活动很牛逼")
private String memo;
@ApiModelProperty(value = "创建时间", required = true, example = "时间戳格式")
private Date createTime;
}

View File

@@ -0,0 +1,43 @@
package cn.iocoder.mall.managementweb.controller.promotion.brand.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.URL;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
@ApiModel("Banner 更新 Request VO")
@Data
public class BannerUpdateReqVO {
@ApiModelProperty(value = "Banner 编号", required = true, example = "1")
@NotNull(message = "编号不能为空")
private Integer id;
@ApiModelProperty(value = "标题", required = true, example = "活动 A")
@NotEmpty(message = "标题不能为空")
@Length(min = 2, max = 32, message = "标题长度为 2-32 位")
private String title;
@ApiModelProperty(value = "跳转链接", required = true, example = "http://www.baidu.com")
@NotEmpty(message = "跳转链接不能为空")
@URL(message = "跳转链接格式不正确")
@Length(max = 255, message = "跳转链接最大长度为 255 位")
private String url;
@ApiModelProperty(value = "跳转链接", required = true, example = "http://www.iocoder.cn/01.jpg")
@NotEmpty(message = "跳转链接不能为空")
@URL(message = "图片链接格式不正确")
@Length(max = 255, message = "图片链接最大长度为 255 位")
private String picUrl;
@ApiModelProperty(value = "排序", required = true, example = "10")
@NotNull(message = "排序不能为空")
private Integer sort;
@ApiModelProperty(value = "状态", required = true, example = "1")
@NotNull(message = "状态不能为空")
private Integer status;
@ApiModelProperty(value = "备注", example = "这个活动很牛逼")
@Length(max = 255, message = "备注最大长度为 255 位")
private String memo;
}

View File

@@ -0,0 +1,71 @@
package cn.iocoder.mall.managementweb.controller.promotion.coupon;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.common.framework.vo.PageResult;
import cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.CouponTemplateCardCreateReqVO;
import cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.CouponTemplateCardUpdateReqVO;
import cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.CouponTemplatePageReqVO;
import cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.CouponTemplateRespVO;
import cn.iocoder.mall.managementweb.manager.promotion.coupon.CouponTemplateManager;
import cn.iocoder.security.annotations.RequiresPermissions;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import static cn.iocoder.common.framework.vo.CommonResult.success;
@RestController
@RequestMapping("/promotion/coupon-template")
@Api(tags = "优惠劵(码)模板 API")
@Validated
public class CouponTemplateController {
@Autowired
private CouponTemplateManager couponTemplateManager;
// ========== 通用逻辑 =========
@GetMapping("/page")
@ApiOperation("获得优惠劵模板分页")
@RequiresPermissions("promotion:coupon-template:page")
public CommonResult<PageResult<CouponTemplateRespVO>> pageCouponTemplate(CouponTemplatePageReqVO pageVO) {
return success(couponTemplateManager.pageCouponTemplate(pageVO));
}
@PostMapping("/update-status")
@ApiOperation("更新优惠劵(码)模板的状态")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "优惠劵(码)模板编号", required = true, example = "1"),
@ApiImplicitParam(name = "status", value = "状态。1 - 开启2 - 禁用", required = true, example = "1"),
})
@RequiresPermissions("promotion:coupon-template:update-status")
public CommonResult<Boolean> updateCouponTemplateStatus(@RequestParam("id") Integer id,
@RequestParam("status") Integer status) {
couponTemplateManager.updateCouponTemplateStatus(id, status);
return success(true);
}
// ========== 优惠劵模板 ==========
@PostMapping("/create-card")
@ApiOperation("创建优惠劵模板")
@RequiresPermissions("promotion:coupon-template:create-card")
public CommonResult<Integer> createCouponCardTemplate(@Valid CouponTemplateCardCreateReqVO createVO) {
return success(couponTemplateManager.createCouponCardTemplate(createVO));
}
@PostMapping("/update-card")
@ApiOperation("更新优惠劵模板")
@RequiresPermissions("promotion:coupon-template:update-card")
public CommonResult<Boolean> updateCouponCardTemplate(@Valid CouponTemplateCardUpdateReqVO updateVO) {
couponTemplateManager.updateCouponCardTemplate(updateVO);
return success(true);
}
}

View File

@@ -0,0 +1,84 @@
package cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template;
import cn.iocoder.common.framework.validator.InEnum;
import cn.iocoder.mall.promotion.api.enums.PreferentialTypeEnum;
import cn.iocoder.mall.promotion.api.enums.RangeTypeEnum;
import cn.iocoder.mall.promotion.api.enums.coupon.template.CouponTemplateDateTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Date;
@ApiModel("优惠劵模板创建 Request VO")
@Data
@Accessors(chain = true)
public class CouponTemplateCardCreateReqVO {
// ========== 基本信息 BEGIN ==========
@ApiModelProperty(value = "标题", required = true, example = "优惠劵牛逼")
@NotEmpty(message = "标题不能为空")
@Length(min = 2, max = 16, message = "标题长度为 {min}-{max} 位")
private String title;
@ApiModelProperty(value = "使用说明", required = true, example = "我只是描述")
@Length(max = 255, message = "使用说明最大长度为 {max} 位")
private String description;
@ApiModelProperty(value = "每人限领个数", example = "1", notes = "null - 则表示不限制")
@Min(value = 1, message = "每人限领个数最小为 {value}")
private Integer quota;
@ApiModelProperty(value = "发放总量", example = "100")
@Min(value = 1, message = "每人限领个数最小为 {value}")
private Integer total;
// ========== 领取规则 END ==========
// ========== 使用规则 BEGIN ==========
@ApiModelProperty(value = "是否设置满多少金额可用,单位:分", required = true, example = "0", notes = "0-不限制大于0-多少金额可用")
@Min(value = 0L, message = "使用金额门槛最低为 {value}")
private Integer priceAvailable;
@ApiModelProperty(value = "可用范围的类型", required = true, example = "10", notes = "参见 RangeTypeEnum 枚举")
@NotNull(message = "可用范围的类型不能为空")
@InEnum(value = RangeTypeEnum.class, message = "可用范围的类型必须在 {value}")
private Integer rangeType;
@ApiModelProperty(value = "指定商品 / 分类列表,使用逗号分隔商品编号", example = "1,3,5")
private String rangeValues;
@ApiModelProperty(value = "生效日期类型", example = "1", notes = "参见 CouponTemplateDateTypeEnum 枚举")
@NotNull(message = "生效日期类型不能为空")
@InEnum(value = CouponTemplateDateTypeEnum.class, message = "生效日期类型必须在 {value}")
private Integer dateType;
@ApiModelProperty(value = "固定日期-生效开始时间", notes = "当 dateType 为固定日期时,非空")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date validStartTime;
@ApiModelProperty(value = "固定日期-生效结束时间", notes = "当 dateType 为固定日期时,非空")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date validEndTime;
@ApiModelProperty(value = "领取日期-开始天数", example = "0", notes = "例如0-当天1-次天")
@Min(value = 0L, message = "领取日期开始时间最小为 {value}")
private Integer fixedStartTerm;
@ApiModelProperty(value = "领取日期-结束天数", example = "1", notes = "当 dateType 为领取日期时,非空")
@Min(value = 1L, message = "领取日期结束时间最小为 {value}")
private Integer fixedEndTerm;
// ========== 使用效果 BEGIN ==========
@ApiModelProperty(value = "优惠类型", required = true, example = "1", notes = "参见 PreferentialTypeEnum 枚举")
@NotNull(message = "优惠类型不能为空")
@InEnum(value = PreferentialTypeEnum.class, message = "优惠类型必须在 {value}")
private Integer preferentialType;
@ApiModelProperty(value = "折扣百分比", example = "80", notes = "当 preferentialType 为现金券时,非空")
@Max(value = 100, message = "折扣比最大值为 {value}")
private Integer percentOff;
@ApiModelProperty(value = "优惠金额,单位:分", example = "100", notes = "当 preferentialType 为折扣卷时,非空")
@Min(value = 1, message = "优惠金额最小值为 {value}")
private Integer priceOff;
@ApiModelProperty(value = "折扣上限", example = "100", notes = "当 preferentialType 为折扣卷时,非空")
@Min(value = 1, message = "折扣上限最小值为 {value}")
private Integer discountPriceLimit;
// ========== 使用效果 END ==========
}

View File

@@ -0,0 +1,47 @@
package cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template;
import cn.iocoder.common.framework.validator.InEnum;
import cn.iocoder.mall.promotion.api.enums.RangeTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
@ApiModel("优惠劵模板更新 Request VO")
@Data
@Accessors(chain = true)
public class CouponTemplateCardUpdateReqVO {
// ========== 基本信息 BEGIN ==========
@ApiModelProperty(value = "模板编号,自增唯一", required = true, example = "1")
@NotNull(message = "编号不能为空")
private Integer id;
@ApiModelProperty(value = "标题", required = true, example = "优惠劵牛逼")
@NotEmpty(message = "标题不能为空")
@Length(min = 2, max = 16, message = "标题长度为 {min}-{max} 位")
private String title;
@ApiModelProperty(value = "使用说明", required = true, example = "我只是描述")
@Length(max = 255, message = "使用说明最大长度为 {max} 位")
private String description;
@ApiModelProperty(value = "每人限领个数", example = "1", notes = "null - 则表示不限制")
@Min(value = 1, message = "每人限领个数最小为 {value}")
private Integer quota;
@ApiModelProperty(value = "发放总量", example = "100")
@Min(value = 1, message = "每人限领个数最小为 {value}")
private Integer total;
// ========== 领取规则 END ==========
// ========== 使用规则 BEGIN ==========
@NotNull(message = "可用范围的类型不能为空")
@InEnum(value = RangeTypeEnum.class, message = "可用范围的类型必须在 {value}")
private Integer rangeType;
@ApiModelProperty(value = "指定商品 / 分类列表,使用逗号分隔商品编号", example = "1,3,5")
private String rangeValues;
// ========== 使用规则 END ==========
}

View File

@@ -0,0 +1,23 @@
package cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template;
import cn.iocoder.common.framework.vo.PageParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ApiModel("优惠劵(码)模板分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
public class CouponTemplatePageReqVO extends PageParam {
@ApiModelProperty(value = "类型", example = "1", notes = "参考 CouponTemplateTypeEnum 枚举")
private Integer type;
@ApiModelProperty(value = "标题", example = "优惠劵牛逼")
private String title;
@ApiModelProperty(value = "状态", example = "1", notes = "参考 CouponTemplateStatusEnum 枚举")
private Integer status;
@ApiModelProperty(value = "优惠类型", example = "1", notes = "参见 PreferentialTypeEnum 枚举")
private Integer preferentialType;
}

View File

@@ -0,0 +1,80 @@
package cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Date;
import java.util.List;
@ApiModel("优惠劵(码)模板 VO")
@Data
@Accessors(chain = true)
public class CouponTemplateRespVO {
// ========== 基本信息 BEGIN ==========
@ApiModelProperty(value = "模板编号,自增唯一", required = true, example = "1")
private Integer id;
@ApiModelProperty(value = "标题", required = true, example = "优惠劵牛逼")
private String title;
@ApiModelProperty(value = "使用说明", required = true, example = "我只是描述")
private String description;
@ApiModelProperty(value = "优惠劵类型", required = true, example = "1", notes = "参见 CouponTemplateTypeEnum 枚举")
private Integer type;
/**
* 码类型
*
* 1-一卡一码UNIQUE
* 2-通用码GENERAL
*
* 【优惠码独有】 @see CouponCodeDO
*/
private Integer codeType;
@ApiModelProperty(value = "优惠码状态", required = true, example = "1", notes = "参见 CouponTemplateStatusEnum 枚举")
private Integer status;
@ApiModelProperty(value = "每人限领个数", example = "1", notes = "null - 则表示不限制")
private Integer quota;
@ApiModelProperty(value = "发放总量", example = "100")
private Integer total;
// ========== 领取规则 END ==========
// ========== 使用规则 BEGIN ==========
@ApiModelProperty(value = "是否设置满多少金额可用,单位:分", required = true, example = "0", notes = "0-不限制大于0-多少金额可用")
private Integer priceAvailable;
@ApiModelProperty(value = "可用范围的类型", required = true, example = "10", notes = "参见 RangeTypeEnum 枚举")
private Integer rangeType;
@ApiModelProperty(value = "指定商品 / 分类列表,使用逗号分隔商品编号", example = "1,3,5")
private List<Integer> rangeValues;
@ApiModelProperty(value = "生效日期类型", example = "1", notes = "参见 CouponTemplateDateTypeEnum 枚举")
private Integer dateType;
@ApiModelProperty(value = "固定日期-生效开始时间", notes = "当 dateType 为固定日期时,非空")
private Date validStartTime;
@ApiModelProperty(value = "固定日期-生效结束时间", notes = "当 dateType 为固定日期时,非空")
private Date validEndTime;
@ApiModelProperty(value = "领取日期-开始天数", example = "0", notes = "例如0-当天1-次天")
private Integer fixedStartTerm;
@ApiModelProperty(value = "领取日期-结束天数", example = "1", notes = "当 dateType 为领取日期时,非空")
private Integer fixedEndTerm;
// ========== 使用规则 END ==========
// ========== 使用效果 BEGIN ==========
@ApiModelProperty(value = "优惠类型", required = true, example = "1", notes = "参见 PreferentialTypeEnum 枚举")
private Integer preferentialType;
@ApiModelProperty(value = "折扣百分比", example = "80", notes = "当 preferentialType 为现金券时,非空")
private Integer percentOff;
@ApiModelProperty(value = "优惠金额,单位:分", example = "100", notes = "当 preferentialType 为折扣卷时,非空")
private Integer priceOff;
@ApiModelProperty(value = "折扣上限", example = "100", notes = "当 preferentialType 为折扣卷时,非空")
private Integer discountPriceLimit;
// ========== 使用效果 END ==========
// ========== 统计信息 BEGIN ==========
@ApiModelProperty(value = "领取优惠券的次数", required = true)
private Integer statFetchNum;
// ========== 统计信息 END ==========
@ApiModelProperty(value = "创建时间", required = true)
private Date createTime;
}

View File

@@ -0,0 +1,60 @@
package cn.iocoder.mall.managementweb.controller.promotion.recommend;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.common.framework.vo.PageResult;
import cn.iocoder.mall.managementweb.controller.promotion.recommend.vo.ProductRecommendCreateReqVO;
import cn.iocoder.mall.managementweb.controller.promotion.recommend.vo.ProductRecommendDetailVO;
import cn.iocoder.mall.managementweb.controller.promotion.recommend.vo.ProductRecommendPageReqVO;
import cn.iocoder.mall.managementweb.controller.promotion.recommend.vo.ProductRecommendUpdateReqVO;
import cn.iocoder.mall.managementweb.manager.promotion.recommend.ProductRecommendManager;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import static cn.iocoder.common.framework.vo.CommonResult.success;
/**
* 商品推荐 Controller
*/
@RestController
@RequestMapping("/promotion/product-recommend")
@Api(tags = "商品推荐")
@Validated
public class ProductRecommendController {
@Autowired
private ProductRecommendManager productRecommendManager;
@PostMapping("/create")
@ApiOperation("创建商品推荐")
public CommonResult<Integer> createProductRecommend(@Valid ProductRecommendCreateReqVO createVO) {
return success(productRecommendManager.createProductRecommend(createVO));
}
@PostMapping("/update")
@ApiOperation("更新商品推荐")
public CommonResult<Boolean> updateProductRecommend(@Valid ProductRecommendUpdateReqVO updateVO) {
productRecommendManager.updateProductRecommend(updateVO);
return success(true);
}
@PostMapping("/delete")
@ApiOperation("删除商品推荐")
@ApiImplicitParam(name = "productRecommendId", value = "商品推荐编号", required = true)
public CommonResult<Boolean> deleteProductRecommend(@RequestParam("productRecommendId") Integer productRecommendId) {
productRecommendManager.deleteProductRecommend(productRecommendId);
return success(true);
}
@GetMapping("/page")
@ApiOperation("获得商品推荐分页")
public CommonResult<PageResult<ProductRecommendDetailVO>> pageProductRecommend(ProductRecommendPageReqVO pageVO) {
return success(productRecommendManager.pageProductRecommend(pageVO));
}
}

View File

@@ -0,0 +1,33 @@
package cn.iocoder.mall.managementweb.controller.promotion.recommend.vo;
import cn.iocoder.common.framework.enums.CommonStatusEnum;
import cn.iocoder.common.framework.validator.InEnum;
import cn.iocoder.mall.promotion.api.enums.recommend.ProductRecommendTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
@ApiModel("商品推荐创建 Request VO")
@Data
public class ProductRecommendCreateReqVO {
@ApiModelProperty(value = "类型", example = "1", required = true, notes = "参见 ProductRecommendTypeEnum 枚举")
@NotNull(message = "类型不能为空")
@InEnum(value = ProductRecommendTypeEnum.class, message = "推荐类型必须是 {value}")
private Integer type;
@ApiModelProperty(value = "商品 Spu 编号", required = true, example = "1")
@NotNull(message = "商品 Spu 编号不能为空")
private Integer productSpuId;
@ApiModelProperty(value = "排序", required = true, example = "1")
@NotNull(message = "排序不能为空")
private Integer sort;
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 CommonStatusEnum 枚举")
@NotNull(message = "状态不能为空")
@InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")
private Integer status;
@ApiModelProperty(value = "备注", example = "我是备注")
private String memo;
}

View File

@@ -0,0 +1,43 @@
package cn.iocoder.mall.managementweb.controller.promotion.recommend.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Date;
@ApiModel("商品推荐明细 VO")
@Data
@Accessors(chain = true)
public class ProductRecommendDetailVO {
@ApiModelProperty(value = "编号", required = true, example = "1")
private Integer id;
@ApiModelProperty(value = "推荐类型", required = true, example = "1", notes = "参见 ProductRecommendTypeEnum 枚举")
private Integer type;
@ApiModelProperty(value = "商品编号", required = true, example = "1")
private Integer productSpuId;
@ApiModelProperty(value = "排序", required = true, example = "10")
private Integer sort;
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 CommonStatusEnum 枚举")
private Integer status;
@ApiModelProperty(value = "备注", required = true, example = "这个活动很牛逼")
private String memo;
@ApiModelProperty(value = "创建时间", required = true, example = "时间戳格式")
private Date createTime;
/**
* 商品信息
*/
private Spu spu;
@ApiModel("商品信息")
@Data
public static class Spu {
@ApiModelProperty(value = "SPU 名字", required = true, example = "厮大牛逼")
private String name;
}
}

View File

@@ -0,0 +1,20 @@
package cn.iocoder.mall.managementweb.controller.promotion.recommend.vo;
import cn.iocoder.common.framework.validator.InEnum;
import cn.iocoder.common.framework.vo.PageParam;
import cn.iocoder.mall.promotion.api.enums.recommend.ProductRecommendTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ApiModel("商品推荐分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
public class ProductRecommendPageReqVO extends PageParam {
@ApiModelProperty(value = "类型", example = "1", notes = "参见 ProductRecommendTypeEnum 枚举")
@InEnum(value = ProductRecommendTypeEnum.class, message = "推荐类型必须是 {value}")
private Integer type;
}

View File

@@ -0,0 +1,36 @@
package cn.iocoder.mall.managementweb.controller.promotion.recommend.vo;
import cn.iocoder.common.framework.enums.CommonStatusEnum;
import cn.iocoder.common.framework.validator.InEnum;
import cn.iocoder.mall.promotion.api.enums.recommend.ProductRecommendTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
@ApiModel("商品推荐更新 Request VO")
@Data
public class ProductRecommendUpdateReqVO {
@ApiModelProperty(value = "编号", required = true, example = "1")
@NotNull(message = "编号不能为空")
private Integer id;
@ApiModelProperty(value = "类型", example = "1", required = true, notes = "参见 ProductRecommendTypeEnum 枚举")
@NotNull(message = "类型不能为空")
@InEnum(value = ProductRecommendTypeEnum.class, message = "推荐类型必须是 {value}")
private Integer type;
@ApiModelProperty(value = "商品 Spu 编号", required = true, example = "1")
@NotNull(message = "商品 Spu 编号不能为空")
private Integer productSpuId;
@ApiModelProperty(value = "排序", required = true, example = "1")
@NotNull(message = "排序不能为空")
private Integer sort;
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 CommonStatusEnum 枚举")
@NotNull(message = "状态不能为空")
@InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")
private Integer status;
@ApiModelProperty(value = "备注", example = "我是备注")
private String memo;
}

View File

@@ -0,0 +1,7 @@
### /system-access-log/page 成功
GET http://127.0.0.1:18083/management-api/system-access-log/page?pageNo=1&pageSize=10
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
###

View File

@@ -0,0 +1,38 @@
package cn.iocoder.mall.managementweb.controller.systemlog;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.common.framework.vo.PageResult;
import cn.iocoder.mall.managementweb.controller.systemlog.dto.SystemAccessLogPageDTO;
import cn.iocoder.mall.managementweb.controller.systemlog.vo.SystemAccessLogVO;
import cn.iocoder.mall.managementweb.manager.systemlog.SystemAccessLogManager;
import cn.iocoder.security.annotations.RequiresPermissions;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import static cn.iocoder.common.framework.vo.CommonResult.success;
/**
* 系统访问日志 Controller
*/
@RestController
@RequestMapping("/system-access-log")
@Api(tags = "系统访问日志")
@Validated
public class SystemAccessLogController {
@Autowired
private SystemAccessLogManager systemAccessLogManager;
@GetMapping("/page")
@ApiOperation("获得系统访问日志分页")
@RequiresPermissions("system:system-access-log:page")
public CommonResult<PageResult<SystemAccessLogVO>> pageSystemAccessLog(SystemAccessLogPageDTO pageDTO) {
return success(systemAccessLogManager.pageSystemAccessLog(pageDTO));
}
}

View File

@@ -0,0 +1,56 @@
package cn.iocoder.mall.managementweb.controller.systemlog;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.common.framework.vo.PageResult;
import cn.iocoder.mall.managementweb.controller.systemlog.dto.SystemExceptionLogPageDTO;
import cn.iocoder.mall.managementweb.controller.systemlog.dto.SystemExceptionLogProcessDTO;
import cn.iocoder.mall.managementweb.controller.systemlog.vo.SystemExceptionLogDetailVO;
import cn.iocoder.mall.managementweb.controller.systemlog.vo.SystemExceptionLogVO;
import cn.iocoder.mall.managementweb.manager.systemlog.SystemExceptionLogManager;
import cn.iocoder.mall.security.admin.core.context.AdminSecurityContextHolder;
import cn.iocoder.security.annotations.RequiresPermissions;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import static cn.iocoder.common.framework.vo.CommonResult.success;
/**
* 系统异常日志 Controller
*/
@RestController
@RequestMapping("/system-exception-log")
@Api(tags = "系统异常日志")
@Validated
public class SystemExceptionLogController {
@Autowired
private SystemExceptionLogManager systemExceptionLogManager;
@GetMapping("/get")
@ApiOperation("获得系统异常日志明细")
@ApiImplicitParam(name = "logId", value = "系统异常日志编号", required = true)
@RequiresPermissions("system:system-exception-log:page")
public CommonResult<SystemExceptionLogDetailVO> getSystemExceptionLogDetail(@RequestParam("logId") Integer logId) {
return success(systemExceptionLogManager.getSystemExceptionLogDetail(logId));
}
@GetMapping("/page")
@ApiOperation("获得系统异常日志分页")
@RequiresPermissions("system:system-exception-log:page")
public CommonResult<PageResult<SystemExceptionLogVO>> pageSystemExceptionLog(SystemExceptionLogPageDTO pageDTO) {
return success(systemExceptionLogManager.pageSystemExceptionLog(pageDTO));
}
@PostMapping("/process")
@ApiOperation("处理系统异常日志")
@RequiresPermissions("system:system-exception-log:process")
public CommonResult<Boolean> processSystemExceptionLog(SystemExceptionLogProcessDTO processDTO) {
systemExceptionLogManager.processSystemExceptionLog(AdminSecurityContextHolder.getAdminId(), processDTO);
return CommonResult.success(true);
}
}

Some files were not shown because too many files have changed in this diff Show More