This commit is contained in:
Paidax
2025-09-24 17:44:32 +08:00
parent e6cf2df937
commit 45888897b4
@@ -1,12 +1,20 @@
package com.budwk.app.zhgh.staffmanage.member.param.pageform;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.constant.RoleConstant;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.utils.PageUtil;
import com.budwk.app.web.commons.auth.utils.AuthUtil;
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nutz.dao.Cnd;
import org.nutz.dao.util.cri.SqlExpressionGroup;
import java.util.List;
import java.util.Map;
/**
* @version 1.0
@@ -79,4 +87,43 @@ public class MemberInfoPageForm extends PageForm {
@ApiModelProperty("工号结尾")
private String endLoginNames;
@ApiModelProperty("导出的数据")
private List<Map<String, String>> columns;
public void buildSearch(Cnd cnd, String prefix){
if (cnd == null) {
cnd = Cnd.NEW();
}
if (StrUtil.isNotBlank(this.getSearchKeyword())) {
SqlExpressionGroup seg = new SqlExpressionGroup();
seg.orLike(prefix + "username", this.getSearchKeyword());
seg.orLike(prefix + "loginname", this.getSearchKeyword());
cnd.and(seg);
}
// 权限判断
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
SqlExpressionGroup seg = new SqlExpressionGroup();
seg.or(prefix + "unionId", "=", SecurityUtil.getUnionId());
seg.or(prefix + "unionId", "is", null);
seg.or(prefix + "unionId", "=", "");
cnd.and(seg);
} else {
cnd.andEX(prefix + "unionId", "=", this.getUnionId());
}
cnd.andEX(prefix + "unitId", "=", this.getUnitId());
cnd.andEX(prefix + "userState", "in", this.getUserStates());
cnd.andEX(prefix + "preparedBy", "in", this.getPreparedBys());
cnd.andEX(prefix + "personType", "in", this.getPersonTypes());
if(StrUtil.isAllBlank(this.getPageOrderName(),this.getPageOrderBy())){
cnd.asc("unionCode").asc("unitCode");
}else{
cnd.orderBy(this.getPageOrderName(), PageUtil.getOrder(this.getPageOrderBy()));
}
}
}