diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 2b508e243..3a6e03cf3 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -127,7 +127,7 @@ security: # 多租户配置 tenant: # 是否开启 - enable: true + enable: false # 排除表 excludes: - sys_menu @@ -138,6 +138,8 @@ tenant: - sys_user_post - sys_user_role - sys_client + - f_labels + - f_questions # MyBatisPlus配置 # https://baomidou.com/config/ diff --git a/ruoyi-modules/ruoyi-question/src/main/java/org/dromara/question/controller/LabelsController.java b/ruoyi-modules/ruoyi-question/src/main/java/org/dromara/question/controller/LabelsController.java index 5660d6cc7..ce9ff4ccf 100644 --- a/ruoyi-modules/ruoyi-question/src/main/java/org/dromara/question/controller/LabelsController.java +++ b/ruoyi-modules/ruoyi-question/src/main/java/org/dromara/question/controller/LabelsController.java @@ -90,6 +90,14 @@ public class LabelsController extends BaseController { return toAjax(labelsService.updateByBo(bo)); } + @SaCheckPermission("question:label:edit") + @Log(title = "题目标签", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping("changeStatus") + public R changeStatus(@RequestBody LabelsBo bo) { + return toAjax(labelsService.updateStatusByBo(bo)); + } + /** * 删除题目标签 * diff --git a/ruoyi-modules/ruoyi-question/src/main/java/org/dromara/question/domain/Labels.java b/ruoyi-modules/ruoyi-question/src/main/java/org/dromara/question/domain/Labels.java index 14c692825..d2d2526fa 100644 --- a/ruoyi-modules/ruoyi-question/src/main/java/org/dromara/question/domain/Labels.java +++ b/ruoyi-modules/ruoyi-question/src/main/java/org/dromara/question/domain/Labels.java @@ -1,11 +1,10 @@ package org.dromara.question.domain; -import org.dromara.common.mybatis.core.domain.BaseEntity; import com.baomidou.mybatisplus.annotation.*; import lombok.Data; -import lombok.EqualsAndHashCode; import java.io.Serial; +import java.util.Date; /** * 题目标签对象 f_labels @@ -14,17 +13,13 @@ import java.io.Serial; * @date 2023-11-08 */ @Data -@EqualsAndHashCode(callSuper = true) @TableName("f_labels") -public class Labels extends BaseEntity { +public class Labels { - @Serial private static final long serialVersionUID = 1L; - /** - * - */ - @TableId(value = "id") + + @TableId(value = "id", type = IdType.AUTO) private Long id; /** @@ -37,5 +32,15 @@ public class Labels extends BaseEntity { */ private Integer status; + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private Date createTime; + /** + * 更新时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; } diff --git a/ruoyi-modules/ruoyi-question/src/main/java/org/dromara/question/domain/bo/LabelsBo.java b/ruoyi-modules/ruoyi-question/src/main/java/org/dromara/question/domain/bo/LabelsBo.java index 93671c91c..76b45b9e2 100644 --- a/ruoyi-modules/ruoyi-question/src/main/java/org/dromara/question/domain/bo/LabelsBo.java +++ b/ruoyi-modules/ruoyi-question/src/main/java/org/dromara/question/domain/bo/LabelsBo.java @@ -1,5 +1,7 @@ package org.dromara.question.domain.bo; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import org.dromara.question.domain.Labels; import org.dromara.common.mybatis.core.domain.BaseEntity; import org.dromara.common.core.validate.AddGroup; @@ -9,6 +11,8 @@ import lombok.Data; import lombok.EqualsAndHashCode; import jakarta.validation.constraints.*; +import java.util.Date; + /** * 题目标签业务对象 f_labels * @@ -16,12 +20,11 @@ import jakarta.validation.constraints.*; * @date 2023-11-08 */ @Data -@EqualsAndHashCode(callSuper = true) @AutoMapper(target = Labels.class, reverseConvertGenerate = false) -public class LabelsBo extends BaseEntity { +public class LabelsBo { /** - * + * */ @NotNull(message = "不能为空", groups = { EditGroup.class }) private Long id; @@ -38,5 +41,17 @@ public class LabelsBo extends BaseEntity { @NotNull(message = "标签状态 1:启用 0:禁用不能为空", groups = { AddGroup.class, EditGroup.class }) private Integer status; + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + /** + * 更新时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + } diff --git a/ruoyi-modules/ruoyi-question/src/main/java/org/dromara/question/domain/vo/LabelsVo.java b/ruoyi-modules/ruoyi-question/src/main/java/org/dromara/question/domain/vo/LabelsVo.java index d91e8d843..ae0361f15 100644 --- a/ruoyi-modules/ruoyi-question/src/main/java/org/dromara/question/domain/vo/LabelsVo.java +++ b/ruoyi-modules/ruoyi-question/src/main/java/org/dromara/question/domain/vo/LabelsVo.java @@ -29,7 +29,7 @@ public class LabelsVo implements Serializable { private static final long serialVersionUID = 1L; /** - * + * */ @ExcelProperty(value = "") private Long id; @@ -43,7 +43,7 @@ public class LabelsVo implements Serializable { /** * 标签状态 1:启用 0:禁用 */ - @ExcelProperty(value = "标签状态 1:启用 0:禁用") + @ExcelProperty(value = "标签状态") private Integer status; diff --git a/ruoyi-modules/ruoyi-question/src/main/java/org/dromara/question/service/ILabelsService.java b/ruoyi-modules/ruoyi-question/src/main/java/org/dromara/question/service/ILabelsService.java index f4ff8663d..2a6ada941 100644 --- a/ruoyi-modules/ruoyi-question/src/main/java/org/dromara/question/service/ILabelsService.java +++ b/ruoyi-modules/ruoyi-question/src/main/java/org/dromara/question/service/ILabelsService.java @@ -1,10 +1,9 @@ package org.dromara.question.service; -import org.dromara.question.domain.Labels; -import org.dromara.question.domain.vo.LabelsVo; -import org.dromara.question.domain.bo.LabelsBo; -import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.question.domain.bo.LabelsBo; +import org.dromara.question.domain.vo.LabelsVo; import java.util.Collection; import java.util.List; @@ -41,6 +40,7 @@ public interface ILabelsService { * 修改题目标签 */ Boolean updateByBo(LabelsBo bo); + Boolean updateStatusByBo(LabelsBo bo); /** * 校验并批量删除题目标签信息 diff --git a/ruoyi-modules/ruoyi-question/src/main/java/org/dromara/question/service/impl/LabelsServiceImpl.java b/ruoyi-modules/ruoyi-question/src/main/java/org/dromara/question/service/impl/LabelsServiceImpl.java index cd2c0bdca..3c4da4a35 100644 --- a/ruoyi-modules/ruoyi-question/src/main/java/org/dromara/question/service/impl/LabelsServiceImpl.java +++ b/ruoyi-modules/ruoyi-question/src/main/java/org/dromara/question/service/impl/LabelsServiceImpl.java @@ -1,5 +1,6 @@ package org.dromara.question.service.impl; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import org.dromara.common.core.utils.MapstructUtils; import org.dromara.common.core.utils.StringUtils; import org.dromara.common.mybatis.core.page.TableDataInfo; @@ -59,7 +60,6 @@ public class LabelsServiceImpl implements ILabelsService { } private LambdaQueryWrapper buildQueryWrapper(LabelsBo bo) { - Map params = bo.getParams(); LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); lqw.eq(StringUtils.isNotBlank(bo.getLabel()), Labels::getLabel, bo.getLabel()); lqw.eq(bo.getStatus() != null, Labels::getStatus, bo.getStatus()); @@ -90,6 +90,13 @@ public class LabelsServiceImpl implements ILabelsService { return baseMapper.updateById(update) > 0; } + @Override + public Boolean updateStatusByBo(LabelsBo bo) { + Labels update = MapstructUtils.convert(bo, Labels.class); + validEntityBeforeSave(update); + return baseMapper.updateById(update) > 0; + } + /** * 保存前的数据校验 */