feat(system): 工具管理
parent
f4c0374375
commit
849000ca3f
|
@ -1,4 +1,4 @@
|
||||||
package com.mcwl.web.controller.email;
|
package com.mcwl.web.controller.system;
|
||||||
|
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
@ -19,16 +19,15 @@ import javax.validation.Valid;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* 邮箱
|
* 邮箱
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("email")
|
@RequestMapping("sys/email")
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Api(tags = "邮箱")
|
@Api(tags = "邮箱")
|
||||||
public class EmailController {
|
public class SysEmailController {
|
||||||
|
|
||||||
private final ISysEmailService sysEmailService;
|
private final ISysEmailService sysEmailService;
|
||||||
|
|
|
@ -0,0 +1,90 @@
|
||||||
|
package com.mcwl.web.controller.system;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.mcwl.common.constant.HttpStatus;
|
||||||
|
import com.mcwl.common.core.domain.R;
|
||||||
|
import com.mcwl.system.domain.SysEmail;
|
||||||
|
import com.mcwl.system.domain.SysTool;
|
||||||
|
import com.mcwl.system.domain.dto.AddEmailRes;
|
||||||
|
import com.mcwl.system.domain.dto.AddToolRes;
|
||||||
|
import com.mcwl.system.domain.dto.EditEmailRes;
|
||||||
|
import com.mcwl.system.domain.dto.EditToolRes;
|
||||||
|
import com.mcwl.system.domain.vo.EmailVo;
|
||||||
|
import com.mcwl.system.domain.vo.ToolVo;
|
||||||
|
import com.mcwl.system.service.ISysEmailService;
|
||||||
|
import com.mcwl.system.service.ISysToolService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 工具
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("sys/tool")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Api(tags = "工具")
|
||||||
|
public class SysToolController {
|
||||||
|
|
||||||
|
private final ISysToolService sysToolService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询工具列表
|
||||||
|
*/
|
||||||
|
@GetMapping("listTool")
|
||||||
|
@ApiOperation(value = "查询工具列表")
|
||||||
|
public R<List<ToolVo>> listTool() {
|
||||||
|
List<SysTool> sysToolList = sysToolService.list(new LambdaQueryWrapper<SysTool>()
|
||||||
|
.orderByDesc(SysTool::getCreateTime)
|
||||||
|
.orderByAsc(SysTool::getStatus));
|
||||||
|
return R.ok(BeanUtil.copyToList(sysToolList, ToolVo.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按id查询工具
|
||||||
|
*/
|
||||||
|
@GetMapping("getTool")
|
||||||
|
@ApiOperation(value = "按id查询工具")
|
||||||
|
public R<ToolVo> getTool(@Valid @NotNull(message = "工具id不能为空") Long toolId) {
|
||||||
|
SysTool sysTool = sysToolService.getById(toolId);
|
||||||
|
return R.ok(BeanUtil.toBean(sysTool, ToolVo.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("addTool")
|
||||||
|
@ApiOperation(value = "添加工具")
|
||||||
|
public R<String> addTool(@Valid @RequestBody AddToolRes addToolRes) {
|
||||||
|
|
||||||
|
SysTool sysTool = BeanUtil.toBean(addToolRes, SysTool.class);
|
||||||
|
return sysToolService.save(sysTool) ? R.ok("添加成功") : R.fail("添加失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑工具
|
||||||
|
*/
|
||||||
|
@PostMapping("editTool")
|
||||||
|
@ApiOperation(value = "编辑工具")
|
||||||
|
public R<String> editTool(@Valid @RequestBody EditToolRes editToolRes) {
|
||||||
|
SysTool sysTool = BeanUtil.toBean(editToolRes, SysTool.class);
|
||||||
|
return sysToolService.updateById(sysTool) ? R.ok("编辑成功") : R.fail("编辑失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除工具
|
||||||
|
*/
|
||||||
|
@GetMapping("delTool")
|
||||||
|
@ApiOperation(value = "删除工具")
|
||||||
|
public R<String> delTool(@Valid @NotNull(message = "工具id不能为空") Long toolId) {
|
||||||
|
return sysToolService.removeById(toolId) ? R.ok("删除成功") : R.fail("删除失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -6,6 +6,10 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.mcwl.common.core.domain.BaseEntity;
|
import com.mcwl.common.core.domain.BaseEntity;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮箱
|
||||||
|
*
|
||||||
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@TableName("sys_email")
|
@TableName("sys_email")
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
package com.mcwl.system.domain;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.mcwl.common.core.domain.BaseEntity;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工具
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@TableName("sys_tool")
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class SysTool extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮箱id
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图片url
|
||||||
|
*/
|
||||||
|
private String imageUrl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态 0不可用 1可用
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.mcwl.system.domain.dto;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.Pattern;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
@ApiModel(value = "新增工具请求对象")
|
||||||
|
public class AddToolRes {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图片url
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "图片url", required = true)
|
||||||
|
@NotBlank(message = "图片url不能为空")
|
||||||
|
private String imageUrl;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package com.mcwl.system.domain.dto;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
@ApiModel(value = "编辑工具请求对象")
|
||||||
|
public class EditToolRes {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工具id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "工具id", required = true)
|
||||||
|
@NotNull(message = "工具id不能为空")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图片url
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "图片url", required = true)
|
||||||
|
@NotBlank(message = "图片url不能为空")
|
||||||
|
private String imageUrl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "状态", required = true)
|
||||||
|
@NotNull(message = "状态不能为空")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
package com.mcwl.system.domain.vo;
|
||||||
|
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工具返回对象
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@ApiModel(value = "工具返回对象")
|
||||||
|
public class ToolVo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工具id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "工具id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图片url
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "图片url")
|
||||||
|
private String imageUrl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态 0不可用 1可用
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "状态 0不可用 1可用")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
}
|
|
@ -6,7 +6,7 @@ import com.mcwl.system.domain.SysUserPayAccountLog;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户提现
|
* 邮箱
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface SysEmailMapper extends BaseMapper<SysEmail> {
|
public interface SysEmailMapper extends BaseMapper<SysEmail> {
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.mcwl.system.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.mcwl.system.domain.SysEmail;
|
||||||
|
import com.mcwl.system.domain.SysTool;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工具
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface SysToolMapper extends BaseMapper<SysTool> {
|
||||||
|
|
||||||
|
}
|
|
@ -7,7 +7,7 @@ import com.mcwl.system.domain.SysUserPayAccountLog;
|
||||||
import com.mcwl.system.domain.dto.WithdrawalPageRes;
|
import com.mcwl.system.domain.dto.WithdrawalPageRes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户提现 服务层
|
* 邮箱 服务层
|
||||||
*
|
*
|
||||||
* @author mcwl
|
* @author mcwl
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.mcwl.system.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.mcwl.system.domain.SysEmail;
|
||||||
|
import com.mcwl.system.domain.SysTool;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工具 服务层
|
||||||
|
*
|
||||||
|
* @author mcwl
|
||||||
|
*/
|
||||||
|
public interface ISysToolService extends IService<SysTool> {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -18,7 +18,7 @@ import org.springframework.stereotype.Service;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户提现
|
* 邮箱
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class SysEmailServiceImpl extends ServiceImpl<SysEmailMapper, SysEmail> implements ISysEmailService {
|
public class SysEmailServiceImpl extends ServiceImpl<SysEmailMapper, SysEmail> implements ISysEmailService {
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.mcwl.system.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.mcwl.system.domain.SysEmail;
|
||||||
|
import com.mcwl.system.domain.SysTool;
|
||||||
|
import com.mcwl.system.mapper.SysEmailMapper;
|
||||||
|
import com.mcwl.system.mapper.SysToolMapper;
|
||||||
|
import com.mcwl.system.service.ISysEmailService;
|
||||||
|
import com.mcwl.system.service.ISysToolService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工具
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SysToolServiceImpl extends ServiceImpl<SysToolMapper, SysTool> implements ISysToolService {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue