feat(system): 增加工具类型名称和备注字段
parent
452ec60d17
commit
0eca5db854
|
@ -17,11 +17,14 @@ import com.mcwl.system.service.ISysEmailService;
|
||||||
import com.mcwl.system.service.ISysToolService;
|
import com.mcwl.system.service.ISysToolService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.annotations.ApiParam;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@ -42,12 +45,25 @@ public class SysToolController {
|
||||||
*/
|
*/
|
||||||
@GetMapping("listTool")
|
@GetMapping("listTool")
|
||||||
@ApiOperation(value = "查询工具列表")
|
@ApiOperation(value = "查询工具列表")
|
||||||
public R<List<ToolVo>> listTool() {
|
public R<List<ToolVo>> listTool(@ApiParam(value = "工具类型") @RequestParam(required = false) Integer type) {
|
||||||
List<SysTool> sysToolList = sysToolService.list(new LambdaQueryWrapper<SysTool>()
|
List<SysTool> sysToolList = sysToolService.list(new LambdaQueryWrapper<SysTool>()
|
||||||
|
.eq(type != null, SysTool::getType, type)
|
||||||
.orderByDesc(SysTool::getStatus)
|
.orderByDesc(SysTool::getStatus)
|
||||||
.orderByDesc(SysTool::getCreateTime));
|
.orderByDesc(SysTool::getCreateTime));
|
||||||
|
List<ToolVo> toolVoList = new ArrayList<>();
|
||||||
|
for (SysTool sysTool : sysToolList) {
|
||||||
|
ToolVo toolVo = BeanUtil.toBean(sysTool, ToolVo.class);
|
||||||
|
if (sysTool.getType() == 0) {
|
||||||
|
toolVo.setTypeName("文本");
|
||||||
|
} else if (sysTool.getType() == 1) {
|
||||||
|
toolVo.setTypeName("图片");
|
||||||
|
} else if (sysTool.getType() == 2) {
|
||||||
|
toolVo.setTypeName("视频");
|
||||||
|
}
|
||||||
|
toolVoList.add(toolVo);
|
||||||
|
}
|
||||||
|
|
||||||
return R.ok(BeanUtil.copyToList(sysToolList, ToolVo.class));
|
return R.ok(toolVoList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -57,7 +73,15 @@ public class SysToolController {
|
||||||
@ApiOperation(value = "按id查询工具")
|
@ApiOperation(value = "按id查询工具")
|
||||||
public R<ToolVo> getTool(@Valid @NotNull(message = "工具id不能为空") Long toolId) {
|
public R<ToolVo> getTool(@Valid @NotNull(message = "工具id不能为空") Long toolId) {
|
||||||
SysTool sysTool = sysToolService.getById(toolId);
|
SysTool sysTool = sysToolService.getById(toolId);
|
||||||
return R.ok(BeanUtil.toBean(sysTool, ToolVo.class));
|
ToolVo toolVo = BeanUtil.toBean(sysTool, ToolVo.class);
|
||||||
|
if (sysTool.getType() == 0) {
|
||||||
|
toolVo.setTypeName("文本");
|
||||||
|
} else if (sysTool.getType() == 1) {
|
||||||
|
toolVo.setTypeName("图片");
|
||||||
|
} else if (sysTool.getType() == 2) {
|
||||||
|
toolVo.setTypeName("视频");
|
||||||
|
}
|
||||||
|
return R.ok(toolVo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("addTool")
|
@PostMapping("addTool")
|
||||||
|
@ -65,7 +89,7 @@ public class SysToolController {
|
||||||
public R<String> addTool(@Valid @RequestBody AddToolRes addToolRes) {
|
public R<String> addTool(@Valid @RequestBody AddToolRes addToolRes) {
|
||||||
|
|
||||||
SysTool sysTool = BeanUtil.toBean(addToolRes, SysTool.class);
|
SysTool sysTool = BeanUtil.toBean(addToolRes, SysTool.class);
|
||||||
return sysToolService.save(sysTool) ? R.ok(null,"添加成功") : R.fail(null,"添加失败");
|
return sysToolService.save(sysTool) ? R.ok(null, "添加成功") : R.fail(null, "添加失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -75,7 +99,7 @@ public class SysToolController {
|
||||||
@ApiOperation(value = "编辑工具")
|
@ApiOperation(value = "编辑工具")
|
||||||
public R<String> editTool(@Valid @RequestBody EditToolRes editToolRes) {
|
public R<String> editTool(@Valid @RequestBody EditToolRes editToolRes) {
|
||||||
SysTool sysTool = BeanUtil.toBean(editToolRes, SysTool.class);
|
SysTool sysTool = BeanUtil.toBean(editToolRes, SysTool.class);
|
||||||
return sysToolService.updateById(sysTool) ? R.ok(null,"编辑成功") : R.fail(null,"编辑失败");
|
return sysToolService.updateById(sysTool) ? R.ok(null, "编辑成功") : R.fail(null, "编辑失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -84,7 +108,7 @@ public class SysToolController {
|
||||||
@GetMapping("delTool")
|
@GetMapping("delTool")
|
||||||
@ApiOperation(value = "删除工具")
|
@ApiOperation(value = "删除工具")
|
||||||
public R<String> delTool(@Valid @NotNull(message = "工具id不能为空") Long toolId) {
|
public R<String> delTool(@Valid @NotNull(message = "工具id不能为空") Long toolId) {
|
||||||
return sysToolService.removeById(toolId) ? R.ok(null,"删除成功") : R.fail(null,"删除失败");
|
return sysToolService.removeById(toolId) ? R.ok(null, "删除成功") : R.fail(null, "删除失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,10 +23,6 @@ public class CustomTenantHandler implements TenantLineHandler {
|
||||||
static {
|
static {
|
||||||
// 通知表
|
// 通知表
|
||||||
tables.add("cc_advice");
|
tables.add("cc_advice");
|
||||||
// 发布评论表
|
|
||||||
tables.add("cc_comment");
|
|
||||||
// 评论点赞表
|
|
||||||
tables.add("cc_comment_like");
|
|
||||||
// 社区表
|
// 社区表
|
||||||
tables.add("cc_community");
|
tables.add("cc_community");
|
||||||
// 社区文件表
|
// 社区文件表
|
||||||
|
@ -43,12 +39,20 @@ public class CustomTenantHandler implements TenantLineHandler {
|
||||||
tables.add("cc_publish");
|
tables.add("cc_publish");
|
||||||
// 收藏表
|
// 收藏表
|
||||||
tables.add("cc_publish_collect");
|
tables.add("cc_publish_collect");
|
||||||
|
// 发布评论表
|
||||||
|
tables.add("cc_publish_comment");
|
||||||
|
// 评论点赞表
|
||||||
|
tables.add("cc_publish_comment_like");
|
||||||
|
// 发布标签
|
||||||
|
tables.add("cc_publish_label");
|
||||||
// 发布点赞表
|
// 发布点赞表
|
||||||
tables.add("cc_publish_like");
|
tables.add("cc_publish_like");
|
||||||
// 提问表
|
// 提问表
|
||||||
tables.add("cc_question");
|
tables.add("cc_question");
|
||||||
// 提问评论表
|
// 提问评论表
|
||||||
tables.add("cc_question_comment");
|
tables.add("cc_question_comment");
|
||||||
|
// 发布举报
|
||||||
|
tables.add("cc_report");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -46,4 +46,15 @@ public class AddToolRes {
|
||||||
@NotNull(message = "类型不能为空")
|
@NotNull(message = "类型不能为空")
|
||||||
private Integer type;
|
private Integer type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态 0不可用 1可用
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "状态 0不可用 1可用")
|
||||||
|
private Integer status = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "备注")
|
||||||
|
private String remark;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,4 +60,10 @@ public class EditToolRes {
|
||||||
@NotNull(message = "状态不能为空")
|
@NotNull(message = "状态不能为空")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,12 @@ public class ToolVo {
|
||||||
@ApiModelProperty(value = "类型 0文本 1图片 2视频")
|
@ApiModelProperty(value = "类型 0文本 1图片 2视频")
|
||||||
private Integer type;
|
private Integer type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型名称
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "类型名称")
|
||||||
|
private String typeName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态 0不可用 1可用
|
* 状态 0不可用 1可用
|
||||||
*/
|
*/
|
||||||
|
@ -61,4 +67,11 @@ public class ToolVo {
|
||||||
@ApiModelProperty(value = "创建时间")
|
@ApiModelProperty(value = "创建时间")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue