|
@ -20,6 +20,7 @@ import com.qs.serve.modules.exl.entity.dto.ExlTableBo; |
|
|
import com.qs.serve.modules.exl.mapper.ExlTableConfMapper; |
|
|
import com.qs.serve.modules.exl.mapper.ExlTableConfMapper; |
|
|
import com.qs.serve.modules.exl.service.ExlColumnConfService; |
|
|
import com.qs.serve.modules.exl.service.ExlColumnConfService; |
|
|
import com.qs.serve.modules.exl.service.ExlTableConfService; |
|
|
import com.qs.serve.modules.exl.service.ExlTableConfService; |
|
|
|
|
|
import com.qs.serve.modules.exl.service.ExlTableUserService; |
|
|
import com.qs.serve.modules.his.entity.HisUserSupplier; |
|
|
import com.qs.serve.modules.his.entity.HisUserSupplier; |
|
|
import com.qs.serve.modules.his.mapper.HisUserSupplierMapper; |
|
|
import com.qs.serve.modules.his.mapper.HisUserSupplierMapper; |
|
|
import com.qs.serve.modules.sys.entity.SysUser; |
|
|
import com.qs.serve.modules.sys.entity.SysUser; |
|
@ -49,6 +50,7 @@ public class ExlTableDataController { |
|
|
|
|
|
|
|
|
private ExlTableConfService exlTableConfService; |
|
|
private ExlTableConfService exlTableConfService; |
|
|
private ExlColumnConfService exlColumnConfService; |
|
|
private ExlColumnConfService exlColumnConfService; |
|
|
|
|
|
private ExlTableUserService exlTableUserService; |
|
|
private SqlSessionTemplate sqlSessionTemplate; |
|
|
private SqlSessionTemplate sqlSessionTemplate; |
|
|
private ExlTableConfMapper exlTableConfMapper; |
|
|
private ExlTableConfMapper exlTableConfMapper; |
|
|
private SysUserMapper sysUserMapper; |
|
|
private SysUserMapper sysUserMapper; |
|
@ -74,7 +76,8 @@ public class ExlTableDataController { |
|
|
columnLqw.orderByAsc(ExlColumnConf::getSort); |
|
|
columnLqw.orderByAsc(ExlColumnConf::getSort); |
|
|
List<ExlColumnConf> columnList = exlColumnConfService.list(columnLqw); |
|
|
List<ExlColumnConf> columnList = exlColumnConfService.list(columnLqw); |
|
|
// query
|
|
|
// query
|
|
|
Map<String, Object> queryMap = buildQueryMap(map, columnList); |
|
|
boolean adminFlag = false; |
|
|
|
|
|
Map<String, Object> queryMap = buildQueryMap(map, columnList,adminFlag); |
|
|
String targetTableName = ExlConst.TABLE_NAME_PRE + tableConf.getTableName(); |
|
|
String targetTableName = ExlConst.TABLE_NAME_PRE + tableConf.getTableName(); |
|
|
Long count = exlTableConfMapper.countData(targetTableName,queryMap); |
|
|
Long count = exlTableConfMapper.countData(targetTableName,queryMap); |
|
|
PageVo vo = new PageVo(); |
|
|
PageVo vo = new PageVo(); |
|
@ -96,7 +99,7 @@ public class ExlTableDataController { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@NotNull |
|
|
@NotNull |
|
|
private Map<String, Object> buildQueryMap(Map<String, String> map, List<ExlColumnConf> columnList) { |
|
|
private Map<String, Object> buildQueryMap(Map<String, String> map, List<ExlColumnConf> columnList,Boolean adminFlag) { |
|
|
Map<String,Object> queryMap = new HashMap<>(10); |
|
|
Map<String,Object> queryMap = new HashMap<>(10); |
|
|
// condition
|
|
|
// condition
|
|
|
List<ExlConditionDto> ge_conditions = new ArrayList<>(); |
|
|
List<ExlConditionDto> ge_conditions = new ArrayList<>(); |
|
@ -121,47 +124,50 @@ public class ExlTableDataController { |
|
|
continue; |
|
|
continue; |
|
|
} |
|
|
} |
|
|
String colType = currColumnConf.getColumnType(); |
|
|
String colType = currColumnConf.getColumnType(); |
|
|
// 权限范围:0->本人;1->下属;2->全部(本人级下属)
|
|
|
if(!adminFlag){ |
|
|
Integer scope = currColumnConf.getScope(); |
|
|
// 权限范围:0->本人;1->下属;2->全部(本人级下属)
|
|
|
Set<String> values = new HashSet<>(); |
|
|
Integer scope = currColumnConf.getScope(); |
|
|
// 业务类型
|
|
|
Set<String> values = new HashSet<>(); |
|
|
String userId = AuthContextUtils.getSysUserId(); |
|
|
// 业务类型
|
|
|
SysUser sysUser = sysUserMapper.selectById(userId); |
|
|
String userId = AuthContextUtils.getSysUserId(); |
|
|
if (colType.equals(ExlConst.TYPE_USER_CODE)){ |
|
|
SysUser sysUser = sysUserMapper.selectById(userId); |
|
|
values.add("0"); |
|
|
if (colType.equals(ExlConst.TYPE_USER_CODE)){ |
|
|
if(scope==0){ |
|
|
values.add("0"); |
|
|
values.add(sysUser.getCode()); |
|
|
if(scope==0){ |
|
|
}else if (scope>0){ |
|
|
|
|
|
List<String> childIds = postUserService.listByChildIds(AuthContextUtils.getSysUserId()); |
|
|
|
|
|
if(childIds.size()>0){ |
|
|
|
|
|
List<SysUser> sysUsers = sysUserMapper.selectBatchIds(childIds); |
|
|
|
|
|
List<String> codes = sysUsers.stream().map(a->a.getCode()).collect(Collectors.toList()); |
|
|
|
|
|
values.addAll(codes); |
|
|
|
|
|
} |
|
|
|
|
|
if (scope==2){ |
|
|
|
|
|
values.add(sysUser.getCode()); |
|
|
values.add(sysUser.getCode()); |
|
|
|
|
|
}else if (scope>0){ |
|
|
|
|
|
List<String> childIds = postUserService.listByChildIds(AuthContextUtils.getSysUserId()); |
|
|
|
|
|
if(childIds.size()>0){ |
|
|
|
|
|
List<SysUser> sysUsers = sysUserMapper.selectBatchIds(childIds); |
|
|
|
|
|
List<String> codes = sysUsers.stream().map(a->a.getCode()).collect(Collectors.toList()); |
|
|
|
|
|
values.addAll(codes); |
|
|
|
|
|
} |
|
|
|
|
|
if (scope==2){ |
|
|
|
|
|
values.add(sysUser.getCode()); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
ExlConditionDto conditionDto = new ExlConditionDto(orgColumn,values); |
|
|
|
|
|
in_conditions.add(conditionDto); |
|
|
|
|
|
}else if (colType.equals(ExlConst.TYPE_CUSTOMER_CODE)){ |
|
|
|
|
|
values.add("0"); |
|
|
|
|
|
List<String> userIds = new ArrayList<>(); |
|
|
|
|
|
userIds.add(userId); |
|
|
|
|
|
if(scope>0){ |
|
|
|
|
|
List<String> childIds = postUserService.listByChildIds(AuthContextUtils.getSysUserId()); |
|
|
|
|
|
userIds.addAll(childIds); |
|
|
|
|
|
} |
|
|
|
|
|
LambdaQueryWrapper<HisUserSupplier> husLqw = new LambdaQueryWrapper<>(); |
|
|
|
|
|
husLqw.in(HisUserSupplier::getUserId,userIds); |
|
|
|
|
|
husLqw.select(HisUserSupplier::getSupplierCode); |
|
|
|
|
|
List<HisUserSupplier> hisUserSuppliers = hisUserSupplierMapper.selectList(husLqw); |
|
|
|
|
|
List<String> supplierCodes = hisUserSuppliers.stream() |
|
|
|
|
|
.map(HisUserSupplier::getSupplierCode).distinct().collect(Collectors.toList()); |
|
|
|
|
|
values.addAll(supplierCodes); |
|
|
|
|
|
ExlConditionDto conditionDto = new ExlConditionDto(orgColumn,values); |
|
|
|
|
|
in_conditions.add(conditionDto); |
|
|
} |
|
|
} |
|
|
ExlConditionDto conditionDto = new ExlConditionDto(orgColumn,values); |
|
|
|
|
|
in_conditions.add(conditionDto); |
|
|
|
|
|
}else if (colType.equals(ExlConst.TYPE_CUSTOMER_CODE)){ |
|
|
|
|
|
values.add("0"); |
|
|
|
|
|
List<String> userIds = new ArrayList<>(); |
|
|
|
|
|
userIds.add(userId); |
|
|
|
|
|
if(scope>0){ |
|
|
|
|
|
List<String> childIds = postUserService.listByChildIds(AuthContextUtils.getSysUserId()); |
|
|
|
|
|
userIds.addAll(childIds); |
|
|
|
|
|
} |
|
|
|
|
|
LambdaQueryWrapper<HisUserSupplier> husLqw = new LambdaQueryWrapper<>(); |
|
|
|
|
|
husLqw.in(HisUserSupplier::getUserId,userIds); |
|
|
|
|
|
husLqw.select(HisUserSupplier::getSupplierCode); |
|
|
|
|
|
List<HisUserSupplier> hisUserSuppliers = hisUserSupplierMapper.selectList(husLqw); |
|
|
|
|
|
List<String> supplierCodes = hisUserSuppliers.stream() |
|
|
|
|
|
.map(HisUserSupplier::getSupplierCode).distinct().collect(Collectors.toList()); |
|
|
|
|
|
values.addAll(supplierCodes); |
|
|
|
|
|
ExlConditionDto conditionDto = new ExlConditionDto(orgColumn,values); |
|
|
|
|
|
in_conditions.add(conditionDto); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//基础的数据类型
|
|
|
//基础的数据类型
|
|
|
if(columnName.contains(ExlConst.PRE_COLUMN_START)){ |
|
|
if(columnName.contains(ExlConst.PRE_COLUMN_START)){ |
|
|
ExlConditionDto conditionDto = new ExlConditionDto(orgColumn,searchValue); |
|
|
ExlConditionDto conditionDto = new ExlConditionDto(orgColumn,searchValue); |
|
@ -207,7 +213,8 @@ public class ExlTableDataController { |
|
|
columnLqw.orderByAsc(ExlColumnConf::getSort); |
|
|
columnLqw.orderByAsc(ExlColumnConf::getSort); |
|
|
List<ExlColumnConf> columnList = exlColumnConfService.list(columnLqw); |
|
|
List<ExlColumnConf> columnList = exlColumnConfService.list(columnLqw); |
|
|
// query
|
|
|
// query
|
|
|
Map<String, Object> queryMap = buildQueryMap(map, columnList); |
|
|
boolean adminFlag = exlTableUserService.checkAdmin(tableConf.getId(),AuthContextUtils.getSysUserId())>0; |
|
|
|
|
|
Map<String, Object> queryMap = buildQueryMap(map, columnList,adminFlag); |
|
|
String targetTableName = ExlConst.TABLE_NAME_PRE + tableConf.getTableName(); |
|
|
String targetTableName = ExlConst.TABLE_NAME_PRE + tableConf.getTableName(); |
|
|
List<Map<String,Object>> list = exlTableConfMapper.listData(targetTableName,queryMap); |
|
|
List<Map<String,Object>> list = exlTableConfMapper.listData(targetTableName,queryMap); |
|
|
this.formatListData(list); |
|
|
this.formatListData(list); |
|
|