|
|
@ -1,37 +1,34 @@
|
|
|
|
package jnpf.service.impl;
|
|
|
|
package jnpf.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
import jnpf.entity.*;
|
|
|
|
|
|
|
|
import jnpf.mapper.YysClassesMapper;
|
|
|
|
|
|
|
|
import jnpf.service.*;
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
|
|
|
import jnpf.model.yysclasses.*;
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
import jnpf.permission.model.authorize.AuthorizeConditionModel;
|
|
|
|
|
|
|
|
import jnpf.util.GeneraterSwapUtil;
|
|
|
|
|
|
|
|
import jnpf.database.model.superQuery.SuperQueryJsonModel;
|
|
|
|
|
|
|
|
import jnpf.database.model.superQuery.ConditionJsonModel;
|
|
|
|
|
|
|
|
import jnpf.database.model.superQuery.SuperQueryConditionModel;
|
|
|
|
|
|
|
|
import java.lang.reflect.Field;
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.annotation.TableField;
|
|
|
|
import com.baomidou.mybatisplus.annotation.TableField;
|
|
|
|
import java.util.regex.Pattern;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
import jnpf.model.QueryModel;
|
|
|
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
import jnpf.base.model.ColumnDataModel;
|
|
|
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
import jnpf.database.model.superQuery.SuperJsonModel;
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
|
|
|
import jnpf.util.*;
|
|
|
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
import jnpf.base.UserInfo;
|
|
|
|
import jnpf.base.UserInfo;
|
|
|
|
|
|
|
|
import jnpf.base.model.ColumnDataModel;
|
|
|
|
|
|
|
|
import jnpf.database.model.superQuery.SuperJsonModel;
|
|
|
|
|
|
|
|
import jnpf.entity.YysClassesEntity;
|
|
|
|
|
|
|
|
import jnpf.mapper.YysClassesMapper;
|
|
|
|
|
|
|
|
import jnpf.model.QueryModel;
|
|
|
|
|
|
|
|
import jnpf.model.yysclasses.YysClassesConstant;
|
|
|
|
|
|
|
|
import jnpf.model.yysclasses.YysClassesForm;
|
|
|
|
|
|
|
|
import jnpf.model.yysclasses.YysClassesPagination;
|
|
|
|
import jnpf.permission.entity.UserEntity;
|
|
|
|
import jnpf.permission.entity.UserEntity;
|
|
|
|
|
|
|
|
import jnpf.service.YysClassesService;
|
|
|
|
|
|
|
|
import jnpf.util.*;
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.lang.reflect.Field;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
|
|
|
|
* yysClasses
|
|
|
|
* yysClasses
|
|
|
|
* 版本: V3.5
|
|
|
|
* 版本: V3.5
|
|
|
|
* 版权: 引迈信息技术有限公司(https://www.jnpfsoft.com)
|
|
|
|
* 版权: 引迈信息技术有限公司(https://www.jnpfsoft.com)
|
|
|
@ -39,7 +36,7 @@ import jnpf.permission.entity.UserEntity;
|
|
|
|
* 日期: 2024-08-05
|
|
|
|
* 日期: 2024-08-05
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Service
|
|
|
|
@Service
|
|
|
|
public class YysClassesServiceImpl extends ServiceImpl<YysClassesMapper, YysClassesEntity> implements YysClassesService{
|
|
|
|
public class YysClassesServiceImpl extends ServiceImpl<YysClassesMapper, YysClassesEntity> implements YysClassesService {
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private GeneraterSwapUtil generaterSwapUtil;
|
|
|
|
private GeneraterSwapUtil generaterSwapUtil;
|
|
|
|
|
|
|
|
|
|
|
@ -47,260 +44,277 @@ public class YysClassesServiceImpl extends ServiceImpl<YysClassesMapper, YysClas
|
|
|
|
private UserProvider userProvider;
|
|
|
|
private UserProvider userProvider;
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<YysClassesEntity> getList(YysClassesPagination yysClassesPagination){
|
|
|
|
public List<YysClassesEntity> getList(YysClassesPagination yysClassesPagination) {
|
|
|
|
return getTypeList(yysClassesPagination,yysClassesPagination.getDataType());
|
|
|
|
return getTypeList(yysClassesPagination, yysClassesPagination.getDataType());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/** 列表查询 */
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 列表查询
|
|
|
|
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<YysClassesEntity> getTypeList(YysClassesPagination yysClassesPagination,String dataType){
|
|
|
|
public List<YysClassesEntity> getTypeList(YysClassesPagination yysClassesPagination, String dataType) {
|
|
|
|
String userId=userProvider.get().getUserId();
|
|
|
|
String userId = userProvider.get().getUserId();
|
|
|
|
List<String> AllIdList =new ArrayList();
|
|
|
|
List<String> AllIdList = new ArrayList();
|
|
|
|
List<List<String>> intersectionList =new ArrayList<>();
|
|
|
|
List<List<String>> intersectionList = new ArrayList<>();
|
|
|
|
boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
|
|
|
|
boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
|
|
|
|
String columnData = !isPc ? YysClassesConstant.getAppColumnData() : YysClassesConstant.getColumnData();
|
|
|
|
String columnData = !isPc ? YysClassesConstant.getAppColumnData() : YysClassesConstant.getColumnData();
|
|
|
|
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
|
|
|
|
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
|
|
|
|
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
|
|
|
|
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
|
|
|
|
|
|
|
|
|
|
|
|
int total=0;
|
|
|
|
int total = 0;
|
|
|
|
int yysClassesNum =0;
|
|
|
|
int yysClassesNum = 0;
|
|
|
|
QueryWrapper<YysClassesEntity> yysClassesQueryWrapper=new QueryWrapper<>();
|
|
|
|
QueryWrapper<YysClassesEntity> yysClassesQueryWrapper = new QueryWrapper<>();
|
|
|
|
List<String> allSuperIDlist = new ArrayList<>();
|
|
|
|
List<String> allSuperIDlist = new ArrayList<>();
|
|
|
|
String superOp ="";
|
|
|
|
String superOp = "";
|
|
|
|
if (ObjectUtil.isNotEmpty(yysClassesPagination.getSuperQueryJson())){
|
|
|
|
if (ObjectUtil.isNotEmpty(yysClassesPagination.getSuperQueryJson())) {
|
|
|
|
List<String> allSuperList = new ArrayList<>();
|
|
|
|
List<String> allSuperList = new ArrayList<>();
|
|
|
|
List<List<String>> intersectionSuperList = new ArrayList<>();
|
|
|
|
List<List<String>> intersectionSuperList = new ArrayList<>();
|
|
|
|
String queryJson = yysClassesPagination.getSuperQueryJson();
|
|
|
|
String queryJson = yysClassesPagination.getSuperQueryJson();
|
|
|
|
SuperJsonModel superJsonModel = JsonUtil.getJsonToBean(queryJson, SuperJsonModel.class);
|
|
|
|
SuperJsonModel superJsonModel = JsonUtil.getJsonToBean(queryJson, SuperJsonModel.class);
|
|
|
|
int superNum = 0;
|
|
|
|
int superNum = 0;
|
|
|
|
QueryWrapper<YysClassesEntity> yysClassesSuperWrapper = new QueryWrapper<>();
|
|
|
|
QueryWrapper<YysClassesEntity> yysClassesSuperWrapper = new QueryWrapper<>();
|
|
|
|
yysClassesSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(yysClassesSuperWrapper,YysClassesEntity.class,queryJson,"0"));
|
|
|
|
yysClassesSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(yysClassesSuperWrapper, YysClassesEntity.class, queryJson, "0"));
|
|
|
|
int yysClassesNum1 = yysClassesSuperWrapper.getExpression().getNormal().size();
|
|
|
|
int yysClassesNum1 = yysClassesSuperWrapper.getExpression().getNormal().size();
|
|
|
|
if (yysClassesNum1>0){
|
|
|
|
if (yysClassesNum1 > 0) {
|
|
|
|
List<String> yysClassesList =this.list(yysClassesSuperWrapper).stream().map(YysClassesEntity::getId).collect(Collectors.toList());
|
|
|
|
List<String> yysClassesList = this.list(yysClassesSuperWrapper).stream().map(YysClassesEntity::getId).collect(Collectors.toList());
|
|
|
|
allSuperList.addAll(yysClassesList);
|
|
|
|
allSuperList.addAll(yysClassesList);
|
|
|
|
intersectionSuperList.add(yysClassesList);
|
|
|
|
intersectionSuperList.add(yysClassesList);
|
|
|
|
superNum++;
|
|
|
|
superNum++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
superOp = superNum > 0 ? superJsonModel.getMatchLogic() : "";
|
|
|
|
superOp = superNum > 0 ? superJsonModel.getMatchLogic() : "";
|
|
|
|
//and or
|
|
|
|
//and or
|
|
|
|
if(superOp.equalsIgnoreCase("and")){
|
|
|
|
if (superOp.equalsIgnoreCase("and")) {
|
|
|
|
allSuperIDlist = generaterSwapUtil.getIntersection(intersectionSuperList);
|
|
|
|
allSuperIDlist = generaterSwapUtil.getIntersection(intersectionSuperList);
|
|
|
|
}else{
|
|
|
|
} else {
|
|
|
|
allSuperIDlist = allSuperList;
|
|
|
|
allSuperIDlist = allSuperList;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
List<String> allRuleIDlist = new ArrayList<>();
|
|
|
|
List<String> allRuleIDlist = new ArrayList<>();
|
|
|
|
String ruleOp ="";
|
|
|
|
String ruleOp = "";
|
|
|
|
if (ObjectUtil.isNotEmpty(ruleJson)){
|
|
|
|
if (ObjectUtil.isNotEmpty(ruleJson)) {
|
|
|
|
List<String> allRuleList = new ArrayList<>();
|
|
|
|
List<String> allRuleList = new ArrayList<>();
|
|
|
|
List<List<String>> intersectionRuleList = new ArrayList<>();
|
|
|
|
List<List<String>> intersectionRuleList = new ArrayList<>();
|
|
|
|
SuperJsonModel ruleJsonModel = JsonUtil.getJsonToBean(ruleJson, SuperJsonModel.class);
|
|
|
|
SuperJsonModel ruleJsonModel = JsonUtil.getJsonToBean(ruleJson, SuperJsonModel.class);
|
|
|
|
int ruleNum = 0;
|
|
|
|
int ruleNum = 0;
|
|
|
|
QueryWrapper<YysClassesEntity> yysClassesSuperWrapper = new QueryWrapper<>();
|
|
|
|
QueryWrapper<YysClassesEntity> yysClassesSuperWrapper = new QueryWrapper<>();
|
|
|
|
yysClassesSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(yysClassesSuperWrapper,YysClassesEntity.class,ruleJson,"0"));
|
|
|
|
yysClassesSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(yysClassesSuperWrapper, YysClassesEntity.class, ruleJson, "0"));
|
|
|
|
int yysClassesNum1 = yysClassesSuperWrapper.getExpression().getNormal().size();
|
|
|
|
int yysClassesNum1 = yysClassesSuperWrapper.getExpression().getNormal().size();
|
|
|
|
if (yysClassesNum1>0){
|
|
|
|
if (yysClassesNum1 > 0) {
|
|
|
|
List<String> yysClassesList =this.list(yysClassesSuperWrapper).stream().map(YysClassesEntity::getId).collect(Collectors.toList());
|
|
|
|
List<String> yysClassesList = this.list(yysClassesSuperWrapper).stream().map(YysClassesEntity::getId).collect(Collectors.toList());
|
|
|
|
allRuleList.addAll(yysClassesList);
|
|
|
|
allRuleList.addAll(yysClassesList);
|
|
|
|
intersectionRuleList.add(yysClassesList);
|
|
|
|
intersectionRuleList.add(yysClassesList);
|
|
|
|
ruleNum++;
|
|
|
|
ruleNum++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ruleOp = ruleNum > 0 ? ruleJsonModel.getMatchLogic() : "";
|
|
|
|
ruleOp = ruleNum > 0 ? ruleJsonModel.getMatchLogic() : "";
|
|
|
|
//and or
|
|
|
|
//and or
|
|
|
|
if(ruleOp.equalsIgnoreCase("and")){
|
|
|
|
if (ruleOp.equalsIgnoreCase("and")) {
|
|
|
|
allRuleIDlist = generaterSwapUtil.getIntersection(intersectionRuleList);
|
|
|
|
allRuleIDlist = generaterSwapUtil.getIntersection(intersectionRuleList);
|
|
|
|
}else{
|
|
|
|
} else {
|
|
|
|
allRuleIDlist = allRuleList;
|
|
|
|
allRuleIDlist = allRuleList;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
boolean pcPermission = false;
|
|
|
|
boolean pcPermission = false;
|
|
|
|
boolean appPermission = false;
|
|
|
|
boolean appPermission = false;
|
|
|
|
if(isPc && pcPermission){
|
|
|
|
if (isPc && pcPermission) {
|
|
|
|
if (!userProvider.get().getIsAdministrator()){
|
|
|
|
if (!userProvider.get().getIsAdministrator()) {
|
|
|
|
Object yysClassesObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(yysClassesQueryWrapper,YysClassesEntity.class,yysClassesPagination.getMenuId(),"0"));
|
|
|
|
Object yysClassesObj = generaterSwapUtil.getAuthorizeCondition(new QueryModel(yysClassesQueryWrapper, YysClassesEntity.class, yysClassesPagination.getMenuId(), "0"));
|
|
|
|
if (ObjectUtil.isEmpty(yysClassesObj)){
|
|
|
|
if (ObjectUtil.isEmpty(yysClassesObj)) {
|
|
|
|
return new ArrayList<>();
|
|
|
|
return new ArrayList<>();
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
yysClassesQueryWrapper = (QueryWrapper<YysClassesEntity>)yysClassesObj;
|
|
|
|
yysClassesQueryWrapper = (QueryWrapper<YysClassesEntity>) yysClassesObj;
|
|
|
|
if( yysClassesQueryWrapper.getExpression().getNormal().size()>0){
|
|
|
|
if (yysClassesQueryWrapper.getExpression().getNormal().size() > 0) {
|
|
|
|
yysClassesNum++;
|
|
|
|
yysClassesNum++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isPc && appPermission){
|
|
|
|
|
|
|
|
if (!userProvider.get().getIsAdministrator()){
|
|
|
|
|
|
|
|
Object yysClassesObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(yysClassesQueryWrapper,YysClassesEntity.class,yysClassesPagination.getMenuId(),"0"));
|
|
|
|
|
|
|
|
if (ObjectUtil.isEmpty(yysClassesObj)){
|
|
|
|
|
|
|
|
return new ArrayList<>();
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
yysClassesQueryWrapper = (QueryWrapper<YysClassesEntity>)yysClassesObj;
|
|
|
|
|
|
|
|
if( yysClassesQueryWrapper.getExpression().getNormal().size()>0){
|
|
|
|
|
|
|
|
yysClassesNum++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!isPc && appPermission) {
|
|
|
|
|
|
|
|
if (!userProvider.get().getIsAdministrator()) {
|
|
|
|
|
|
|
|
Object yysClassesObj = generaterSwapUtil.getAuthorizeCondition(new QueryModel(yysClassesQueryWrapper, YysClassesEntity.class, yysClassesPagination.getMenuId(), "0"));
|
|
|
|
|
|
|
|
if (ObjectUtil.isEmpty(yysClassesObj)) {
|
|
|
|
|
|
|
|
return new ArrayList<>();
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
yysClassesQueryWrapper = (QueryWrapper<YysClassesEntity>) yysClassesObj;
|
|
|
|
|
|
|
|
if (yysClassesQueryWrapper.getExpression().getNormal().size() > 0) {
|
|
|
|
|
|
|
|
yysClassesNum++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(isPc){
|
|
|
|
if (isPc) {
|
|
|
|
if(ObjectUtil.isNotEmpty(yysClassesPagination.getClassesName())){
|
|
|
|
if (ObjectUtil.isNotEmpty(yysClassesPagination.getClassesName())) {
|
|
|
|
yysClassesNum++;
|
|
|
|
yysClassesNum++;
|
|
|
|
|
|
|
|
|
|
|
|
String value = yysClassesPagination.getClassesName() instanceof List ?
|
|
|
|
String value = yysClassesPagination.getClassesName() instanceof List ?
|
|
|
|
JsonUtil.getObjectToString(yysClassesPagination.getClassesName()) :
|
|
|
|
JsonUtil.getObjectToString(yysClassesPagination.getClassesName()) :
|
|
|
|
String.valueOf(yysClassesPagination.getClassesName());
|
|
|
|
String.valueOf(yysClassesPagination.getClassesName());
|
|
|
|
yysClassesQueryWrapper.lambda().like(YysClassesEntity::getClassesName,value);
|
|
|
|
yysClassesQueryWrapper.lambda().like(YysClassesEntity::getClassesName, value);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(ObjectUtil.isNotEmpty(yysClassesPagination.getEnabledStatus())){
|
|
|
|
if (ObjectUtil.isNotEmpty(yysClassesPagination.getEnabledStatus())) {
|
|
|
|
yysClassesNum++;
|
|
|
|
yysClassesNum++;
|
|
|
|
|
|
|
|
|
|
|
|
List<String> idList = new ArrayList<>();
|
|
|
|
List<String> idList = new ArrayList<>();
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
String[][] enabledStatus = JsonUtil.getJsonToBean(yysClassesPagination.getEnabledStatus(),String[][].class);
|
|
|
|
String[][] enabledStatus = JsonUtil.getJsonToBean(yysClassesPagination.getEnabledStatus(), String[][].class);
|
|
|
|
for(int i=0;i<enabledStatus.length;i++){
|
|
|
|
for (int i = 0; i < enabledStatus.length; i++) {
|
|
|
|
if(enabledStatus[i].length>0){
|
|
|
|
if (enabledStatus[i].length > 0) {
|
|
|
|
idList.add(JsonUtil.getObjectToString(Arrays.asList(enabledStatus[i])));
|
|
|
|
idList.add(JsonUtil.getObjectToString(Arrays.asList(enabledStatus[i])));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}catch (Exception e1){
|
|
|
|
} catch (Exception e1) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
List<String> enabledStatus = JsonUtil.getJsonToList(yysClassesPagination.getEnabledStatus(),String.class);
|
|
|
|
List<String> enabledStatus = JsonUtil.getJsonToList(yysClassesPagination.getEnabledStatus(), String.class);
|
|
|
|
if(enabledStatus.size()>0){
|
|
|
|
if (enabledStatus.size() > 0) {
|
|
|
|
idList.addAll(enabledStatus);
|
|
|
|
idList.addAll(enabledStatus);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}catch (Exception e2){
|
|
|
|
} catch (Exception e2) {
|
|
|
|
idList.add(String.valueOf(yysClassesPagination.getEnabledStatus()));
|
|
|
|
idList.add(String.valueOf(yysClassesPagination.getEnabledStatus()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
yysClassesQueryWrapper.lambda().and(t->{
|
|
|
|
yysClassesQueryWrapper.lambda().and(t -> {
|
|
|
|
idList.forEach(tt->{
|
|
|
|
idList.forEach(tt -> {
|
|
|
|
t.like(YysClassesEntity::getEnabledStatus, tt).or();
|
|
|
|
t.like(YysClassesEntity::getEnabledStatus, tt).or();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
List<String> intersection = generaterSwapUtil.getIntersection(intersectionList);
|
|
|
|
List<String> intersection = generaterSwapUtil.getIntersection(intersectionList);
|
|
|
|
if (total>0){
|
|
|
|
if (total > 0) {
|
|
|
|
if (intersection.size()==0){
|
|
|
|
if (intersection.size() == 0) {
|
|
|
|
intersection.add("jnpfNullList");
|
|
|
|
intersection.add("jnpfNullList");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
yysClassesQueryWrapper.lambda().in(YysClassesEntity::getId, intersection);
|
|
|
|
yysClassesQueryWrapper.lambda().in(YysClassesEntity::getId, intersection);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//是否有高级查询
|
|
|
|
//是否有高级查询
|
|
|
|
if (StringUtil.isNotEmpty(superOp)){
|
|
|
|
if (StringUtil.isNotEmpty(superOp)) {
|
|
|
|
if (allSuperIDlist.size()==0){
|
|
|
|
if (allSuperIDlist.size() == 0) {
|
|
|
|
allSuperIDlist.add("jnpfNullList");
|
|
|
|
allSuperIDlist.add("jnpfNullList");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
List<String> finalAllSuperIDlist = allSuperIDlist;
|
|
|
|
List<String> finalAllSuperIDlist = allSuperIDlist;
|
|
|
|
yysClassesQueryWrapper.lambda().and(t->t.in(YysClassesEntity::getId, finalAllSuperIDlist));
|
|
|
|
yysClassesQueryWrapper.lambda().and(t -> t.in(YysClassesEntity::getId, finalAllSuperIDlist));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//是否有数据过滤查询
|
|
|
|
//是否有数据过滤查询
|
|
|
|
if (StringUtil.isNotEmpty(ruleOp)){
|
|
|
|
if (StringUtil.isNotEmpty(ruleOp)) {
|
|
|
|
if (allRuleIDlist.size()==0){
|
|
|
|
if (allRuleIDlist.size() == 0) {
|
|
|
|
allRuleIDlist.add("jnpfNullList");
|
|
|
|
allRuleIDlist.add("jnpfNullList");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
List<String> finalAllRuleIDlist = allRuleIDlist;
|
|
|
|
List<String> finalAllRuleIDlist = allRuleIDlist;
|
|
|
|
yysClassesQueryWrapper.lambda().and(t->t.in(YysClassesEntity::getId, finalAllRuleIDlist));
|
|
|
|
yysClassesQueryWrapper.lambda().and(t -> t.in(YysClassesEntity::getId, finalAllRuleIDlist));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//排序
|
|
|
|
//排序
|
|
|
|
if(StringUtil.isEmpty(yysClassesPagination.getSidx())){
|
|
|
|
if (StringUtil.isEmpty(yysClassesPagination.getSidx())) {
|
|
|
|
yysClassesQueryWrapper.lambda().orderByDesc(YysClassesEntity::getId);
|
|
|
|
yysClassesQueryWrapper.lambda().orderByDesc(YysClassesEntity::getId);
|
|
|
|
}else{
|
|
|
|
} else {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
String sidx = yysClassesPagination.getSidx();
|
|
|
|
String sidx = yysClassesPagination.getSidx();
|
|
|
|
String[] strs= sidx.split("_name");
|
|
|
|
String[] strs = sidx.split("_name");
|
|
|
|
YysClassesEntity yysClassesEntity = new YysClassesEntity();
|
|
|
|
YysClassesEntity yysClassesEntity = new YysClassesEntity();
|
|
|
|
Field declaredField = yysClassesEntity.getClass().getDeclaredField(strs[0]);
|
|
|
|
Field declaredField = yysClassesEntity.getClass().getDeclaredField(strs[0]);
|
|
|
|
declaredField.setAccessible(true);
|
|
|
|
declaredField.setAccessible(true);
|
|
|
|
String value = declaredField.getAnnotation(TableField.class).value();
|
|
|
|
String value = declaredField.getAnnotation(TableField.class).value();
|
|
|
|
yysClassesQueryWrapper="asc".equals(yysClassesPagination.getSort().toLowerCase())?yysClassesQueryWrapper.orderByAsc(value):yysClassesQueryWrapper.orderByDesc(value);
|
|
|
|
yysClassesQueryWrapper = "asc".equals(yysClassesPagination.getSort().toLowerCase()) ? yysClassesQueryWrapper.orderByAsc(value) : yysClassesQueryWrapper.orderByDesc(value);
|
|
|
|
} catch (NoSuchFieldException e) {
|
|
|
|
} catch (NoSuchFieldException e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
yysClassesQueryWrapper.lambda().isNull(YysClassesEntity::getDeleteMark);
|
|
|
|
yysClassesQueryWrapper.lambda().isNull(YysClassesEntity::getDeleteMark);
|
|
|
|
if("0".equals(dataType)){
|
|
|
|
if ("0".equals(dataType)) {
|
|
|
|
if((total>0 && AllIdList.size()>0) || total==0){
|
|
|
|
if ((total > 0 && AllIdList.size() > 0) || total == 0) {
|
|
|
|
Page<YysClassesEntity> page=new Page<>(yysClassesPagination.getCurrentPage(), yysClassesPagination.getPageSize());
|
|
|
|
Page<YysClassesEntity> page = new Page<>(yysClassesPagination.getCurrentPage(), yysClassesPagination.getPageSize());
|
|
|
|
IPage<YysClassesEntity> userIPage=this.page(page, yysClassesQueryWrapper);
|
|
|
|
IPage<YysClassesEntity> userIPage = this.page(page, yysClassesQueryWrapper);
|
|
|
|
return yysClassesPagination.setData(userIPage.getRecords(),userIPage.getTotal());
|
|
|
|
return yysClassesPagination.setData(userIPage.getRecords(), userIPage.getTotal());
|
|
|
|
}else{
|
|
|
|
} else {
|
|
|
|
List<YysClassesEntity> list = new ArrayList();
|
|
|
|
List<YysClassesEntity> list = new ArrayList();
|
|
|
|
return yysClassesPagination.setData(list, list.size());
|
|
|
|
return yysClassesPagination.setData(list, list.size());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
} else {
|
|
|
|
return this.list(yysClassesQueryWrapper);
|
|
|
|
return this.list(yysClassesQueryWrapper);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public YysClassesEntity getInfo(String id){
|
|
|
|
public YysClassesEntity getInfo(String id) {
|
|
|
|
QueryWrapper<YysClassesEntity> queryWrapper=new QueryWrapper<>();
|
|
|
|
QueryWrapper<YysClassesEntity> queryWrapper = new QueryWrapper<>();
|
|
|
|
queryWrapper.lambda().eq(YysClassesEntity::getId,id);
|
|
|
|
queryWrapper.lambda().eq(YysClassesEntity::getId, id);
|
|
|
|
return this.getOne(queryWrapper);
|
|
|
|
return this.getOne(queryWrapper);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void create(YysClassesEntity entity){
|
|
|
|
public void create(YysClassesEntity entity) {
|
|
|
|
this.save(entity);
|
|
|
|
this.save(entity);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean update(String id, YysClassesEntity entity){
|
|
|
|
public boolean update(String id, YysClassesEntity entity) {
|
|
|
|
return this.updateById(entity);
|
|
|
|
return this.updateById(entity);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void delete(YysClassesEntity entity){
|
|
|
|
public void delete(YysClassesEntity entity) {
|
|
|
|
if(entity!=null){
|
|
|
|
if (entity != null) {
|
|
|
|
entity.setDeleteMark(1);
|
|
|
|
entity.setDeleteMark(1);
|
|
|
|
entity.setDeleteTime(DateUtil.getNowDate());
|
|
|
|
entity.setDeleteTime(DateUtil.getNowDate());
|
|
|
|
this.updateById(entity);
|
|
|
|
this.updateById(entity);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 验证表单唯一字段,正则,非空 i-0新增-1修改
|
|
|
|
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public String checkForm(YysClassesForm form,int i) {
|
|
|
|
public String checkForm(YysClassesForm form, int i) {
|
|
|
|
boolean isUp =StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0");
|
|
|
|
boolean isUp = StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0");
|
|
|
|
String id="";
|
|
|
|
String id = "";
|
|
|
|
String countRecover = "";
|
|
|
|
String countRecover = "";
|
|
|
|
if (isUp){
|
|
|
|
if (isUp) {
|
|
|
|
id = form.getId();
|
|
|
|
id = form.getId();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//主表字段验证
|
|
|
|
//主表字段验证
|
|
|
|
if(StringUtil.isEmpty(form.getClassesName())){
|
|
|
|
if (StringUtil.isEmpty(form.getClassesName())) {
|
|
|
|
return "班次名称不能为空";
|
|
|
|
return "班次名称不能为空";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return countRecover;
|
|
|
|
return countRecover;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 新增修改数据(事务回滚)
|
|
|
|
* 新增修改数据(事务回滚)
|
|
|
|
* @param id
|
|
|
|
*
|
|
|
|
* @param yysClassesForm
|
|
|
|
* @param id
|
|
|
|
* @return
|
|
|
|
* @param yysClassesForm
|
|
|
|
*/
|
|
|
|
* @return
|
|
|
|
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
@Transactional
|
|
|
|
@Transactional
|
|
|
|
public void saveOrUpdate(YysClassesForm yysClassesForm,String id, boolean isSave) throws Exception{
|
|
|
|
public void saveOrUpdate(YysClassesForm yysClassesForm, String id, boolean isSave) throws Exception {
|
|
|
|
UserInfo userInfo=userProvider.get();
|
|
|
|
UserInfo userInfo = userProvider.get();
|
|
|
|
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
|
|
|
|
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
|
|
|
|
yysClassesForm = JsonUtil.getJsonToBean(
|
|
|
|
yysClassesForm = JsonUtil.getJsonToBean(
|
|
|
|
generaterSwapUtil.swapDatetime(YysClassesConstant.getFormData(),yysClassesForm),YysClassesForm.class);
|
|
|
|
generaterSwapUtil.swapDatetime(YysClassesConstant.getFormData(), yysClassesForm), YysClassesForm.class);
|
|
|
|
YysClassesEntity entity = JsonUtil.getJsonToBean(yysClassesForm, YysClassesEntity.class);
|
|
|
|
YysClassesEntity entity = JsonUtil.getJsonToBean(yysClassesForm, YysClassesEntity.class);
|
|
|
|
|
|
|
|
|
|
|
|
if(isSave){
|
|
|
|
if (isSave) {
|
|
|
|
String mainId = RandomUtil.uuId() ;
|
|
|
|
String mainId = RandomUtil.uuId();
|
|
|
|
entity.setCreatorTime(DateUtil.getNowDate());
|
|
|
|
entity.setCreatorTime(DateUtil.getNowDate());
|
|
|
|
entity.setCreatorUserId(userInfo.getUserId());
|
|
|
|
entity.setCreatorUserId(userInfo.getUserId());
|
|
|
|
entity.setId(mainId);
|
|
|
|
entity.setId(mainId);
|
|
|
|
}else{
|
|
|
|
} else {
|
|
|
|
entity.setLastModifyTime(DateUtil.getNowDate());
|
|
|
|
entity.setLastModifyTime(DateUtil.getNowDate());
|
|
|
|
entity.setLastModifyUserId(userInfo.getUserId());
|
|
|
|
entity.setLastModifyUserId(userInfo.getUserId());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.saveOrUpdate(entity);
|
|
|
|
this.saveOrUpdate(entity);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public YysClassesEntity getInfoById(String id) {
|
|
|
|
|
|
|
|
return this.getById(id);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|