mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-21 02:25:56 +08:00
feat:增加标签功能
This commit is contained in:
parent
d83ce56244
commit
3e69a02f7d
@ -127,7 +127,7 @@ security:
|
|||||||
# 多租户配置
|
# 多租户配置
|
||||||
tenant:
|
tenant:
|
||||||
# 是否开启
|
# 是否开启
|
||||||
enable: true
|
enable: false
|
||||||
# 排除表
|
# 排除表
|
||||||
excludes:
|
excludes:
|
||||||
- sys_menu
|
- sys_menu
|
||||||
@ -138,6 +138,8 @@ tenant:
|
|||||||
- sys_user_post
|
- sys_user_post
|
||||||
- sys_user_role
|
- sys_user_role
|
||||||
- sys_client
|
- sys_client
|
||||||
|
- f_labels
|
||||||
|
- f_questions
|
||||||
|
|
||||||
# MyBatisPlus配置
|
# MyBatisPlus配置
|
||||||
# https://baomidou.com/config/
|
# https://baomidou.com/config/
|
||||||
|
|||||||
@ -90,6 +90,14 @@ public class LabelsController extends BaseController {
|
|||||||
return toAjax(labelsService.updateByBo(bo));
|
return toAjax(labelsService.updateByBo(bo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SaCheckPermission("question:label:edit")
|
||||||
|
@Log(title = "题目标签", businessType = BusinessType.UPDATE)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PutMapping("changeStatus")
|
||||||
|
public R<Void> changeStatus(@RequestBody LabelsBo bo) {
|
||||||
|
return toAjax(labelsService.updateStatusByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除题目标签
|
* 删除题目标签
|
||||||
*
|
*
|
||||||
|
|||||||
@ -1,11 +1,10 @@
|
|||||||
package org.dromara.question.domain;
|
package org.dromara.question.domain;
|
||||||
|
|
||||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 题目标签对象 f_labels
|
* 题目标签对象 f_labels
|
||||||
@ -14,17 +13,13 @@ import java.io.Serial;
|
|||||||
* @date 2023-11-08
|
* @date 2023-11-08
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@TableName("f_labels")
|
@TableName("f_labels")
|
||||||
public class Labels extends BaseEntity {
|
public class Labels {
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
*/
|
|
||||||
@TableId(value = "id")
|
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -37,5 +32,15 @@ public class Labels extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
|
private Date updateTime;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
package org.dromara.question.domain.bo;
|
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.question.domain.Labels;
|
||||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||||
import org.dromara.common.core.validate.AddGroup;
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
@ -9,6 +11,8 @@ import lombok.Data;
|
|||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import jakarta.validation.constraints.*;
|
import jakarta.validation.constraints.*;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 题目标签业务对象 f_labels
|
* 题目标签业务对象 f_labels
|
||||||
*
|
*
|
||||||
@ -16,9 +20,8 @@ import jakarta.validation.constraints.*;
|
|||||||
* @date 2023-11-08
|
* @date 2023-11-08
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@AutoMapper(target = Labels.class, reverseConvertGenerate = false)
|
@AutoMapper(target = Labels.class, reverseConvertGenerate = false)
|
||||||
public class LabelsBo extends BaseEntity {
|
public class LabelsBo {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -38,5 +41,17 @@ public class LabelsBo extends BaseEntity {
|
|||||||
@NotNull(message = "标签状态 1:启用 0:禁用不能为空", groups = { AddGroup.class, EditGroup.class })
|
@NotNull(message = "标签状态 1:启用 0:禁用不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,7 +43,7 @@ public class LabelsVo implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 标签状态 1:启用 0:禁用
|
* 标签状态 1:启用 0:禁用
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "标签状态 1:启用 0:禁用")
|
@ExcelProperty(value = "标签状态")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,9 @@
|
|||||||
package org.dromara.question.service;
|
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.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.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -41,6 +40,7 @@ public interface ILabelsService {
|
|||||||
* 修改题目标签
|
* 修改题目标签
|
||||||
*/
|
*/
|
||||||
Boolean updateByBo(LabelsBo bo);
|
Boolean updateByBo(LabelsBo bo);
|
||||||
|
Boolean updateStatusByBo(LabelsBo bo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验并批量删除题目标签信息
|
* 校验并批量删除题目标签信息
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package org.dromara.question.service.impl;
|
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.MapstructUtils;
|
||||||
import org.dromara.common.core.utils.StringUtils;
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
@ -59,7 +60,6 @@ public class LabelsServiceImpl implements ILabelsService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private LambdaQueryWrapper<Labels> buildQueryWrapper(LabelsBo bo) {
|
private LambdaQueryWrapper<Labels> buildQueryWrapper(LabelsBo bo) {
|
||||||
Map<String, Object> params = bo.getParams();
|
|
||||||
LambdaQueryWrapper<Labels> lqw = Wrappers.lambdaQuery();
|
LambdaQueryWrapper<Labels> lqw = Wrappers.lambdaQuery();
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getLabel()), Labels::getLabel, bo.getLabel());
|
lqw.eq(StringUtils.isNotBlank(bo.getLabel()), Labels::getLabel, bo.getLabel());
|
||||||
lqw.eq(bo.getStatus() != null, Labels::getStatus, bo.getStatus());
|
lqw.eq(bo.getStatus() != null, Labels::getStatus, bo.getStatus());
|
||||||
@ -90,6 +90,13 @@ public class LabelsServiceImpl implements ILabelsService {
|
|||||||
return baseMapper.updateById(update) > 0;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存前的数据校验
|
* 保存前的数据校验
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user