Commit 7765eff1 authored by ZWT's avatar ZWT

feat(吉林演示): 松原

1.修改系统首页大屏总览接口,增加区分组织机构逻辑,完成接口冒烟测试;
2.修改系统首页获取井场列表接口,增加区分组织机构逻辑,完成接口冒烟测试;
3.修改系统首页井场功能下钻后提示报错问题,修改用电功率数据获取逻辑,修复报错问题;
4.修改输电线路分页列表查询接口,增加查询条件,在查询父线路列表时只查询10千伏线路,修改线上接口文档同时完成接口冒烟测试;
5.修改系统首页井场实时监控接口,增加区分组织机构逻辑,完成接口冒烟测试;
6.修改系统首页用能分析接口,增加区分组织机构逻辑,完成接口冒烟测试;
7.修改系统首页井场用能分析(双坐标轴)接口,增加区分组织机构逻辑,完成接口冒烟测试;
8.修改系统首页累积用电接口,增加区分组织机构逻辑,完成接口冒烟测试;
9.修改系统首页光伏实时监控接口,增加区分组织机构逻辑,完成接口冒烟测试;
10.修改系统首页井场效果评价接口,增加区分组织机构逻辑,完成接口冒烟测试;
11.修改系统首页先导实验井间开制度接口,增加区分组织机构逻辑,完成接口冒烟测试;

BREAKING CHANGE: 无

Closes 无

[skip ci]
parent 580ed807
package pps.core.auth; package pps.core.auth;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpHeaders; import org.apache.http.HttpHeaders;
import org.apache.http.HttpResponse; import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair; import org.apache.http.NameValuePair;
...@@ -346,7 +346,7 @@ public class HttpRequestClient { ...@@ -346,7 +346,7 @@ public class HttpRequestClient {
.addHeader(HttpHeaders.AUTHORIZATION, auth.getAuth()) .addHeader(HttpHeaders.AUTHORIZATION, auth.getAuth())
.addHeader("Accept", ContentType.APPLICATION_JSON.toString()) .addHeader("Accept", ContentType.APPLICATION_JSON.toString())
.addHeader("Content-type", ContentType.APPLICATION_JSON.toString()); .addHeader("Content-type", ContentType.APPLICATION_JSON.toString());
if (StringUtils.isNotBlank(json)) { if (CharSequenceUtil.isNotBlank(json)) {
reqBuilder.setEntity(new StringEntity(json, ContentType.APPLICATION_JSON)); reqBuilder.setEntity(new StringEntity(json, ContentType.APPLICATION_JSON));
} }
try { try {
......
package pps.core.common.utils; package pps.core.common.utils;
import org.apache.commons.lang3.StringUtils; import cn.hutool.core.text.CharSequenceUtil;
import java.util.regex.Pattern; import java.util.regex.Pattern;
...@@ -25,7 +25,7 @@ public class PatternUtil { ...@@ -25,7 +25,7 @@ public class PatternUtil {
* 字符串脱敏模糊处理 * 字符串脱敏模糊处理
*/ */
public static String desensitization(String str) { public static String desensitization(String str) {
if (StringUtils.isBlank(str)) { if (CharSequenceUtil.isBlank(str)) {
return str; return str;
} }
//先判断手机号 //先判断手机号
...@@ -46,7 +46,7 @@ public class PatternUtil { ...@@ -46,7 +46,7 @@ public class PatternUtil {
public static boolean easyCheckIdCard(String IdCard) { public static boolean easyCheckIdCard(String IdCard) {
//字符串为空或者不符合简单的18位校验返回false //字符串为空或者不符合简单的18位校验返回false
String regex = "^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$"; String regex = "^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$";
if (StringUtils.isBlank(IdCard) || !Pattern.matches(regex, IdCard)) { if (CharSequenceUtil.isBlank(IdCard) || !Pattern.matches(regex, IdCard)) {
return false; return false;
} }
return true; return true;
...@@ -68,7 +68,7 @@ public class PatternUtil { ...@@ -68,7 +68,7 @@ public class PatternUtil {
//邮箱加*号 //邮箱加*号
public static String reStr(String str) { public static String reStr(String str) {
if (StringUtils.isBlank(str)) { if (CharSequenceUtil.isBlank(str)) {
return str; return str;
} }
String name = str; String name = str;
......
package pps.core.system.cache; package pps.core.system.cache;
import cn.hutool.core.text.CharSequenceUtil;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import pps.core.common.utils.CounterBuilder; import pps.core.common.utils.CounterBuilder;
import xstartup.annotation.XText; import xstartup.annotation.XText;
import xstartup.base.XContext; import xstartup.base.XContext;
...@@ -124,7 +124,7 @@ public class SysDictionaryCache implements XCacheObject, XCacheLife { ...@@ -124,7 +124,7 @@ public class SysDictionaryCache implements XCacheObject, XCacheLife {
public static void delete(XContext context, String alias, String dicId) { public static void delete(XContext context, String alias, String dicId) {
List<SysDictionaryCache> list = Tool.get(Tool.class).list(context, alias, SysDictionaryCache.class); List<SysDictionaryCache> list = Tool.get(Tool.class).list(context, alias, SysDictionaryCache.class);
if (ObjectUtils.isNotEmpty(list)) { if (ObjectUtils.isNotEmpty(list)) {
list = list.stream().filter((SysDictionaryCache b) -> !StringUtils.equals(b.getId(), dicId)) list = list.stream().filter((SysDictionaryCache b) -> !CharSequenceUtil.equals(b.getId(), dicId))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
CounterBuilder.globalCounterBuilder.addCounter("deleteCache"); CounterBuilder.globalCounterBuilder.addCounter("deleteCache");
......
...@@ -5,7 +5,6 @@ import cn.hutool.core.text.CharSequenceUtil; ...@@ -5,7 +5,6 @@ import cn.hutool.core.text.CharSequenceUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import pps.core.common.utils.ManifestComponentInfoHelper; import pps.core.common.utils.ManifestComponentInfoHelper;
import pps.core.system.cache.SysDictionaryCache; import pps.core.system.cache.SysDictionaryCache;
import pps.core.system.entity.SysDictionaryEnt; import pps.core.system.entity.SysDictionaryEnt;
...@@ -47,7 +46,7 @@ public class PpsCoreSystemModule extends XModule { ...@@ -47,7 +46,7 @@ public class PpsCoreSystemModule extends XModule {
List<SysDictionaryEnt> sysDictionarys = dictionaryMapper.selectList(new LambdaQueryWrapper<SysDictionaryEnt>() List<SysDictionaryEnt> sysDictionarys = dictionaryMapper.selectList(new LambdaQueryWrapper<SysDictionaryEnt>()
.isNotNull(SysDictionaryEnt::getAlias).gt(SysDictionaryEnt::getEndTime, DateUtil.date()) .isNotNull(SysDictionaryEnt::getAlias).gt(SysDictionaryEnt::getEndTime, DateUtil.date())
); );
sysDictionarys = sysDictionarys.stream().filter(p -> !StringUtils.equals("", p.getAlias())).collect(Collectors.toList()); sysDictionarys = sysDictionarys.stream().filter(p -> !CharSequenceUtil.equals("", p.getAlias())).collect(Collectors.toList());
for (SysDictionaryEnt dictObj : sysDictionarys) { for (SysDictionaryEnt dictObj : sysDictionarys) {
List<SysDictionaryCache> list = new ArrayList<>(); List<SysDictionaryCache> list = new ArrayList<>();
SysDictionaryCache dictMap = new SysDictionaryCache(); SysDictionaryCache dictMap = new SysDictionaryCache();
...@@ -72,7 +71,7 @@ public class PpsCoreSystemModule extends XModule { ...@@ -72,7 +71,7 @@ public class PpsCoreSystemModule extends XModule {
if (ObjectUtils.isNotEmpty(sysDictionaryChilds)) { if (ObjectUtils.isNotEmpty(sysDictionaryChilds)) {
SysDictionaryCache dict = iterator.next(); SysDictionaryCache dict = iterator.next();
for (SysDictionaryEnt dictChild : sysDictionaryChilds) { for (SysDictionaryEnt dictChild : sysDictionaryChilds) {
if (StringUtils.equals(dict.getId(), dictChild.getPid())) { if (CharSequenceUtil.equals(dict.getId(), dictChild.getPid())) {
List<SysDictionaryCache> sysDictionaryList = dictCashMap.get(aliasObj); List<SysDictionaryCache> sysDictionaryList = dictCashMap.get(aliasObj);
SysDictionaryCache dictMap = new SysDictionaryCache(); SysDictionaryCache dictMap = new SysDictionaryCache();
XCopyUtils.copyObject(dictChild, dictMap); XCopyUtils.copyObject(dictChild, dictMap);
......
package pps.core.system.provider.impl; package pps.core.system.provider.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.text.CharSequenceUtil; import cn.hutool.core.text.CharSequenceUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.base.Splitter; import com.google.common.base.Splitter;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.CollectionUtils;
import pps.cloud.system.service.SysOrganizationCloudService; import pps.cloud.system.service.SysOrganizationCloudService;
import pps.cloud.system.service.SystemDictionaryService; import pps.cloud.system.service.SystemDictionaryService;
import pps.cloud.system.service.SystemUserRoleRelService; import pps.cloud.system.service.SystemUserRoleRelService;
...@@ -114,7 +113,7 @@ public class PpsUserSessionInjectProviderImpl implements XSessionInjectProvider ...@@ -114,7 +113,7 @@ public class PpsUserSessionInjectProviderImpl implements XSessionInjectProvider
set.addAll(Arrays.asList(split)); set.addAll(Arrays.asList(split));
} }
} }
if (!CollectionUtils.isEmpty(set)) { if (CollUtil.isNotEmpty(set)) {
SystemDictionaryService dictService = context.getBean(SystemDictionaryService.class); SystemDictionaryService dictService = context.getBean(SystemDictionaryService.class);
CreateSysDictionaryInput mediaTypesInput = new CreateSysDictionaryInput(); CreateSysDictionaryInput mediaTypesInput = new CreateSysDictionaryInput();
mediaTypesInput.setAlias("MEDIUM_TYPE"); mediaTypesInput.setAlias("MEDIUM_TYPE");
...@@ -192,7 +191,7 @@ public class PpsUserSessionInjectProviderImpl implements XSessionInjectProvider ...@@ -192,7 +191,7 @@ public class PpsUserSessionInjectProviderImpl implements XSessionInjectProvider
List<String> roleList = roleRelResult.getResult().stream().map(GetSysUserRoleRelOutput::getRoleId).collect(Collectors.toList()); List<String> roleList = roleRelResult.getResult().stream().map(GetSysUserRoleRelOutput::getRoleId).collect(Collectors.toList());
String value = LoginConfig.adminRoles.findValue(context); String value = LoginConfig.adminRoles.findValue(context);
session.setDevops(0); session.setDevops(0);
if (StringUtils.isNotBlank(value)) { if (CharSequenceUtil.isNotBlank(value)) {
roleList.stream().filter(value::contains).findFirst().ifPresent(role -> session.setDevops(1)); roleList.stream().filter(value::contains).findFirst().ifPresent(role -> session.setDevops(1));
} }
} }
...@@ -208,7 +207,7 @@ public class PpsUserSessionInjectProviderImpl implements XSessionInjectProvider ...@@ -208,7 +207,7 @@ public class PpsUserSessionInjectProviderImpl implements XSessionInjectProvider
List<String> roleList = roleRelResult.getResult().stream().map(GetSysUserRoleRelOutput::getRoleId).collect(Collectors.toList()); List<String> roleList = roleRelResult.getResult().stream().map(GetSysUserRoleRelOutput::getRoleId).collect(Collectors.toList());
String value = LoginConfig.adminRoles.findValue(context); String value = LoginConfig.adminRoles.findValue(context);
if (StringUtils.isNotBlank(value)) { if (CharSequenceUtil.isNotBlank(value)) {
roleList.stream().filter(value::contains).findFirst().ifPresent(role -> session.setIsSuperAdmin(BusinessConstant.ONE)); roleList.stream().filter(value::contains).findFirst().ifPresent(role -> session.setIsSuperAdmin(BusinessConstant.ONE));
} }
......
...@@ -35,7 +35,7 @@ import java.util.List; ...@@ -35,7 +35,7 @@ import java.util.List;
public class SysAreaService { public class SysAreaService {
@XText("查询地区树") @XText("查询地区树")
@XApiPost @XApiPost(anonymous = true)
public XListResult<GetSysAreaViewOutputTree> getSysAreaTree(XContext context, GetSysAreaInput input) { public XListResult<GetSysAreaViewOutputTree> getSysAreaTree(XContext context, GetSysAreaInput input) {
//先从缓存中获取 //先从缓存中获取
List<SysAreaCache> sysAreaCaches = SysAreaCache.list(context, BusinessConstant.SYS_AREA_CACHE); List<SysAreaCache> sysAreaCaches = SysAreaCache.list(context, BusinessConstant.SYS_AREA_CACHE);
...@@ -73,7 +73,7 @@ public class SysAreaService { ...@@ -73,7 +73,7 @@ public class SysAreaService {
XCopyUtils.copyObject(input, record); XCopyUtils.copyObject(input, record);
List<SysAreaView> areaViews = mapper.selectListAll(record); List<SysAreaView> areaViews = mapper.selectListAll(record);
List<GetSysAreaViewOutputTree> list = XCopyUtils.copyNewList(areaViews, GetSysAreaViewOutputTree.class); List<GetSysAreaViewOutputTree> list = XCopyUtils.copyNewList(areaViews, GetSysAreaViewOutputTree.class);
List<GetSysAreaViewOutputTree> trees = new ArrayList<>(); List<GetSysAreaViewOutputTree> trees = new ArrayList<>(list.size());
for (GetSysAreaViewOutputTree tree : list) { for (GetSysAreaViewOutputTree tree : list) {
if (tree.getLev().equals(0)) { if (tree.getLev().equals(0)) {
trees.add(tree); trees.add(tree);
...@@ -81,7 +81,7 @@ public class SysAreaService { ...@@ -81,7 +81,7 @@ public class SysAreaService {
//子集 //子集
for (GetSysAreaViewOutputTree it : list) { for (GetSysAreaViewOutputTree it : list) {
if (tree.getId().equals(it.getParentId())) { if (tree.getId().equals(it.getParentId())) {
if (tree.getChildren() == null) { if (CollUtil.isEmpty(tree.getChildren())) {
tree.setChildren(new ArrayList<>()); tree.setChildren(new ArrayList<>());
} }
tree.getChildren().add(it); tree.getChildren().add(it);
...@@ -167,7 +167,7 @@ public class SysAreaService { ...@@ -167,7 +167,7 @@ public class SysAreaService {
SysAreaView record = new SysAreaView(); SysAreaView record = new SysAreaView();
XCopyUtils.copyObject(input, record); XCopyUtils.copyObject(input, record);
SysAreaView view = mapper.selectOne(record); SysAreaView view = mapper.selectOne(record);
if (view == null) { if (ObjectUtil.isNull(view)) {
return XSingleResult.error(context, XError.NotFound); return XSingleResult.error(context, XError.NotFound);
} }
GetSysAreaViewOutput output = new GetSysAreaViewOutput(); GetSysAreaViewOutput output = new GetSysAreaViewOutput();
......
package pps.core.system.service; package pps.core.system.service;
import com.alibaba.csp.sentinel.util.StringUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.util.CollectionUtils;
import pps.core.common.session.PpsUserSession; import pps.core.common.session.PpsUserSession;
import pps.core.system.entity.SysAuthOuScopeEnt; import pps.core.system.entity.SysAuthOuScopeEnt;
import pps.core.system.entity.SysAuthOuScopeView; import pps.core.system.entity.SysAuthOuScopeView;
...@@ -43,19 +43,19 @@ public class SysAuthOuScopeService { ...@@ -43,19 +43,19 @@ public class SysAuthOuScopeService {
SysAuthOuScopeMapper sysAuthOuScopeMapper = context.getBean(SysAuthOuScopeMapper.class); SysAuthOuScopeMapper sysAuthOuScopeMapper = context.getBean(SysAuthOuScopeMapper.class);
SysAuthOuScopeViewMapper sysAuthOuScopeViewMapper = context.getBean(SysAuthOuScopeViewMapper.class); SysAuthOuScopeViewMapper sysAuthOuScopeViewMapper = context.getBean(SysAuthOuScopeViewMapper.class);
//删除原关系 //删除原关系
QueryWrapper<SysAuthOuScopeEnt> queryWrapper = new QueryWrapper<>(); List<SysAuthOuScopeEnt> sysAuthOuScopeEnts = sysAuthOuScopeMapper.selectList(new QueryWrapper<SysAuthOuScopeEnt>()
queryWrapper.lambda().eq(SysAuthOuScopeEnt::getUserId, input.getUserId()); .lambda()
List<SysAuthOuScopeEnt> sysAuthOuScopeEnts = sysAuthOuScopeMapper.selectList(queryWrapper); .eq(SysAuthOuScopeEnt::getUserId, input.getUserId()));
List<SysAuthOuScopeEnt> deleteList = new ArrayList<>(); List<SysAuthOuScopeEnt> deleteList = new ArrayList<>();
//查询已存在的组织机构和功能 //查询已存在的组织机构和功能
if (!CollectionUtils.isEmpty(sysAuthOuScopeEnts)) { if (CollUtil.isNotEmpty(sysAuthOuScopeEnts)) {
for (SysAuthOuScopeEnt scopeEnt : sysAuthOuScopeEnts) { for (SysAuthOuScopeEnt scopeEnt : sysAuthOuScopeEnts) {
List<String> ouIds = input.getOuIds(); List<String> ouIds = input.getOuIds();
for (String ouId : ouIds) { for (String ouId : ouIds) {
List<String> menuIds = input.getMenuIds(); List<String> menuIds = input.getMenuIds();
for (String menuId : menuIds) { for (String menuId : menuIds) {
if (scopeEnt != null) { if (ObjectUtil.isNotNull(scopeEnt)) {
if (ouId.equals(scopeEnt.getOuId()) && menuId.equals(scopeEnt.getMenuId())) { if (CharSequenceUtil.equals(ouId, scopeEnt.getOuId()) && CharSequenceUtil.equals(menuId, scopeEnt.getMenuId())) {
deleteList.add(scopeEnt); deleteList.add(scopeEnt);
} }
} }
...@@ -63,11 +63,12 @@ public class SysAuthOuScopeService { ...@@ -63,11 +63,12 @@ public class SysAuthOuScopeService {
} }
} }
} }
if (!CollectionUtils.isEmpty(deleteList)) { if (CollUtil.isNotEmpty(deleteList)) {
List<String> collect = deleteList.stream().map(SysAuthOuScopeEnt::getId).collect(Collectors.toList()); List<String> collect = deleteList.stream().map(SysAuthOuScopeEnt::getId).collect(Collectors.toList());
sysAuthOuScopeMapper.deleteBatchIds(collect); sysAuthOuScopeMapper.deleteBatchIds(collect);
} }
//创建新关系 //创建新关系
PpsUserSession session = context.getSession(PpsUserSession.class);
List<SysAuthOuScopeView> viewList = new ArrayList<>(); List<SysAuthOuScopeView> viewList = new ArrayList<>();
List<String> ouIds = input.getOuIds(); List<String> ouIds = input.getOuIds();
for (String ouId : ouIds) { for (String ouId : ouIds) {
...@@ -78,14 +79,13 @@ public class SysAuthOuScopeService { ...@@ -78,14 +79,13 @@ public class SysAuthOuScopeService {
entity.setOuId(ouId); entity.setOuId(ouId);
entity.setUserId(input.getUserId()); entity.setUserId(input.getUserId());
entity.setId(UUID.randomUUID().toString()); entity.setId(UUID.randomUUID().toString());
PpsUserSession session = context.getSession(PpsUserSession.class);
entity.setCreateById(session.getId()); entity.setCreateById(session.getId());
entity.setCreateByName(session.getUserName()); entity.setCreateByName(session.getUserName());
entity.setCreateTime(new Date()); entity.setCreateTime(new Date());
viewList.add(entity); viewList.add(entity);
} }
} }
if (!CollectionUtils.isEmpty(viewList)) { if (CollUtil.isNotEmpty(viewList)) {
sysAuthOuScopeViewMapper.batchInsert(viewList); sysAuthOuScopeViewMapper.batchInsert(viewList);
} }
//返回执行成功的结果,事务提交 //返回执行成功的结果,事务提交
...@@ -96,16 +96,17 @@ public class SysAuthOuScopeService { ...@@ -96,16 +96,17 @@ public class SysAuthOuScopeService {
@XText("批量删除") @XText("批量删除")
@XApiPost @XApiPost
public XServiceResult batchDeleteSysAuthOuScope(XContext context, BatchDeleteSysAuthOuScopeInput input) { public XServiceResult batchDeleteSysAuthOuScope(XContext context, BatchDeleteSysAuthOuScopeInput input) {
SysAuthOuScopeMapper mapper = context.getBean(SysAuthOuScopeMapper.class);
List<String> idList = input.getIdList(); List<String> idList = input.getIdList();
if (!ObjectUtils.isEmpty(idList)) { if (ObjectUtil.isNotNull(idList)) {
idList = idList.stream().filter(item -> !StringUtil.isBlank(item)).collect(Collectors.toList()); idList = idList.stream()
.filter(CharSequenceUtil::isNotBlank)
.collect(Collectors.toList());
} }
if (ObjectUtils.isEmpty(idList)) { if (CollUtil.isEmpty(idList)) {
return XServiceResult.error(context, XError.NotFound); return XServiceResult.error(context, XError.NotFound);
} }
int i = mapper.deleteBatchIds(idList); SysAuthOuScopeMapper mapper = context.getBean(SysAuthOuScopeMapper.class);
context.getLogger().debug("批量删除:{}", i); mapper.deleteBatchIds(idList);
return XServiceResult.OK; return XServiceResult.OK;
} }
......
package pps.core.system.service; package pps.core.system.service;
import cn.hutool.core.text.CharSequenceUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import pps.cloud.system.service.SystemDictionaryService; import pps.cloud.system.service.SystemDictionaryService;
import pps.cloud.system.service.data.sys_dictionary.*; import pps.cloud.system.service.data.sys_dictionary.*;
import pps.core.system.cache.SysDictionaryCache; import pps.core.system.cache.SysDictionaryCache;
...@@ -36,7 +36,7 @@ public class SysDictionaryServiceImpl implements SystemDictionaryService { ...@@ -36,7 +36,7 @@ public class SysDictionaryServiceImpl implements SystemDictionaryService {
QueryWrapper<SysDictionaryEnt> queryWrapper = new QueryWrapper<>(); QueryWrapper<SysDictionaryEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SysDictionaryEnt::getAlias, input.getAlias()); queryWrapper.lambda().eq(SysDictionaryEnt::getAlias, input.getAlias());
SysDictionaryEnt sysDictionaryEnt = mapper.selectOne(queryWrapper); SysDictionaryEnt sysDictionaryEnt = mapper.selectOne(queryWrapper);
list = list.stream().filter((SysDictionaryCache dic) -> StringUtils.equals(dic.getPid(), sysDictionaryEnt.getId()) && !StringUtils.equals(dic.getAlias(), input.getAlias())) list = list.stream().filter((SysDictionaryCache dic) -> CharSequenceUtil.equals(dic.getPid(), sysDictionaryEnt.getId()) && !CharSequenceUtil.equals(dic.getAlias(), input.getAlias()))
.collect(Collectors.toList()); .collect(Collectors.toList());
if (ObjectUtils.isEmpty(list)) { if (ObjectUtils.isEmpty(list)) {
list = new ArrayList<>(); list = new ArrayList<>();
...@@ -64,7 +64,7 @@ public class SysDictionaryServiceImpl implements SystemDictionaryService { ...@@ -64,7 +64,7 @@ public class SysDictionaryServiceImpl implements SystemDictionaryService {
List<SysOrganizationDictionaryEnt> sysOrganizationDictionaryEnts = orgDicmapper.selectList(queryOrgDic); List<SysOrganizationDictionaryEnt> sysOrganizationDictionaryEnts = orgDicmapper.selectList(queryOrgDic);
String ouIdPath = sysOrganizationRelEnt.getOuIdPath(); String ouIdPath = sysOrganizationRelEnt.getOuIdPath();
String ouId = sysOrganizationRelEnt.getOuId(); String ouId = sysOrganizationRelEnt.getOuId();
if (StringUtils.isNotBlank(ouIdPath)) { if (CharSequenceUtil.isNotBlank(ouIdPath)) {
List<String> dicIds = sysOrganizationDictionaryEnts.stream().map(p -> { List<String> dicIds = sysOrganizationDictionaryEnts.stream().map(p -> {
if (ouIdPath.contains(p.getOuId()) && p.getUseLowerLevel() == 1) { if (ouIdPath.contains(p.getOuId()) && p.getUseLowerLevel() == 1) {
return p.getDicCode(); return p.getDicCode();
...@@ -112,7 +112,7 @@ public class SysDictionaryServiceImpl implements SystemDictionaryService { ...@@ -112,7 +112,7 @@ public class SysDictionaryServiceImpl implements SystemDictionaryService {
List<SysOrganizationDictionaryEnt> sysOrganizationDictionaryEnts = orgDicmapper.selectList(queryOrgDic); List<SysOrganizationDictionaryEnt> sysOrganizationDictionaryEnts = orgDicmapper.selectList(queryOrgDic);
String ouIdPath = sysOrganizationRelEnt.getOuIdPath(); String ouIdPath = sysOrganizationRelEnt.getOuIdPath();
String ouId = sysOrganizationRelEnt.getOuId(); String ouId = sysOrganizationRelEnt.getOuId();
if (StringUtils.isNotBlank(ouIdPath)) { if (CharSequenceUtil.isNotBlank(ouIdPath)) {
List<String> dicIds = sysOrganizationDictionaryEnts.stream().map(p -> { List<String> dicIds = sysOrganizationDictionaryEnts.stream().map(p -> {
if (ouIdPath.contains(p.getOuId()) && p.getUseLowerLevel() == 1) { if (ouIdPath.contains(p.getOuId()) && p.getUseLowerLevel() == 1) {
return p.getDicCode(); return p.getDicCode();
......
package pps.core.system.service; package pps.core.system.service;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.text.CharSequenceUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.util.CollectionUtils;
import pps.cloud.system.service.SysOrganizationCloudService; import pps.cloud.system.service.SysOrganizationCloudService;
import pps.cloud.system.service.data.sys_organization.*; import pps.cloud.system.service.data.sys_organization.*;
import pps.core.common.constant.BusinessConstant; import pps.core.common.constant.BusinessConstant;
...@@ -13,7 +13,6 @@ import xstartup.annotation.XService; ...@@ -13,7 +13,6 @@ import xstartup.annotation.XService;
import xstartup.annotation.XText; import xstartup.annotation.XText;
import xstartup.base.XContext; import xstartup.base.XContext;
import xstartup.base.util.XCopyUtils; import xstartup.base.util.XCopyUtils;
import xstartup.base.util.XStringUtils;
import xstartup.data.XListResult; import xstartup.data.XListResult;
import xstartup.data.XSingleResult; import xstartup.data.XSingleResult;
...@@ -29,9 +28,9 @@ public class SysOrganizationCloudServiceImpl implements SysOrganizationCloudServ ...@@ -29,9 +28,9 @@ public class SysOrganizationCloudServiceImpl implements SysOrganizationCloudServ
@Override @Override
public XSingleResult<GetSysOrganizationViewOutput> getSysOrganizationById(XContext context, GetSysOrganizationViewInput input) { public XSingleResult<GetSysOrganizationViewOutput> getSysOrganizationById(XContext context, GetSysOrganizationViewInput input) {
SysOrganizationMapper mapper = context.getBean(SysOrganizationMapper.class); SysOrganizationMapper mapper = context.getBean(SysOrganizationMapper.class);
QueryWrapper<SysOrganizationEnt> queryWrapper = new QueryWrapper<>(); SysOrganizationEnt ent = mapper.selectOne(new QueryWrapper<SysOrganizationEnt>()
queryWrapper.lambda().eq(SysOrganizationEnt::getId, input.getId()); .lambda()
SysOrganizationEnt ent = mapper.selectOne(queryWrapper); .eq(SysOrganizationEnt::getId, input.getId()));
GetSysOrganizationViewOutput output = new GetSysOrganizationViewOutput(); GetSysOrganizationViewOutput output = new GetSysOrganizationViewOutput();
XCopyUtils.copyObject(ent, output); XCopyUtils.copyObject(ent, output);
return XSingleResult.success(output); return XSingleResult.success(output);
...@@ -42,26 +41,26 @@ public class SysOrganizationCloudServiceImpl implements SysOrganizationCloudServ ...@@ -42,26 +41,26 @@ public class SysOrganizationCloudServiceImpl implements SysOrganizationCloudServ
SysUserOrganizationRelMapper mapper = context.getBean(SysUserOrganizationRelMapper.class); SysUserOrganizationRelMapper mapper = context.getBean(SysUserOrganizationRelMapper.class);
SysOrganizationMapper sysOrganizationMapper = context.getBean(SysOrganizationMapper.class); SysOrganizationMapper sysOrganizationMapper = context.getBean(SysOrganizationMapper.class);
SysOrganizationRelMapper sysOrganizationRelMapper = context.getBean(SysOrganizationRelMapper.class); SysOrganizationRelMapper sysOrganizationRelMapper = context.getBean(SysOrganizationRelMapper.class);
QueryWrapper<SysUserOrganizationRelEnt> wrapper = new QueryWrapper<>(); List<SysUserOrganizationRelEnt> relEnts = mapper.selectList(new QueryWrapper<SysUserOrganizationRelEnt>()
wrapper.lambda().eq(SysUserOrganizationRelEnt::getUserId, input.getUserId()) .lambda()
.eq(SysUserOrganizationRelEnt::getUserId, input.getUserId())
.le(SysUserOrganizationRelEnt::getEffectTime, new Date()) .le(SysUserOrganizationRelEnt::getEffectTime, new Date())
.ge(SysUserOrganizationRelEnt::getEndTime, new Date()); .ge(SysUserOrganizationRelEnt::getEndTime, new Date()));
List<SysUserOrganizationRelEnt> relEnts = mapper.selectList(wrapper);
GetSysOrganizationViewOutput output = new GetSysOrganizationViewOutput(); GetSysOrganizationViewOutput output = new GetSysOrganizationViewOutput();
if (CollUtil.isNotEmpty(relEnts)) { if (CollUtil.isNotEmpty(relEnts)) {
if (XStringUtils.isNotEmpty(relEnts.get(0).getOuId())) { if (CharSequenceUtil.isNotBlank(relEnts.get(0).getOuId())) {
QueryWrapper<SysOrganizationEnt> queryWrapper = new QueryWrapper<>(); SysOrganizationEnt sysOrganizationEnt = sysOrganizationMapper.selectOne(new QueryWrapper<SysOrganizationEnt>()
queryWrapper.lambda().eq(SysOrganizationEnt::getId, relEnts.get(0).getOuId()) .lambda()
.eq(SysOrganizationEnt::getIsDeleted, 1); .eq(SysOrganizationEnt::getId, relEnts.get(0).getOuId())
SysOrganizationEnt sysOrganizationEnt = sysOrganizationMapper.selectOne(queryWrapper); .eq(SysOrganizationEnt::getIsDeleted, 1));
XCopyUtils.copyObject(sysOrganizationEnt, output); XCopyUtils.copyObject(sysOrganizationEnt, output);
output.setOuId(relEnts.get(0).getOuId()); output.setOuId(relEnts.get(0).getOuId());
QueryWrapper<SysOrganizationRelEnt> qw = new QueryWrapper<>(); List<SysOrganizationRelEnt> sysOrganizationRelEnts = sysOrganizationRelMapper.selectList(new QueryWrapper<SysOrganizationRelEnt>()
qw.lambda().eq(SysOrganizationRelEnt::getOuId, relEnts.get(0).getOuId()) .lambda()
.eq(SysOrganizationRelEnt::getOuId, relEnts.get(0).getOuId())
.le(SysOrganizationRelEnt::getEffectTime, new Date()) .le(SysOrganizationRelEnt::getEffectTime, new Date())
.ge(SysOrganizationRelEnt::getEndTime, new Date()); .ge(SysOrganizationRelEnt::getEndTime, new Date()));
List<SysOrganizationRelEnt> sysOrganizationRelEnts = sysOrganizationRelMapper.selectList(qw); if (CollUtil.isNotEmpty(sysOrganizationRelEnts)) {
if (!CollectionUtils.isEmpty(sysOrganizationRelEnts)) {
output.setOuPath(sysOrganizationRelEnts.get(0).getOuIdPath()); output.setOuPath(sysOrganizationRelEnts.get(0).getOuIdPath());
} }
} }
......
package pps.core.system.service; package pps.core.system.service;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
...@@ -18,7 +20,6 @@ import xstartup.annotation.XText; ...@@ -18,7 +20,6 @@ import xstartup.annotation.XText;
import xstartup.base.XContext; import xstartup.base.XContext;
import xstartup.base.data.CustomQueryInput; import xstartup.base.data.CustomQueryInput;
import xstartup.base.util.XCopyUtils; import xstartup.base.util.XCopyUtils;
import xstartup.base.util.XStringUtils;
import xstartup.data.XListResult; import xstartup.data.XListResult;
import xstartup.data.XPageResult; import xstartup.data.XPageResult;
import xstartup.data.XServiceResult; import xstartup.data.XServiceResult;
...@@ -47,12 +48,12 @@ public class SysOrganizationPropertyService { ...@@ -47,12 +48,12 @@ public class SysOrganizationPropertyService {
mediaTypesInput.setAlias("MEDIUM_TYPE"); mediaTypesInput.setAlias("MEDIUM_TYPE");
XListResult<QuerySysDictionaryViewOutput> mediaTypes = dictService.querySysDictionarysByAlias(context, mediaTypesInput); XListResult<QuerySysDictionaryViewOutput> mediaTypes = dictService.querySysDictionarysByAlias(context, mediaTypesInput);
List<QuerySysDictionaryViewOutput> mediaTypesResult = mediaTypes.getResult(); List<QuerySysDictionaryViewOutput> mediaTypesResult = mediaTypes.getResult();
if (XStringUtils.isEmpty(input.getOuId())) { if (CharSequenceUtil.isBlank(input.getOuId())) {
PpsUserSession session = context.getSession(PpsUserSession.class); PpsUserSession session = context.getSession(PpsUserSession.class);
if (BusinessConstant.ZERO.equals(session.getIsSuperAdmin())) { if (BusinessConstant.ZERO.equals(session.getIsSuperAdmin())) {
queryWrapper.lambda().eq(SysOrganizationPropertyEnt::getOuId, session.getOuId()) queryWrapper.lambda().eq(SysOrganizationPropertyEnt::getOuId, session.getOuId())
.le(true, SysOrganizationPropertyEnt::getEffectTime, date) .le(SysOrganizationPropertyEnt::getEffectTime, date)
.ge(true, SysOrganizationPropertyEnt::getEndTime, date); .ge(SysOrganizationPropertyEnt::getEndTime, date);
} else { } else {
List<GetSysOrganizationPropertyOutput> list = new ArrayList<>(); List<GetSysOrganizationPropertyOutput> list = new ArrayList<>();
for (QuerySysDictionaryViewOutput viewOutput : mediaTypesResult) { for (QuerySysDictionaryViewOutput viewOutput : mediaTypesResult) {
...@@ -65,8 +66,8 @@ public class SysOrganizationPropertyService { ...@@ -65,8 +66,8 @@ public class SysOrganizationPropertyService {
} }
} else { } else {
queryWrapper.lambda().eq(SysOrganizationPropertyEnt::getOuId, input.getOuId()) queryWrapper.lambda().eq(SysOrganizationPropertyEnt::getOuId, input.getOuId())
.le(true, SysOrganizationPropertyEnt::getEffectTime, date) .le(SysOrganizationPropertyEnt::getEffectTime, date)
.ge(true, SysOrganizationPropertyEnt::getEndTime, date); .ge(SysOrganizationPropertyEnt::getEndTime, date);
} }
List<SysOrganizationPropertyEnt> propertyEnts = mapper.selectList(queryWrapper); List<SysOrganizationPropertyEnt> propertyEnts = mapper.selectList(queryWrapper);
List<GetSysOrganizationPropertyOutput> outputs = XCopyUtils.copyNewList(propertyEnts, GetSysOrganizationPropertyOutput.class); List<GetSysOrganizationPropertyOutput> outputs = XCopyUtils.copyNewList(propertyEnts, GetSysOrganizationPropertyOutput.class);
...@@ -107,10 +108,10 @@ public class SysOrganizationPropertyService { ...@@ -107,10 +108,10 @@ public class SysOrganizationPropertyService {
@XApiPost @XApiPost
public XServiceResult updateSysOrganizationProperty(XContext context, UpdateSysOrganizationPropertyInput input) { public XServiceResult updateSysOrganizationProperty(XContext context, UpdateSysOrganizationPropertyInput input) {
SysOrganizationPropertyMapper mapper = context.getBean(SysOrganizationPropertyMapper.class); SysOrganizationPropertyMapper mapper = context.getBean(SysOrganizationPropertyMapper.class);
QueryWrapper<SysOrganizationPropertyEnt> queryWrapper = new QueryWrapper<>(); SysOrganizationPropertyEnt entity = mapper.selectOne(new QueryWrapper<SysOrganizationPropertyEnt>()
queryWrapper.lambda().eq(SysOrganizationPropertyEnt::getId, input.getId()); .lambda()
SysOrganizationPropertyEnt entity = mapper.selectOne(queryWrapper); .eq(SysOrganizationPropertyEnt::getId, input.getId()));
if (entity == null) { if (ObjectUtil.isNull(entity)) {
return XServiceResult.error(context, XError.NotFound); return XServiceResult.error(context, XError.NotFound);
} }
XCopyUtils.copyObject(input, entity); XCopyUtils.copyObject(input, entity);
...@@ -121,10 +122,10 @@ public class SysOrganizationPropertyService { ...@@ -121,10 +122,10 @@ public class SysOrganizationPropertyService {
@XApiPost @XApiPost
public XServiceResult deleteSysOrganizationProperty(XContext context, DeleteSysOrganizationPropertyInput input) { public XServiceResult deleteSysOrganizationProperty(XContext context, DeleteSysOrganizationPropertyInput input) {
SysOrganizationPropertyMapper mapper = context.getBean(SysOrganizationPropertyMapper.class); SysOrganizationPropertyMapper mapper = context.getBean(SysOrganizationPropertyMapper.class);
QueryWrapper<SysOrganizationPropertyEnt> queryWrapper = new QueryWrapper<>(); SysOrganizationPropertyEnt entity = mapper.selectOne(new QueryWrapper<SysOrganizationPropertyEnt>()
queryWrapper.lambda().eq(SysOrganizationPropertyEnt::getId, input.getId()); .lambda()
SysOrganizationPropertyEnt entity = mapper.selectOne(queryWrapper); .eq(SysOrganizationPropertyEnt::getId, input.getId()));
if (entity == null) { if (ObjectUtil.isNull(entity)) {
return XServiceResult.error(context, XError.NotFound); return XServiceResult.error(context, XError.NotFound);
} }
mapper.deleteById(entity); mapper.deleteById(entity);
......
package pps.core.system.service; package pps.core.system.service;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
...@@ -37,10 +38,10 @@ public class SysOrganizationRelService { ...@@ -37,10 +38,10 @@ public class SysOrganizationRelService {
@XApiPost @XApiPost
public XServiceResult deleteSysOrganizationRel(XContext context, DeleteSysOrganizationRelInput input) { public XServiceResult deleteSysOrganizationRel(XContext context, DeleteSysOrganizationRelInput input) {
SysOrganizationRelMapper mapper = context.getBean(SysOrganizationRelMapper.class); SysOrganizationRelMapper mapper = context.getBean(SysOrganizationRelMapper.class);
QueryWrapper<SysOrganizationRelEnt> queryWrapper = new QueryWrapper<>(); SysOrganizationRelEnt entity = mapper.selectOne(new QueryWrapper<SysOrganizationRelEnt>()
queryWrapper.lambda().eq(SysOrganizationRelEnt::getId, input.getId()); .lambda()
SysOrganizationRelEnt entity = mapper.selectOne(queryWrapper); .eq(SysOrganizationRelEnt::getId, input.getId()));
if (entity == null) { if (ObjectUtil.isNull(entity)) {
return XServiceResult.error(context, XError.NotFound); return XServiceResult.error(context, XError.NotFound);
} }
mapper.deleteById(entity); mapper.deleteById(entity);
...@@ -50,10 +51,10 @@ public class SysOrganizationRelService { ...@@ -50,10 +51,10 @@ public class SysOrganizationRelService {
@XApiGet @XApiGet
public XSingleResult<GetSysOrganizationRelOutput> getSysOrganizationRel(XContext context, GetSysOrganizationRelInput input) { public XSingleResult<GetSysOrganizationRelOutput> getSysOrganizationRel(XContext context, GetSysOrganizationRelInput input) {
SysOrganizationRelMapper mapper = context.getBean(SysOrganizationRelMapper.class); SysOrganizationRelMapper mapper = context.getBean(SysOrganizationRelMapper.class);
QueryWrapper<SysOrganizationRelEnt> queryWrapper = new QueryWrapper<>(); SysOrganizationRelEnt entity = mapper.selectOne(new QueryWrapper<SysOrganizationRelEnt>()
queryWrapper.lambda().eq(SysOrganizationRelEnt::getId, input.getId()); .lambda()
SysOrganizationRelEnt entity = mapper.selectOne(queryWrapper); .eq(SysOrganizationRelEnt::getId, input.getId()));
if (entity == null) { if (ObjectUtil.isNull(entity)) {
return XSingleResult.error(context, XError.NotFound); return XSingleResult.error(context, XError.NotFound);
} }
GetSysOrganizationRelOutput output = new GetSysOrganizationRelOutput(); GetSysOrganizationRelOutput output = new GetSysOrganizationRelOutput();
...@@ -95,7 +96,7 @@ public class SysOrganizationRelService { ...@@ -95,7 +96,7 @@ public class SysOrganizationRelService {
SysOrganizationRelView record = new SysOrganizationRelView(); SysOrganizationRelView record = new SysOrganizationRelView();
XCopyUtils.copyObject(input, record); XCopyUtils.copyObject(input, record);
SysOrganizationRelView view = mapper.selectOne(record); SysOrganizationRelView view = mapper.selectOne(record);
if (view == null) { if (ObjectUtil.isNull(view)) {
return XSingleResult.error(context, XError.NotFound); return XSingleResult.error(context, XError.NotFound);
} }
GetSysOrganizationRelViewOutput output = new GetSysOrganizationRelViewOutput(); GetSysOrganizationRelViewOutput output = new GetSysOrganizationRelViewOutput();
......
package pps.core.system.service; package pps.core.system.service;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import org.springframework.util.CollectionUtils;
import pps.core.common.session.PpsUserSession; import pps.core.common.session.PpsUserSession;
import pps.core.system.entity.SysRoleMenuAuthEnt; import pps.core.system.entity.SysRoleMenuAuthEnt;
import pps.core.system.entity.SysRoleMenuAuthView; import pps.core.system.entity.SysRoleMenuAuthView;
...@@ -42,33 +43,29 @@ public class SysRoleMenuAuthService { ...@@ -42,33 +43,29 @@ public class SysRoleMenuAuthService {
return XTransactionHelper.begin(context, () -> { return XTransactionHelper.begin(context, () -> {
//删除原关系 //删除原关系
SysRoleMenuAuthMapper mapper = context.getBean(SysRoleMenuAuthMapper.class); SysRoleMenuAuthMapper mapper = context.getBean(SysRoleMenuAuthMapper.class);
QueryWrapper<SysRoleMenuAuthEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SysRoleMenuAuthEnt::getRoleId, input.getRoleId());
PageHelper.startPage(1, 1000); PageHelper.startPage(1, 1000);
List<SysRoleMenuAuthEnt> sysUserRoleRelEnts = mapper.selectList(queryWrapper); List<SysRoleMenuAuthEnt> sysUserRoleRelEnts = mapper.selectList(new QueryWrapper<SysRoleMenuAuthEnt>()
if (!CollectionUtils.isEmpty(sysUserRoleRelEnts)) { .lambda()
List<String> collect = sysUserRoleRelEnts.stream().map(SysRoleMenuAuthEnt::getId).collect(Collectors.toList()); .eq(SysRoleMenuAuthEnt::getRoleId, input.getRoleId()));
mapper.deleteBatchIds(collect); if (CollUtil.isNotEmpty(sysUserRoleRelEnts)) {
mapper.deleteBatchIds(sysUserRoleRelEnts.stream().map(SysRoleMenuAuthEnt::getId).collect(Collectors.toList()));
} }
//创建新关系 //创建新关系
PpsUserSession session = context.getSession(PpsUserSession.class);
SysRoleMenuAuthViewMapper viewMapper = context.getBean(SysRoleMenuAuthViewMapper.class); SysRoleMenuAuthViewMapper viewMapper = context.getBean(SysRoleMenuAuthViewMapper.class);
List<String> menuIdList = input.getMenuIds();
Date now = new Date(); Date now = new Date();
List<SysRoleMenuAuthView> viewList = new ArrayList<>(); List<SysRoleMenuAuthView> viewList = new ArrayList<>();
for (String menuId : menuIdList) { for (String menuId : input.getMenuIds()) {
SysRoleMenuAuthView entity = new SysRoleMenuAuthView(); SysRoleMenuAuthView entity = new SysRoleMenuAuthView();
entity.setId(UUID.randomUUID().toString()); entity.setId(UUID.randomUUID().toString());
entity.setMenuId(menuId); entity.setMenuId(menuId);
entity.setRoleId(input.getRoleId()); entity.setRoleId(input.getRoleId());
PpsUserSession session = context.getSession(PpsUserSession.class);
if (session != null) {
entity.setCreateById(session.getId()); entity.setCreateById(session.getId());
entity.setCreateByName(session.getUserName()); entity.setCreateByName(session.getUserName());
}
entity.setCreateTime(now); entity.setCreateTime(now);
viewList.add(entity); viewList.add(entity);
} }
if (!CollectionUtils.isEmpty(viewList)) { if (CollUtil.isNotEmpty(viewList)) {
viewMapper.batchInsert(viewList); viewMapper.batchInsert(viewList);
} }
//返回执行成功的结果,事务提交 //返回执行成功的结果,事务提交
...@@ -94,7 +91,7 @@ public class SysRoleMenuAuthService { ...@@ -94,7 +91,7 @@ public class SysRoleMenuAuthService {
QueryWrapper<SysRoleMenuAuthEnt> queryWrapper = new QueryWrapper<>(); QueryWrapper<SysRoleMenuAuthEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SysRoleMenuAuthEnt::getId, input.getId()); queryWrapper.lambda().eq(SysRoleMenuAuthEnt::getId, input.getId());
SysRoleMenuAuthEnt entity = mapper.selectOne(queryWrapper); SysRoleMenuAuthEnt entity = mapper.selectOne(queryWrapper);
if (entity == null) { if (ObjectUtil.isNull(entity)) {
return XServiceResult.error(context, XError.NotFound); return XServiceResult.error(context, XError.NotFound);
} }
XCopyUtils.copyObject(input, entity); XCopyUtils.copyObject(input, entity);
...@@ -105,10 +102,10 @@ public class SysRoleMenuAuthService { ...@@ -105,10 +102,10 @@ public class SysRoleMenuAuthService {
@XApiPost @XApiPost
public XServiceResult deleteSysRoleMenuAuth(XContext context, DeleteSysRoleMenuAuthInput input) { public XServiceResult deleteSysRoleMenuAuth(XContext context, DeleteSysRoleMenuAuthInput input) {
SysRoleMenuAuthMapper mapper = context.getBean(SysRoleMenuAuthMapper.class); SysRoleMenuAuthMapper mapper = context.getBean(SysRoleMenuAuthMapper.class);
QueryWrapper<SysRoleMenuAuthEnt> queryWrapper = new QueryWrapper<>(); SysRoleMenuAuthEnt entity = mapper.selectOne(new QueryWrapper<SysRoleMenuAuthEnt>()
queryWrapper.lambda().eq(SysRoleMenuAuthEnt::getId, input.getId()); .lambda()
SysRoleMenuAuthEnt entity = mapper.selectOne(queryWrapper); .eq(SysRoleMenuAuthEnt::getId, input.getId()));
if (entity == null) { if (ObjectUtil.isNull(entity)) {
return XServiceResult.error(context, XError.NotFound); return XServiceResult.error(context, XError.NotFound);
} }
mapper.deleteById(entity); mapper.deleteById(entity);
...@@ -118,10 +115,10 @@ public class SysRoleMenuAuthService { ...@@ -118,10 +115,10 @@ public class SysRoleMenuAuthService {
@XApiGet @XApiGet
public XSingleResult<GetSysRoleMenuAuthOutput> getSysRoleMenuAuth(XContext context, GetSysRoleMenuAuthInput input) { public XSingleResult<GetSysRoleMenuAuthOutput> getSysRoleMenuAuth(XContext context, GetSysRoleMenuAuthInput input) {
SysRoleMenuAuthMapper mapper = context.getBean(SysRoleMenuAuthMapper.class); SysRoleMenuAuthMapper mapper = context.getBean(SysRoleMenuAuthMapper.class);
QueryWrapper<SysRoleMenuAuthEnt> queryWrapper = new QueryWrapper<>(); SysRoleMenuAuthEnt entity = mapper.selectOne(new QueryWrapper<SysRoleMenuAuthEnt>()
queryWrapper.lambda().eq(SysRoleMenuAuthEnt::getId, input.getId()); .lambda()
SysRoleMenuAuthEnt entity = mapper.selectOne(queryWrapper); .eq(SysRoleMenuAuthEnt::getId, input.getId()));
if (entity == null) { if (ObjectUtil.isNull(entity)) {
return XSingleResult.error(context, XError.NotFound); return XSingleResult.error(context, XError.NotFound);
} }
GetSysRoleMenuAuthOutput output = new GetSysRoleMenuAuthOutput(); GetSysRoleMenuAuthOutput output = new GetSysRoleMenuAuthOutput();
...@@ -157,7 +154,7 @@ public class SysRoleMenuAuthService { ...@@ -157,7 +154,7 @@ public class SysRoleMenuAuthService {
SysRoleMenuAuthView record = new SysRoleMenuAuthView(); SysRoleMenuAuthView record = new SysRoleMenuAuthView();
XCopyUtils.copyObject(input, record); XCopyUtils.copyObject(input, record);
SysRoleMenuAuthView view = mapper.selectOne(record); SysRoleMenuAuthView view = mapper.selectOne(record);
if (view == null) { if (ObjectUtil.isNull(view)) {
return XSingleResult.error(context, XError.NotFound); return XSingleResult.error(context, XError.NotFound);
} }
GetSysRoleMenuAuthViewOutput output = new GetSysRoleMenuAuthViewOutput(); GetSysRoleMenuAuthViewOutput output = new GetSysRoleMenuAuthViewOutput();
......
package pps.core.system.service; package pps.core.system.service;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
...@@ -37,10 +38,10 @@ public class SysUserGroupRoleRelService { ...@@ -37,10 +38,10 @@ public class SysUserGroupRoleRelService {
@XApiPost @XApiPost
public XServiceResult updateSysUserGroupRoleRel(XContext context, UpdateSysUserGroupRoleRelInput input) { public XServiceResult updateSysUserGroupRoleRel(XContext context, UpdateSysUserGroupRoleRelInput input) {
SysUserGroupRoleRelMapper mapper = context.getBean(SysUserGroupRoleRelMapper.class); SysUserGroupRoleRelMapper mapper = context.getBean(SysUserGroupRoleRelMapper.class);
QueryWrapper<SysUserGroupRoleRelEnt> queryWrapper = new QueryWrapper<>(); SysUserGroupRoleRelEnt entity = mapper.selectOne(new QueryWrapper<SysUserGroupRoleRelEnt>()
queryWrapper.lambda().eq(SysUserGroupRoleRelEnt::getId, input.getId()); .lambda()
SysUserGroupRoleRelEnt entity = mapper.selectOne(queryWrapper); .eq(SysUserGroupRoleRelEnt::getId, input.getId()));
if (entity == null) { if (ObjectUtil.isNull(entity)) {
return XServiceResult.error(context, XError.NotFound); return XServiceResult.error(context, XError.NotFound);
} }
XCopyUtils.copyObject(input, entity); XCopyUtils.copyObject(input, entity);
...@@ -51,10 +52,10 @@ public class SysUserGroupRoleRelService { ...@@ -51,10 +52,10 @@ public class SysUserGroupRoleRelService {
@XApiPost @XApiPost
public XServiceResult deleteSysUserGroupRoleRel(XContext context, DeleteSysUserGroupRoleRelInput input) { public XServiceResult deleteSysUserGroupRoleRel(XContext context, DeleteSysUserGroupRoleRelInput input) {
SysUserGroupRoleRelMapper mapper = context.getBean(SysUserGroupRoleRelMapper.class); SysUserGroupRoleRelMapper mapper = context.getBean(SysUserGroupRoleRelMapper.class);
QueryWrapper<SysUserGroupRoleRelEnt> queryWrapper = new QueryWrapper<>(); SysUserGroupRoleRelEnt entity = mapper.selectOne(new QueryWrapper<SysUserGroupRoleRelEnt>()
queryWrapper.lambda().eq(SysUserGroupRoleRelEnt::getId, input.getId()); .lambda()
SysUserGroupRoleRelEnt entity = mapper.selectOne(queryWrapper); .eq(SysUserGroupRoleRelEnt::getId, input.getId()));
if (entity == null) { if (ObjectUtil.isNull(entity)) {
return XServiceResult.error(context, XError.NotFound); return XServiceResult.error(context, XError.NotFound);
} }
mapper.deleteById(entity); mapper.deleteById(entity);
...@@ -64,10 +65,10 @@ public class SysUserGroupRoleRelService { ...@@ -64,10 +65,10 @@ public class SysUserGroupRoleRelService {
@XApiPost @XApiPost
public XSingleResult<GetSysUserGroupRoleRelOutput> getSysUserGroupRoleRel(XContext context, GetSysUserGroupRoleRelInput input) { public XSingleResult<GetSysUserGroupRoleRelOutput> getSysUserGroupRoleRel(XContext context, GetSysUserGroupRoleRelInput input) {
SysUserGroupRoleRelMapper mapper = context.getBean(SysUserGroupRoleRelMapper.class); SysUserGroupRoleRelMapper mapper = context.getBean(SysUserGroupRoleRelMapper.class);
QueryWrapper<SysUserGroupRoleRelEnt> queryWrapper = new QueryWrapper<>(); SysUserGroupRoleRelEnt entity = mapper.selectOne(new QueryWrapper<SysUserGroupRoleRelEnt>()
queryWrapper.lambda().eq(SysUserGroupRoleRelEnt::getId, input.getId()); .lambda().
SysUserGroupRoleRelEnt entity = mapper.selectOne(queryWrapper); eq(SysUserGroupRoleRelEnt::getId, input.getId()));
if (entity == null) { if (ObjectUtil.isNull(entity)) {
return XSingleResult.error(context, XError.NotFound); return XSingleResult.error(context, XError.NotFound);
} }
GetSysUserGroupRoleRelOutput output = new GetSysUserGroupRoleRelOutput(); GetSysUserGroupRoleRelOutput output = new GetSysUserGroupRoleRelOutput();
...@@ -103,7 +104,7 @@ public class SysUserGroupRoleRelService { ...@@ -103,7 +104,7 @@ public class SysUserGroupRoleRelService {
SysUserGroupRoleRelView record = new SysUserGroupRoleRelView(); SysUserGroupRoleRelView record = new SysUserGroupRoleRelView();
XCopyUtils.copyObject(input, record); XCopyUtils.copyObject(input, record);
SysUserGroupRoleRelView view = mapper.selectOne(record); SysUserGroupRoleRelView view = mapper.selectOne(record);
if (view == null) { if (ObjectUtil.isNull(view)) {
return XSingleResult.error(context, XError.NotFound); return XSingleResult.error(context, XError.NotFound);
} }
GetSysUserGroupRoleRelViewOutput output = new GetSysUserGroupRoleRelViewOutput(); GetSysUserGroupRoleRelViewOutput output = new GetSysUserGroupRoleRelViewOutput();
......
package pps.core.system.service; package pps.core.system.service;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
...@@ -36,10 +37,10 @@ public class SysUserOrganizationRelService { ...@@ -36,10 +37,10 @@ public class SysUserOrganizationRelService {
@XApiPost @XApiPost
public XServiceResult updateSysUserOrganizationRel(XContext context, UpdateSysUserOrganizationRelInput input) { public XServiceResult updateSysUserOrganizationRel(XContext context, UpdateSysUserOrganizationRelInput input) {
SysUserOrganizationRelMapper mapper = context.getBean(SysUserOrganizationRelMapper.class); SysUserOrganizationRelMapper mapper = context.getBean(SysUserOrganizationRelMapper.class);
QueryWrapper<SysUserOrganizationRelEnt> queryWrapper = new QueryWrapper<>(); SysUserOrganizationRelEnt entity = mapper.selectOne(new QueryWrapper<SysUserOrganizationRelEnt>()
queryWrapper.lambda().eq(SysUserOrganizationRelEnt::getId, input.getId()); .lambda()
SysUserOrganizationRelEnt entity = mapper.selectOne(queryWrapper); .eq(SysUserOrganizationRelEnt::getId, input.getId()));
if (entity == null) { if (ObjectUtil.isNull(entity)) {
return XServiceResult.error(context, XError.NotFound); return XServiceResult.error(context, XError.NotFound);
} }
XCopyUtils.copyObject(input, entity); XCopyUtils.copyObject(input, entity);
...@@ -50,10 +51,10 @@ public class SysUserOrganizationRelService { ...@@ -50,10 +51,10 @@ public class SysUserOrganizationRelService {
@XApiPost @XApiPost
public XServiceResult deleteSysUserOrganizationRel(XContext context, DeleteSysUserOrganizationRelInput input) { public XServiceResult deleteSysUserOrganizationRel(XContext context, DeleteSysUserOrganizationRelInput input) {
SysUserOrganizationRelMapper mapper = context.getBean(SysUserOrganizationRelMapper.class); SysUserOrganizationRelMapper mapper = context.getBean(SysUserOrganizationRelMapper.class);
QueryWrapper<SysUserOrganizationRelEnt> queryWrapper = new QueryWrapper<>(); SysUserOrganizationRelEnt entity = mapper.selectOne(new QueryWrapper<SysUserOrganizationRelEnt>()
queryWrapper.lambda().eq(SysUserOrganizationRelEnt::getId, input.getId()); .lambda()
SysUserOrganizationRelEnt entity = mapper.selectOne(queryWrapper); .eq(SysUserOrganizationRelEnt::getId, input.getId()));
if (entity == null) { if (ObjectUtil.isNull(entity)) {
return XServiceResult.error(context, XError.NotFound); return XServiceResult.error(context, XError.NotFound);
} }
mapper.deleteById(entity); mapper.deleteById(entity);
...@@ -66,7 +67,7 @@ public class SysUserOrganizationRelService { ...@@ -66,7 +67,7 @@ public class SysUserOrganizationRelService {
QueryWrapper<SysUserOrganizationRelEnt> queryWrapper = new QueryWrapper<>(); QueryWrapper<SysUserOrganizationRelEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SysUserOrganizationRelEnt::getId, input.getId()); queryWrapper.lambda().eq(SysUserOrganizationRelEnt::getId, input.getId());
SysUserOrganizationRelEnt entity = mapper.selectOne(queryWrapper); SysUserOrganizationRelEnt entity = mapper.selectOne(queryWrapper);
if (entity == null) { if (ObjectUtil.isNull(entity)) {
return XSingleResult.error(context, XError.NotFound); return XSingleResult.error(context, XError.NotFound);
} }
GetSysUserOrganizationRelOutput output = new GetSysUserOrganizationRelOutput(); GetSysUserOrganizationRelOutput output = new GetSysUserOrganizationRelOutput();
...@@ -102,7 +103,7 @@ public class SysUserOrganizationRelService { ...@@ -102,7 +103,7 @@ public class SysUserOrganizationRelService {
SysUserOrganizationRelView record = new SysUserOrganizationRelView(); SysUserOrganizationRelView record = new SysUserOrganizationRelView();
XCopyUtils.copyObject(input, record); XCopyUtils.copyObject(input, record);
SysUserOrganizationRelView view = mapper.selectOne(record); SysUserOrganizationRelView view = mapper.selectOne(record);
if (view == null) { if (ObjectUtil.isNull(view)) {
return XSingleResult.error(context, XError.NotFound); return XSingleResult.error(context, XError.NotFound);
} }
GetSysUserOrganizationRelViewOutput output = new GetSysUserOrganizationRelViewOutput(); GetSysUserOrganizationRelViewOutput output = new GetSysUserOrganizationRelViewOutput();
......
package pps.core.system.service; package pps.core.system.service;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.text.CharSequenceUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import org.springframework.util.CollectionUtils;
import pps.core.common.constant.BusinessConstant; import pps.core.common.constant.BusinessConstant;
import pps.core.common.session.PpsUserSession; import pps.core.common.session.PpsUserSession;
import pps.core.system.entity.SysOrganizationView; import pps.core.system.entity.SysOrganizationView;
...@@ -18,7 +19,6 @@ import xstartup.annotation.XText; ...@@ -18,7 +19,6 @@ import xstartup.annotation.XText;
import xstartup.base.XContext; import xstartup.base.XContext;
import xstartup.base.exception.XServiceException; import xstartup.base.exception.XServiceException;
import xstartup.base.util.XCopyUtils; import xstartup.base.util.XCopyUtils;
import xstartup.base.util.XStringUtils;
import xstartup.data.XListResult; import xstartup.data.XListResult;
import xstartup.data.XPageResult; import xstartup.data.XPageResult;
import xstartup.data.XServiceResult; import xstartup.data.XServiceResult;
...@@ -42,30 +42,29 @@ public class SysUserRoleRelService { ...@@ -42,30 +42,29 @@ public class SysUserRoleRelService {
return XTransactionHelper.begin(context, () -> { return XTransactionHelper.begin(context, () -> {
//删除原关系 //删除原关系
SysUserRoleRelMapper mapper = context.getBean(SysUserRoleRelMapper.class); SysUserRoleRelMapper mapper = context.getBean(SysUserRoleRelMapper.class);
QueryWrapper<SysUserRoleRelEnt> queryWrapper = new QueryWrapper<>(); List<SysUserRoleRelEnt> sysUserRoleRelEnts = mapper.selectList(new QueryWrapper<SysUserRoleRelEnt>()
queryWrapper.lambda().eq(SysUserRoleRelEnt::getUserId, input.getUserId()); .lambda()
List<SysUserRoleRelEnt> sysUserRoleRelEnts = mapper.selectList(queryWrapper); .eq(SysUserRoleRelEnt::getUserId, input.getUserId()));
if (!CollectionUtils.isEmpty(sysUserRoleRelEnts)) { if (CollUtil.isNotEmpty(sysUserRoleRelEnts)) {
List<String> collect = sysUserRoleRelEnts.stream().map(SysUserRoleRelEnt::getId).collect(Collectors.toList()); mapper.deleteBatchIds(sysUserRoleRelEnts.stream().map(SysUserRoleRelEnt::getId).collect(Collectors.toList()));
mapper.deleteBatchIds(collect);
} }
//创建新关系 //创建新关系
SysUserRoleRelViewMapper viewMapper = context.getBean(SysUserRoleRelViewMapper.class); SysUserRoleRelViewMapper viewMapper = context.getBean(SysUserRoleRelViewMapper.class);
List<String> roleIdList = input.getRoleIdList(); List<String> roleIdList = input.getRoleIdList();
Date now = new Date(); Date now = new Date();
List<SysUserRoleRelView> viewList = new ArrayList<>(); List<SysUserRoleRelView> viewList = new ArrayList<>();
PpsUserSession session = context.getSession(PpsUserSession.class);
for (String roleId : roleIdList) { for (String roleId : roleIdList) {
SysUserRoleRelView entity = new SysUserRoleRelView(); SysUserRoleRelView entity = new SysUserRoleRelView();
entity.setId(UUID.randomUUID().toString()); entity.setId(UUID.randomUUID().toString());
entity.setUserId(input.getUserId()); entity.setUserId(input.getUserId());
entity.setRoleId(roleId); entity.setRoleId(roleId);
PpsUserSession session = context.getSession(PpsUserSession.class);
entity.setCreateById(session.getId()); entity.setCreateById(session.getId());
entity.setCreateByName(session.getUserName()); entity.setCreateByName(session.getUserName());
entity.setCreateTime(now); entity.setCreateTime(now);
viewList.add(entity); viewList.add(entity);
} }
if (!CollectionUtils.isEmpty(viewList)) { if (CollUtil.isNotEmpty(viewList)) {
viewMapper.batchInsert(viewList); viewMapper.batchInsert(viewList);
} }
//返回执行成功的结果,事务提交 //返回执行成功的结果,事务提交
...@@ -80,41 +79,40 @@ public class SysUserRoleRelService { ...@@ -80,41 +79,40 @@ public class SysUserRoleRelService {
return XTransactionHelper.begin(context, () -> { return XTransactionHelper.begin(context, () -> {
//查询原关系 //查询原关系
SysUserRoleRelMapper mapper = context.getBean(SysUserRoleRelMapper.class); SysUserRoleRelMapper mapper = context.getBean(SysUserRoleRelMapper.class);
QueryWrapper<SysUserRoleRelEnt> queryWrapper = new QueryWrapper<>(); List<SysUserRoleRelEnt> sysUserRoleRelEnts = mapper.selectList(new QueryWrapper<SysUserRoleRelEnt>()
queryWrapper.lambda().eq(SysUserRoleRelEnt::getRoleId, input.getRoleId()); .lambda()
List<String> userIds = input.getUserIdList().stream().map(SysUserRoleRelEnt::getId).collect(Collectors.toList()); .eq(SysUserRoleRelEnt::getRoleId, input.getRoleId())
queryWrapper.lambda().in(SysUserRoleRelEnt::getUserId, userIds); .in(SysUserRoleRelEnt::getUserId, input.getUserIdList().stream()
List<SysUserRoleRelEnt> sysUserRoleRelEnts = mapper.selectList(queryWrapper); .map(SysUserRoleRelEnt::getId).collect(Collectors.toList())));
//创建新关系 //创建新关系
SysUserRoleRelViewMapper viewMapper = context.getBean(SysUserRoleRelViewMapper.class); SysUserRoleRelViewMapper viewMapper = context.getBean(SysUserRoleRelViewMapper.class);
List<SysUserRoleRelEnt> userIdList = input.getUserIdList(); List<SysUserRoleRelEnt> userIdList = input.getUserIdList();
Date now = new Date(); Date now = new Date();
List<SysUserRoleRelView> viewList = new ArrayList<>(); List<SysUserRoleRelView> viewList = new ArrayList<>();
List<SysUserRoleRelEnt> entList = new ArrayList<>(); List<SysUserRoleRelEnt> entList = new ArrayList<>();
PpsUserSession session = context.getSession(PpsUserSession.class);
for (SysUserRoleRelEnt user : userIdList) { for (SysUserRoleRelEnt user : userIdList) {
SysUserRoleRelView entity = new SysUserRoleRelView(); SysUserRoleRelView entity = new SysUserRoleRelView();
entity.setId(UUID.randomUUID().toString()); entity.setId(UUID.randomUUID().toString());
entity.setUserId(user.getId()); entity.setUserId(user.getId());
entity.setRoleId(input.getRoleId()); entity.setRoleId(input.getRoleId());
PpsUserSession session = context.getSession(PpsUserSession.class);
entity.setCreateById(session.getId()); entity.setCreateById(session.getId());
entity.setCreateByName(session.getUserName()); entity.setCreateByName(session.getUserName());
entity.setCreateTime(now); entity.setCreateTime(now);
viewList.add(entity); viewList.add(entity);
//同一个用户添加多次删除调旧的 //同一个用户添加多次删除调旧的
for (SysUserRoleRelEnt roleRelEnt : sysUserRoleRelEnts) { for (SysUserRoleRelEnt roleRelEnt : sysUserRoleRelEnts) {
if (roleRelEnt.getUserId().equals(user.getId())) { if (CharSequenceUtil.equals(roleRelEnt.getUserId(), user.getId())) {
entList.add(roleRelEnt); entList.add(roleRelEnt);
break; break;
} }
} }
} }
if (!CollectionUtils.isEmpty(viewList)) { if (CollUtil.isNotEmpty(viewList)) {
viewMapper.batchInsert(viewList); viewMapper.batchInsert(viewList);
} }
if (!CollectionUtils.isEmpty(entList)) { if (CollUtil.isNotEmpty(entList)) {
List<String> collect = entList.stream().map(SysUserRoleRelEnt::getId).collect(Collectors.toList()); mapper.deleteBatchIds(entList.stream().map(SysUserRoleRelEnt::getId).collect(Collectors.toList()));
mapper.deleteBatchIds(collect);
} }
//返回执行成功的结果,事务提交 //返回执行成功的结果,事务提交
return XServiceResult.OK; return XServiceResult.OK;
...@@ -139,11 +137,9 @@ public class SysUserRoleRelService { ...@@ -139,11 +137,9 @@ public class SysUserRoleRelService {
SysUserRoleRelView record = new SysUserRoleRelView(); SysUserRoleRelView record = new SysUserRoleRelView();
XCopyUtils.copyObject(input, record); XCopyUtils.copyObject(input, record);
PageHelper.startPage(input.getPage(), input.getLimit()); PageHelper.startPage(input.getPage(), input.getLimit());
PpsUserSession session = context.getSession(PpsUserSession.class);
Integer isSuperAdmin = session.getIsSuperAdmin();
List<SysUserRoleRelView> list; List<SysUserRoleRelView> list;
record.setEndTime(new Date()); record.setEndTime(new Date());
if (XStringUtils.isNotEmpty(input.getOuId())) { if (CharSequenceUtil.isNotBlank(input.getOuId())) {
List<String> ouIds = new ArrayList<>(); List<String> ouIds = new ArrayList<>();
ouIds.add(input.getOuId()); ouIds.add(input.getOuId());
record.setOuIds(ouIds); record.setOuIds(ouIds);
...@@ -152,6 +148,8 @@ public class SysUserRoleRelService { ...@@ -152,6 +148,8 @@ public class SysUserRoleRelService {
List<QuerySysUserRoleRelViewOutput> outputs = XCopyUtils.copyNewList(pageInfo.getList(), QuerySysUserRoleRelViewOutput.class); List<QuerySysUserRoleRelViewOutput> outputs = XCopyUtils.copyNewList(pageInfo.getList(), QuerySysUserRoleRelViewOutput.class);
return XPageResult.success(outputs, input, pageInfo.getTotal()); return XPageResult.success(outputs, input, pageInfo.getTotal());
} }
PpsUserSession session = context.getSession(PpsUserSession.class);
Integer isSuperAdmin = session.getIsSuperAdmin();
if (BusinessConstant.ZERO.equals(isSuperAdmin)) { if (BusinessConstant.ZERO.equals(isSuperAdmin)) {
//查询当前用户所属组织机构的子级 //查询当前用户所属组织机构的子级
SysOrganizationViewMapper sysOrganizationViewMapper = context.getBean(SysOrganizationViewMapper.class); SysOrganizationViewMapper sysOrganizationViewMapper = context.getBean(SysOrganizationViewMapper.class);
...@@ -161,7 +159,7 @@ public class SysUserRoleRelService { ...@@ -161,7 +159,7 @@ public class SysUserRoleRelService {
sysOrganizationView.setParentOuId(session.getOuId()); sysOrganizationView.setParentOuId(session.getOuId());
List<SysOrganizationView> viewList = sysOrganizationViewMapper.selectOuSonByParentOuId(sysOrganizationView); List<SysOrganizationView> viewList = sysOrganizationViewMapper.selectOuSonByParentOuId(sysOrganizationView);
List<String> ouIds = new ArrayList<>(); List<String> ouIds = new ArrayList<>();
if (!CollectionUtils.isEmpty(viewList)) { if (CollUtil.isNotEmpty(viewList)) {
for (SysOrganizationView organizationView : viewList) { for (SysOrganizationView organizationView : viewList) {
ouIds.add(organizationView.getId()); ouIds.add(organizationView.getId());
} }
...@@ -182,12 +180,11 @@ public class SysUserRoleRelService { ...@@ -182,12 +180,11 @@ public class SysUserRoleRelService {
public XServiceResult deleteSysUserRoleRel(XContext context, DeleteSysUserRoleRelOutput input) throws XServiceException { public XServiceResult deleteSysUserRoleRel(XContext context, DeleteSysUserRoleRelOutput input) throws XServiceException {
return XTransactionHelper.begin(context, () -> { return XTransactionHelper.begin(context, () -> {
SysUserRoleRelMapper mapper = context.getBean(SysUserRoleRelMapper.class); SysUserRoleRelMapper mapper = context.getBean(SysUserRoleRelMapper.class);
QueryWrapper<SysUserRoleRelEnt> queryWrapper = new QueryWrapper<>(); List<SysUserRoleRelEnt> relEnts = mapper.selectList(new QueryWrapper<SysUserRoleRelEnt>()
queryWrapper.lambda().in(SysUserRoleRelEnt::getId, input.getIds()); .lambda()
List<SysUserRoleRelEnt> relEnts = mapper.selectList(queryWrapper); .in(SysUserRoleRelEnt::getId, input.getIds()));
if (!CollectionUtils.isEmpty(relEnts)) { if (CollUtil.isNotEmpty(relEnts)) {
List<String> collect = relEnts.stream().map(SysUserRoleRelEnt::getId).collect(Collectors.toList()); mapper.deleteBatchIds(relEnts.stream().map(SysUserRoleRelEnt::getId).collect(Collectors.toList()));
mapper.deleteBatchIds(collect);
} }
//返回执行成功的结果,事务提交 //返回执行成功的结果,事务提交
return XServiceResult.OK; return XServiceResult.OK;
......
...@@ -26,9 +26,9 @@ public class SysUserRoleRelServiceImpl implements SystemUserRoleRelService { ...@@ -26,9 +26,9 @@ public class SysUserRoleRelServiceImpl implements SystemUserRoleRelService {
@XText("获取用户角色") @XText("获取用户角色")
public XListResult<GetSysUserRoleRelOutput> getSysRoleByUserId(XContext context, GetSysUserRoleRelInput input) { public XListResult<GetSysUserRoleRelOutput> getSysRoleByUserId(XContext context, GetSysUserRoleRelInput input) {
SysUserRoleRelMapper mapper = context.getBean(SysUserRoleRelMapper.class); SysUserRoleRelMapper mapper = context.getBean(SysUserRoleRelMapper.class);
QueryWrapper<SysUserRoleRelEnt> queryWrapper = new QueryWrapper<>(); List<SysUserRoleRelEnt> list = mapper.selectList(new QueryWrapper<SysUserRoleRelEnt>()
queryWrapper.lambda().eq(SysUserRoleRelEnt::getUserId, input.getUserId()); .lambda()
List<SysUserRoleRelEnt> list = mapper.selectList(queryWrapper); .eq(SysUserRoleRelEnt::getUserId, input.getUserId()));
List<GetSysUserRoleRelOutput> outputs = XCopyUtils.copyNewList(list, GetSysUserRoleRelOutput.class); List<GetSysUserRoleRelOutput> outputs = XCopyUtils.copyNewList(list, GetSysUserRoleRelOutput.class);
return XListResult.success(outputs); return XListResult.success(outputs);
} }
......
package pps.core.system.service; package pps.core.system.service;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.text.CharSequenceUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.CollectionUtils;
import pps.core.common.session.PpsUserSession; import pps.core.common.session.PpsUserSession;
import pps.core.system.entity.SysUserWithUserGroupRelEnt; import pps.core.system.entity.SysUserWithUserGroupRelEnt;
import pps.core.system.entity.SysUserWithUserGroupRelView; import pps.core.system.entity.SysUserWithUserGroupRelView;
...@@ -47,16 +47,15 @@ public class SysUserWithUserGroupRelService { ...@@ -47,16 +47,15 @@ public class SysUserWithUserGroupRelService {
SysUserWithUserGroupRelViewMapper userWithUserGroupRelViewMapper = context.getBean(SysUserWithUserGroupRelViewMapper.class); SysUserWithUserGroupRelViewMapper userWithUserGroupRelViewMapper = context.getBean(SysUserWithUserGroupRelViewMapper.class);
//删除原关系 //删除原关系
QueryWrapper<SysUserWithUserGroupRelEnt> queryWrapper = new QueryWrapper<>(); QueryWrapper<SysUserWithUserGroupRelEnt> queryWrapper = new QueryWrapper<>();
if (StringUtils.equals("1", input.getType())) { if (CharSequenceUtil.equals("1", input.getType())) {
queryWrapper.lambda().eq(SysUserWithUserGroupRelEnt::getUserGroupId, input.getUserGroupId()); queryWrapper.lambda().eq(SysUserWithUserGroupRelEnt::getUserGroupId, input.getUserGroupId());
} else { } else {
queryWrapper.lambda().eq(SysUserWithUserGroupRelEnt::getUserId, input.getUserId()); queryWrapper.lambda().eq(SysUserWithUserGroupRelEnt::getUserId, input.getUserId());
} }
PageHelper.startPage(1, 1000); PageHelper.startPage(1, 1000);
List<SysUserWithUserGroupRelEnt> sysAuthOuScopeEnts = userGroupWithRole.selectList(queryWrapper); List<SysUserWithUserGroupRelEnt> sysAuthOuScopeEnts = userGroupWithRole.selectList(queryWrapper);
if (!CollectionUtils.isEmpty(sysAuthOuScopeEnts)) { if (CollUtil.isNotEmpty(sysAuthOuScopeEnts)) {
List<String> collect = sysAuthOuScopeEnts.stream().map(SysUserWithUserGroupRelEnt::getId).collect(Collectors.toList()); userGroupWithRole.deleteBatchIds(sysAuthOuScopeEnts.stream().map(SysUserWithUserGroupRelEnt::getId).collect(Collectors.toList()));
userGroupWithRole.deleteBatchIds(collect);
} }
//创建新关系 //创建新关系
Date now = new Date(); Date now = new Date();
...@@ -64,7 +63,7 @@ public class SysUserWithUserGroupRelService { ...@@ -64,7 +63,7 @@ public class SysUserWithUserGroupRelService {
List<SysUserWithUserGroupRelView> viewList = new ArrayList<>(); List<SysUserWithUserGroupRelView> viewList = new ArrayList<>();
for (String groupId : groupIdList) { for (String groupId : groupIdList) {
SysUserWithUserGroupRelView entity = new SysUserWithUserGroupRelView(); SysUserWithUserGroupRelView entity = new SysUserWithUserGroupRelView();
if (StringUtils.equals("1", input.getType())) { if (CharSequenceUtil.equals("1", input.getType())) {
entity.setUserId(groupId); entity.setUserId(groupId);
entity.setUserGroupId(input.getUserGroupId()); entity.setUserGroupId(input.getUserGroupId());
} else { } else {
...@@ -78,7 +77,7 @@ public class SysUserWithUserGroupRelService { ...@@ -78,7 +77,7 @@ public class SysUserWithUserGroupRelService {
entity.setCreateTime(now); entity.setCreateTime(now);
viewList.add(entity); viewList.add(entity);
} }
if (!CollectionUtils.isEmpty(viewList)) { if (CollUtil.isNotEmpty(viewList)) {
userWithUserGroupRelViewMapper.batchInsert(viewList); userWithUserGroupRelViewMapper.batchInsert(viewList);
} }
return XServiceResult.OK; return XServiceResult.OK;
...@@ -88,13 +87,12 @@ public class SysUserWithUserGroupRelService { ...@@ -88,13 +87,12 @@ public class SysUserWithUserGroupRelService {
public XServiceResult createSysUserWithUserGroupRel(XContext context, CreateSysUserWithUserGroupRelInput input) { public XServiceResult createSysUserWithUserGroupRel(XContext context, CreateSysUserWithUserGroupRelInput input) {
//删除原关系 //删除原关系
SysUserWithUserGroupRelMapper delMapper = context.getBean(SysUserWithUserGroupRelMapper.class); SysUserWithUserGroupRelMapper delMapper = context.getBean(SysUserWithUserGroupRelMapper.class);
QueryWrapper<SysUserWithUserGroupRelEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SysUserWithUserGroupRelEnt::getUserId, input.getUserId());
PageHelper.startPage(1, 1000); PageHelper.startPage(1, 1000);
List<SysUserWithUserGroupRelEnt> sysUserGroupEnts = delMapper.selectList(queryWrapper); List<SysUserWithUserGroupRelEnt> sysUserGroupEnts = delMapper.selectList(new QueryWrapper<SysUserWithUserGroupRelEnt>()
if (!CollectionUtils.isEmpty(sysUserGroupEnts)) { .lambda()
List<String> collect = sysUserGroupEnts.stream().map(SysUserWithUserGroupRelEnt::getId).collect(Collectors.toList()); .eq(SysUserWithUserGroupRelEnt::getUserId, input.getUserId()));
delMapper.deleteBatchIds(collect); if (CollUtil.isNotEmpty(sysUserGroupEnts)) {
delMapper.deleteBatchIds(sysUserGroupEnts.stream().map(SysUserWithUserGroupRelEnt::getId).collect(Collectors.toList()));
} }
SysUserWithUserGroupRelMapper mapper = context.getBean(SysUserWithUserGroupRelMapper.class); SysUserWithUserGroupRelMapper mapper = context.getBean(SysUserWithUserGroupRelMapper.class);
List<SysUserWithUserGroupRelEnt> list = new ArrayList<>(); List<SysUserWithUserGroupRelEnt> list = new ArrayList<>();
...@@ -113,13 +111,12 @@ public class SysUserWithUserGroupRelService { ...@@ -113,13 +111,12 @@ public class SysUserWithUserGroupRelService {
public XServiceResult createSysUserGroupWithUserRel(XContext context, CreateSysUserGroupWithUserRelInput input) { public XServiceResult createSysUserGroupWithUserRel(XContext context, CreateSysUserGroupWithUserRelInput input) {
//删除原关系 //删除原关系
SysUserWithUserGroupRelMapper delMapper = context.getBean(SysUserWithUserGroupRelMapper.class); SysUserWithUserGroupRelMapper delMapper = context.getBean(SysUserWithUserGroupRelMapper.class);
QueryWrapper<SysUserWithUserGroupRelEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SysUserWithUserGroupRelEnt::getUserGroupId, input.getUserGroupId());
PageHelper.startPage(1, 1000); PageHelper.startPage(1, 1000);
List<SysUserWithUserGroupRelEnt> sysUserGroupEnts = delMapper.selectList(queryWrapper); List<SysUserWithUserGroupRelEnt> sysUserGroupEnts = delMapper.selectList(new QueryWrapper<SysUserWithUserGroupRelEnt>()
if (!CollectionUtils.isEmpty(sysUserGroupEnts)) { .lambda()
List<String> collect = sysUserGroupEnts.stream().map(SysUserWithUserGroupRelEnt::getId).collect(Collectors.toList()); .eq(SysUserWithUserGroupRelEnt::getUserGroupId, input.getUserGroupId()));
delMapper.deleteBatchIds(collect); if (CollUtil.isNotEmpty(sysUserGroupEnts)) {
delMapper.deleteBatchIds(sysUserGroupEnts.stream().map(SysUserWithUserGroupRelEnt::getId).collect(Collectors.toList()));
} }
SysUserWithUserGroupRelMapper mapper = context.getBean(SysUserWithUserGroupRelMapper.class); SysUserWithUserGroupRelMapper mapper = context.getBean(SysUserWithUserGroupRelMapper.class);
List<SysUserWithUserGroupRelEnt> list = new ArrayList<>(); List<SysUserWithUserGroupRelEnt> list = new ArrayList<>();
......
package pps.core.system.service; package pps.core.system.service;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.apache.commons.lang3.StringUtils;
import pps.cloud.system.service.SystemAreaService; import pps.cloud.system.service.SystemAreaService;
import pps.cloud.system.service.data.sys_area.GetSysAreaInput; import pps.cloud.system.service.data.sys_area.GetSysAreaInput;
import pps.cloud.system.service.data.sys_area.GetSysAreaOutput; import pps.cloud.system.service.data.sys_area.GetSysAreaOutput;
...@@ -20,7 +21,6 @@ import xstartup.data.XSingleResult; ...@@ -20,7 +21,6 @@ import xstartup.data.XSingleResult;
import xstartup.feature.api.annotation.XApiPost; import xstartup.feature.api.annotation.XApiPost;
import java.util.List; import java.util.List;
import java.util.Objects;
@XService @XService
public class SystemAreaServiceImpl implements SystemAreaService { public class SystemAreaServiceImpl implements SystemAreaService {
...@@ -48,9 +48,9 @@ public class SystemAreaServiceImpl implements SystemAreaService { ...@@ -48,9 +48,9 @@ public class SystemAreaServiceImpl implements SystemAreaService {
Integer parentId = input.getParentId(); Integer parentId = input.getParentId();
SysAreaMapper mapper = context.getBean(SysAreaMapper.class); SysAreaMapper mapper = context.getBean(SysAreaMapper.class);
SysAreaEnt sysAreaEnt = mapper.selectOne(new LambdaQueryWrapper<SysAreaEnt>() SysAreaEnt sysAreaEnt = mapper.selectOne(new LambdaQueryWrapper<SysAreaEnt>()
.eq(Objects.nonNull(id), SysAreaEnt::getId, id) .eq(ObjectUtil.isNotNull(id), SysAreaEnt::getId, id)
.eq(Objects.nonNull(parentId), SysAreaEnt::getParentId, parentId) .eq(ObjectUtil.isNotNull(parentId), SysAreaEnt::getParentId, parentId)
.eq(StringUtils.isNotEmpty(name), SysAreaEnt::getName, name) .eq(CharSequenceUtil.isNotBlank(name), SysAreaEnt::getName, name)
.last(BusinessConstant.LAST_LIMIT) .last(BusinessConstant.LAST_LIMIT)
); );
return XSingleResult.success(XCopyUtils.copyNewObject(sysAreaEnt, GetSysAreaOutput.class)); return XSingleResult.success(XCopyUtils.copyNewObject(sysAreaEnt, GetSysAreaOutput.class));
......
package pps.core.system.utils; package pps.core.system.utils;
import org.apache.commons.lang3.StringUtils; import cn.hutool.core.text.CharSequenceUtil;
import pps.core.common.utils.PatternUtil; import pps.core.common.utils.PatternUtil;
import pps.core.common.utils.RSAUtil; import pps.core.common.utils.RSAUtil;
import pps.core.system.config.LoginConfig; import pps.core.system.config.LoginConfig;
...@@ -18,7 +18,7 @@ public class UserInfoUtil { ...@@ -18,7 +18,7 @@ public class UserInfoUtil {
//敏感信息rsa加密 //敏感信息rsa加密
public static String encrypt(String str) { public static String encrypt(String str) {
if (StringUtils.isBlank(str)) { if (CharSequenceUtil.isBlank(str)) {
return str; return str;
} }
XContext context = XServiceContext.build(UserInfoUtil.class); XContext context = XServiceContext.build(UserInfoUtil.class);
...@@ -29,7 +29,7 @@ public class UserInfoUtil { ...@@ -29,7 +29,7 @@ public class UserInfoUtil {
//敏感信息rsa解密 //敏感信息rsa解密
public static String decrypt(String str) { public static String decrypt(String str) {
if (StringUtils.isBlank(str)) { if (CharSequenceUtil.isBlank(str)) {
return str; return str;
} }
XContext context = XServiceContext.build(UserInfoUtil.class); XContext context = XServiceContext.build(UserInfoUtil.class);
......
package pps.core.base.service; package pps.core.base.service;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.util.CollectionUtils;
import pps.core.base.entity.BaseDataEnt; import pps.core.base.entity.BaseDataEnt;
import pps.core.base.entity.BaseDataImportLogEnt; import pps.core.base.entity.BaseDataImportLogEnt;
import pps.core.base.entity.BaseDataView; import pps.core.base.entity.BaseDataView;
...@@ -337,7 +337,7 @@ public class BaseDataService { ...@@ -337,7 +337,7 @@ public class BaseDataService {
BaseDataImportLogEnt ent = logMapper.selectOne(logEntQueryWrapper); BaseDataImportLogEnt ent = logMapper.selectOne(logEntQueryWrapper);
if (ent == null) if (ent == null)
return XServiceResult.OK; return XServiceResult.OK;
if (!CollectionUtils.isEmpty(input.getKeyNames())) { if (CollUtil.isNotEmpty(input.getKeyNames())) {
for (String keyName : input.getKeyNames()) { for (String keyName : input.getKeyNames()) {
CalcBaseDataInput calcBaseDataInput = new CalcBaseDataInput("", keyName, input.getLineId(), "train_val", XDateUtils.getString(ent.getBeginDate()), XDateUtils.getString(ent.getEndDate())); CalcBaseDataInput calcBaseDataInput = new CalcBaseDataInput("", keyName, input.getLineId(), "train_val", XDateUtils.getString(ent.getBeginDate()), XDateUtils.getString(ent.getEndDate()));
doTrainData(context, calcBaseDataInput); doTrainData(context, calcBaseDataInput);
......
package pps.core.base.service; package pps.core.base.service;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import org.springframework.util.CollectionUtils;
import pps.core.base.entity.BaseLineAttenuationRateEnt; import pps.core.base.entity.BaseLineAttenuationRateEnt;
import pps.core.base.entity.BaseLineAttenuationRateView; import pps.core.base.entity.BaseLineAttenuationRateView;
import pps.core.base.entity.BaseProjectInfoEnt; import pps.core.base.entity.BaseProjectInfoEnt;
...@@ -66,7 +66,7 @@ public class BaseProjectInfoService { ...@@ -66,7 +66,7 @@ public class BaseProjectInfoService {
entity.setIsDeleted(0); entity.setIsDeleted(0);
mapper.insert(entity); mapper.insert(entity);
List<BaseLineAttenuationRateView> list = new ArrayList<>(); List<BaseLineAttenuationRateView> list = new ArrayList<>();
if (!CollectionUtils.isEmpty(input.getList())) { if (CollUtil.isNotEmpty(input.getList())) {
BaseLineAttenuationRateViewMapper rateMapper = context.getBean(BaseLineAttenuationRateViewMapper.class); BaseLineAttenuationRateViewMapper rateMapper = context.getBean(BaseLineAttenuationRateViewMapper.class);
for (CreateBaseLineAttenuationRateInput rateInput : input.getList()) { for (CreateBaseLineAttenuationRateInput rateInput : input.getList()) {
BaseLineAttenuationRateView ent = XCopyUtils.copyNewObject(rateInput, BaseLineAttenuationRateView.class); BaseLineAttenuationRateView ent = XCopyUtils.copyNewObject(rateInput, BaseLineAttenuationRateView.class);
...@@ -107,7 +107,7 @@ public class BaseProjectInfoService { ...@@ -107,7 +107,7 @@ public class BaseProjectInfoService {
queryRateWrapper.lambda().eq(BaseLineAttenuationRateEnt::getType, 1); queryRateWrapper.lambda().eq(BaseLineAttenuationRateEnt::getType, 1);
rateMapper.delete(queryRateWrapper); rateMapper.delete(queryRateWrapper);
List<BaseLineAttenuationRateView> list = new ArrayList<>(); List<BaseLineAttenuationRateView> list = new ArrayList<>();
if (!CollectionUtils.isEmpty(input.getList())) { if (CollUtil.isNotEmpty(input.getList())) {
BaseLineAttenuationRateViewMapper rateViewMapper = context.getBean(BaseLineAttenuationRateViewMapper.class); BaseLineAttenuationRateViewMapper rateViewMapper = context.getBean(BaseLineAttenuationRateViewMapper.class);
for (CreateBaseLineAttenuationRateInput rateInput : input.getList()) { for (CreateBaseLineAttenuationRateInput rateInput : input.getList()) {
BaseLineAttenuationRateView ent = XCopyUtils.copyNewObject(rateInput, BaseLineAttenuationRateView.class); BaseLineAttenuationRateView ent = XCopyUtils.copyNewObject(rateInput, BaseLineAttenuationRateView.class);
...@@ -157,7 +157,7 @@ public class BaseProjectInfoService { ...@@ -157,7 +157,7 @@ public class BaseProjectInfoService {
queryRateWrapper.lambda().eq(BaseLineAttenuationRateEnt::getLineId, entity.getId()); queryRateWrapper.lambda().eq(BaseLineAttenuationRateEnt::getLineId, entity.getId());
queryRateWrapper.lambda().eq(BaseLineAttenuationRateEnt::getType, 1); queryRateWrapper.lambda().eq(BaseLineAttenuationRateEnt::getType, 1);
List<BaseLineAttenuationRateEnt> list = rateMapper.selectList(queryRateWrapper); List<BaseLineAttenuationRateEnt> list = rateMapper.selectList(queryRateWrapper);
if (!CollectionUtils.isEmpty(list)) { if (CollUtil.isNotEmpty(list)) {
List<CreateBaseLineAttenuationRateInput> rateInputs = XCopyUtils.copyNewList(list, CreateBaseLineAttenuationRateInput.class); List<CreateBaseLineAttenuationRateInput> rateInputs = XCopyUtils.copyNewList(list, CreateBaseLineAttenuationRateInput.class);
output.setList(rateInputs); output.setList(rateInputs);
} }
......
package pps.core.base.service; package pps.core.base.service;
import cn.hutool.core.text.CharSequenceUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import pps.core.base.entity.SysPageInfoEnt; import pps.core.base.entity.SysPageInfoEnt;
import pps.core.base.mapper.SysPageInfoMapper; import pps.core.base.mapper.SysPageInfoMapper;
import pps.core.base.service.data.sys_page_info.*; import pps.core.base.service.data.sys_page_info.*;
...@@ -54,13 +54,13 @@ public class SysPageInfoService { ...@@ -54,13 +54,13 @@ public class SysPageInfoService {
if (entity == null) { if (entity == null) {
return XServiceResult.error(context, XError.NotFound); return XServiceResult.error(context, XError.NotFound);
} }
if (StringUtils.isNotBlank(input.getPageContext())) { if (CharSequenceUtil.isNotBlank(input.getPageContext())) {
entity.setPageContext(input.getPageContext()); entity.setPageContext(input.getPageContext());
} }
if (StringUtils.isNotBlank(input.getPageName())) { if (CharSequenceUtil.isNotBlank(input.getPageName())) {
entity.setPageName(input.getPageName()); entity.setPageName(input.getPageName());
} }
if (StringUtils.isNotBlank(input.getPageRemark())) { if (CharSequenceUtil.isNotBlank(input.getPageRemark())) {
entity.setPageRemark(input.getPageRemark()); entity.setPageRemark(input.getPageRemark());
} }
entity.setModifyTime(new Date()); entity.setModifyTime(new Date());
...@@ -104,10 +104,10 @@ public class SysPageInfoService { ...@@ -104,10 +104,10 @@ public class SysPageInfoService {
public XPageResult<QuerySysPageInfoOutput> querySysPageInfo(XContext context, QuerySysPageInfoInput input) { public XPageResult<QuerySysPageInfoOutput> querySysPageInfo(XContext context, QuerySysPageInfoInput input) {
SysPageInfoMapper mapper = context.getBean(SysPageInfoMapper.class); SysPageInfoMapper mapper = context.getBean(SysPageInfoMapper.class);
QueryWrapper<SysPageInfoEnt> queryWrapper = new QueryWrapper<>(); QueryWrapper<SysPageInfoEnt> queryWrapper = new QueryWrapper<>();
if (StringUtils.isNotBlank(input.getPageId())) { if (CharSequenceUtil.isNotBlank(input.getPageId())) {
queryWrapper.lambda().eq(SysPageInfoEnt::getPageId, input.getPageId()); queryWrapper.lambda().eq(SysPageInfoEnt::getPageId, input.getPageId());
} }
if (StringUtils.isNotBlank(input.getPageName())) { if (CharSequenceUtil.isNotBlank(input.getPageName())) {
queryWrapper.lambda().like(SysPageInfoEnt::getPageName, input.getPageName()); queryWrapper.lambda().like(SysPageInfoEnt::getPageName, input.getPageName());
} }
if (ObjectUtils.isNotEmpty(input.getReleaseState())) { if (ObjectUtils.isNotEmpty(input.getReleaseState())) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment