Commit 0af99b0d by 宋祥

1.数据权限开发

parent a9d3af5d
......@@ -27,13 +27,17 @@ import java.sql.PreparedStatement;
import java.util.HashMap;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;
/**
* 切面处理类,操作日志异常日志记录处理
*/
@Slf4j
@Aspect //记录日志实现性能跟踪以及用户行为分析
@Component
public class OperationLogAspect {
private static Dao dao = (Dao) PlatApplicationContext.getBean("dao");
private static final Dao dao = (Dao) PlatApplicationContext.getBean("dao");
/**
* 设置操作日志切入点 记录操作日志 在注解的位置切入代码
......@@ -79,21 +83,23 @@ public class OperationLogAspect {
String sql = "INSERT INTO hpjx.SYS_OPERATION_LOG (OPER_MODUL,OPER_TYPE,OPER_DESC," +
"OPER_CONTENT,COMPANY_CODE,CREATED_BY,CREATED_NAME,CREATED_TIME)" +
" VALUES (?,?,?,?,?,?,?,?)";
PreparedStatement ps = ((SqlMapDaoLogProxy) dao).getSqlMapClient().getDataSource().getConnection().prepareStatement(sql);
ps.setString(1,operModul);
ps.setString(2,operType);
ps.setString(3,operDesc);
if(saveContet && joinPoint.getArgs() != null) {
PreparedStatement ps = ((SqlMapDaoLogProxy) dao).getSqlMapClient().getDataSource().getConnection()
.prepareStatement(sql);
ps.setString(1, operModul);
ps.setString(2, operType);
ps.setString(3, operDesc);
if (saveContet && joinPoint.getArgs() != null) {
String strBlock = EiConstant.resultBlock;
EiInfo result = ((EiInfo) joinPoint.getArgs()[0]);
ps.setString(4, JSONObject.toJSONString(((EiInfo) joinPoint.getArgs()[0]).getBlock(strBlock).getRows().get(0)));
}else {
ps.setString(4, JSONObject.toJSONString(
((EiInfo) joinPoint.getArgs()[0]).getBlock(strBlock).getRows().get(0)));
} else {
ps.setString(4, "");
}
ps.setString(5,companyCode);
ps.setString(6,userId);
ps.setString(7,loginName);
ps.setString(8,DateUtils.shortDateTime());
ps.setString(5, companyCode);
ps.setString(6, userId);
ps.setString(7, loginName);
ps.setString(8, DateUtils.shortDateTime());
ps.execute();
} catch (Exception e) {
e.printStackTrace();
......
package com.baosight.hpjx.aspect;
import com.baosight.hpjx.core.tools.ThreadLocalTools;
import com.baosight.hpjx.util.ObjectUtils;
import com.baosight.hpjx.util.StringUtils;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.util.EiInfoUtil;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;
/**
* 切面处理类,请求拦截
*/
@Slf4j
@Aspect
@Component
public class RequestControllerAspect {
/**
* 设置web请求切入点
*/
@Pointcut("execution(* com.baosight.iplat4j.core.web.controller.WebDispatchController.handleRequest(..))")
public void webDispatchPointCut() {
}
/**
* 设置service请求切入点
*/
@Pointcut("execution(* com.baosight.iplat4j.core.web.controller.ServiceDispatchController.dispatchService(..))")
public void serviceDispatchPointCut() {
}
/**
* web 请求切入点
*
* @param joinPoint
*/
@Before("webDispatchPointCut()")
public void webDispatchPageInfo(JoinPoint joinPoint) {
try {
Object[] objects = joinPoint.getArgs();
if (objects == null || objects.length == 0) {
return;
}
// 先取requert参数
HttpServletRequest request = (HttpServletRequest) objects[1];
String efParentFormEname = request.getParameter("efParentFormEname");
String formEname = StringUtils.isNotBlank(efParentFormEname) ? efParentFormEname
: ObjectUtils.toString(objects[0]);
if (StringUtils.isBlank(formEname)) {
log.warn("the web formEname is null");
return;
}
// 非HP开头的页面不是业务模块的页面,无需校验数据权限
if (!formEname.startsWith("HP")) {
return;
}
ThreadLocalTools.FORM_ENAME.set(formEname);
} catch (Exception e) {
log.error("webDispatchPageInfo设置切入点失败:{}", e.getMessage(), e);
}
}
/**
* service请求切入点
*
* @param joinPoint
*/
@Before("serviceDispatchPointCut()")
public void serviceDispatchPageInfo(JoinPoint joinPoint) {
try {
Object[] objects = joinPoint.getArgs();
if (objects == null || objects.length == 0) {
return;
}
Object eiInfoStr = objects.length == 4 ? objects[3] : objects[2];
if (ObjectUtils.isEmpty(eiInfoStr)) {
log.warn("{}.{} the param is not EiInfo。param -> {}", objects[0], objects[1], eiInfoStr);
return;
}
EiInfo inInfo = EiInfoUtil.json2EiInfo(eiInfoStr.toString());
// 如果存在父级页面号,说明是二级页面发送的请求;如果不存在就取当前请求的页面号
String efParentFormEname = inInfo.getString("efParentFormEname");
String pageEname = StringUtils.isNotBlank(efParentFormEname) ? efParentFormEname
: inInfo.getString("efCurFormEname");
// 非HP开头的页面不是业务模块的页面,无需校验数据权限
if (StringUtils.isBlank(pageEname) || !pageEname.startsWith("HP")) {
return;
}
ThreadLocalTools.FORM_ENAME.set(pageEname);
} catch (Exception e) {
log.error("serviceDispatchPageInfo设置切入点失败:{}", e.getMessage(), e);
}
}
}
package com.baosight.hpjx.common;
import com.baosight.iplat4j.core.ei.EiBlock;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 数据权限类型
*
......@@ -15,6 +8,9 @@ import java.util.Map;
*/
public enum AuthTypeEnum {
ALL("all", "全部"),
NO_AUTH("noAuth", "不可查看"),
ONLY_COMPANY("onlyCompany", "本企业"),
ONLY_FACTORY("onlyFactory", "本厂"),
ONLY_DEPT("onlyDept", "本部门");
......
......@@ -199,7 +199,7 @@ public enum DdynamicEnum {
* 用途:项目档案下拉框
* 编写:wwl
*/
ORG_RECORD_BLOCK_ID("org_record_block_id","orgId","orgCname","HPXSOrg.queryComboBox"),
ORG_RECORD_BLOCK_ID("org_record_block_id","orgId","orgCname","HPXSOrg.queryAll"),
/**
* 模块:用户企业
......
package com.baosight.hpjx.controller;
import com.baosight.hpjx.core.tools.ThreadLocalTools;
import com.baosight.hpjx.util.FileUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.hpjx.util.StringUtils;
......@@ -9,7 +11,6 @@ import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.soa.XServiceManager;
import com.baosight.iplat4j.eu.dm.document.bos.s3.api.signed.SignedBosHelp;
import com.baosight.iplat4j.eu.dm.document.bos.s3.param.BosParamHelp;
import com.baosight.hpjx.util.FileUtils;
import com.google.common.base.Joiner;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
......@@ -137,4 +138,25 @@ public class FileDownloadController {
}
return strBuilder.toString();
}
/**
* 数据权限临时使用
*
* @param value
* @param request
* @param response
* @throws IOException
*/
@RequestMapping({"/dataAuth/{value}"})
public String dataAuth(@PathVariable String value, HttpServletRequest request, HttpServletResponse response)
throws IOException {
try {
ThreadLocalTools.DATA_AUTH.set("0".equals(value) ? false : true);
} catch (Exception e) {
response.getWriter().write("数据接口异常");
return "操作失败";
}
return "操作成功";
}
}
......@@ -106,20 +106,18 @@ public class DaoUtils {
log.warn("写入创建人姓名失败", e);
}
// 创建人企业编码
String companyCode = UserSessionUtils.getCompanyCode();
AssertUtils.isEmpty(companyCode, "当前用户未绑定公司,无法操作数据,请联系管理员!");
try {
String companyCode;
try {
companyCode = UserSessionUtils.getCompanyCode();
} catch (Exception e) {
companyCode = "";
}
BeanUtils.setProperty(bean, "companyCode", companyCode);
} catch (Exception e) {
log.warn("写入创建人企业编码失败", e);
}
// 创建人部门编码
// 创建人组织机构
List<String> orgIds = UserSessionUtils.getOrgId();
AssertUtils.isEmpty(orgIds, "当前用户未绑定部门,无法操作数据,请联系管理员!");
try {
BeanUtils.setProperty(bean, "depCode", HPXSTools.XsOrg.getOrgId());
BeanUtils.setProperty(bean, "depCode", orgIds.get(0));
} catch (Exception e) {
log.warn("写入创建人部门编码失败", e);
}
......
package com.baosight.hpjx.core.security;
import com.baosight.hpjx.hp.xs.domain.Org;
import com.baosight.hpjx.hp.xs.domain.User;
import com.baosight.hpjx.hp.xs.tools.HPXSTools;
import com.baosight.iplat4j.core.ei.EiConstant;
......@@ -7,10 +8,14 @@ import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.soa.XLocalManager;
import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.stream.Collectors;
/**
* @author:songx
......@@ -67,16 +72,30 @@ public class UserSessionUtils extends UserSession {
}
/**
* 获取登录用户的部门编码
* 获取登录用户的组织机构
*
* @return
*/
public static String getDepCode() {
String loginName = getLoginName();
if (loginName == null) {
public static List<String> getOrgId() {
return HPXSTools.XsOrg.getOrgId();
}
/**
* 获取登录用户的厂区编码
*
* @return
*/
public static List<String> getFactoryCode() {
List<String> orgIds = getOrgId();
if (CollectionUtils.isEmpty(orgIds)) {
return null;
}
return HPXSTools.XsOrg.getOrgId();
List<String> factoryCodes = new ArrayList<>();
for (String orgId : orgIds) {
Org org = HPXSTools.XsOrg.queryFactory(orgId);
factoryCodes.add(org.getOrgId());
}
return factoryCodes;
}
}
package com.baosight.hpjx.core.tools;
import java.util.concurrent.atomic.AtomicBoolean;
/**
* @author:songx
* @date:2024/3/22,9:05
*/
public class ThreadLocalTools {
/**
* 请求页面号
*/
public static ThreadLocal<String> FORM_ENAME = new ThreadLocal<>();
/**
* 数据权限临时用,true-启用
*/
public static AtomicBoolean DATA_AUTH = new AtomicBoolean(true);
}
package com.baosight.hpjx.hp.constant;
import com.jcraft.jsch.UserAuth;
/**
* @author:songx
* @date:2024/1/18,17:16
......@@ -250,10 +252,14 @@ public class HPSqlConstant {
* @author:songx
* @date:2024/1/18,17:17
*/
public class HPPZ010 {
public class HpPz010 {
// 查询
public static final String QUERY = "HPPZ010.query";
// 查询
public static final String QUERY_TREE_NODE = "HPPZ010.queryTreeNode";
// 查询用户数据权限
public static final String QUERY_USER_AUTH = "HPPZ010.queryUserAuth";
}
/**
......@@ -385,6 +391,22 @@ public class HPSqlConstant {
public static final String DO_PROCESS2 = "HPZL001.doProcess2";
}
/**
* HPXSOrg SQL 定义
*
* @author:songx
* @date:2024/1/20,16:45
*/
public class HpXsOrg {
// 查询组织机构
public static final String QUERY = "HPXSOrg.query";
// 查询企业下所有的组织机构
public static final String QUERY_ALL = "HPXSOrg.queryAll";
// 查询父级信息,含自己(递归)
public static final String QUERY_PARENT = "HPXSOrg.queryParent";
// 查询用户组织机构
public static final String QUERY_ORG_ID = "HPXSUser.queryOrgId";
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">
<!-- table information
Generate time : 2024-03-04 15:58:48
Version : 1.0
schema : hpjx
tableName : SYS_OPERATION_LOG
ID BIGINT NOT NULL primarykey,
COMPANY_CODE VARCHAR NOT NULL,
CREATED_BY VARCHAR,
CREATED_NAME VARCHAR,
CREATED_TIME VARCHAR,
OPER_MODUL VARCHAR,
OPER_TYPE VARCHAR,
OPER_DESC VARCHAR,
OPER_CONTENT VARCHAR
-->
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HPDS001">
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
......
......@@ -22,7 +22,20 @@
-->
<sqlMap namespace="HPDS002">
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
......
......@@ -30,16 +30,23 @@
FACTORY_NAME as "factoryName" <!-- 工厂 -->
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
......
......@@ -33,7 +33,20 @@
FACTORY_NAME as "factoryName" <!-- 工厂 -->
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......
......@@ -43,13 +43,20 @@
FACTORY_CODE as "factoryCode" <!-- 厂区编码 -->
</sql>
<sql id="condition">
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......
......@@ -38,16 +38,23 @@
FACTORY_NAME as "factoryName" <!-- 工厂 -->
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiptDate">
RECEIPT_DATE = #receiptDate#
</isNotEmpty>
......
......@@ -35,13 +35,23 @@
FACTORY_NAME as "factoryName" <!-- 工厂 -->
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiptDate">
RECEIPT_DATE = #receiptDate#
</isNotEmpty>
......
......@@ -36,16 +36,23 @@
A.FACTORY_NAME as "factoryName" <!-- 工厂 -->
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
A.ID = #id#
</isNotEmpty>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
A.DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
A.DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
A.ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiptDate">
A.RECEIPT_DATE = #receiptDate#
</isNotEmpty>
......
......@@ -31,16 +31,23 @@
FACTORY_NAME as "factoryName" <!-- 工厂 -->
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiptDate">
RECEIPT_DATE = #receiptDate#
</isNotEmpty>
......
......@@ -23,16 +23,23 @@
UPDATED_TIME as "updatedTime" <!-- 修改时间 -->
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="dateMonth">
DATE_MONTH = #dateMonth#
</isNotEmpty>
......
......@@ -44,16 +44,23 @@
UPDATED_TIME as "updatedTime" <!-- 更新时间 -->
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="dateType">
DATE_TYPE = #dateType#
</isNotEmpty>
......
......@@ -34,16 +34,23 @@
END_WEIGHT as "endWeight" <!-- 期末重量 -->
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
......
......@@ -26,16 +26,26 @@
FACTORY_NAME as "factoryName" <!-- 工厂 -->
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventRecordId">
INVENT_RECORD_ID = #inventRecordId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode">
WH_CODE = #whCode#
</isNotEmpty>
......
......@@ -25,16 +25,23 @@
VERSION as "version" <!-- 版本号 -->
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="dateProc">
DATE_PROC = #dateProc#
</isNotEmpty>
......
......@@ -34,13 +34,23 @@
FACTORY_NAME as "factoryName" <!-- 工厂 -->
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode">
WH_CODE = #whCode#
</isNotEmpty>
......
......@@ -32,16 +32,23 @@
VERSION as "version" <!-- 版本号 -->
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="dateProc">
DATE_PROC = #dateProc#
</isNotEmpty>
......
......@@ -25,13 +25,23 @@
C.PRINC as "princ" <!-- 负责人 -->
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
A.DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
A.DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="inventRecordId">
A.INVENT_RECORD_ID = #inventRecordId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode">
A.WH_CODE = #whCode#
</isNotEmpty>
......
package com.baosight.hpjx.hp.pz.domain;
import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.core.util.StringUtils;
import java.util.HashMap;
import java.util.Map;
/**
* Project: <br>
* Title:THppz010.java <br>
* Description: <br>
*
* Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br>
*
* @version 1.0
* @history 2024-03-21 10:15:34 create
*/
public class HPPZ010A extends DaoEPBase {
private static final long serialVersionUID = 1L;
public static final String FIELD_COMPANY_CODE = "companyCode"; /* 企业编码*/
public static final String FIELD_USER_ID = "userId"; /* 用户ID*/
public static final String FIELD_USER_NAME = "userName"; /* 用户中文名*/
public static final String FIELD_GENDER = "gender"; /* 性别*/
public static final String FIELD_MOBILE = "mobile"; /* 手机号*/
public static final String FIELD_EMAIL = "email"; /* 邮箱*/
public static final String FIELD_ORG_ID = "orgId"; /* 组织机构ID*/
public static final String FIELD_ORG_CNAME = "orgCname"; /* 组织机构名称*/
public static final String FIELD_PAGE_ENAME = "pageEname"; /* 页面英文名*/
public static final String FIELD_PAGE_CNAME = "pageCname"; /* 页面中文名*/
public static final String FIELD_CUSTOM_AUTH = "customAuth"; /* 自定义权限*/
private String companyCode = " "; /* 企业编码*/
private String userId = " "; /* 用户ID*/
private String userName = " "; /* 用户中文名*/
private String gender = " "; /* 性别*/
private String mobile = " "; /* 手机号*/
private String email = " "; /* 邮箱*/
private String orgId = " "; /* 组织机构ID*/
private String orgCname = " "; /* 组织机构名称*/
private String pageEname = " "; /* 页面英文名*/
private String pageCname = " "; /* 页面中文名*/
private String customAuth = " "; /* 自定义权限*/
/**
* initialize the metadata.
*/
public void initMetaData() {
EiColumn eiColumn;
eiColumn = new EiColumn(FIELD_COMPANY_CODE);
eiColumn.setDescName("企业编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_USER_ID);
eiColumn.setDescName("用户ID");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_USER_NAME);
eiColumn.setDescName("用户中文名");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_GENDER);
eiColumn.setDescName("性别");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_MOBILE);
eiColumn.setDescName("手机号");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_EMAIL);
eiColumn.setDescName("邮箱");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ORG_ID);
eiColumn.setDescName("组织机构ID");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ORG_CNAME);
eiColumn.setDescName("组织机构名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PAGE_ENAME);
eiColumn.setDescName("页面英文名");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PAGE_CNAME);
eiColumn.setDescName("页面中文名");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CUSTOM_AUTH);
eiColumn.setDescName("自定义权限");
eiMetadata.addMeta(eiColumn);
}
/**
* the constructor.
*/
public HPPZ010A() {
initMetaData();
}
public String getCompanyCode() {
return companyCode;
}
public void setCompanyCode(String companyCode) {
this.companyCode = companyCode;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getOrgId() {
return orgId;
}
public void setOrgId(String orgId) {
this.orgId = orgId;
}
public String getOrgCname() {
return orgCname;
}
public void setOrgCname(String orgCname) {
this.orgCname = orgCname;
}
public String getPageEname() {
return pageEname;
}
public void setPageEname(String pageEname) {
this.pageEname = pageEname;
}
public String getPageCname() {
return pageCname;
}
public void setPageCname(String pageCname) {
this.pageCname = pageCname;
}
public String getCustomAuth() {
return customAuth;
}
public void setCustomAuth(String customAuth) {
this.customAuth = customAuth;
}
/**
* get the value from Map.
*
* @param map - source data map
*/
@Override
public void fromMap(Map map) {
setCompanyCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_CODE)), companyCode));
setUserId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_USER_ID)), userId));
setUserName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_USER_NAME)), userName));
setGender(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_GENDER)), gender));
setMobile(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_MOBILE)), mobile));
setEmail(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_EMAIL)), email));
setOrgId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ORG_ID)), orgId));
setOrgCname(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ORG_CNAME)), orgCname));
setPageEname(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PAGE_ENAME)), pageEname));
setPageCname(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PAGE_CNAME)), pageCname));
setCustomAuth(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CUSTOM_AUTH)), customAuth));
}
/**
* set the value to Map.
*/
@Override
public Map toMap() {
Map map = new HashMap();
map.put(FIELD_COMPANY_CODE, StringUtils.toString(companyCode, eiMetadata.getMeta(FIELD_COMPANY_CODE)));
map.put(FIELD_USER_ID, StringUtils.toString(userId, eiMetadata.getMeta(FIELD_USER_ID)));
map.put(FIELD_USER_NAME, StringUtils.toString(userName, eiMetadata.getMeta(FIELD_USER_NAME)));
map.put(FIELD_GENDER, StringUtils.toString(gender, eiMetadata.getMeta(FIELD_GENDER)));
map.put(FIELD_MOBILE, StringUtils.toString(mobile, eiMetadata.getMeta(FIELD_MOBILE)));
map.put(FIELD_EMAIL, StringUtils.toString(email, eiMetadata.getMeta(FIELD_EMAIL)));
map.put(FIELD_ORG_ID, StringUtils.toString(orgId, eiMetadata.getMeta(FIELD_ORG_ID)));
map.put(FIELD_ORG_CNAME, StringUtils.toString(orgCname, eiMetadata.getMeta(FIELD_ORG_CNAME)));
map.put(FIELD_PAGE_ENAME, StringUtils.toString(pageEname, eiMetadata.getMeta(FIELD_PAGE_ENAME)));
map.put(FIELD_PAGE_CNAME, StringUtils.toString(pageCname, eiMetadata.getMeta(FIELD_PAGE_CNAME)));
map.put(FIELD_CUSTOM_AUTH, StringUtils.toString(customAuth, eiMetadata.getMeta(FIELD_CUSTOM_AUTH)));
return map;
}
}
......@@ -5,23 +5,18 @@ import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.pz.domain.HPPZ009;
import com.baosight.hpjx.hp.pz.domain.HPPZ010;
import com.baosight.hpjx.hp.pz.domain.HPPZ010A;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.hp.xs.tools.HPXSTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.hpjx.util.RsaUtils;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.service.soa.XLocalManager;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import com.baosight.xservices.xs.constants.LoginConstants;
import com.baosight.xservices.xs.util.LoginUserDetails;
import com.baosight.xservices.xs.util.UserSession;
import org.apache.commons.collections.CollectionUtils;
......@@ -65,7 +60,7 @@ public class ServiceHPPZ010 extends ServiceBase {
@OperationLogAnnotation(operModul = "数据权限管理", operType = "查询", operDesc = "查询数据列表")
public EiInfo query(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HPSqlConstant.HPPZ010.QUERY, new HPPZ010());
inInfo = super.query(inInfo, HPSqlConstant.HpPz010.QUERY, new HPPZ010());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
......@@ -87,12 +82,10 @@ public class ServiceHPPZ010 extends ServiceBase {
String loginName = UserSession.getUser().getUsername();
params.put("node", parentNode);
params.put("loginName", loginName);
params.put("isOnlyAuth", CommonConstant.YesNo.YES);
// root:根节点或管理员查所有
if ("root".equals(parentNode) || LoginUserDetails.isUserAdmin(loginName)) {
params.put("isOnlyAuth", CommonConstant.YesNo.NO);
}
List results = dao.query("HPPZ010.queryTreeNode", params);
// 管理员查所有
params.put("isUserAdmin", LoginUserDetails.isUserAdmin(loginName) ? CommonConstant.YesNo.YES
: CommonConstant.YesNo.NO);
List results = dao.query(HPSqlConstant.HpPz010.QUERY_TREE_NODE, params);
inInfo.addBlock(node).addRows(results);
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询失败");
......@@ -152,11 +145,12 @@ public class ServiceHPPZ010 extends ServiceBase {
*/
private void checkSaveData(List<Map> resultRows) {
AssertUtils.isEmpty(UserSessionUtils.getCompanyCode(), "当前用户未绑定公司,无法操作数据,请联系管理员!");
AssertUtils.isEmpty(UserSessionUtils.getDepCode(), "当前用户未绑定部门,无法操作数据,请联系管理员!");
AssertUtils.isEmpty(UserSessionUtils.getOrgId(), "当前用户未绑定部门,无法操作数据,请联系管理员!");
for (Map resultRow : resultRows) {
HPPZ010 fPz010 = new HPPZ010();
fPz010.fromMap(resultRow);
AssertUtils.isEmpty(fPz010.getPageEname(), "请选择菜单");
AssertUtils.isEmpty(fPz010.getDepAuth(), "请选择部门");
}
}
......@@ -170,7 +164,7 @@ public class ServiceHPPZ010 extends ServiceBase {
HPPZ010 fPz010 = new HPPZ010();
fPz010.fromMap(resultRow);
// 当前企业是否已经设置过权限
HPPZ010 dbPz010 = HPPZTools.HpPz010.getByPage(fPz010.getPageEname());
HPPZ010 dbPz010 = HPPZTools.HpPz010.getByPage(fPz010.getPageEname(), fPz010.getDepAuth());
if (dbPz010 == null) {
DaoUtils.insert(HPPZ010.INSERT, fPz010);
} else {
......
package com.baosight.hpjx.hp.pz.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.pz.domain.HPPZ010A;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import java.util.Arrays;
import java.util.Map;
/**
* 用户数据授权
*
* @author:songx
* @date:2024/1/18,17:15
*/
public class ServiceHPPZ010A extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "用户数据权限查询", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.ORG_RECORD_BLOCK_ID), null, false);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPPZ010A().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询数据列表
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "用户数据权限查询", operType = "查询", operDesc = "查询数据列表")
public EiInfo query(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
inInfo = super.query(inInfo, HPSqlConstant.HpPz010.QUERY_USER_AUTH, new HPPZ010A());
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询失败");
}
return inInfo;
}
}
......@@ -3,6 +3,18 @@
"http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HPPZ001">
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.pz.domain.Thppz001">
SELECT
......@@ -18,6 +30,7 @@
UPDATED_TIME as "updatedTime" <!-- 更新时间 -->
FROM hpjx.t_hppz001
WHERE 1=1
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="custType">
CUST_TYPE LIKE CONCAT('%',CONCAT( #custType#,'%'))
</isNotEmpty>
......@@ -37,6 +50,7 @@
<select id="count" resultClass="int">
SELECT COUNT(*) FROM hpjx.t_hppz001 WHERE 1=1
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......
......@@ -22,8 +22,21 @@
PHONE_NAME as "phoneName" <!--负责人联系方式-->
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
AND DELETE_FLAG = 0
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......
......@@ -23,8 +23,21 @@
PUT_ADDRESS as "putAddress" <!--收货地址-->
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
AND DELETE_FLAG = 0
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......
......@@ -19,8 +19,21 @@
DELETE_FLAG as "deleteFlag" <!-- 更新时间 -->
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
AND DELETE_FLAG = 0
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......
......@@ -25,17 +25,24 @@
UPDATED_TIME as "updatedTime" <!-- 更新时间 -->
</sql>
<sql id="condition">
AND DELETE_FLAG = 0
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
AND DELETE_FLAG = 0
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventType">
INVENT_TYPE = #inventType#
</isNotEmpty>
......
......@@ -21,17 +21,24 @@
FACTORY_NAME as "factoryName" <!-- 工厂 -->
</sql>
<sql id="condition">
AND DELETE_FLAG = 0
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
AND DELETE_FLAG = 0
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whType">
WH_TYPE = #whType#
</isNotEmpty>
......
......@@ -23,6 +23,18 @@
-->
<sqlMap namespace="HPPZ008">
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.iplat4j.hp.pz.domain.Thppz008">
SELECT
......@@ -43,6 +55,7 @@
UPDATED_BY as "updatedBy", <!-- 更新人 -->
UPDATED_TIME as "updatedTime" <!-- 更新时间 -->
FROM hpjx.t_hppz008 WHERE 1=1
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......@@ -63,6 +76,7 @@
<select id="count" resultClass="int">
SELECT COUNT(*) FROM hpjx.t_hppz008 WHERE 1=1
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......
......@@ -34,6 +34,15 @@
<isNotEmpty prepend=" AND " property="pageCname">
PAGE_CNAME = #pageCname#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depAuth">
DEP_AUTH = #depAuth#
</isNotEmpty>
</sql>
<sql id="customCondition">
<isNotEmpty prepend=" AND " property="depAuths">
DEP_AUTH IN <iterate close=")" open="(" conjunction="," property="depAuths">#depAuths[]#</iterate>
</isNotEmpty>
</sql>
<!-- 公共修改字段 -->
......@@ -59,12 +68,14 @@
FROM ${hpjxSchema}.T_HPPZ010
WHERE 1=1
<include refid="condition" />
<include refid="customCondition"/>
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPPZ010 WHERE 1=1
<include refid="condition" />
<include refid="condition"/>
<include refid="customCondition"/>
</select>
<!-- 查询树节点 -->
......@@ -84,9 +95,13 @@
<isNotEmpty prepend=" AND " property="nodeEnames">
NODE_ENAME IN <iterate close=")" open="(" conjunction="," property="nodeEnames">#nodeEnames[]#</iterate>
</isNotEmpty>
<!-- nodeType=2:目录。非目录或者非管理员非root节点仅显示有权限的菜单 -->
<isEqual prepend=" AND " property="isOnlyAuth" compareValue="Y">
(NODE_TYPE = '2' OR NODE_ENAME IN (
<!-- nodeType:1-页面,2-目录。非管理员仅显示有权限的菜单 -->
<isEqual prepend=" AND " property="isUserAdmin" compareValue="Y">
(NODE_TYPE = '2' OR (NODE_TYPE = '1' AND NODE_ENAME LIKE 'HP%'))
</isEqual>
<isEqual prepend=" AND " property="isUserAdmin" compareValue="N">
(NODE_TYPE = '2' OR (NODE_TYPE = '1' AND NODE_ENAME LIKE 'HP%'
AND NODE_ENAME IN (
SELECT D.RESOURCE_ENAME
FROM ${platSchema}.XS_USER A,
${platSchema}.XS_USER_GROUP_MEMBER B,
......@@ -97,11 +112,49 @@
AND C.OBJECT_ID = D.ID
AND A.LOGIN_NAME = #loginName#
AND D.TYPE = 'PAGE'
)
))
</isEqual>
ORDER BY NODE_SORT_ID ASC
</select>
<!-- 查询用户数据权限 -->
<select id="queryUserAuth" resultClass="com.baosight.hpjx.hp.pz.domain.HPPZ010A">
SELECT
A.LOGIN_NAME AS "userId",
A.USER_NAME AS "userName",
A.GENDER AS "gender",
A.MOBILE AS "mobile",
A.EMAIL AS "email",
B.ORG_ID AS "orgId",
C.ORG_CNAME AS "orgCname",
D.PAGE_ENAME AS "pageEname",
D.PAGE_CNAME AS "pageCname",
D.CUSTOM_AUTH AS "customAuth"
FROM ${platSchema}.XS_USER A
LEFT JOIN ${platSchema}.TXSOG02 B ON A.USER_ID = B.USER_ID
LEFT JOIN ${platSchema}.TXSOG01 C ON B.ORG_ID = C.ORG_ID
LEFT JOIN ${hpjxSchema}.T_HPPZ010 D ON B.ORG_ID = D.DEP_AUTH
WHERE 1=1
AND D.PAGE_ENAME IS NOT NULL
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userId">
A.LOGIN_NAME = #userId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userName">
A.USER_NAME LIKE CONCAT('%', #userName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="orgId">
B.ORG_ID = #orgId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="pageCname">
D.PAGE_CNAME LIKE CONCAT('%', #pageCname#, '%')
</isNotEmpty>
ORDER BY A.LOGIN_NAME ASC, D.PAGE_CNAME ASC, B.ORG_ID ASC
</select>
<insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPPZ010 (
COMPANY_CODE, <!-- 企业编码 -->
......
......@@ -23,8 +23,21 @@
REMARK as "remark" <!-- 备注 -->
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
AND DELETE_FLAG = '0'
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......
......@@ -24,9 +24,22 @@
REMARK as "remark" <!-- 备注 -->
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
AND DELETE_FLAG = '0'
AND COMPANY_CODE = #companyCode#
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......
......@@ -24,9 +24,22 @@
MAN_HOUR as "manHour" <!-- 工时 -->
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
AND DELETE_FLAG = '0'
AND COMPANY_CODE = #companyCode#
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......
......@@ -21,7 +21,20 @@
-->
<sqlMap namespace="HPPZ015">
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......
......@@ -79,7 +79,20 @@
B.STATUS as "pgStatus" <!-- 派工状态 -->
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......@@ -109,7 +122,20 @@
</isNotEmpty>
</sql>
<sql id="authCondition1">
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
A.DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
A.DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition1">
<include refid="authCondition1"/>
<isNotEmpty prepend=" AND " property="id">
A.ID = #id#
</isNotEmpty>
......
......@@ -34,6 +34,7 @@ import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
......@@ -557,21 +558,44 @@ public class HPPZTools {
* 查询菜单权限
*
* @param pageEname
* @param depAuth
* @return
*/
public static HPPZ010 getByPage(String pageEname) {
AssertUtils.isNull(pageEname, "菜单ID不能为空");
public static HPPZ010 getByPage(String pageEname, String depAuth) {
AssertUtils.isEmpty(pageEname, "页面号不能为空");
AssertUtils.isEmpty(depAuth, "部门不能为空");
String companyCode = UserSessionUtils.getCompanyCode();
if (StringUtils.isBlank(companyCode)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put(HPPZ010.FIELD_COMPANY_CODE, UserSessionUtils.getCompanyCode());
queryMap.put(HPPZ010.FIELD_COMPANY_CODE, companyCode);
queryMap.put(HPPZ010.FIELD_PAGE_ENAME, pageEname);
queryMap.put(HPPZ010.FIELD_DEP_AUTH, depAuth);
List<HPPZ010> results = DaoBase.getInstance().query(HPPZ010.QUERY, queryMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
/**
* 查询菜单权限
*
* @param pageEname
* @param depCodes
* @return
*/
public static List<HPPZ010> listByPage(String pageEname, List<String> depCodes) {
AssertUtils.isEmpty(pageEname, "页面号不能为空");
String companyCode = UserSessionUtils.getCompanyCode();
if (StringUtils.isBlank(companyCode)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put(HPPZ010.FIELD_COMPANY_CODE, companyCode);
queryMap.put(HPPZ010.FIELD_PAGE_ENAME, pageEname);
queryMap.put("depAuths", depCodes);
return DaoBase.getInstance().query(HPPZ010.QUERY, queryMap);
}
}
/**
......
......@@ -16,6 +16,18 @@
-->
<sqlMap namespace="HPRZ001">
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.rz.domian.HPRZ001">
SELECT
......@@ -29,6 +41,7 @@
OPER_DESC as "operDesc", <!-- 操作说明 -->
OPER_CONTENT as "operContent" <!-- 操作内容 -->
FROM hpjx.sys_operation_log WHERE 1=1
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
......@@ -60,6 +73,7 @@
<select id="count" resultClass="int">
SELECT COUNT(*) FROM hpjx.sys_operation_log WHERE 1=1
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
......
......@@ -2,6 +2,15 @@
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HPSC001">
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.sc.domain.HPSC001">
SELECT
......@@ -21,6 +30,7 @@
REMARK as "remark", <!-- 备注 -->
MATERIAL_STATUS as "materialStatus"
FROM hpjx.t_hpsc001 WHERE 1=1
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......@@ -62,6 +72,7 @@
<select id="count" resultClass="int">
SELECT COUNT(*) FROM hpjx.t_hpsc001 WHERE 1=1
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......@@ -213,6 +224,7 @@
REMARK as "remark", <!-- 备注 -->
MATERIAL_STATUS as "materialStatus"
FROM hpjx.t_hpsc001 WHERE 1=1
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
......@@ -229,7 +241,6 @@
UPDATE hpjx.t_hpsc001 SET MATERIAL_STATUS = #materialStatus# WHERE PROJ_CODE = #projCode#
</update>
<select id="queryDomainById" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.sc.domain.HPSC001">
SELECT
......@@ -248,6 +259,7 @@
DEP_CODE as "depCode", <!-- 部门编码 -->
REMARK as "remark" <!-- 备注 -->
FROM hpjx.t_hpsc001 WHERE 1=1
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......
......@@ -80,6 +80,7 @@
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......@@ -109,7 +110,20 @@
</isNotEmpty>
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition1">
<include refid="authCondition1"/>
<isNotEmpty prepend=" AND " property="id">
A.ID = #id#
</isNotEmpty>
......@@ -140,9 +154,18 @@
<isNotEmpty prepend=" AND " property="projCode">
A.PROJ_CODE = #projCode#
</isNotEmpty>
</sql>
<sql id="authCondition1">
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
A.DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
A.DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="order">
......
......@@ -27,7 +27,20 @@
B.RES_CNAME as "docName" <!-- 文件名称 -->
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
A.DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
A.DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
A.ID = #id#
</isNotEmpty>
......
......@@ -27,7 +27,20 @@
B.RES_CNAME as "docName" <!-- 文件名称 -->
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
A.DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
A.DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
A.ID = #id#
</isNotEmpty>
......
......@@ -3,12 +3,10 @@
<sqlMap namespace="HPSC003">
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projType">
PROJ_TYPE = #projType#
</isNotEmpty>
......@@ -59,6 +57,18 @@
</isNotEmpty>
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<!-- 公共修改字段 -->
<sql id="updateRevise">
UPDATED_BY = #updatedBy#, <!-- 修改人 -->
......
......@@ -49,15 +49,10 @@
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode">
PROJ_CODE = #projCode#
</isNotEmpty>
......@@ -180,6 +175,18 @@
</isNotEmpty>
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<!-- 公共修改字段 -->
<sql id="updateRevise">
UPDATED_BY = #updatedBy#, <!-- 修改人 -->
......
......@@ -53,15 +53,10 @@
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode">
PROJ_CODE like CONCAT('%', #projCode#, '%')
</isNotEmpty>
......@@ -125,6 +120,18 @@
</isNotEmpty>
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<!-- 公共修改字段 -->
<sql id="updateRevise">
UPDATED_BY = #updatedBy#, <!-- 修改人 -->
......
......@@ -23,7 +23,20 @@
UPDATED_TIME as "updatedTime" <!-- 更新时间 -->
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......
......@@ -38,7 +38,20 @@
C.PROD_TASK_NO as "zlprodTaskNo"
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
A.DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
A.DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
......
......@@ -98,7 +98,20 @@
COALESCE(C.ACTUAL_COMPLETION_NUM,0) as "actualCompletionTotalWt"<!-- 实际完工重量 -->
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
A.DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
A.DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd"> <!-- table information
Generate time : 2024-02-05 9:36:07
Version : 1.0
schema : hpjx
tableName : T_HPSC006
ID BIGINT NOT NULL primarykey,
COMPANY_CODE VARCHAR,
PROJ_CODE VARCHAR,
PROJ_NAME VARCHAR,
PRODUCTION_ORDER_NO VARCHAR,
INVENT_TYPE TINYINT,
INVENT_CODE VARCHAR,
INVENT_NAME VARCHAR,
INVENT_LENGTH DECIMAL,
INVENT_WIDTH DECIMAL,
INVENT_THICK DECIMAL,
INVENT_SPEC VARCHAR,
PLAN_COMPLETION_DATE VARCHAR,
NUM DECIMAL,
UNIT_WT DECIMAL,
TOTAL_WT DECIMAL,
ACTUAL_COMPLETION_DATE VARCHAR,
ACTUAL_COMPLETION_NUM DECIMAL,
STATUS TINYINT,
ORG_NO VARCHAR,
ORG_NAME VARCHAR,
FACTORY_CODE VARCHAR,
FACTORY_NAME VARCHAR,
CREATED_BY VARCHAR,
CREATED_TIME VARCHAR,
UPDATED_BY VARCHAR,
UPDATED_TIME VARCHAR,
DEP_CODE VARCHAR,
REMARK VARCHAR,
FILE_PATH1 VARCHAR,
INVENT_RECORD_ID INTEGER
-->
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HPSC006">
<sql id="column">
ID as "id",
COMPANY_CODE as "companyCode", <!-- 企业编码 预留 -->
......@@ -74,12 +39,10 @@
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode">
PROJ_CODE = #projCode#
</isNotEmpty>
......@@ -172,6 +135,18 @@
</isNotEmpty>
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="order">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
......
......@@ -118,6 +118,18 @@
B.PART_NAME AS "partName"
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
A.DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
A.DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
A.ID = #id#
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd"> <!-- table information
Generate time : 2024-02-06 15:50:11
Version : 1.0
schema : hpjx
tableName : T_HPSC007
ID BIGINT NOT NULL primarykey,
COMPANY_CODE VARCHAR,
HPSC006_ID VARCHAR,
ACTUAL_COMPLETION_DATE VARCHAR,
ACTUAL_COMPLETION_NUM DECIMAL,
ACTUAL_COMPLETION_TOTAL_WT DECIMAL,
USER_ID VARCHAR,
USER_NAME VARCHAR,
CREATED_BY VARCHAR,
CREATED_TIME VARCHAR,
UPDATED_BY VARCHAR,
UPDATED_TIME VARCHAR,
DEP_CODE VARCHAR,
REMARK VARCHAR
-->
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HPSC007">
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="hpsc006Id">
HPSC006_ID = #hpsc006Id#
</isNotEmpty>
......@@ -66,6 +45,18 @@
</isNotEmpty>
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.sc.domain.HPSC007">
SELECT
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">
<!-- table information
Generate time : 2024-03-07 17:21:17
Version : 1.0
schema : hpjx
tableName : T_HPXS001
ID BIGINT NOT NULL primarykey,
COMPANY_CODE VARCHAR,
DEP_CODE VARCHAR,
REGISTER_DATE VARCHAR,
FACTORY_CODE VARCHAR NOT NULL,
GROUP_CODE VARCHAR,
USER_ID VARCHAR,
GROUP_TYPE VARCHAR,
PRDT_CODE VARCHAR,
PRDT_NAME VARCHAR,
WEIGHT DECIMAL,
REMARK VARCHAR,
DELETE_FLAG TINYINT,
CREATED_BY VARCHAR,
CREATED_NAME VARCHAR,
CREATED_TIME VARCHAR,
UPDATED_BY VARCHAR,
UPDATED_TIME VARCHAR,
UPDATED_NAME VARCHAR
-->
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HPSC008">
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="registerDate">
REGISTER_DATE = #registerDate#
</isNotEmpty>
......@@ -93,6 +63,18 @@
</isNotEmpty>
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.sc.domain.HPSC008">
SELECT
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<!-- table information
Generate time : 2024-01-10 9:33:44
Version : 1.0
tableName :hpjx.t_hpsc001
ID BIGINT NOT NULL primarykey,
COMPANY_CODE VARCHAR NOT NULL,
PROJ_TYPE TINYINT,
PROJ_CODE VARCHAR,
PROJ_NAME VARCHAR,
PRINC1 VARCHAR,
PRINC2 VARCHAR,
STATUS TINYINT,
CREATED_BY VARCHAR,
CREATED_TIME DATETIME,
UPDATED_BY VARCHAR,
UPDATED_TIME DATETIME,
DEP_CODE VARCHAR
-->
<sqlMap namespace="HPSC001">
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.sc.domain.HPSC001">
SELECT
......@@ -38,6 +32,7 @@
DEP_CODE as "depCode", <!-- 部门编码 -->
MATERIAL_STATUS as "materialStatus"
FROM hpjx.t_hpsc001 WHERE 1=1
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......@@ -73,6 +68,7 @@
<select id="count" resultClass="int">
SELECT COUNT(*) FROM hpjx.t_hpsc001 WHERE 1=1
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......
package com.baosight.hpjx.hp.xs.domain;
import java.io.Serializable;
import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.util.StringUtils;
import java.util.HashMap;
import java.util.Map;
/**
* @author:songx
* @date:2024/1/15,14:50
*/
public class Org implements Serializable {
public class Org extends DaoEPBase {
public static final String FIELD_COMPANY_CODE = "companyCode"; /* 企业编码*/
public static final String FIELD_ORG_ID = "orgId"; /* 组织机构ID*/
public static final String FIELD_ORG_ENAME = "orgEname"; /* 组织机构名称*/
public static final String FIELD_ORG_CNAME = "orgCname"; /* 组织机构名称*/
public static final String FIELD_ORG_TYPE = "orgType"; /* 用户ID*/
public static final String FIELD_PARENT_ORG_ID = "parentOrgId"; /* 用户中文名*/
public static final String FIELD_FACTORY_CODE = "factoryCode"; /* 性别*/
public static final String FIELD_FACTORY_NAME = "factoryName"; /* 手机号*/
public static final String FIELD_LEVEL = "level"; /* 邮箱*/
private String companyCode = ""; /* 企业编码 */
private String orgId = ""; /* 组织ID */
private String orgEname = ""; /* 组织英文名 */
private String orgCname = ""; /* 组织中文名 */
private String orgType = ""; /* 组织类型 */
private String parentOrgId = ""; /* 父级组织ID */
private String factoryCode = ""; /* 厂区编码 */
private String factoryName = ""; /* 厂区名称 */
private String level = ""; /* 层级 */
/**
* 组织ID
* initialize the metadata.
*/
private String orgId;
public void initMetaData() {
EiColumn eiColumn;
/**
* 组织英文名
*/
private String orgEname;
eiColumn = new EiColumn(FIELD_COMPANY_CODE);
eiColumn.setDescName("企业编码");
eiMetadata.addMeta(eiColumn);
/**
* 组织中文名
*/
private String orgCname;
eiColumn = new EiColumn(FIELD_ORG_ID);
eiColumn.setDescName("组织ID");
eiMetadata.addMeta(eiColumn);
/**
* 组织类型
*/
private String orgType;
eiColumn = new EiColumn(FIELD_ORG_ENAME);
eiColumn.setDescName("组织英文名");
eiMetadata.addMeta(eiColumn);
/**
* 父级组织ID
*/
private String parentOrgId;
eiColumn = new EiColumn(FIELD_ORG_CNAME);
eiColumn.setDescName("组织中文名");
eiMetadata.addMeta(eiColumn);
/**
* 厂区编码
*/
private String factoryCode;
eiColumn = new EiColumn(FIELD_ORG_TYPE);
eiColumn.setDescName("组织类型");
eiMetadata.addMeta(eiColumn);
/**
* 厂区名称
*/
private String factoryName;
eiColumn = new EiColumn(FIELD_PARENT_ORG_ID);
eiColumn.setDescName("父级组织ID");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_FACTORY_CODE);
eiColumn.setDescName("厂区编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_FACTORY_NAME);
eiColumn.setDescName("厂区名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_LEVEL);
eiColumn.setDescName("层级");
eiMetadata.addMeta(eiColumn);
}
/**
* 层级
* the constructor.
*/
private String level;
public Org() {
initMetaData();
}
public String getCompanyCode() {
return companyCode;
}
public void setCompanyCode(String companyCode) {
this.companyCode = companyCode;
}
public String getOrgId() {
return orgId;
......@@ -111,4 +155,43 @@ public class Org implements Serializable {
public void setLevel(String level) {
this.level = level;
}
/**
* get the value from Map.
*
* @param map - source data map
*/
@Override
public void fromMap(Map map) {
setCompanyCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_CODE)), companyCode));
setOrgId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ORG_ID)), orgId));
setOrgEname(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ORG_ENAME)), orgEname));
setOrgCname(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ORG_CNAME)), orgCname));
setOrgType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ORG_TYPE)), orgType));
setParentOrgId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PARENT_ORG_ID)), parentOrgId));
setFactoryCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_FACTORY_CODE)), factoryCode));
setFactoryName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_FACTORY_NAME)), factoryName));
setLevel(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_LEVEL)), level));
}
/**
* set the value to Map.
*/
@Override
public Map toMap() {
Map map = new HashMap();
map.put(FIELD_COMPANY_CODE, StringUtils.toString(companyCode, eiMetadata.getMeta(FIELD_COMPANY_CODE)));
map.put(FIELD_ORG_ID, StringUtils.toString(orgId, eiMetadata.getMeta(FIELD_ORG_ID)));
map.put(FIELD_ORG_ENAME, StringUtils.toString(orgEname, eiMetadata.getMeta(FIELD_ORG_ENAME)));
map.put(FIELD_ORG_CNAME, StringUtils.toString(orgCname, eiMetadata.getMeta(FIELD_ORG_CNAME)));
map.put(FIELD_ORG_TYPE, StringUtils.toString(orgType, eiMetadata.getMeta(FIELD_ORG_TYPE)));
map.put(FIELD_PARENT_ORG_ID, StringUtils.toString(parentOrgId, eiMetadata.getMeta(FIELD_PARENT_ORG_ID)));
map.put(FIELD_FACTORY_CODE, StringUtils.toString(factoryCode, eiMetadata.getMeta(FIELD_FACTORY_CODE)));
map.put(FIELD_FACTORY_NAME, StringUtils.toString(factoryName, eiMetadata.getMeta(FIELD_FACTORY_NAME)));
map.put(FIELD_LEVEL, StringUtils.toString(level, eiMetadata.getMeta(FIELD_LEVEL)));
return map;
}
}
......@@ -63,7 +63,7 @@
<include refid="customCondition"/>
</select>
<!-- 查询企业所有的组织机构 -->
<!-- 查询指定组织机构下所有的子集组织机构(不包含root) -->
<select id="queryAll" parameterClass="java.util.HashMap" resultClass="com.baosight.hpjx.hp.xs.domain.Org">
SELECT
T2.LEVEL AS "level", T3.ORG_ID AS "orgId",
......@@ -80,13 +80,19 @@
) AS T1,
@LEVEL:=@LEVEL+1 AS LEVEL
FROM ${platSchema}.TXSOG01,
<isNotEmpty property="parentOrgId">
(SELECT @CODES:=#parentOrgId#, @LEVEL:= 0) T4
</isNotEmpty>
<isEmpty property="parentOrgId">
(SELECT @CODES:='root', @LEVEL:= 0) T4
</isEmpty>
WHERE @CODES IS NOT NULL
) T2,
${platSchema}.TXSOG01 T3
LEFT JOIN ${platSchema}.TXSOG01 T5 ON T3.FACTORY_CODE = T5.ORG_ID
WHERE 1=1
AND FIND_IN_SET(T3.ORG_ID, T2.CODES)
AND T3.ORG_ID != 'root'
ORDER BY T3.FACTORY_CODE ASC, T2.LEVEL ASC, T3.ORG_ID ASC
</select>
......
......@@ -3,6 +3,7 @@ package com.baosight.hpjx.hp.xs.tools;
import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.core.enums.OrgTypeEnum;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.xs.domain.Org;
import com.baosight.hpjx.hp.xs.domain.User;
import com.baosight.hpjx.util.AssertUtils;
......@@ -18,6 +19,7 @@ import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import com.baosight.xservices.xs.constants.LoginConstants;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -162,7 +164,7 @@ public class HPXSTools {
AssertUtils.isEmpty(orgId, "组织编码不能为空");
Map paramMap = new HashMap();
paramMap.put("orgId", orgId);
List<Org> results = DaoBase.getInstance().query("HPXSOrg.query", paramMap);
List<Org> results = DaoBase.getInstance().query(HPSqlConstant.HpXsOrg.QUERY, paramMap);
AssertUtils.isEmpty(results, String.format("组织信息[%s]不存在", orgId));
return results.get(0);
}
......@@ -172,11 +174,14 @@ public class HPXSTools {
*
* @return
*/
public static String getOrgId() {
public static List<String> getOrgId() {
Map paramMap = new HashMap();
paramMap.put("userId", UserSession.getLoginName());
List<Map> results = DaoBase.getInstance().query("HPXSUser.queryOrgId", paramMap);
return CollectionUtils.isEmpty(results) ? "" : results.get(0).get("orgId").toString();
List<Map> results = DaoBase.getInstance().query(HPSqlConstant.HpXsOrg.QUERY_ORG_ID, paramMap);
if (CollectionUtils.isEmpty(results)) {
return null;
}
return results.stream().map(item -> item.get("orgId").toString()).collect(Collectors.toList());
}
/**
......@@ -189,7 +194,7 @@ public class HPXSTools {
AssertUtils.isNull(orgId, "组织ID不能为空");
Map queryMap = new HashMap();
queryMap.put("orgId", orgId);
List<Org> results = DaoBase.getInstance().query("HPXSOrg.queryParent", queryMap);
List<Org> results = DaoBase.getInstance().query(HPSqlConstant.HpXsOrg.QUERY_PARENT, queryMap);
AssertUtils.isNull(results, String.format("组织[%s]不存在父级信息", orgId));
return results;
}
......@@ -205,12 +210,25 @@ public class HPXSTools {
Map queryMap = new HashMap();
queryMap.put("orgId", orgId);
queryMap.put("orgType", OrgTypeEnum.FACTORY.getCode());
List<Org> results = DaoBase.getInstance().query("HPXSOrg.queryParent", queryMap);
List<Org> results = DaoBase.getInstance().query(HPSqlConstant.HpXsOrg.QUERY_PARENT, queryMap);
AssertUtils.isNull(results, String.format("组织[%s]不存在厂区信息", orgId));
return results.get(0);
}
/**
* 查询指定组织机构下所有的子集组织机构
*
* @param parentOrgId root:查询企业所有的组织信息
* @return
*/
public static List<Org> queryByParent(String parentOrgId) {
AssertUtils.isNull(parentOrgId, "组织ID不能为空");
Map queryMap = new HashMap();
queryMap.put("parentOrgId", parentOrgId);
return DaoBase.getInstance().query(HPSqlConstant.HpXsOrg.QUERY_ALL, queryMap);
}
/**
* 查询企业下所有组织按厂区分组
*
* @return
......@@ -222,7 +240,7 @@ public class HPXSTools {
}
Map queryMap = new HashMap();
queryMap.put("companyCode", companyCode);
List<Org> results = DaoBase.getInstance().query("HPXSOrg.queryAll", queryMap);
List<Org> results = DaoBase.getInstance().query(HPSqlConstant.HpXsOrg.QUERY_ALL, queryMap);
if (CollectionUtils.isEmpty(results)) {
return null;
}
......@@ -249,6 +267,41 @@ public class HPXSTools {
return results;
}
/**
* 查询组织机构的子集
*
* @param orgId
* @return
*/
public static List<String> queryChildren(String orgId) {
// 查询组织子集
List<Org> dbOrgs = HPXSTools.XsOrg.queryByParent(orgId);
if (CollectionUtils.isEmpty(dbOrgs)) {
return null;
}
return dbOrgs.stream().map(Org::getOrgId).collect(Collectors.toList());
}
/**
* 查询组织机构的子集
*
* @param orgIds
* @return
*/
public static List<String> queryChildren(List<String> orgIds) {
List<String> childOrgIds = new ArrayList<>();
for (String orgId : orgIds) {
// 已经存在不在重复查询
if (childOrgIds.contains(orgId)) {
continue;
}
// 查询组织子集
List<Org> dbOrgs = HPXSTools.XsOrg.queryByParent(orgId);
childOrgIds.addAll(dbOrgs.stream().map(Org::getOrgId).collect(Collectors.toList()));
}
// 去除重复组织机构
return childOrgIds.stream().distinct().collect(Collectors.toList());
}
}
}
......@@ -34,8 +34,21 @@
DELETE_FLAG as "deleteFlag" <!-- 是否删除 -->
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
AND DELETE_FLAG = 0
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......
......@@ -27,7 +27,20 @@
B.RES_CNAME as "docName" <!-- 文件名称 -->
</sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
A.DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
A.DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id">
A.ID = #id#
</isNotEmpty>
......
......@@ -2,14 +2,19 @@ package com.baosight.iplat4j.core.data.ibatis.dao;
import com.baosight.hpjx.common.AuthTypeEnum;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.core.tools.ThreadLocalTools;
import com.baosight.hpjx.hp.pz.domain.HPPZ010;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.hpjx.util.ObjectUtils;
import com.baosight.hpjx.hp.xs.domain.Org;
import com.baosight.hpjx.hp.xs.tools.HPXSTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.StringUtils;
import com.baosight.iplat4j.core.service.soa.DomainQuery.PageStatus;
import com.baosight.iplat4j.core.util.ExceptionUtil;
import org.apache.commons.collections.CollectionUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
......@@ -29,7 +34,7 @@ public class SqlMapDaoLogProxy extends SqlMapDao {
public List query(String name, Object parameters) {
try {
// 初始化参数
this.setCompanyCode(name, parameters);
this.setAuthParam(name, parameters);
List ret = super.query(name, parameters);
return ret;
} catch (RuntimeException var4) {
......@@ -40,7 +45,7 @@ public class SqlMapDaoLogProxy extends SqlMapDao {
public List queryAll(String name, Object parameters) {
try {
// 初始化参数
this.setCompanyCode(name, parameters);
this.setAuthParam(name, parameters);
List ret = super.queryAll(name, parameters);
return ret;
} catch (RuntimeException var4) {
......@@ -51,7 +56,7 @@ public class SqlMapDaoLogProxy extends SqlMapDao {
public List query(String name, Object parameters, int offset, int limit) {
try {
// 初始化参数
this.setCompanyCode(name, parameters);
this.setAuthParam(name, parameters);
List ret = super.query(name, parameters, offset, limit);
return ret;
} catch (RuntimeException var6) {
......@@ -77,7 +82,7 @@ public class SqlMapDaoLogProxy extends SqlMapDao {
try {
// 初始化参数
this.setCompanyCode(name, parameters);
this.setAuthParam(name, parameters);
int ret = super.count(name, parameters);
return ret;
} catch (RuntimeException var5) {
......@@ -154,24 +159,38 @@ public class SqlMapDaoLogProxy extends SqlMapDao {
}
/**
* 设置企业编码
* 设置权限参数
*
* @param name
* @param parameters
*/
private void setCompanyCode(String name, Object parameters) {
// 查询登录用户信息时不设置企业编码,否则会形成死循环
// 仅限业务模块的查询需要设置企业编码
if (name.startsWith("HPXSUser") || !name.startsWith("HP") || !(parameters instanceof Map)) {
private void setAuthParam(String name, Object parameters) {
// 需要过滤部分sql name,否则会形成死循环
if (!name.startsWith("HP") || !(parameters instanceof Map)) {
return;
}
if (parameters == null) {
parameters = new HashMap();
}
// 企业编码
// 设置企业信息
this.setCompanyCode(name, parameters);
// 设置数据查询权限
this.setDataAuth(name, parameters);
}
/**
* 设置企业编码
*
* @param name
* @param parameters
*/
private void setCompanyCode(String name, Object parameters) {
// 需要过滤部分sql name,否则会形成死循环
String[] serviceFilter = {"HPXSUser"};
if (StringUtils.startsWithAny(name, serviceFilter)) {
return;
}
((Map) parameters).put("companyCode", UserSessionUtils.getCompanyCode());
// 部门编码
// ((Map) parameters).put("depCode", UserSessionUtils.getDepCode());
}
/**
......@@ -181,60 +200,77 @@ public class SqlMapDaoLogProxy extends SqlMapDao {
* @param parameters
*/
private void setDataAuth(String name, Object parameters) {
// 仅限业务模块的查询需要设置企业编码
if (name.startsWith("HPXSUser") || !name.startsWith("HP") || !(parameters instanceof Map)) {
// 需要过滤部分sql name,否则会形成死循环
String[] serviceFilter = {"HPXSUser", "HPXSOrg", "HPPZ010.query"};
if (StringUtils.startsWithAny(name, serviceFilter)) {
return;
}
if (parameters == null) {
parameters = new HashMap();
// 是否启用数据权限
if (!ThreadLocalTools.DATA_AUTH.get()) {
return;
}
// 页面英文名
String pageEname = MapUtils.getString((Map) parameters, "pageEname");
String pageEname = ThreadLocalTools.FORM_ENAME.get();
if (StringUtils.isBlank(pageEname)) {
return;
}
// 组装权限条件
HPPZ010 dbPz010 = HPPZTools.HpPz010.getByPage(pageEname);
if (dbPz010 == null || StringUtils.isBlank(dbPz010.getCustomAuth())
|| StringUtils.isBlank(dbPz010.getDepAuth())) {
((Map) parameters).put("dataAuthCondition", " AND DEP_CODE = 'NOT AUTH'");
return;
}
buildCustomCondition(dbPz010);
buildDepCondition(dbPz010);
// 当前用户所在的部门
List<String> userOrgIds = UserSessionUtils.getOrgId();
AssertUtils.isEmpty(userOrgIds, "当前用户未绑定部门,无法操作数据,请联系管理员!");
// 构建部门权限
buildDepAuth(pageEname, userOrgIds, parameters);
}
/**
* 组装 Custom Data Auth Condition
* 构建部门权限
*
* @param dbPz010
* @param pageEname
* @param userOrgIds
* @param parameters
*/
private void buildCustomCondition(HPPZ010 dbPz010) {
if (StringUtils.isBlank(dbPz010.getCustomAuth())) {
private void buildDepAuth(String pageEname, List<String> userOrgIds, Object parameters) {
// 查询当前页面设置的所有权限
List<HPPZ010> dbPz010s = HPPZTools.HpPz010.listByPage(pageEname, userOrgIds);
if (CollectionUtils.isEmpty(dbPz010s)) {
((Map) parameters).put("depCode", AuthTypeEnum.NO_AUTH.getCode());
return;
}
String[] customAuths = dbPz010.getCustomAuth().split(",");
for (String item : customAuths) {
AuthTypeEnum authTypeEnum = AuthTypeEnum.getByCode(item);
if (authTypeEnum == null) {
continue;
// 构建数据范围权限查询条件
List<String> depCodes = new ArrayList<>();
for (HPPZ010 dbPz010 : dbPz010s) {
List<String> depAuths = buildDepCondition(dbPz010);
// ALL查看所有数据,仅限本企业
if (depAuths.contains(AuthTypeEnum.ALL.getCode())) {
depCodes = null;
break;
}
depCodes.addAll(depAuths);
}
((Map) parameters).put("depCodes", depCodes);
}
/**
* 组装 Dep Data Auth Condition
* 组装 Custom Data Auth Condition
*
* @param dbPz010
*/
private void buildDepCondition(HPPZ010 dbPz010) {
if (StringUtils.isBlank(dbPz010.getDepAuth())) {
return;
}
String[] depAuths = dbPz010.getDepAuth().split(",");
for (String item : depAuths) {
private List<String> buildDepCondition(HPPZ010 dbPz010) {
String customAuth = dbPz010.getCustomAuth();
if (StringUtils.isBlank(customAuth) || AuthTypeEnum.NO_AUTH.getCode().equals(customAuth)) {
return Arrays.asList(AuthTypeEnum.NO_AUTH.getCode());
}
String depAuth = dbPz010.getDepAuth();
// 看全部
if (AuthTypeEnum.ALL.getCode().equals(customAuth)) {
return Arrays.asList(AuthTypeEnum.ALL.getCode());
} else if (AuthTypeEnum.ONLY_FACTORY.getCode().equals(customAuth)) {
// 查询当前部门所在的厂及子集
Org factoryOrg = HPXSTools.XsOrg.queryFactory(depAuth);
return HPXSTools.XsOrg.queryChildren(factoryOrg.getOrgId());
} else if (AuthTypeEnum.ONLY_DEPT.getCode().equals(customAuth)) {
return HPXSTools.XsOrg.queryChildren(depAuth);
} else {
return Arrays.asList(AuthTypeEnum.NO_AUTH.getCode());
}
}
......
......@@ -18,67 +18,78 @@ $(function () {
* 页面加载时执行
*/
$(window).load(function () {
// 禁用checkBox
disableCheckBox(true);
// 禁用Input
disableInput(true);
// 全选框绑定事件
allCheckBoxEvent();
allInputEvent();
// 子项绑定事件
customAuthCheckBoxEvent();
depAuthCheckBoxEvent()
customAuthInputEvent();
// 部门绑定事件
depAuthInputEvent()
});
/**
* checkBox集合
* Input集合
*
* @returns {*|jQuery|HTMLElement}
*/
let listCustomCheckBox = function () {
return $("input:checkbox[name='result-0-customAuth']");
let listCustomInput = function () {
return $("input:radio[name='result-0-customAuth']");
}
/**
* checkBox集合
* Input集合
*
* @returns {*|jQuery|HTMLElement}
*/
let listDepCheckBox = function () {
return $("input:checkbox[name='result-0-depAuth']");
let listDepInput = function () {
return $("input:radio[name='result-0-depAuth']");
}
/**
* 清除checkBox选择
* 清除Input选择
*
* @param bool
*/
let clearCheckedCheckBox = function () {
let clearCheckedInput = function () {
// 全选
$("input:checkbox[name='result-0-authAll']").prop('checked', '');
// $("input:checkbox[name='result-0-authAll']").prop('checked', 'false');
// 权限子项
checkedCheckBox(false);
checkedCustomInput(false);
// 部门子项
checkedDepInput(false);
}
/**
* 选中或取消checkBox
* 选中或取消Input,权限子项
*
* @param bool
*/
let checkedCheckBox = function (bool) {
// 权限子项
listCustomCheckBox().prop('checked', bool);
listDepCheckBox().prop('checked', bool);
let checkedCustomInput = function (bool) {
listCustomInput().prop('checked', bool);
}
/**
* 选中或取消Input,部门子项
*
* @param bool
*/
let checkedDepInput = function (bool) {
listDepInput().prop('checked', bool);
}
/**
* 禁用或启用checkBox
* 禁用或启用Input
*/
let disableCheckBox = function (bool) {
let disableInput = function (bool) {
// 全选
$("input:checkbox[name='result-0-authAll']").attr('readonly', bool);
// 权限子项
listCustomCheckBox().each(function () {
// $("input:checkbox[name='result-0-authAll']").attr('readonly', bool);
// 数据权限
listCustomInput().each(function () {
$(this).attr('readonly', bool);
});
listDepCheckBox().each(function () {
// 部门权限
listDepInput().each(function () {
$(this).attr('readonly', bool);
});
}
......@@ -86,62 +97,62 @@ let disableCheckBox = function (bool) {
/**
* 全选框绑定事件
*/
let allCheckBoxEvent = function () {
let allInputEvent = function () {
$("input:checkbox[name='result-0-authAll']").on("change", function () {
if ($(this).prop('readonly')) {
$(this).attr('checked', false);
return;
}
checkedCheckBox(this.checked);
listDepInput().prop('checked', this.checked);
});
}
/**
* 子项绑定事件
* 数据权限绑定事件
*/
let customAuthCheckBoxEvent = function () {
$("input:checkbox[name='result-0-customAuth']").on("change", function () {
let customAuthInputEvent = function () {
$("input:radio[name='result-0-customAuth']").on("change", function () {
if ($(this).prop('readonly')) {
$(this).prop('checked', '');
return;
}
// 判断全选框是选中还是不选中
setAllCheckBox();
});
}
/**
* 子项绑定事件
* 组织部门绑定事件
*/
let depAuthCheckBoxEvent = function () {
$("input:checkbox[name='result-0-depAuth']").on("change", function () {
let depAuthInputEvent = function () {
$("input:radio[name='result-0-depAuth']").on("change", function () {
if ($(this).prop('readonly')) {
$(this).prop('checked', '');
return;
}
// 判断全选框是选中还是不选中
setAllCheckBox();
// setAllInput();
// 加载部门权限
showAuthInput();
});
}
/**
* 设置全选框选中或取消
*/
let setAllCheckBox = function (){
let setAllInput = function (){
// 判断全选框是选中还是不选中
let allCheckBool = true;
listCustomCheckBox().each(function () {
if ($(this).prop('checked') == false) {
allCheckBool = false;
}
})
listDepCheckBox().each(function () {
// listCustomInput().each(function () {
// if ($(this).prop('checked') == false) {
// allCheckBool = false;
// }
// })
listDepInput().each(function () {
if ($(this).prop('checked') == false) {
allCheckBool = false;
}
})
// 全选
$("input:checkbox[name='result-0-authAll']").prop('checked', allCheckBool);
// $("input:checkbox[name='result-0-authAll']").prop('checked', allCheckBool);
}
/**
......@@ -154,15 +165,15 @@ let treeNodeSelect = function (nodeData) {
setSelectTreeNode(nodeData);
// 非叶子节点清空显示
if (nodeData.leaf) {
// 禁用checkBox
disableCheckBox(true);
// 禁用Input
disableInput(true);
// 清空选项
clearCheckedCheckBox();
clearCheckedInput();
} else {
// 启用checkBox
disableCheckBox(false);
// 启用Input
disableInput(false);
// 渲染权限
showAuthInput(nodeData.label);
showAuthInput();
}
}
......@@ -182,13 +193,20 @@ let setSelectTreeNode = function (nodeData) {
*
* @param node
*/
let showAuthInput = function (node) {
let showAuthInput = function () {
let depAuth = $("input:radio[name='result-0-depAuth']:checked").val();
let node = IPLATUI.EFTree.pageTree.selectTreeNode.label;
if(isBlank(depAuth) || isBlank(node)){
return;
}
// 渲染权限
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-depAuth", depAuth);
inInfo.set("inqu_status-0-pageEname", node);
EiCommunicator.send("HPPZ010", "getByPage", inInfo, {
onSuccess: getByPageSuccess,
onFail: function (res) {
message(res.msg);
}
}, {async: false});
}
......@@ -199,8 +217,8 @@ let showAuthInput = function (node) {
* @param res
*/
let getByPageSuccess = function (res) {
// 清空所有选
clearCheckedCheckBox();
// 清空权限子
checkedCustomInput(false);
if (res.status < 0) {
message(res.msg);
return;
......@@ -212,7 +230,7 @@ let getByPageSuccess = function (res) {
let customAuth = resultRows[0]['customAuth'];
if(!isBlank(customAuth)){
let customAuths = customAuth.split(',');
listCustomCheckBox().each(function () {
listCustomInput().each(function () {
for (let i = 0; i < customAuths.length; i++) {
if ($(this).val() == customAuths[i]) {
$(this).prop('checked', 'true');
......@@ -220,19 +238,8 @@ let getByPageSuccess = function (res) {
}
})
}
let depAuth = resultRows[0]['depAuth'];
if(!isBlank(depAuth)){
let depAuths = depAuth.split(',');
listDepCheckBox().each(function () {
for (let i = 0; i < depAuths.length; i++) {
if ($(this).val() == depAuths[i]) {
$(this).prop('checked', 'true');
}
}
})
}
// 判断全选框是选中还是不选中
setAllCheckBox();
// setAllInput();
}
/**
......@@ -254,19 +261,22 @@ let save = function () {
* 保存确认
*/
let saveOk = function () {
let selectTreeNode = IPLATUI.EFTree.pageTree.selectTreeNode;
if (isBlank(selectTreeNode)) {
message("请选择菜单");
return;
}
let depAuth = $("input:radio[name='result-0-depAuth']:checked").val();
if (isBlank(depAuth)) {
message("请选择部门");
return;
}
let customAuth = '';
listCustomCheckBox().each(function () {
listCustomInput().each(function () {
if ($(this).prop('checked')) {
customAuth += ('' == customAuth ? $(this).val() : ',' + $(this).val());
}
})
let depAuth = '';
listDepCheckBox().each(function () {
if ($(this).prop('checked')) {
depAuth += ('' == depAuth ? $(this).val() : ',' + $(this).val());
}
})
let selectTreeNode = IPLATUI.EFTree.pageTree.selectTreeNode;
let inInfo = new EiInfo();
inInfo.set("result-0-pageEname", selectTreeNode.label);
inInfo.set("result-0-pageCname", selectTreeNode.text);
......
......@@ -29,48 +29,44 @@
</div>
<div class="col-md-9">
<%-- <EF:EFRegion title="自定义" id="result" hidden="true">--%>
<%-- <div class="row">--%>
<%-- <EF:EFInput cname="本厂" blockId="result" ename="customAuth" row="0" value="onlyFactory" colWidth="3"--%>
<%-- type="checkbox" inline="true"/>--%>
<%-- <EF:EFInput cname="本部门" blockId="result" ename="customAuth" row="0" value="onlyDept" colWidth="3"--%>
<%-- type="checkbox" inline="true"/>--%>
<%-- </div>--%>
<%-- </EF:EFRegion>--%>
<EF:EFRegion title="组织机构" id="org">
<div class="row">
<EF:EFInput cname="全选" blockId="result" ename="authAll" row="0" value="0" colWidth="3"
type="checkbox" inline="true"/>
</div>
<c:forEach items="${requestScope.orgMap}" var="entry">
<c:forEach items="${entry.value}" var="item" varStatus="i">
<c:if test="${item.orgType == 'factory'}">
<c:if test="${i.index == 0}">
<div class="row">
<EF:EFInput cname="${item.orgCname}" blockId="result" ename="depAuth" row="0"
value="${item.orgId}" colWidth="3" type="checkbox" inline="true"/>
</div>
<div class="row">
<div class="col-md-9">
</c:if>
<c:if test="${i.index != 0}">
</div>
<div class="row">
<EF:EFInput cname="${item.orgCname}" blockId="result" ename="depAuth" row="0"
value="${item.orgId}" colWidth="3" type="checkbox" inline="true"/>
</div>
<div class="row">
<div class="col-md-9">
</c:if>
</c:if>
<c:if test="${item.orgType != 'factory'}">
<EF:EFInput cname="${item.orgCname}" blockId="result" ename="depAuth" row="0"
value="${item.orgId}" colWidth="3" type="checkbox" inline="true"/>
</c:if>
value="${item.orgId}" colWidth="3" type="radio" inline="true"/>
</c:forEach>
</div>
</div>
</c:forEach>
</EF:EFRegion>
<EF:EFRegion title="提示">
<%-- <span style="color: red">1:非叶子节点授权时,会同步将该节点下的所有子节点权限设置为当前选择的权限。</span>--%>
<EF:EFRegion title="数据查看范围" id="result">
<div class="row">
<div class="col-md-9">
<EF:EFInput cname="不可查看" blockId="result" ename="customAuth" row="0" value="noAuth" colWidth="3"
type="radio" inline="true"/>
<EF:EFInput cname="本企业" blockId="result" ename="customAuth" row="0" value="onlyCompany"
colWidth="3" type="radio" inline="true"/>
<EF:EFInput cname="本厂" blockId="result" ename="customAuth" row="0" value="onlyFactory"
colWidth="3" type="radio" inline="true"/>
<EF:EFInput cname="本部门" blockId="result" ename="customAuth" row="0" value="onlyDept"
colWidth="3" type="radio" inline="true"/>
</div>
</div>
</EF:EFRegion>
<EF:EFRegion title="提示" hidden="true">
<span style="color: red">1:仅叶子节点页面可设置数据权限。</span>
</EF:EFRegion>
</div>
</div>
......
$(function () {
IPLATUI.EFGrid.result = {
pageable: {
pageSize: 15,
pageSizes: [15, 50, 70, 100],
},
"result": {
columns: []
}
}
// 查询
$("#QUERY").on("click", query);
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 查询
query();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
}
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="用户数据权限查询">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFInput cname="登录名" blockId="inqu_status" ename="userId" row="0" colWidth="3"/>
<EF:EFInput cname="用户姓名" blockId="inqu_status" ename="userName" row="0" colWidth="3"/>
<EF:EFInput cname="菜单名称" blockId="inqu_status" ename="pageCname" row="0" colWidth="3"/>
<EF:EFSelect cname="组织机构" blockId="inqu_status" ename="orgId" row="0" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="org_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="userId" cname="登录名" enable="false" width="120" align="center"/>
<EF:EFColumn ename="userName" cname="用户姓名" enable="false" width="140" align="center"/>
<EF:EFColumn ename="pageCname" cname="菜单名称" enable="false" width="140" align="center"/>
<EF:EFComboColumn ename="orgId" cname="组织机构" enable="false" width="140" align="center">
<EF:EFOptions blockId="org_record_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="orgCname" cname="组织机构名称" enable="false" width="140" align="center"/>
<EF:EFComboColumn ename="customAuth" cname="数据权限" enable="false" width="140" align="center">
<EF:EFCodeOption codeName="hpjx.hppz.authType"/>
</EF:EFComboColumn>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
......@@ -31,7 +31,7 @@
<EF:EFInput cname="联系方式" blockId="inqu_status" ename="mobile" row="0" colWidth="3"/>
<EF:EFSelect cname="状态" blockId="inqu_status" ename="status" row="0" colWidth="3">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="ctdy.hppz.userStatus"/>
<EF:EFCodeOption codeName="hpjx.hppz.userStatus"/>
</EF:EFSelect>
</div>
</EF:EFRegion>
......@@ -56,7 +56,7 @@
<EF:EFColumn ename="mobile" cname="联系方式" width="120" align="center" required="true" readonly="true"/>
<EF:EFComboColumn ename="status" cname="状态" width="80" align="center" defaultValue="1"
valueField="valueField" textField="textField">
<EF:EFCodeOption codeName="ctdy.hppz.userStatus"/>
<EF:EFCodeOption codeName="hpjx.hppz.userStatus"/>
</EF:EFComboColumn>
<EF:EFColumn ename="remark" cname="备注" width="150"/>
</EF:EFGrid>
......
......@@ -521,7 +521,7 @@ $(function () {
if (ei["status"] == 1) {
var projCodeNew=ei["extAttr"]["projCode"];
JSColorbox.open({
href: "HPSC002C?methodName=initLoad",
href: "HPSC002C?methodName=initLoad&efParentFormEname=HPSC002",
title: "<div style='text-align: center;'>选择产品模板</div>",
width: "70%",
height: "70%",
......@@ -684,7 +684,7 @@ function openUploadFile(id) {
*/
function showUploadFile(id) {
JSColorbox.open({
href: "HPSC002A?methodName=initLoad&inqu_status-0-bizType=WL&inqu_status-0-id=" + id,
href: "HPSC002A?methodName=initLoad&efParentFormEname=HPSC002&inqu_status-0-bizType=WL&inqu_status-0-id=" + id,
title: "<div style='text-align: center;'>附件清单</div>",
width: "80%",
height: "80%",
......
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