diff --git a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/constant/CacheConstants.java b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/constant/CacheConstants.java index 45220eb1..e41f2197 100644 --- a/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/constant/CacheConstants.java +++ b/continew-admin-common/src/main/java/top/charles7c/continew/admin/common/constant/CacheConstants.java @@ -56,11 +56,6 @@ public class CacheConstants { */ public static final String MENU_KEY_PREFIX = "MENU" + DELIMITER; - /** - * 字典缓存键前缀 - */ - public static final String DICT_KEY_PREFIX = "DICT" + DELIMITER; - /** * 参数缓存键前缀 */ diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/entity/DictItemDO.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/entity/DictItemDO.java index 55adcef2..4b4323d6 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/entity/DictItemDO.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/entity/DictItemDO.java @@ -16,14 +16,13 @@ package top.charles7c.continew.admin.system.model.entity; -import java.io.Serial; - -import lombok.Data; - import com.baomidou.mybatisplus.annotation.TableName; - +import lombok.Data; +import top.charles7c.continew.admin.common.enums.DisEnableStatusEnum; import top.charles7c.continew.starter.extension.crud.model.entity.BaseDO; +import java.io.Serial; + /** * 字典项实体 * @@ -62,6 +61,11 @@ public class DictItemDO extends BaseDO { */ private String description; + /** + * 状态 + */ + private DisEnableStatusEnum status; + /** * 字典ID */ diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/DictItemQuery.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/DictItemQuery.java index 75f332fa..b57d1f20 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/DictItemQuery.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/DictItemQuery.java @@ -18,6 +18,8 @@ package top.charles7c.continew.admin.system.model.query; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; +import top.charles7c.continew.starter.data.core.annotation.Query; +import top.charles7c.continew.starter.data.core.enums.QueryType; import java.io.Serial; import java.io.Serializable; @@ -35,6 +37,19 @@ public class DictItemQuery implements Serializable { @Serial private static final long serialVersionUID = 1L; + /** + * 关键词 + */ + @Schema(description = "关键词") + @Query(columns = {"label", "description"}, type = QueryType.LIKE) + private String description; + + /** + * 状态 + */ + @Schema(description = "状态(1:启用;2:禁用)", example = "1") + private Integer status; + /** * 字典 ID */ diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/DictQuery.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/DictQuery.java index a627addf..fd86a4a0 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/DictQuery.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/query/DictQuery.java @@ -38,10 +38,9 @@ public class DictQuery implements Serializable { private static final long serialVersionUID = 1L; /** - * 名称 + * 关键词 */ - @Schema(description = "名称") + @Schema(description = "关键词") @Query(columns = {"name", "code", "description"}, type = QueryType.LIKE) - private String name; - + private String description; } \ No newline at end of file diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/req/DictItemReq.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/req/DictItemReq.java index faae552a..e4f2088d 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/req/DictItemReq.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/req/DictItemReq.java @@ -16,18 +16,17 @@ package top.charles7c.continew.admin.system.model.req; -import java.io.Serial; - -import jakarta.validation.constraints.*; - -import lombok.Data; - import io.swagger.v3.oas.annotations.media.Schema; - +import jakarta.validation.constraints.Min; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; import org.hibernate.validator.constraints.Length; - +import top.charles7c.continew.admin.common.enums.DisEnableStatusEnum; import top.charles7c.continew.starter.extension.crud.model.req.BaseReq; +import java.io.Serial; + /** * 创建或修改字典项信息 * @@ -78,6 +77,12 @@ public class DictItemReq extends BaseReq { @Length(max = 200, message = "描述长度不能超过 {max} 个字符") private String description; + /** + * 状态 + */ + @Schema(description = "状态(1:启用;2:禁用)", type = "Integer", allowableValues = {"1", "2"}, example = "1") + private DisEnableStatusEnum status; + /** * 所属字典 */ diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/DictDetailResp.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/DictDetailResp.java deleted file mode 100644 index 5956b25a..00000000 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/DictDetailResp.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package top.charles7c.continew.admin.system.model.resp; - -import java.io.Serial; - -import lombok.Data; - -import io.swagger.v3.oas.annotations.media.Schema; - -import top.charles7c.continew.starter.extension.crud.model.resp.BaseDetailResp; - -/** - * 字典详情信息 - * - * @author Charles7c - * @since 2023/9/11 21:29 - */ -@Data -@Schema(description = "字典详情信息") -public class DictDetailResp extends BaseDetailResp { - - @Serial - private static final long serialVersionUID = 1L; - - /** - * 名称 - */ - @Schema(description = "名称", example = "公告类型") - private String name; - - /** - * 编码 - */ - @Schema(description = "编码", example = "announcement_type") - private String code; - - /** - * 描述 - */ - @Schema(description = "描述", example = "公告类型描述信息") - private String description; - - /** - * 是否为系统内置数据 - */ - @Schema(description = "是否为系统内置数据", example = "true") - private Boolean isSystem; -} \ No newline at end of file diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/DictItemDetailResp.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/DictItemDetailResp.java deleted file mode 100644 index 8892ca01..00000000 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/DictItemDetailResp.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package top.charles7c.continew.admin.system.model.resp; - -import java.io.Serial; - -import lombok.Data; - -import io.swagger.v3.oas.annotations.media.Schema; - -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; -import com.alibaba.excel.annotation.ExcelProperty; - -import top.charles7c.continew.starter.extension.crud.model.resp.BaseDetailResp; - -/** - * 字典项详情信息 - * - * @author Charles7c - * @since 2023/9/11 21:29 - */ -@Data -@ExcelIgnoreUnannotated -@Schema(description = "字典项详情信息") -public class DictItemDetailResp extends BaseDetailResp { - - @Serial - private static final long serialVersionUID = 1L; - - /** - * 标签 - */ - @Schema(description = "标签", example = "通知") - @ExcelProperty(value = "标签", order = 2) - private String label; - - /** - * 值 - */ - @Schema(description = "值", example = "1") - @ExcelProperty(value = "值", order = 3) - private String value; - - /** - * 标签颜色 - */ - @Schema(description = "标签颜色", example = "blue") - @ExcelProperty(value = "标签颜色", order = 4) - private String color; - - /** - * 排序 - */ - @Schema(description = "排序", example = "1") - @ExcelProperty(value = "排序", order = 5) - private Integer sort; - - /** - * 描述 - */ - @Schema(description = "描述", example = "通知描述信息") - @ExcelProperty(value = "描述", order = 6) - private String description; - - /** - * 字典 ID - */ - @Schema(description = "字典 ID", example = "1") - private Long dictId; - - /** - * 字典名称 - */ - @Schema(hidden = true) - @ExcelProperty(value = "字典名称", order = 7) - private String dictName; - - /** - * 字典编码 - */ - @Schema(hidden = true) - @ExcelProperty(value = "字典编码", order = 8) - private String dictCode; -} \ No newline at end of file diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/DictItemResp.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/DictItemResp.java index ebaad361..6217b74d 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/DictItemResp.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/DictItemResp.java @@ -16,13 +16,14 @@ package top.charles7c.continew.admin.system.model.resp; -import java.io.Serial; - -import lombok.Data; - +import com.alibaba.excel.annotation.ExcelProperty; import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import top.charles7c.continew.admin.common.enums.DisEnableStatusEnum; +import top.charles7c.continew.starter.extension.crud.converter.ExcelBaseEnumConverter; +import top.charles7c.continew.starter.extension.crud.model.resp.BaseDetailResp; -import top.charles7c.continew.starter.extension.crud.model.resp.BaseResp; +import java.io.Serial; /** * 字典项信息 @@ -32,7 +33,7 @@ import top.charles7c.continew.starter.extension.crud.model.resp.BaseResp; */ @Data @Schema(description = "字典项信息") -public class DictItemResp extends BaseResp { +public class DictItemResp extends BaseDetailResp { @Serial private static final long serialVersionUID = 1L; @@ -56,14 +57,27 @@ public class DictItemResp extends BaseResp { private String color; /** - * 描述 + * 状态 */ - @Schema(description = "描述", example = "通知描述信息") - private String description; + @Schema(description = "状态(1:启用;2:禁用)", type = "Integer", allowableValues = {"1", "2"}, example = "1") + @ExcelProperty(value = "状态", converter = ExcelBaseEnumConverter.class) + private DisEnableStatusEnum status; /** * 排序 */ @Schema(description = "排序", example = "1") private Integer sort; + + /** + * 描述 + */ + @Schema(description = "描述", example = "通知描述信息") + private String description; + + /** + * 字典 ID + */ + @Schema(description = "字典 ID", example = "1") + private Long dictId; } \ No newline at end of file diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/DictResp.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/DictResp.java index dc4b70c3..40c83b17 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/DictResp.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/model/resp/DictResp.java @@ -16,13 +16,11 @@ package top.charles7c.continew.admin.system.model.resp; -import java.io.Serial; - -import lombok.Data; - import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import top.charles7c.continew.starter.extension.crud.model.resp.BaseDetailResp; -import top.charles7c.continew.starter.extension.crud.model.resp.BaseResp; +import java.io.Serial; /** * 字典信息 @@ -32,7 +30,7 @@ import top.charles7c.continew.starter.extension.crud.model.resp.BaseResp; */ @Data @Schema(description = "字典信息") -public class DictResp extends BaseResp { +public class DictResp extends BaseDetailResp { @Serial private static final long serialVersionUID = 1L; diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/DictItemService.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/DictItemService.java index 4b9b2eb6..dd30256c 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/DictItemService.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/DictItemService.java @@ -20,10 +20,9 @@ import top.charles7c.continew.admin.common.model.resp.LabelValueResp; import top.charles7c.continew.admin.system.model.entity.DictItemDO; import top.charles7c.continew.admin.system.model.query.DictItemQuery; import top.charles7c.continew.admin.system.model.req.DictItemReq; -import top.charles7c.continew.admin.system.model.resp.DictItemDetailResp; import top.charles7c.continew.admin.system.model.resp.DictItemResp; -import top.charles7c.continew.starter.extension.crud.service.BaseService; import top.charles7c.continew.starter.data.mybatis.plus.service.IService; +import top.charles7c.continew.starter.extension.crud.service.BaseService; import java.io.Serializable; import java.util.List; @@ -34,15 +33,7 @@ import java.util.List; * @author Charles7c * @since 2023/9/11 21:29 */ -public interface DictItemService extends BaseService, IService { - - /** - * 根据字典 ID 查询 - * - * @param dictId 字典 ID - * @return 字典项列表 - */ - List listByDictId(Long dictId); +public interface DictItemService extends BaseService, IService { /** * 根据字典编码查询 diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/DictService.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/DictService.java index 76c6770d..83af3ddd 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/DictService.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/DictService.java @@ -19,10 +19,9 @@ package top.charles7c.continew.admin.system.service; import top.charles7c.continew.admin.system.model.entity.DictDO; import top.charles7c.continew.admin.system.model.query.DictQuery; import top.charles7c.continew.admin.system.model.req.DictReq; -import top.charles7c.continew.admin.system.model.resp.DictDetailResp; import top.charles7c.continew.admin.system.model.resp.DictResp; -import top.charles7c.continew.starter.extension.crud.service.BaseService; import top.charles7c.continew.starter.data.mybatis.plus.service.IService; +import top.charles7c.continew.starter.extension.crud.service.BaseService; /** * 字典业务接口 @@ -30,4 +29,4 @@ import top.charles7c.continew.starter.data.mybatis.plus.service.IService; * @author Charles7c * @since 2023/9/11 21:29 */ -public interface DictService extends BaseService, IService {} \ No newline at end of file +public interface DictService extends BaseService, IService {} \ No newline at end of file diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/DictItemServiceImpl.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/DictItemServiceImpl.java index 9e834088..e6f4bfc8 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/DictItemServiceImpl.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/DictItemServiceImpl.java @@ -23,12 +23,10 @@ import top.charles7c.continew.admin.system.mapper.DictItemMapper; import top.charles7c.continew.admin.system.model.entity.DictItemDO; import top.charles7c.continew.admin.system.model.query.DictItemQuery; import top.charles7c.continew.admin.system.model.req.DictItemReq; -import top.charles7c.continew.admin.system.model.resp.DictItemDetailResp; import top.charles7c.continew.admin.system.model.resp.DictItemResp; import top.charles7c.continew.admin.system.service.DictItemService; import top.charles7c.continew.starter.core.util.validate.CheckUtils; import top.charles7c.continew.starter.extension.crud.service.impl.BaseServiceImpl; -import top.charles7c.continew.starter.extension.crud.model.query.SortQuery; import java.io.Serializable; import java.util.List; @@ -41,7 +39,7 @@ import java.util.List; */ @Service @RequiredArgsConstructor -public class DictItemServiceImpl extends BaseServiceImpl implements DictItemService { +public class DictItemServiceImpl extends BaseServiceImpl implements DictItemService { @Override protected void beforeAdd(DictItemReq req) { @@ -55,17 +53,6 @@ public class DictItemServiceImpl extends BaseServiceImpl listByDictId(Long dictId) { - DictItemQuery dictItemQuery = new DictItemQuery(); - dictItemQuery.setDictId(dictId); - SortQuery sortQuery = new SortQuery(); - sortQuery.setSort(new String[] {"sort,asc"}); - List detailList = super.list(dictItemQuery, sortQuery, DictItemDetailResp.class); - detailList.forEach(super::fill); - return detailList; - } - @Override public List> listByDictCode(String dictCode) { return baseMapper.listByDictCode(dictCode); diff --git a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/DictServiceImpl.java b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/DictServiceImpl.java index 492d160f..331bfca3 100644 --- a/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/DictServiceImpl.java +++ b/continew-admin-system/src/main/java/top/charles7c/continew/admin/system/service/impl/DictServiceImpl.java @@ -16,24 +16,18 @@ package top.charles7c.continew.admin.system.service.impl; -import jakarta.servlet.http.HttpServletResponse; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import top.charles7c.continew.admin.system.mapper.DictMapper; import top.charles7c.continew.admin.system.model.entity.DictDO; import top.charles7c.continew.admin.system.model.query.DictQuery; import top.charles7c.continew.admin.system.model.req.DictReq; -import top.charles7c.continew.admin.system.model.resp.DictDetailResp; -import top.charles7c.continew.admin.system.model.resp.DictItemDetailResp; import top.charles7c.continew.admin.system.model.resp.DictResp; import top.charles7c.continew.admin.system.service.DictItemService; import top.charles7c.continew.admin.system.service.DictService; import top.charles7c.continew.starter.core.util.validate.CheckUtils; import top.charles7c.continew.starter.extension.crud.service.impl.BaseServiceImpl; -import top.charles7c.continew.starter.extension.crud.model.query.SortQuery; -import top.charles7c.continew.starter.file.excel.util.ExcelUtils; -import java.util.ArrayList; import java.util.List; import java.util.Optional; @@ -45,7 +39,7 @@ import java.util.Optional; */ @Service @RequiredArgsConstructor -public class DictServiceImpl extends BaseServiceImpl implements DictService { +public class DictServiceImpl extends BaseServiceImpl implements DictService { private final DictItemService dictItemService; @@ -64,7 +58,7 @@ public class DictServiceImpl extends BaseServiceImpl dictList = this.list(query, sortQuery); - List dictItemList = new ArrayList<>(); - for (DictResp dict : dictList) { - List tempDictItemList = dictItemService.listByDictId(dict.getId()); - for (DictItemDetailResp dictItem : tempDictItemList) { - dictItem.setDictName(dict.getName()); - dictItem.setDictCode(dict.getCode()); - dictItemList.add(dictItem); - } - } - ExcelUtils.export(dictItemList, "导出数据", DictItemDetailResp.class, response); - } - /** * 名称是否存在 * diff --git a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/common/CommonController.java b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/common/CommonController.java index efe3b95f..311f69c2 100644 --- a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/common/CommonController.java +++ b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/common/CommonController.java @@ -20,8 +20,6 @@ import cn.dev33.satoken.annotation.SaIgnore; import cn.hutool.core.lang.tree.Tree; import cn.hutool.core.util.ClassUtil; import cn.hutool.core.util.StrUtil; -import com.alicp.jetcache.anno.CachePenetrationProtect; -import com.alicp.jetcache.anno.CacheRefresh; import com.alicp.jetcache.anno.Cached; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; @@ -106,9 +104,6 @@ public class CommonController { @Operation(summary = "查询字典", description = "查询字典列表") @Parameter(name = "code", description = "字典编码", example = "announcement_type", in = ParameterIn.PATH) @GetMapping("/dict/{code}") - @CachePenetrationProtect - @CacheRefresh(refresh = 3600, stopRefreshAfterLastAccess = 7200) - @Cached(key = "#code", name = CacheConstants.DICT_KEY_PREFIX) public R>> listDict(@PathVariable String code) { Optional> enumClassOptional = this.getEnumClassByName(code); return R.ok(enumClassOptional.map(this::listEnumDict).orElseGet(() -> dictItemService.listByDictCode(code))); diff --git a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/system/DictController.java b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/system/DictController.java index b872b9ab..737e883e 100644 --- a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/system/DictController.java +++ b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/system/DictController.java @@ -17,16 +17,14 @@ package top.charles7c.continew.admin.webapi.system; import io.swagger.v3.oas.annotations.tags.Tag; - -import org.springframework.web.bind.annotation.*; - +import org.springframework.web.bind.annotation.RestController; import top.charles7c.continew.admin.system.model.query.DictQuery; import top.charles7c.continew.admin.system.model.req.DictReq; -import top.charles7c.continew.admin.system.model.resp.DictDetailResp; import top.charles7c.continew.admin.system.model.resp.DictResp; import top.charles7c.continew.admin.system.service.DictService; import top.charles7c.continew.starter.extension.crud.annotation.CrudRequestMapping; import top.charles7c.continew.starter.extension.crud.controller.BaseController; +import top.charles7c.continew.starter.extension.crud.enums.Api; /** * 字典管理 API @@ -36,5 +34,5 @@ import top.charles7c.continew.starter.extension.crud.controller.BaseController; */ @Tag(name = "字典管理 API") @RestController -@CrudRequestMapping("/system/dict") -public class DictController extends BaseController {} \ No newline at end of file +@CrudRequestMapping(value = "/system/dict", api = {Api.PAGE, Api.GET, Api.ADD, Api.UPDATE, Api.DELETE}) +public class DictController extends BaseController {} \ No newline at end of file diff --git a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/system/DictItemController.java b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/system/DictItemController.java index f163adcf..bf44e0f5 100644 --- a/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/system/DictItemController.java +++ b/continew-admin-webapi/src/main/java/top/charles7c/continew/admin/webapi/system/DictItemController.java @@ -17,12 +17,9 @@ package top.charles7c.continew.admin.webapi.system; import io.swagger.v3.oas.annotations.tags.Tag; - -import org.springframework.web.bind.annotation.*; - +import org.springframework.web.bind.annotation.RestController; import top.charles7c.continew.admin.system.model.query.DictItemQuery; import top.charles7c.continew.admin.system.model.req.DictItemReq; -import top.charles7c.continew.admin.system.model.resp.DictItemDetailResp; import top.charles7c.continew.admin.system.model.resp.DictItemResp; import top.charles7c.continew.admin.system.service.DictItemService; import top.charles7c.continew.starter.extension.crud.annotation.CrudRequestMapping; @@ -38,4 +35,4 @@ import top.charles7c.continew.starter.extension.crud.enums.Api; @Tag(name = "字典项管理 API") @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 +public class DictItemController extends BaseController {} \ No newline at end of file diff --git a/continew-admin-webapi/src/main/resources/db/changelog/mysql/continew-admin_data.sql b/continew-admin-webapi/src/main/resources/db/changelog/mysql/continew-admin_data.sql index bbcd029b..008e471e 100644 --- a/continew-admin-webapi/src/main/resources/db/changelog/mysql/continew-admin_data.sql +++ b/continew-admin-webapi/src/main/resources/db/changelog/mysql/continew-admin_data.sql @@ -124,10 +124,10 @@ VALUES (547889614262632491, '公告类型', 'announcement_type', NULL, b'1', 1, NOW(), NULL, NULL); INSERT INTO `sys_dict_item` -(`id`, `label`, `value`, `color`, `sort`, `description`, `dict_id`, `create_user`, `create_time`, `update_user`, `update_time`) +(`id`, `label`, `value`, `color`, `sort`, `description`, `status`, `dict_id`, `create_user`, `create_time`, `update_user`, `update_time`) VALUES -(547889649658363951, '通知', '1', 'blue', 1, NULL, 547889614262632491, 1, NOW(), NULL, NULL), -(547890124537462835, '活动', '2', 'orangered', 2, NULL, 547889614262632491, 1, NOW(), NULL, NULL); +(547889649658363951, '通知', '1', 'blue', 1, NULL, 1, 547889614262632491, 1, NOW(), NULL, NULL), +(547890124537462835, '活动', '2', 'orangered', 2, NULL, 1, 547889614262632491, 1, NOW(), NULL, NULL); -- 初始化默认用户和角色关联数据 INSERT INTO `sys_user_role` diff --git a/continew-admin-webapi/src/main/resources/db/changelog/mysql/continew-admin_table.sql b/continew-admin-webapi/src/main/resources/db/changelog/mysql/continew-admin_table.sql index b4c4f00a..1f22c562 100644 --- a/continew-admin-webapi/src/main/resources/db/changelog/mysql/continew-admin_table.sql +++ b/continew-admin-webapi/src/main/resources/db/changelog/mysql/continew-admin_table.sql @@ -151,17 +151,18 @@ CREATE TABLE IF NOT EXISTS `sys_dict` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='字典表'; CREATE TABLE IF NOT EXISTS `sys_dict_item` ( - `id` bigint(20) NOT NULL COMMENT 'ID', - `label` varchar(30) NOT NULL COMMENT '标签', - `value` varchar(30) NOT NULL COMMENT '值', - `color` varchar(30) DEFAULT NULL COMMENT '标签颜色', - `sort` int NOT NULL DEFAULT 999 COMMENT '排序', - `description` varchar(200) DEFAULT NULL COMMENT '描述', - `dict_id` bigint(20) NOT NULL COMMENT '字典ID', - `create_user` bigint(20) NOT NULL COMMENT '创建人', - `create_time` datetime NOT NULL COMMENT '创建时间', - `update_user` bigint(20) DEFAULT NULL COMMENT '修改人', - `update_time` datetime DEFAULT NULL COMMENT '修改时间', + `id` bigint(20) NOT NULL COMMENT 'ID', + `label` varchar(30) NOT NULL COMMENT '标签', + `value` varchar(30) NOT NULL COMMENT '值', + `color` varchar(30) DEFAULT NULL COMMENT '标签颜色', + `sort` int NOT NULL DEFAULT 999 COMMENT '排序', + `description` varchar(200) DEFAULT NULL COMMENT '描述', + `status` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态(1:启用;2:禁用)', + `dict_id` bigint(20) NOT NULL COMMENT '字典ID', + `create_user` bigint(20) NOT NULL COMMENT '创建人', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_user` bigint(20) DEFAULT NULL COMMENT '修改人', + `update_time` datetime DEFAULT NULL COMMENT '修改时间', PRIMARY KEY (`id`) USING BTREE, UNIQUE INDEX `uk_value_dict_id`(`value`, `dict_id`) USING BTREE, INDEX `idx_dict_id`(`dict_id`) USING BTREE, diff --git a/continew-admin-webapi/src/main/resources/db/changelog/postgresql/continew-admin_data.sql b/continew-admin-webapi/src/main/resources/db/changelog/postgresql/continew-admin_data.sql index a50c88b5..dacef74b 100644 --- a/continew-admin-webapi/src/main/resources/db/changelog/postgresql/continew-admin_data.sql +++ b/continew-admin-webapi/src/main/resources/db/changelog/postgresql/continew-admin_data.sql @@ -124,10 +124,10 @@ VALUES (547889614262632491, '公告类型', 'announcement_type', NULL, true, 1, NOW(), NULL, NULL); INSERT INTO "sys_dict_item" -("id", "label", "value", "color", "sort", "description", "dict_id", "create_user", "create_time", "update_user", "update_time") +("id", "label", "value", "color", "sort", "description", "status", "dict_id", "create_user", "create_time", "update_user", "update_time") VALUES -(547889649658363951, '通知', '1', 'blue', 1, NULL, 547889614262632491, 1, NOW(), NULL, NULL), -(547890124537462835, '活动', '2', 'orangered', 2, NULL, 547889614262632491, 1, NOW(), NULL, NULL); +(547889649658363951, '通知', '1', 'blue', 1, NULL, 547889614262632491, 1, 1, NOW(), NULL, NULL), +(547890124537462835, '活动', '2', 'orangered', 2, NULL, 547889614262632491, 1, 1, NOW(), NULL, NULL); -- 初始化默认用户和角色关联数据 INSERT INTO "sys_user_role" diff --git a/continew-admin-webapi/src/main/resources/db/changelog/postgresql/continew-admin_table.sql b/continew-admin-webapi/src/main/resources/db/changelog/postgresql/continew-admin_table.sql index 92f19761..7c668862 100644 --- a/continew-admin-webapi/src/main/resources/db/changelog/postgresql/continew-admin_table.sql +++ b/continew-admin-webapi/src/main/resources/db/changelog/postgresql/continew-admin_table.sql @@ -256,6 +256,7 @@ CREATE TABLE IF NOT EXISTS "sys_dict_item" ( "color" varchar(30) DEFAULT NULL, "sort" int4 NOT NULL DEFAULT 999, "description" varchar(200) DEFAULT NULL, + "status" int2 NOT NULL DEFAULT 1, "dict_id" int8 NOT NULL, "create_user" int8 NOT NULL, "create_time" timestamp NOT NULL, @@ -273,6 +274,7 @@ COMMENT ON COLUMN "sys_dict_item"."value" IS '值'; COMMENT ON COLUMN "sys_dict_item"."color" IS '标签颜色'; COMMENT ON COLUMN "sys_dict_item"."sort" IS '排序'; COMMENT ON COLUMN "sys_dict_item"."description" IS '描述'; +COMMENT ON COLUMN "sys_dict_item"."status" IS '状态(1:启用;2:禁用)'; COMMENT ON COLUMN "sys_dict_item"."dict_id" IS '字典ID'; COMMENT ON COLUMN "sys_dict_item"."create_user" IS '创建人'; COMMENT ON COLUMN "sys_dict_item"."create_time" IS '创建时间';