refactor: 代码优化重构
This commit is contained in:
@@ -1,120 +0,0 @@
|
|||||||
package com.youlai.boot.common.constant;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 符号和特殊符号常用类
|
|
||||||
*
|
|
||||||
* @author Theo
|
|
||||||
* @since 2024-7-29 11:46:08
|
|
||||||
*/
|
|
||||||
public interface SymbolConstant {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 符号:点
|
|
||||||
*/
|
|
||||||
String SPOT = ".";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 符号:双斜杠
|
|
||||||
*/
|
|
||||||
String DOUBLE_BACKSLASH = "\\";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 符号:冒号
|
|
||||||
*/
|
|
||||||
String COLON = ":";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 符号:逗号
|
|
||||||
*/
|
|
||||||
String COMMA = ",";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 符号:左花括号 {
|
|
||||||
*/
|
|
||||||
String LEFT_CURLY_BRACKET = "{";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 符号:右花括号 }
|
|
||||||
*/
|
|
||||||
String RIGHT_CURLY_BRACKET = "}";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 符号:井号 #
|
|
||||||
*/
|
|
||||||
String WELL_NUMBER = "#";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 符号:单斜杠
|
|
||||||
*/
|
|
||||||
String SINGLE_SLASH = "/";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 符号:双斜杠
|
|
||||||
*/
|
|
||||||
String DOUBLE_SLASH = "//";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 符号:感叹号
|
|
||||||
*/
|
|
||||||
String EXCLAMATORY_MARK = "!";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 符号:下划线
|
|
||||||
*/
|
|
||||||
String UNDERLINE = "_";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 符号:单引号
|
|
||||||
*/
|
|
||||||
String SINGLE_QUOTATION_MARK = "'";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 符号:星号
|
|
||||||
*/
|
|
||||||
String ASTERISK = "*";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 符号:百分号
|
|
||||||
*/
|
|
||||||
String PERCENT_SIGN = "%";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 符号:美元 $
|
|
||||||
*/
|
|
||||||
String DOLLAR = "$";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 符号:和 &
|
|
||||||
*/
|
|
||||||
String AND = "&";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 符号:../
|
|
||||||
*/
|
|
||||||
String SPOT_SINGLE_SLASH = "../";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 符号:..\\
|
|
||||||
*/
|
|
||||||
String SPOT_DOUBLE_BACKSLASH = "..\\";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 系统变量前缀 #{
|
|
||||||
*/
|
|
||||||
String SYS_VAR_PREFIX = "#{";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 符号 {{
|
|
||||||
*/
|
|
||||||
String DOUBLE_LEFT_CURLY_BRACKET = "{{";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 符号:[
|
|
||||||
*/
|
|
||||||
String SQUARE_BRACKETS_LEFT = "[";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 符号:]
|
|
||||||
*/
|
|
||||||
String SQUARE_BRACKETS_RIGHT = "]";
|
|
||||||
}
|
|
||||||
@@ -2,17 +2,15 @@ package com.youlai.boot.core.security.filter;
|
|||||||
|
|
||||||
import cn.hutool.captcha.generator.CodeGenerator;
|
import cn.hutool.captcha.generator.CodeGenerator;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.youlai.boot.common.constant.RedisConstants;
|
|
||||||
import com.youlai.boot.common.constant.SecurityConstants;
|
import com.youlai.boot.common.constant.SecurityConstants;
|
||||||
import com.youlai.boot.common.constant.SymbolConstant;
|
|
||||||
import com.youlai.boot.common.result.ResultCode;
|
import com.youlai.boot.common.result.ResultCode;
|
||||||
import com.youlai.boot.common.util.ResponseUtils;
|
import com.youlai.boot.common.util.ResponseUtils;
|
||||||
import com.youlai.boot.system.service.ConfigService;
|
|
||||||
import jakarta.servlet.FilterChain;
|
import jakarta.servlet.FilterChain;
|
||||||
import jakarta.servlet.ServletException;
|
import jakarta.servlet.ServletException;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.http.HttpMethod;
|
||||||
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
|
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
|
||||||
import org.springframework.web.filter.OncePerRequestFilter;
|
import org.springframework.web.filter.OncePerRequestFilter;
|
||||||
|
|
||||||
@@ -27,7 +25,7 @@ import java.io.IOException;
|
|||||||
*/
|
*/
|
||||||
public class CaptchaValidationFilter extends OncePerRequestFilter {
|
public class CaptchaValidationFilter extends OncePerRequestFilter {
|
||||||
|
|
||||||
private static final AntPathRequestMatcher LOGIN_PATH_REQUEST_MATCHER = new AntPathRequestMatcher(SecurityConstants.LOGIN_PATH, "POST");
|
private static final AntPathRequestMatcher LOGIN_PATH_REQUEST_MATCHER = new AntPathRequestMatcher(SecurityConstants.LOGIN_PATH, HttpMethod.POST.name());
|
||||||
|
|
||||||
public static final String CAPTCHA_CODE_PARAM_NAME = "captchaCode";
|
public static final String CAPTCHA_CODE_PARAM_NAME = "captchaCode";
|
||||||
public static final String CAPTCHA_KEY_PARAM_NAME = "captchaKey";
|
public static final String CAPTCHA_KEY_PARAM_NAME = "captchaKey";
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -88,14 +89,8 @@ public class DictController {
|
|||||||
public Result<?> deleteDictionaries(
|
public Result<?> deleteDictionaries(
|
||||||
@Parameter(description = "字典ID,多个以英文逗号(,)拼接") @PathVariable String ids
|
@Parameter(description = "字典ID,多个以英文逗号(,)拼接") @PathVariable String ids
|
||||||
) {
|
) {
|
||||||
dictService.deleteDictByIds(ids);
|
dictService.deleteDictByIds(Arrays.stream(ids.split(",")).toList());
|
||||||
return Result.success();
|
return Result.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class DictDataController {
|
|||||||
return PageResult.success(result);
|
return PageResult.success(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "字典数据表单内")
|
@Operation(summary = "获取字典数据表单")
|
||||||
@GetMapping("/{id}/form")
|
@GetMapping("/{id}/form")
|
||||||
public Result<DictDataForm> getDictDataForm(
|
public Result<DictDataForm> getDictDataForm(
|
||||||
@Parameter(description = "字典数据ID") @PathVariable Long id
|
@Parameter(description = "字典数据ID") @PathVariable Long id
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import lombok.Getter;
|
|||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
@Schema(enumAsRef = true)
|
@Schema(enumAsRef = true)
|
||||||
public enum NoticeTargetTypeEnum implements IBaseEnum<Integer> {
|
public enum NoticeTargetEnum implements IBaseEnum<Integer> {
|
||||||
|
|
||||||
ALL(1, "全体"),
|
ALL(1, "全体"),
|
||||||
SPECIFIED(2, "指定");
|
SPECIFIED(2, "指定");
|
||||||
@@ -22,7 +22,7 @@ public enum NoticeTargetTypeEnum implements IBaseEnum<Integer> {
|
|||||||
|
|
||||||
private final String label;
|
private final String label;
|
||||||
|
|
||||||
NoticeTargetTypeEnum(Integer value, String label) {
|
NoticeTargetEnum(Integer value, String label) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
this.label = label;
|
this.label = label;
|
||||||
}
|
}
|
||||||
@@ -21,11 +21,6 @@ public interface DictDataMapper extends BaseMapper<DictData> {
|
|||||||
* 字典数据分页列表
|
* 字典数据分页列表
|
||||||
*/
|
*/
|
||||||
Page<DictDataPageVO> getDictDataPage(Page<DictDataPageVO> page, DictDataPageQuery queryParams);
|
Page<DictDataPageVO> getDictDataPage(Page<DictDataPageVO> page, DictDataPageQuery queryParams);
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据字典编码获取字典数据列表
|
|
||||||
*/
|
|
||||||
Option listDictDataByDictCode(String dictCode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -25,14 +25,14 @@ public interface DictMapper extends BaseMapper<Dict> {
|
|||||||
*
|
*
|
||||||
* @param page 分页参数
|
* @param page 分页参数
|
||||||
* @param queryParams 查询参数
|
* @param queryParams 查询参数
|
||||||
* @return
|
* @return 字典分页列表
|
||||||
*/
|
*/
|
||||||
Page<DictPageVO> getDictPage(Page<DictPageVO> page, DictPageQuery queryParams);
|
Page<DictPageVO> getDictPage(Page<DictPageVO> page, DictPageQuery queryParams);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取所有字典和字典数据
|
* 获取字典列表(包含字典数据)
|
||||||
*
|
*
|
||||||
* @return
|
* @return 字典列表
|
||||||
*/
|
*/
|
||||||
List<DictVO> getAllDictWithData();
|
List<DictVO> getAllDictWithData();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,51 +23,47 @@ public interface DictService extends IService<Dict> {
|
|||||||
* 字典分页列表
|
* 字典分页列表
|
||||||
*
|
*
|
||||||
* @param queryParams 分页查询对象
|
* @param queryParams 分页查询对象
|
||||||
* @return
|
* @return 字典分页列表
|
||||||
*/
|
*/
|
||||||
Page<DictPageVO> getDictPage(DictPageQuery queryParams);
|
Page<DictPageVO> getDictPage(DictPageQuery queryParams);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取字典表单详情
|
* 获取字典表单详情
|
||||||
*
|
*
|
||||||
* @param id 字典ID
|
* @param id 字典ID
|
||||||
* @return
|
* @return 字典表单
|
||||||
*/
|
*/
|
||||||
DictForm getDictForm(Long id);
|
DictForm getDictForm(Long id);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增字典
|
* 新增字典
|
||||||
*
|
*
|
||||||
* @param dictForm 字典表单
|
* @param dictForm 字典表单
|
||||||
* @return
|
* @return 是否成功
|
||||||
*/
|
*/
|
||||||
boolean saveDict(DictForm dictForm);
|
boolean saveDict(DictForm dictForm);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改字典
|
* 修改字典
|
||||||
*
|
*
|
||||||
* @param id 字典ID
|
* @param id 字典ID
|
||||||
* @param dictForm 字典表单
|
* @param dictForm 字典表单
|
||||||
* @return
|
* @return 是否成功
|
||||||
*/
|
*/
|
||||||
boolean updateDict(Long id, DictForm dictForm);
|
boolean updateDict(Long id, DictForm dictForm);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除字典
|
* 删除字典
|
||||||
*
|
*
|
||||||
* @param idsStr 字典ID,多个以英文逗号(,)分割
|
* @param ids 字典ID集合
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
void deleteDictByIds(String idsStr);
|
void deleteDictByIds(List<String> ids);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取字典列表
|
* 获取字典列表(包含字典数据)
|
||||||
*
|
*
|
||||||
* @return
|
* @return 字典列表
|
||||||
*/
|
*/
|
||||||
List<DictVO> getAllDictWithData();
|
List<DictVO> getAllDictWithData();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import com.youlai.boot.system.model.entity.Dept;
|
|||||||
import com.youlai.boot.system.model.form.DeptForm;
|
import com.youlai.boot.system.model.form.DeptForm;
|
||||||
import com.youlai.boot.system.model.query.DeptQuery;
|
import com.youlai.boot.system.model.query.DeptQuery;
|
||||||
import com.youlai.boot.system.model.vo.DeptVO;
|
import com.youlai.boot.system.model.vo.DeptVO;
|
||||||
import com.youlai.boot.common.constant.SymbolConstant;
|
|
||||||
import com.youlai.boot.common.constant.SystemConstants;
|
import com.youlai.boot.common.constant.SystemConstants;
|
||||||
import com.youlai.boot.common.enums.StatusEnum;
|
import com.youlai.boot.common.enums.StatusEnum;
|
||||||
import com.youlai.boot.common.model.Option;
|
import com.youlai.boot.common.model.Option;
|
||||||
@@ -237,7 +236,7 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements De
|
|||||||
public boolean deleteByIds(String ids) {
|
public boolean deleteByIds(String ids) {
|
||||||
// 删除部门及子部门
|
// 删除部门及子部门
|
||||||
if (StrUtil.isNotBlank(ids)) {
|
if (StrUtil.isNotBlank(ids)) {
|
||||||
String[] menuIds = ids.split(SymbolConstant.COMMA);
|
String[] menuIds = ids.split(",");
|
||||||
for (String deptId : menuIds) {
|
for (String deptId : menuIds) {
|
||||||
this.update(new LambdaUpdateWrapper<Dept>()
|
this.update(new LambdaUpdateWrapper<Dept>()
|
||||||
.eq(Dept::getId, deptId)
|
.eq(Dept::getId, deptId)
|
||||||
@@ -265,7 +264,7 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements De
|
|||||||
} else {
|
} else {
|
||||||
Dept parent = this.getById(parentId);
|
Dept parent = this.getById(parentId);
|
||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
treePath = parent.getTreePath() + SymbolConstant.COMMA + parent.getId();
|
treePath = parent.getTreePath() + "," + parent.getId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return treePath;
|
return treePath;
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ public class DictServiceImpl extends ServiceImpl<DictMapper, Dict> implements Di
|
|||||||
public DictForm getDictForm(Long id) {
|
public DictForm getDictForm(Long id) {
|
||||||
// 获取字典
|
// 获取字典
|
||||||
Dict entity = this.getById(id);
|
Dict entity = this.getById(id);
|
||||||
if(entity==null){
|
if (entity == null) {
|
||||||
throw new BusinessException("字典不存在");
|
throw new BusinessException("字典不存在");
|
||||||
}
|
}
|
||||||
return dictConverter.toForm(entity);
|
return dictConverter.toForm(entity);
|
||||||
@@ -108,7 +108,7 @@ public class DictServiceImpl extends ServiceImpl<DictMapper, Dict> implements Di
|
|||||||
.eq(Dict::getDictCode, dictCode)
|
.eq(Dict::getDictCode, dictCode)
|
||||||
.ne(Dict::getId, id)
|
.ne(Dict::getId, id)
|
||||||
);
|
);
|
||||||
if(count>0){
|
if (count > 0) {
|
||||||
throw new BusinessException("字典编码已存在");
|
throw new BusinessException("字典编码已存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,14 +122,8 @@ public class DictServiceImpl extends ServiceImpl<DictMapper, Dict> implements Di
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void deleteDictByIds(String ids) {
|
public void deleteDictByIds(List<String> ids) {
|
||||||
|
for (String id : ids) {
|
||||||
Assert.isTrue(StrUtil.isNotBlank(ids), "请选择需要删除的字典");
|
|
||||||
|
|
||||||
List<String> idList = Arrays.stream(ids.split(","))
|
|
||||||
.toList();
|
|
||||||
|
|
||||||
for (String id : idList) {
|
|
||||||
Dict dict = this.getById(id);
|
Dict dict = this.getById(id);
|
||||||
if (dict != null) {
|
if (dict != null) {
|
||||||
boolean removeResult = this.removeById(id);
|
boolean removeResult = this.removeById(id);
|
||||||
@@ -145,13 +139,13 @@ public class DictServiceImpl extends ServiceImpl<DictMapper, Dict> implements Di
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取所有字典和字典数据
|
* 获取字典列表(包含字典数据)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<DictVO> getAllDictWithData() {
|
public List<DictVO> getAllDictWithData() {
|
||||||
return this.baseMapper.getAllDictWithData();
|
return this.baseMapper.getAllDictWithData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,13 +7,12 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.youlai.boot.common.constant.SymbolConstant;
|
|
||||||
import com.youlai.boot.common.exception.BusinessException;
|
import com.youlai.boot.common.exception.BusinessException;
|
||||||
import com.youlai.boot.core.security.util.SecurityUtils;
|
import com.youlai.boot.core.security.util.SecurityUtils;
|
||||||
import com.youlai.boot.shared.websocket.service.OnlineUserService;
|
import com.youlai.boot.shared.websocket.service.OnlineUserService;
|
||||||
import com.youlai.boot.system.converter.NoticeConverter;
|
import com.youlai.boot.system.converter.NoticeConverter;
|
||||||
import com.youlai.boot.system.enums.NoticePublishStatusEnum;
|
import com.youlai.boot.system.enums.NoticePublishStatusEnum;
|
||||||
import com.youlai.boot.system.enums.NoticeTargetTypeEnum;
|
import com.youlai.boot.system.enums.NoticeTargetEnum;
|
||||||
import com.youlai.boot.system.mapper.NoticeMapper;
|
import com.youlai.boot.system.mapper.NoticeMapper;
|
||||||
import com.youlai.boot.system.model.bo.NoticeBO;
|
import com.youlai.boot.system.model.bo.NoticeBO;
|
||||||
import com.youlai.boot.system.model.dto.NoticeDTO;
|
import com.youlai.boot.system.model.dto.NoticeDTO;
|
||||||
@@ -95,7 +94,7 @@ public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> impleme
|
|||||||
@Override
|
@Override
|
||||||
public boolean saveNotice(NoticeForm formData) {
|
public boolean saveNotice(NoticeForm formData) {
|
||||||
|
|
||||||
if (NoticeTargetTypeEnum.SPECIFIED.getValue().equals(formData.getTargetType())) {
|
if (NoticeTargetEnum.SPECIFIED.getValue().equals(formData.getTargetType())) {
|
||||||
List<String> targetUserIdList = formData.getTargetUserIds();
|
List<String> targetUserIdList = formData.getTargetUserIds();
|
||||||
if (CollectionUtil.isEmpty(targetUserIdList)) {
|
if (CollectionUtil.isEmpty(targetUserIdList)) {
|
||||||
throw new BusinessException("推送指定用户不能为空");
|
throw new BusinessException("推送指定用户不能为空");
|
||||||
@@ -115,7 +114,7 @@ public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> impleme
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean updateNotice(Long id, NoticeForm formData) {
|
public boolean updateNotice(Long id, NoticeForm formData) {
|
||||||
if (NoticeTargetTypeEnum.SPECIFIED.getValue().equals(formData.getTargetType())) {
|
if (NoticeTargetEnum.SPECIFIED.getValue().equals(formData.getTargetType())) {
|
||||||
List<String> targetUserIdList = formData.getTargetUserIds();
|
List<String> targetUserIdList = formData.getTargetUserIds();
|
||||||
if (CollectionUtil.isEmpty(targetUserIdList)) {
|
if (CollectionUtil.isEmpty(targetUserIdList)) {
|
||||||
throw new BusinessException("推送指定用户不能为空");
|
throw new BusinessException("推送指定用户不能为空");
|
||||||
@@ -140,7 +139,7 @@ public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> impleme
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 逻辑删除
|
// 逻辑删除
|
||||||
List<Long> idList = Arrays.stream(ids.split(SymbolConstant.COMMA))
|
List<Long> idList = Arrays.stream(ids.split(","))
|
||||||
.map(Long::parseLong)
|
.map(Long::parseLong)
|
||||||
.toList();
|
.toList();
|
||||||
boolean isRemoved = this.removeByIds(idList);
|
boolean isRemoved = this.removeByIds(idList);
|
||||||
@@ -171,7 +170,7 @@ public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> impleme
|
|||||||
|
|
||||||
Integer targetType = notice.getTargetType();
|
Integer targetType = notice.getTargetType();
|
||||||
String targetUserIds = notice.getTargetUserIds();
|
String targetUserIds = notice.getTargetUserIds();
|
||||||
if (NoticeTargetTypeEnum.SPECIFIED.getValue().equals(targetType)
|
if (NoticeTargetEnum.SPECIFIED.getValue().equals(targetType)
|
||||||
&& StrUtil.isBlank(targetUserIds)) {
|
&& StrUtil.isBlank(targetUserIds)) {
|
||||||
throw new BusinessException("推送指定用户不能为空");
|
throw new BusinessException("推送指定用户不能为空");
|
||||||
}
|
}
|
||||||
@@ -189,7 +188,7 @@ public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> impleme
|
|||||||
|
|
||||||
// 添加新的用户通知数据
|
// 添加新的用户通知数据
|
||||||
List<String> targetUserIdList = null;
|
List<String> targetUserIdList = null;
|
||||||
if (NoticeTargetTypeEnum.SPECIFIED.getValue().equals(targetType)) {
|
if (NoticeTargetEnum.SPECIFIED.getValue().equals(targetType)) {
|
||||||
targetUserIdList = Arrays.asList(targetUserIds.split(","));
|
targetUserIdList = Arrays.asList(targetUserIds.split(","));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,7 +196,7 @@ public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> impleme
|
|||||||
new LambdaQueryWrapper<User>()
|
new LambdaQueryWrapper<User>()
|
||||||
// 如果是指定用户,则筛选出指定用户
|
// 如果是指定用户,则筛选出指定用户
|
||||||
.in(
|
.in(
|
||||||
NoticeTargetTypeEnum.SPECIFIED.getValue().equals(targetType),
|
NoticeTargetEnum.SPECIFIED.getValue().equals(targetType),
|
||||||
User::getId,
|
User::getId,
|
||||||
targetUserIdList
|
targetUserIdList
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -29,20 +29,6 @@
|
|||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 根据字典编码获取字典数据列表 -->
|
|
||||||
<select id="listDictDataByDictCode" resultType="com.youlai.boot.common.model.Option">
|
|
||||||
SELECT
|
|
||||||
value,
|
|
||||||
label
|
|
||||||
FROM
|
|
||||||
sys_dict_data
|
|
||||||
<where>
|
|
||||||
dict_code = #{dictCode}
|
|
||||||
</where>
|
|
||||||
ORDER BY
|
|
||||||
sort ASC
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<!-- 根据字典编码获取字典数据列表 -->
|
<!-- 根据字典编码获取字典数据列表 -->
|
||||||
<select id="getDictDataList" resultType="com.youlai.boot.system.model.vo.DictVO$DictData">
|
<select id="getDictDataList" resultType="com.youlai.boot.system.model.vo.DictVO$DictData">
|
||||||
SELECT
|
SELECT
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
</collection>
|
</collection>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<!-- 获取所有字典和字典数据 -->
|
<!-- 获取字典列表(包含字典数据) -->
|
||||||
<select id="getAllDictWithData" resultMap="DictWithDataMap">
|
<select id="getAllDictWithData" resultMap="DictWithDataMap">
|
||||||
SELECT
|
SELECT
|
||||||
t1.name,
|
t1.name,
|
||||||
|
|||||||
Reference in New Issue
Block a user