diff --git a/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/base/BaseController.java b/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/base/BaseController.java index df1fdba71..d1f33d63d 100644 --- a/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/base/BaseController.java +++ b/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/base/BaseController.java @@ -41,15 +41,15 @@ import top.charles7c.cnadmin.common.constant.StringConsts; import top.charles7c.cnadmin.common.model.query.PageQuery; import top.charles7c.cnadmin.common.model.query.SortQuery; -import top.charles7c.cnadmin.common.model.vo.PageDataVO; -import top.charles7c.cnadmin.common.model.vo.R; +import top.charles7c.cnadmin.common.model.resp.PageDataResp; +import top.charles7c.cnadmin.common.model.resp.R; /** * 控制器基类 * * @param * 业务接口 - * @param + * @param * 列表信息 * @param * 详情信息 @@ -61,7 +61,7 @@ * @since 2023/1/26 10:45 */ @NoArgsConstructor -public abstract class BaseController, V, D, Q, C extends BaseRequest> { +public abstract class BaseController, L, D, Q, C extends BaseReq> { @Autowired protected S baseService; @@ -78,7 +78,7 @@ public abstract class BaseController, V, D, Q, @Operation(summary = "分页查询列表", description = "分页查询列表") @ResponseBody @GetMapping - public PageDataVO page(Q query, @Validated PageQuery pageQuery) { + public PageDataResp page(Q query, @Validated PageQuery pageQuery) { this.checkPermission(Api.LIST); return baseService.page(query, pageQuery); } @@ -112,7 +112,7 @@ public List> tree(Q query, SortQuery sortQuery) { @Operation(summary = "查询列表", description = "查询列表") @ResponseBody @GetMapping("/list") - public List list(Q query, SortQuery sortQuery) { + public List list(Q query, SortQuery sortQuery) { this.checkPermission(Api.LIST); return baseService.list(query, sortQuery); } @@ -136,23 +136,23 @@ public D get(@PathVariable Long id) { /** * 新增 * - * @param request + * @param req * 创建信息 * @return 自增 ID */ @Operation(summary = "新增数据", description = "新增数据") @ResponseBody @PostMapping - public R add(@Validated(ValidateGroup.Crud.Add.class) @RequestBody C request) { + public R add(@Validated(ValidateGroup.Crud.Add.class) @RequestBody C req) { this.checkPermission(Api.ADD); - Long id = baseService.add(request); + Long id = baseService.add(req); return R.ok("新增成功", id); } /** * 修改 * - * @param request + * @param req * 修改信息 * @param id * ID @@ -162,9 +162,9 @@ public R add(@Validated(ValidateGroup.Crud.Add.class) @RequestBody C reque @Parameter(name = "id", description = "ID", example = "1", in = ParameterIn.PATH) @ResponseBody @PutMapping("/{id}") - public R update(@Validated(ValidateGroup.Crud.Update.class) @RequestBody C request, @PathVariable Long id) { + public R update(@Validated(ValidateGroup.Crud.Update.class) @RequestBody C req, @PathVariable Long id) { this.checkPermission(Api.UPDATE); - baseService.update(request, id); + baseService.update(req, id); return R.ok("修改成功"); } diff --git a/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/base/BaseDetailVO.java b/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/base/BaseDetailResp.java similarity index 95% rename from continew-admin-common/src/main/java/top/charles7c/cnadmin/common/base/BaseDetailVO.java rename to continew-admin-common/src/main/java/top/charles7c/cnadmin/common/base/BaseDetailResp.java index 70ba76e7c..e91661292 100644 --- a/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/base/BaseDetailVO.java +++ b/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/base/BaseDetailResp.java @@ -26,13 +26,13 @@ import com.fasterxml.jackson.annotation.JsonIgnore; /** - * 详情 VO 基类 + * 详情响应基类 * * @author Charles7c * @since 2023/1/26 10:40 */ @Data -public class BaseDetailVO extends BaseVO { +public class BaseDetailResp extends BaseResp { private static final long serialVersionUID = 1L; diff --git a/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/base/BaseRequest.java b/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/base/BaseReq.java similarity index 92% rename from continew-admin-common/src/main/java/top/charles7c/cnadmin/common/base/BaseRequest.java rename to continew-admin-common/src/main/java/top/charles7c/cnadmin/common/base/BaseReq.java index fd8c17790..0607661b1 100644 --- a/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/base/BaseRequest.java +++ b/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/base/BaseReq.java @@ -21,13 +21,13 @@ import lombok.Data; /** - * Request 基类 + * 请求基类 * * @author Charles7c * @since 2023/1/30 21:51 */ @Data -public class BaseRequest implements Serializable { +public class BaseReq implements Serializable { private static final long serialVersionUID = 1L; } diff --git a/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/base/BaseVO.java b/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/base/BaseResp.java similarity index 96% rename from continew-admin-common/src/main/java/top/charles7c/cnadmin/common/base/BaseVO.java rename to continew-admin-common/src/main/java/top/charles7c/cnadmin/common/base/BaseResp.java index 52577e705..8d307d118 100644 --- a/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/base/BaseVO.java +++ b/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/base/BaseResp.java @@ -28,13 +28,13 @@ import com.fasterxml.jackson.annotation.JsonInclude; /** - * VO 基类 + * 响应基类 * * @author Charles7c * @since 2023/1/26 10:40 */ @Data -public class BaseVO implements Serializable { +public class BaseResp implements Serializable { private static final long serialVersionUID = 1L; diff --git a/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/base/BaseService.java b/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/base/BaseService.java index 913ca36cc..f5a476a29 100644 --- a/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/base/BaseService.java +++ b/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/base/BaseService.java @@ -24,12 +24,12 @@ import top.charles7c.cnadmin.common.model.query.PageQuery; import top.charles7c.cnadmin.common.model.query.SortQuery; -import top.charles7c.cnadmin.common.model.vo.PageDataVO; +import top.charles7c.cnadmin.common.model.resp.PageDataResp; /** * 业务接口基类 * - * @param + * @param * 列表信息 * @param * 详情信息 @@ -40,7 +40,7 @@ * @author Charles7c * @since 2023/1/26 16:54 */ -public interface BaseService { +public interface BaseService { /** * 分页查询列表 @@ -51,7 +51,7 @@ public interface BaseService { * 分页查询条件 * @return 分页列表信息 */ - PageDataVO page(Q query, PageQuery pageQuery); + PageDataResp page(Q query, PageQuery pageQuery); /** * 查询树列表 @@ -75,7 +75,7 @@ public interface BaseService { * 排序查询条件 * @return 列表信息 */ - List list(Q query, SortQuery sortQuery); + List list(Q query, SortQuery sortQuery); /** * 查看详情 @@ -89,21 +89,21 @@ public interface BaseService { /** * 新增 * - * @param request + * @param req * 创建信息 * @return 自增 ID */ - Long add(C request); + Long add(C req); /** * 修改 * - * @param request + * @param req * 修改信息 * @param id * ID */ - void update(C request, Long id); + void update(C req, Long id); /** * 删除 diff --git a/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/base/BaseServiceImpl.java b/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/base/BaseServiceImpl.java index dcd8f3af6..5730748ec 100644 --- a/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/base/BaseServiceImpl.java +++ b/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/base/BaseServiceImpl.java @@ -44,7 +44,7 @@ import top.charles7c.cnadmin.common.annotation.TreeField; import top.charles7c.cnadmin.common.model.query.PageQuery; import top.charles7c.cnadmin.common.model.query.SortQuery; -import top.charles7c.cnadmin.common.model.vo.PageDataVO; +import top.charles7c.cnadmin.common.model.resp.PageDataResp; import top.charles7c.cnadmin.common.service.CommonUserService; import top.charles7c.cnadmin.common.util.ExcelUtils; import top.charles7c.cnadmin.common.util.ExceptionUtils; @@ -60,7 +60,7 @@ * Mapper 接口 * @param * 实体类 - * @param + * @param * 列表信息 * @param * 详情信息 @@ -71,41 +71,41 @@ * @author Charles7c * @since 2023/1/26 21:52 */ -public abstract class BaseServiceImpl, T extends BaseDO, V, D, Q, C extends BaseRequest> - implements BaseService { +public abstract class BaseServiceImpl, T extends BaseDO, L, D, Q, C extends BaseReq> + implements BaseService { @Autowired protected M baseMapper; private final Class entityClass; - private final Class voClass; - private final Class detailVoClass; + private final Class listClass; + private final Class detailClass; protected BaseServiceImpl() { this.entityClass = (Class)ClassUtil.getTypeArgument(this.getClass(), 1); - this.voClass = (Class)ClassUtil.getTypeArgument(this.getClass(), 2); - this.detailVoClass = (Class)ClassUtil.getTypeArgument(this.getClass(), 3); + this.listClass = (Class)ClassUtil.getTypeArgument(this.getClass(), 2); + this.detailClass = (Class)ClassUtil.getTypeArgument(this.getClass(), 3); } @Override - public PageDataVO page(Q query, PageQuery pageQuery) { + public PageDataResp page(Q query, PageQuery pageQuery) { QueryWrapper queryWrapper = QueryHelper.build(query); IPage page = baseMapper.selectPage(pageQuery.toPage(), queryWrapper); - PageDataVO pageDataVO = PageDataVO.build(page, voClass); - pageDataVO.getList().forEach(this::fill); - return pageDataVO; + PageDataResp pageDataResp = PageDataResp.build(page, listClass); + pageDataResp.getList().forEach(this::fill); + return pageDataResp; } @Override public List> tree(Q query, SortQuery sortQuery, boolean isSimple) { - List list = this.list(query, sortQuery); + List list = this.list(query, sortQuery); if (CollUtil.isEmpty(list)) { return new ArrayList<>(0); } // 如果构建简单树结构,则不包含基本树结构之外的扩展字段 TreeNodeConfig treeNodeConfig = TreeUtils.DEFAULT_CONFIG; - TreeField treeField = voClass.getDeclaredAnnotation(TreeField.class); + TreeField treeField = listClass.getDeclaredAnnotation(TreeField.class); if (!isSimple) { // 根据 @TreeField 配置生成树结构配置 treeNodeConfig = TreeUtils.genTreeNodeConfig(treeField); @@ -119,7 +119,7 @@ public List> tree(Q query, SortQuery sortQuery, boolean isSimple) { tree.setName(ReflectUtil.invoke(node, StrUtil.genGetter(treeField.nameKey()))); tree.setWeight(ReflectUtil.invoke(node, StrUtil.genGetter(treeField.weightKey()))); if (!isSimple) { - List fieldList = ReflectUtils.getNonStaticFields(voClass); + List fieldList = ReflectUtils.getNonStaticFields(listClass); fieldList.removeIf(f -> StrUtil.containsAnyIgnoreCase(f.getName(), treeField.value(), treeField.parentIdKey(), treeField.nameKey(), treeField.weightKey(), treeField.childrenKey())); fieldList @@ -129,8 +129,8 @@ public List> tree(Q query, SortQuery sortQuery, boolean isSimple) { } @Override - public List list(Q query, SortQuery sortQuery) { - List list = this.list(query, sortQuery, voClass); + public List list(Q query, SortQuery sortQuery) { + List list = this.list(query, sortQuery, listClass); list.forEach(this::fill); return list; } @@ -174,27 +174,27 @@ protected void sort(QueryWrapper queryWrapper, SortQuery sortQuery) { @Override public D get(Long id) { T entity = this.getById(id); - D detailVO = BeanUtil.copyProperties(entity, detailVoClass); - this.fillDetail(detailVO); - return detailVO; + D detail = BeanUtil.copyProperties(entity, detailClass); + this.fillDetail(detail); + return detail; } @Override @Transactional(rollbackFor = Exception.class) - public Long add(C request) { - if (null == request) { + public Long add(C req) { + if (null == req) { return 0L; } - T entity = BeanUtil.copyProperties(request, entityClass); + T entity = BeanUtil.copyProperties(req, entityClass); baseMapper.insert(entity); return entity.getId(); } @Override @Transactional(rollbackFor = Exception.class) - public void update(C request, Long id) { + public void update(C req, Long id) { T entity = this.getById(id); - BeanUtil.copyProperties(request, entity, CopyOptions.create().ignoreNullValue()); + BeanUtil.copyProperties(req, entity, CopyOptions.create().ignoreNullValue()); baseMapper.updateById(entity); } @@ -206,9 +206,9 @@ public void delete(List ids) { @Override public void export(Q query, SortQuery sortQuery, HttpServletResponse response) { - List list = this.list(query, sortQuery, detailVoClass); + List list = this.list(query, sortQuery, detailClass); list.forEach(this::fillDetail); - ExcelUtils.export(list, "导出数据", detailVoClass, response); + ExcelUtils.export(list, "导出数据", detailClass, response); } /** @@ -231,14 +231,14 @@ protected T getById(Object id) { * 待填充列表信息 */ protected void fill(Object baseObj) { - if (baseObj instanceof BaseVO) { - BaseVO baseVO = (BaseVO)baseObj; - Long createUser = baseVO.getCreateUser(); + if (baseObj instanceof BaseResp) { + BaseResp baseResp = (BaseResp)baseObj; + Long createUser = baseResp.getCreateUser(); if (null == createUser) { return; } CommonUserService userService = SpringUtil.getBean(CommonUserService.class); - baseVO.setCreateUserString(ExceptionUtils.exToNull(() -> userService.getNicknameById(createUser))); + baseResp.setCreateUserString(ExceptionUtils.exToNull(() -> userService.getNicknameById(createUser))); } } @@ -249,16 +249,16 @@ protected void fill(Object baseObj) { * 待填充详情信息 */ public void fillDetail(Object detailObj) { - if (detailObj instanceof BaseDetailVO) { - BaseDetailVO detailVO = (BaseDetailVO)detailObj; - this.fill(detailVO); + if (detailObj instanceof BaseDetailResp) { + BaseDetailResp detail = (BaseDetailResp)detailObj; + this.fill(detail); - Long updateUser = detailVO.getUpdateUser(); + Long updateUser = detail.getUpdateUser(); if (null == updateUser) { return; } CommonUserService userService = SpringUtil.getBean(CommonUserService.class); - detailVO.setUpdateUserString(ExceptionUtils.exToNull(() -> userService.getNicknameById(updateUser))); + detail.setUpdateUserString(ExceptionUtils.exToNull(() -> userService.getNicknameById(updateUser))); } } } diff --git a/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/base/IBaseEnum.java b/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/base/IBaseEnum.java index abe8c55fe..1bd795223 100644 --- a/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/base/IBaseEnum.java +++ b/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/base/IBaseEnum.java @@ -23,12 +23,12 @@ /** * 枚举接口 * - * @param + * @param * value 类型 * @author Charles7c * @since 2023/2/5 20:44 */ -public interface IBaseEnum extends IEnum { +public interface IBaseEnum extends IEnum { /** * 枚举描述 diff --git a/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/constant/SysConsts.java b/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/constant/SysConsts.java index 704ec355e..b9ab7305b 100644 --- a/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/constant/SysConsts.java +++ b/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/constant/SysConsts.java @@ -64,7 +64,7 @@ public class SysConsts { public static final String LOGOUT_URI = "/auth/logout"; /** - * VO 描述类字段后缀 + * 描述类字段后缀 */ - public static final String VO_DESCRIPTION_FIELD_SUFFIX = "String"; + public static final String DESCRIPTION_FIELD_SUFFIX = "String"; } diff --git a/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/handler/GlobalErrorHandler.java b/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/handler/GlobalErrorHandler.java index 1ee3ed112..da85ed12e 100644 --- a/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/handler/GlobalErrorHandler.java +++ b/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/handler/GlobalErrorHandler.java @@ -41,7 +41,7 @@ import cn.hutool.core.bean.BeanUtil; import cn.hutool.json.JSONUtil; -import top.charles7c.cnadmin.common.model.vo.R; +import top.charles7c.cnadmin.common.model.resp.R; /** * 全局错误处理器 diff --git a/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/handler/GlobalExceptionHandler.java b/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/handler/GlobalExceptionHandler.java index ac7e95d6b..a5c816a10 100644 --- a/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/handler/GlobalExceptionHandler.java +++ b/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/handler/GlobalExceptionHandler.java @@ -42,7 +42,7 @@ import top.charles7c.cnadmin.common.exception.BadRequestException; import top.charles7c.cnadmin.common.exception.ServiceException; -import top.charles7c.cnadmin.common.model.vo.R; +import top.charles7c.cnadmin.common.model.resp.R; import top.charles7c.cnadmin.common.util.ExceptionUtils; import top.charles7c.cnadmin.common.util.StreamUtils; import top.charles7c.cnadmin.common.util.holder.LogContextHolder; diff --git a/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/handler/GlobalResponseBodyAdviceHandler.java b/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/handler/GlobalResponseBodyAdviceHandler.java index 0c291c357..976dec78f 100644 --- a/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/handler/GlobalResponseBodyAdviceHandler.java +++ b/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/handler/GlobalResponseBodyAdviceHandler.java @@ -32,7 +32,7 @@ import cn.hutool.core.util.StrUtil; import top.charles7c.cnadmin.common.annotation.NoResponseAdvice; -import top.charles7c.cnadmin.common.model.vo.R; +import top.charles7c.cnadmin.common.model.resp.R; /** * 全局响应结果处理器 diff --git a/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/model/request/UpdateStatusRequest.java b/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/model/req/UpdateStatusReq.java similarity index 91% rename from continew-admin-common/src/main/java/top/charles7c/cnadmin/common/model/request/UpdateStatusRequest.java rename to continew-admin-common/src/main/java/top/charles7c/cnadmin/common/model/req/UpdateStatusReq.java index 369e62a86..30c6e814f 100644 --- a/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/model/request/UpdateStatusRequest.java +++ b/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/model/req/UpdateStatusReq.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package top.charles7c.cnadmin.common.model.request; +package top.charles7c.cnadmin.common.model.req; import java.io.Serializable; @@ -34,7 +34,7 @@ */ @Data @Schema(description = "修改状态信息") -public class UpdateStatusRequest implements Serializable { +public class UpdateStatusReq implements Serializable { private static final long serialVersionUID = 1L; diff --git a/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/model/vo/CaptchaVO.java b/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/model/resp/CaptchaResp.java similarity index 93% rename from continew-admin-common/src/main/java/top/charles7c/cnadmin/common/model/vo/CaptchaVO.java rename to continew-admin-common/src/main/java/top/charles7c/cnadmin/common/model/resp/CaptchaResp.java index 33bb3dac5..63884467d 100644 --- a/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/model/vo/CaptchaVO.java +++ b/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/model/resp/CaptchaResp.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package top.charles7c.cnadmin.common.model.vo; +package top.charles7c.cnadmin.common.model.resp; import java.io.Serializable; @@ -32,7 +32,7 @@ @Data @Builder @Schema(description = "验证码信息") -public class CaptchaVO implements Serializable { +public class CaptchaResp implements Serializable { private static final long serialVersionUID = 1L; diff --git a/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/model/vo/LabelValueVO.java b/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/model/resp/LabelValueResp.java similarity index 85% rename from continew-admin-common/src/main/java/top/charles7c/cnadmin/common/model/vo/LabelValueVO.java rename to continew-admin-common/src/main/java/top/charles7c/cnadmin/common/model/resp/LabelValueResp.java index 782574737..ef264c792 100644 --- a/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/model/vo/LabelValueVO.java +++ b/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/model/resp/LabelValueResp.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package top.charles7c.cnadmin.common.model.vo; +package top.charles7c.cnadmin.common.model.resp; import java.io.Serializable; @@ -28,14 +28,14 @@ /** * 键值对信息 * - * @param + * @param * @author Charles7c * @since 2023/2/24 22:02 */ @Data @NoArgsConstructor @Schema(description = "键值对信息") -public class LabelValueVO implements Serializable { +public class LabelValueResp implements Serializable { private static final long serialVersionUID = 1L; @@ -49,7 +49,7 @@ public class LabelValueVO implements Serializable { * 值 */ @Schema(description = "值", example = "1") - private V value; + private T value; /** * 颜色 @@ -58,12 +58,12 @@ public class LabelValueVO implements Serializable { @JsonInclude(JsonInclude.Include.NON_NULL) private String color; - public LabelValueVO(String label, V value) { + public LabelValueResp(String label, T value) { this.label = label; this.value = value; } - public LabelValueVO(String label, V value, String color) { + public LabelValueResp(String label, T value, String color) { this.label = label; this.value = value; this.color = color; diff --git a/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/model/vo/PageDataVO.java b/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/model/resp/PageDataResp.java similarity index 67% rename from continew-admin-common/src/main/java/top/charles7c/cnadmin/common/model/vo/PageDataVO.java rename to continew-admin-common/src/main/java/top/charles7c/cnadmin/common/model/resp/PageDataResp.java index 17dd3043b..16107a9a9 100644 --- a/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/model/vo/PageDataVO.java +++ b/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/model/resp/PageDataResp.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package top.charles7c.cnadmin.common.model.vo; +package top.charles7c.cnadmin.common.model.resp; import java.io.Serializable; import java.util.ArrayList; @@ -32,14 +32,14 @@ /** * 分页信息 * - * @param + * @param * 列表数据类型 * @author Charles7c * @since 2023/1/14 23:40 */ @Data @Schema(description = "分页信息") -public class PageDataVO implements Serializable { +public class PageDataResp implements Serializable { private static final long serialVersionUID = 1L; @@ -47,7 +47,7 @@ public class PageDataVO implements Serializable { * 列表数据 */ @Schema(description = "列表数据") - private List list; + private List list; /** * 总记录数 @@ -64,18 +64,18 @@ public class PageDataVO implements Serializable { * 目标类型 Class 对象 * @param * 源列表数据类型 - * @param + * @param * 目标列表数据类型 * @return 分页信息 */ - public static PageDataVO build(IPage page, Class targetClass) { + public static PageDataResp build(IPage page, Class targetClass) { if (null == page) { return empty(); } - PageDataVO pageDataVO = new PageDataVO<>(); - pageDataVO.setList(BeanUtil.copyToList(page.getRecords(), targetClass)); - pageDataVO.setTotal(page.getTotal()); - return pageDataVO; + PageDataResp pageDataResp = new PageDataResp<>(); + pageDataResp.setList(BeanUtil.copyToList(page.getRecords(), targetClass)); + pageDataResp.setTotal(page.getTotal()); + return pageDataResp; } /** @@ -83,18 +83,18 @@ public static PageDataVO build(IPage page, Class targetClass) { * * @param page * MyBatis Plus 分页数据 - * @param + * @param * 列表数据类型 * @return 分页信息 */ - public static PageDataVO build(IPage page) { + public static PageDataResp build(IPage page) { if (null == page) { return empty(); } - PageDataVO pageDataVO = new PageDataVO<>(); - pageDataVO.setList(page.getRecords()); - pageDataVO.setTotal(page.getTotal()); - return pageDataVO; + PageDataResp pageDataResp = new PageDataResp<>(); + pageDataResp.setList(page.getRecords()); + pageDataResp.setTotal(page.getTotal()); + return pageDataResp; } /** @@ -106,39 +106,39 @@ public static PageDataVO build(IPage page) { * 每页条数 * @param list * 列表数据 - * @param + * @param * 列表数据类型 * @return 分页信息 */ - public static PageDataVO build(int page, int size, List list) { + public static PageDataResp build(int page, int size, List list) { if (CollUtil.isEmpty(list)) { return empty(); } - PageDataVO pageDataVO = new PageDataVO<>(); - pageDataVO.setTotal(list.size()); + PageDataResp pageDataResp = new PageDataResp<>(); + pageDataResp.setTotal(list.size()); // 对列表数据进行分页 int fromIndex = (page - 1) * size; int toIndex = page * size + size; if (fromIndex > list.size()) { - pageDataVO.setList(new ArrayList<>(0)); + pageDataResp.setList(new ArrayList<>(0)); } else if (toIndex >= list.size()) { - pageDataVO.setList(list.subList(fromIndex, list.size())); + pageDataResp.setList(list.subList(fromIndex, list.size())); } else { - pageDataVO.setList(list.subList(fromIndex, toIndex)); + pageDataResp.setList(list.subList(fromIndex, toIndex)); } - return pageDataVO; + return pageDataResp; } /** * 空分页信息 * - * @param + * @param * 列表数据类型 * @return 分页信息 */ - private static PageDataVO empty() { - PageDataVO pageDataVO = new PageDataVO<>(); - pageDataVO.setList(new ArrayList<>(0)); - return pageDataVO; + private static PageDataResp empty() { + PageDataResp pageDataResp = new PageDataResp<>(); + pageDataResp.setList(new ArrayList<>(0)); + return pageDataResp; } } diff --git a/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/model/vo/R.java b/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/model/resp/R.java similarity index 79% rename from continew-admin-common/src/main/java/top/charles7c/cnadmin/common/model/vo/R.java rename to continew-admin-common/src/main/java/top/charles7c/cnadmin/common/model/resp/R.java index f10189d3f..a2d50a66d 100644 --- a/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/model/vo/R.java +++ b/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/model/resp/R.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package top.charles7c.cnadmin.common.model.vo; +package top.charles7c.cnadmin.common.model.resp; import java.io.Serializable; @@ -37,7 +37,7 @@ @Data @NoArgsConstructor(access = AccessLevel.PRIVATE) @Schema(description = "响应信息") -public class R implements Serializable { +public class R implements Serializable { private static final long serialVersionUID = 1L; @@ -53,9 +53,9 @@ public class R implements Serializable { @Schema(description = "业务状态信息", example = "操作成功") private String msg; - /** 返回数据 */ - @Schema(description = "返回数据") - private V data; + /** 响应数据 */ + @Schema(description = "响应数据") + private T data; /** 时间戳 */ @Schema(description = "时间戳", example = "1691453288") @@ -66,46 +66,46 @@ public class R implements Serializable { /** 失败状态码 */ private static final int FAIL_CODE = HttpStatus.INTERNAL_SERVER_ERROR.value(); - private R(boolean success, int code, String msg, V data) { + private R(boolean success, int code, String msg, T data) { this.success = success; this.code = code; this.msg = msg; this.data = data; } - public static R ok() { + public static R ok() { return new R<>(true, SUCCESS_CODE, "操作成功", null); } - public static R ok(V data) { + public static R ok(T data) { return new R<>(true, SUCCESS_CODE, "操作成功", data); } - public static R ok(String msg) { + public static R ok(String msg) { return new R<>(true, SUCCESS_CODE, msg, null); } - public static R ok(String msg, V data) { + public static R ok(String msg, T data) { return new R<>(true, SUCCESS_CODE, msg, data); } - public static R fail() { + public static R fail() { return new R<>(false, FAIL_CODE, "操作失败", null); } - public static R fail(String msg) { + public static R fail(String msg) { return new R<>(false, FAIL_CODE, msg, null); } - public static R fail(V data) { + public static R fail(T data) { return new R<>(false, FAIL_CODE, "操作失败", data); } - public static R fail(String msg, V data) { + public static R fail(String msg, T data) { return new R<>(false, FAIL_CODE, msg, data); } - public static R fail(int code, String msg) { + public static R fail(int code, String msg) { return new R<>(false, code, msg, null); } } diff --git a/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/util/ExcelUtils.java b/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/util/ExcelUtils.java index 869070b2a..7793fe38c 100644 --- a/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/util/ExcelUtils.java +++ b/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/util/ExcelUtils.java @@ -57,7 +57,7 @@ public class ExcelUtils { * @param response * 响应对象 */ - public static void export(List list, String fileName, Class clazz, HttpServletResponse response) { + public static void export(List list, String fileName, Class clazz, HttpServletResponse response) { export(list, fileName, "Sheet1", clazz, response); } @@ -75,7 +75,7 @@ public static void export(List list, String fileName, Class clazz, Htt * @param response * 响应对象 */ - public static void export(List list, String fileName, String sheetName, Class clazz, + public static void export(List list, String fileName, String sheetName, Class clazz, HttpServletResponse response) { try { fileName = diff --git a/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/util/ServletUtils.java b/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/util/ServletUtils.java index c184580cc..4f636ecac 100644 --- a/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/util/ServletUtils.java +++ b/continew-admin-common/src/main/java/top/charles7c/cnadmin/common/util/ServletUtils.java @@ -61,7 +61,7 @@ public static HttpServletResponse getResponse() { * 获取浏览器及其版本信息 * * @param request - * 请求信息 + * 请求对象 * @return 浏览器及其版本信息 */ public static String getBrowser(HttpServletRequest request) { diff --git a/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/interceptor/LogInterceptor.java b/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/interceptor/LogInterceptor.java index 072b679ba..705a1fc21 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/interceptor/LogInterceptor.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/interceptor/LogInterceptor.java @@ -50,11 +50,11 @@ import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; -import top.charles7c.cnadmin.auth.model.request.AccountLoginRequest; +import top.charles7c.cnadmin.auth.model.req.AccountLoginReq; import top.charles7c.cnadmin.common.constant.StringConsts; import top.charles7c.cnadmin.common.constant.SysConsts; import top.charles7c.cnadmin.common.model.dto.LogContext; -import top.charles7c.cnadmin.common.model.vo.R; +import top.charles7c.cnadmin.common.model.resp.R; import top.charles7c.cnadmin.common.util.ExceptionUtils; import top.charles7c.cnadmin.common.util.IpUtils; import top.charles7c.cnadmin.common.util.ServletUtils; @@ -225,9 +225,9 @@ private void logRequest(LogDO logDO, HttpServletRequest request) { logDO.setCreateUser(null); } if (null == logDO.getCreateUser() && SysConsts.LOGIN_URI.equals(requestURI)) { - AccountLoginRequest loginRequest = JSONUtil.toBean(requestBody, AccountLoginRequest.class); + AccountLoginReq loginReq = JSONUtil.toBean(requestBody, AccountLoginReq.class); logDO.setCreateUser( - ExceptionUtils.exToNull(() -> userService.getByUsername(loginRequest.getUsername()).getId())); + ExceptionUtils.exToNull(() -> userService.getByUsername(loginReq.getUsername()).getId())); } if (StrUtil.isNotBlank(requestBody)) { if (JSONUtil.isTypeJSONObject(requestBody)) { diff --git a/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/mapper/LogMapper.java b/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/mapper/LogMapper.java index 5e8ed24c1..52edb3d6c 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/mapper/LogMapper.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/mapper/LogMapper.java @@ -23,9 +23,9 @@ import top.charles7c.cnadmin.common.base.BaseMapper; import top.charles7c.cnadmin.monitor.model.entity.LogDO; -import top.charles7c.cnadmin.monitor.model.vo.DashboardAccessTrendVO; -import top.charles7c.cnadmin.monitor.model.vo.DashboardPopularModuleVO; -import top.charles7c.cnadmin.monitor.model.vo.DashboardTotalVO; +import top.charles7c.cnadmin.monitor.model.resp.DashboardAccessTrendResp; +import top.charles7c.cnadmin.monitor.model.resp.DashboardPopularModuleResp; +import top.charles7c.cnadmin.monitor.model.resp.DashboardTotalResp; /** * 系统日志 Mapper @@ -40,7 +40,7 @@ public interface LogMapper extends BaseMapper { * * @return 仪表盘总计信息 */ - DashboardTotalVO selectDashboardTotal(); + DashboardTotalResp selectDashboardTotal(); /** * 查询仪表盘访问趋势信息 @@ -50,14 +50,14 @@ public interface LogMapper extends BaseMapper { * * @return 仪表盘访问趋势信息 */ - List selectListDashboardAccessTrend(@Param("days") Integer days); + List selectListDashboardAccessTrend(@Param("days") Integer days); /** * 查询仪表盘热门模块列表 * * @return 仪表盘热门模块列表 */ - List selectListDashboardPopularModule(); + List selectListDashboardPopularModule(); /** * 查询仪表盘访客地域分布信息 diff --git a/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/vo/DashboardAccessTrendVO.java b/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/resp/DashboardAccessTrendResp.java similarity index 91% rename from continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/vo/DashboardAccessTrendVO.java rename to continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/resp/DashboardAccessTrendResp.java index 3ff0719de..1862840bb 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/vo/DashboardAccessTrendVO.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/resp/DashboardAccessTrendResp.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package top.charles7c.cnadmin.monitor.model.vo; +package top.charles7c.cnadmin.monitor.model.resp; import java.io.Serializable; @@ -30,7 +30,7 @@ */ @Data @Schema(description = "仪表盘-访问趋势信息") -public class DashboardAccessTrendVO implements Serializable { +public class DashboardAccessTrendResp implements Serializable { private static final long serialVersionUID = 1L; diff --git a/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/vo/DashboardGeoDistributionVO.java b/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/resp/DashboardGeoDistributionResp.java similarity index 92% rename from continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/vo/DashboardGeoDistributionVO.java rename to continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/resp/DashboardGeoDistributionResp.java index ea3619dc1..4d6cf95aa 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/vo/DashboardGeoDistributionVO.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/resp/DashboardGeoDistributionResp.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package top.charles7c.cnadmin.monitor.model.vo; +package top.charles7c.cnadmin.monitor.model.resp; import java.io.Serializable; import java.util.List; @@ -32,7 +32,7 @@ */ @Data @Schema(description = "仪表盘-访客地域分布信息") -public class DashboardGeoDistributionVO implements Serializable { +public class DashboardGeoDistributionResp implements Serializable { private static final long serialVersionUID = 1L; diff --git a/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/vo/DashboardPopularModuleVO.java b/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/resp/DashboardPopularModuleResp.java similarity index 93% rename from continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/vo/DashboardPopularModuleVO.java rename to continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/resp/DashboardPopularModuleResp.java index f387e4d87..850c01bb1 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/vo/DashboardPopularModuleVO.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/resp/DashboardPopularModuleResp.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package top.charles7c.cnadmin.monitor.model.vo; +package top.charles7c.cnadmin.monitor.model.resp; import java.io.Serializable; import java.math.BigDecimal; @@ -33,7 +33,7 @@ */ @Data @Schema(description = "仪表盘-热门模块信息") -public class DashboardPopularModuleVO implements Serializable { +public class DashboardPopularModuleResp implements Serializable { private static final long serialVersionUID = 1L; diff --git a/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/vo/DashboardTotalVO.java b/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/resp/DashboardTotalResp.java similarity index 93% rename from continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/vo/DashboardTotalVO.java rename to continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/resp/DashboardTotalResp.java index 7bc642f5d..0deb7d74b 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/vo/DashboardTotalVO.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/resp/DashboardTotalResp.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package top.charles7c.cnadmin.monitor.model.vo; +package top.charles7c.cnadmin.monitor.model.resp; import java.io.Serializable; import java.math.BigDecimal; @@ -33,7 +33,7 @@ */ @Data @Schema(description = "仪表盘-总计信息") -public class DashboardTotalVO implements Serializable { +public class DashboardTotalResp implements Serializable { private static final long serialVersionUID = 1L; diff --git a/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/vo/LogVO.java b/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/resp/LogResp.java similarity index 93% rename from continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/vo/LogVO.java rename to continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/resp/LogResp.java index 38c0392ab..49943c494 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/vo/LogVO.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/resp/LogResp.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package top.charles7c.cnadmin.monitor.model.vo; +package top.charles7c.cnadmin.monitor.model.resp; import java.io.Serializable; import java.time.LocalDateTime; @@ -32,7 +32,7 @@ * @since 2023/1/17 21:43 */ @Data -public class LogVO implements Serializable { +public class LogResp implements Serializable { private static final long serialVersionUID = 1L; diff --git a/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/vo/LoginLogVO.java b/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/resp/LoginLogResp.java similarity index 95% rename from continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/vo/LoginLogVO.java rename to continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/resp/LoginLogResp.java index 2c42446ca..37471d4d6 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/vo/LoginLogVO.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/resp/LoginLogResp.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package top.charles7c.cnadmin.monitor.model.vo; +package top.charles7c.cnadmin.monitor.model.resp; import lombok.Data; @@ -30,7 +30,7 @@ */ @Data @Schema(description = "登录日志信息") -public class LoginLogVO extends LogVO { +public class LoginLogResp extends LogResp { private static final long serialVersionUID = 1L; diff --git a/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/vo/OperationLogVO.java b/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/resp/OperationLogResp.java similarity index 95% rename from continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/vo/OperationLogVO.java rename to continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/resp/OperationLogResp.java index eafa0b949..4a967e60c 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/vo/OperationLogVO.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/resp/OperationLogResp.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package top.charles7c.cnadmin.monitor.model.vo; +package top.charles7c.cnadmin.monitor.model.resp; import lombok.Data; @@ -30,7 +30,7 @@ */ @Data @Schema(description = "操作日志信息") -public class OperationLogVO extends LogVO { +public class OperationLogResp extends LogResp { private static final long serialVersionUID = 1L; diff --git a/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/vo/SystemLogDetailVO.java b/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/resp/SystemLogDetailResp.java similarity index 96% rename from continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/vo/SystemLogDetailVO.java rename to continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/resp/SystemLogDetailResp.java index 4133e6658..980940716 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/vo/SystemLogDetailVO.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/resp/SystemLogDetailResp.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package top.charles7c.cnadmin.monitor.model.vo; +package top.charles7c.cnadmin.monitor.model.resp; import lombok.Data; @@ -28,7 +28,7 @@ */ @Data @Schema(description = "系统日志详情信息") -public class SystemLogDetailVO extends LogVO { +public class SystemLogDetailResp extends LogResp { private static final long serialVersionUID = 1L; diff --git a/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/vo/SystemLogVO.java b/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/resp/SystemLogResp.java similarity index 95% rename from continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/vo/SystemLogVO.java rename to continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/resp/SystemLogResp.java index e6882ce7a..366214020 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/vo/SystemLogVO.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/resp/SystemLogResp.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package top.charles7c.cnadmin.monitor.model.vo; +package top.charles7c.cnadmin.monitor.model.resp; import lombok.Data; @@ -28,7 +28,7 @@ */ @Data @Schema(description = "系统日志信息") -public class SystemLogVO extends LogVO { +public class SystemLogResp extends LogResp { private static final long serialVersionUID = 1L; diff --git a/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/service/DashboardService.java b/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/service/DashboardService.java index 26b0faf2b..05e489583 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/service/DashboardService.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/service/DashboardService.java @@ -18,11 +18,11 @@ import java.util.List; -import top.charles7c.cnadmin.monitor.model.vo.DashboardAccessTrendVO; -import top.charles7c.cnadmin.monitor.model.vo.DashboardGeoDistributionVO; -import top.charles7c.cnadmin.monitor.model.vo.DashboardPopularModuleVO; -import top.charles7c.cnadmin.monitor.model.vo.DashboardTotalVO; -import top.charles7c.cnadmin.system.model.vo.DashboardAnnouncementVO; +import top.charles7c.cnadmin.monitor.model.resp.DashboardAccessTrendResp; +import top.charles7c.cnadmin.monitor.model.resp.DashboardGeoDistributionResp; +import top.charles7c.cnadmin.monitor.model.resp.DashboardPopularModuleResp; +import top.charles7c.cnadmin.monitor.model.resp.DashboardTotalResp; +import top.charles7c.cnadmin.system.model.resp.DashboardAnnouncementResp; /** * 仪表盘业务接口 @@ -37,7 +37,7 @@ public interface DashboardService { * * @return 总计信息 */ - DashboardTotalVO getTotal(); + DashboardTotalResp getTotal(); /** * 查询访问趋势信息 @@ -46,26 +46,26 @@ public interface DashboardService { * 日期数 * @return 访问趋势信息 */ - List listAccessTrend(Integer days); + List listAccessTrend(Integer days); /** * 查询热门模块列表 * * @return 热门模块列表 */ - List listPopularModule(); + List listPopularModule(); /** * 查询访客地域分布信息 * * @return 访客地域分布信息 */ - DashboardGeoDistributionVO getGeoDistribution(); + DashboardGeoDistributionResp getGeoDistribution(); /** * 查询公告列表 * * @return 公告列表 */ - List listAnnouncement(); + List listAnnouncement(); } diff --git a/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/service/LogService.java b/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/service/LogService.java index 46f4cf9e3..ad6f5bc65 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/service/LogService.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/service/LogService.java @@ -20,11 +20,11 @@ import java.util.Map; import top.charles7c.cnadmin.common.model.query.PageQuery; -import top.charles7c.cnadmin.common.model.vo.PageDataVO; +import top.charles7c.cnadmin.common.model.resp.PageDataResp; import top.charles7c.cnadmin.monitor.model.query.LoginLogQuery; import top.charles7c.cnadmin.monitor.model.query.OperationLogQuery; import top.charles7c.cnadmin.monitor.model.query.SystemLogQuery; -import top.charles7c.cnadmin.monitor.model.vo.*; +import top.charles7c.cnadmin.monitor.model.resp.*; /** * 系统日志业务接口 @@ -43,7 +43,7 @@ public interface LogService { * 分页查询条件 * @return 操作日志分页信息 */ - PageDataVO page(OperationLogQuery query, PageQuery pageQuery); + PageDataResp page(OperationLogQuery query, PageQuery pageQuery); /** * 分页查询登录日志列表 @@ -54,7 +54,7 @@ public interface LogService { * 分页查询条件 * @return 登录日志分页信息 */ - PageDataVO page(LoginLogQuery query, PageQuery pageQuery); + PageDataResp page(LoginLogQuery query, PageQuery pageQuery); /** * 分页查询系统日志列表 @@ -65,7 +65,7 @@ public interface LogService { * 分页查询条件 * @return 系统日志分页信息 */ - PageDataVO page(SystemLogQuery query, PageQuery pageQuery); + PageDataResp page(SystemLogQuery query, PageQuery pageQuery); /** * 查看系统日志详情 @@ -74,28 +74,28 @@ public interface LogService { * 日志 ID * @return 系统日志详情 */ - SystemLogDetailVO get(Long logId); + SystemLogDetailResp get(Long logId); /** * 查询仪表盘总计信息 * * @return 仪表盘总计信息 */ - DashboardTotalVO getDashboardTotal(); + DashboardTotalResp getDashboardTotal(); /** * 查询仪表盘访问趋势信息 * * @return 仪表盘访问趋势信息 */ - List listDashboardAccessTrend(Integer days); + List listDashboardAccessTrend(Integer days); /** * 查询仪表盘热门模块列表 * * @return 仪表盘热门模块列表 */ - List listDashboardPopularModule(); + List listDashboardPopularModule(); /** * 查询仪表盘访客地域分布信息 diff --git a/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/service/impl/DashboardServiceImpl.java b/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/service/impl/DashboardServiceImpl.java index 797ed2be9..aa7e5f00d 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/service/impl/DashboardServiceImpl.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/service/impl/DashboardServiceImpl.java @@ -31,13 +31,13 @@ import cn.hutool.core.util.NumberUtil; import top.charles7c.cnadmin.common.constant.CacheConsts; -import top.charles7c.cnadmin.monitor.model.vo.DashboardAccessTrendVO; -import top.charles7c.cnadmin.monitor.model.vo.DashboardGeoDistributionVO; -import top.charles7c.cnadmin.monitor.model.vo.DashboardPopularModuleVO; -import top.charles7c.cnadmin.monitor.model.vo.DashboardTotalVO; +import top.charles7c.cnadmin.monitor.model.resp.DashboardAccessTrendResp; +import top.charles7c.cnadmin.monitor.model.resp.DashboardGeoDistributionResp; +import top.charles7c.cnadmin.monitor.model.resp.DashboardPopularModuleResp; +import top.charles7c.cnadmin.monitor.model.resp.DashboardTotalResp; import top.charles7c.cnadmin.monitor.service.DashboardService; import top.charles7c.cnadmin.monitor.service.LogService; -import top.charles7c.cnadmin.system.model.vo.DashboardAnnouncementVO; +import top.charles7c.cnadmin.system.model.resp.DashboardAnnouncementResp; import top.charles7c.cnadmin.system.service.AnnouncementService; /** @@ -55,27 +55,27 @@ public class DashboardServiceImpl implements DashboardService { private final AnnouncementService announcementService; @Override - public DashboardTotalVO getTotal() { - DashboardTotalVO totalVO = logService.getDashboardTotal(); - Long todayPvCount = totalVO.getTodayPvCount(); - Long yesterdayPvCount = totalVO.getYesterdayPvCount(); + public DashboardTotalResp getTotal() { + DashboardTotalResp totalResp = logService.getDashboardTotal(); + Long todayPvCount = totalResp.getTodayPvCount(); + Long yesterdayPvCount = totalResp.getYesterdayPvCount(); BigDecimal newPvCountFromYesterday = NumberUtil.sub(todayPvCount, yesterdayPvCount); BigDecimal newPvFromYesterday = (0 == yesterdayPvCount) ? BigDecimal.valueOf(100) : NumberUtil.round(NumberUtil.mul(NumberUtil.div(newPvCountFromYesterday, yesterdayPvCount), 100), 1); - totalVO.setNewPvFromYesterday(newPvFromYesterday); - return totalVO; + totalResp.setNewPvFromYesterday(newPvFromYesterday); + return totalResp; } @Override @Cacheable(key = "#days") - public List listAccessTrend(Integer days) { + public List listAccessTrend(Integer days) { return logService.listDashboardAccessTrend(days); } @Override - public List listPopularModule() { - List popularModuleList = logService.listDashboardPopularModule(); - for (DashboardPopularModuleVO popularModule : popularModuleList) { + public List listPopularModule() { + List popularModuleList = logService.listDashboardPopularModule(); + for (DashboardPopularModuleResp popularModule : popularModuleList) { Long todayPvCount = popularModule.getTodayPvCount(); Long yesterdayPvCount = popularModule.getYesterdayPvCount(); BigDecimal newPvCountFromYesterday = NumberUtil.sub(todayPvCount, yesterdayPvCount); @@ -87,9 +87,9 @@ public List listPopularModule() { } @Override - public DashboardGeoDistributionVO getGeoDistribution() { + public DashboardGeoDistributionResp getGeoDistribution() { List> locationIpStatistics = logService.listDashboardGeoDistribution(); - DashboardGeoDistributionVO geoDistribution = new DashboardGeoDistributionVO(); + DashboardGeoDistributionResp geoDistribution = new DashboardGeoDistributionResp(); geoDistribution.setLocationIpStatistics(locationIpStatistics); geoDistribution.setLocations( locationIpStatistics.stream().map(m -> Convert.toStr(m.get("name"))).collect(Collectors.toList())); @@ -97,7 +97,7 @@ public DashboardGeoDistributionVO getGeoDistribution() { } @Override - public List listAnnouncement() { + public List listAnnouncement() { return announcementService.listDashboard(); } } diff --git a/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/service/impl/LogServiceImpl.java b/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/service/impl/LogServiceImpl.java index 864068cd9..b68f67658 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/service/impl/LogServiceImpl.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/service/impl/LogServiceImpl.java @@ -35,7 +35,7 @@ import top.charles7c.cnadmin.common.constant.SysConsts; import top.charles7c.cnadmin.common.model.query.PageQuery; -import top.charles7c.cnadmin.common.model.vo.PageDataVO; +import top.charles7c.cnadmin.common.model.resp.PageDataResp; import top.charles7c.cnadmin.common.service.CommonUserService; import top.charles7c.cnadmin.common.util.ExceptionUtils; import top.charles7c.cnadmin.common.util.ReflectUtils; @@ -46,7 +46,7 @@ import top.charles7c.cnadmin.monitor.model.query.LoginLogQuery; import top.charles7c.cnadmin.monitor.model.query.OperationLogQuery; import top.charles7c.cnadmin.monitor.model.query.SystemLogQuery; -import top.charles7c.cnadmin.monitor.model.vo.*; +import top.charles7c.cnadmin.monitor.model.resp.*; import top.charles7c.cnadmin.monitor.service.LogService; /** @@ -70,93 +70,93 @@ public void save(LogDO logDO) { } @Override - public PageDataVO page(OperationLogQuery query, PageQuery pageQuery) { + public PageDataResp page(OperationLogQuery query, PageQuery pageQuery) { QueryWrapper queryWrapper = QueryHelper.build(query); // 限定查询信息 - List fieldNameList = ReflectUtils.getNonStaticFieldsName(OperationLogVO.class); + List fieldNameList = ReflectUtils.getNonStaticFieldsName(OperationLogResp.class); List columnNameList = - fieldNameList.stream().filter(n -> !n.endsWith(SysConsts.VO_DESCRIPTION_FIELD_SUFFIX)) + fieldNameList.stream().filter(n -> !n.endsWith(SysConsts.DESCRIPTION_FIELD_SUFFIX)) .map(StrUtil::toUnderlineCase).collect(Collectors.toList()); queryWrapper.select(columnNameList); // 分页查询 IPage page = logMapper.selectPage(pageQuery.toPage(), queryWrapper); - PageDataVO pageDataVO = PageDataVO.build(page, OperationLogVO.class); + PageDataResp pageDataResp = PageDataResp.build(page, OperationLogResp.class); // 填充数据(如果是查询个人操作日志,只查询一次用户信息即可) if (null != query.getUid()) { String nickname = ExceptionUtils.exToNull(() -> commonUserService.getNicknameById(query.getUid())); - pageDataVO.getList().forEach(o -> o.setCreateUserString(nickname)); + pageDataResp.getList().forEach(o -> o.setCreateUserString(nickname)); } else { - pageDataVO.getList().forEach(this::fill); + pageDataResp.getList().forEach(this::fill); } - return pageDataVO; + return pageDataResp; } @Override - public PageDataVO page(LoginLogQuery query, PageQuery pageQuery) { + public PageDataResp page(LoginLogQuery query, PageQuery pageQuery) { QueryWrapper queryWrapper = QueryHelper.build(query); queryWrapper.eq("module", "登录"); // 限定查询信息 - List fieldNameList = ReflectUtils.getNonStaticFieldsName(LoginLogVO.class); + List fieldNameList = ReflectUtils.getNonStaticFieldsName(LoginLogResp.class); List columnNameList = - fieldNameList.stream().filter(n -> !n.endsWith(SysConsts.VO_DESCRIPTION_FIELD_SUFFIX)) + fieldNameList.stream().filter(n -> !n.endsWith(SysConsts.DESCRIPTION_FIELD_SUFFIX)) .map(StrUtil::toUnderlineCase).collect(Collectors.toList()); queryWrapper.select(columnNameList); // 分页查询 IPage page = logMapper.selectPage(pageQuery.toPage(), queryWrapper); - PageDataVO pageDataVO = PageDataVO.build(page, LoginLogVO.class); + PageDataResp pageDataResp = PageDataResp.build(page, LoginLogResp.class); // 填充数据 - pageDataVO.getList().forEach(this::fill); - return pageDataVO; + pageDataResp.getList().forEach(this::fill); + return pageDataResp; } @Override - public PageDataVO page(SystemLogQuery query, PageQuery pageQuery) { + public PageDataResp page(SystemLogQuery query, PageQuery pageQuery) { QueryWrapper queryWrapper = QueryHelper.build(query); // 限定查询信息 - List fieldNameList = ReflectUtils.getNonStaticFieldsName(SystemLogVO.class); + List fieldNameList = ReflectUtils.getNonStaticFieldsName(SystemLogResp.class); List columnNameList = - fieldNameList.stream().filter(n -> !n.endsWith(SysConsts.VO_DESCRIPTION_FIELD_SUFFIX)) + fieldNameList.stream().filter(n -> !n.endsWith(SysConsts.DESCRIPTION_FIELD_SUFFIX)) .map(StrUtil::toUnderlineCase).collect(Collectors.toList()); queryWrapper.select(columnNameList); // 分页查询 IPage page = logMapper.selectPage(pageQuery.toPage(), queryWrapper); - PageDataVO pageDataVO = PageDataVO.build(page, SystemLogVO.class); + PageDataResp pageDataResp = PageDataResp.build(page, SystemLogResp.class); // 填充数据 - pageDataVO.getList().forEach(this::fill); - return pageDataVO; + pageDataResp.getList().forEach(this::fill); + return pageDataResp; } @Override - public SystemLogDetailVO get(Long id) { + public SystemLogDetailResp get(Long id) { LogDO logDO = logMapper.selectById(id); CheckUtils.throwIfNotExists(logDO, "LogDO", "ID", id); - SystemLogDetailVO detailVO = BeanUtil.copyProperties(logDO, SystemLogDetailVO.class); + SystemLogDetailResp detailVO = BeanUtil.copyProperties(logDO, SystemLogDetailResp.class); this.fill(detailVO); return detailVO; } @Override - public DashboardTotalVO getDashboardTotal() { + public DashboardTotalResp getDashboardTotal() { return logMapper.selectDashboardTotal(); } @Override - public List listDashboardAccessTrend(Integer days) { + public List listDashboardAccessTrend(Integer days) { return logMapper.selectListDashboardAccessTrend(days); } @Override - public List listDashboardPopularModule() { + public List listDashboardPopularModule() { return logMapper.selectListDashboardPopularModule(); } @@ -168,14 +168,14 @@ public List> listDashboardGeoDistribution() { /** * 填充数据 * - * @param logVO + * @param logResp * 日志信息 */ - private void fill(LogVO logVO) { - Long createUser = logVO.getCreateUser(); + private void fill(LogResp logResp) { + Long createUser = logResp.getCreateUser(); if (null == createUser) { return; } - logVO.setCreateUserString(ExceptionUtils.exToNull(() -> commonUserService.getNicknameById(createUser))); + logResp.setCreateUserString(ExceptionUtils.exToNull(() -> commonUserService.getNicknameById(createUser))); } } diff --git a/continew-admin-monitor/src/main/resources/mapper/LogMapper.xml b/continew-admin-monitor/src/main/resources/mapper/LogMapper.xml index 3ec3efcec..3078ace40 100644 --- a/continew-admin-monitor/src/main/resources/mapper/LogMapper.xml +++ b/continew-admin-monitor/src/main/resources/mapper/LogMapper.xml @@ -1,7 +1,7 @@ - SELECT (SELECT COUNT(*) FROM `sys_log`) AS pvCount, (SELECT COUNT(DISTINCT `client_ip`) FROM `sys_log`) AS ipCount, @@ -10,7 +10,7 @@ + resultType="top.charles7c.cnadmin.system.model.resp.DashboardAnnouncementResp"> SELECT `id`, `title`, `type` FROM `sys_announcement` diff --git a/continew-admin-system/src/main/resources/mapper/DictItemMapper.xml b/continew-admin-system/src/main/resources/mapper/DictItemMapper.xml index 821d96811..9ae2bd616 100644 --- a/continew-admin-system/src/main/resources/mapper/DictItemMapper.xml +++ b/continew-admin-system/src/main/resources/mapper/DictItemMapper.xml @@ -1,7 +1,7 @@ - SELECT t1.`label`, t1.`value`, t1.`color` FROM `sys_dict_item` AS t1 LEFT JOIN `sys_dict` AS t2 ON t1.`dict_id` = t2.`id` diff --git a/continew-admin-system/src/main/resources/mapper/MessageMapper.xml b/continew-admin-system/src/main/resources/mapper/MessageMapper.xml index 76b96b0b4..d33bf8bb0 100644 --- a/continew-admin-system/src/main/resources/mapper/MessageMapper.xml +++ b/continew-admin-system/src/main/resources/mapper/MessageMapper.xml @@ -1,7 +1,7 @@ - SELECT t1.*, t2.`user_id`, diff --git a/continew-admin-tool/src/main/java/top/charles7c/cnadmin/tool/model/request/GenConfigRequest.java b/continew-admin-tool/src/main/java/top/charles7c/cnadmin/tool/model/req/GenConfigReq.java similarity index 93% rename from continew-admin-tool/src/main/java/top/charles7c/cnadmin/tool/model/request/GenConfigRequest.java rename to continew-admin-tool/src/main/java/top/charles7c/cnadmin/tool/model/req/GenConfigReq.java index 16e24a1fa..38ca207a1 100644 --- a/continew-admin-tool/src/main/java/top/charles7c/cnadmin/tool/model/request/GenConfigRequest.java +++ b/continew-admin-tool/src/main/java/top/charles7c/cnadmin/tool/model/req/GenConfigReq.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package top.charles7c.cnadmin.tool.model.request; +package top.charles7c.cnadmin.tool.model.req; import java.io.Serializable; import java.util.ArrayList; @@ -38,7 +38,7 @@ */ @Data @Schema(description = "代码生成配置信息") -public class GenConfigRequest implements Serializable { +public class GenConfigReq implements Serializable { private static final long serialVersionUID = 1L; diff --git a/continew-admin-tool/src/main/java/top/charles7c/cnadmin/tool/model/vo/TableVO.java b/continew-admin-tool/src/main/java/top/charles7c/cnadmin/tool/model/resp/TableResp.java similarity index 94% rename from continew-admin-tool/src/main/java/top/charles7c/cnadmin/tool/model/vo/TableVO.java rename to continew-admin-tool/src/main/java/top/charles7c/cnadmin/tool/model/resp/TableResp.java index 0ac08d373..548309e0e 100644 --- a/continew-admin-tool/src/main/java/top/charles7c/cnadmin/tool/model/vo/TableVO.java +++ b/continew-admin-tool/src/main/java/top/charles7c/cnadmin/tool/model/resp/TableResp.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package top.charles7c.cnadmin.tool.model.vo; +package top.charles7c.cnadmin.tool.model.resp; import java.io.Serializable; import java.time.LocalDateTime; @@ -31,7 +31,7 @@ */ @Data @Schema(description = "表信息") -public class TableVO implements Serializable { +public class TableResp implements Serializable { private static final long serialVersionUID = 1L; diff --git a/continew-admin-tool/src/main/java/top/charles7c/cnadmin/tool/service/GeneratorService.java b/continew-admin-tool/src/main/java/top/charles7c/cnadmin/tool/service/GeneratorService.java index 2ad614fa2..c3411b420 100644 --- a/continew-admin-tool/src/main/java/top/charles7c/cnadmin/tool/service/GeneratorService.java +++ b/continew-admin-tool/src/main/java/top/charles7c/cnadmin/tool/service/GeneratorService.java @@ -20,12 +20,12 @@ import java.util.List; import top.charles7c.cnadmin.common.model.query.PageQuery; -import top.charles7c.cnadmin.common.model.vo.PageDataVO; +import top.charles7c.cnadmin.common.model.resp.PageDataResp; import top.charles7c.cnadmin.tool.model.entity.FieldConfigDO; import top.charles7c.cnadmin.tool.model.entity.GenConfigDO; import top.charles7c.cnadmin.tool.model.query.TableQuery; -import top.charles7c.cnadmin.tool.model.request.GenConfigRequest; -import top.charles7c.cnadmin.tool.model.vo.TableVO; +import top.charles7c.cnadmin.tool.model.req.GenConfigReq; +import top.charles7c.cnadmin.tool.model.resp.TableResp; /** * 代码生成业务接口 @@ -46,7 +46,7 @@ public interface GeneratorService { * @throws SQLException * / */ - PageDataVO pageTable(TableQuery query, PageQuery pageQuery) throws SQLException; + PageDataResp pageTable(TableQuery query, PageQuery pageQuery) throws SQLException; /** * 查询生成配置信息 @@ -73,12 +73,12 @@ public interface GeneratorService { /** * 保存代码生成配置信息 * - * @param request + * @param req * 代码生成配置信息 * @param tableName * 表名称 */ - void saveConfig(GenConfigRequest request, String tableName); + void saveConfig(GenConfigReq req, String tableName); /** * 生成代码 diff --git a/continew-admin-tool/src/main/java/top/charles7c/cnadmin/tool/service/impl/GeneratorServiceImpl.java b/continew-admin-tool/src/main/java/top/charles7c/cnadmin/tool/service/impl/GeneratorServiceImpl.java index 4ba4620f3..2d5d322e5 100644 --- a/continew-admin-tool/src/main/java/top/charles7c/cnadmin/tool/service/impl/GeneratorServiceImpl.java +++ b/continew-admin-tool/src/main/java/top/charles7c/cnadmin/tool/service/impl/GeneratorServiceImpl.java @@ -47,7 +47,7 @@ import top.charles7c.cnadmin.common.enums.QueryTypeEnum; import top.charles7c.cnadmin.common.exception.ServiceException; import top.charles7c.cnadmin.common.model.query.PageQuery; -import top.charles7c.cnadmin.common.model.vo.PageDataVO; +import top.charles7c.cnadmin.common.model.resp.PageDataResp; import top.charles7c.cnadmin.common.util.TemplateUtils; import top.charles7c.cnadmin.common.util.validate.CheckUtils; import top.charles7c.cnadmin.tool.config.properties.GeneratorProperties; @@ -57,8 +57,8 @@ import top.charles7c.cnadmin.tool.model.entity.FieldConfigDO; import top.charles7c.cnadmin.tool.model.entity.GenConfigDO; import top.charles7c.cnadmin.tool.model.query.TableQuery; -import top.charles7c.cnadmin.tool.model.request.GenConfigRequest; -import top.charles7c.cnadmin.tool.model.vo.TableVO; +import top.charles7c.cnadmin.tool.model.req.GenConfigReq; +import top.charles7c.cnadmin.tool.model.resp.TableResp; import top.charles7c.cnadmin.tool.service.GeneratorService; import top.charles7c.cnadmin.tool.util.MetaUtils; import top.charles7c.cnadmin.tool.util.Table; @@ -80,7 +80,7 @@ public class GeneratorServiceImpl implements GeneratorService { private final GenConfigMapper genConfigMapper; @Override - public PageDataVO pageTable(TableQuery query, PageQuery pageQuery) throws SQLException { + public PageDataResp pageTable(TableQuery query, PageQuery pageQuery) throws SQLException { List tableList = MetaUtils.getTables(dataSource); String tableName = query.getTableName(); if (StrUtil.isNotBlank(tableName)) { @@ -91,14 +91,15 @@ public PageDataVO pageTable(TableQuery query, PageQuery pageQuery) thro Comparator.comparing(Table::getCreateTime) .thenComparing(table -> Optional.ofNullable(table.getUpdateTime()).orElse(table.getCreateTime())) .reversed()); - List tableVOList = BeanUtil.copyToList(tableList, TableVO.class); - PageDataVO pageDataVO = PageDataVO.build(pageQuery.getPage(), pageQuery.getSize(), tableVOList); - for (TableVO tableVO : pageDataVO.getList()) { + List tableRespList = BeanUtil.copyToList(tableList, TableResp.class); + PageDataResp pageDataResp = + PageDataResp.build(pageQuery.getPage(), pageQuery.getSize(), tableRespList); + for (TableResp tableResp : pageDataResp.getList()) { long count = genConfigMapper.selectCount( - Wrappers.lambdaQuery(GenConfigDO.class).eq(GenConfigDO::getTableName, tableVO.getTableName())); - tableVO.setIsConfiged(count > 0); + Wrappers.lambdaQuery(GenConfigDO.class).eq(GenConfigDO::getTableName, tableResp.getTableName())); + tableResp.setIsConfiged(count > 0); } - return pageDataVO; + return pageDataResp; } @Override @@ -166,10 +167,10 @@ public List listFieldConfig(String tableName, Boolean requireSync @Override @Transactional(rollbackFor = Exception.class) - public void saveConfig(GenConfigRequest request, String tableName) { + public void saveConfig(GenConfigReq req, String tableName) { // 保存字段配置 fieldConfigMapper.delete(Wrappers.lambdaQuery(FieldConfigDO.class).eq(FieldConfigDO::getTableName, tableName)); - List fieldConfigList = request.getFieldConfigs(); + List fieldConfigList = req.getFieldConfigs(); for (FieldConfigDO fieldConfig : fieldConfigList) { if (fieldConfig.getShowInForm()) { CheckUtils.throwIfNull(fieldConfig.getFormType(), "字段 [{}] 的表单类型不能为空", fieldConfig.getFieldName()); @@ -193,7 +194,7 @@ public void saveConfig(GenConfigRequest request, String tableName) { fieldConfigMapper.insertBatch(fieldConfigList); // 保存或更新生成配置信息 - GenConfigDO newGenConfig = request.getGenConfig(); + GenConfigDO newGenConfig = req.getGenConfig(); String frontendPath = newGenConfig.getFrontendPath(); if (StrUtil.isNotBlank(frontendPath)) { CheckUtils.throwIf(!StrUtil.containsAll(frontendPath, "src", "views"), "前端路径配置错误"); diff --git a/continew-admin-tool/src/main/resources/templates/generator/Controller.ftl b/continew-admin-tool/src/main/resources/templates/generator/Controller.ftl index 1c2c7ede8..28f50f55a 100644 --- a/continew-admin-tool/src/main/resources/templates/generator/Controller.ftl +++ b/continew-admin-tool/src/main/resources/templates/generator/Controller.ftl @@ -25,9 +25,9 @@ import org.springframework.web.bind.annotation.*; import top.charles7c.cnadmin.common.annotation.CrudRequestMapping; import top.charles7c.cnadmin.common.base.BaseController; import ${packageName}.model.query.${classNamePrefix}Query; -import ${packageName}.model.request.${classNamePrefix}Request; -import ${packageName}.model.vo.${classNamePrefix}DetailVO; -import ${packageName}.model.vo.${classNamePrefix}VO; +import ${packageName}.model.req.${classNamePrefix}Req; +import ${packageName}.model.resp.${classNamePrefix}DetailResp; +import ${packageName}.model.resp.${classNamePrefix}Resp; import ${packageName}.service.${classNamePrefix}Service; /** @@ -39,4 +39,4 @@ import ${packageName}.service.${classNamePrefix}Service; @Tag(name = "${businessName}管理 API") @RestController @CrudRequestMapping(value = "/${apiModuleName}/${apiName}", api = {Api.PAGE, Api.GET, Api.ADD, Api.UPDATE, Api.DELETE, Api.EXPORT}) -public class ${className} extends BaseController<${classNamePrefix}Service, ${classNamePrefix}VO, ${classNamePrefix}DetailVO, ${classNamePrefix}Query, ${classNamePrefix}Request> {} \ No newline at end of file +public class ${className} extends BaseController<${classNamePrefix}Service, ${classNamePrefix}Resp, ${classNamePrefix}DetailResp, ${classNamePrefix}Query, ${classNamePrefix}Req> {} \ No newline at end of file diff --git a/continew-admin-tool/src/main/resources/templates/generator/DetailVO.ftl b/continew-admin-tool/src/main/resources/templates/generator/DetailResp.ftl similarity index 93% rename from continew-admin-tool/src/main/resources/templates/generator/DetailVO.ftl rename to continew-admin-tool/src/main/resources/templates/generator/DetailResp.ftl index 542cd0f91..07ec614c5 100644 --- a/continew-admin-tool/src/main/resources/templates/generator/DetailVO.ftl +++ b/continew-admin-tool/src/main/resources/templates/generator/DetailResp.ftl @@ -30,7 +30,7 @@ import io.swagger.v3.oas.annotations.media.Schema; import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; import com.alibaba.excel.annotation.ExcelProperty; -import top.charles7c.cnadmin.common.base.BaseDetailVO; +import top.charles7c.cnadmin.common.base.BaseDetailResp; /** * ${businessName}详情信息 @@ -41,7 +41,7 @@ import top.charles7c.cnadmin.common.base.BaseDetailVO; @Data @ExcelIgnoreUnannotated @Schema(description = "${businessName}详情信息") -public class ${className} extends BaseDetailVO { +public class ${className} extends BaseDetailResp { private static final long serialVersionUID = 1L; <#if fieldConfigs??> diff --git a/continew-admin-tool/src/main/resources/templates/generator/Request.ftl b/continew-admin-tool/src/main/resources/templates/generator/Req.ftl similarity index 94% rename from continew-admin-tool/src/main/resources/templates/generator/Request.ftl rename to continew-admin-tool/src/main/resources/templates/generator/Req.ftl index 084163789..36a0dd1e6 100644 --- a/continew-admin-tool/src/main/resources/templates/generator/Request.ftl +++ b/continew-admin-tool/src/main/resources/templates/generator/Req.ftl @@ -31,7 +31,7 @@ import lombok.Data; import io.swagger.v3.oas.annotations.media.Schema; -import top.charles7c.cnadmin.common.base.BaseRequest; +import top.charles7c.cnadmin.common.base.BaseReq; /** * 创建或修改${businessName}信息 @@ -41,7 +41,7 @@ import top.charles7c.cnadmin.common.base.BaseRequest; */ @Data @Schema(description = "创建或修改${businessName}信息") -public class ${className} extends BaseRequest { +public class ${className} extends BaseReq { private static final long serialVersionUID = 1L; <#if fieldConfigs??> diff --git a/continew-admin-tool/src/main/resources/templates/generator/VO.ftl b/continew-admin-tool/src/main/resources/templates/generator/Resp.ftl similarity index 93% rename from continew-admin-tool/src/main/resources/templates/generator/VO.ftl rename to continew-admin-tool/src/main/resources/templates/generator/Resp.ftl index c93a10a63..8c6b9a3e5 100644 --- a/continew-admin-tool/src/main/resources/templates/generator/VO.ftl +++ b/continew-admin-tool/src/main/resources/templates/generator/Resp.ftl @@ -27,7 +27,7 @@ import lombok.Data; import io.swagger.v3.oas.annotations.media.Schema; -import top.charles7c.cnadmin.common.base.BaseVO; +import top.charles7c.cnadmin.common.base.BaseResp; /** * ${businessName}信息 @@ -37,7 +37,7 @@ import top.charles7c.cnadmin.common.base.BaseVO; */ @Data @Schema(description = "${businessName}信息") -public class ${className} extends BaseVO { +public class ${className} extends BaseResp { private static final long serialVersionUID = 1L; <#if fieldConfigs??> diff --git a/continew-admin-tool/src/main/resources/templates/generator/Service.ftl b/continew-admin-tool/src/main/resources/templates/generator/Service.ftl index 7ce48b027..67c2b908c 100644 --- a/continew-admin-tool/src/main/resources/templates/generator/Service.ftl +++ b/continew-admin-tool/src/main/resources/templates/generator/Service.ftl @@ -18,9 +18,9 @@ package ${packageName}.${subPackageName}; import top.charles7c.cnadmin.common.base.BaseService; import ${packageName}.model.query.${classNamePrefix}Query; -import ${packageName}.model.request.${classNamePrefix}Request; -import ${packageName}.model.vo.${classNamePrefix}DetailVO; -import ${packageName}.model.vo.${classNamePrefix}VO; +import ${packageName}.model.req.${classNamePrefix}Req; +import ${packageName}.model.resp.${classNamePrefix}DetailResp; +import ${packageName}.model.resp.${classNamePrefix}Resp; /** * ${businessName}业务接口 @@ -28,4 +28,4 @@ import ${packageName}.model.vo.${classNamePrefix}VO; * @author ${author} * @since ${date} */ -public interface ${className} extends BaseService<${classNamePrefix}VO, ${classNamePrefix}DetailVO, ${classNamePrefix}Query, ${classNamePrefix}Request> {} \ No newline at end of file +public interface ${className} extends BaseService<${classNamePrefix}Resp, ${classNamePrefix}DetailResp, ${classNamePrefix}Query, ${classNamePrefix}Req> {} \ No newline at end of file diff --git a/continew-admin-tool/src/main/resources/templates/generator/ServiceImpl.ftl b/continew-admin-tool/src/main/resources/templates/generator/ServiceImpl.ftl index 7089dc22a..3d1d21e89 100644 --- a/continew-admin-tool/src/main/resources/templates/generator/ServiceImpl.ftl +++ b/continew-admin-tool/src/main/resources/templates/generator/ServiceImpl.ftl @@ -24,9 +24,9 @@ import top.charles7c.cnadmin.common.base.BaseServiceImpl; import ${packageName}.mapper.${classNamePrefix}Mapper; import ${packageName}.model.entity.${classNamePrefix}DO; import ${packageName}.model.query.${classNamePrefix}Query; -import ${packageName}.model.request.${classNamePrefix}Request; -import ${packageName}.model.vo.${classNamePrefix}DetailVO; -import ${packageName}.model.vo.${classNamePrefix}VO; +import ${packageName}.model.req.${classNamePrefix}Req; +import ${packageName}.model.resp.${classNamePrefix}DetailResp; +import ${packageName}.model.resp.${classNamePrefix}Resp; import ${packageName}.service.${classNamePrefix}Service; /** @@ -37,4 +37,4 @@ import ${packageName}.service.${classNamePrefix}Service; */ @Service @RequiredArgsConstructor -public class ${className} extends BaseServiceImpl<${classNamePrefix}Mapper, ${classNamePrefix}DO, ${classNamePrefix}VO, ${classNamePrefix}DetailVO, ${classNamePrefix}Query, ${classNamePrefix}Request> implements ${classNamePrefix}Service {} \ No newline at end of file +public class ${className} extends BaseServiceImpl<${classNamePrefix}Mapper, ${classNamePrefix}DO, ${classNamePrefix}Resp, ${classNamePrefix}DetailResp, ${classNamePrefix}Query, ${classNamePrefix}Req> implements ${classNamePrefix}Service {} \ No newline at end of file diff --git a/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/auth/AuthController.java b/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/auth/AuthController.java index 2bcc4344d..b3febdb45 100644 --- a/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/auth/AuthController.java +++ b/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/auth/AuthController.java @@ -32,12 +32,12 @@ import cn.dev33.satoken.stp.StpUtil; import cn.hutool.core.bean.BeanUtil; -import top.charles7c.cnadmin.auth.model.request.AccountLoginRequest; -import top.charles7c.cnadmin.auth.model.request.EmailLoginRequest; -import top.charles7c.cnadmin.auth.model.request.PhoneLoginRequest; -import top.charles7c.cnadmin.auth.model.vo.LoginVO; -import top.charles7c.cnadmin.auth.model.vo.RouteVO; -import top.charles7c.cnadmin.auth.model.vo.UserInfoVO; +import top.charles7c.cnadmin.auth.model.req.AccountLoginReq; +import top.charles7c.cnadmin.auth.model.req.EmailLoginReq; +import top.charles7c.cnadmin.auth.model.req.PhoneLoginReq; +import top.charles7c.cnadmin.auth.model.resp.LoginResp; +import top.charles7c.cnadmin.auth.model.resp.RouteResp; +import top.charles7c.cnadmin.auth.model.resp.UserInfoResp; import top.charles7c.cnadmin.auth.service.LoginService; import top.charles7c.cnadmin.common.constant.CacheConsts; import top.charles7c.cnadmin.common.model.dto.LoginUser; @@ -47,7 +47,7 @@ import top.charles7c.cnadmin.common.util.helper.LoginHelper; import top.charles7c.cnadmin.common.util.validate.ValidationUtils; import top.charles7c.cnadmin.monitor.annotation.Log; -import top.charles7c.cnadmin.system.model.vo.UserDetailVO; +import top.charles7c.cnadmin.system.model.resp.UserDetailResp; import top.charles7c.cnadmin.system.service.UserService; /** @@ -69,46 +69,45 @@ public class AuthController { @SaIgnore @Operation(summary = "账号登录", description = "根据账号和密码进行登录认证") @PostMapping("/account") - public LoginVO accountLogin(@Validated @RequestBody AccountLoginRequest loginRequest) { - String captchaKey = RedisUtils.formatKey(CacheConsts.CAPTCHA_KEY_PREFIX, loginRequest.getUuid()); + public LoginResp accountLogin(@Validated @RequestBody AccountLoginReq loginReq) { + String captchaKey = RedisUtils.formatKey(CacheConsts.CAPTCHA_KEY_PREFIX, loginReq.getUuid()); String captcha = RedisUtils.getCacheObject(captchaKey); ValidationUtils.throwIfBlank(captcha, "验证码已失效"); RedisUtils.deleteCacheObject(captchaKey); - ValidationUtils.throwIfNotEqualIgnoreCase(loginRequest.getCaptcha(), captcha, "验证码错误"); + ValidationUtils.throwIfNotEqualIgnoreCase(loginReq.getCaptcha(), captcha, "验证码错误"); // 用户登录 - String rawPassword = - ExceptionUtils.exToNull(() -> SecureUtils.decryptByRsaPrivateKey(loginRequest.getPassword())); + String rawPassword = ExceptionUtils.exToNull(() -> SecureUtils.decryptByRsaPrivateKey(loginReq.getPassword())); ValidationUtils.throwIfBlank(rawPassword, "密码解密失败"); - String token = loginService.accountLogin(loginRequest.getUsername(), rawPassword); - return LoginVO.builder().token(token).build(); + String token = loginService.accountLogin(loginReq.getUsername(), rawPassword); + return LoginResp.builder().token(token).build(); } @SaIgnore @Operation(summary = "邮箱登录", description = "根据邮箱和验证码进行登录认证") @PostMapping("/email") - public LoginVO emailLogin(@Validated @RequestBody EmailLoginRequest loginRequest) { - String email = loginRequest.getEmail(); + public LoginResp emailLogin(@Validated @RequestBody EmailLoginReq loginReq) { + String email = loginReq.getEmail(); String captchaKey = RedisUtils.formatKey(CacheConsts.CAPTCHA_KEY_PREFIX, email); String captcha = RedisUtils.getCacheObject(captchaKey); ValidationUtils.throwIfBlank(captcha, "验证码已失效"); - ValidationUtils.throwIfNotEqualIgnoreCase(loginRequest.getCaptcha(), captcha, "验证码错误"); + ValidationUtils.throwIfNotEqualIgnoreCase(loginReq.getCaptcha(), captcha, "验证码错误"); RedisUtils.deleteCacheObject(captchaKey); String token = loginService.emailLogin(email); - return LoginVO.builder().token(token).build(); + return LoginResp.builder().token(token).build(); } @SaIgnore @Operation(summary = "手机号登录", description = "根据手机号和验证码进行登录认证") @PostMapping("/phone") - public LoginVO phoneLogin(@Validated @RequestBody PhoneLoginRequest loginRequest) { - String phone = loginRequest.getPhone(); + public LoginResp phoneLogin(@Validated @RequestBody PhoneLoginReq loginReq) { + String phone = loginReq.getPhone(); String captchaKey = RedisUtils.formatKey(CacheConsts.CAPTCHA_KEY_PREFIX, phone); String captcha = RedisUtils.getCacheObject(captchaKey); ValidationUtils.throwIfBlank(captcha, "验证码已失效"); - ValidationUtils.throwIfNotEqualIgnoreCase(loginRequest.getCaptcha(), captcha, "验证码错误"); + ValidationUtils.throwIfNotEqualIgnoreCase(loginReq.getCaptcha(), captcha, "验证码错误"); RedisUtils.deleteCacheObject(captchaKey); String token = loginService.phoneLogin(phone); - return LoginVO.builder().token(token).build(); + return LoginResp.builder().token(token).build(); } @SaIgnore @@ -123,19 +122,19 @@ public void logout() { @Log(ignore = true) @Operation(summary = "获取用户信息", description = "获取登录用户信息") @GetMapping("/user/info") - public UserInfoVO getUserInfo() { + public UserInfoResp getUserInfo() { LoginUser loginUser = LoginHelper.getLoginUser(); - UserDetailVO userDetailVO = userService.get(loginUser.getId()); - UserInfoVO userInfoVO = BeanUtil.copyProperties(userDetailVO, UserInfoVO.class); - userInfoVO.setPermissions(loginUser.getPermissions()); - userInfoVO.setRoles(loginUser.getRoleCodes()); - return userInfoVO; + UserDetailResp userDetailResp = userService.get(loginUser.getId()); + UserInfoResp userInfoResp = BeanUtil.copyProperties(userDetailResp, UserInfoResp.class); + userInfoResp.setPermissions(loginUser.getPermissions()); + userInfoResp.setRoles(loginUser.getRoleCodes()); + return userInfoResp; } @Log(ignore = true) @Operation(summary = "获取路由信息", description = "获取登录用户的路由信息") @GetMapping("/route") - public List listRoute() { + public List listRoute() { Long userId = LoginHelper.getUserId(); return loginService.buildRouteTree(userId); } diff --git a/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/auth/SocialAuthController.java b/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/auth/SocialAuthController.java index 9a23af421..44dde1a6b 100644 --- a/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/auth/SocialAuthController.java +++ b/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/auth/SocialAuthController.java @@ -30,10 +30,10 @@ import cn.dev33.satoken.annotation.SaIgnore; import cn.dev33.satoken.stp.StpUtil; -import top.charles7c.cnadmin.auth.model.vo.LoginVO; +import top.charles7c.cnadmin.auth.model.resp.LoginResp; import top.charles7c.cnadmin.auth.service.LoginService; import top.charles7c.cnadmin.common.exception.BadRequestException; -import top.charles7c.cnadmin.common.model.vo.R; +import top.charles7c.cnadmin.common.model.resp.R; import top.charles7c.cnadmin.common.util.validate.ValidationUtils; import top.charles7c.cnadmin.monitor.annotation.Log; @@ -71,7 +71,7 @@ public R authorize(@PathVariable String source) { @Operation(summary = "三方账号登录", description = "三方账号登录") @Parameter(name = "source", description = "来源", example = "gitee", in = ParameterIn.PATH) @PostMapping("/{source}") - public LoginVO login(@PathVariable String source, @RequestBody AuthCallback callback) { + public LoginResp login(@PathVariable String source, @RequestBody AuthCallback callback) { if (StpUtil.isLogin()) { StpUtil.logout(); } @@ -80,7 +80,7 @@ public LoginVO login(@PathVariable String source, @RequestBody AuthCallback call ValidationUtils.throwIf(!response.ok(), response.getMsg()); AuthUser authUser = response.getData(); String token = loginService.socialLogin(authUser); - return LoginVO.builder().token(token).build(); + return LoginResp.builder().token(token).build(); } private AuthRequest getAuthRequest(String source) { diff --git a/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/common/CaptchaController.java b/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/common/CaptchaController.java index afae54cea..9b1a4115d 100644 --- a/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/common/CaptchaController.java +++ b/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/common/CaptchaController.java @@ -50,8 +50,8 @@ import top.charles7c.cnadmin.common.config.properties.ProjectProperties; import top.charles7c.cnadmin.common.constant.CacheConsts; import top.charles7c.cnadmin.common.constant.RegexConsts; -import top.charles7c.cnadmin.common.model.vo.CaptchaVO; -import top.charles7c.cnadmin.common.model.vo.R; +import top.charles7c.cnadmin.common.model.resp.CaptchaResp; +import top.charles7c.cnadmin.common.model.resp.R; import top.charles7c.cnadmin.common.util.MailUtils; import top.charles7c.cnadmin.common.util.RedisUtils; import top.charles7c.cnadmin.common.util.TemplateUtils; @@ -76,7 +76,7 @@ public class CaptchaController { @Operation(summary = "获取图片验证码", description = "获取图片验证码(Base64编码,带图片格式:data:image/gif;base64)") @GetMapping("/img") - public CaptchaVO getImageCaptcha() { + public CaptchaResp getImageCaptcha() { // 生成验证码 CaptchaProperties.CaptchaImage captchaImage = captchaProperties.getImage(); Captcha captcha = captchaImage.getCaptcha(); @@ -85,7 +85,7 @@ public CaptchaVO getImageCaptcha() { String captchaKey = RedisUtils.formatKey(CacheConsts.CAPTCHA_KEY_PREFIX, uuid); RedisUtils.setCacheObject(captchaKey, captcha.text(), Duration.ofMinutes(captchaImage.getExpirationInMinutes())); - return CaptchaVO.builder().uuid(uuid).img(captcha.toBase64()).build(); + return CaptchaResp.builder().uuid(uuid).img(captcha.toBase64()).build(); } @Operation(summary = "获取邮箱验证码", description = "发送验证码到指定邮箱") diff --git a/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/common/CommonController.java b/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/common/CommonController.java index 63ed876f4..1ad9a7498 100644 --- a/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/common/CommonController.java +++ b/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/common/CommonController.java @@ -47,8 +47,8 @@ import top.charles7c.cnadmin.common.config.properties.ProjectProperties; import top.charles7c.cnadmin.common.constant.CacheConsts; import top.charles7c.cnadmin.common.model.query.SortQuery; -import top.charles7c.cnadmin.common.model.vo.LabelValueVO; -import top.charles7c.cnadmin.common.model.vo.R; +import top.charles7c.cnadmin.common.model.resp.LabelValueResp; +import top.charles7c.cnadmin.common.model.resp.R; import top.charles7c.cnadmin.common.util.FileUtils; import top.charles7c.cnadmin.common.util.validate.CheckUtils; import top.charles7c.cnadmin.common.util.validate.ValidationUtils; @@ -57,7 +57,7 @@ import top.charles7c.cnadmin.system.model.query.MenuQuery; import top.charles7c.cnadmin.system.model.query.OptionQuery; import top.charles7c.cnadmin.system.model.query.RoleQuery; -import top.charles7c.cnadmin.system.model.vo.RoleVO; +import top.charles7c.cnadmin.system.model.resp.RoleResp; import top.charles7c.cnadmin.system.service.*; /** @@ -109,8 +109,8 @@ public List> listMenuTree(MenuQuery query, SortQuery sortQuery) { @Operation(summary = "查询角色字典", description = "查询角色字典列表") @GetMapping("/dict/role") - public List> listRoleDict(RoleQuery query, SortQuery sortQuery) { - List list = roleService.list(query, sortQuery); + public List> listRoleDict(RoleQuery query, SortQuery sortQuery) { + List list = roleService.list(query, sortQuery); return roleService.buildDict(list); } @@ -118,7 +118,7 @@ public List> listRoleDict(RoleQuery query, SortQuery sortQuer @Parameter(name = "code", description = "字典编码", example = "announcement_type", in = ParameterIn.PATH) @GetMapping("/dict/{code}") @Cacheable(key = "#code", cacheNames = CacheConsts.DICT_KEY_PREFIX) - public List listDict(@PathVariable String code) { + public List listDict(@PathVariable String code) { Optional> enumClass = this.getEnumClassByName(code); return enumClass.map(this::listEnumDict).orElseGet(() -> dictItemService.listByDictCode(code)); } @@ -127,8 +127,8 @@ public List listDict(@PathVariable String code) { @Operation(summary = "查询参数", description = "查询参数") @GetMapping("/option") @Cacheable(cacheNames = CacheConsts.OPTION_KEY_PREFIX) - public List listOption(@Validated OptionQuery query) { - return optionService.list(query).stream().map(option -> new LabelValueVO(option.getCode(), + public List listOption(@Validated OptionQuery query) { + return optionService.list(query).stream().map(option -> new LabelValueResp(option.getCode(), StrUtil.nullToDefault(option.getValue(), option.getDefaultValue()))).collect(Collectors.toList()); } @@ -154,11 +154,11 @@ private Optional> getEnumClassByName(String enumClassName) { * 枚举类型 * @return 枚举字典 */ - private List listEnumDict(Class enumClass) { + private List listEnumDict(Class enumClass) { Object[] enumConstants = enumClass.getEnumConstants(); return Arrays.stream(enumConstants).map(e -> { IBaseEnum baseEnum = (IBaseEnum)e; - return new LabelValueVO<>(baseEnum.getDescription(), baseEnum.getValue(), baseEnum.getColor()); + return new LabelValueResp<>(baseEnum.getDescription(), baseEnum.getValue(), baseEnum.getColor()); }).collect(Collectors.toList()); } } diff --git a/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/common/DashboardController.java b/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/common/DashboardController.java index 82e302e8f..51a158f9d 100644 --- a/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/common/DashboardController.java +++ b/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/common/DashboardController.java @@ -33,12 +33,12 @@ import top.charles7c.cnadmin.common.util.validate.ValidationUtils; import top.charles7c.cnadmin.monitor.annotation.Log; -import top.charles7c.cnadmin.monitor.model.vo.DashboardAccessTrendVO; -import top.charles7c.cnadmin.monitor.model.vo.DashboardGeoDistributionVO; -import top.charles7c.cnadmin.monitor.model.vo.DashboardPopularModuleVO; -import top.charles7c.cnadmin.monitor.model.vo.DashboardTotalVO; +import top.charles7c.cnadmin.monitor.model.resp.DashboardAccessTrendResp; +import top.charles7c.cnadmin.monitor.model.resp.DashboardGeoDistributionResp; +import top.charles7c.cnadmin.monitor.model.resp.DashboardPopularModuleResp; +import top.charles7c.cnadmin.monitor.model.resp.DashboardTotalResp; import top.charles7c.cnadmin.monitor.service.DashboardService; -import top.charles7c.cnadmin.system.model.vo.DashboardAnnouncementVO; +import top.charles7c.cnadmin.system.model.resp.DashboardAnnouncementResp; /** * 仪表盘 API @@ -58,33 +58,33 @@ public class DashboardController { @Operation(summary = "查询总计信息", description = "查询总计信息") @GetMapping("/total") - public DashboardTotalVO getTotal() { + public DashboardTotalResp getTotal() { return dashboardService.getTotal(); } @Operation(summary = "查询访问趋势信息", description = "查询访问趋势信息") @Parameter(name = "days", description = "日期数", example = "30", in = ParameterIn.PATH) @GetMapping("/access/trend/{days}") - public List listAccessTrend(@PathVariable Integer days) { + public List listAccessTrend(@PathVariable Integer days) { ValidationUtils.throwIf(7 != days && 30 != days, "仅支持查询近 7/30 天访问趋势信息"); return dashboardService.listAccessTrend(days); } @Operation(summary = "查询热门模块列表", description = "查询热门模块列表") @GetMapping("/popular/module") - public List listPopularModule() { + public List listPopularModule() { return dashboardService.listPopularModule(); } @Operation(summary = "查询访客地域分布信息", description = "查询访客地域分布信息") @GetMapping("/geo/distribution") - public DashboardGeoDistributionVO getGeoDistribution() { + public DashboardGeoDistributionResp getGeoDistribution() { return dashboardService.getGeoDistribution(); } @Operation(summary = "查询公告列表", description = "查询公告列表") @GetMapping("/announcement") - public List listAnnouncement() { + public List listAnnouncement() { return dashboardService.listAnnouncement(); } } diff --git a/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/monitor/LogController.java b/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/monitor/LogController.java index 932fb2f2a..953518e3c 100644 --- a/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/monitor/LogController.java +++ b/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/monitor/LogController.java @@ -30,15 +30,15 @@ import org.springframework.web.bind.annotation.RestController; import top.charles7c.cnadmin.common.model.query.PageQuery; -import top.charles7c.cnadmin.common.model.vo.PageDataVO; +import top.charles7c.cnadmin.common.model.resp.PageDataResp; import top.charles7c.cnadmin.monitor.annotation.Log; import top.charles7c.cnadmin.monitor.model.query.LoginLogQuery; import top.charles7c.cnadmin.monitor.model.query.OperationLogQuery; import top.charles7c.cnadmin.monitor.model.query.SystemLogQuery; -import top.charles7c.cnadmin.monitor.model.vo.LoginLogVO; -import top.charles7c.cnadmin.monitor.model.vo.OperationLogVO; -import top.charles7c.cnadmin.monitor.model.vo.SystemLogDetailVO; -import top.charles7c.cnadmin.monitor.model.vo.SystemLogVO; +import top.charles7c.cnadmin.monitor.model.resp.LoginLogResp; +import top.charles7c.cnadmin.monitor.model.resp.OperationLogResp; +import top.charles7c.cnadmin.monitor.model.resp.SystemLogDetailResp; +import top.charles7c.cnadmin.monitor.model.resp.SystemLogResp; import top.charles7c.cnadmin.monitor.service.LogService; /** @@ -58,21 +58,21 @@ public class LogController { @Log(module = "登录日志") @Operation(summary = "分页查询登录日志列表", description = "分页查询登录日志列表") @GetMapping("/login") - public PageDataVO page(LoginLogQuery query, @Validated PageQuery pageQuery) { + public PageDataResp page(LoginLogQuery query, @Validated PageQuery pageQuery) { return logService.page(query, pageQuery); } @Log(module = "操作日志") @Operation(summary = "分页查询操作日志列表", description = "分页查询操作日志列表") @GetMapping("/operation") - public PageDataVO page(OperationLogQuery query, @Validated PageQuery pageQuery) { + public PageDataResp page(OperationLogQuery query, @Validated PageQuery pageQuery) { return logService.page(query, pageQuery); } @Log(module = "系统日志") @Operation(summary = "分页查询系统日志列表", description = "分页查询系统日志列表") @GetMapping("/system") - public PageDataVO page(SystemLogQuery query, @Validated PageQuery pageQuery) { + public PageDataResp page(SystemLogQuery query, @Validated PageQuery pageQuery) { return logService.page(query, pageQuery); } @@ -80,7 +80,7 @@ public PageDataVO page(SystemLogQuery query, @Validated PageQuery p @Operation(summary = "查看系统日志详情", description = "查看系统日志详情") @Parameter(name = "id", description = "ID", example = "1", in = ParameterIn.PATH) @GetMapping("/system/{id}") - public SystemLogDetailVO get(@PathVariable Long id) { + public SystemLogDetailResp get(@PathVariable Long id) { return logService.get(id); } } diff --git a/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/monitor/OnlineUserController.java b/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/monitor/OnlineUserController.java index 82fa2ad9b..5073e2002 100644 --- a/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/monitor/OnlineUserController.java +++ b/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/monitor/OnlineUserController.java @@ -30,11 +30,11 @@ import cn.dev33.satoken.stp.StpUtil; import top.charles7c.cnadmin.auth.model.query.OnlineUserQuery; -import top.charles7c.cnadmin.auth.model.vo.OnlineUserVO; +import top.charles7c.cnadmin.auth.model.resp.OnlineUserResp; import top.charles7c.cnadmin.auth.service.OnlineUserService; import top.charles7c.cnadmin.common.model.query.PageQuery; -import top.charles7c.cnadmin.common.model.vo.PageDataVO; -import top.charles7c.cnadmin.common.model.vo.R; +import top.charles7c.cnadmin.common.model.resp.PageDataResp; +import top.charles7c.cnadmin.common.model.resp.R; import top.charles7c.cnadmin.common.util.validate.CheckUtils; /** @@ -54,7 +54,7 @@ public class OnlineUserController { @Operation(summary = "分页查询列表", description = "分页查询列表") @SaCheckPermission("monitor:online:user:list") @GetMapping - public PageDataVO page(OnlineUserQuery query, @Validated PageQuery pageQuery) { + public PageDataResp page(OnlineUserQuery query, @Validated PageQuery pageQuery) { return onlineUserService.page(query, pageQuery); } diff --git a/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/system/AnnouncementController.java b/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/system/AnnouncementController.java index 009aaf495..f5dfc0622 100644 --- a/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/system/AnnouncementController.java +++ b/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/system/AnnouncementController.java @@ -30,12 +30,12 @@ import top.charles7c.cnadmin.common.annotation.CrudRequestMapping; import top.charles7c.cnadmin.common.base.BaseController; import top.charles7c.cnadmin.common.base.ValidateGroup; -import top.charles7c.cnadmin.common.model.vo.R; +import top.charles7c.cnadmin.common.model.resp.R; import top.charles7c.cnadmin.common.util.validate.ValidationUtils; import top.charles7c.cnadmin.system.model.query.AnnouncementQuery; -import top.charles7c.cnadmin.system.model.request.AnnouncementRequest; -import top.charles7c.cnadmin.system.model.vo.AnnouncementDetailVO; -import top.charles7c.cnadmin.system.model.vo.AnnouncementVO; +import top.charles7c.cnadmin.system.model.req.AnnouncementReq; +import top.charles7c.cnadmin.system.model.resp.AnnouncementDetailResp; +import top.charles7c.cnadmin.system.model.resp.AnnouncementResp; import top.charles7c.cnadmin.system.service.AnnouncementService; /** @@ -49,32 +49,32 @@ @CrudRequestMapping(value = "/system/announcement", api = {Api.PAGE, Api.GET, Api.ADD, Api.UPDATE, Api.DELETE, Api.EXPORT}) public class AnnouncementController extends - BaseController { + BaseController { @Override @SaCheckPermission("system:announcement:add") - public R add(@Validated(ValidateGroup.Crud.Add.class) @RequestBody AnnouncementRequest request) { - this.checkTime(request); - return super.add(request); + public R add(@Validated(ValidateGroup.Crud.Add.class) @RequestBody AnnouncementReq req) { + this.checkTime(req); + return super.add(req); } @Override @SaCheckPermission("system:announcement:update") - public R update(@Validated(ValidateGroup.Crud.Update.class) @RequestBody AnnouncementRequest request, + public R update(@Validated(ValidateGroup.Crud.Update.class) @RequestBody AnnouncementReq req, @PathVariable Long id) { - this.checkTime(request); - return super.update(request, id); + this.checkTime(req); + return super.update(req, id); } /** * 检查时间 * - * @param request + * @param req * 创建或修改信息 */ - private void checkTime(AnnouncementRequest request) { - LocalDateTime effectiveTime = request.getEffectiveTime(); - LocalDateTime terminateTime = request.getTerminateTime(); + private void checkTime(AnnouncementReq req) { + LocalDateTime effectiveTime = req.getEffectiveTime(); + LocalDateTime terminateTime = req.getTerminateTime(); if (null != effectiveTime && null != terminateTime) { ValidationUtils.throwIf(terminateTime.isBefore(effectiveTime), "终止时间必须晚于生效时间"); } diff --git a/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/system/DeptController.java b/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/system/DeptController.java index 3016a085c..6ed02da19 100644 --- a/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/system/DeptController.java +++ b/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/system/DeptController.java @@ -25,9 +25,9 @@ import top.charles7c.cnadmin.common.annotation.CrudRequestMapping; import top.charles7c.cnadmin.common.base.BaseController; import top.charles7c.cnadmin.system.model.query.DeptQuery; -import top.charles7c.cnadmin.system.model.request.DeptRequest; -import top.charles7c.cnadmin.system.model.vo.DeptDetailVO; -import top.charles7c.cnadmin.system.model.vo.DeptVO; +import top.charles7c.cnadmin.system.model.req.DeptReq; +import top.charles7c.cnadmin.system.model.resp.DeptDetailResp; +import top.charles7c.cnadmin.system.model.resp.DeptResp; import top.charles7c.cnadmin.system.service.DeptService; /** @@ -39,4 +39,4 @@ @Tag(name = "部门管理 API") @RestController @CrudRequestMapping(value = "/system/dept", api = {Api.TREE, Api.GET, Api.ADD, Api.UPDATE, Api.DELETE, Api.EXPORT}) -public class DeptController extends BaseController {} +public class DeptController extends BaseController {} diff --git a/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/system/DictController.java b/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/system/DictController.java index 7bc14a7c2..98a11389e 100644 --- a/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/system/DictController.java +++ b/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/system/DictController.java @@ -25,9 +25,9 @@ import top.charles7c.cnadmin.common.annotation.CrudRequestMapping; import top.charles7c.cnadmin.common.base.BaseController; import top.charles7c.cnadmin.system.model.query.DictQuery; -import top.charles7c.cnadmin.system.model.request.DictRequest; -import top.charles7c.cnadmin.system.model.vo.DictDetailVO; -import top.charles7c.cnadmin.system.model.vo.DictVO; +import top.charles7c.cnadmin.system.model.req.DictReq; +import top.charles7c.cnadmin.system.model.resp.DictDetailResp; +import top.charles7c.cnadmin.system.model.resp.DictResp; import top.charles7c.cnadmin.system.service.DictService; /** @@ -39,4 +39,4 @@ @Tag(name = "字典管理 API") @RestController @CrudRequestMapping(value = "/system/dict", api = {Api.PAGE, Api.GET, Api.ADD, Api.UPDATE, Api.DELETE, Api.EXPORT}) -public class DictController extends BaseController {} \ No newline at end of file +public class DictController extends BaseController {} \ No newline at end of file diff --git a/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/system/DictItemController.java b/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/system/DictItemController.java index 5a5392884..d969a09f7 100644 --- a/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/system/DictItemController.java +++ b/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/system/DictItemController.java @@ -25,9 +25,9 @@ import top.charles7c.cnadmin.common.annotation.CrudRequestMapping; import top.charles7c.cnadmin.common.base.BaseController; import top.charles7c.cnadmin.system.model.query.DictItemQuery; -import top.charles7c.cnadmin.system.model.request.DictItemRequest; -import top.charles7c.cnadmin.system.model.vo.DictItemDetailVO; -import top.charles7c.cnadmin.system.model.vo.DictItemVO; +import top.charles7c.cnadmin.system.model.req.DictItemReq; +import top.charles7c.cnadmin.system.model.resp.DictItemDetailResp; +import top.charles7c.cnadmin.system.model.resp.DictItemResp; import top.charles7c.cnadmin.system.service.DictItemService; /** @@ -40,4 +40,4 @@ @RestController @CrudRequestMapping(value = "/system/dict/item", api = {Api.PAGE, Api.GET, Api.ADD, Api.UPDATE, Api.DELETE}) public class DictItemController - extends BaseController {} \ No newline at end of file + extends BaseController {} \ No newline at end of file diff --git a/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/system/MenuController.java b/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/system/MenuController.java index 0fec4d343..32c13f1a0 100644 --- a/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/system/MenuController.java +++ b/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/system/MenuController.java @@ -31,12 +31,12 @@ import top.charles7c.cnadmin.common.annotation.CrudRequestMapping; import top.charles7c.cnadmin.common.base.BaseController; import top.charles7c.cnadmin.common.base.ValidateGroup; -import top.charles7c.cnadmin.common.model.vo.R; +import top.charles7c.cnadmin.common.model.resp.R; import top.charles7c.cnadmin.common.util.URLUtils; import top.charles7c.cnadmin.common.util.validate.ValidationUtils; import top.charles7c.cnadmin.system.model.query.MenuQuery; -import top.charles7c.cnadmin.system.model.request.MenuRequest; -import top.charles7c.cnadmin.system.model.vo.MenuVO; +import top.charles7c.cnadmin.system.model.req.MenuReq; +import top.charles7c.cnadmin.system.model.resp.MenuResp; import top.charles7c.cnadmin.system.service.MenuService; /** @@ -48,32 +48,31 @@ @Tag(name = "菜单管理 API") @RestController @CrudRequestMapping(value = "/system/menu", api = {Api.TREE, Api.GET, Api.ADD, Api.UPDATE, Api.DELETE, Api.EXPORT}) -public class MenuController extends BaseController { +public class MenuController extends BaseController { @Override @SaCheckPermission("system:menu:add") - public R add(@Validated(ValidateGroup.Crud.Add.class) @RequestBody MenuRequest request) { - this.checkPath(request); - return super.add(request); + public R add(@Validated(ValidateGroup.Crud.Add.class) @RequestBody MenuReq req) { + this.checkPath(req); + return super.add(req); } @Override @SaCheckPermission("system:menu:update") - public R update(@Validated(ValidateGroup.Crud.Update.class) @RequestBody MenuRequest request, - @PathVariable Long id) { - this.checkPath(request); - return super.update(request, id); + public R update(@Validated(ValidateGroup.Crud.Update.class) @RequestBody MenuReq req, @PathVariable Long id) { + this.checkPath(req); + return super.update(req, id); } /** * 检查路由地址格式 * - * @param request + * @param req * 创建或修改信息 */ - private void checkPath(MenuRequest request) { - Boolean isExternal = ObjectUtil.defaultIfNull(request.getIsExternal(), false); - String path = request.getPath(); + private void checkPath(MenuReq req) { + Boolean isExternal = ObjectUtil.defaultIfNull(req.getIsExternal(), false); + String path = req.getPath(); ValidationUtils.throwIf(isExternal && !URLUtils.isHttpUrl(path), "路由地址格式错误,请以 http:// 或 https:// 开头"); ValidationUtils.throwIf(!isExternal && URLUtils.isHttpUrl(path), "路由地址格式错误"); } diff --git a/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/system/MessageController.java b/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/system/MessageController.java index ee31ab88f..bffa9c191 100644 --- a/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/system/MessageController.java +++ b/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/system/MessageController.java @@ -29,13 +29,13 @@ import org.springframework.web.bind.annotation.*; import top.charles7c.cnadmin.common.model.query.PageQuery; -import top.charles7c.cnadmin.common.model.vo.PageDataVO; -import top.charles7c.cnadmin.common.model.vo.R; +import top.charles7c.cnadmin.common.model.resp.PageDataResp; +import top.charles7c.cnadmin.common.model.resp.R; import top.charles7c.cnadmin.common.util.helper.LoginHelper; import top.charles7c.cnadmin.monitor.annotation.Log; import top.charles7c.cnadmin.system.model.query.MessageQuery; -import top.charles7c.cnadmin.system.model.vo.MessageUnreadVO; -import top.charles7c.cnadmin.system.model.vo.MessageVO; +import top.charles7c.cnadmin.system.model.resp.MessageResp; +import top.charles7c.cnadmin.system.model.resp.MessageUnreadResp; import top.charles7c.cnadmin.system.service.MessageService; import top.charles7c.cnadmin.system.service.MessageUserService; @@ -56,7 +56,7 @@ public class MessageController { @Operation(summary = "分页查询列表", description = "分页查询列表") @GetMapping - public PageDataVO page(MessageQuery query, @Validated PageQuery pageQuery) { + public PageDataResp page(MessageQuery query, @Validated PageQuery pageQuery) { query.setUserId(LoginHelper.getUserId()); return baseService.page(query, pageQuery); } @@ -69,7 +69,7 @@ public R delete(@PathVariable List ids) { return R.ok("删除成功"); } - @Operation(description = "标记已读", summary = "将消息标记为已读状态") + @Operation(summary = "标记已读", description = "将消息标记为已读状态") @Parameter(name = "ids", description = "消息ID列表", example = "1,2", in = ParameterIn.QUERY) @PatchMapping("/read") public void readMessage(@RequestParam(required = false) List ids) { @@ -77,10 +77,10 @@ public void readMessage(@RequestParam(required = false) List ids) { } @Log(ignore = true) - @Operation(description = "查询未读消息数量", summary = "查询当前用户的未读消息数量") + @Operation(summary = "查询未读消息数量", description = "查询当前用户的未读消息数量") @Parameter(name = "isDetail", description = "是否查询详情", example = "true", in = ParameterIn.QUERY) @GetMapping("/unread") - public MessageUnreadVO countUnreadMessage(@RequestParam(required = false) Boolean detail) { + public MessageUnreadResp countUnreadMessage(@RequestParam(required = false) Boolean detail) { return messageUserService.countUnreadMessageByUserId(LoginHelper.getUserId(), detail); } } \ No newline at end of file diff --git a/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/system/OptionController.java b/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/system/OptionController.java index 928bba75f..14a47bef5 100644 --- a/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/system/OptionController.java +++ b/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/system/OptionController.java @@ -29,9 +29,9 @@ import cn.dev33.satoken.annotation.SaCheckPermission; import top.charles7c.cnadmin.system.model.query.OptionQuery; -import top.charles7c.cnadmin.system.model.request.OptionRequest; -import top.charles7c.cnadmin.system.model.request.OptionResetValueRequest; -import top.charles7c.cnadmin.system.model.vo.OptionVO; +import top.charles7c.cnadmin.system.model.req.OptionReq; +import top.charles7c.cnadmin.system.model.req.OptionResetValueReq; +import top.charles7c.cnadmin.system.model.resp.OptionResp; import top.charles7c.cnadmin.system.service.OptionService; /** @@ -51,21 +51,21 @@ public class OptionController { @Operation(summary = "查询参数列表", description = "查询参数列表") @SaCheckPermission("system:config:list") @GetMapping - public List list(@Validated OptionQuery query) { + public List list(@Validated OptionQuery query) { return optionService.list(query); } @Operation(summary = "修改参数", description = "修改参数") @SaCheckPermission("system:config:update") @PatchMapping - public void update(@Validated @RequestBody List request) { - optionService.update(request); + public void update(@Validated @RequestBody List req) { + optionService.update(req); } @Operation(summary = "重置参数", description = "重置参数") @SaCheckPermission("system:config:reset") @PatchMapping("/value") - public void resetValue(@Validated @RequestBody OptionResetValueRequest request) { - optionService.resetValue(request); + public void resetValue(@Validated @RequestBody OptionResetValueReq req) { + optionService.resetValue(req); } } \ No newline at end of file diff --git a/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/system/RoleController.java b/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/system/RoleController.java index a8b14dcb6..93d296b09 100644 --- a/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/system/RoleController.java +++ b/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/system/RoleController.java @@ -23,9 +23,9 @@ import top.charles7c.cnadmin.common.annotation.CrudRequestMapping; import top.charles7c.cnadmin.common.base.BaseController; import top.charles7c.cnadmin.system.model.query.RoleQuery; -import top.charles7c.cnadmin.system.model.request.RoleRequest; -import top.charles7c.cnadmin.system.model.vo.RoleDetailVO; -import top.charles7c.cnadmin.system.model.vo.RoleVO; +import top.charles7c.cnadmin.system.model.req.RoleReq; +import top.charles7c.cnadmin.system.model.resp.RoleDetailResp; +import top.charles7c.cnadmin.system.model.resp.RoleResp; import top.charles7c.cnadmin.system.service.RoleService; /** @@ -37,4 +37,4 @@ @Tag(name = "角色管理 API") @RestController @CrudRequestMapping("/system/role") -public class RoleController extends BaseController {} +public class RoleController extends BaseController {} diff --git a/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/system/UserCenterController.java b/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/system/UserCenterController.java index 2ae06559d..7349eca64 100644 --- a/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/system/UserCenterController.java +++ b/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/system/UserCenterController.java @@ -39,19 +39,19 @@ import top.charles7c.cnadmin.common.constant.CacheConsts; import top.charles7c.cnadmin.common.constant.RegexConsts; import top.charles7c.cnadmin.common.enums.SocialSourceEnum; -import top.charles7c.cnadmin.common.model.vo.R; +import top.charles7c.cnadmin.common.model.resp.R; import top.charles7c.cnadmin.common.util.ExceptionUtils; import top.charles7c.cnadmin.common.util.RedisUtils; import top.charles7c.cnadmin.common.util.SecureUtils; import top.charles7c.cnadmin.common.util.helper.LoginHelper; import top.charles7c.cnadmin.common.util.validate.ValidationUtils; import top.charles7c.cnadmin.system.model.entity.UserSocialDO; -import top.charles7c.cnadmin.system.model.request.UserBasicInfoUpdateRequest; -import top.charles7c.cnadmin.system.model.request.UserEmailUpdateRequest; -import top.charles7c.cnadmin.system.model.request.UserPasswordUpdateRequest; -import top.charles7c.cnadmin.system.model.request.UserPhoneUpdateRequest; -import top.charles7c.cnadmin.system.model.vo.AvatarVO; -import top.charles7c.cnadmin.system.model.vo.UserSocialBindVO; +import top.charles7c.cnadmin.system.model.req.UserBasicInfoUpdateReq; +import top.charles7c.cnadmin.system.model.req.UserEmailUpdateRequest; +import top.charles7c.cnadmin.system.model.req.UserPasswordUpdateReq; +import top.charles7c.cnadmin.system.model.req.UserPhoneUpdateReq; +import top.charles7c.cnadmin.system.model.resp.AvatarResp; +import top.charles7c.cnadmin.system.model.resp.UserSocialBindResp; import top.charles7c.cnadmin.system.service.UserService; import top.charles7c.cnadmin.system.service.UserSocialService; @@ -79,27 +79,27 @@ public class UserCenterController { @Operation(summary = "上传头像", description = "用户上传个人头像") @PostMapping("/avatar") - public R uploadAvatar(@NotNull(message = "头像不能为空") MultipartFile avatarFile) { + public R uploadAvatar(@NotNull(message = "头像不能为空") MultipartFile avatarFile) { ValidationUtils.throwIf(avatarFile::isEmpty, "头像不能为空"); String newAvatar = userService.uploadAvatar(avatarFile, LoginHelper.getUserId()); - return R.ok("上传成功", AvatarVO.builder().avatar(newAvatar).build()); + return R.ok("上传成功", AvatarResp.builder().avatar(newAvatar).build()); } @Operation(summary = "修改基础信息", description = "修改用户基础信息") @PatchMapping("/basic/info") - public R updateBasicInfo(@Validated @RequestBody UserBasicInfoUpdateRequest updateRequest) { - userService.updateBasicInfo(updateRequest, LoginHelper.getUserId()); + public R updateBasicInfo(@Validated @RequestBody UserBasicInfoUpdateReq updateReq) { + userService.updateBasicInfo(updateReq, LoginHelper.getUserId()); return R.ok("修改成功"); } @Operation(summary = "修改密码", description = "修改用户登录密码") @PatchMapping("/password") - public R updatePassword(@Validated @RequestBody UserPasswordUpdateRequest updateRequest) { + public R updatePassword(@Validated @RequestBody UserPasswordUpdateReq updateReq) { String rawOldPassword = - ExceptionUtils.exToNull(() -> SecureUtils.decryptByRsaPrivateKey(updateRequest.getOldPassword())); + ExceptionUtils.exToNull(() -> SecureUtils.decryptByRsaPrivateKey(updateReq.getOldPassword())); ValidationUtils.throwIfNull(rawOldPassword, "当前密码解密失败"); String rawNewPassword = - ExceptionUtils.exToNull(() -> SecureUtils.decryptByRsaPrivateKey(updateRequest.getNewPassword())); + ExceptionUtils.exToNull(() -> SecureUtils.decryptByRsaPrivateKey(updateReq.getNewPassword())); ValidationUtils.throwIfNull(rawNewPassword, "新密码解密失败"); ValidationUtils.throwIf(!ReUtil.isMatch(RegexConsts.PASSWORD, rawNewPassword), "密码长度为 6 到 32 位,可以包含字母、数字、下划线,特殊字符,同时包含字母和数字"); @@ -109,41 +109,41 @@ public R updatePassword(@Validated @RequestBody UserPasswordUpdateRequest update @Operation(summary = "修改手机号", description = "修改手机号") @PatchMapping("/phone") - public R updatePhone(@Validated @RequestBody UserPhoneUpdateRequest updateRequest) { + public R updatePhone(@Validated @RequestBody UserPhoneUpdateReq updateReq) { String rawCurrentPassword = - ExceptionUtils.exToNull(() -> SecureUtils.decryptByRsaPrivateKey(updateRequest.getCurrentPassword())); + ExceptionUtils.exToNull(() -> SecureUtils.decryptByRsaPrivateKey(updateReq.getCurrentPassword())); ValidationUtils.throwIfBlank(rawCurrentPassword, "当前密码解密失败"); - String captchaKey = RedisUtils.formatKey(CacheConsts.CAPTCHA_KEY_PREFIX, updateRequest.getNewPhone()); + String captchaKey = RedisUtils.formatKey(CacheConsts.CAPTCHA_KEY_PREFIX, updateReq.getNewPhone()); String captcha = RedisUtils.getCacheObject(captchaKey); ValidationUtils.throwIfBlank(captcha, "验证码已失效"); - ValidationUtils.throwIfNotEqualIgnoreCase(updateRequest.getCaptcha(), captcha, "验证码错误"); + ValidationUtils.throwIfNotEqualIgnoreCase(updateReq.getCaptcha(), captcha, "验证码错误"); RedisUtils.deleteCacheObject(captchaKey); - userService.updatePhone(updateRequest.getNewPhone(), rawCurrentPassword, LoginHelper.getUserId()); + userService.updatePhone(updateReq.getNewPhone(), rawCurrentPassword, LoginHelper.getUserId()); return R.ok("修改成功"); } @Operation(summary = "修改邮箱", description = "修改用户邮箱") @PatchMapping("/email") - public R updateEmail(@Validated @RequestBody UserEmailUpdateRequest updateRequest) { + public R updateEmail(@Validated @RequestBody UserEmailUpdateRequest updateReq) { String rawCurrentPassword = - ExceptionUtils.exToNull(() -> SecureUtils.decryptByRsaPrivateKey(updateRequest.getCurrentPassword())); + ExceptionUtils.exToNull(() -> SecureUtils.decryptByRsaPrivateKey(updateReq.getCurrentPassword())); ValidationUtils.throwIfBlank(rawCurrentPassword, "当前密码解密失败"); - String captchaKey = RedisUtils.formatKey(CacheConsts.CAPTCHA_KEY_PREFIX, updateRequest.getNewEmail()); + String captchaKey = RedisUtils.formatKey(CacheConsts.CAPTCHA_KEY_PREFIX, updateReq.getNewEmail()); String captcha = RedisUtils.getCacheObject(captchaKey); ValidationUtils.throwIfBlank(captcha, "验证码已失效"); - ValidationUtils.throwIfNotEqualIgnoreCase(updateRequest.getCaptcha(), captcha, "验证码错误"); + ValidationUtils.throwIfNotEqualIgnoreCase(updateReq.getCaptcha(), captcha, "验证码错误"); RedisUtils.deleteCacheObject(captchaKey); - userService.updateEmail(updateRequest.getNewEmail(), rawCurrentPassword, LoginHelper.getUserId()); + userService.updateEmail(updateReq.getNewEmail(), rawCurrentPassword, LoginHelper.getUserId()); return R.ok("修改成功"); } @Operation(summary = "查询绑定的三方账号", description = "查询绑定的三方账号") @GetMapping("/social") - public List listSocialBind() { + public List listSocialBind() { List userSocialList = userSocialService.listByUserId(LoginHelper.getUserId()); return userSocialList.stream().map(userSocial -> { String source = userSocial.getSource(); - UserSocialBindVO userSocialBind = new UserSocialBindVO(); + UserSocialBindResp userSocialBind = new UserSocialBindResp(); userSocialBind.setSource(source); userSocialBind.setDescription(SocialSourceEnum.valueOf(source).getDescription()); return userSocialBind; diff --git a/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/system/UserController.java b/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/system/UserController.java index 2f02ec747..57d9bf4df 100644 --- a/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/system/UserController.java +++ b/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/system/UserController.java @@ -33,12 +33,12 @@ import top.charles7c.cnadmin.common.base.BaseController; import top.charles7c.cnadmin.common.base.ValidateGroup; import top.charles7c.cnadmin.common.constant.SysConsts; -import top.charles7c.cnadmin.common.model.vo.R; +import top.charles7c.cnadmin.common.model.resp.R; import top.charles7c.cnadmin.system.model.query.UserQuery; -import top.charles7c.cnadmin.system.model.request.UserRequest; -import top.charles7c.cnadmin.system.model.request.UserRoleUpdateRequest; -import top.charles7c.cnadmin.system.model.vo.UserDetailVO; -import top.charles7c.cnadmin.system.model.vo.UserVO; +import top.charles7c.cnadmin.system.model.req.UserReq; +import top.charles7c.cnadmin.system.model.req.UserRoleUpdateReq; +import top.charles7c.cnadmin.system.model.resp.UserDetailResp; +import top.charles7c.cnadmin.system.model.resp.UserResp; import top.charles7c.cnadmin.system.service.UserService; /** @@ -51,12 +51,12 @@ @Validated @RestController @CrudRequestMapping("/system/user") -public class UserController extends BaseController { +public class UserController extends BaseController { @Override @SaCheckPermission("system:user:add") - public R add(@Validated(ValidateGroup.Crud.Add.class) @RequestBody UserRequest request) { - Long id = baseService.add(request); + public R add(@Validated(ValidateGroup.Crud.Add.class) @RequestBody UserReq req) { + Long id = baseService.add(req); return R.ok(String.format("新增成功,请牢记默认密码:%s", SysConsts.DEFAULT_PASSWORD), id); } @@ -73,8 +73,8 @@ public R resetPassword(@PathVariable Long id) { @Parameter(name = "id", description = "ID", example = "1", in = ParameterIn.PATH) @SaCheckPermission("system:user:role:update") @PatchMapping("/{id}/role") - public R updateRole(@Validated @RequestBody UserRoleUpdateRequest updateRequest, @PathVariable Long id) { - baseService.updateRole(updateRequest, id); + public R updateRole(@Validated @RequestBody UserRoleUpdateReq updateReq, @PathVariable Long id) { + baseService.updateRole(updateReq, id); return R.ok("分配成功"); } } diff --git a/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/tool/GeneratorController.java b/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/tool/GeneratorController.java index d9a204e11..68481dca3 100644 --- a/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/tool/GeneratorController.java +++ b/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/tool/GeneratorController.java @@ -33,14 +33,14 @@ import top.charles7c.cnadmin.common.config.properties.ProjectProperties; import top.charles7c.cnadmin.common.model.query.PageQuery; -import top.charles7c.cnadmin.common.model.vo.PageDataVO; -import top.charles7c.cnadmin.common.model.vo.R; +import top.charles7c.cnadmin.common.model.resp.PageDataResp; +import top.charles7c.cnadmin.common.model.resp.R; import top.charles7c.cnadmin.common.util.validate.ValidationUtils; import top.charles7c.cnadmin.tool.model.entity.FieldConfigDO; import top.charles7c.cnadmin.tool.model.entity.GenConfigDO; import top.charles7c.cnadmin.tool.model.query.TableQuery; -import top.charles7c.cnadmin.tool.model.request.GenConfigRequest; -import top.charles7c.cnadmin.tool.model.vo.TableVO; +import top.charles7c.cnadmin.tool.model.req.GenConfigReq; +import top.charles7c.cnadmin.tool.model.resp.TableResp; import top.charles7c.cnadmin.tool.service.GeneratorService; /** @@ -62,7 +62,7 @@ public class GeneratorController { @Operation(summary = "分页查询数据表", description = "分页查询数据表") @SaCheckPermission("tool:generator:list") @GetMapping("/table") - public PageDataVO pageTable(TableQuery query, @Validated PageQuery pageQuery) throws SQLException { + public PageDataResp pageTable(TableQuery query, @Validated PageQuery pageQuery) throws SQLException { return generatorService.pageTable(query, pageQuery); } @@ -88,8 +88,8 @@ public GenConfigDO getGenConfig(@PathVariable String tableName) throws SQLExcept @Parameter(name = "tableName", description = "表名称", required = true, example = "sys_user", in = ParameterIn.PATH) @SaCheckPermission("tool:generator:list") @PostMapping("/config/{tableName}") - public R saveConfig(@Validated @RequestBody GenConfigRequest request, @PathVariable String tableName) { - generatorService.saveConfig(request, tableName); + public R saveConfig(@Validated @RequestBody GenConfigReq req, @PathVariable String tableName) { + generatorService.saveConfig(req, tableName); return R.ok("保存成功"); } diff --git a/continew-admin-webapi/src/main/resources/config/application.yml b/continew-admin-webapi/src/main/resources/config/application.yml index ba485956c..fbe0eb40e 100644 --- a/continew-admin-webapi/src/main/resources/config/application.yml +++ b/continew-admin-webapi/src/main/resources/config/application.yml @@ -246,19 +246,19 @@ generator: Query: templatePath: generator/Query.ftl packageName: model.query - Request: - templatePath: generator/Request.ftl - packageName: model.request - VO: - templatePath: generator/VO.ftl - packageName: model.vo + Req: + templatePath: generator/Req.ftl + packageName: model.req + Resp: + templatePath: generator/Resp.ftl + packageName: model.resp excludeFields: - id - createUser - createTime - DetailVO: - templatePath: generator/DetailVO.ftl - packageName: model.vo + DetailResp: + templatePath: generator/DetailResp.ftl + packageName: model.resp excludeFields: - id - createUser