Compare commits

..

4 Commits

7 changed files with 145 additions and 19 deletions

View File

@ -107,12 +107,6 @@
<artifactId>mcwl-pay</artifactId>
<version>3.8.8</version>
</dependency>
<!-- 资源中心模块-->
<dependency>
<groupId>com.mcwl</groupId>
<artifactId>mcwl-resource</artifactId>
<version>3.8.8</version>
</dependency>
<!-- 代码生成-->
<dependency>
<groupId>com.mcwl</groupId>

View File

@ -17,11 +17,14 @@ import com.mcwl.system.service.ISysEmailService;
import com.mcwl.system.service.ISysToolService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@ -42,12 +45,25 @@ public class SysToolController {
*/
@GetMapping("listTool")
@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>()
.eq(type != null, SysTool::getType, type)
.orderByDesc(SysTool::getStatus)
.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查询工具")
public R<ToolVo> getTool(@Valid @NotNull(message = "工具id不能为空") Long 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")
@ -65,7 +89,7 @@ public class SysToolController {
public R<String> addTool(@Valid @RequestBody AddToolRes addToolRes) {
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 = "编辑工具")
public R<String> editTool(@Valid @RequestBody EditToolRes editToolRes) {
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")
@ApiOperation(value = "删除工具")
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, "删除失败");
}

View File

@ -23,10 +23,6 @@ public class CustomTenantHandler implements TenantLineHandler {
static {
// 通知表
tables.add("cc_advice");
// 发布评论表
tables.add("cc_comment");
// 评论点赞表
tables.add("cc_comment_like");
// 社区表
tables.add("cc_community");
// 社区文件表
@ -43,12 +39,20 @@ public class CustomTenantHandler implements TenantLineHandler {
tables.add("cc_publish");
// 收藏表
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_question");
// 提问评论表
tables.add("cc_question_comment");
// 发布举报
tables.add("cc_report");

View File

@ -18,17 +18,29 @@ import lombok.*;
@NoArgsConstructor
public class SysTool extends BaseEntity {
/**
* id
*/
@TableId
private Long id;
/**
*
*/
private String name;
/**
* url
*/
private String imageUrl;
/**
* url
*/
private String toolUrl;
/**
* 0 1 2
*/
private Integer type;
/**
* 0 1
*/

View File

@ -8,6 +8,7 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
@Data
@ -17,6 +18,13 @@ import javax.validation.constraints.Pattern;
@ApiModel(value = "新增工具请求对象")
public class AddToolRes {
/**
*
*/
@ApiModelProperty(value = "工具名称", required = true)
@NotBlank(message = "工具名称不能为空")
private String name;
/**
* url
*/
@ -24,4 +32,29 @@ public class AddToolRes {
@NotBlank(message = "图片url不能为空")
private String imageUrl;
/**
* url
*/
@ApiModelProperty(value = "工具url", required = true)
@NotBlank(message = "工具url不能为空")
private String toolUrl;
/**
* 0 1 2
*/
@ApiModelProperty(value = "类型 0文本 1图片 2视频", required = true)
@NotNull(message = "类型不能为空")
private Integer type;
/**
* 0 1
*/
@ApiModelProperty(value = "状态 0不可用 1可用")
private Integer status = 1;
/**
*
*/
@ApiModelProperty(value = "备注")
private String remark;
}

View File

@ -24,6 +24,14 @@ public class EditToolRes {
@NotNull(message = "工具id不能为空")
private Long id;
/**
*
*/
@ApiModelProperty(value = "工具名称", required = true)
@NotBlank(message = "工具名称不能为空")
private String name;
/**
* url
*/
@ -31,6 +39,20 @@ public class EditToolRes {
@NotBlank(message = "图片url不能为空")
private String imageUrl;
/**
* url
*/
@ApiModelProperty(value = "工具url", required = true)
@NotBlank(message = "工具url不能为空")
private String toolUrl;
/**
* 0 1 2
*/
@ApiModelProperty(value = "类型 0文本 1图片 2视频", required = true)
@NotNull(message = "类型不能为空")
private Integer type;
/**
*
*/
@ -38,4 +60,10 @@ public class EditToolRes {
@NotNull(message = "状态不能为空")
private Integer status;
/**
*
*/
@ApiModelProperty(value = "备注")
private String remark;
}

View File

@ -24,12 +24,36 @@ public class ToolVo {
@ApiModelProperty(value = "工具id")
private Long id;
/**
*
*/
@ApiModelProperty(value = "工具名称")
private String name;
/**
* url
*/
@ApiModelProperty(value = "图片url")
private String imageUrl;
/**
* url
*/
@ApiModelProperty(value = "工具url")
private String toolUrl;
/**
* 0 1 2
*/
@ApiModelProperty(value = "类型 0文本 1图片 2视频")
private Integer type;
/**
*
*/
@ApiModelProperty(value = "类型名称")
private String typeName;
/**
* 0 1
*/
@ -43,4 +67,11 @@ public class ToolVo {
@ApiModelProperty(value = "创建时间")
private Date createTime;
/**
*
*/
@ApiModelProperty(value = "备注")
private String remark;
}