mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-18 09:35:29 +08:00
Pre Merge pull request !846 from YueYe/future/6.X
This commit is contained in:
commit
bd52e52a33
@ -18,7 +18,7 @@ description: 标准后端 CRUD 专家。用于当前项目中的新增单表 CRU
|
|||||||
- mapper 默认继承 `BaseMapperPlus<Entity, Vo>`
|
- mapper 默认继承 `BaseMapperPlus<Entity, Vo>`
|
||||||
- BO 使用 `@AutoMapper(target = Entity.class, reverseConvertGenerate = false)`
|
- BO 使用 `@AutoMapper(target = Entity.class, reverseConvertGenerate = false)`
|
||||||
- VO 使用 `@AutoMapper(target = Entity.class)`
|
- VO 使用 `@AutoMapper(target = Entity.class)`
|
||||||
- service 使用 `baseMapper`
|
- service 中的 Mapper 注入字段使用 Mapper 类型原名称的驼峰形式,例如 `testDemoMapper`
|
||||||
|
|
||||||
## 默认方法集合
|
## 默认方法集合
|
||||||
|
|
||||||
|
|||||||
@ -129,7 +129,7 @@ Vue 3、TypeScript API 文件、生成式列表页、表单状态、字典和日
|
|||||||
- 包路径和 `@RequestMapping` 与模块保持一致。
|
- 包路径和 `@RequestMapping` 与模块保持一致。
|
||||||
- 权限标识遵循 `${module}:${business}:${action}`。
|
- 权限标识遵循 `${module}:${business}:${action}`。
|
||||||
- Mapper 继承 `BaseMapperPlus<Entity, Vo>`。
|
- Mapper 继承 `BaseMapperPlus<Entity, Vo>`。
|
||||||
- Service 使用 `baseMapper`,并按场景返回 `PageResult` 或 `List<Vo>`。
|
- Service 中的 Mapper 注入字段使用 Mapper 类型原名称的驼峰形式,例如 `TestDemoMapper testDemoMapper`,并按场景返回 `PageResult` 或 `List<Vo>`。
|
||||||
- 查询代码优先使用 `LambdaQueryWrapper`,复杂模块沿用既有 MPJ 联表风格。
|
- 查询代码优先使用 `LambdaQueryWrapper`,复杂模块沿用既有 MPJ 联表风格。
|
||||||
- BO 使用 `@AutoMapper(target = Entity.class, reverseConvertGenerate = false)`。
|
- BO 使用 `@AutoMapper(target = Entity.class, reverseConvertGenerate = false)`。
|
||||||
- VO 使用 `@AutoMapper(target = Entity.class)`。
|
- VO 使用 `@AutoMapper(target = Entity.class)`。
|
||||||
|
|||||||
@ -86,13 +86,13 @@
|
|||||||
## Service 规则
|
## Service 规则
|
||||||
|
|
||||||
- 类声明通常是 `@RequiredArgsConstructor`、`@Service`,按需补 `@Slf4j`。
|
- 类声明通常是 `@RequiredArgsConstructor`、`@Service`,按需补 `@Slf4j`。
|
||||||
- mapper 注入字段命名为 `private final XxxMapper baseMapper;`。
|
- mapper 注入字段命名为 Mapper 类型原名称的驼峰形式,例如 `private final XxxMapper xxxMapper;`。
|
||||||
- 读操作通常返回 `Vo`、`List<Vo>` 或 `PageResult<Vo>`。
|
- 读操作通常返回 `Vo`、`List<Vo>` 或 `PageResult<Vo>`。
|
||||||
- BO 转实体用 `MapstructUtils.convert(bo, Entity.class)`。
|
- BO 转实体用 `MapstructUtils.convert(bo, Entity.class)`。
|
||||||
- 查询条件优先用 `LambdaQueryWrapper` 和 `Wrappers.lambdaQuery()`。
|
- 查询条件优先用 `LambdaQueryWrapper` 和 `Wrappers.lambdaQuery()`。
|
||||||
- 在 wrapper 条件里直接写 `StringUtils.isNotBlank(...)` 和 null 判断。
|
- 在 wrapper 条件里直接写 `StringUtils.isNotBlank(...)` 和 null 判断。
|
||||||
- 分页查询优先采用:
|
- 分页查询优先采用:
|
||||||
`Page<Vo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);`
|
`Page<Vo> result = xxxMapper.selectVoPage(pageQuery.build(), lqw);`
|
||||||
`return PageResult.build(result.getRecords(), result.getTotal());`
|
`return PageResult.build(result.getRecords(), result.getTotal());`
|
||||||
- 生成器风格模块保留 `validEntityBeforeSave(...)` 这种扩展点。
|
- 生成器风格模块保留 `validEntityBeforeSave(...)` 这种扩展点。
|
||||||
- 多表写操作使用 `@Transactional(rollbackFor = Exception.class)`。
|
- 多表写操作使用 `@Transactional(rollbackFor = Exception.class)`。
|
||||||
|
|||||||
@ -57,7 +57,7 @@ public class SysLoginService {
|
|||||||
private final ISysRoleService roleService;
|
private final ISysRoleService roleService;
|
||||||
private final ISysDeptService deptService;
|
private final ISysDeptService deptService;
|
||||||
private final ISysPostService postService;
|
private final ISysPostService postService;
|
||||||
private final SysUserMapper userMapper;
|
private final SysUserMapper sysUserMapper;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -181,7 +181,7 @@ public class SysLoginService {
|
|||||||
sysUser.setLoginIp(ip);
|
sysUser.setLoginIp(ip);
|
||||||
sysUser.setLoginDate(LocalDateTime.now());
|
sysUser.setLoginDate(LocalDateTime.now());
|
||||||
sysUser.setUpdateBy(userId);
|
sysUser.setUpdateBy(userId);
|
||||||
DataPermissionHelper.ignore(() -> userMapper.updateById(sysUser));
|
DataPermissionHelper.ignore(() -> sysUserMapper.updateById(sysUser));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -33,7 +33,7 @@ import org.springframework.stereotype.Service;
|
|||||||
public class SysRegisterService {
|
public class SysRegisterService {
|
||||||
|
|
||||||
private final ISysUserService userService;
|
private final ISysUserService userService;
|
||||||
private final SysUserMapper userMapper;
|
private final SysUserMapper sysUserMapper;
|
||||||
private final CaptchaProperties captchaProperties;
|
private final CaptchaProperties captchaProperties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -58,7 +58,7 @@ public class SysRegisterService {
|
|||||||
sysUser.setPassword(BCrypt.hashpw(password));
|
sysUser.setPassword(BCrypt.hashpw(password));
|
||||||
sysUser.setUserType(userType);
|
sysUser.setUserType(userType);
|
||||||
|
|
||||||
boolean exist = userMapper.exists(new LambdaQueryWrapper<SysUser>()
|
boolean exist = sysUserMapper.exists(new LambdaQueryWrapper<SysUser>()
|
||||||
.eq(SysUser::getUserName, sysUser.getUserName()));
|
.eq(SysUser::getUserName, sysUser.getUserName()));
|
||||||
if (exist) {
|
if (exist) {
|
||||||
throw new UserException("user.register.save.error", username);
|
throw new UserException("user.register.save.error", username);
|
||||||
|
|||||||
@ -40,7 +40,7 @@ import org.springframework.stereotype.Service;
|
|||||||
public class EmailAuthStrategy implements IAuthStrategy {
|
public class EmailAuthStrategy implements IAuthStrategy {
|
||||||
|
|
||||||
private final SysLoginService loginService;
|
private final SysLoginService loginService;
|
||||||
private final SysUserMapper userMapper;
|
private final SysUserMapper sysUserMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 执行邮箱验证码登录,并按客户端配置生成访问令牌。
|
* 执行邮箱验证码登录,并按客户端配置生成访问令牌。
|
||||||
@ -95,7 +95,7 @@ public class EmailAuthStrategy implements IAuthStrategy {
|
|||||||
* @return 用户信息
|
* @return 用户信息
|
||||||
*/
|
*/
|
||||||
private SysUserVo loadUserByEmail(String email) {
|
private SysUserVo loadUserByEmail(String email) {
|
||||||
SysUserVo user = userMapper.selectVoOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getEmail, email));
|
SysUserVo user = sysUserMapper.selectVoOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getEmail, email));
|
||||||
if (ObjectUtil.isNull(user)) {
|
if (ObjectUtil.isNull(user)) {
|
||||||
log.info("登录用户:{} 不存在.", email);
|
log.info("登录用户:{} 不存在.", email);
|
||||||
throw new UserException("user.not.exists", email);
|
throw new UserException("user.not.exists", email);
|
||||||
|
|||||||
@ -44,7 +44,7 @@ public class PasswordAuthStrategy implements IAuthStrategy {
|
|||||||
|
|
||||||
private final CaptchaProperties captchaProperties;
|
private final CaptchaProperties captchaProperties;
|
||||||
private final SysLoginService loginService;
|
private final SysLoginService loginService;
|
||||||
private final SysUserMapper userMapper;
|
private final SysUserMapper sysUserMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 执行账号密码登录,并按客户端配置生成访问令牌。
|
* 执行账号密码登录,并按客户端配置生成访问令牌。
|
||||||
@ -112,7 +112,7 @@ public class PasswordAuthStrategy implements IAuthStrategy {
|
|||||||
* @return 用户信息
|
* @return 用户信息
|
||||||
*/
|
*/
|
||||||
private SysUserVo loadUserByUsername(String username) {
|
private SysUserVo loadUserByUsername(String username) {
|
||||||
SysUserVo user = userMapper.selectVoOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUserName, username));
|
SysUserVo user = sysUserMapper.selectVoOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUserName, username));
|
||||||
if (ObjectUtil.isNull(user)) {
|
if (ObjectUtil.isNull(user)) {
|
||||||
log.info("登录用户:{} 不存在.", username);
|
log.info("登录用户:{} 不存在.", username);
|
||||||
throw new UserException("user.not.exists", username);
|
throw new UserException("user.not.exists", username);
|
||||||
|
|||||||
@ -40,7 +40,7 @@ import org.springframework.stereotype.Service;
|
|||||||
public class SmsAuthStrategy implements IAuthStrategy {
|
public class SmsAuthStrategy implements IAuthStrategy {
|
||||||
|
|
||||||
private final SysLoginService loginService;
|
private final SysLoginService loginService;
|
||||||
private final SysUserMapper userMapper;
|
private final SysUserMapper sysUserMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 执行短信验证码登录,并按客户端配置生成访问令牌。
|
* 执行短信验证码登录,并按客户端配置生成访问令牌。
|
||||||
@ -95,7 +95,7 @@ public class SmsAuthStrategy implements IAuthStrategy {
|
|||||||
* @return 用户信息
|
* @return 用户信息
|
||||||
*/
|
*/
|
||||||
private SysUserVo loadUserByPhoneNumber(String phoneNumber) {
|
private SysUserVo loadUserByPhoneNumber(String phoneNumber) {
|
||||||
SysUserVo user = userMapper.selectVoOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getPhoneNumber, phoneNumber));
|
SysUserVo user = sysUserMapper.selectVoOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getPhoneNumber, phoneNumber));
|
||||||
if (ObjectUtil.isNull(user)) {
|
if (ObjectUtil.isNull(user)) {
|
||||||
log.info("登录用户:{} 不存在.", phoneNumber);
|
log.info("登录用户:{} 不存在.", phoneNumber);
|
||||||
throw new UserException("user.not.exists", phoneNumber);
|
throw new UserException("user.not.exists", phoneNumber);
|
||||||
|
|||||||
@ -42,7 +42,7 @@ public class SocialAuthStrategy implements IAuthStrategy {
|
|||||||
|
|
||||||
private final SocialProperties socialProperties;
|
private final SocialProperties socialProperties;
|
||||||
private final ISysSocialService sysSocialService;
|
private final ISysSocialService sysSocialService;
|
||||||
private final SysUserMapper userMapper;
|
private final SysUserMapper sysUserMapper;
|
||||||
private final SysLoginService loginService;
|
private final SysLoginService loginService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -91,7 +91,7 @@ public class SocialAuthStrategy implements IAuthStrategy {
|
|||||||
* @return 用户信息
|
* @return 用户信息
|
||||||
*/
|
*/
|
||||||
private SysUserVo loadUser(Long userId) {
|
private SysUserVo loadUser(Long userId) {
|
||||||
SysUserVo user = userMapper.selectVoById(userId);
|
SysUserVo user = sysUserMapper.selectVoById(userId);
|
||||||
if (ObjectUtil.isNull(user)) {
|
if (ObjectUtil.isNull(user)) {
|
||||||
log.info("登录用户:{} 不存在.", "");
|
log.info("登录用户:{} 不存在.", "");
|
||||||
throw new UserException("user.not.exists", "");
|
throw new UserException("user.not.exists", "");
|
||||||
|
|||||||
@ -25,7 +25,7 @@ import java.util.Map;
|
|||||||
public class TestEncryptController {
|
public class TestEncryptController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private TestDemoEncryptMapper mapper;
|
private TestDemoEncryptMapper testDemoEncryptMapper;
|
||||||
@Value("${mybatis-encryptor.enable}")
|
@Value("${mybatis-encryptor.enable}")
|
||||||
private Boolean encryptEnable;
|
private Boolean encryptEnable;
|
||||||
|
|
||||||
@ -44,9 +44,9 @@ public class TestEncryptController {
|
|||||||
TestDemoEncrypt demo = new TestDemoEncrypt();
|
TestDemoEncrypt demo = new TestDemoEncrypt();
|
||||||
demo.setTestKey(key);
|
demo.setTestKey(key);
|
||||||
demo.setValue(value);
|
demo.setValue(value);
|
||||||
mapper.insert(demo);
|
testDemoEncryptMapper.insert(demo);
|
||||||
map.put("加密", demo);
|
map.put("加密", demo);
|
||||||
TestDemoEncrypt testDemo = mapper.selectById(demo.getId());
|
TestDemoEncrypt testDemo = testDemoEncryptMapper.selectById(demo.getId());
|
||||||
map.put("解密", testDemo);
|
map.put("解密", testDemo);
|
||||||
return R.ok(map);
|
return R.ok(map);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,7 +29,7 @@ import java.util.List;
|
|||||||
@Service
|
@Service
|
||||||
public class TestDemoServiceImpl implements ITestDemoService {
|
public class TestDemoServiceImpl implements ITestDemoService {
|
||||||
|
|
||||||
private final TestDemoMapper baseMapper;
|
private final TestDemoMapper testDemoMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据主键查询测试单表详情。
|
* 根据主键查询测试单表详情。
|
||||||
@ -39,7 +39,7 @@ public class TestDemoServiceImpl implements ITestDemoService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public TestDemoVo queryById(Long id) {
|
public TestDemoVo queryById(Long id) {
|
||||||
return baseMapper.selectVoById(id);
|
return testDemoMapper.selectVoById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -52,7 +52,7 @@ public class TestDemoServiceImpl implements ITestDemoService {
|
|||||||
@Override
|
@Override
|
||||||
public PageResult<TestDemoVo> queryPageList(TestDemoBo bo, PageQuery pageQuery) {
|
public PageResult<TestDemoVo> queryPageList(TestDemoBo bo, PageQuery pageQuery) {
|
||||||
LambdaQueryWrapper<TestDemo> lqw = buildQueryWrapper(bo);
|
LambdaQueryWrapper<TestDemo> lqw = buildQueryWrapper(bo);
|
||||||
Page<TestDemoVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
Page<TestDemoVo> result = testDemoMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
return PageResult.build(result.getRecords(), result.getTotal());
|
return PageResult.build(result.getRecords(), result.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ public class TestDemoServiceImpl implements ITestDemoService {
|
|||||||
@Override
|
@Override
|
||||||
public PageResult<TestDemoVo> customPageList(TestDemoBo bo, PageQuery pageQuery) {
|
public PageResult<TestDemoVo> customPageList(TestDemoBo bo, PageQuery pageQuery) {
|
||||||
LambdaQueryWrapper<TestDemo> lqw = buildQueryWrapper(bo);
|
LambdaQueryWrapper<TestDemo> lqw = buildQueryWrapper(bo);
|
||||||
Page<TestDemoVo> result = baseMapper.customPageList(pageQuery.build(), lqw);
|
Page<TestDemoVo> result = testDemoMapper.customPageList(pageQuery.build(), lqw);
|
||||||
return PageResult.build(result.getRecords(), result.getTotal());
|
return PageResult.build(result.getRecords(), result.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ public class TestDemoServiceImpl implements ITestDemoService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<TestDemoVo> queryList(TestDemoBo bo) {
|
public List<TestDemoVo> queryList(TestDemoBo bo) {
|
||||||
return baseMapper.selectVoList(buildQueryWrapper(bo));
|
return testDemoMapper.selectVoList(buildQueryWrapper(bo));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -107,7 +107,7 @@ public class TestDemoServiceImpl implements ITestDemoService {
|
|||||||
public Boolean insertByBo(TestDemoBo bo) {
|
public Boolean insertByBo(TestDemoBo bo) {
|
||||||
TestDemo add = MapstructUtils.convert(bo, TestDemo.class);
|
TestDemo add = MapstructUtils.convert(bo, TestDemo.class);
|
||||||
validEntityBeforeSave(add);
|
validEntityBeforeSave(add);
|
||||||
boolean flag = baseMapper.insert(add) > 0;
|
boolean flag = testDemoMapper.insert(add) > 0;
|
||||||
if (flag) {
|
if (flag) {
|
||||||
bo.setId(add.getId());
|
bo.setId(add.getId());
|
||||||
}
|
}
|
||||||
@ -124,7 +124,7 @@ public class TestDemoServiceImpl implements ITestDemoService {
|
|||||||
public Boolean updateByBo(TestDemoBo bo) {
|
public Boolean updateByBo(TestDemoBo bo) {
|
||||||
TestDemo update = MapstructUtils.convert(bo, TestDemo.class);
|
TestDemo update = MapstructUtils.convert(bo, TestDemo.class);
|
||||||
validEntityBeforeSave(update);
|
validEntityBeforeSave(update);
|
||||||
return baseMapper.updateById(update) > 0;
|
return testDemoMapper.updateById(update) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -147,12 +147,12 @@ public class TestDemoServiceImpl implements ITestDemoService {
|
|||||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||||
if (isValid) {
|
if (isValid) {
|
||||||
// 做一些业务上的校验,判断是否需要校验
|
// 做一些业务上的校验,判断是否需要校验
|
||||||
List<TestDemo> list = baseMapper.selectByIds(ids);
|
List<TestDemo> list = testDemoMapper.selectByIds(ids);
|
||||||
if (list.size() != ids.size()) {
|
if (list.size() != ids.size()) {
|
||||||
throw new ServiceException("您没有删除权限!");
|
throw new ServiceException("您没有删除权限!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return baseMapper.deleteByIds(ids) > 0;
|
return testDemoMapper.deleteByIds(ids) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -163,6 +163,6 @@ public class TestDemoServiceImpl implements ITestDemoService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Boolean saveBatch(List<TestDemo> list) {
|
public Boolean saveBatch(List<TestDemo> list) {
|
||||||
return baseMapper.insertBatch(list);
|
return testDemoMapper.insertBatch(list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,7 +26,7 @@ import java.util.List;
|
|||||||
@Service
|
@Service
|
||||||
public class TestTreeServiceImpl implements ITestTreeService {
|
public class TestTreeServiceImpl implements ITestTreeService {
|
||||||
|
|
||||||
private final TestTreeMapper baseMapper;
|
private final TestTreeMapper testTreeMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据主键查询测试树表详情。
|
* 根据主键查询测试树表详情。
|
||||||
@ -36,7 +36,7 @@ public class TestTreeServiceImpl implements ITestTreeService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public TestTreeVo queryById(Long id) {
|
public TestTreeVo queryById(Long id) {
|
||||||
return baseMapper.selectVoById(id);
|
return testTreeMapper.selectVoById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @DS("slave") // 切换从库查询
|
// @DS("slave") // 切换从库查询
|
||||||
@ -49,7 +49,7 @@ public class TestTreeServiceImpl implements ITestTreeService {
|
|||||||
@Override
|
@Override
|
||||||
public List<TestTreeVo> queryList(TestTreeBo bo) {
|
public List<TestTreeVo> queryList(TestTreeBo bo) {
|
||||||
LambdaQueryWrapper<TestTree> lqw = buildQueryWrapper(bo);
|
LambdaQueryWrapper<TestTree> lqw = buildQueryWrapper(bo);
|
||||||
return baseMapper.selectVoList(lqw);
|
return testTreeMapper.selectVoList(lqw);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -77,7 +77,7 @@ public class TestTreeServiceImpl implements ITestTreeService {
|
|||||||
public Boolean insertByBo(TestTreeBo bo) {
|
public Boolean insertByBo(TestTreeBo bo) {
|
||||||
TestTree add = MapstructUtils.convert(bo, TestTree.class);
|
TestTree add = MapstructUtils.convert(bo, TestTree.class);
|
||||||
validEntityBeforeSave(add);
|
validEntityBeforeSave(add);
|
||||||
boolean flag = baseMapper.insert(add) > 0;
|
boolean flag = testTreeMapper.insert(add) > 0;
|
||||||
if (flag) {
|
if (flag) {
|
||||||
bo.setId(add.getId());
|
bo.setId(add.getId());
|
||||||
}
|
}
|
||||||
@ -94,7 +94,7 @@ public class TestTreeServiceImpl implements ITestTreeService {
|
|||||||
public Boolean updateByBo(TestTreeBo bo) {
|
public Boolean updateByBo(TestTreeBo bo) {
|
||||||
TestTree update = MapstructUtils.convert(bo, TestTree.class);
|
TestTree update = MapstructUtils.convert(bo, TestTree.class);
|
||||||
validEntityBeforeSave(update);
|
validEntityBeforeSave(update);
|
||||||
return baseMapper.updateById(update) > 0;
|
return testTreeMapper.updateById(update) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -118,6 +118,6 @@ public class TestTreeServiceImpl implements ITestTreeService {
|
|||||||
if (isValid) {
|
if (isValid) {
|
||||||
//TODO 做一些业务上的校验,判断是否需要校验
|
//TODO 做一些业务上的校验,判断是否需要校验
|
||||||
}
|
}
|
||||||
return baseMapper.deleteByIds(ids) > 0;
|
return testTreeMapper.deleteByIds(ids) > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -53,7 +53,7 @@ import java.util.zip.ZipOutputStream;
|
|||||||
@Service
|
@Service
|
||||||
public class GenTableServiceImpl implements IGenTableService {
|
public class GenTableServiceImpl implements IGenTableService {
|
||||||
|
|
||||||
private final GenTableMapper baseMapper;
|
private final GenTableMapper genTableMapper;
|
||||||
private final GenTableColumnMapper genTableColumnMapper;
|
private final GenTableColumnMapper genTableColumnMapper;
|
||||||
|
|
||||||
private static final String[] TABLE_IGNORE = new String[]{"sj_", "flow_", "gen_"};
|
private static final String[] TABLE_IGNORE = new String[]{"sj_", "flow_", "gen_"};
|
||||||
@ -93,7 +93,7 @@ public class GenTableServiceImpl implements IGenTableService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public PageResult<GenTable> selectPageGenTableList(GenTable genTable, PageQuery pageQuery) {
|
public PageResult<GenTable> selectPageGenTableList(GenTable genTable, PageQuery pageQuery) {
|
||||||
Page<GenTable> page = baseMapper.selectPage(pageQuery.build(), this.buildGenTableQueryWrapper(genTable));
|
Page<GenTable> page = genTableMapper.selectPage(pageQuery.build(), this.buildGenTableQueryWrapper(genTable));
|
||||||
return PageResult.build(page.getRecords(), page.getTotal());
|
return PageResult.build(page.getRecords(), page.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,7 +134,7 @@ public class GenTableServiceImpl implements IGenTableService {
|
|||||||
if (CollUtil.isEmpty(tablesMap)) {
|
if (CollUtil.isEmpty(tablesMap)) {
|
||||||
return PageResult.build();
|
return PageResult.build();
|
||||||
}
|
}
|
||||||
List<String> tableNames = baseMapper.selectTableNameList(genTable.getDataName());
|
List<String> tableNames = genTableMapper.selectTableNameList(genTable.getDataName());
|
||||||
String[] tableArrays;
|
String[] tableArrays;
|
||||||
if (CollUtil.isNotEmpty(tableNames)) {
|
if (CollUtil.isNotEmpty(tableNames)) {
|
||||||
tableArrays = tableNames.toArray(new String[0]);
|
tableArrays = tableNames.toArray(new String[0]);
|
||||||
@ -230,7 +230,7 @@ public class GenTableServiceImpl implements IGenTableService {
|
|||||||
normalizeColumnOptions(genTable.getColumns());
|
normalizeColumnOptions(genTable.getColumns());
|
||||||
String options = JsonUtils.toJsonString(genTable.getParams());
|
String options = JsonUtils.toJsonString(genTable.getParams());
|
||||||
genTable.setOptions(options);
|
genTable.setOptions(options);
|
||||||
int row = baseMapper.updateById(genTable);
|
int row = genTableMapper.updateById(genTable);
|
||||||
if (row > 0) {
|
if (row > 0) {
|
||||||
genTableColumnMapper.updateBatchById(genTable.getColumns());
|
genTableColumnMapper.updateBatchById(genTable.getColumns());
|
||||||
}
|
}
|
||||||
@ -245,7 +245,7 @@ public class GenTableServiceImpl implements IGenTableService {
|
|||||||
@Override
|
@Override
|
||||||
public void deleteGenTableByIds(Long[] tableIds) {
|
public void deleteGenTableByIds(Long[] tableIds) {
|
||||||
List<Long> ids = Arrays.asList(tableIds);
|
List<Long> ids = Arrays.asList(tableIds);
|
||||||
baseMapper.deleteByIds(ids);
|
genTableMapper.deleteByIds(ids);
|
||||||
genTableColumnMapper.delete(new LambdaQueryWrapper<GenTableColumn>().in(GenTableColumn::getTableId, ids));
|
genTableColumnMapper.delete(new LambdaQueryWrapper<GenTableColumn>().in(GenTableColumn::getTableId, ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -263,7 +263,7 @@ public class GenTableServiceImpl implements IGenTableService {
|
|||||||
String tableName = table.getTableName();
|
String tableName = table.getTableName();
|
||||||
GenUtils.initTable(table);
|
GenUtils.initTable(table);
|
||||||
table.setDataName(dataName);
|
table.setDataName(dataName);
|
||||||
int row = baseMapper.insert(table);
|
int row = genTableMapper.insert(table);
|
||||||
if (row > 0) {
|
if (row > 0) {
|
||||||
// 保存列信息
|
// 保存列信息
|
||||||
List<GenTableColumn> genTableColumns = SpringUtils.getAopProxy(this).selectDbTableColumnsByName(tableName, dataName);
|
List<GenTableColumn> genTableColumns = SpringUtils.getAopProxy(this).selectDbTableColumnsByName(tableName, dataName);
|
||||||
@ -532,7 +532,7 @@ public class GenTableServiceImpl implements IGenTableService {
|
|||||||
* @return 包含字段集合的业务表实体
|
* @return 包含字段集合的业务表实体
|
||||||
*/
|
*/
|
||||||
private GenTable getGenTable(Long tableId) {
|
private GenTable getGenTable(Long tableId) {
|
||||||
GenTable table = baseMapper.selectById(tableId);
|
GenTable table = genTableMapper.selectById(tableId);
|
||||||
if (ObjectUtil.isNull(table)) {
|
if (ObjectUtil.isNull(table)) {
|
||||||
throw new ServiceException("业务表不存在");
|
throw new ServiceException("业务表不存在");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,7 +41,7 @@ import java.util.Collection;
|
|||||||
@Service
|
@Service
|
||||||
public class ${ClassName}ServiceImpl implements I${ClassName}Service {
|
public class ${ClassName}ServiceImpl implements I${ClassName}Service {
|
||||||
|
|
||||||
private final ${ClassName}Mapper baseMapper;
|
private final ${ClassName}Mapper ${className}Mapper;
|
||||||
|
|
||||||
#set($TreeParentCap = "")
|
#set($TreeParentCap = "")
|
||||||
#if("" != $treeParentCode)
|
#if("" != $treeParentCode)
|
||||||
@ -64,7 +64,7 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ${ClassName}Vo queryById(${pkColumn.javaType} ${pkColumn.javaField}) {
|
public ${ClassName}Vo queryById(${pkColumn.javaType} ${pkColumn.javaField}) {
|
||||||
return baseMapper.selectVoById(${pkColumn.javaField});
|
return ${className}Mapper.selectVoById(${pkColumn.javaField});
|
||||||
}
|
}
|
||||||
|
|
||||||
#if($table.crud)
|
#if($table.crud)
|
||||||
@ -78,7 +78,7 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service {
|
|||||||
@Override
|
@Override
|
||||||
public PageResult<${ClassName}Vo> queryPageList(${ClassName}Bo bo, PageQuery pageQuery) {
|
public PageResult<${ClassName}Vo> queryPageList(${ClassName}Bo bo, PageQuery pageQuery) {
|
||||||
LambdaQueryWrapper<${ClassName}> lqw = buildQueryWrapper(bo);
|
LambdaQueryWrapper<${ClassName}> lqw = buildQueryWrapper(bo);
|
||||||
Page<${ClassName}Vo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
Page<${ClassName}Vo> result = ${className}Mapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
return PageResult.build(result.getRecords(), result.getTotal());
|
return PageResult.build(result.getRecords(), result.getTotal());
|
||||||
}
|
}
|
||||||
#end
|
#end
|
||||||
@ -92,7 +92,7 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service {
|
|||||||
@Override
|
@Override
|
||||||
public List<${ClassName}Vo> queryList(${ClassName}Bo bo) {
|
public List<${ClassName}Vo> queryList(${ClassName}Bo bo) {
|
||||||
LambdaQueryWrapper<${ClassName}> lqw = buildQueryWrapper(bo);
|
LambdaQueryWrapper<${ClassName}> lqw = buildQueryWrapper(bo);
|
||||||
return baseMapper.selectVoList(lqw);
|
return ${className}Mapper.selectVoList(lqw);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if($enableUnique)
|
#if($enableUnique)
|
||||||
@ -120,7 +120,7 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service {
|
|||||||
lqw.eq(${ClassName}::get${column.capJavaField}, bo.get${column.capJavaField}());
|
lqw.eq(${ClassName}::get${column.capJavaField}, bo.get${column.capJavaField}());
|
||||||
#end
|
#end
|
||||||
lqw.ne(bo.get${pkColumn.capJavaField}() != null, ${ClassName}::get${pkColumn.capJavaField}, bo.get${pkColumn.capJavaField}());
|
lqw.ne(bo.get${pkColumn.capJavaField}() != null, ${ClassName}::get${pkColumn.capJavaField}, bo.get${pkColumn.capJavaField}());
|
||||||
return !baseMapper.exists(lqw);
|
return !${className}Mapper.exists(lqw);
|
||||||
}
|
}
|
||||||
#end
|
#end
|
||||||
|
|
||||||
@ -182,7 +182,7 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service {
|
|||||||
fillTreeMetaBeforeSave(add, false);
|
fillTreeMetaBeforeSave(add, false);
|
||||||
#end
|
#end
|
||||||
validEntityBeforeSave(add);
|
validEntityBeforeSave(add);
|
||||||
boolean flag = baseMapper.insert(add) > 0;
|
boolean flag = ${className}Mapper.insert(add) > 0;
|
||||||
if (flag) {
|
if (flag) {
|
||||||
bo.set${pkColumn.capJavaField}(add.get${pkColumn.capJavaField}());
|
bo.set${pkColumn.capJavaField}(add.get${pkColumn.capJavaField}());
|
||||||
}
|
}
|
||||||
@ -202,7 +202,7 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service {
|
|||||||
fillTreeMetaBeforeSave(update, true);
|
fillTreeMetaBeforeSave(update, true);
|
||||||
#end
|
#end
|
||||||
validEntityBeforeSave(update);
|
validEntityBeforeSave(update);
|
||||||
return baseMapper.updateById(update) > 0;
|
return ${className}Mapper.updateById(update) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if($enableStatus)
|
#if($enableStatus)
|
||||||
@ -215,7 +215,7 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Boolean updateStatus(${pkColumn.javaType} ${pkColumn.javaField}, ${statusColumn.javaType} status) {
|
public Boolean updateStatus(${pkColumn.javaType} ${pkColumn.javaField}, ${statusColumn.javaType} status) {
|
||||||
return baseMapper.update(null, new LambdaUpdateWrapper<${ClassName}>()
|
return ${className}Mapper.update(null, new LambdaUpdateWrapper<${ClassName}>()
|
||||||
.set(${ClassName}::get${statusColumn.capJavaField}, status)
|
.set(${ClassName}::get${statusColumn.capJavaField}, status)
|
||||||
.eq(${ClassName}::get${pkColumn.capJavaField}, ${pkColumn.javaField})) > 0;
|
.eq(${ClassName}::get${pkColumn.capJavaField}, ${pkColumn.javaField})) > 0;
|
||||||
}
|
}
|
||||||
@ -231,7 +231,7 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Boolean updateSort(${pkColumn.javaType} ${pkColumn.javaField}, ${sortColumn.javaType} sortValue) {
|
public Boolean updateSort(${pkColumn.javaType} ${pkColumn.javaField}, ${sortColumn.javaType} sortValue) {
|
||||||
return baseMapper.update(null, new LambdaUpdateWrapper<${ClassName}>()
|
return ${className}Mapper.update(null, new LambdaUpdateWrapper<${ClassName}>()
|
||||||
.set(${ClassName}::get${sortColumn.capJavaField}, sortValue)
|
.set(${ClassName}::get${sortColumn.capJavaField}, sortValue)
|
||||||
.eq(${ClassName}::get${pkColumn.capJavaField}, ${pkColumn.javaField})) > 0;
|
.eq(${ClassName}::get${pkColumn.capJavaField}, ${pkColumn.javaField})) > 0;
|
||||||
}
|
}
|
||||||
@ -256,7 +256,7 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service {
|
|||||||
#if("" != $treeAncestorsField)
|
#if("" != $treeAncestorsField)
|
||||||
${ClassName} parent = null;
|
${ClassName} parent = null;
|
||||||
if (!ObjectUtil.equal(entity.get${TreeParentCap}(), ${treeRootValueJavaLiteral})) {
|
if (!ObjectUtil.equal(entity.get${TreeParentCap}(), ${treeRootValueJavaLiteral})) {
|
||||||
parent = baseMapper.selectById(entity.get${TreeParentCap}());
|
parent = ${className}Mapper.selectById(entity.get${TreeParentCap}());
|
||||||
if (ObjectUtil.isNull(parent)) {
|
if (ObjectUtil.isNull(parent)) {
|
||||||
throw new ServiceException("${functionName}父节点不存在");
|
throw new ServiceException("${functionName}父节点不存在");
|
||||||
}
|
}
|
||||||
@ -267,7 +267,7 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service {
|
|||||||
}
|
}
|
||||||
String newAncestors = resolveAncestors(entity.get${TreeParentCap}(), parent);
|
String newAncestors = resolveAncestors(entity.get${TreeParentCap}(), parent);
|
||||||
if (updateMode && entity.get${pkColumn.capJavaField}() != null) {
|
if (updateMode && entity.get${pkColumn.capJavaField}() != null) {
|
||||||
${ClassName} oldEntity = baseMapper.selectById(entity.get${pkColumn.capJavaField}());
|
${ClassName} oldEntity = ${className}Mapper.selectById(entity.get${pkColumn.capJavaField}());
|
||||||
if (ObjectUtil.isNull(oldEntity)) {
|
if (ObjectUtil.isNull(oldEntity)) {
|
||||||
throw new ServiceException("${functionName}不存在,无法修改");
|
throw new ServiceException("${functionName}不存在,无法修改");
|
||||||
}
|
}
|
||||||
@ -296,7 +296,7 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateChildrenAncestors(${pkColumn.javaType} currentId, String newAncestors, String oldAncestors) {
|
private void updateChildrenAncestors(${pkColumn.javaType} currentId, String newAncestors, String oldAncestors) {
|
||||||
List<${ClassName}> children = baseMapper.selectList(new LambdaQueryWrapper<${ClassName}>()
|
List<${ClassName}> children = ${className}Mapper.selectList(new LambdaQueryWrapper<${ClassName}>()
|
||||||
.select(${ClassName}::get${pkColumn.capJavaField}, ${ClassName}::get${TreeAncestorsCap}()));
|
.select(${ClassName}::get${pkColumn.capJavaField}, ${ClassName}::get${TreeAncestorsCap}()));
|
||||||
List<${ClassName}> updateList = new ArrayList<>();
|
List<${ClassName}> updateList = new ArrayList<>();
|
||||||
for (${ClassName} child : children) {
|
for (${ClassName} child : children) {
|
||||||
@ -310,7 +310,7 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service {
|
|||||||
updateList.add(update);
|
updateList.add(update);
|
||||||
}
|
}
|
||||||
if (!updateList.isEmpty()) {
|
if (!updateList.isEmpty()) {
|
||||||
baseMapper.updateBatchById(updateList);
|
${className}Mapper.updateBatchById(updateList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -337,6 +337,6 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service {
|
|||||||
if (isValid) {
|
if (isValid) {
|
||||||
// 可在此扩展删除前业务校验
|
// 可在此扩展删除前业务校验
|
||||||
}
|
}
|
||||||
return baseMapper.deleteByIds(ids) > 0;
|
return ${className}Mapper.deleteByIds(ids) > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,7 +40,7 @@ public class SysClientServiceImpl implements ISysClientService {
|
|||||||
|
|
||||||
private static final String CLIENT_RULE_SEPARATOR_REGEX = "[,;\\r\\n]+";
|
private static final String CLIENT_RULE_SEPARATOR_REGEX = "[,;\\r\\n]+";
|
||||||
|
|
||||||
private final SysClientMapper baseMapper;
|
private final SysClientMapper sysClientMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询客户端管理
|
* 查询客户端管理
|
||||||
@ -50,7 +50,7 @@ public class SysClientServiceImpl implements ISysClientService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public SysClientVo queryById(Long id) {
|
public SysClientVo queryById(Long id) {
|
||||||
SysClientVo vo = baseMapper.selectVoById(id);
|
SysClientVo vo = sysClientMapper.selectVoById(id);
|
||||||
fillClientRuleFields(vo);
|
fillClientRuleFields(vo);
|
||||||
return vo;
|
return vo;
|
||||||
}
|
}
|
||||||
@ -64,7 +64,7 @@ public class SysClientServiceImpl implements ISysClientService {
|
|||||||
@Cacheable(cacheNames = CacheNames.SYS_CLIENT, key = "#clientId")
|
@Cacheable(cacheNames = CacheNames.SYS_CLIENT, key = "#clientId")
|
||||||
@Override
|
@Override
|
||||||
public SysClientVo queryByClientId(String clientId) {
|
public SysClientVo queryByClientId(String clientId) {
|
||||||
SysClientVo vo = baseMapper.selectVoOne(new LambdaQueryWrapper<SysClient>().eq(SysClient::getClientId, clientId));
|
SysClientVo vo = sysClientMapper.selectVoOne(new LambdaQueryWrapper<SysClient>().eq(SysClient::getClientId, clientId));
|
||||||
fillClientRuleFields(vo);
|
fillClientRuleFields(vo);
|
||||||
return vo;
|
return vo;
|
||||||
}
|
}
|
||||||
@ -79,7 +79,7 @@ public class SysClientServiceImpl implements ISysClientService {
|
|||||||
@Override
|
@Override
|
||||||
public PageResult<SysClientVo> queryPageList(SysClientBo bo, PageQuery pageQuery) {
|
public PageResult<SysClientVo> queryPageList(SysClientBo bo, PageQuery pageQuery) {
|
||||||
LambdaQueryWrapper<SysClient> lqw = buildQueryWrapper(bo);
|
LambdaQueryWrapper<SysClient> lqw = buildQueryWrapper(bo);
|
||||||
Page<SysClientVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
Page<SysClientVo> result = sysClientMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
result.getRecords().forEach(this::fillClientRuleFields);
|
result.getRecords().forEach(this::fillClientRuleFields);
|
||||||
return PageResult.build(result.getRecords(), result.getTotal());
|
return PageResult.build(result.getRecords(), result.getTotal());
|
||||||
}
|
}
|
||||||
@ -93,7 +93,7 @@ public class SysClientServiceImpl implements ISysClientService {
|
|||||||
@Override
|
@Override
|
||||||
public List<SysClientVo> queryList(SysClientBo bo) {
|
public List<SysClientVo> queryList(SysClientBo bo) {
|
||||||
LambdaQueryWrapper<SysClient> lqw = buildQueryWrapper(bo);
|
LambdaQueryWrapper<SysClient> lqw = buildQueryWrapper(bo);
|
||||||
List<SysClientVo> list = baseMapper.selectVoList(lqw);
|
List<SysClientVo> list = sysClientMapper.selectVoList(lqw);
|
||||||
list.forEach(this::fillClientRuleFields);
|
list.forEach(this::fillClientRuleFields);
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
@ -130,7 +130,7 @@ public class SysClientServiceImpl implements ISysClientService {
|
|||||||
String clientKey = bo.getClientKey();
|
String clientKey = bo.getClientKey();
|
||||||
String clientSecret = bo.getClientSecret();
|
String clientSecret = bo.getClientSecret();
|
||||||
add.setClientId(SecureUtil.md5(clientKey + clientSecret));
|
add.setClientId(SecureUtil.md5(clientKey + clientSecret));
|
||||||
boolean flag = baseMapper.insert(add) > 0;
|
boolean flag = sysClientMapper.insert(add) > 0;
|
||||||
if (flag) {
|
if (flag) {
|
||||||
bo.setId(add.getId());
|
bo.setId(add.getId());
|
||||||
}
|
}
|
||||||
@ -150,7 +150,7 @@ public class SysClientServiceImpl implements ISysClientService {
|
|||||||
update.setGrantType(StringUtils.joinComma(bo.getGrantTypeList()));
|
update.setGrantType(StringUtils.joinComma(bo.getGrantTypeList()));
|
||||||
update.setAccessPath(resolveRuleValue(bo.getAccessPath(), bo.getAccessPathList(), this::normalizeAccessPath));
|
update.setAccessPath(resolveRuleValue(bo.getAccessPath(), bo.getAccessPathList(), this::normalizeAccessPath));
|
||||||
update.setIpWhitelist(resolveRuleValue(bo.getIpWhitelist(), bo.getIpWhitelistList(), UnaryOperator.identity()));
|
update.setIpWhitelist(resolveRuleValue(bo.getIpWhitelist(), bo.getIpWhitelistList(), UnaryOperator.identity()));
|
||||||
return baseMapper.updateById(update) > 0;
|
return sysClientMapper.updateById(update) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -163,7 +163,7 @@ public class SysClientServiceImpl implements ISysClientService {
|
|||||||
@CacheEvict(cacheNames = CacheNames.SYS_CLIENT, key = "#clientId")
|
@CacheEvict(cacheNames = CacheNames.SYS_CLIENT, key = "#clientId")
|
||||||
@Override
|
@Override
|
||||||
public int updateClientStatus(String clientId, String status) {
|
public int updateClientStatus(String clientId, String status) {
|
||||||
return baseMapper.update(null,
|
return sysClientMapper.update(null,
|
||||||
new LambdaUpdateWrapper<SysClient>()
|
new LambdaUpdateWrapper<SysClient>()
|
||||||
.set(SysClient::getStatus, status)
|
.set(SysClient::getStatus, status)
|
||||||
.eq(SysClient::getClientId, clientId));
|
.eq(SysClient::getClientId, clientId));
|
||||||
@ -179,7 +179,7 @@ public class SysClientServiceImpl implements ISysClientService {
|
|||||||
@CacheEvict(cacheNames = CacheNames.SYS_CLIENT, allEntries = true)
|
@CacheEvict(cacheNames = CacheNames.SYS_CLIENT, allEntries = true)
|
||||||
@Override
|
@Override
|
||||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||||
return baseMapper.deleteByIds(ids) > 0;
|
return sysClientMapper.deleteByIds(ids) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -190,7 +190,7 @@ public class SysClientServiceImpl implements ISysClientService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean checkClickKeyUnique(SysClientBo client) {
|
public boolean checkClickKeyUnique(SysClientBo client) {
|
||||||
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysClient>()
|
boolean exist = sysClientMapper.exists(new LambdaQueryWrapper<SysClient>()
|
||||||
.eq(SysClient::getClientKey, client.getClientKey())
|
.eq(SysClient::getClientKey, client.getClientKey())
|
||||||
.ne(ObjectUtil.isNotNull(client.getId()), SysClient::getId, client.getId()));
|
.ne(ObjectUtil.isNotNull(client.getId()), SysClient::getId, client.getId()));
|
||||||
return !exist;
|
return !exist;
|
||||||
|
|||||||
@ -41,7 +41,7 @@ import java.util.Map;
|
|||||||
@Service
|
@Service
|
||||||
public class SysConfigServiceImpl implements ISysConfigService, ConfigService {
|
public class SysConfigServiceImpl implements ISysConfigService, ConfigService {
|
||||||
|
|
||||||
private final SysConfigMapper baseMapper;
|
private final SysConfigMapper sysConfigMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询参数配置列表
|
* 分页查询参数配置列表
|
||||||
@ -53,7 +53,7 @@ public class SysConfigServiceImpl implements ISysConfigService, ConfigService {
|
|||||||
@Override
|
@Override
|
||||||
public PageResult<SysConfigVo> selectPageConfigList(SysConfigBo config, PageQuery pageQuery) {
|
public PageResult<SysConfigVo> selectPageConfigList(SysConfigBo config, PageQuery pageQuery) {
|
||||||
LambdaQueryWrapper<SysConfig> lqw = buildQueryWrapper(config);
|
LambdaQueryWrapper<SysConfig> lqw = buildQueryWrapper(config);
|
||||||
Page<SysConfigVo> page = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
Page<SysConfigVo> page = sysConfigMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
return PageResult.build(page.getRecords(), page.getTotal());
|
return PageResult.build(page.getRecords(), page.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ public class SysConfigServiceImpl implements ISysConfigService, ConfigService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public SysConfigVo selectConfigById(Long configId) {
|
public SysConfigVo selectConfigById(Long configId) {
|
||||||
return baseMapper.selectVoById(configId);
|
return sysConfigMapper.selectVoById(configId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -77,7 +77,7 @@ public class SysConfigServiceImpl implements ISysConfigService, ConfigService {
|
|||||||
@Cacheable(cacheNames = CacheNames.SYS_CONFIG, key = "#configKey")
|
@Cacheable(cacheNames = CacheNames.SYS_CONFIG, key = "#configKey")
|
||||||
@Override
|
@Override
|
||||||
public String selectConfigByKey(String configKey) {
|
public String selectConfigByKey(String configKey) {
|
||||||
SysConfig retConfig = baseMapper.selectOne(new LambdaQueryWrapper<SysConfig>()
|
SysConfig retConfig = sysConfigMapper.selectOne(new LambdaQueryWrapper<SysConfig>()
|
||||||
.eq(SysConfig::getConfigKey, configKey));
|
.eq(SysConfig::getConfigKey, configKey));
|
||||||
return ObjectUtils.notNullGetter(retConfig, SysConfig::getConfigValue, StringUtils.EMPTY);
|
return ObjectUtils.notNullGetter(retConfig, SysConfig::getConfigValue, StringUtils.EMPTY);
|
||||||
}
|
}
|
||||||
@ -101,7 +101,7 @@ public class SysConfigServiceImpl implements ISysConfigService, ConfigService {
|
|||||||
@Override
|
@Override
|
||||||
public List<SysConfigVo> selectConfigList(SysConfigBo config) {
|
public List<SysConfigVo> selectConfigList(SysConfigBo config) {
|
||||||
LambdaQueryWrapper<SysConfig> lqw = buildQueryWrapper(config);
|
LambdaQueryWrapper<SysConfig> lqw = buildQueryWrapper(config);
|
||||||
return baseMapper.selectVoList(lqw);
|
return sysConfigMapper.selectVoList(lqw);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -132,7 +132,7 @@ public class SysConfigServiceImpl implements ISysConfigService, ConfigService {
|
|||||||
@Override
|
@Override
|
||||||
public String insertConfig(SysConfigBo bo) {
|
public String insertConfig(SysConfigBo bo) {
|
||||||
SysConfig config = MapstructUtils.convert(bo, SysConfig.class);
|
SysConfig config = MapstructUtils.convert(bo, SysConfig.class);
|
||||||
int row = baseMapper.insert(config);
|
int row = sysConfigMapper.insert(config);
|
||||||
if (row > 0) {
|
if (row > 0) {
|
||||||
return config.getConfigValue();
|
return config.getConfigValue();
|
||||||
}
|
}
|
||||||
@ -151,14 +151,14 @@ public class SysConfigServiceImpl implements ISysConfigService, ConfigService {
|
|||||||
int row = 0;
|
int row = 0;
|
||||||
SysConfig config = MapstructUtils.convert(bo, SysConfig.class);
|
SysConfig config = MapstructUtils.convert(bo, SysConfig.class);
|
||||||
if (config.getConfigId() != null) {
|
if (config.getConfigId() != null) {
|
||||||
SysConfig temp = baseMapper.selectById(config.getConfigId());
|
SysConfig temp = sysConfigMapper.selectById(config.getConfigId());
|
||||||
if (ObjectUtil.isNotNull(temp) && !StringUtils.equals(temp.getConfigKey(), config.getConfigKey())) {
|
if (ObjectUtil.isNotNull(temp) && !StringUtils.equals(temp.getConfigKey(), config.getConfigKey())) {
|
||||||
CacheUtils.evict(CacheNames.SYS_CONFIG, temp.getConfigKey());
|
CacheUtils.evict(CacheNames.SYS_CONFIG, temp.getConfigKey());
|
||||||
}
|
}
|
||||||
row = baseMapper.updateById(config);
|
row = sysConfigMapper.updateById(config);
|
||||||
} else {
|
} else {
|
||||||
CacheUtils.evict(CacheNames.SYS_CONFIG, config.getConfigKey());
|
CacheUtils.evict(CacheNames.SYS_CONFIG, config.getConfigKey());
|
||||||
row = baseMapper.update(config, new LambdaQueryWrapper<SysConfig>()
|
row = sysConfigMapper.update(config, new LambdaQueryWrapper<SysConfig>()
|
||||||
.eq(SysConfig::getConfigKey, config.getConfigKey()));
|
.eq(SysConfig::getConfigKey, config.getConfigKey()));
|
||||||
}
|
}
|
||||||
if (row > 0) {
|
if (row > 0) {
|
||||||
@ -174,14 +174,14 @@ public class SysConfigServiceImpl implements ISysConfigService, ConfigService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void deleteConfigByIds(Collection<Long> configIds) {
|
public void deleteConfigByIds(Collection<Long> configIds) {
|
||||||
List<SysConfig> list = baseMapper.selectByIds(configIds);
|
List<SysConfig> list = sysConfigMapper.selectByIds(configIds);
|
||||||
list.forEach(config -> {
|
list.forEach(config -> {
|
||||||
if (StringUtils.equals(SystemConstants.YES, config.getConfigType())) {
|
if (StringUtils.equals(SystemConstants.YES, config.getConfigType())) {
|
||||||
throw new ServiceException("内置参数【{}】不能删除", config.getConfigKey());
|
throw new ServiceException("内置参数【{}】不能删除", config.getConfigKey());
|
||||||
}
|
}
|
||||||
CacheUtils.evict(CacheNames.SYS_CONFIG, config.getConfigKey());
|
CacheUtils.evict(CacheNames.SYS_CONFIG, config.getConfigKey());
|
||||||
});
|
});
|
||||||
baseMapper.deleteByIds(configIds);
|
sysConfigMapper.deleteByIds(configIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -200,7 +200,7 @@ public class SysConfigServiceImpl implements ISysConfigService, ConfigService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean checkConfigKeyUnique(SysConfigBo config) {
|
public boolean checkConfigKeyUnique(SysConfigBo config) {
|
||||||
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysConfig>()
|
boolean exist = sysConfigMapper.exists(new LambdaQueryWrapper<SysConfig>()
|
||||||
.eq(SysConfig::getConfigKey, config.getConfigKey())
|
.eq(SysConfig::getConfigKey, config.getConfigKey())
|
||||||
.ne(ObjectUtil.isNotNull(config.getConfigId()), SysConfig::getConfigId, config.getConfigId()));
|
.ne(ObjectUtil.isNotNull(config.getConfigId()), SysConfig::getConfigId, config.getConfigId()));
|
||||||
return !exist;
|
return !exist;
|
||||||
|
|||||||
@ -20,7 +20,7 @@ import java.util.List;
|
|||||||
* 数据权限 实现
|
* 数据权限 实现
|
||||||
* <p>
|
* <p>
|
||||||
* 注意: 此Service内不允许调用标注`数据权限`注解的方法
|
* 注意: 此Service内不允许调用标注`数据权限`注解的方法
|
||||||
* 例如: deptMapper.selectList 此 selectList 方法标注了`数据权限`注解 会出现循环解析的问题
|
* 例如: sysDeptMapper.selectList 此 selectList 方法标注了`数据权限`注解 会出现循环解析的问题
|
||||||
* 当前实现仅负责返回角色自定义部门范围以及部门树展开后的 id 串,供数据权限插件拼装 SQL 时使用。
|
* 当前实现仅负责返回角色自定义部门范围以及部门树展开后的 id 串,供数据权限插件拼装 SQL 时使用。
|
||||||
*
|
*
|
||||||
* @author Lion Li
|
* @author Lion Li
|
||||||
@ -29,8 +29,8 @@ import java.util.List;
|
|||||||
@Service("sdss")
|
@Service("sdss")
|
||||||
public class SysDataScopeServiceImpl implements ISysDataScopeService {
|
public class SysDataScopeServiceImpl implements ISysDataScopeService {
|
||||||
|
|
||||||
private final SysRoleDeptMapper roleDeptMapper;
|
private final SysRoleDeptMapper sysRoleDeptMapper;
|
||||||
private final SysDeptMapper deptMapper;
|
private final SysDeptMapper sysDeptMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取角色自定义权限
|
* 获取角色自定义权限
|
||||||
@ -44,7 +44,7 @@ public class SysDataScopeServiceImpl implements ISysDataScopeService {
|
|||||||
if (ObjectUtil.isNull(roleId)) {
|
if (ObjectUtil.isNull(roleId)) {
|
||||||
return "-1";
|
return "-1";
|
||||||
}
|
}
|
||||||
List<SysRoleDept> list = roleDeptMapper.selectList(
|
List<SysRoleDept> list = sysRoleDeptMapper.selectList(
|
||||||
new LambdaQueryWrapper<SysRoleDept>()
|
new LambdaQueryWrapper<SysRoleDept>()
|
||||||
.select(SysRoleDept::getDeptId)
|
.select(SysRoleDept::getDeptId)
|
||||||
.eq(SysRoleDept::getRoleId, roleId));
|
.eq(SysRoleDept::getRoleId, roleId));
|
||||||
@ -66,7 +66,7 @@ public class SysDataScopeServiceImpl implements ISysDataScopeService {
|
|||||||
if (ObjectUtil.isNull(deptId)) {
|
if (ObjectUtil.isNull(deptId)) {
|
||||||
return "-1";
|
return "-1";
|
||||||
}
|
}
|
||||||
List<Long> deptIds = deptMapper.selectDeptAndChildById(deptId);
|
List<Long> deptIds = sysDeptMapper.selectDeptAndChildById(deptId);
|
||||||
return CollUtil.isNotEmpty(deptIds) ? StreamUtils.join(deptIds, Convert::toStr) : "-1";
|
return CollUtil.isNotEmpty(deptIds) ? StreamUtils.join(deptIds, Convert::toStr) : "-1";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -47,9 +47,9 @@ import java.util.*;
|
|||||||
@Service
|
@Service
|
||||||
public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
||||||
|
|
||||||
private final SysDeptMapper baseMapper;
|
private final SysDeptMapper sysDeptMapper;
|
||||||
private final SysRoleMapper roleMapper;
|
private final SysRoleMapper sysRoleMapper;
|
||||||
private final SysUserMapper userMapper;
|
private final SysUserMapper sysUserMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询部门管理数据
|
* 分页查询部门管理数据
|
||||||
@ -60,7 +60,7 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public PageResult<SysDeptVo> selectPageDeptList(SysDeptBo dept, PageQuery pageQuery) {
|
public PageResult<SysDeptVo> selectPageDeptList(SysDeptBo dept, PageQuery pageQuery) {
|
||||||
Page<SysDeptVo> page = baseMapper.selectPageDeptList(pageQuery.build(), buildQueryWrapper(dept));
|
Page<SysDeptVo> page = sysDeptMapper.selectPageDeptList(pageQuery.build(), buildQueryWrapper(dept));
|
||||||
return PageResult.build(page.getRecords(), page.getTotal());
|
return PageResult.build(page.getRecords(), page.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
|||||||
@Override
|
@Override
|
||||||
public List<SysDeptVo> selectDeptList(SysDeptBo dept) {
|
public List<SysDeptVo> selectDeptList(SysDeptBo dept) {
|
||||||
LambdaQueryWrapper<SysDept> lqw = buildQueryWrapper(dept);
|
LambdaQueryWrapper<SysDept> lqw = buildQueryWrapper(dept);
|
||||||
return baseMapper.selectDeptList(lqw);
|
return sysDeptMapper.selectDeptList(lqw);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -85,7 +85,7 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
|||||||
@Override
|
@Override
|
||||||
public List<Tree<Long>> selectDeptTreeList(SysDeptBo bo) {
|
public List<Tree<Long>> selectDeptTreeList(SysDeptBo bo) {
|
||||||
LambdaQueryWrapper<SysDept> lqw = buildQueryWrapper(bo);
|
LambdaQueryWrapper<SysDept> lqw = buildQueryWrapper(bo);
|
||||||
List<SysDeptVo> depts = baseMapper.selectDeptList(lqw);
|
List<SysDeptVo> depts = sysDeptMapper.selectDeptList(lqw);
|
||||||
return buildDeptTreeSelect(depts);
|
return buildDeptTreeSelect(depts);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,7 +113,7 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
|||||||
if (ObjectUtil.isNotNull(bo.getBelongDeptId())) {
|
if (ObjectUtil.isNotNull(bo.getBelongDeptId())) {
|
||||||
//部门树搜索
|
//部门树搜索
|
||||||
lqw.and(x -> {
|
lqw.and(x -> {
|
||||||
List<Long> deptIds = baseMapper.selectDeptAndChildById(bo.getBelongDeptId());
|
List<Long> deptIds = sysDeptMapper.selectDeptAndChildById(bo.getBelongDeptId());
|
||||||
x.in(SysDept::getDeptId, deptIds);
|
x.in(SysDept::getDeptId, deptIds);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -152,8 +152,8 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<Long> selectDeptListByRoleId(Long roleId) {
|
public List<Long> selectDeptListByRoleId(Long roleId) {
|
||||||
SysRole role = roleMapper.selectById(roleId);
|
SysRole role = sysRoleMapper.selectById(roleId);
|
||||||
return baseMapper.selectDeptListByRoleId(roleId, role.getDeptCheckStrictly());
|
return sysDeptMapper.selectDeptListByRoleId(roleId, role.getDeptCheckStrictly());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -165,11 +165,11 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
|||||||
@Cacheable(cacheNames = CacheNames.SYS_DEPT, key = "#deptId")
|
@Cacheable(cacheNames = CacheNames.SYS_DEPT, key = "#deptId")
|
||||||
@Override
|
@Override
|
||||||
public SysDeptVo selectDeptById(Long deptId) {
|
public SysDeptVo selectDeptById(Long deptId) {
|
||||||
SysDeptVo dept = baseMapper.selectVoById(deptId);
|
SysDeptVo dept = sysDeptMapper.selectVoById(deptId);
|
||||||
if (ObjectUtil.isNull(dept)) {
|
if (ObjectUtil.isNull(dept)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
SysDeptVo parentDept = baseMapper.selectVoOne(new LambdaQueryWrapper<SysDept>()
|
SysDeptVo parentDept = sysDeptMapper.selectVoOne(new LambdaQueryWrapper<SysDept>()
|
||||||
.select(SysDept::getDeptName).eq(SysDept::getDeptId, dept.getParentId()));
|
.select(SysDept::getDeptName).eq(SysDept::getDeptId, dept.getParentId()));
|
||||||
dept.setParentName(ObjectUtils.notNullGetter(parentDept, SysDeptVo::getDeptName));
|
dept.setParentName(ObjectUtils.notNullGetter(parentDept, SysDeptVo::getDeptName));
|
||||||
return dept;
|
return dept;
|
||||||
@ -183,7 +183,7 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SysDeptVo> selectDeptByIds(Collection<Long> deptIds) {
|
public List<SysDeptVo> selectDeptByIds(Collection<Long> deptIds) {
|
||||||
return baseMapper.selectDeptList(new LambdaQueryWrapper<SysDept>()
|
return sysDeptMapper.selectDeptList(new LambdaQueryWrapper<SysDept>()
|
||||||
.select(SysDept::getDeptId, SysDept::getDeptName, SysDept::getLeader)
|
.select(SysDept::getDeptId, SysDept::getDeptName, SysDept::getLeader)
|
||||||
.eq(SysDept::getStatus, SystemConstants.NORMAL)
|
.eq(SysDept::getStatus, SystemConstants.NORMAL)
|
||||||
.in(CollUtil.isNotEmpty(deptIds), SysDept::getDeptId, deptIds));
|
.in(CollUtil.isNotEmpty(deptIds), SysDept::getDeptId, deptIds));
|
||||||
@ -226,7 +226,7 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<DeptDTO> selectDeptsByList() {
|
public List<DeptDTO> selectDeptsByList() {
|
||||||
List<SysDeptVo> list = baseMapper.selectDeptList(new LambdaQueryWrapper<SysDept>()
|
List<SysDeptVo> list = sysDeptMapper.selectDeptList(new LambdaQueryWrapper<SysDept>()
|
||||||
.select(SysDept::getDeptId, SysDept::getDeptName, SysDept::getParentId)
|
.select(SysDept::getDeptId, SysDept::getDeptName, SysDept::getParentId)
|
||||||
.eq(SysDept::getStatus, SystemConstants.NORMAL));
|
.eq(SysDept::getStatus, SystemConstants.NORMAL));
|
||||||
return BeanUtil.copyToList(list, DeptDTO.class);
|
return BeanUtil.copyToList(list, DeptDTO.class);
|
||||||
@ -240,7 +240,7 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public long selectNormalChildrenDeptById(Long deptId) {
|
public long selectNormalChildrenDeptById(Long deptId) {
|
||||||
return baseMapper.selectCount(new LambdaQueryWrapper<SysDept>()
|
return sysDeptMapper.selectCount(new LambdaQueryWrapper<SysDept>()
|
||||||
.eq(SysDept::getStatus, SystemConstants.NORMAL)
|
.eq(SysDept::getStatus, SystemConstants.NORMAL)
|
||||||
.apply(DataBaseHelper.findInSet(deptId, "ancestors")));
|
.apply(DataBaseHelper.findInSet(deptId, "ancestors")));
|
||||||
}
|
}
|
||||||
@ -253,7 +253,7 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean hasChildByDeptId(Long deptId) {
|
public boolean hasChildByDeptId(Long deptId) {
|
||||||
return baseMapper.exists(new LambdaQueryWrapper<SysDept>()
|
return sysDeptMapper.exists(new LambdaQueryWrapper<SysDept>()
|
||||||
.eq(SysDept::getParentId, deptId));
|
.eq(SysDept::getParentId, deptId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,7 +265,7 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean checkDeptExistUser(Long deptId) {
|
public boolean checkDeptExistUser(Long deptId) {
|
||||||
return userMapper.exists(new LambdaQueryWrapper<SysUser>()
|
return sysUserMapper.exists(new LambdaQueryWrapper<SysUser>()
|
||||||
.eq(SysUser::getDeptId, deptId));
|
.eq(SysUser::getDeptId, deptId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,7 +277,7 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean checkDeptNameUnique(SysDeptBo dept) {
|
public boolean checkDeptNameUnique(SysDeptBo dept) {
|
||||||
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysDept>()
|
boolean exist = sysDeptMapper.exists(new LambdaQueryWrapper<SysDept>()
|
||||||
.eq(SysDept::getDeptName, dept.getDeptName())
|
.eq(SysDept::getDeptName, dept.getDeptName())
|
||||||
.eq(SysDept::getParentId, dept.getParentId())
|
.eq(SysDept::getParentId, dept.getParentId())
|
||||||
.ne(ObjectUtil.isNotNull(dept.getDeptId()), SysDept::getDeptId, dept.getDeptId()));
|
.ne(ObjectUtil.isNotNull(dept.getDeptId()), SysDept::getDeptId, dept.getDeptId()));
|
||||||
@ -297,7 +297,7 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
|||||||
if (LoginHelper.isSuperAdmin()) {
|
if (LoginHelper.isSuperAdmin()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (baseMapper.countDeptById(deptId) == 0) {
|
if (sysDeptMapper.countDeptById(deptId) == 0) {
|
||||||
throw new ServiceException("没有权限访问部门数据!");
|
throw new ServiceException("没有权限访问部门数据!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -311,7 +311,7 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
|||||||
@CacheEvict(cacheNames = CacheNames.SYS_DEPT_AND_CHILD, allEntries = true)
|
@CacheEvict(cacheNames = CacheNames.SYS_DEPT_AND_CHILD, allEntries = true)
|
||||||
@Override
|
@Override
|
||||||
public int insertDept(SysDeptBo bo) {
|
public int insertDept(SysDeptBo bo) {
|
||||||
SysDept info = baseMapper.selectById(bo.getParentId());
|
SysDept info = sysDeptMapper.selectById(bo.getParentId());
|
||||||
// 如果父节点不存在或不为正常状态,则不允许新增子节点
|
// 如果父节点不存在或不为正常状态,则不允许新增子节点
|
||||||
if (ObjectUtil.isNull(info)) {
|
if (ObjectUtil.isNull(info)) {
|
||||||
throw new ServiceException("父部门不存在");
|
throw new ServiceException("父部门不存在");
|
||||||
@ -321,7 +321,7 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
|||||||
}
|
}
|
||||||
SysDept dept = MapstructUtils.convert(bo, SysDept.class);
|
SysDept dept = MapstructUtils.convert(bo, SysDept.class);
|
||||||
dept.setAncestors(info.getAncestors() + StringUtils.SEPARATOR + dept.getParentId());
|
dept.setAncestors(info.getAncestors() + StringUtils.SEPARATOR + dept.getParentId());
|
||||||
return baseMapper.insert(dept);
|
return sysDeptMapper.insert(dept);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -338,14 +338,14 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int updateDept(SysDeptBo bo) {
|
public int updateDept(SysDeptBo bo) {
|
||||||
SysDept dept = MapstructUtils.convert(bo, SysDept.class);
|
SysDept dept = MapstructUtils.convert(bo, SysDept.class);
|
||||||
SysDept oldDept = baseMapper.selectById(dept.getDeptId());
|
SysDept oldDept = sysDeptMapper.selectById(dept.getDeptId());
|
||||||
if (ObjectUtil.isNull(oldDept)) {
|
if (ObjectUtil.isNull(oldDept)) {
|
||||||
throw new ServiceException("部门不存在,无法修改");
|
throw new ServiceException("部门不存在,无法修改");
|
||||||
}
|
}
|
||||||
if (!oldDept.getParentId().equals(dept.getParentId())) {
|
if (!oldDept.getParentId().equals(dept.getParentId())) {
|
||||||
// 如果是新父部门 则校验是否具有新父部门权限 避免越权
|
// 如果是新父部门 则校验是否具有新父部门权限 避免越权
|
||||||
this.checkDeptDataScope(dept.getParentId());
|
this.checkDeptDataScope(dept.getParentId());
|
||||||
SysDept newParentDept = baseMapper.selectById(dept.getParentId());
|
SysDept newParentDept = sysDeptMapper.selectById(dept.getParentId());
|
||||||
if (ObjectUtil.isNotNull(newParentDept)) {
|
if (ObjectUtil.isNotNull(newParentDept)) {
|
||||||
String newAncestors = newParentDept.getAncestors() + StringUtils.SEPARATOR + newParentDept.getDeptId();
|
String newAncestors = newParentDept.getAncestors() + StringUtils.SEPARATOR + newParentDept.getDeptId();
|
||||||
String oldAncestors = oldDept.getAncestors();
|
String oldAncestors = oldDept.getAncestors();
|
||||||
@ -355,7 +355,7 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
|||||||
} else {
|
} else {
|
||||||
dept.setAncestors(oldDept.getAncestors());
|
dept.setAncestors(oldDept.getAncestors());
|
||||||
}
|
}
|
||||||
int result = baseMapper.updateById(dept);
|
int result = sysDeptMapper.updateById(dept);
|
||||||
// 如果部门状态为启用,且部门祖级列表不为空,且部门祖级列表不等于根部门祖级列表(如果部门祖级列表不等于根部门祖级列表,则说明存在上级部门)
|
// 如果部门状态为启用,且部门祖级列表不为空,且部门祖级列表不等于根部门祖级列表(如果部门祖级列表不等于根部门祖级列表,则说明存在上级部门)
|
||||||
if (SystemConstants.NORMAL.equals(dept.getStatus())
|
if (SystemConstants.NORMAL.equals(dept.getStatus())
|
||||||
&& StringUtils.isNotEmpty(dept.getAncestors())
|
&& StringUtils.isNotEmpty(dept.getAncestors())
|
||||||
@ -374,7 +374,7 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
|||||||
private void updateParentDeptStatusNormal(SysDept dept) {
|
private void updateParentDeptStatusNormal(SysDept dept) {
|
||||||
String ancestors = dept.getAncestors();
|
String ancestors = dept.getAncestors();
|
||||||
Long[] deptIds = Convert.toLongArray(ancestors);
|
Long[] deptIds = Convert.toLongArray(ancestors);
|
||||||
baseMapper.update(null, new LambdaUpdateWrapper<SysDept>()
|
sysDeptMapper.update(null, new LambdaUpdateWrapper<SysDept>()
|
||||||
.set(SysDept::getStatus, SystemConstants.NORMAL)
|
.set(SysDept::getStatus, SystemConstants.NORMAL)
|
||||||
.in(SysDept::getDeptId, Arrays.asList(deptIds)));
|
.in(SysDept::getDeptId, Arrays.asList(deptIds)));
|
||||||
}
|
}
|
||||||
@ -387,7 +387,7 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
|||||||
* @param oldAncestors 旧的父ID集合
|
* @param oldAncestors 旧的父ID集合
|
||||||
*/
|
*/
|
||||||
private void updateDeptChildren(Long deptId, String newAncestors, String oldAncestors) {
|
private void updateDeptChildren(Long deptId, String newAncestors, String oldAncestors) {
|
||||||
List<SysDept> children = baseMapper.selectList(new LambdaQueryWrapper<SysDept>()
|
List<SysDept> children = sysDeptMapper.selectList(new LambdaQueryWrapper<SysDept>()
|
||||||
.apply(DataBaseHelper.findInSet(deptId, "ancestors")));
|
.apply(DataBaseHelper.findInSet(deptId, "ancestors")));
|
||||||
List<SysDept> list = new ArrayList<>();
|
List<SysDept> list = new ArrayList<>();
|
||||||
for (SysDept child : children) {
|
for (SysDept child : children) {
|
||||||
@ -397,7 +397,7 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
|||||||
list.add(dept);
|
list.add(dept);
|
||||||
}
|
}
|
||||||
if (CollUtil.isNotEmpty(list)) {
|
if (CollUtil.isNotEmpty(list)) {
|
||||||
if (baseMapper.updateBatchById(list)) {
|
if (sysDeptMapper.updateBatchById(list)) {
|
||||||
list.forEach(dept -> CacheUtils.evict(CacheNames.SYS_DEPT, dept.getDeptId()));
|
list.forEach(dept -> CacheUtils.evict(CacheNames.SYS_DEPT, dept.getDeptId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -415,7 +415,7 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
|||||||
})
|
})
|
||||||
@Override
|
@Override
|
||||||
public int deleteDeptById(Long deptId) {
|
public int deleteDeptById(Long deptId) {
|
||||||
return baseMapper.deleteById(deptId);
|
return sysDeptMapper.deleteById(deptId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -430,7 +430,7 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
|||||||
if (CollUtil.isEmpty(deptIds)) {
|
if (CollUtil.isEmpty(deptIds)) {
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
}
|
}
|
||||||
List<SysDept> list = baseMapper.selectList(
|
List<SysDept> list = sysDeptMapper.selectList(
|
||||||
new LambdaQueryWrapper<SysDept>()
|
new LambdaQueryWrapper<SysDept>()
|
||||||
.select(SysDept::getDeptId, SysDept::getDeptName)
|
.select(SysDept::getDeptId, SysDept::getDeptName)
|
||||||
.in(SysDept::getDeptId, deptIds)
|
.in(SysDept::getDeptId, deptIds)
|
||||||
|
|||||||
@ -32,7 +32,7 @@ import java.util.List;
|
|||||||
@Service
|
@Service
|
||||||
public class SysDictDataServiceImpl implements ISysDictDataService {
|
public class SysDictDataServiceImpl implements ISysDictDataService {
|
||||||
|
|
||||||
private final SysDictDataMapper baseMapper;
|
private final SysDictDataMapper sysDictDataMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询字典数据列表
|
* 分页查询字典数据列表
|
||||||
@ -44,7 +44,7 @@ public class SysDictDataServiceImpl implements ISysDictDataService {
|
|||||||
@Override
|
@Override
|
||||||
public PageResult<SysDictDataVo> selectPageDictDataList(SysDictDataBo dictData, PageQuery pageQuery) {
|
public PageResult<SysDictDataVo> selectPageDictDataList(SysDictDataBo dictData, PageQuery pageQuery) {
|
||||||
LambdaQueryWrapper<SysDictData> lqw = buildQueryWrapper(dictData);
|
LambdaQueryWrapper<SysDictData> lqw = buildQueryWrapper(dictData);
|
||||||
Page<SysDictDataVo> page = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
Page<SysDictDataVo> page = sysDictDataMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
return PageResult.build(page.getRecords(), page.getTotal());
|
return PageResult.build(page.getRecords(), page.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ public class SysDictDataServiceImpl implements ISysDictDataService {
|
|||||||
@Override
|
@Override
|
||||||
public List<SysDictDataVo> selectDictDataList(SysDictDataBo dictData) {
|
public List<SysDictDataVo> selectDictDataList(SysDictDataBo dictData) {
|
||||||
LambdaQueryWrapper<SysDictData> lqw = buildQueryWrapper(dictData);
|
LambdaQueryWrapper<SysDictData> lqw = buildQueryWrapper(dictData);
|
||||||
return baseMapper.selectVoList(lqw);
|
return sysDictDataMapper.selectVoList(lqw);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -84,7 +84,7 @@ public class SysDictDataServiceImpl implements ISysDictDataService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String selectDictLabel(String dictType, String dictValue) {
|
public String selectDictLabel(String dictType, String dictValue) {
|
||||||
return baseMapper.selectOne(new LambdaQueryWrapper<SysDictData>()
|
return sysDictDataMapper.selectOne(new LambdaQueryWrapper<SysDictData>()
|
||||||
.select(SysDictData::getDictLabel)
|
.select(SysDictData::getDictLabel)
|
||||||
.eq(SysDictData::getDictType, dictType)
|
.eq(SysDictData::getDictType, dictType)
|
||||||
.eq(SysDictData::getDictValue, dictValue))
|
.eq(SysDictData::getDictValue, dictValue))
|
||||||
@ -99,7 +99,7 @@ public class SysDictDataServiceImpl implements ISysDictDataService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public SysDictDataVo selectDictDataById(Long dictCode) {
|
public SysDictDataVo selectDictDataById(Long dictCode) {
|
||||||
return baseMapper.selectVoById(dictCode);
|
return sysDictDataMapper.selectVoById(dictCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -109,8 +109,8 @@ public class SysDictDataServiceImpl implements ISysDictDataService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void deleteDictDataByIds(Collection<Long> dictCodes) {
|
public void deleteDictDataByIds(Collection<Long> dictCodes) {
|
||||||
List<SysDictData> list = baseMapper.selectByIds(dictCodes);
|
List<SysDictData> list = sysDictDataMapper.selectByIds(dictCodes);
|
||||||
baseMapper.deleteByIds(dictCodes);
|
sysDictDataMapper.deleteByIds(dictCodes);
|
||||||
list.forEach(x -> CacheUtils.evict(CacheNames.SYS_DICT, x.getDictType()));
|
list.forEach(x -> CacheUtils.evict(CacheNames.SYS_DICT, x.getDictType()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,9 +124,9 @@ public class SysDictDataServiceImpl implements ISysDictDataService {
|
|||||||
@Override
|
@Override
|
||||||
public List<SysDictDataVo> insertDictData(SysDictDataBo bo) {
|
public List<SysDictDataVo> insertDictData(SysDictDataBo bo) {
|
||||||
SysDictData data = MapstructUtils.convert(bo, SysDictData.class);
|
SysDictData data = MapstructUtils.convert(bo, SysDictData.class);
|
||||||
int row = baseMapper.insert(data);
|
int row = sysDictDataMapper.insert(data);
|
||||||
if (row > 0) {
|
if (row > 0) {
|
||||||
return baseMapper.selectDictDataByType(data.getDictType());
|
return sysDictDataMapper.selectDictDataByType(data.getDictType());
|
||||||
}
|
}
|
||||||
throw new ServiceException("操作失败");
|
throw new ServiceException("操作失败");
|
||||||
}
|
}
|
||||||
@ -141,9 +141,9 @@ public class SysDictDataServiceImpl implements ISysDictDataService {
|
|||||||
@Override
|
@Override
|
||||||
public List<SysDictDataVo> updateDictData(SysDictDataBo bo) {
|
public List<SysDictDataVo> updateDictData(SysDictDataBo bo) {
|
||||||
SysDictData data = MapstructUtils.convert(bo, SysDictData.class);
|
SysDictData data = MapstructUtils.convert(bo, SysDictData.class);
|
||||||
int row = baseMapper.updateById(data);
|
int row = sysDictDataMapper.updateById(data);
|
||||||
if (row > 0) {
|
if (row > 0) {
|
||||||
return baseMapper.selectDictDataByType(data.getDictType());
|
return sysDictDataMapper.selectDictDataByType(data.getDictType());
|
||||||
}
|
}
|
||||||
throw new ServiceException("操作失败");
|
throw new ServiceException("操作失败");
|
||||||
}
|
}
|
||||||
@ -156,7 +156,7 @@ public class SysDictDataServiceImpl implements ISysDictDataService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean checkDictDataUnique(SysDictDataBo dict) {
|
public boolean checkDictDataUnique(SysDictDataBo dict) {
|
||||||
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysDictData>()
|
boolean exist = sysDictDataMapper.exists(new LambdaQueryWrapper<SysDictData>()
|
||||||
.eq(SysDictData::getDictType, dict.getDictType())
|
.eq(SysDictData::getDictType, dict.getDictType())
|
||||||
.eq(SysDictData::getDictValue, dict.getDictValue())
|
.eq(SysDictData::getDictValue, dict.getDictValue())
|
||||||
.ne(ObjectUtil.isNotNull(dict.getDictCode()), SysDictData::getDictCode, dict.getDictCode()));
|
.ne(ObjectUtil.isNotNull(dict.getDictCode()), SysDictData::getDictCode, dict.getDictCode()));
|
||||||
|
|||||||
@ -45,8 +45,8 @@ import java.util.stream.Collectors;
|
|||||||
@Service
|
@Service
|
||||||
public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService {
|
public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService {
|
||||||
|
|
||||||
private final SysDictTypeMapper baseMapper;
|
private final SysDictTypeMapper sysDictTypeMapper;
|
||||||
private final SysDictDataMapper dictDataMapper;
|
private final SysDictDataMapper sysDictDataMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询字典类型列表
|
* 分页查询字典类型列表
|
||||||
@ -58,7 +58,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
|
|||||||
@Override
|
@Override
|
||||||
public PageResult<SysDictTypeVo> selectPageDictTypeList(SysDictTypeBo dictType, PageQuery pageQuery) {
|
public PageResult<SysDictTypeVo> selectPageDictTypeList(SysDictTypeBo dictType, PageQuery pageQuery) {
|
||||||
LambdaQueryWrapper<SysDictType> lqw = buildQueryWrapper(dictType);
|
LambdaQueryWrapper<SysDictType> lqw = buildQueryWrapper(dictType);
|
||||||
Page<SysDictTypeVo> page = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
Page<SysDictTypeVo> page = sysDictTypeMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
return PageResult.build(page.getRecords(), page.getTotal());
|
return PageResult.build(page.getRecords(), page.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
|
|||||||
@Override
|
@Override
|
||||||
public List<SysDictTypeVo> selectDictTypeList(SysDictTypeBo dictType) {
|
public List<SysDictTypeVo> selectDictTypeList(SysDictTypeBo dictType) {
|
||||||
LambdaQueryWrapper<SysDictType> lqw = buildQueryWrapper(dictType);
|
LambdaQueryWrapper<SysDictType> lqw = buildQueryWrapper(dictType);
|
||||||
return baseMapper.selectVoList(lqw);
|
return sysDictTypeMapper.selectVoList(lqw);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -95,7 +95,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SysDictTypeVo> selectDictTypeAll() {
|
public List<SysDictTypeVo> selectDictTypeAll() {
|
||||||
return baseMapper.selectVoList();
|
return sysDictTypeMapper.selectVoList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -107,7 +107,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
|
|||||||
@Cacheable(cacheNames = CacheNames.SYS_DICT, key = "#dictType")
|
@Cacheable(cacheNames = CacheNames.SYS_DICT, key = "#dictType")
|
||||||
@Override
|
@Override
|
||||||
public List<SysDictDataVo> selectDictDataByType(String dictType) {
|
public List<SysDictDataVo> selectDictDataByType(String dictType) {
|
||||||
List<SysDictDataVo> dictDatas = dictDataMapper.selectDictDataByType(dictType);
|
List<SysDictDataVo> dictDatas = sysDictDataMapper.selectDictDataByType(dictType);
|
||||||
return CollUtil.isNotEmpty(dictDatas) ? dictDatas : Collections.emptyList();
|
return CollUtil.isNotEmpty(dictDatas) ? dictDatas : Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,7 +119,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public SysDictTypeVo selectDictTypeById(Long dictId) {
|
public SysDictTypeVo selectDictTypeById(Long dictId) {
|
||||||
return baseMapper.selectVoById(dictId);
|
return sysDictTypeMapper.selectVoById(dictId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -131,7 +131,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
|
|||||||
@Cacheable(cacheNames = CacheNames.SYS_DICT_TYPE, key = "#dictType")
|
@Cacheable(cacheNames = CacheNames.SYS_DICT_TYPE, key = "#dictType")
|
||||||
@Override
|
@Override
|
||||||
public SysDictTypeVo selectDictTypeByType(String dictType) {
|
public SysDictTypeVo selectDictTypeByType(String dictType) {
|
||||||
return baseMapper.selectVoOne(new LambdaQueryWrapper<SysDictType>().eq(SysDictType::getDictType, dictType));
|
return sysDictTypeMapper.selectVoOne(new LambdaQueryWrapper<SysDictType>().eq(SysDictType::getDictType, dictType));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -141,15 +141,15 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void deleteDictTypeByIds(Collection<Long> dictIds) {
|
public void deleteDictTypeByIds(Collection<Long> dictIds) {
|
||||||
List<SysDictType> list = baseMapper.selectByIds(dictIds);
|
List<SysDictType> list = sysDictTypeMapper.selectByIds(dictIds);
|
||||||
list.forEach(x -> {
|
list.forEach(x -> {
|
||||||
boolean assigned = dictDataMapper.exists(new LambdaQueryWrapper<SysDictData>()
|
boolean assigned = sysDictDataMapper.exists(new LambdaQueryWrapper<SysDictData>()
|
||||||
.eq(SysDictData::getDictType, x.getDictType()));
|
.eq(SysDictData::getDictType, x.getDictType()));
|
||||||
if (assigned) {
|
if (assigned) {
|
||||||
throw new ServiceException("{}已分配,不能删除", x.getDictName());
|
throw new ServiceException("{}已分配,不能删除", x.getDictName());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
baseMapper.deleteByIds(dictIds);
|
sysDictTypeMapper.deleteByIds(dictIds);
|
||||||
list.forEach(x -> {
|
list.forEach(x -> {
|
||||||
CacheUtils.evict(CacheNames.SYS_DICT, x.getDictType());
|
CacheUtils.evict(CacheNames.SYS_DICT, x.getDictType());
|
||||||
CacheUtils.evict(CacheNames.SYS_DICT_TYPE, x.getDictType());
|
CacheUtils.evict(CacheNames.SYS_DICT_TYPE, x.getDictType());
|
||||||
@ -175,7 +175,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
|
|||||||
@Override
|
@Override
|
||||||
public List<SysDictDataVo> insertDictType(SysDictTypeBo bo) {
|
public List<SysDictDataVo> insertDictType(SysDictTypeBo bo) {
|
||||||
SysDictType dict = MapstructUtils.convert(bo, SysDictType.class);
|
SysDictType dict = MapstructUtils.convert(bo, SysDictType.class);
|
||||||
int row = baseMapper.insert(dict);
|
int row = sysDictTypeMapper.insert(dict);
|
||||||
if (row > 0) {
|
if (row > 0) {
|
||||||
// 新增 type 下无 data 数据 返回空防止缓存穿透
|
// 新增 type 下无 data 数据 返回空防止缓存穿透
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
@ -194,15 +194,15 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public List<SysDictDataVo> updateDictType(SysDictTypeBo bo) {
|
public List<SysDictDataVo> updateDictType(SysDictTypeBo bo) {
|
||||||
SysDictType dict = MapstructUtils.convert(bo, SysDictType.class);
|
SysDictType dict = MapstructUtils.convert(bo, SysDictType.class);
|
||||||
SysDictType oldDict = baseMapper.selectById(dict.getDictId());
|
SysDictType oldDict = sysDictTypeMapper.selectById(dict.getDictId());
|
||||||
dictDataMapper.update(null, new LambdaUpdateWrapper<SysDictData>()
|
sysDictDataMapper.update(null, new LambdaUpdateWrapper<SysDictData>()
|
||||||
.set(SysDictData::getDictType, dict.getDictType())
|
.set(SysDictData::getDictType, dict.getDictType())
|
||||||
.eq(SysDictData::getDictType, oldDict.getDictType()));
|
.eq(SysDictData::getDictType, oldDict.getDictType()));
|
||||||
int row = baseMapper.updateById(dict);
|
int row = sysDictTypeMapper.updateById(dict);
|
||||||
if (row > 0) {
|
if (row > 0) {
|
||||||
CacheUtils.evict(CacheNames.SYS_DICT, oldDict.getDictType());
|
CacheUtils.evict(CacheNames.SYS_DICT, oldDict.getDictType());
|
||||||
CacheUtils.evict(CacheNames.SYS_DICT_TYPE, oldDict.getDictType());
|
CacheUtils.evict(CacheNames.SYS_DICT_TYPE, oldDict.getDictType());
|
||||||
return dictDataMapper.selectDictDataByType(dict.getDictType());
|
return sysDictDataMapper.selectDictDataByType(dict.getDictType());
|
||||||
}
|
}
|
||||||
throw new ServiceException("操作失败");
|
throw new ServiceException("操作失败");
|
||||||
}
|
}
|
||||||
@ -215,7 +215,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean checkDictTypeUnique(SysDictTypeBo dictType) {
|
public boolean checkDictTypeUnique(SysDictTypeBo dictType) {
|
||||||
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysDictType>()
|
boolean exist = sysDictTypeMapper.exists(new LambdaQueryWrapper<SysDictType>()
|
||||||
.eq(SysDictType::getDictType, dictType.getDictType())
|
.eq(SysDictType::getDictType, dictType.getDictType())
|
||||||
.ne(ObjectUtil.isNotNull(dictType.getDictId()), SysDictType::getDictId, dictType.getDictId()));
|
.ne(ObjectUtil.isNotNull(dictType.getDictId()), SysDictType::getDictId, dictType.getDictId()));
|
||||||
return !exist;
|
return !exist;
|
||||||
|
|||||||
@ -43,7 +43,7 @@ import java.util.Map;
|
|||||||
@Service
|
@Service
|
||||||
public class SysLoginInfoServiceImpl implements ISysLoginInfoService {
|
public class SysLoginInfoServiceImpl implements ISysLoginInfoService {
|
||||||
|
|
||||||
private final SysLoginInfoMapper baseMapper;
|
private final SysLoginInfoMapper sysLoginInfoMapper;
|
||||||
|
|
||||||
private final ISysClientService clientService;
|
private final ISysClientService clientService;
|
||||||
|
|
||||||
@ -132,7 +132,7 @@ public class SysLoginInfoServiceImpl implements ISysLoginInfoService {
|
|||||||
if (StringUtils.isBlank(pageQuery.getOrderByColumn())) {
|
if (StringUtils.isBlank(pageQuery.getOrderByColumn())) {
|
||||||
lqw.orderByDesc(SysLoginInfo::getInfoId);
|
lqw.orderByDesc(SysLoginInfo::getInfoId);
|
||||||
}
|
}
|
||||||
Page<SysLoginInfoVo> page = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
Page<SysLoginInfoVo> page = sysLoginInfoMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
return PageResult.build(page.getRecords(), page.getTotal());
|
return PageResult.build(page.getRecords(), page.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,7 +145,7 @@ public class SysLoginInfoServiceImpl implements ISysLoginInfoService {
|
|||||||
public void insertLoginInfo(SysLoginInfoBo bo) {
|
public void insertLoginInfo(SysLoginInfoBo bo) {
|
||||||
SysLoginInfo loginInfo = MapstructUtils.convert(bo, SysLoginInfo.class);
|
SysLoginInfo loginInfo = MapstructUtils.convert(bo, SysLoginInfo.class);
|
||||||
loginInfo.setLoginTime(LocalDateTime.now());
|
loginInfo.setLoginTime(LocalDateTime.now());
|
||||||
baseMapper.insert(loginInfo);
|
sysLoginInfoMapper.insert(loginInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -157,7 +157,7 @@ public class SysLoginInfoServiceImpl implements ISysLoginInfoService {
|
|||||||
@Override
|
@Override
|
||||||
public List<SysLoginInfoVo> selectLoginInfoList(SysLoginInfoBo loginInfo) {
|
public List<SysLoginInfoVo> selectLoginInfoList(SysLoginInfoBo loginInfo) {
|
||||||
Map<String, Object> params = loginInfo.getParams();
|
Map<String, Object> params = loginInfo.getParams();
|
||||||
return baseMapper.selectVoList(new LambdaQueryWrapper<SysLoginInfo>()
|
return sysLoginInfoMapper.selectVoList(new LambdaQueryWrapper<SysLoginInfo>()
|
||||||
.like(StringUtils.isNotBlank(loginInfo.getIpaddr()), SysLoginInfo::getIpaddr, loginInfo.getIpaddr())
|
.like(StringUtils.isNotBlank(loginInfo.getIpaddr()), SysLoginInfo::getIpaddr, loginInfo.getIpaddr())
|
||||||
.eq(StringUtils.isNotBlank(loginInfo.getStatus()), SysLoginInfo::getStatus, loginInfo.getStatus())
|
.eq(StringUtils.isNotBlank(loginInfo.getStatus()), SysLoginInfo::getStatus, loginInfo.getStatus())
|
||||||
.like(StringUtils.isNotBlank(loginInfo.getUserName()), SysLoginInfo::getUserName, loginInfo.getUserName())
|
.like(StringUtils.isNotBlank(loginInfo.getUserName()), SysLoginInfo::getUserName, loginInfo.getUserName())
|
||||||
@ -174,7 +174,7 @@ public class SysLoginInfoServiceImpl implements ISysLoginInfoService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteLoginInfoByIds(Long[] infoIds) {
|
public int deleteLoginInfoByIds(Long[] infoIds) {
|
||||||
return baseMapper.deleteByIds(Arrays.asList(infoIds));
|
return sysLoginInfoMapper.deleteByIds(Arrays.asList(infoIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -182,6 +182,6 @@ public class SysLoginInfoServiceImpl implements ISysLoginInfoService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void cleanLoginInfo() {
|
public void cleanLoginInfo() {
|
||||||
baseMapper.delete(new LambdaQueryWrapper<>());
|
sysLoginInfoMapper.delete(new LambdaQueryWrapper<>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,9 +38,9 @@ import java.util.*;
|
|||||||
@Service
|
@Service
|
||||||
public class SysMenuServiceImpl implements ISysMenuService {
|
public class SysMenuServiceImpl implements ISysMenuService {
|
||||||
|
|
||||||
private final SysMenuMapper baseMapper;
|
private final SysMenuMapper sysMenuMapper;
|
||||||
private final SysRoleMapper roleMapper;
|
private final SysRoleMapper sysRoleMapper;
|
||||||
private final SysRoleMenuMapper roleMenuMapper;
|
private final SysRoleMenuMapper sysRoleMenuMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据用户查询系统菜单列表
|
* 根据用户查询系统菜单列表
|
||||||
@ -64,7 +64,7 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
|||||||
public List<SysMenuVo> selectMenuList(SysMenuBo menu, Long userId) {
|
public List<SysMenuVo> selectMenuList(SysMenuBo menu, Long userId) {
|
||||||
// 管理员显示所有菜单信息 不是管理员 按用户id过滤菜单
|
// 管理员显示所有菜单信息 不是管理员 按用户id过滤菜单
|
||||||
if (LoginHelper.isSuperAdmin(userId)) {
|
if (LoginHelper.isSuperAdmin(userId)) {
|
||||||
return baseMapper.selectVoList(
|
return sysMenuMapper.selectVoList(
|
||||||
new LambdaQueryWrapper<SysMenu>()
|
new LambdaQueryWrapper<SysMenu>()
|
||||||
.like(StringUtils.isNotBlank(menu.getMenuName()), SysMenu::getMenuName, menu.getMenuName())
|
.like(StringUtils.isNotBlank(menu.getMenuName()), SysMenu::getMenuName, menu.getMenuName())
|
||||||
.eq(StringUtils.isNotBlank(menu.getVisible()), SysMenu::getVisible, menu.getVisible())
|
.eq(StringUtils.isNotBlank(menu.getVisible()), SysMenu::getVisible, menu.getVisible())
|
||||||
@ -74,7 +74,7 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
|||||||
.orderByAsc(SysMenu::getParentId)
|
.orderByAsc(SysMenu::getParentId)
|
||||||
.orderByAsc(SysMenu::getOrderNum));
|
.orderByAsc(SysMenu::getOrderNum));
|
||||||
}
|
}
|
||||||
return baseMapper.selectMenuListByUserId(menu, userId);
|
return sysMenuMapper.selectMenuListByUserId(menu, userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -85,7 +85,7 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Set<String> selectMenuPermsByUserId(Long userId) {
|
public Set<String> selectMenuPermsByUserId(Long userId) {
|
||||||
return baseMapper.selectMenuPermsByUserId(userId);
|
return sysMenuMapper.selectMenuPermsByUserId(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -96,7 +96,7 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Set<String> selectMenuPermsByRoleId(Long roleId) {
|
public Set<String> selectMenuPermsByRoleId(Long roleId) {
|
||||||
return baseMapper.selectMenuPermsByRoleId(roleId);
|
return sysMenuMapper.selectMenuPermsByRoleId(roleId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -107,7 +107,7 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Map<Long, Set<String>> selectMenuPermsByRoleIds(Collection<Long> roleIds) {
|
public Map<Long, Set<String>> selectMenuPermsByRoleIds(Collection<Long> roleIds) {
|
||||||
return baseMapper.selectMenuPermsByRoleIds(roleIds);
|
return sysMenuMapper.selectMenuPermsByRoleIds(roleIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -120,9 +120,9 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
|||||||
public List<SysMenu> selectMenuTreeByUserId(Long userId) {
|
public List<SysMenu> selectMenuTreeByUserId(Long userId) {
|
||||||
List<SysMenu> menus;
|
List<SysMenu> menus;
|
||||||
if (LoginHelper.isSuperAdmin(userId)) {
|
if (LoginHelper.isSuperAdmin(userId)) {
|
||||||
menus = baseMapper.selectMenuTreeAll();
|
menus = sysMenuMapper.selectMenuTreeAll();
|
||||||
} else {
|
} else {
|
||||||
menus = baseMapper.selectMenuTreeByUserId(userId);
|
menus = sysMenuMapper.selectMenuTreeByUserId(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TreeBuildUtils.build(menus, Constants.TOP_PARENT_ID, SysMenu::getParentId, (menu, nodeTreeMaps) -> {
|
return TreeBuildUtils.build(menus, Constants.TOP_PARENT_ID, SysMenu::getParentId, (menu, nodeTreeMaps) -> {
|
||||||
@ -145,8 +145,8 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<Long> selectMenuListByRoleId(Long roleId) {
|
public List<Long> selectMenuListByRoleId(Long roleId) {
|
||||||
SysRole role = roleMapper.selectById(roleId);
|
SysRole role = sysRoleMapper.selectById(roleId);
|
||||||
return baseMapper.selectMenuListByRoleId(roleId, role.getMenuCheckStrictly());
|
return sysMenuMapper.selectMenuListByRoleId(roleId, role.getMenuCheckStrictly());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -235,7 +235,7 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public SysMenuVo selectMenuById(Long menuId) {
|
public SysMenuVo selectMenuById(Long menuId) {
|
||||||
return baseMapper.selectVoById(menuId);
|
return sysMenuMapper.selectVoById(menuId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -246,7 +246,7 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean hasChildByMenuId(Long menuId) {
|
public boolean hasChildByMenuId(Long menuId) {
|
||||||
return baseMapper.exists(new LambdaQueryWrapper<SysMenu>().eq(SysMenu::getParentId, menuId));
|
return sysMenuMapper.exists(new LambdaQueryWrapper<SysMenu>().eq(SysMenu::getParentId, menuId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -257,7 +257,7 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean hasChildByMenuId(Collection<Long> menuIds) {
|
public boolean hasChildByMenuId(Collection<Long> menuIds) {
|
||||||
return baseMapper.exists(new LambdaQueryWrapper<SysMenu>().in(SysMenu::getParentId, menuIds).notIn(SysMenu::getMenuId, menuIds));
|
return sysMenuMapper.exists(new LambdaQueryWrapper<SysMenu>().in(SysMenu::getParentId, menuIds).notIn(SysMenu::getMenuId, menuIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -268,7 +268,7 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean checkMenuExistRole(Long menuId) {
|
public boolean checkMenuExistRole(Long menuId) {
|
||||||
return roleMenuMapper.exists(new LambdaQueryWrapper<SysRoleMenu>().eq(SysRoleMenu::getMenuId, menuId));
|
return sysRoleMenuMapper.exists(new LambdaQueryWrapper<SysRoleMenu>().eq(SysRoleMenu::getMenuId, menuId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -280,7 +280,7 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
|||||||
@Override
|
@Override
|
||||||
public int insertMenu(SysMenuBo bo) {
|
public int insertMenu(SysMenuBo bo) {
|
||||||
SysMenu menu = MapstructUtils.convert(bo, SysMenu.class);
|
SysMenu menu = MapstructUtils.convert(bo, SysMenu.class);
|
||||||
return baseMapper.insert(menu);
|
return sysMenuMapper.insert(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -292,7 +292,7 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
|||||||
@Override
|
@Override
|
||||||
public int updateMenu(SysMenuBo bo) {
|
public int updateMenu(SysMenuBo bo) {
|
||||||
SysMenu menu = MapstructUtils.convert(bo, SysMenu.class);
|
SysMenu menu = MapstructUtils.convert(bo, SysMenu.class);
|
||||||
return baseMapper.updateById(menu);
|
return sysMenuMapper.updateById(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -303,7 +303,7 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteMenuById(Long menuId) {
|
public int deleteMenuById(Long menuId) {
|
||||||
return baseMapper.deleteById(menuId);
|
return sysMenuMapper.deleteById(menuId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -314,8 +314,8 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void deleteMenuById(Collection<Long> menuIds) {
|
public void deleteMenuById(Collection<Long> menuIds) {
|
||||||
baseMapper.deleteByIds(menuIds);
|
sysMenuMapper.deleteByIds(menuIds);
|
||||||
roleMenuMapper.deleteByMenuIds(menuIds);
|
sysRoleMenuMapper.deleteByMenuIds(menuIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -326,7 +326,7 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean checkMenuNameUnique(SysMenuBo menu) {
|
public boolean checkMenuNameUnique(SysMenuBo menu) {
|
||||||
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysMenu>()
|
boolean exist = sysMenuMapper.exists(new LambdaQueryWrapper<SysMenu>()
|
||||||
.eq(SysMenu::getMenuName, menu.getMenuName())
|
.eq(SysMenu::getMenuName, menu.getMenuName())
|
||||||
.eq(SysMenu::getParentId, menu.getParentId())
|
.eq(SysMenu::getParentId, menu.getParentId())
|
||||||
.ne(ObjectUtil.isNotNull(menu.getMenuId()), SysMenu::getMenuId, menu.getMenuId()));
|
.ne(ObjectUtil.isNotNull(menu.getMenuId()), SysMenu::getMenuId, menu.getMenuId()));
|
||||||
@ -349,7 +349,7 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
|||||||
Long parentId = menu.getParentId();
|
Long parentId = menu.getParentId();
|
||||||
String path = menu.getPath();
|
String path = menu.getPath();
|
||||||
String routeName = StringUtils.isEmpty(menu.getRouteName()) ? path : menu.getRouteName();
|
String routeName = StringUtils.isEmpty(menu.getRouteName()) ? path : menu.getRouteName();
|
||||||
List<SysMenu> sysMenuList = baseMapper.selectList(
|
List<SysMenu> sysMenuList = sysMenuMapper.selectList(
|
||||||
new LambdaQueryWrapper<SysMenu>()
|
new LambdaQueryWrapper<SysMenu>()
|
||||||
.in(SysMenu::getMenuType, SystemConstants.TYPE_DIR, SystemConstants.TYPE_MENU)
|
.in(SysMenu::getMenuType, SystemConstants.TYPE_DIR, SystemConstants.TYPE_MENU)
|
||||||
.and(w ->
|
.and(w ->
|
||||||
|
|||||||
@ -66,7 +66,7 @@ public class SysMessageServiceImpl implements ISysMessageService, MessageService
|
|||||||
*/
|
*/
|
||||||
private static final long BOX_DAYS = 30L;
|
private static final long BOX_DAYS = 30L;
|
||||||
|
|
||||||
private final SysMessageMapper baseMapper;
|
private final SysMessageMapper sysMessageMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询当前用户消息盒子数据
|
* 查询当前用户消息盒子数据
|
||||||
@ -193,7 +193,7 @@ public class SysMessageServiceImpl implements ISysMessageService, MessageService
|
|||||||
return payload;
|
return payload;
|
||||||
}
|
}
|
||||||
SysMessage message = buildMessage(userIds, payload);
|
SysMessage message = buildMessage(userIds, payload);
|
||||||
baseMapper.insert(message);
|
sysMessageMapper.insert(message);
|
||||||
payload.setMessageId(message.getMessageId());
|
payload.setMessageId(message.getMessageId());
|
||||||
return payload;
|
return payload;
|
||||||
}
|
}
|
||||||
@ -219,7 +219,7 @@ public class SysMessageServiceImpl implements ISysMessageService, MessageService
|
|||||||
// 按创建时间+消息ID倒序
|
// 按创建时间+消息ID倒序
|
||||||
lqw.orderByDesc(SysMessage::getCreateTime, SysMessage::getMessageId);
|
lqw.orderByDesc(SysMessage::getCreateTime, SysMessage::getMessageId);
|
||||||
// 分页查询(只查第一页,最多100条)
|
// 分页查询(只查第一页,最多100条)
|
||||||
List<SysMessage> list = baseMapper.selectList(new Page<>(1, BOX_LIMIT, false), lqw);
|
List<SysMessage> list = sysMessageMapper.selectList(new Page<>(1, BOX_LIMIT, false), lqw);
|
||||||
// 转换为VO并返回
|
// 转换为VO并返回
|
||||||
return list.stream().map(this::buildVo).toList();
|
return list.stream().map(this::buildVo).toList();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,8 +31,8 @@ import java.util.List;
|
|||||||
@Service
|
@Service
|
||||||
public class SysNoticeServiceImpl implements ISysNoticeService {
|
public class SysNoticeServiceImpl implements ISysNoticeService {
|
||||||
|
|
||||||
private final SysNoticeMapper baseMapper;
|
private final SysNoticeMapper sysNoticeMapper;
|
||||||
private final SysUserMapper userMapper;
|
private final SysUserMapper sysUserMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询通知公告列表
|
* 分页查询通知公告列表
|
||||||
@ -44,7 +44,7 @@ public class SysNoticeServiceImpl implements ISysNoticeService {
|
|||||||
@Override
|
@Override
|
||||||
public PageResult<SysNoticeVo> selectPageNoticeList(SysNoticeBo notice, PageQuery pageQuery) {
|
public PageResult<SysNoticeVo> selectPageNoticeList(SysNoticeBo notice, PageQuery pageQuery) {
|
||||||
LambdaQueryWrapper<SysNotice> lqw = buildQueryWrapper(notice);
|
LambdaQueryWrapper<SysNotice> lqw = buildQueryWrapper(notice);
|
||||||
Page<SysNoticeVo> page = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
Page<SysNoticeVo> page = sysNoticeMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
return PageResult.build(page.getRecords(), page.getTotal());
|
return PageResult.build(page.getRecords(), page.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ public class SysNoticeServiceImpl implements ISysNoticeService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public SysNoticeVo selectNoticeById(Long noticeId) {
|
public SysNoticeVo selectNoticeById(Long noticeId) {
|
||||||
return baseMapper.selectVoById(noticeId);
|
return sysNoticeMapper.selectVoById(noticeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -68,7 +68,7 @@ public class SysNoticeServiceImpl implements ISysNoticeService {
|
|||||||
@Override
|
@Override
|
||||||
public List<SysNoticeVo> selectNoticeList(SysNoticeBo notice) {
|
public List<SysNoticeVo> selectNoticeList(SysNoticeBo notice) {
|
||||||
LambdaQueryWrapper<SysNotice> lqw = buildQueryWrapper(notice);
|
LambdaQueryWrapper<SysNotice> lqw = buildQueryWrapper(notice);
|
||||||
return baseMapper.selectVoList(lqw);
|
return sysNoticeMapper.selectVoList(lqw);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -82,7 +82,7 @@ public class SysNoticeServiceImpl implements ISysNoticeService {
|
|||||||
lqw.like(StringUtils.isNotBlank(bo.getNoticeTitle()), SysNotice::getNoticeTitle, bo.getNoticeTitle());
|
lqw.like(StringUtils.isNotBlank(bo.getNoticeTitle()), SysNotice::getNoticeTitle, bo.getNoticeTitle());
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getNoticeType()), SysNotice::getNoticeType, bo.getNoticeType());
|
lqw.eq(StringUtils.isNotBlank(bo.getNoticeType()), SysNotice::getNoticeType, bo.getNoticeType());
|
||||||
if (StringUtils.isNotBlank(bo.getCreateByName())) {
|
if (StringUtils.isNotBlank(bo.getCreateByName())) {
|
||||||
SysUserVo sysUser = userMapper.selectVoOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUserName, bo.getCreateByName()));
|
SysUserVo sysUser = sysUserMapper.selectVoOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUserName, bo.getCreateByName()));
|
||||||
lqw.eq(SysNotice::getCreateBy, ObjectUtils.notNullGetter(sysUser, SysUserVo::getUserId));
|
lqw.eq(SysNotice::getCreateBy, ObjectUtils.notNullGetter(sysUser, SysUserVo::getUserId));
|
||||||
}
|
}
|
||||||
lqw.orderByAsc(SysNotice::getNoticeId);
|
lqw.orderByAsc(SysNotice::getNoticeId);
|
||||||
@ -98,7 +98,7 @@ public class SysNoticeServiceImpl implements ISysNoticeService {
|
|||||||
@Override
|
@Override
|
||||||
public int insertNotice(SysNoticeBo bo) {
|
public int insertNotice(SysNoticeBo bo) {
|
||||||
SysNotice notice = MapstructUtils.convert(bo, SysNotice.class);
|
SysNotice notice = MapstructUtils.convert(bo, SysNotice.class);
|
||||||
int rows = baseMapper.insert(notice);
|
int rows = sysNoticeMapper.insert(notice);
|
||||||
bo.setNoticeId(notice.getNoticeId());
|
bo.setNoticeId(notice.getNoticeId());
|
||||||
return rows;
|
return rows;
|
||||||
}
|
}
|
||||||
@ -112,7 +112,7 @@ public class SysNoticeServiceImpl implements ISysNoticeService {
|
|||||||
@Override
|
@Override
|
||||||
public int updateNotice(SysNoticeBo bo) {
|
public int updateNotice(SysNoticeBo bo) {
|
||||||
SysNotice notice = MapstructUtils.convert(bo, SysNotice.class);
|
SysNotice notice = MapstructUtils.convert(bo, SysNotice.class);
|
||||||
return baseMapper.updateById(notice);
|
return sysNoticeMapper.updateById(notice);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -123,7 +123,7 @@ public class SysNoticeServiceImpl implements ISysNoticeService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteNoticeById(Long noticeId) {
|
public int deleteNoticeById(Long noticeId) {
|
||||||
return baseMapper.deleteById(noticeId);
|
return sysNoticeMapper.deleteById(noticeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -134,6 +134,6 @@ public class SysNoticeServiceImpl implements ISysNoticeService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteNoticeByIds(Long[] noticeIds) {
|
public int deleteNoticeByIds(Long[] noticeIds) {
|
||||||
return baseMapper.deleteByIds(Arrays.asList(noticeIds));
|
return sysNoticeMapper.deleteByIds(Arrays.asList(noticeIds));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,7 +33,7 @@ import java.util.Map;
|
|||||||
@Service
|
@Service
|
||||||
public class SysOperLogServiceImpl implements ISysOperLogService {
|
public class SysOperLogServiceImpl implements ISysOperLogService {
|
||||||
|
|
||||||
private final SysOperLogMapper baseMapper;
|
private final SysOperLogMapper sysOperLogMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 操作日志记录
|
* 操作日志记录
|
||||||
@ -62,7 +62,7 @@ public class SysOperLogServiceImpl implements ISysOperLogService {
|
|||||||
if (StringUtils.isBlank(pageQuery.getOrderByColumn())) {
|
if (StringUtils.isBlank(pageQuery.getOrderByColumn())) {
|
||||||
lqw.orderByDesc(SysOperLog::getOperId);
|
lqw.orderByDesc(SysOperLog::getOperId);
|
||||||
}
|
}
|
||||||
Page<SysOperLogVo> page = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
Page<SysOperLogVo> page = sysOperLogMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
return PageResult.build(page.getRecords(), page.getTotal());
|
return PageResult.build(page.getRecords(), page.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ public class SysOperLogServiceImpl implements ISysOperLogService {
|
|||||||
public void insertOperlog(SysOperLogBo bo) {
|
public void insertOperlog(SysOperLogBo bo) {
|
||||||
SysOperLog operLog = MapstructUtils.convert(bo, SysOperLog.class);
|
SysOperLog operLog = MapstructUtils.convert(bo, SysOperLog.class);
|
||||||
operLog.setOperTime(LocalDateTime.now());
|
operLog.setOperTime(LocalDateTime.now());
|
||||||
baseMapper.insert(operLog);
|
sysOperLogMapper.insert(operLog);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -118,7 +118,7 @@ public class SysOperLogServiceImpl implements ISysOperLogService {
|
|||||||
@Override
|
@Override
|
||||||
public List<SysOperLogVo> selectOperLogList(SysOperLogBo operLog) {
|
public List<SysOperLogVo> selectOperLogList(SysOperLogBo operLog) {
|
||||||
LambdaQueryWrapper<SysOperLog> lqw = buildQueryWrapper(operLog);
|
LambdaQueryWrapper<SysOperLog> lqw = buildQueryWrapper(operLog);
|
||||||
return baseMapper.selectVoList(lqw.orderByDesc(SysOperLog::getOperId));
|
return sysOperLogMapper.selectVoList(lqw.orderByDesc(SysOperLog::getOperId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -129,7 +129,7 @@ public class SysOperLogServiceImpl implements ISysOperLogService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteOperLogByIds(Long[] operIds) {
|
public int deleteOperLogByIds(Long[] operIds) {
|
||||||
return baseMapper.deleteByIds(Arrays.asList(operIds));
|
return sysOperLogMapper.deleteByIds(Arrays.asList(operIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -140,7 +140,7 @@ public class SysOperLogServiceImpl implements ISysOperLogService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public SysOperLogVo selectOperLogById(Long operId) {
|
public SysOperLogVo selectOperLogById(Long operId) {
|
||||||
return baseMapper.selectVoById(operId);
|
return sysOperLogMapper.selectVoById(operId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -148,6 +148,6 @@ public class SysOperLogServiceImpl implements ISysOperLogService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void cleanOperLog() {
|
public void cleanOperLog() {
|
||||||
baseMapper.delete(new LambdaQueryWrapper<>());
|
sysOperLogMapper.delete(new LambdaQueryWrapper<>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,14 +43,14 @@ import java.util.List;
|
|||||||
@Service
|
@Service
|
||||||
public class SysOssConfigServiceImpl implements ISysOssConfigService {
|
public class SysOssConfigServiceImpl implements ISysOssConfigService {
|
||||||
|
|
||||||
private final SysOssConfigMapper baseMapper;
|
private final SysOssConfigMapper sysOssConfigMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目启动时,初始化参数到缓存,加载配置类
|
* 项目启动时,初始化参数到缓存,加载配置类
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void init() {
|
public void init() {
|
||||||
List<SysOssConfig> list = baseMapper.selectList();
|
List<SysOssConfig> list = sysOssConfigMapper.selectList();
|
||||||
// 加载OSS初始化配置
|
// 加载OSS初始化配置
|
||||||
for (SysOssConfig config : list) {
|
for (SysOssConfig config : list) {
|
||||||
String configKey = config.getConfigKey();
|
String configKey = config.getConfigKey();
|
||||||
@ -69,7 +69,7 @@ public class SysOssConfigServiceImpl implements ISysOssConfigService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public SysOssConfigVo queryById(Long ossConfigId) {
|
public SysOssConfigVo queryById(Long ossConfigId) {
|
||||||
return baseMapper.selectVoById(ossConfigId);
|
return sysOssConfigMapper.selectVoById(ossConfigId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -82,7 +82,7 @@ public class SysOssConfigServiceImpl implements ISysOssConfigService {
|
|||||||
@Override
|
@Override
|
||||||
public PageResult<SysOssConfigVo> queryPageList(SysOssConfigBo bo, PageQuery pageQuery) {
|
public PageResult<SysOssConfigVo> queryPageList(SysOssConfigBo bo, PageQuery pageQuery) {
|
||||||
LambdaQueryWrapper<SysOssConfig> lqw = buildQueryWrapper(bo);
|
LambdaQueryWrapper<SysOssConfig> lqw = buildQueryWrapper(bo);
|
||||||
Page<SysOssConfigVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
Page<SysOssConfigVo> result = sysOssConfigMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
return PageResult.build(result.getRecords(), result.getTotal());
|
return PageResult.build(result.getRecords(), result.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,10 +112,10 @@ public class SysOssConfigServiceImpl implements ISysOssConfigService {
|
|||||||
public Boolean insertByBo(SysOssConfigBo bo) {
|
public Boolean insertByBo(SysOssConfigBo bo) {
|
||||||
SysOssConfig config = MapstructUtils.convert(bo, SysOssConfig.class);
|
SysOssConfig config = MapstructUtils.convert(bo, SysOssConfig.class);
|
||||||
validEntityBeforeSave(config);
|
validEntityBeforeSave(config);
|
||||||
boolean flag = baseMapper.insert(config) > 0;
|
boolean flag = sysOssConfigMapper.insert(config) > 0;
|
||||||
if (flag) {
|
if (flag) {
|
||||||
// 从数据库查询完整的数据做缓存
|
// 从数据库查询完整的数据做缓存
|
||||||
config = baseMapper.selectById(config.getOssConfigId());
|
config = sysOssConfigMapper.selectById(config.getOssConfigId());
|
||||||
CacheUtils.put(CacheNames.SYS_OSS_CONFIG, config.getConfigKey(), JsonUtils.toJsonString(config));
|
CacheUtils.put(CacheNames.SYS_OSS_CONFIG, config.getConfigKey(), JsonUtils.toJsonString(config));
|
||||||
}
|
}
|
||||||
return flag;
|
return flag;
|
||||||
@ -137,10 +137,10 @@ public class SysOssConfigServiceImpl implements ISysOssConfigService {
|
|||||||
luw.set(ObjectUtil.isNull(config.getExt1()), SysOssConfig::getExt1, "");
|
luw.set(ObjectUtil.isNull(config.getExt1()), SysOssConfig::getExt1, "");
|
||||||
luw.set(ObjectUtil.isNull(config.getRemark()), SysOssConfig::getRemark, "");
|
luw.set(ObjectUtil.isNull(config.getRemark()), SysOssConfig::getRemark, "");
|
||||||
luw.eq(SysOssConfig::getOssConfigId, config.getOssConfigId());
|
luw.eq(SysOssConfig::getOssConfigId, config.getOssConfigId());
|
||||||
boolean flag = baseMapper.update(config, luw) > 0;
|
boolean flag = sysOssConfigMapper.update(config, luw) > 0;
|
||||||
if (flag) {
|
if (flag) {
|
||||||
// 从数据库查询完整的数据做缓存
|
// 从数据库查询完整的数据做缓存
|
||||||
config = baseMapper.selectById(config.getOssConfigId());
|
config = sysOssConfigMapper.selectById(config.getOssConfigId());
|
||||||
CacheUtils.put(CacheNames.SYS_OSS_CONFIG, config.getConfigKey(), JsonUtils.toJsonString(config));
|
CacheUtils.put(CacheNames.SYS_OSS_CONFIG, config.getConfigKey(), JsonUtils.toJsonString(config));
|
||||||
}
|
}
|
||||||
return flag;
|
return flag;
|
||||||
@ -174,10 +174,10 @@ public class SysOssConfigServiceImpl implements ISysOssConfigService {
|
|||||||
}
|
}
|
||||||
List<SysOssConfig> list = CollUtil.newArrayList();
|
List<SysOssConfig> list = CollUtil.newArrayList();
|
||||||
for (Long configId : ids) {
|
for (Long configId : ids) {
|
||||||
SysOssConfig config = baseMapper.selectById(configId);
|
SysOssConfig config = sysOssConfigMapper.selectById(configId);
|
||||||
list.add(config);
|
list.add(config);
|
||||||
}
|
}
|
||||||
boolean flag = baseMapper.deleteByIds(ids) > 0;
|
boolean flag = sysOssConfigMapper.deleteByIds(ids) > 0;
|
||||||
if (flag) {
|
if (flag) {
|
||||||
list.forEach(sysOssConfig ->
|
list.forEach(sysOssConfig ->
|
||||||
CacheUtils.evict(CacheNames.SYS_OSS_CONFIG, sysOssConfig.getConfigKey()));
|
CacheUtils.evict(CacheNames.SYS_OSS_CONFIG, sysOssConfig.getConfigKey()));
|
||||||
@ -193,7 +193,7 @@ public class SysOssConfigServiceImpl implements ISysOssConfigService {
|
|||||||
*/
|
*/
|
||||||
private boolean checkConfigKeyUnique(SysOssConfig sysOssConfig) {
|
private boolean checkConfigKeyUnique(SysOssConfig sysOssConfig) {
|
||||||
long ossConfigId = ObjectUtils.notNull(sysOssConfig.getOssConfigId(), -1L);
|
long ossConfigId = ObjectUtils.notNull(sysOssConfig.getOssConfigId(), -1L);
|
||||||
SysOssConfig info = baseMapper.selectOne(new LambdaQueryWrapper<SysOssConfig>()
|
SysOssConfig info = sysOssConfigMapper.selectOne(new LambdaQueryWrapper<SysOssConfig>()
|
||||||
.select(SysOssConfig::getOssConfigId, SysOssConfig::getConfigKey)
|
.select(SysOssConfig::getOssConfigId, SysOssConfig::getConfigKey)
|
||||||
.eq(SysOssConfig::getConfigKey, sysOssConfig.getConfigKey()));
|
.eq(SysOssConfig::getConfigKey, sysOssConfig.getConfigKey()));
|
||||||
if (ObjectUtil.isNotNull(info) && info.getOssConfigId() != ossConfigId) {
|
if (ObjectUtil.isNotNull(info) && info.getOssConfigId() != ossConfigId) {
|
||||||
@ -212,9 +212,9 @@ public class SysOssConfigServiceImpl implements ISysOssConfigService {
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int updateOssConfigStatus(SysOssConfigBo bo) {
|
public int updateOssConfigStatus(SysOssConfigBo bo) {
|
||||||
SysOssConfig sysOssConfig = MapstructUtils.convert(bo, SysOssConfig.class);
|
SysOssConfig sysOssConfig = MapstructUtils.convert(bo, SysOssConfig.class);
|
||||||
int row = baseMapper.update(null, new LambdaUpdateWrapper<SysOssConfig>()
|
int row = sysOssConfigMapper.update(null, new LambdaUpdateWrapper<SysOssConfig>()
|
||||||
.set(SysOssConfig::getStatus, SystemConstants.NO));
|
.set(SysOssConfig::getStatus, SystemConstants.NO));
|
||||||
row += baseMapper.updateById(sysOssConfig);
|
row += sysOssConfigMapper.updateById(sysOssConfig);
|
||||||
if (row > 0) {
|
if (row > 0) {
|
||||||
RedisUtils.setCacheObject(OssConstant.DEFAULT_CONFIG_KEY, sysOssConfig.getConfigKey());
|
RedisUtils.setCacheObject(OssConstant.DEFAULT_CONFIG_KEY, sysOssConfig.getConfigKey());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -59,7 +59,7 @@ import java.util.Map;
|
|||||||
@Service
|
@Service
|
||||||
public class SysOssServiceImpl implements ISysOssService, OssService {
|
public class SysOssServiceImpl implements ISysOssService, OssService {
|
||||||
|
|
||||||
private final SysOssMapper baseMapper;
|
private final SysOssMapper sysOssMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询OSS对象存储列表
|
* 查询OSS对象存储列表
|
||||||
@ -71,7 +71,7 @@ public class SysOssServiceImpl implements ISysOssService, OssService {
|
|||||||
@Override
|
@Override
|
||||||
public PageResult<SysOssVo> queryPageList(SysOssBo bo, PageQuery pageQuery) {
|
public PageResult<SysOssVo> queryPageList(SysOssBo bo, PageQuery pageQuery) {
|
||||||
LambdaQueryWrapper<SysOss> lqw = buildQueryWrapper(bo);
|
LambdaQueryWrapper<SysOss> lqw = buildQueryWrapper(bo);
|
||||||
Page<SysOssVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
Page<SysOssVo> result = sysOssMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
List<SysOssVo> filterResult = StreamUtils.toList(result.getRecords(), this::matchingUrl);
|
List<SysOssVo> filterResult = StreamUtils.toList(result.getRecords(), this::matchingUrl);
|
||||||
result.setRecords(filterResult);
|
result.setRecords(filterResult);
|
||||||
return PageResult.build(result.getRecords(), result.getTotal());
|
return PageResult.build(result.getRecords(), result.getTotal());
|
||||||
@ -179,7 +179,7 @@ public class SysOssServiceImpl implements ISysOssService, OssService {
|
|||||||
@Cacheable(cacheNames = CacheNames.SYS_OSS, key = "#ossId")
|
@Cacheable(cacheNames = CacheNames.SYS_OSS, key = "#ossId")
|
||||||
@Override
|
@Override
|
||||||
public SysOssVo getById(Long ossId) {
|
public SysOssVo getById(Long ossId) {
|
||||||
return baseMapper.selectVoById(ossId);
|
return sysOssMapper.selectVoById(ossId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -285,7 +285,7 @@ public class SysOssServiceImpl implements ISysOssService, OssService {
|
|||||||
oss.setOriginalName(originalfileName);
|
oss.setOriginalName(originalfileName);
|
||||||
oss.setService(configKey);
|
oss.setService(configKey);
|
||||||
oss.setExt1(JsonUtils.toJsonString(ext1));
|
oss.setExt1(JsonUtils.toJsonString(ext1));
|
||||||
baseMapper.insert(oss);
|
sysOssMapper.insert(oss);
|
||||||
SysOssVo sysOssVo = MapstructUtils.convert(oss, SysOssVo.class);
|
SysOssVo sysOssVo = MapstructUtils.convert(oss, SysOssVo.class);
|
||||||
return this.matchingUrl(sysOssVo);
|
return this.matchingUrl(sysOssVo);
|
||||||
}
|
}
|
||||||
@ -302,11 +302,11 @@ public class SysOssServiceImpl implements ISysOssService, OssService {
|
|||||||
if (isValid) {
|
if (isValid) {
|
||||||
// 做一些业务上的校验,判断是否需要校验
|
// 做一些业务上的校验,判断是否需要校验
|
||||||
}
|
}
|
||||||
List<SysOss> list = baseMapper.selectByIds(ids);
|
List<SysOss> list = sysOssMapper.selectByIds(ids);
|
||||||
for (SysOss sysOss : list) {
|
for (SysOss sysOss : list) {
|
||||||
OssFactory.instance(sysOss.getService()).delete(sysOss.getFileName());
|
OssFactory.instance(sysOss.getService()).delete(sysOss.getFileName());
|
||||||
}
|
}
|
||||||
return baseMapper.deleteByIds(ids) > 0;
|
return sysOssMapper.deleteByIds(ids) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -38,9 +38,9 @@ import java.util.Map;
|
|||||||
@Service
|
@Service
|
||||||
public class SysPostServiceImpl implements ISysPostService, PostService {
|
public class SysPostServiceImpl implements ISysPostService, PostService {
|
||||||
|
|
||||||
private final SysPostMapper baseMapper;
|
private final SysPostMapper sysPostMapper;
|
||||||
private final SysDeptMapper deptMapper;
|
private final SysDeptMapper sysDeptMapper;
|
||||||
private final SysUserPostMapper userPostMapper;
|
private final SysUserPostMapper sysUserPostMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询岗位列表
|
* 分页查询岗位列表
|
||||||
@ -51,7 +51,7 @@ public class SysPostServiceImpl implements ISysPostService, PostService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public PageResult<SysPostVo> selectPagePostList(SysPostBo post, PageQuery pageQuery) {
|
public PageResult<SysPostVo> selectPagePostList(SysPostBo post, PageQuery pageQuery) {
|
||||||
Page<SysPostVo> page = baseMapper.selectPagePostList(pageQuery.build(), buildQueryWrapper(post));
|
Page<SysPostVo> page = sysPostMapper.selectPagePostList(pageQuery.build(), buildQueryWrapper(post));
|
||||||
return PageResult.build(page.getRecords(), page.getTotal());
|
return PageResult.build(page.getRecords(), page.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ public class SysPostServiceImpl implements ISysPostService, PostService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SysPostVo> selectPostList(SysPostBo post) {
|
public List<SysPostVo> selectPostList(SysPostBo post) {
|
||||||
return baseMapper.selectVoList(buildQueryWrapper(post));
|
return sysPostMapper.selectVoList(buildQueryWrapper(post));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -74,7 +74,7 @@ public class SysPostServiceImpl implements ISysPostService, PostService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SysPostVo> selectPostsByUserId(Long userId) {
|
public List<SysPostVo> selectPostsByUserId(Long userId) {
|
||||||
return baseMapper.selectPostsByUserId(userId);
|
return sysPostMapper.selectPostsByUserId(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -99,7 +99,7 @@ public class SysPostServiceImpl implements ISysPostService, PostService {
|
|||||||
} else if (ObjectUtil.isNotNull(bo.getBelongDeptId())) {
|
} else if (ObjectUtil.isNotNull(bo.getBelongDeptId())) {
|
||||||
//部门树搜索
|
//部门树搜索
|
||||||
wrapper.and(x -> {
|
wrapper.and(x -> {
|
||||||
List<Long> deptIds = deptMapper.selectDeptAndChildById(bo.getBelongDeptId());
|
List<Long> deptIds = sysDeptMapper.selectDeptAndChildById(bo.getBelongDeptId());
|
||||||
x.in(SysPost::getDeptId, deptIds);
|
x.in(SysPost::getDeptId, deptIds);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -113,7 +113,7 @@ public class SysPostServiceImpl implements ISysPostService, PostService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SysPostVo> selectPostAll() {
|
public List<SysPostVo> selectPostAll() {
|
||||||
return baseMapper.selectVoList(new QueryWrapper<>());
|
return sysPostMapper.selectVoList(new QueryWrapper<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -124,7 +124,7 @@ public class SysPostServiceImpl implements ISysPostService, PostService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public SysPostVo selectPostById(Long postId) {
|
public SysPostVo selectPostById(Long postId) {
|
||||||
return baseMapper.selectVoById(postId);
|
return sysPostMapper.selectVoById(postId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -135,7 +135,7 @@ public class SysPostServiceImpl implements ISysPostService, PostService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<Long> selectPostListByUserId(Long userId) {
|
public List<Long> selectPostListByUserId(Long userId) {
|
||||||
List<SysPostVo> list = baseMapper.selectPostsByUserId(userId);
|
List<SysPostVo> list = sysPostMapper.selectPostsByUserId(userId);
|
||||||
return StreamUtils.toList(list, SysPostVo::getPostId);
|
return StreamUtils.toList(list, SysPostVo::getPostId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ public class SysPostServiceImpl implements ISysPostService, PostService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SysPostVo> selectPostByIds(Collection<Long> postIds) {
|
public List<SysPostVo> selectPostByIds(Collection<Long> postIds) {
|
||||||
return baseMapper.selectVoList(new LambdaQueryWrapper<SysPost>()
|
return sysPostMapper.selectVoList(new LambdaQueryWrapper<SysPost>()
|
||||||
.select(SysPost::getPostId, SysPost::getPostName, SysPost::getPostCode)
|
.select(SysPost::getPostId, SysPost::getPostName, SysPost::getPostCode)
|
||||||
.eq(SysPost::getStatus, SystemConstants.NORMAL)
|
.eq(SysPost::getStatus, SystemConstants.NORMAL)
|
||||||
.in(CollUtil.isNotEmpty(postIds), SysPost::getPostId, postIds));
|
.in(CollUtil.isNotEmpty(postIds), SysPost::getPostId, postIds));
|
||||||
@ -161,7 +161,7 @@ public class SysPostServiceImpl implements ISysPostService, PostService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean checkPostNameUnique(SysPostBo post) {
|
public boolean checkPostNameUnique(SysPostBo post) {
|
||||||
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysPost>()
|
boolean exist = sysPostMapper.exists(new LambdaQueryWrapper<SysPost>()
|
||||||
.eq(SysPost::getPostName, post.getPostName())
|
.eq(SysPost::getPostName, post.getPostName())
|
||||||
.eq(SysPost::getDeptId, post.getDeptId())
|
.eq(SysPost::getDeptId, post.getDeptId())
|
||||||
.ne(ObjectUtil.isNotNull(post.getPostId()), SysPost::getPostId, post.getPostId()));
|
.ne(ObjectUtil.isNotNull(post.getPostId()), SysPost::getPostId, post.getPostId()));
|
||||||
@ -176,7 +176,7 @@ public class SysPostServiceImpl implements ISysPostService, PostService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean checkPostCodeUnique(SysPostBo post) {
|
public boolean checkPostCodeUnique(SysPostBo post) {
|
||||||
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysPost>()
|
boolean exist = sysPostMapper.exists(new LambdaQueryWrapper<SysPost>()
|
||||||
.eq(SysPost::getPostCode, post.getPostCode())
|
.eq(SysPost::getPostCode, post.getPostCode())
|
||||||
.ne(ObjectUtil.isNotNull(post.getPostId()), SysPost::getPostId, post.getPostId()));
|
.ne(ObjectUtil.isNotNull(post.getPostId()), SysPost::getPostId, post.getPostId()));
|
||||||
return !exist;
|
return !exist;
|
||||||
@ -190,7 +190,7 @@ public class SysPostServiceImpl implements ISysPostService, PostService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public long countUserPostById(Long postId) {
|
public long countUserPostById(Long postId) {
|
||||||
return userPostMapper.selectCount(new LambdaQueryWrapper<SysUserPost>().eq(SysUserPost::getPostId, postId));
|
return sysUserPostMapper.selectCount(new LambdaQueryWrapper<SysUserPost>().eq(SysUserPost::getPostId, postId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -201,7 +201,7 @@ public class SysPostServiceImpl implements ISysPostService, PostService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public long countPostByDeptId(Long deptId) {
|
public long countPostByDeptId(Long deptId) {
|
||||||
return baseMapper.selectCount(new LambdaQueryWrapper<SysPost>().eq(SysPost::getDeptId, deptId));
|
return sysPostMapper.selectCount(new LambdaQueryWrapper<SysPost>().eq(SysPost::getDeptId, deptId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -212,7 +212,7 @@ public class SysPostServiceImpl implements ISysPostService, PostService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deletePostById(Long postId) {
|
public int deletePostById(Long postId) {
|
||||||
return baseMapper.deleteById(postId);
|
return sysPostMapper.deleteById(postId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -223,13 +223,13 @@ public class SysPostServiceImpl implements ISysPostService, PostService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deletePostByIds(Collection<Long> postIds) {
|
public int deletePostByIds(Collection<Long> postIds) {
|
||||||
List<SysPost> list = baseMapper.selectByIds(postIds);
|
List<SysPost> list = sysPostMapper.selectByIds(postIds);
|
||||||
for (SysPost post : list) {
|
for (SysPost post : list) {
|
||||||
if (this.countUserPostById(post.getPostId()) > 0) {
|
if (this.countUserPostById(post.getPostId()) > 0) {
|
||||||
throw new ServiceException("{}已分配,不能删除!", post.getPostName());
|
throw new ServiceException("{}已分配,不能删除!", post.getPostName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return baseMapper.deleteByIds(postIds);
|
return sysPostMapper.deleteByIds(postIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -241,7 +241,7 @@ public class SysPostServiceImpl implements ISysPostService, PostService {
|
|||||||
@Override
|
@Override
|
||||||
public int insertPost(SysPostBo bo) {
|
public int insertPost(SysPostBo bo) {
|
||||||
SysPost post = MapstructUtils.convert(bo, SysPost.class);
|
SysPost post = MapstructUtils.convert(bo, SysPost.class);
|
||||||
return baseMapper.insert(post);
|
return sysPostMapper.insert(post);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -253,7 +253,7 @@ public class SysPostServiceImpl implements ISysPostService, PostService {
|
|||||||
@Override
|
@Override
|
||||||
public int updatePost(SysPostBo bo) {
|
public int updatePost(SysPostBo bo) {
|
||||||
SysPost post = MapstructUtils.convert(bo, SysPost.class);
|
SysPost post = MapstructUtils.convert(bo, SysPost.class);
|
||||||
return baseMapper.updateById(post);
|
return sysPostMapper.updateById(post);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -267,7 +267,7 @@ public class SysPostServiceImpl implements ISysPostService, PostService {
|
|||||||
if (CollUtil.isEmpty(postIds)) {
|
if (CollUtil.isEmpty(postIds)) {
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
}
|
}
|
||||||
List<SysPost> list = baseMapper.selectList(
|
List<SysPost> list = sysPostMapper.selectList(
|
||||||
new LambdaQueryWrapper<SysPost>()
|
new LambdaQueryWrapper<SysPost>()
|
||||||
.select(SysPost::getPostId, SysPost::getPostName)
|
.select(SysPost::getPostId, SysPost::getPostName)
|
||||||
.in(SysPost::getPostId, postIds)
|
.in(SysPost::getPostId, postIds)
|
||||||
|
|||||||
@ -48,10 +48,10 @@ import java.util.*;
|
|||||||
@Service
|
@Service
|
||||||
public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
||||||
|
|
||||||
private final SysRoleMapper baseMapper;
|
private final SysRoleMapper sysRoleMapper;
|
||||||
private final SysRoleMenuMapper roleMenuMapper;
|
private final SysRoleMenuMapper sysRoleMenuMapper;
|
||||||
private final SysUserRoleMapper userRoleMapper;
|
private final SysUserRoleMapper sysUserRoleMapper;
|
||||||
private final SysRoleDeptMapper roleDeptMapper;
|
private final SysRoleDeptMapper sysRoleDeptMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询角色列表
|
* 分页查询角色列表
|
||||||
@ -62,7 +62,7 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public PageResult<SysRoleVo> selectPageRoleList(SysRoleBo role, PageQuery pageQuery) {
|
public PageResult<SysRoleVo> selectPageRoleList(SysRoleBo role, PageQuery pageQuery) {
|
||||||
Page<SysRoleVo> page = baseMapper.selectPageRoleList(pageQuery.build(), this.buildQueryWrapper(role));
|
Page<SysRoleVo> page = sysRoleMapper.selectPageRoleList(pageQuery.build(), this.buildQueryWrapper(role));
|
||||||
return PageResult.build(page.getRecords(), page.getTotal());
|
return PageResult.build(page.getRecords(), page.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SysRoleVo> selectRoleList(SysRoleBo role) {
|
public List<SysRoleVo> selectRoleList(SysRoleBo role) {
|
||||||
return baseMapper.selectRoleList(this.buildQueryWrapper(role));
|
return sysRoleMapper.selectRoleList(this.buildQueryWrapper(role));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -104,7 +104,7 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SysRoleVo> selectRolesByUserId(Long userId) {
|
public List<SysRoleVo> selectRolesByUserId(Long userId) {
|
||||||
return baseMapper.selectRolesByUserId(userId);
|
return sysRoleMapper.selectRolesByUserId(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -115,7 +115,7 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SysRoleVo> selectRolesAuthByUserId(Long userId) {
|
public List<SysRoleVo> selectRolesAuthByUserId(Long userId) {
|
||||||
List<SysRoleVo> userRoles = baseMapper.selectRolesByUserId(userId);
|
List<SysRoleVo> userRoles = sysRoleMapper.selectRolesByUserId(userId);
|
||||||
List<SysRoleVo> roles = selectRoleAll();
|
List<SysRoleVo> roles = selectRoleAll();
|
||||||
// 使用HashSet提高查找效率
|
// 使用HashSet提高查找效率
|
||||||
Set<Long> userRoleIds = StreamUtils.toSet(userRoles, SysRoleVo::getRoleId);
|
Set<Long> userRoleIds = StreamUtils.toSet(userRoles, SysRoleVo::getRoleId);
|
||||||
@ -135,7 +135,7 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Set<String> selectRolePermissionByUserId(Long userId) {
|
public Set<String> selectRolePermissionByUserId(Long userId) {
|
||||||
List<SysRoleVo> perms = baseMapper.selectRolesByUserId(userId);
|
List<SysRoleVo> perms = sysRoleMapper.selectRolesByUserId(userId);
|
||||||
Set<String> permsSet = new HashSet<>();
|
Set<String> permsSet = new HashSet<>();
|
||||||
for (SysRoleVo perm : perms) {
|
for (SysRoleVo perm : perms) {
|
||||||
if (ObjectUtil.isNotNull(perm)) {
|
if (ObjectUtil.isNotNull(perm)) {
|
||||||
@ -163,7 +163,7 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<Long> selectRoleListByUserId(Long userId) {
|
public List<Long> selectRoleListByUserId(Long userId) {
|
||||||
List<SysRoleVo> list = baseMapper.selectRolesByUserId(userId);
|
List<SysRoleVo> list = sysRoleMapper.selectRolesByUserId(userId);
|
||||||
return StreamUtils.toList(list, SysRoleVo::getRoleId);
|
return StreamUtils.toList(list, SysRoleVo::getRoleId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,7 +175,7 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public SysRoleVo selectRoleById(Long roleId) {
|
public SysRoleVo selectRoleById(Long roleId) {
|
||||||
return baseMapper.selectRoleById(roleId);
|
return sysRoleMapper.selectRoleById(roleId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -186,7 +186,7 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SysRoleVo> selectRoleByIds(Collection<Long> roleIds) {
|
public List<SysRoleVo> selectRoleByIds(Collection<Long> roleIds) {
|
||||||
return baseMapper.selectRoleList(new LambdaQueryWrapper<SysRole>()
|
return sysRoleMapper.selectRoleList(new LambdaQueryWrapper<SysRole>()
|
||||||
.eq(SysRole::getStatus, SystemConstants.NORMAL)
|
.eq(SysRole::getStatus, SystemConstants.NORMAL)
|
||||||
.in(CollUtil.isNotEmpty(roleIds), SysRole::getRoleId, roleIds));
|
.in(CollUtil.isNotEmpty(roleIds), SysRole::getRoleId, roleIds));
|
||||||
}
|
}
|
||||||
@ -199,7 +199,7 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean checkRoleNameUnique(SysRoleBo role) {
|
public boolean checkRoleNameUnique(SysRoleBo role) {
|
||||||
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysRole>()
|
boolean exist = sysRoleMapper.exists(new LambdaQueryWrapper<SysRole>()
|
||||||
.eq(SysRole::getRoleName, role.getRoleName())
|
.eq(SysRole::getRoleName, role.getRoleName())
|
||||||
.ne(ObjectUtil.isNotNull(role.getRoleId()), SysRole::getRoleId, role.getRoleId()));
|
.ne(ObjectUtil.isNotNull(role.getRoleId()), SysRole::getRoleId, role.getRoleId()));
|
||||||
return !exist;
|
return !exist;
|
||||||
@ -213,7 +213,7 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean checkRoleKeyUnique(SysRoleBo role) {
|
public boolean checkRoleKeyUnique(SysRoleBo role) {
|
||||||
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysRole>()
|
boolean exist = sysRoleMapper.exists(new LambdaQueryWrapper<SysRole>()
|
||||||
.eq(SysRole::getRoleKey, role.getRoleKey())
|
.eq(SysRole::getRoleKey, role.getRoleKey())
|
||||||
.ne(ObjectUtil.isNotNull(role.getRoleId()), SysRole::getRoleId, role.getRoleId()));
|
.ne(ObjectUtil.isNotNull(role.getRoleId()), SysRole::getRoleId, role.getRoleId()));
|
||||||
return !exist;
|
return !exist;
|
||||||
@ -237,7 +237,7 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
|||||||
}
|
}
|
||||||
// 修改不允许修改 管理员标识符
|
// 修改不允许修改 管理员标识符
|
||||||
if (ObjectUtil.isNotNull(role.getRoleId())) {
|
if (ObjectUtil.isNotNull(role.getRoleId())) {
|
||||||
SysRole sysRole = baseMapper.selectById(role.getRoleId());
|
SysRole sysRole = sysRoleMapper.selectById(role.getRoleId());
|
||||||
// 如果标识符不相等 判断为修改了管理员标识符
|
// 如果标识符不相等 判断为修改了管理员标识符
|
||||||
if (!StringUtils.equals(sysRole.getRoleKey(), role.getRoleKey())) {
|
if (!StringUtils.equals(sysRole.getRoleKey(), role.getRoleKey())) {
|
||||||
if (StringUtils.equalsAny(sysRole.getRoleKey(), keys)) {
|
if (StringUtils.equalsAny(sysRole.getRoleKey(), keys)) {
|
||||||
@ -272,7 +272,7 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
|||||||
if (CollUtil.isEmpty(roleIds) || LoginHelper.isSuperAdmin()) {
|
if (CollUtil.isEmpty(roleIds) || LoginHelper.isSuperAdmin()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
long count = baseMapper.selectRoleCount(roleIds);
|
long count = sysRoleMapper.selectRoleCount(roleIds);
|
||||||
if (count != roleIds.size()) {
|
if (count != roleIds.size()) {
|
||||||
throw new ServiceException("没有权限访问部分角色数据!");
|
throw new ServiceException("没有权限访问部分角色数据!");
|
||||||
}
|
}
|
||||||
@ -286,7 +286,7 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public long countUserRoleByRoleId(Long roleId) {
|
public long countUserRoleByRoleId(Long roleId) {
|
||||||
return userRoleMapper.selectCount(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getRoleId, roleId));
|
return sysUserRoleMapper.selectCount(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getRoleId, roleId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -300,7 +300,7 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
|||||||
public int insertRole(SysRoleBo bo) {
|
public int insertRole(SysRoleBo bo) {
|
||||||
SysRole role = MapstructUtils.convert(bo, SysRole.class);
|
SysRole role = MapstructUtils.convert(bo, SysRole.class);
|
||||||
// 新增角色信息
|
// 新增角色信息
|
||||||
baseMapper.insert(role);
|
sysRoleMapper.insert(role);
|
||||||
bo.setRoleId(role.getRoleId());
|
bo.setRoleId(role.getRoleId());
|
||||||
return insertRoleMenu(bo);
|
return insertRoleMenu(bo);
|
||||||
}
|
}
|
||||||
@ -320,7 +320,7 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
|||||||
throw new ServiceException("角色已分配,不能禁用!");
|
throw new ServiceException("角色已分配,不能禁用!");
|
||||||
}
|
}
|
||||||
// 仅更新角色基础字段,避免影响权限分配。
|
// 仅更新角色基础字段,避免影响权限分配。
|
||||||
return baseMapper.updateById(role);
|
return sysRoleMapper.updateById(role);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -335,12 +335,12 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
|||||||
public int updateRolePermission(SysRoleBo bo) {
|
public int updateRolePermission(SysRoleBo bo) {
|
||||||
SysRole role = MapstructUtils.convert(bo, SysRole.class);
|
SysRole role = MapstructUtils.convert(bo, SysRole.class);
|
||||||
// 更新权限相关配置字段(数据范围、树联动)。
|
// 更新权限相关配置字段(数据范围、树联动)。
|
||||||
baseMapper.updateById(role);
|
sysRoleMapper.updateById(role);
|
||||||
// 先清理旧菜单权限,再重建。
|
// 先清理旧菜单权限,再重建。
|
||||||
roleMenuMapper.delete(new LambdaQueryWrapper<SysRoleMenu>().eq(SysRoleMenu::getRoleId, role.getRoleId()));
|
sysRoleMenuMapper.delete(new LambdaQueryWrapper<SysRoleMenu>().eq(SysRoleMenu::getRoleId, role.getRoleId()));
|
||||||
insertRoleMenu(bo);
|
insertRoleMenu(bo);
|
||||||
// 先清理旧数据权限,再按当前配置重建。
|
// 先清理旧数据权限,再按当前配置重建。
|
||||||
roleDeptMapper.delete(new LambdaQueryWrapper<SysRoleDept>().eq(SysRoleDept::getRoleId, role.getRoleId()));
|
sysRoleDeptMapper.delete(new LambdaQueryWrapper<SysRoleDept>().eq(SysRoleDept::getRoleId, role.getRoleId()));
|
||||||
return insertRoleDept(bo);
|
return insertRoleDept(bo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -356,7 +356,7 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
|||||||
if (SystemConstants.DISABLE.equals(status) && this.countUserRoleByRoleId(roleId) > 0) {
|
if (SystemConstants.DISABLE.equals(status) && this.countUserRoleByRoleId(roleId) > 0) {
|
||||||
throw new ServiceException("角色已分配,不能禁用!");
|
throw new ServiceException("角色已分配,不能禁用!");
|
||||||
}
|
}
|
||||||
return baseMapper.update(null,
|
return sysRoleMapper.update(null,
|
||||||
new LambdaUpdateWrapper<SysRole>()
|
new LambdaUpdateWrapper<SysRole>()
|
||||||
.set(SysRole::getStatus, status)
|
.set(SysRole::getStatus, status)
|
||||||
.eq(SysRole::getRoleId, roleId));
|
.eq(SysRole::getRoleId, roleId));
|
||||||
@ -380,7 +380,7 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
|||||||
list.add(rm);
|
list.add(rm);
|
||||||
}
|
}
|
||||||
if (CollUtil.isNotEmpty(list)) {
|
if (CollUtil.isNotEmpty(list)) {
|
||||||
rows = roleMenuMapper.insertBatch(list) ? list.size() : 0;
|
rows = sysRoleMenuMapper.insertBatch(list) ? list.size() : 0;
|
||||||
}
|
}
|
||||||
return rows;
|
return rows;
|
||||||
}
|
}
|
||||||
@ -401,7 +401,7 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
|||||||
list.add(rd);
|
list.add(rd);
|
||||||
}
|
}
|
||||||
if (CollUtil.isNotEmpty(list)) {
|
if (CollUtil.isNotEmpty(list)) {
|
||||||
rows = roleDeptMapper.insertBatch(list) ? list.size() : 0;
|
rows = sysRoleDeptMapper.insertBatch(list) ? list.size() : 0;
|
||||||
}
|
}
|
||||||
return rows;
|
return rows;
|
||||||
}
|
}
|
||||||
@ -417,10 +417,10 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int deleteRoleById(Long roleId) {
|
public int deleteRoleById(Long roleId) {
|
||||||
// 删除角色与菜单关联
|
// 删除角色与菜单关联
|
||||||
roleMenuMapper.delete(new LambdaQueryWrapper<SysRoleMenu>().eq(SysRoleMenu::getRoleId, roleId));
|
sysRoleMenuMapper.delete(new LambdaQueryWrapper<SysRoleMenu>().eq(SysRoleMenu::getRoleId, roleId));
|
||||||
// 删除角色与部门关联
|
// 删除角色与部门关联
|
||||||
roleDeptMapper.delete(new LambdaQueryWrapper<SysRoleDept>().eq(SysRoleDept::getRoleId, roleId));
|
sysRoleDeptMapper.delete(new LambdaQueryWrapper<SysRoleDept>().eq(SysRoleDept::getRoleId, roleId));
|
||||||
return baseMapper.deleteById(roleId);
|
return sysRoleMapper.deleteById(roleId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -434,7 +434,7 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int deleteRoleByIds(Collection<Long> roleIds) {
|
public int deleteRoleByIds(Collection<Long> roleIds) {
|
||||||
this.checkRoleDataScope(roleIds);
|
this.checkRoleDataScope(roleIds);
|
||||||
List<SysRole> roles = baseMapper.selectByIds(roleIds);
|
List<SysRole> roles = sysRoleMapper.selectByIds(roleIds);
|
||||||
for (SysRole role : roles) {
|
for (SysRole role : roles) {
|
||||||
checkRoleAllowed(BeanUtil.toBean(role, SysRoleBo.class));
|
checkRoleAllowed(BeanUtil.toBean(role, SysRoleBo.class));
|
||||||
if (countUserRoleByRoleId(role.getRoleId()) > 0) {
|
if (countUserRoleByRoleId(role.getRoleId()) > 0) {
|
||||||
@ -442,10 +442,10 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 删除角色与菜单关联
|
// 删除角色与菜单关联
|
||||||
roleMenuMapper.delete(new LambdaQueryWrapper<SysRoleMenu>().in(SysRoleMenu::getRoleId, roleIds));
|
sysRoleMenuMapper.delete(new LambdaQueryWrapper<SysRoleMenu>().in(SysRoleMenu::getRoleId, roleIds));
|
||||||
// 删除角色与部门关联
|
// 删除角色与部门关联
|
||||||
roleDeptMapper.delete(new LambdaQueryWrapper<SysRoleDept>().in(SysRoleDept::getRoleId, roleIds));
|
sysRoleDeptMapper.delete(new LambdaQueryWrapper<SysRoleDept>().in(SysRoleDept::getRoleId, roleIds));
|
||||||
return baseMapper.deleteByIds(roleIds);
|
return sysRoleMapper.deleteByIds(roleIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -459,7 +459,7 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
|||||||
if (LoginHelper.getUserId().equals(userRole.getUserId())) {
|
if (LoginHelper.getUserId().equals(userRole.getUserId())) {
|
||||||
throw new ServiceException("不允许修改当前用户角色!");
|
throw new ServiceException("不允许修改当前用户角色!");
|
||||||
}
|
}
|
||||||
int rows = userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>()
|
int rows = sysUserRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>()
|
||||||
.eq(SysUserRole::getRoleId, userRole.getRoleId())
|
.eq(SysUserRole::getRoleId, userRole.getRoleId())
|
||||||
.eq(SysUserRole::getUserId, userRole.getUserId()));
|
.eq(SysUserRole::getUserId, userRole.getUserId()));
|
||||||
if (rows > 0) {
|
if (rows > 0) {
|
||||||
@ -480,7 +480,7 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
|||||||
if (userIds.contains(LoginHelper.getUserId())) {
|
if (userIds.contains(LoginHelper.getUserId())) {
|
||||||
throw new ServiceException("不允许修改当前用户角色!");
|
throw new ServiceException("不允许修改当前用户角色!");
|
||||||
}
|
}
|
||||||
int rows = userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>()
|
int rows = sysUserRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>()
|
||||||
.eq(SysUserRole::getRoleId, roleId)
|
.eq(SysUserRole::getRoleId, roleId)
|
||||||
.in(SysUserRole::getUserId, userIds));
|
.in(SysUserRole::getUserId, userIds));
|
||||||
if (rows > 0) {
|
if (rows > 0) {
|
||||||
@ -510,7 +510,7 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
|||||||
return ur;
|
return ur;
|
||||||
});
|
});
|
||||||
if (CollUtil.isNotEmpty(list)) {
|
if (CollUtil.isNotEmpty(list)) {
|
||||||
rows = userRoleMapper.insertBatch(list) ? list.size() : 0;
|
rows = sysUserRoleMapper.insertBatch(list) ? list.size() : 0;
|
||||||
}
|
}
|
||||||
if (rows > 0) {
|
if (rows > 0) {
|
||||||
cleanOnlineUser(userIds);
|
cleanOnlineUser(userIds);
|
||||||
@ -532,7 +532,7 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
|||||||
@Override
|
@Override
|
||||||
public void cleanOnlineUserByRole(Long roleId) {
|
public void cleanOnlineUserByRole(Long roleId) {
|
||||||
// 如果角色未绑定用户 直接返回
|
// 如果角色未绑定用户 直接返回
|
||||||
Long num = userRoleMapper.selectCount(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getRoleId, roleId));
|
Long num = sysUserRoleMapper.selectCount(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getRoleId, roleId));
|
||||||
if (num == 0) {
|
if (num == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -607,7 +607,7 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
|||||||
if (CollUtil.isEmpty(roleIds)) {
|
if (CollUtil.isEmpty(roleIds)) {
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
}
|
}
|
||||||
List<SysRole> list = baseMapper.selectList(
|
List<SysRole> list = sysRoleMapper.selectList(
|
||||||
new LambdaQueryWrapper<SysRole>()
|
new LambdaQueryWrapper<SysRole>()
|
||||||
.select(SysRole::getRoleId, SysRole::getRoleName)
|
.select(SysRole::getRoleId, SysRole::getRoleName)
|
||||||
.in(SysRole::getRoleId, roleIds)
|
.in(SysRole::getRoleId, roleIds)
|
||||||
|
|||||||
@ -24,7 +24,7 @@ import java.util.List;
|
|||||||
@Service
|
@Service
|
||||||
public class SysSocialServiceImpl implements ISysSocialService {
|
public class SysSocialServiceImpl implements ISysSocialService {
|
||||||
|
|
||||||
private final SysSocialMapper baseMapper;
|
private final SysSocialMapper sysSocialMapper;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -35,7 +35,7 @@ public class SysSocialServiceImpl implements ISysSocialService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public SysSocialVo queryById(String id) {
|
public SysSocialVo queryById(String id) {
|
||||||
return baseMapper.selectVoById(id);
|
return sysSocialMapper.selectVoById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -50,7 +50,7 @@ public class SysSocialServiceImpl implements ISysSocialService {
|
|||||||
.eq(ObjectUtil.isNotNull(bo.getUserId()), SysSocial::getUserId, bo.getUserId())
|
.eq(ObjectUtil.isNotNull(bo.getUserId()), SysSocial::getUserId, bo.getUserId())
|
||||||
.eq(StringUtils.isNotBlank(bo.getAuthId()), SysSocial::getAuthId, bo.getAuthId())
|
.eq(StringUtils.isNotBlank(bo.getAuthId()), SysSocial::getAuthId, bo.getAuthId())
|
||||||
.eq(StringUtils.isNotBlank(bo.getSource()), SysSocial::getSource, bo.getSource());
|
.eq(StringUtils.isNotBlank(bo.getSource()), SysSocial::getSource, bo.getSource());
|
||||||
return baseMapper.selectVoList(lqw);
|
return sysSocialMapper.selectVoList(lqw);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -61,7 +61,7 @@ public class SysSocialServiceImpl implements ISysSocialService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SysSocialVo> queryListByUserId(Long userId) {
|
public List<SysSocialVo> queryListByUserId(Long userId) {
|
||||||
return baseMapper.selectVoList(new LambdaQueryWrapper<SysSocial>().eq(SysSocial::getUserId, userId));
|
return sysSocialMapper.selectVoList(new LambdaQueryWrapper<SysSocial>().eq(SysSocial::getUserId, userId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ public class SysSocialServiceImpl implements ISysSocialService {
|
|||||||
public Boolean insertByBo(SysSocialBo bo) {
|
public Boolean insertByBo(SysSocialBo bo) {
|
||||||
SysSocial add = MapstructUtils.convert(bo, SysSocial.class);
|
SysSocial add = MapstructUtils.convert(bo, SysSocial.class);
|
||||||
validEntityBeforeSave(add);
|
validEntityBeforeSave(add);
|
||||||
boolean flag = baseMapper.insert(add) > 0;
|
boolean flag = sysSocialMapper.insert(add) > 0;
|
||||||
if (flag) {
|
if (flag) {
|
||||||
if (add != null) {
|
if (add != null) {
|
||||||
bo.setId(add.getId());
|
bo.setId(add.getId());
|
||||||
@ -96,7 +96,7 @@ public class SysSocialServiceImpl implements ISysSocialService {
|
|||||||
public Boolean updateByBo(SysSocialBo bo) {
|
public Boolean updateByBo(SysSocialBo bo) {
|
||||||
SysSocial update = MapstructUtils.convert(bo, SysSocial.class);
|
SysSocial update = MapstructUtils.convert(bo, SysSocial.class);
|
||||||
validEntityBeforeSave(update);
|
validEntityBeforeSave(update);
|
||||||
return baseMapper.updateById(update) > 0;
|
return sysSocialMapper.updateById(update) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -117,7 +117,7 @@ public class SysSocialServiceImpl implements ISysSocialService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Boolean deleteWithValidById(Long id) {
|
public Boolean deleteWithValidById(Long id) {
|
||||||
return baseMapper.deleteById(id) > 0;
|
return sysSocialMapper.deleteById(id) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -129,7 +129,7 @@ public class SysSocialServiceImpl implements ISysSocialService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SysSocialVo> selectByAuthId(String authId) {
|
public List<SysSocialVo> selectByAuthId(String authId) {
|
||||||
return baseMapper.selectVoList(new LambdaQueryWrapper<SysSocial>().eq(SysSocial::getAuthId, authId));
|
return sysSocialMapper.selectVoList(new LambdaQueryWrapper<SysSocial>().eq(SysSocial::getAuthId, authId));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,12 +48,12 @@ import java.util.*;
|
|||||||
@Service
|
@Service
|
||||||
public class SysUserServiceImpl implements ISysUserService, UserService {
|
public class SysUserServiceImpl implements ISysUserService, UserService {
|
||||||
|
|
||||||
private final SysUserMapper baseMapper;
|
private final SysUserMapper sysUserMapper;
|
||||||
private final SysDeptMapper deptMapper;
|
private final SysDeptMapper sysDeptMapper;
|
||||||
private final SysRoleMapper roleMapper;
|
private final SysRoleMapper sysRoleMapper;
|
||||||
private final SysPostMapper postMapper;
|
private final SysPostMapper sysPostMapper;
|
||||||
private final SysUserRoleMapper userRoleMapper;
|
private final SysUserRoleMapper sysUserRoleMapper;
|
||||||
private final SysUserPostMapper userPostMapper;
|
private final SysUserPostMapper sysUserPostMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询用户列表。
|
* 分页查询用户列表。
|
||||||
@ -64,7 +64,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public PageResult<SysUserVo> selectPageUserList(SysUserBo user, PageQuery pageQuery) {
|
public PageResult<SysUserVo> selectPageUserList(SysUserBo user, PageQuery pageQuery) {
|
||||||
Page<SysUserVo> page = baseMapper.selectPageUserList(pageQuery.build(), this.buildQueryWrapper(user));
|
Page<SysUserVo> page = sysUserMapper.selectPageUserList(pageQuery.build(), this.buildQueryWrapper(user));
|
||||||
return PageResult.build(page.getRecords(), page.getTotal());
|
return PageResult.build(page.getRecords(), page.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,8 +76,8 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SysUserExportVo> selectUserExportList(SysUserBo user) {
|
public List<SysUserExportVo> selectUserExportList(SysUserBo user) {
|
||||||
List<Long> deptIds = ObjectUtil.isNotNull(user.getDeptId()) ? deptMapper.selectDeptAndChildById(user.getDeptId()) : null;
|
List<Long> deptIds = ObjectUtil.isNotNull(user.getDeptId()) ? sysDeptMapper.selectDeptAndChildById(user.getDeptId()) : null;
|
||||||
return baseMapper.selectUserExportList(user, deptIds);
|
return sysUserMapper.selectUserExportList(user, deptIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -99,7 +99,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
.between(params.get("beginTime") != null && params.get("endTime") != null,
|
.between(params.get("beginTime") != null && params.get("endTime") != null,
|
||||||
SysUser::getCreateTime, params.get("beginTime"), params.get("endTime"))
|
SysUser::getCreateTime, params.get("beginTime"), params.get("endTime"))
|
||||||
.and(ObjectUtil.isNotNull(user.getDeptId()), w -> {
|
.and(ObjectUtil.isNotNull(user.getDeptId()), w -> {
|
||||||
List<Long> ids = deptMapper.selectDeptAndChildById(user.getDeptId());
|
List<Long> ids = sysDeptMapper.selectDeptAndChildById(user.getDeptId());
|
||||||
w.in(SysUser::getDeptId, ids);
|
w.in(SysUser::getDeptId, ids);
|
||||||
}).orderByAsc(SysUser::getUserId);
|
}).orderByAsc(SysUser::getUserId);
|
||||||
if (StringUtils.isNotBlank(user.getExcludeUserIds())) {
|
if (StringUtils.isNotBlank(user.getExcludeUserIds())) {
|
||||||
@ -116,7 +116,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public PageResult<SysUserVo> selectAllocatedList(SysUserBo user, PageQuery pageQuery) {
|
public PageResult<SysUserVo> selectAllocatedList(SysUserBo user, PageQuery pageQuery) {
|
||||||
Page<SysUserVo> page = baseMapper.selectAllocatedList(pageQuery.build(), user);
|
Page<SysUserVo> page = sysUserMapper.selectAllocatedList(pageQuery.build(), user);
|
||||||
return PageResult.build(page.getRecords(), page.getTotal());
|
return PageResult.build(page.getRecords(), page.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,8 +128,8 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public PageResult<SysUserVo> selectUnallocatedList(SysUserBo user, PageQuery pageQuery) {
|
public PageResult<SysUserVo> selectUnallocatedList(SysUserBo user, PageQuery pageQuery) {
|
||||||
List<Long> userIds = userRoleMapper.selectUserIdsByRoleId(user.getRoleId());
|
List<Long> userIds = sysUserRoleMapper.selectUserIdsByRoleId(user.getRoleId());
|
||||||
Page<SysUserVo> page = baseMapper.selectUnallocatedList(pageQuery.build(), user, userIds);
|
Page<SysUserVo> page = sysUserMapper.selectUnallocatedList(pageQuery.build(), user, userIds);
|
||||||
return PageResult.build(page.getRecords(), page.getTotal());
|
return PageResult.build(page.getRecords(), page.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public SysUserVo selectUserByUserName(String userName) {
|
public SysUserVo selectUserByUserName(String userName) {
|
||||||
return baseMapper.selectVoOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUserName, userName));
|
return sysUserMapper.selectVoOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUserName, userName));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -152,7 +152,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public SysUserVo selectUserByPhoneNumber(String phoneNumber) {
|
public SysUserVo selectUserByPhoneNumber(String phoneNumber) {
|
||||||
return baseMapper.selectVoOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getPhoneNumber, phoneNumber));
|
return sysUserMapper.selectVoOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getPhoneNumber, phoneNumber));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -163,11 +163,11 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public SysUserVo selectUserById(Long userId) {
|
public SysUserVo selectUserById(Long userId) {
|
||||||
SysUserVo user = baseMapper.selectVoById(userId);
|
SysUserVo user = sysUserMapper.selectVoById(userId);
|
||||||
if (ObjectUtil.isNull(user)) {
|
if (ObjectUtil.isNull(user)) {
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
user.setRoles(roleMapper.selectRolesByUserId(user.getUserId()));
|
user.setRoles(sysRoleMapper.selectRolesByUserId(user.getUserId()));
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,7 +180,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SysUserVo> selectUserByIds(Collection<Long> userIds, Long deptId) {
|
public List<SysUserVo> selectUserByIds(Collection<Long> userIds, Long deptId) {
|
||||||
return baseMapper.selectUserList(new LambdaQueryWrapper<SysUser>()
|
return sysUserMapper.selectUserList(new LambdaQueryWrapper<SysUser>()
|
||||||
.select(SysUser::getUserId, SysUser::getUserName, SysUser::getNickName)
|
.select(SysUser::getUserId, SysUser::getUserName, SysUser::getNickName)
|
||||||
.eq(SysUser::getStatus, SystemConstants.NORMAL)
|
.eq(SysUser::getStatus, SystemConstants.NORMAL)
|
||||||
.eq(ObjectUtil.isNotNull(deptId), SysUser::getDeptId, deptId)
|
.eq(ObjectUtil.isNotNull(deptId), SysUser::getDeptId, deptId)
|
||||||
@ -195,7 +195,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String selectUserRoleGroup(Long userId) {
|
public String selectUserRoleGroup(Long userId) {
|
||||||
List<SysRoleVo> list = roleMapper.selectRolesByUserId(userId);
|
List<SysRoleVo> list = sysRoleMapper.selectRolesByUserId(userId);
|
||||||
if (CollUtil.isEmpty(list)) {
|
if (CollUtil.isEmpty(list)) {
|
||||||
return StringUtils.EMPTY;
|
return StringUtils.EMPTY;
|
||||||
}
|
}
|
||||||
@ -210,7 +210,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String selectUserPostGroup(Long userId) {
|
public String selectUserPostGroup(Long userId) {
|
||||||
List<SysPostVo> list = postMapper.selectPostsByUserId(userId);
|
List<SysPostVo> list = sysPostMapper.selectPostsByUserId(userId);
|
||||||
if (CollUtil.isEmpty(list)) {
|
if (CollUtil.isEmpty(list)) {
|
||||||
return StringUtils.EMPTY;
|
return StringUtils.EMPTY;
|
||||||
}
|
}
|
||||||
@ -225,7 +225,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean checkUserNameUnique(SysUserBo user) {
|
public boolean checkUserNameUnique(SysUserBo user) {
|
||||||
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysUser>()
|
boolean exist = sysUserMapper.exists(new LambdaQueryWrapper<SysUser>()
|
||||||
.eq(SysUser::getUserName, user.getUserName())
|
.eq(SysUser::getUserName, user.getUserName())
|
||||||
.ne(ObjectUtil.isNotNull(user.getUserId()), SysUser::getUserId, user.getUserId()));
|
.ne(ObjectUtil.isNotNull(user.getUserId()), SysUser::getUserId, user.getUserId()));
|
||||||
return !exist;
|
return !exist;
|
||||||
@ -238,7 +238,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean checkPhoneUnique(SysUserBo user) {
|
public boolean checkPhoneUnique(SysUserBo user) {
|
||||||
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysUser>()
|
boolean exist = sysUserMapper.exists(new LambdaQueryWrapper<SysUser>()
|
||||||
.eq(SysUser::getPhoneNumber, user.getPhoneNumber())
|
.eq(SysUser::getPhoneNumber, user.getPhoneNumber())
|
||||||
.ne(ObjectUtil.isNotNull(user.getUserId()), SysUser::getUserId, user.getUserId()));
|
.ne(ObjectUtil.isNotNull(user.getUserId()), SysUser::getUserId, user.getUserId()));
|
||||||
return !exist;
|
return !exist;
|
||||||
@ -251,7 +251,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean checkEmailUnique(SysUserBo user) {
|
public boolean checkEmailUnique(SysUserBo user) {
|
||||||
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysUser>()
|
boolean exist = sysUserMapper.exists(new LambdaQueryWrapper<SysUser>()
|
||||||
.eq(SysUser::getEmail, user.getEmail())
|
.eq(SysUser::getEmail, user.getEmail())
|
||||||
.ne(ObjectUtil.isNotNull(user.getUserId()), SysUser::getUserId, user.getUserId()));
|
.ne(ObjectUtil.isNotNull(user.getUserId()), SysUser::getUserId, user.getUserId()));
|
||||||
return !exist;
|
return !exist;
|
||||||
@ -282,7 +282,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
if (LoginHelper.isSuperAdmin()) {
|
if (LoginHelper.isSuperAdmin()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (baseMapper.countUserById(userId) == 0) {
|
if (sysUserMapper.countUserById(userId) == 0) {
|
||||||
throw new ServiceException("没有权限访问用户数据!");
|
throw new ServiceException("没有权限访问用户数据!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -298,7 +298,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
public int insertUser(SysUserBo user) {
|
public int insertUser(SysUserBo user) {
|
||||||
SysUser sysUser = MapstructUtils.convert(user, SysUser.class);
|
SysUser sysUser = MapstructUtils.convert(user, SysUser.class);
|
||||||
// 新增用户信息
|
// 新增用户信息
|
||||||
int rows = baseMapper.insert(sysUser);
|
int rows = sysUserMapper.insert(sysUser);
|
||||||
user.setUserId(sysUser.getUserId());
|
user.setUserId(sysUser.getUserId());
|
||||||
// 新增用户岗位关联
|
// 新增用户岗位关联
|
||||||
insertUserPost(user, false);
|
insertUserPost(user, false);
|
||||||
@ -318,7 +318,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
user.setCreateBy(0L);
|
user.setCreateBy(0L);
|
||||||
user.setUpdateBy(0L);
|
user.setUpdateBy(0L);
|
||||||
SysUser sysUser = MapstructUtils.convert(user, SysUser.class);
|
SysUser sysUser = MapstructUtils.convert(user, SysUser.class);
|
||||||
return baseMapper.insert(sysUser) > 0;
|
return sysUserMapper.insert(sysUser) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -337,7 +337,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
insertUserPost(user, true);
|
insertUserPost(user, true);
|
||||||
SysUser sysUser = MapstructUtils.convert(user, SysUser.class);
|
SysUser sysUser = MapstructUtils.convert(user, SysUser.class);
|
||||||
// 防止错误更新后导致的数据误删除
|
// 防止错误更新后导致的数据误删除
|
||||||
int flag = baseMapper.updateById(sysUser);
|
int flag = sysUserMapper.updateById(sysUser);
|
||||||
if (flag < 1) {
|
if (flag < 1) {
|
||||||
throw new ServiceException("修改用户{}信息失败", user.getUserName());
|
throw new ServiceException("修改用户{}信息失败", user.getUserName());
|
||||||
}
|
}
|
||||||
@ -365,7 +365,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int updateUserStatus(Long userId, String status) {
|
public int updateUserStatus(Long userId, String status) {
|
||||||
return baseMapper.update(null,
|
return sysUserMapper.update(null,
|
||||||
new LambdaUpdateWrapper<SysUser>()
|
new LambdaUpdateWrapper<SysUser>()
|
||||||
.set(SysUser::getStatus, status)
|
.set(SysUser::getStatus, status)
|
||||||
.eq(SysUser::getUserId, userId));
|
.eq(SysUser::getUserId, userId));
|
||||||
@ -380,7 +380,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
@CacheEvict(cacheNames = CacheNames.SYS_NICKNAME, key = "#user.userId")
|
@CacheEvict(cacheNames = CacheNames.SYS_NICKNAME, key = "#user.userId")
|
||||||
@Override
|
@Override
|
||||||
public int updateUserProfile(SysUserBo user) {
|
public int updateUserProfile(SysUserBo user) {
|
||||||
return baseMapper.update(null,
|
return sysUserMapper.update(null,
|
||||||
new LambdaUpdateWrapper<SysUser>()
|
new LambdaUpdateWrapper<SysUser>()
|
||||||
.set(ObjectUtil.isNotNull(user.getNickName()), SysUser::getNickName, user.getNickName())
|
.set(ObjectUtil.isNotNull(user.getNickName()), SysUser::getNickName, user.getNickName())
|
||||||
.set(SysUser::getPhoneNumber, user.getPhoneNumber())
|
.set(SysUser::getPhoneNumber, user.getPhoneNumber())
|
||||||
@ -398,7 +398,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean updateUserAvatar(Long userId, Long avatar) {
|
public boolean updateUserAvatar(Long userId, Long avatar) {
|
||||||
return baseMapper.update(null,
|
return sysUserMapper.update(null,
|
||||||
new LambdaUpdateWrapper<SysUser>()
|
new LambdaUpdateWrapper<SysUser>()
|
||||||
.set(SysUser::getAvatar, avatar)
|
.set(SysUser::getAvatar, avatar)
|
||||||
.eq(SysUser::getUserId, userId)) > 0;
|
.eq(SysUser::getUserId, userId)) > 0;
|
||||||
@ -413,7 +413,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int resetUserPwd(Long userId, String password) {
|
public int resetUserPwd(Long userId, String password) {
|
||||||
return baseMapper.update(null,
|
return sysUserMapper.update(null,
|
||||||
new LambdaUpdateWrapper<SysUser>()
|
new LambdaUpdateWrapper<SysUser>()
|
||||||
.set(SysUser::getPassword, password)
|
.set(SysUser::getPassword, password)
|
||||||
.eq(SysUser::getUserId, userId));
|
.eq(SysUser::getUserId, userId));
|
||||||
@ -443,13 +443,13 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
List<Long> postIds = Arrays.asList(postIdArr);
|
List<Long> postIds = Arrays.asList(postIdArr);
|
||||||
|
|
||||||
// 校验是否有权限操作这些岗位(含数据权限控制)
|
// 校验是否有权限操作这些岗位(含数据权限控制)
|
||||||
if (postMapper.selectPostCount(postIds) != postIds.size()) {
|
if (sysPostMapper.selectPostCount(postIds) != postIds.size()) {
|
||||||
throw new ServiceException("没有权限访问岗位的数据");
|
throw new ServiceException("没有权限访问岗位的数据");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 是否清除旧的用户岗位绑定
|
// 是否清除旧的用户岗位绑定
|
||||||
if (clear) {
|
if (clear) {
|
||||||
userPostMapper.delete(new LambdaQueryWrapper<SysUserPost>().eq(SysUserPost::getUserId, user.getUserId()));
|
sysUserPostMapper.delete(new LambdaQueryWrapper<SysUserPost>().eq(SysUserPost::getUserId, user.getUserId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 构建用户岗位关联列表并批量插入
|
// 构建用户岗位关联列表并批量插入
|
||||||
@ -460,7 +460,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
up.setPostId(postId);
|
up.setPostId(postId);
|
||||||
return up;
|
return up;
|
||||||
});
|
});
|
||||||
userPostMapper.insertBatch(list);
|
sysUserPostMapper.insertBatch(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -488,13 +488,13 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 校验是否有权限访问这些角色(含数据权限控制)
|
// 校验是否有权限访问这些角色(含数据权限控制)
|
||||||
if (roleMapper.selectRoleCount(roleList) != roleList.size()) {
|
if (sysRoleMapper.selectRoleCount(roleList) != roleList.size()) {
|
||||||
throw new ServiceException("没有权限访问角色的数据");
|
throw new ServiceException("没有权限访问角色的数据");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 是否清除原有绑定
|
// 是否清除原有绑定
|
||||||
if (clear) {
|
if (clear) {
|
||||||
userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId, userId));
|
sysUserRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId, userId));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 批量插入用户-角色关联
|
// 批量插入用户-角色关联
|
||||||
@ -505,7 +505,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
ur.setRoleId(roleId);
|
ur.setRoleId(roleId);
|
||||||
return ur;
|
return ur;
|
||||||
});
|
});
|
||||||
userRoleMapper.insertBatch(list);
|
sysUserRoleMapper.insertBatch(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -518,11 +518,11 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int deleteUserById(Long userId) {
|
public int deleteUserById(Long userId) {
|
||||||
// 删除用户与角色关联
|
// 删除用户与角色关联
|
||||||
userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId, userId));
|
sysUserRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId, userId));
|
||||||
// 删除用户与岗位表
|
// 删除用户与岗位表
|
||||||
userPostMapper.delete(new LambdaQueryWrapper<SysUserPost>().eq(SysUserPost::getUserId, userId));
|
sysUserPostMapper.delete(new LambdaQueryWrapper<SysUserPost>().eq(SysUserPost::getUserId, userId));
|
||||||
// 防止更新失败导致的数据删除
|
// 防止更新失败导致的数据删除
|
||||||
int flag = baseMapper.deleteById(userId);
|
int flag = sysUserMapper.deleteById(userId);
|
||||||
if (flag < 1) {
|
if (flag < 1) {
|
||||||
throw new ServiceException("删除用户失败!");
|
throw new ServiceException("删除用户失败!");
|
||||||
}
|
}
|
||||||
@ -544,11 +544,11 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
}
|
}
|
||||||
List<Long> ids = List.of(userIds);
|
List<Long> ids = List.of(userIds);
|
||||||
// 删除用户与角色关联
|
// 删除用户与角色关联
|
||||||
userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>().in(SysUserRole::getUserId, ids));
|
sysUserRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>().in(SysUserRole::getUserId, ids));
|
||||||
// 删除用户与岗位表
|
// 删除用户与岗位表
|
||||||
userPostMapper.delete(new LambdaQueryWrapper<SysUserPost>().in(SysUserPost::getUserId, ids));
|
sysUserPostMapper.delete(new LambdaQueryWrapper<SysUserPost>().in(SysUserPost::getUserId, ids));
|
||||||
// 防止更新失败导致的数据删除
|
// 防止更新失败导致的数据删除
|
||||||
int flag = baseMapper.deleteByIds(ids);
|
int flag = sysUserMapper.deleteByIds(ids);
|
||||||
if (flag < 1) {
|
if (flag < 1) {
|
||||||
throw new ServiceException("删除用户失败!");
|
throw new ServiceException("删除用户失败!");
|
||||||
}
|
}
|
||||||
@ -566,7 +566,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
LambdaQueryWrapper<SysUser> lqw = Wrappers.lambdaQuery();
|
LambdaQueryWrapper<SysUser> lqw = Wrappers.lambdaQuery();
|
||||||
lqw.eq(SysUser::getDeptId, deptId);
|
lqw.eq(SysUser::getDeptId, deptId);
|
||||||
lqw.orderByAsc(SysUser::getUserId);
|
lqw.orderByAsc(SysUser::getUserId);
|
||||||
return baseMapper.selectVoList(lqw);
|
return sysUserMapper.selectVoList(lqw);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -578,7 +578,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
@Cacheable(cacheNames = CacheNames.SYS_USER_NAME, key = "#userId")
|
@Cacheable(cacheNames = CacheNames.SYS_USER_NAME, key = "#userId")
|
||||||
@Override
|
@Override
|
||||||
public String selectUserNameById(Long userId) {
|
public String selectUserNameById(Long userId) {
|
||||||
SysUser sysUser = baseMapper.selectOne(new LambdaQueryWrapper<SysUser>()
|
SysUser sysUser = sysUserMapper.selectOne(new LambdaQueryWrapper<SysUser>()
|
||||||
.select(SysUser::getUserName).eq(SysUser::getUserId, userId));
|
.select(SysUser::getUserName).eq(SysUser::getUserId, userId));
|
||||||
return ObjectUtils.notNullGetter(sysUser, SysUser::getUserName);
|
return ObjectUtils.notNullGetter(sysUser, SysUser::getUserName);
|
||||||
}
|
}
|
||||||
@ -592,7 +592,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
@Override
|
@Override
|
||||||
@Cacheable(cacheNames = CacheNames.SYS_NICKNAME, key = "#userId")
|
@Cacheable(cacheNames = CacheNames.SYS_NICKNAME, key = "#userId")
|
||||||
public String selectNicknameById(Long userId) {
|
public String selectNicknameById(Long userId) {
|
||||||
SysUser sysUser = baseMapper.selectOne(new LambdaQueryWrapper<SysUser>()
|
SysUser sysUser = sysUserMapper.selectOne(new LambdaQueryWrapper<SysUser>()
|
||||||
.select(SysUser::getNickName).eq(SysUser::getUserId, userId));
|
.select(SysUser::getNickName).eq(SysUser::getUserId, userId));
|
||||||
return ObjectUtils.notNullGetter(sysUser, SysUser::getNickName);
|
return ObjectUtils.notNullGetter(sysUser, SysUser::getNickName);
|
||||||
}
|
}
|
||||||
@ -623,7 +623,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String selectPhonenumberById(Long userId) {
|
public String selectPhonenumberById(Long userId) {
|
||||||
SysUser sysUser = baseMapper.selectOne(new LambdaQueryWrapper<SysUser>()
|
SysUser sysUser = sysUserMapper.selectOne(new LambdaQueryWrapper<SysUser>()
|
||||||
.select(SysUser::getPhoneNumber).eq(SysUser::getUserId, userId));
|
.select(SysUser::getPhoneNumber).eq(SysUser::getUserId, userId));
|
||||||
return ObjectUtils.notNullGetter(sysUser, SysUser::getPhoneNumber);
|
return ObjectUtils.notNullGetter(sysUser, SysUser::getPhoneNumber);
|
||||||
}
|
}
|
||||||
@ -636,7 +636,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String selectEmailById(Long userId) {
|
public String selectEmailById(Long userId) {
|
||||||
SysUser sysUser = baseMapper.selectOne(new LambdaQueryWrapper<SysUser>()
|
SysUser sysUser = sysUserMapper.selectOne(new LambdaQueryWrapper<SysUser>()
|
||||||
.select(SysUser::getEmail).eq(SysUser::getUserId, userId));
|
.select(SysUser::getEmail).eq(SysUser::getUserId, userId));
|
||||||
return ObjectUtils.notNullGetter(sysUser, SysUser::getEmail);
|
return ObjectUtils.notNullGetter(sysUser, SysUser::getEmail);
|
||||||
}
|
}
|
||||||
@ -649,7 +649,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public UserDTO selectById(Long userId) {
|
public UserDTO selectById(Long userId) {
|
||||||
SysUserVo vo = baseMapper.selectVoOne(new LambdaQueryWrapper<SysUser>()
|
SysUserVo vo = sysUserMapper.selectVoOne(new LambdaQueryWrapper<SysUser>()
|
||||||
.select(SysUser::getUserId, SysUser::getDeptId, SysUser::getUserName,
|
.select(SysUser::getUserId, SysUser::getDeptId, SysUser::getUserName,
|
||||||
SysUser::getNickName, SysUser::getUserType, SysUser::getEmail,
|
SysUser::getNickName, SysUser::getUserType, SysUser::getEmail,
|
||||||
SysUser::getPhoneNumber, SysUser::getGender, SysUser::getStatus,
|
SysUser::getPhoneNumber, SysUser::getGender, SysUser::getStatus,
|
||||||
@ -670,7 +670,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
if (CollUtil.isEmpty(userIds)) {
|
if (CollUtil.isEmpty(userIds)) {
|
||||||
return List.of();
|
return List.of();
|
||||||
}
|
}
|
||||||
List<SysUserVo> list = baseMapper.selectVoList(new LambdaQueryWrapper<SysUser>()
|
List<SysUserVo> list = sysUserMapper.selectVoList(new LambdaQueryWrapper<SysUser>()
|
||||||
.select(SysUser::getUserId, SysUser::getDeptId, SysUser::getUserName,
|
.select(SysUser::getUserId, SysUser::getDeptId, SysUser::getUserName,
|
||||||
SysUser::getNickName, SysUser::getUserType, SysUser::getEmail,
|
SysUser::getNickName, SysUser::getUserType, SysUser::getEmail,
|
||||||
SysUser::getPhoneNumber, SysUser::getGender, SysUser::getStatus,
|
SysUser::getPhoneNumber, SysUser::getGender, SysUser::getStatus,
|
||||||
@ -691,7 +691,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
if (CollUtil.isEmpty(roleIds)) {
|
if (CollUtil.isEmpty(roleIds)) {
|
||||||
return List.of();
|
return List.of();
|
||||||
}
|
}
|
||||||
List<SysUserRole> userRoles = userRoleMapper.selectList(
|
List<SysUserRole> userRoles = sysUserRoleMapper.selectList(
|
||||||
new LambdaQueryWrapper<SysUserRole>().in(SysUserRole::getRoleId, roleIds));
|
new LambdaQueryWrapper<SysUserRole>().in(SysUserRole::getRoleId, roleIds));
|
||||||
return StreamUtils.toList(userRoles, SysUserRole::getUserId);
|
return StreamUtils.toList(userRoles, SysUserRole::getUserId);
|
||||||
}
|
}
|
||||||
@ -709,7 +709,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 通过角色ID获取用户角色信息
|
// 通过角色ID获取用户角色信息
|
||||||
List<SysUserRole> userRoles = userRoleMapper.selectList(
|
List<SysUserRole> userRoles = sysUserRoleMapper.selectList(
|
||||||
new LambdaQueryWrapper<SysUserRole>().in(SysUserRole::getRoleId, roleIds));
|
new LambdaQueryWrapper<SysUserRole>().in(SysUserRole::getRoleId, roleIds));
|
||||||
|
|
||||||
// 获取用户ID列表
|
// 获取用户ID列表
|
||||||
@ -729,7 +729,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
if (CollUtil.isEmpty(deptIds)) {
|
if (CollUtil.isEmpty(deptIds)) {
|
||||||
return List.of();
|
return List.of();
|
||||||
}
|
}
|
||||||
List<SysUserVo> list = baseMapper.selectVoList(new LambdaQueryWrapper<SysUser>()
|
List<SysUserVo> list = sysUserMapper.selectVoList(new LambdaQueryWrapper<SysUser>()
|
||||||
.select(SysUser::getUserId, SysUser::getUserName, SysUser::getNickName, SysUser::getEmail, SysUser::getPhoneNumber)
|
.select(SysUser::getUserId, SysUser::getUserName, SysUser::getNickName, SysUser::getEmail, SysUser::getPhoneNumber)
|
||||||
.eq(SysUser::getStatus, SystemConstants.NORMAL)
|
.eq(SysUser::getStatus, SystemConstants.NORMAL)
|
||||||
.in(SysUser::getDeptId, deptIds));
|
.in(SysUser::getDeptId, deptIds));
|
||||||
@ -749,7 +749,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 通过岗位ID获取用户岗位信息
|
// 通过岗位ID获取用户岗位信息
|
||||||
List<SysUserPost> userPosts = userPostMapper.selectList(
|
List<SysUserPost> userPosts = sysUserPostMapper.selectList(
|
||||||
new LambdaQueryWrapper<SysUserPost>().in(SysUserPost::getPostId, postIds));
|
new LambdaQueryWrapper<SysUserPost>().in(SysUserPost::getPostId, postIds));
|
||||||
|
|
||||||
// 获取用户ID列表
|
// 获取用户ID列表
|
||||||
@ -769,7 +769,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
if (CollUtil.isEmpty(userIds)) {
|
if (CollUtil.isEmpty(userIds)) {
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
}
|
}
|
||||||
List<SysUser> list = baseMapper.selectList(
|
List<SysUser> list = sysUserMapper.selectList(
|
||||||
new LambdaQueryWrapper<SysUser>()
|
new LambdaQueryWrapper<SysUser>()
|
||||||
.select(SysUser::getUserId, SysUser::getNickName)
|
.select(SysUser::getUserId, SysUser::getNickName)
|
||||||
.in(SysUser::getUserId, userIds)
|
.in(SysUser::getUserId, userIds)
|
||||||
|
|||||||
@ -39,7 +39,7 @@ import java.util.*;
|
|||||||
public class FlwCategoryServiceImpl implements IFlwCategoryService, CategoryService {
|
public class FlwCategoryServiceImpl implements IFlwCategoryService, CategoryService {
|
||||||
|
|
||||||
private final DefService defService;
|
private final DefService defService;
|
||||||
private final FlwCategoryMapper baseMapper;
|
private final FlwCategoryMapper flwCategoryMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询流程分类
|
* 查询流程分类
|
||||||
@ -49,7 +49,7 @@ public class FlwCategoryServiceImpl implements IFlwCategoryService, CategoryServ
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public FlowCategoryVo queryById(Long categoryId) {
|
public FlowCategoryVo queryById(Long categoryId) {
|
||||||
return baseMapper.selectVoById(categoryId);
|
return flwCategoryMapper.selectVoById(categoryId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -64,7 +64,7 @@ public class FlwCategoryServiceImpl implements IFlwCategoryService, CategoryServ
|
|||||||
if (ObjectUtil.isNull(categoryId)) {
|
if (ObjectUtil.isNull(categoryId)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
FlowCategory category = baseMapper.selectOne(new LambdaQueryWrapper<FlowCategory>()
|
FlowCategory category = flwCategoryMapper.selectOne(new LambdaQueryWrapper<FlowCategory>()
|
||||||
.select(FlowCategory::getCategoryName).eq(FlowCategory::getCategoryId, categoryId));
|
.select(FlowCategory::getCategoryName).eq(FlowCategory::getCategoryId, categoryId));
|
||||||
return ObjectUtils.notNullGetter(category, FlowCategory::getCategoryName);
|
return ObjectUtils.notNullGetter(category, FlowCategory::getCategoryName);
|
||||||
}
|
}
|
||||||
@ -80,7 +80,7 @@ public class FlwCategoryServiceImpl implements IFlwCategoryService, CategoryServ
|
|||||||
if (CollUtil.isEmpty(categoryIds)) {
|
if (CollUtil.isEmpty(categoryIds)) {
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
}
|
}
|
||||||
List<FlowCategory> list = baseMapper.selectList(new LambdaQueryWrapper<FlowCategory>()
|
List<FlowCategory> list = flwCategoryMapper.selectList(new LambdaQueryWrapper<FlowCategory>()
|
||||||
.select(FlowCategory::getCategoryId, FlowCategory::getCategoryName)
|
.select(FlowCategory::getCategoryId, FlowCategory::getCategoryName)
|
||||||
.in(FlowCategory::getCategoryId, categoryIds));
|
.in(FlowCategory::getCategoryId, categoryIds));
|
||||||
return StreamUtils.toMap(list, FlowCategory::getCategoryId, FlowCategory::getCategoryName);
|
return StreamUtils.toMap(list, FlowCategory::getCategoryId, FlowCategory::getCategoryName);
|
||||||
@ -95,7 +95,7 @@ public class FlwCategoryServiceImpl implements IFlwCategoryService, CategoryServ
|
|||||||
@Override
|
@Override
|
||||||
public List<FlowCategoryVo> queryList(FlowCategoryBo bo) {
|
public List<FlowCategoryVo> queryList(FlowCategoryBo bo) {
|
||||||
LambdaQueryWrapper<FlowCategory> lqw = buildQueryWrapper(bo);
|
LambdaQueryWrapper<FlowCategory> lqw = buildQueryWrapper(bo);
|
||||||
return baseMapper.selectVoList(lqw);
|
return flwCategoryMapper.selectVoList(lqw);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -145,7 +145,7 @@ public class FlwCategoryServiceImpl implements IFlwCategoryService, CategoryServ
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean checkCategoryNameUnique(FlowCategoryBo category) {
|
public boolean checkCategoryNameUnique(FlowCategoryBo category) {
|
||||||
boolean exist = baseMapper.exists(new LambdaQueryWrapper<FlowCategory>()
|
boolean exist = flwCategoryMapper.exists(new LambdaQueryWrapper<FlowCategory>()
|
||||||
.eq(FlowCategory::getCategoryName, category.getCategoryName())
|
.eq(FlowCategory::getCategoryName, category.getCategoryName())
|
||||||
.eq(FlowCategory::getParentId, category.getParentId())
|
.eq(FlowCategory::getParentId, category.getParentId())
|
||||||
.ne(ObjectUtil.isNotNull(category.getCategoryId()), FlowCategory::getCategoryId, category.getCategoryId()));
|
.ne(ObjectUtil.isNotNull(category.getCategoryId()), FlowCategory::getCategoryId, category.getCategoryId()));
|
||||||
@ -173,7 +173,7 @@ public class FlwCategoryServiceImpl implements IFlwCategoryService, CategoryServ
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean hasChildByCategoryId(Long categoryId) {
|
public boolean hasChildByCategoryId(Long categoryId) {
|
||||||
return baseMapper.exists(new LambdaQueryWrapper<FlowCategory>()
|
return flwCategoryMapper.exists(new LambdaQueryWrapper<FlowCategory>()
|
||||||
.eq(FlowCategory::getParentId, categoryId));
|
.eq(FlowCategory::getParentId, categoryId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,13 +204,13 @@ public class FlwCategoryServiceImpl implements IFlwCategoryService, CategoryServ
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int insertByBo(FlowCategoryBo bo) {
|
public int insertByBo(FlowCategoryBo bo) {
|
||||||
FlowCategory info = baseMapper.selectById(bo.getParentId());
|
FlowCategory info = flwCategoryMapper.selectById(bo.getParentId());
|
||||||
if (ObjectUtil.isNull(info)) {
|
if (ObjectUtil.isNull(info)) {
|
||||||
throw new ServiceException("父级流程分类不存在!");
|
throw new ServiceException("父级流程分类不存在!");
|
||||||
}
|
}
|
||||||
FlowCategory category = MapstructUtils.convert(bo, FlowCategory.class);
|
FlowCategory category = MapstructUtils.convert(bo, FlowCategory.class);
|
||||||
category.setAncestors(info.getAncestors() + StringUtils.SEPARATOR + category.getParentId());
|
category.setAncestors(info.getAncestors() + StringUtils.SEPARATOR + category.getParentId());
|
||||||
return baseMapper.insert(category);
|
return flwCategoryMapper.insert(category);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -224,7 +224,7 @@ public class FlwCategoryServiceImpl implements IFlwCategoryService, CategoryServ
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int updateByBo(FlowCategoryBo bo) {
|
public int updateByBo(FlowCategoryBo bo) {
|
||||||
FlowCategory category = MapstructUtils.convert(bo, FlowCategory.class);
|
FlowCategory category = MapstructUtils.convert(bo, FlowCategory.class);
|
||||||
FlowCategory oldCategory = baseMapper.selectById(category.getCategoryId());
|
FlowCategory oldCategory = flwCategoryMapper.selectById(category.getCategoryId());
|
||||||
if (ObjectUtil.isNull(oldCategory)) {
|
if (ObjectUtil.isNull(oldCategory)) {
|
||||||
throw new ServiceException("流程分类不存在,无法修改");
|
throw new ServiceException("流程分类不存在,无法修改");
|
||||||
}
|
}
|
||||||
@ -232,7 +232,7 @@ public class FlwCategoryServiceImpl implements IFlwCategoryService, CategoryServ
|
|||||||
throw new ServiceException("不允许修改顶级分类的父级节点");
|
throw new ServiceException("不允许修改顶级分类的父级节点");
|
||||||
}
|
}
|
||||||
if (!oldCategory.getParentId().equals(category.getParentId())) {
|
if (!oldCategory.getParentId().equals(category.getParentId())) {
|
||||||
FlowCategory newParentCategory = baseMapper.selectById(category.getParentId());
|
FlowCategory newParentCategory = flwCategoryMapper.selectById(category.getParentId());
|
||||||
if (ObjectUtil.isNotNull(newParentCategory)) {
|
if (ObjectUtil.isNotNull(newParentCategory)) {
|
||||||
String newAncestors = newParentCategory.getAncestors() + StringUtils.SEPARATOR + newParentCategory.getCategoryId();
|
String newAncestors = newParentCategory.getAncestors() + StringUtils.SEPARATOR + newParentCategory.getCategoryId();
|
||||||
String oldAncestors = oldCategory.getAncestors();
|
String oldAncestors = oldCategory.getAncestors();
|
||||||
@ -244,7 +244,7 @@ public class FlwCategoryServiceImpl implements IFlwCategoryService, CategoryServ
|
|||||||
} else {
|
} else {
|
||||||
category.setAncestors(oldCategory.getAncestors());
|
category.setAncestors(oldCategory.getAncestors());
|
||||||
}
|
}
|
||||||
return baseMapper.updateById(category);
|
return flwCategoryMapper.updateById(category);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -255,7 +255,7 @@ public class FlwCategoryServiceImpl implements IFlwCategoryService, CategoryServ
|
|||||||
* @param oldAncestors 旧的父ID集合
|
* @param oldAncestors 旧的父ID集合
|
||||||
*/
|
*/
|
||||||
private void updateCategoryChildren(Long categoryId, String newAncestors, String oldAncestors) {
|
private void updateCategoryChildren(Long categoryId, String newAncestors, String oldAncestors) {
|
||||||
List<FlowCategory> children = baseMapper.selectList(new LambdaQueryWrapper<FlowCategory>()
|
List<FlowCategory> children = flwCategoryMapper.selectList(new LambdaQueryWrapper<FlowCategory>()
|
||||||
.apply(DataBaseHelper.findInSet(categoryId, "ancestors")));
|
.apply(DataBaseHelper.findInSet(categoryId, "ancestors")));
|
||||||
List<FlowCategory> list = new ArrayList<>();
|
List<FlowCategory> list = new ArrayList<>();
|
||||||
for (FlowCategory child : children) {
|
for (FlowCategory child : children) {
|
||||||
@ -265,7 +265,7 @@ public class FlwCategoryServiceImpl implements IFlwCategoryService, CategoryServ
|
|||||||
list.add(category);
|
list.add(category);
|
||||||
}
|
}
|
||||||
if (CollUtil.isNotEmpty(list)) {
|
if (CollUtil.isNotEmpty(list)) {
|
||||||
baseMapper.updateBatchById(list);
|
flwCategoryMapper.updateBatchById(list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -278,6 +278,6 @@ public class FlwCategoryServiceImpl implements IFlwCategoryService, CategoryServ
|
|||||||
@CacheEvict(cacheNames = FlowConstant.FLOW_CATEGORY_NAME, key = "#categoryId")
|
@CacheEvict(cacheNames = FlowConstant.FLOW_CATEGORY_NAME, key = "#categoryId")
|
||||||
@Override
|
@Override
|
||||||
public int deleteWithValidById(Long categoryId) {
|
public int deleteWithValidById(Long categoryId) {
|
||||||
return baseMapper.deleteById(categoryId);
|
return flwCategoryMapper.deleteById(categoryId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,7 +41,7 @@ import java.util.Map;
|
|||||||
@Service
|
@Service
|
||||||
public class FlwSpelServiceImpl implements IFlwSpelService {
|
public class FlwSpelServiceImpl implements IFlwSpelService {
|
||||||
|
|
||||||
private final FlwSpelMapper baseMapper;
|
private final FlwSpelMapper flwSpelMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询流程spel表达式定义
|
* 查询流程spel表达式定义
|
||||||
@ -51,7 +51,7 @@ public class FlwSpelServiceImpl implements IFlwSpelService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public FlowSpelVo queryById(Long id){
|
public FlowSpelVo queryById(Long id){
|
||||||
return baseMapper.selectVoById(id);
|
return flwSpelMapper.selectVoById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -64,7 +64,7 @@ public class FlwSpelServiceImpl implements IFlwSpelService {
|
|||||||
@Override
|
@Override
|
||||||
public PageResult<FlowSpelVo> queryPageList(FlowSpelBo bo, PageQuery pageQuery) {
|
public PageResult<FlowSpelVo> queryPageList(FlowSpelBo bo, PageQuery pageQuery) {
|
||||||
LambdaQueryWrapper<FlowSpel> lqw = buildQueryWrapper(bo);
|
LambdaQueryWrapper<FlowSpel> lqw = buildQueryWrapper(bo);
|
||||||
Page<FlowSpelVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
Page<FlowSpelVo> result = flwSpelMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
return PageResult.build(result.getRecords(), result.getTotal());
|
return PageResult.build(result.getRecords(), result.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ public class FlwSpelServiceImpl implements IFlwSpelService {
|
|||||||
@Override
|
@Override
|
||||||
public List<FlowSpelVo> queryList(FlowSpelBo bo) {
|
public List<FlowSpelVo> queryList(FlowSpelBo bo) {
|
||||||
LambdaQueryWrapper<FlowSpel> lqw = buildQueryWrapper(bo);
|
LambdaQueryWrapper<FlowSpel> lqw = buildQueryWrapper(bo);
|
||||||
return baseMapper.selectVoList(lqw);
|
return flwSpelMapper.selectVoList(lqw);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -108,7 +108,7 @@ public class FlwSpelServiceImpl implements IFlwSpelService {
|
|||||||
public Boolean insertByBo(FlowSpelBo bo) {
|
public Boolean insertByBo(FlowSpelBo bo) {
|
||||||
FlowSpel add = MapstructUtils.convert(bo, FlowSpel.class);
|
FlowSpel add = MapstructUtils.convert(bo, FlowSpel.class);
|
||||||
validEntityBeforeSave(add);
|
validEntityBeforeSave(add);
|
||||||
boolean flag = baseMapper.insert(add) > 0;
|
boolean flag = flwSpelMapper.insert(add) > 0;
|
||||||
if (flag) {
|
if (flag) {
|
||||||
bo.setId(add.getId());
|
bo.setId(add.getId());
|
||||||
}
|
}
|
||||||
@ -125,7 +125,7 @@ public class FlwSpelServiceImpl implements IFlwSpelService {
|
|||||||
public Boolean updateByBo(FlowSpelBo bo) {
|
public Boolean updateByBo(FlowSpelBo bo) {
|
||||||
FlowSpel update = MapstructUtils.convert(bo, FlowSpel.class);
|
FlowSpel update = MapstructUtils.convert(bo, FlowSpel.class);
|
||||||
validEntityBeforeSave(update);
|
validEntityBeforeSave(update);
|
||||||
return baseMapper.updateById(update) > 0;
|
return flwSpelMapper.updateById(update) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -135,7 +135,7 @@ public class FlwSpelServiceImpl implements IFlwSpelService {
|
|||||||
*/
|
*/
|
||||||
private void validEntityBeforeSave(FlowSpel entity){
|
private void validEntityBeforeSave(FlowSpel entity){
|
||||||
if (StringUtils.isNotBlank(entity.getViewSpel())) {
|
if (StringUtils.isNotBlank(entity.getViewSpel())) {
|
||||||
boolean exists = baseMapper.exists(new LambdaQueryWrapper<FlowSpel>()
|
boolean exists = flwSpelMapper.exists(new LambdaQueryWrapper<FlowSpel>()
|
||||||
.eq(FlowSpel::getViewSpel, entity.getViewSpel())
|
.eq(FlowSpel::getViewSpel, entity.getViewSpel())
|
||||||
.ne(ObjectUtil.isNotNull(entity.getId()), FlowSpel::getId, entity.getId()));
|
.ne(ObjectUtil.isNotNull(entity.getId()), FlowSpel::getId, entity.getId()));
|
||||||
if (exists) {
|
if (exists) {
|
||||||
@ -156,7 +156,7 @@ public class FlwSpelServiceImpl implements IFlwSpelService {
|
|||||||
if (isValid){
|
if (isValid){
|
||||||
//TODO 做一些业务上的校验,判断是否需要校验
|
//TODO 做一些业务上的校验,判断是否需要校验
|
||||||
}
|
}
|
||||||
return baseMapper.deleteByIds(ids) > 0;
|
return flwSpelMapper.deleteByIds(ids) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -193,7 +193,7 @@ public class FlwSpelServiceImpl implements IFlwSpelService {
|
|||||||
if (CollUtil.isEmpty(viewSpels)) {
|
if (CollUtil.isEmpty(viewSpels)) {
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
}
|
}
|
||||||
List<FlowSpel> list = baseMapper.selectList(
|
List<FlowSpel> list = flwSpelMapper.selectList(
|
||||||
new LambdaQueryWrapper<FlowSpel>()
|
new LambdaQueryWrapper<FlowSpel>()
|
||||||
.select(FlowSpel::getViewSpel, FlowSpel::getRemark)
|
.select(FlowSpel::getViewSpel, FlowSpel::getRemark)
|
||||||
.in(FlowSpel::getViewSpel, viewSpels)
|
.in(FlowSpel::getViewSpel, viewSpels)
|
||||||
|
|||||||
@ -50,7 +50,7 @@ import java.util.Map;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class TestLeaveServiceImpl implements ITestLeaveService {
|
public class TestLeaveServiceImpl implements ITestLeaveService {
|
||||||
|
|
||||||
private final TestLeaveMapper baseMapper;
|
private final TestLeaveMapper testLeaveMapper;
|
||||||
private final WorkflowService workflowService;
|
private final WorkflowService workflowService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -74,7 +74,7 @@ public class TestLeaveServiceImpl implements ITestLeaveService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public TestLeaveVo queryById(Long id) {
|
public TestLeaveVo queryById(Long id) {
|
||||||
return baseMapper.selectVoById(id);
|
return testLeaveMapper.selectVoById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -87,7 +87,7 @@ public class TestLeaveServiceImpl implements ITestLeaveService {
|
|||||||
@Override
|
@Override
|
||||||
public PageResult<TestLeaveVo> queryPageList(TestLeaveBo bo, PageQuery pageQuery) {
|
public PageResult<TestLeaveVo> queryPageList(TestLeaveBo bo, PageQuery pageQuery) {
|
||||||
LambdaQueryWrapper<TestLeave> lqw = buildQueryWrapper(bo);
|
LambdaQueryWrapper<TestLeave> lqw = buildQueryWrapper(bo);
|
||||||
Page<TestLeaveVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
Page<TestLeaveVo> result = testLeaveMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
return PageResult.build(result.getRecords(), result.getTotal());
|
return PageResult.build(result.getRecords(), result.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ public class TestLeaveServiceImpl implements ITestLeaveService {
|
|||||||
@Override
|
@Override
|
||||||
public List<TestLeaveVo> queryList(TestLeaveBo bo) {
|
public List<TestLeaveVo> queryList(TestLeaveBo bo) {
|
||||||
LambdaQueryWrapper<TestLeave> lqw = buildQueryWrapper(bo);
|
LambdaQueryWrapper<TestLeave> lqw = buildQueryWrapper(bo);
|
||||||
return baseMapper.selectVoList(lqw);
|
return testLeaveMapper.selectVoList(lqw);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -134,7 +134,7 @@ public class TestLeaveServiceImpl implements ITestLeaveService {
|
|||||||
if (StringUtils.isBlank(add.getStatus())) {
|
if (StringUtils.isBlank(add.getStatus())) {
|
||||||
add.setStatus(BusinessStatusEnum.DRAFT.getStatus());
|
add.setStatus(BusinessStatusEnum.DRAFT.getStatus());
|
||||||
}
|
}
|
||||||
boolean flag = baseMapper.insert(add) > 0;
|
boolean flag = testLeaveMapper.insert(add) > 0;
|
||||||
if (flag) {
|
if (flag) {
|
||||||
bo.setId(add.getId());
|
bo.setId(add.getId());
|
||||||
}
|
}
|
||||||
@ -157,7 +157,7 @@ public class TestLeaveServiceImpl implements ITestLeaveService {
|
|||||||
bo.setApplyCode(System.currentTimeMillis() + StrUtil.EMPTY);
|
bo.setApplyCode(System.currentTimeMillis() + StrUtil.EMPTY);
|
||||||
}
|
}
|
||||||
TestLeave leave = MapstructUtils.convert(bo, TestLeave.class);
|
TestLeave leave = MapstructUtils.convert(bo, TestLeave.class);
|
||||||
boolean flag = baseMapper.insertOrUpdate(leave);
|
boolean flag = testLeaveMapper.insertOrUpdate(leave);
|
||||||
if (flag) {
|
if (flag) {
|
||||||
bo.setId(leave.getId());
|
bo.setId(leave.getId());
|
||||||
// 后端发起需要忽略权限
|
// 后端发起需要忽略权限
|
||||||
@ -187,7 +187,7 @@ public class TestLeaveServiceImpl implements ITestLeaveService {
|
|||||||
@Override
|
@Override
|
||||||
public TestLeaveVo updateByBo(TestLeaveBo bo) {
|
public TestLeaveVo updateByBo(TestLeaveBo bo) {
|
||||||
TestLeave update = MapstructUtils.convert(bo, TestLeave.class);
|
TestLeave update = MapstructUtils.convert(bo, TestLeave.class);
|
||||||
baseMapper.updateById(update);
|
testLeaveMapper.updateById(update);
|
||||||
return MapstructUtils.convert(update, TestLeaveVo.class);
|
return MapstructUtils.convert(update, TestLeaveVo.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,7 +201,7 @@ public class TestLeaveServiceImpl implements ITestLeaveService {
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean deleteWithValidByIds(Collection<Long> ids) {
|
public Boolean deleteWithValidByIds(Collection<Long> ids) {
|
||||||
workflowService.deleteInstance(StreamUtils.toList(ids, Convert::toStr));
|
workflowService.deleteInstance(StreamUtils.toList(ids, Convert::toStr));
|
||||||
return baseMapper.deleteByIds(ids) > 0;
|
return testLeaveMapper.deleteByIds(ids) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -214,7 +214,7 @@ public class TestLeaveServiceImpl implements ITestLeaveService {
|
|||||||
@EventListener(condition = "#processEvent.flowCode.startsWith('leave')")
|
@EventListener(condition = "#processEvent.flowCode.startsWith('leave')")
|
||||||
public void processHandler(ProcessEvent processEvent) {
|
public void processHandler(ProcessEvent processEvent) {
|
||||||
log.info("当前任务执行了{}", processEvent.toString());
|
log.info("当前任务执行了{}", processEvent.toString());
|
||||||
TestLeave testLeave = baseMapper.selectById(Convert.toLong(processEvent.getBusinessId()));
|
TestLeave testLeave = testLeaveMapper.selectById(Convert.toLong(processEvent.getBusinessId()));
|
||||||
testLeave.setStatus(processEvent.getStatus());
|
testLeave.setStatus(processEvent.getStatus());
|
||||||
// 用于例如审批附件 审批意见等 存储到业务表内 自行根据业务实现存储流程
|
// 用于例如审批附件 审批意见等 存储到业务表内 自行根据业务实现存储流程
|
||||||
Map<String, Object> params = processEvent.getParams();
|
Map<String, Object> params = processEvent.getParams();
|
||||||
@ -236,7 +236,7 @@ public class TestLeaveServiceImpl implements ITestLeaveService {
|
|||||||
}
|
}
|
||||||
String status = BusinessStatusEnum.findByStatus(processEvent.getStatus());
|
String status = BusinessStatusEnum.findByStatus(processEvent.getStatus());
|
||||||
log.info("当前流程状态为{}", status);
|
log.info("当前流程状态为{}", status);
|
||||||
baseMapper.updateById(testLeave);
|
testLeaveMapper.updateById(testLeave);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -264,11 +264,11 @@ public class TestLeaveServiceImpl implements ITestLeaveService {
|
|||||||
@EventListener(condition = "#processDeleteEvent.flowCode.startsWith('leave')")
|
@EventListener(condition = "#processDeleteEvent.flowCode.startsWith('leave')")
|
||||||
public void processDeleteHandler(ProcessDeleteEvent processDeleteEvent) {
|
public void processDeleteHandler(ProcessDeleteEvent processDeleteEvent) {
|
||||||
log.info("监听删除流程事件,当前任务执行了{}", processDeleteEvent.toString());
|
log.info("监听删除流程事件,当前任务执行了{}", processDeleteEvent.toString());
|
||||||
TestLeave testLeave = baseMapper.selectById(Convert.toLong(processDeleteEvent.getBusinessId()));
|
TestLeave testLeave = testLeaveMapper.selectById(Convert.toLong(processDeleteEvent.getBusinessId()));
|
||||||
if (ObjectUtil.isNull(testLeave)) {
|
if (ObjectUtil.isNull(testLeave)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
baseMapper.deleteById(testLeave.getId());
|
testLeaveMapper.deleteById(testLeave.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user