Commit 0af99b0d by 宋祥

1.数据权限开发

parent a9d3af5d
...@@ -27,98 +27,104 @@ import java.sql.PreparedStatement; ...@@ -27,98 +27,104 @@ import java.sql.PreparedStatement;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import lombok.extern.slf4j.Slf4j;
/** /**
* 切面处理类,操作日志异常日志记录处理 * 切面处理类,操作日志异常日志记录处理
*/ */
@Slf4j
@Aspect //记录日志实现性能跟踪以及用户行为分析 @Aspect //记录日志实现性能跟踪以及用户行为分析
@Component @Component
public class OperationLogAspect { public class OperationLogAspect {
private static Dao dao = (Dao) PlatApplicationContext.getBean("dao");
private static final Dao dao = (Dao) PlatApplicationContext.getBean("dao");
/**
* 设置操作日志切入点 记录操作日志 在注解的位置切入代码 /**
*/ * 设置操作日志切入点 记录操作日志 在注解的位置切入代码
@Pointcut("@annotation(com.baosight.hpjx.aspect.annotation.OperationLogAnnotation)") */
public void operLogPointCut() { @Pointcut("@annotation(com.baosight.hpjx.aspect.annotation.OperationLogAnnotation)")
} public void operLogPointCut() {
}
/**
* 设置操作异常切入点记录异常日志 扫描所有dc包下操作 /**
*/ * 设置操作异常切入点记录异常日志 扫描所有dc包下操作
@Pointcut("execution(* com.baosight.hpjx.hp.*.service..*.*(..))") */
public void operExceptionLogPointCut() { @Pointcut("execution(* com.baosight.hpjx.hp.*.service..*.*(..))")
} public void operExceptionLogPointCut() {
}
/**
* 正常返回通知,拦截用户操作日志,连接点正常执行完成后执行, 如果连接点抛出异常,则不会执行 /**
* * 正常返回通知,拦截用户操作日志,连接点正常执行完成后执行, 如果连接点抛出异常,则不会执行
* @param joinPoint 切入点 *
* @param keys 返回结果 * @param joinPoint 切入点
*/ * @param keys 返回结果
@AfterReturning(value = "operLogPointCut()", returning = "keys") */
public void saveOperLog(JoinPoint joinPoint, Object keys) { @AfterReturning(value = "operLogPointCut()", returning = "keys")
// 从切面织入点处通过反射机制获取织入点处的方法 public void saveOperLog(JoinPoint joinPoint, Object keys) {
MethodSignature signature = (MethodSignature) joinPoint.getSignature(); // 从切面织入点处通过反射机制获取织入点处的方法
// 获取切入点所在的方法 MethodSignature signature = (MethodSignature) joinPoint.getSignature();
Method method = signature.getMethod(); // 获取切入点所在的方法
OperationLogAnnotation opLog = method.getAnnotation(OperationLogAnnotation.class); Method method = signature.getMethod();
if (opLog != null) { OperationLogAnnotation opLog = method.getAnnotation(OperationLogAnnotation.class);
try { if (opLog != null) {
String companyCode; try {
try { String companyCode;
companyCode = UserSessionUtils.getCompanyCode(); try {
} catch (Exception e) { companyCode = UserSessionUtils.getCompanyCode();
companyCode = ""; } catch (Exception e) {
} companyCode = "";
String userId = UserSession.getLoginName(); }
String loginName = UserSession.getLoginCName(); String userId = UserSession.getLoginName();
String operModul = opLog.operModul(); String loginName = UserSession.getLoginCName();
String operType = opLog.operType(); String operModul = opLog.operModul();
String operDesc = opLog.operDesc(); String operType = opLog.operType();
boolean saveContet = opLog.saveContent(); String operDesc = opLog.operDesc();
String sql = "INSERT INTO hpjx.SYS_OPERATION_LOG (OPER_MODUL,OPER_TYPE,OPER_DESC," + boolean saveContet = opLog.saveContent();
"OPER_CONTENT,COMPANY_CODE,CREATED_BY,CREATED_NAME,CREATED_TIME)" + String sql = "INSERT INTO hpjx.SYS_OPERATION_LOG (OPER_MODUL,OPER_TYPE,OPER_DESC," +
" VALUES (?,?,?,?,?,?,?,?)"; "OPER_CONTENT,COMPANY_CODE,CREATED_BY,CREATED_NAME,CREATED_TIME)" +
PreparedStatement ps = ((SqlMapDaoLogProxy) dao).getSqlMapClient().getDataSource().getConnection().prepareStatement(sql); " VALUES (?,?,?,?,?,?,?,?)";
ps.setString(1,operModul); PreparedStatement ps = ((SqlMapDaoLogProxy) dao).getSqlMapClient().getDataSource().getConnection()
ps.setString(2,operType); .prepareStatement(sql);
ps.setString(3,operDesc); ps.setString(1, operModul);
if(saveContet && joinPoint.getArgs() != null) { ps.setString(2, operType);
String strBlock = EiConstant.resultBlock; ps.setString(3, operDesc);
EiInfo result = ((EiInfo) joinPoint.getArgs()[0]); if (saveContet && joinPoint.getArgs() != null) {
ps.setString(4, JSONObject.toJSONString(((EiInfo) joinPoint.getArgs()[0]).getBlock(strBlock).getRows().get(0))); String strBlock = EiConstant.resultBlock;
}else { EiInfo result = ((EiInfo) joinPoint.getArgs()[0]);
ps.setString(4, ""); ps.setString(4, JSONObject.toJSONString(
} ((EiInfo) joinPoint.getArgs()[0]).getBlock(strBlock).getRows().get(0)));
ps.setString(5,companyCode); } else {
ps.setString(6,userId); ps.setString(4, "");
ps.setString(7,loginName); }
ps.setString(8,DateUtils.shortDateTime()); ps.setString(5, companyCode);
ps.execute(); ps.setString(6, userId);
} catch (Exception e) { ps.setString(7, loginName);
e.printStackTrace(); ps.setString(8, DateUtils.shortDateTime());
} ps.execute();
} } catch (Exception e) {
} e.printStackTrace();
}
/** }
* 异常返回通知,用于拦截异常日志信息 连接点抛出异常后执行 }
*
* @param joinPoint 切入点 /**
* @param e 异常信息 * 异常返回通知,用于拦截异常日志信息 连接点抛出异常后执行
*/ *
@AfterThrowing(pointcut = "operExceptionLogPointCut()", throwing = "e") * @param joinPoint 切入点
public void saveExceptionLog(JoinPoint joinPoint, Throwable e) { * @param e 异常信息
// 获取RequestAttributes */
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes(); @AfterThrowing(pointcut = "operExceptionLogPointCut()", throwing = "e")
// 从获取RequestAttributes中获取HttpServletRequest的信息 public void saveExceptionLog(JoinPoint joinPoint, Throwable e) {
HttpServletRequest request = (HttpServletRequest) requestAttributes // 获取RequestAttributes
.resolveReference(RequestAttributes.REFERENCE_REQUEST); RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
try { // 从获取RequestAttributes中获取HttpServletRequest的信息
// 从切面织入点处通过反射机制获取织入点处的方法 HttpServletRequest request = (HttpServletRequest) requestAttributes
MethodSignature signature = (MethodSignature) joinPoint.getSignature(); .resolveReference(RequestAttributes.REFERENCE_REQUEST);
// 获取切入点所在的方法 try {
Method method = signature.getMethod(); // 从切面织入点处通过反射机制获取织入点处的方法
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
// 获取切入点所在的方法
Method method = signature.getMethod();
// 获取请求的类名 // 获取请求的类名
String className = joinPoint.getTarget().getClass().getName(); String className = joinPoint.getTarget().getClass().getName();
// 获取请求的方法名 // 获取请求的方法名
...@@ -166,4 +172,4 @@ public class OperationLogAspect { ...@@ -166,4 +172,4 @@ public class OperationLogAspect {
String message = exceptionName + ":" + exceptionMessage + "\n\t" + strbuff.toString(); String message = exceptionName + ":" + exceptionMessage + "\n\t" + strbuff.toString();
return message; return message;
} }
} }
\ No newline at end of file
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; 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; ...@@ -15,6 +8,9 @@ import java.util.Map;
*/ */
public enum AuthTypeEnum { public enum AuthTypeEnum {
ALL("all", "全部"),
NO_AUTH("noAuth", "不可查看"),
ONLY_COMPANY("onlyCompany", "本企业"),
ONLY_FACTORY("onlyFactory", "本厂"), ONLY_FACTORY("onlyFactory", "本厂"),
ONLY_DEPT("onlyDept", "本部门"); ONLY_DEPT("onlyDept", "本部门");
......
...@@ -199,7 +199,7 @@ public enum DdynamicEnum { ...@@ -199,7 +199,7 @@ public enum DdynamicEnum {
* 用途:项目档案下拉框 * 用途:项目档案下拉框
* 编写:wwl * 编写: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; 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.LogUtils;
import com.baosight.hpjx.util.MapUtils; import com.baosight.hpjx.util.MapUtils;
import com.baosight.hpjx.util.StringUtils; import com.baosight.hpjx.util.StringUtils;
...@@ -9,7 +11,6 @@ import com.baosight.iplat4j.core.exception.PlatException; ...@@ -9,7 +11,6 @@ import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.soa.XServiceManager; 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.api.signed.SignedBosHelp;
import com.baosight.iplat4j.eu.dm.document.bos.s3.param.BosParamHelp; import com.baosight.iplat4j.eu.dm.document.bos.s3.param.BosParamHelp;
import com.baosight.hpjx.util.FileUtils;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.CrossOrigin;
...@@ -137,4 +138,25 @@ public class FileDownloadController { ...@@ -137,4 +138,25 @@ public class FileDownloadController {
} }
return strBuilder.toString(); 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 { ...@@ -106,20 +106,18 @@ public class DaoUtils {
log.warn("写入创建人姓名失败", e); log.warn("写入创建人姓名失败", e);
} }
// 创建人企业编码 // 创建人企业编码
String companyCode = UserSessionUtils.getCompanyCode();
AssertUtils.isEmpty(companyCode, "当前用户未绑定公司,无法操作数据,请联系管理员!");
try { try {
String companyCode;
try {
companyCode = UserSessionUtils.getCompanyCode();
} catch (Exception e) {
companyCode = "";
}
BeanUtils.setProperty(bean, "companyCode", companyCode); BeanUtils.setProperty(bean, "companyCode", companyCode);
} catch (Exception e) { } catch (Exception e) {
log.warn("写入创建人企业编码失败", e); log.warn("写入创建人企业编码失败", e);
} }
// 创建人部门编码 // 创建人组织机构
List<String> orgIds = UserSessionUtils.getOrgId();
AssertUtils.isEmpty(orgIds, "当前用户未绑定部门,无法操作数据,请联系管理员!");
try { try {
BeanUtils.setProperty(bean, "depCode", HPXSTools.XsOrg.getOrgId()); BeanUtils.setProperty(bean, "depCode", orgIds.get(0));
} catch (Exception e) { } catch (Exception e) {
log.warn("写入创建人部门编码失败", e); log.warn("写入创建人部门编码失败", e);
} }
......
package com.baosight.hpjx.core.security; 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.domain.User;
import com.baosight.hpjx.hp.xs.tools.HPXSTools; import com.baosight.hpjx.hp.xs.tools.HPXSTools;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
...@@ -7,10 +8,14 @@ import com.baosight.iplat4j.core.ei.EiInfo; ...@@ -7,10 +8,14 @@ import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.soa.XLocalManager; import com.baosight.iplat4j.core.service.soa.XLocalManager;
import com.baosight.iplat4j.core.web.threadlocal.UserSession; import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ConcurrentMap;
import java.util.stream.Collectors;
/** /**
* @author:songx * @author:songx
...@@ -67,16 +72,30 @@ public class UserSessionUtils extends UserSession { ...@@ -67,16 +72,30 @@ public class UserSessionUtils extends UserSession {
} }
/** /**
* 获取登录用户的部门编码 * 获取登录用户的组织机构
* *
* @return * @return
*/ */
public static String getDepCode() { public static List<String> getOrgId() {
String loginName = getLoginName(); return HPXSTools.XsOrg.getOrgId();
if (loginName == null) { }
/**
* 获取登录用户的厂区编码
*
* @return
*/
public static List<String> getFactoryCode() {
List<String> orgIds = getOrgId();
if (CollectionUtils.isEmpty(orgIds)) {
return null; 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; package com.baosight.hpjx.hp.constant;
import com.jcraft.jsch.UserAuth;
/** /**
* @author:songx * @author:songx
* @date:2024/1/18,17:16 * @date:2024/1/18,17:16
...@@ -250,10 +252,14 @@ public class HPSqlConstant { ...@@ -250,10 +252,14 @@ public class HPSqlConstant {
* @author:songx * @author:songx
* @date:2024/1/18,17:17 * @date:2024/1/18,17:17
*/ */
public class HPPZ010 { public class HpPz010 {
// 查询 // 查询
public static final String QUERY = "HPPZ010.query"; 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";
} }
/** /**
...@@ -384,7 +390,23 @@ public class HPSqlConstant { ...@@ -384,7 +390,23 @@ public class HPSqlConstant {
// 已处理 // 已处理
public static final String DO_PROCESS2 = "HPZL001.doProcess2"; 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"?> <?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"> <!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-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
-->
<sqlMap namespace="HPDS001"> <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"> <sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy"> <isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy# CREATED_BY = #createdBy#
</isNotEmpty> </isNotEmpty>
......
...@@ -4,25 +4,38 @@ ...@@ -4,25 +4,38 @@
Version : 1.0 Version : 1.0
schema : hpjx schema : hpjx
tableName : TEUDM_TEMP tableName : TEUDM_TEMP
COMPANY_CODE VARCHAR NOT NULL primarykey, COMPANY_CODE VARCHAR NOT NULL primarykey,
DOC_ID VARCHAR NOT NULL primarykey, DOC_ID VARCHAR NOT NULL primarykey,
DIR_ID VARCHAR NOT NULL, DIR_ID VARCHAR NOT NULL,
DOC_NAME VARCHAR NOT NULL, DOC_NAME VARCHAR NOT NULL,
CHG_NAME VARCHAR NOT NULL, CHG_NAME VARCHAR NOT NULL,
DOC_SIZE DECIMAL NOT NULL, DOC_SIZE DECIMAL NOT NULL,
DOC_TAG VARCHAR NOT NULL, DOC_TAG VARCHAR NOT NULL,
CREATED_BY VARCHAR NOT NULL, CREATED_BY VARCHAR NOT NULL,
CREATED_NAME VARCHAR NOT NULL, CREATED_NAME VARCHAR NOT NULL,
CREATED_TIME VARCHAR NOT NULL, CREATED_TIME VARCHAR NOT NULL,
UPDATED_BY VARCHAR NOT NULL, UPDATED_BY VARCHAR NOT NULL,
UPDATED_NAME VARCHAR NOT NULL, UPDATED_NAME VARCHAR NOT NULL,
UPDATED_TIME VARCHAR NOT NULL, UPDATED_TIME VARCHAR NOT NULL,
ARCHIVE_FLAG VARCHAR NOT NULL, ARCHIVE_FLAG VARCHAR NOT NULL,
REAL_PATH VARCHAR REAL_PATH VARCHAR
--> -->
<sqlMap namespace="HPDS002"> <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"> <sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="companyCode"> <isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode# COMPANY_CODE = #companyCode#
</isNotEmpty> </isNotEmpty>
...@@ -106,7 +119,7 @@ ...@@ -106,7 +119,7 @@
$orderBy$ $orderBy$
</isNotEmpty> </isNotEmpty>
<isEmpty property="orderBy"> <isEmpty property="orderBy">
COMPANY_CODE asc, COMPANY_CODE asc,
DOC_ID asc DOC_ID asc
</isEmpty> </isEmpty>
</dynamic> </dynamic>
......
...@@ -30,16 +30,23 @@ ...@@ -30,16 +30,23 @@
FACTORY_NAME as "factoryName" <!-- 工厂 --> FACTORY_NAME as "factoryName" <!-- 工厂 -->
</sql> </sql>
<sql id="condition"> <sql id="authCondition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode"> <isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode# COMPANY_CODE = #companyCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode"> <isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode# DEP_CODE = #depCode#
</isNotEmpty> </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"> <isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy# CREATED_BY = #createdBy#
</isNotEmpty> </isNotEmpty>
......
...@@ -33,7 +33,20 @@ ...@@ -33,7 +33,20 @@
FACTORY_NAME as "factoryName" <!-- 工厂 --> FACTORY_NAME as "factoryName" <!-- 工厂 -->
</sql> </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"> <sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
......
...@@ -43,13 +43,20 @@ ...@@ -43,13 +43,20 @@
FACTORY_CODE as "factoryCode" <!-- 厂区编码 --> FACTORY_CODE as "factoryCode" <!-- 厂区编码 -->
</sql> </sql>
<sql id="condition"> <sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode"> <isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode# COMPANY_CODE = #companyCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode"> <isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode# DEP_CODE = #depCode#
</isNotEmpty> </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"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
......
...@@ -38,16 +38,23 @@ ...@@ -38,16 +38,23 @@
FACTORY_NAME as "factoryName" <!-- 工厂 --> FACTORY_NAME as "factoryName" <!-- 工厂 -->
</sql> </sql>
<sql id="condition"> <sql id="authCondition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode"> <isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode# COMPANY_CODE = #companyCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode"> <isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode# DEP_CODE = #depCode#
</isNotEmpty> </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"> <isNotEmpty prepend=" AND " property="receiptDate">
RECEIPT_DATE = #receiptDate# RECEIPT_DATE = #receiptDate#
</isNotEmpty> </isNotEmpty>
......
...@@ -35,13 +35,23 @@ ...@@ -35,13 +35,23 @@
FACTORY_NAME as "factoryName" <!-- 工厂 --> FACTORY_NAME as "factoryName" <!-- 工厂 -->
</sql> </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"> <sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiptDate"> <isNotEmpty prepend=" AND " property="receiptDate">
RECEIPT_DATE = #receiptDate# RECEIPT_DATE = #receiptDate#
</isNotEmpty> </isNotEmpty>
......
...@@ -36,16 +36,23 @@ ...@@ -36,16 +36,23 @@
A.FACTORY_NAME as "factoryName" <!-- 工厂 --> A.FACTORY_NAME as "factoryName" <!-- 工厂 -->
</sql> </sql>
<sql id="condition"> <sql id="authCondition">
<isNotEmpty prepend=" AND " property="id">
A.ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode"> <isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode# A.COMPANY_CODE = #companyCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode"> <isNotEmpty prepend=" AND " property="depCode">
A.DEP_CODE = #depCode# A.DEP_CODE = #depCode#
</isNotEmpty> </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"> <isNotEmpty prepend=" AND " property="receiptDate">
A.RECEIPT_DATE = #receiptDate# A.RECEIPT_DATE = #receiptDate#
</isNotEmpty> </isNotEmpty>
......
...@@ -31,16 +31,23 @@ ...@@ -31,16 +31,23 @@
FACTORY_NAME as "factoryName" <!-- 工厂 --> FACTORY_NAME as "factoryName" <!-- 工厂 -->
</sql> </sql>
<sql id="condition"> <sql id="authCondition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode"> <isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode# COMPANY_CODE = #companyCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode"> <isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode# DEP_CODE = #depCode#
</isNotEmpty> </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"> <isNotEmpty prepend=" AND " property="receiptDate">
RECEIPT_DATE = #receiptDate# RECEIPT_DATE = #receiptDate#
</isNotEmpty> </isNotEmpty>
......
...@@ -23,16 +23,23 @@ ...@@ -23,16 +23,23 @@
UPDATED_TIME as "updatedTime" <!-- 修改时间 --> UPDATED_TIME as "updatedTime" <!-- 修改时间 -->
</sql> </sql>
<sql id="condition"> <sql id="authCondition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode"> <isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode# COMPANY_CODE = #companyCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode"> <isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode# DEP_CODE = #depCode#
</isNotEmpty> </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"> <isNotEmpty prepend=" AND " property="dateMonth">
DATE_MONTH = #dateMonth# DATE_MONTH = #dateMonth#
</isNotEmpty> </isNotEmpty>
......
...@@ -44,16 +44,23 @@ ...@@ -44,16 +44,23 @@
UPDATED_TIME as "updatedTime" <!-- 更新时间 --> UPDATED_TIME as "updatedTime" <!-- 更新时间 -->
</sql> </sql>
<sql id="condition"> <sql id="authCondition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode"> <isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode# COMPANY_CODE = #companyCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode"> <isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode# DEP_CODE = #depCode#
</isNotEmpty> </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"> <isNotEmpty prepend=" AND " property="dateType">
DATE_TYPE = #dateType# DATE_TYPE = #dateType#
</isNotEmpty> </isNotEmpty>
......
...@@ -34,16 +34,23 @@ ...@@ -34,16 +34,23 @@
END_WEIGHT as "endWeight" <!-- 期末重量 --> END_WEIGHT as "endWeight" <!-- 期末重量 -->
</sql> </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"> <sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy"> <isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy# CREATED_BY = #createdBy#
</isNotEmpty> </isNotEmpty>
......
...@@ -26,16 +26,26 @@ ...@@ -26,16 +26,26 @@
FACTORY_NAME as "factoryName" <!-- 工厂 --> FACTORY_NAME as "factoryName" <!-- 工厂 -->
</sql> </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"> <sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="inventRecordId"> <isNotEmpty prepend=" AND " property="inventRecordId">
INVENT_RECORD_ID = #inventRecordId# INVENT_RECORD_ID = #inventRecordId#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode"> <isNotEmpty prepend=" AND " property="whCode">
WH_CODE = #whCode# WH_CODE = #whCode#
</isNotEmpty> </isNotEmpty>
......
...@@ -25,16 +25,23 @@ ...@@ -25,16 +25,23 @@
VERSION as "version" <!-- 版本号 --> VERSION as "version" <!-- 版本号 -->
</sql> </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"> <sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="dateProc"> <isNotEmpty prepend=" AND " property="dateProc">
DATE_PROC = #dateProc# DATE_PROC = #dateProc#
</isNotEmpty> </isNotEmpty>
......
...@@ -34,13 +34,23 @@ ...@@ -34,13 +34,23 @@
FACTORY_NAME as "factoryName" <!-- 工厂 --> FACTORY_NAME as "factoryName" <!-- 工厂 -->
</sql> </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"> <sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode"> <isNotEmpty prepend=" AND " property="whCode">
WH_CODE = #whCode# WH_CODE = #whCode#
</isNotEmpty> </isNotEmpty>
......
...@@ -32,16 +32,23 @@ ...@@ -32,16 +32,23 @@
VERSION as "version" <!-- 版本号 --> VERSION as "version" <!-- 版本号 -->
</sql> </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"> <sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="dateProc"> <isNotEmpty prepend=" AND " property="dateProc">
DATE_PROC = #dateProc# DATE_PROC = #dateProc#
</isNotEmpty> </isNotEmpty>
......
...@@ -25,13 +25,23 @@ ...@@ -25,13 +25,23 @@
C.PRINC as "princ" <!-- 负责人 --> C.PRINC as "princ" <!-- 负责人 -->
</sql> </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"> <sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="inventRecordId"> <isNotEmpty prepend=" AND " property="inventRecordId">
A.INVENT_RECORD_ID = #inventRecordId# A.INVENT_RECORD_ID = #inventRecordId#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode"> <isNotEmpty prepend=" AND " property="whCode">
A.WH_CODE = #whCode# A.WH_CODE = #whCode#
</isNotEmpty> </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; ...@@ -5,23 +5,18 @@ import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils; import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.security.UserSessionUtils; import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.constant.HPSqlConstant; 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.HPPZ010;
import com.baosight.hpjx.hp.pz.domain.HPPZ010A;
import com.baosight.hpjx.hp.pz.tools.HPPZTools; 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.AssertUtils;
import com.baosight.hpjx.util.EiInfoUtils; import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils; import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.MapUtils; 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.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase; 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.LoginUserDetails;
import com.baosight.xservices.xs.util.UserSession; import com.baosight.xservices.xs.util.UserSession;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
...@@ -65,7 +60,7 @@ public class ServiceHPPZ010 extends ServiceBase { ...@@ -65,7 +60,7 @@ public class ServiceHPPZ010 extends ServiceBase {
@OperationLogAnnotation(operModul = "数据权限管理", operType = "查询", operDesc = "查询数据列表") @OperationLogAnnotation(operModul = "数据权限管理", operType = "查询", operDesc = "查询数据列表")
public EiInfo query(EiInfo inInfo) { public EiInfo query(EiInfo inInfo) {
try { try {
inInfo = super.query(inInfo, HPSqlConstant.HPPZ010.QUERY, new HPPZ010()); inInfo = super.query(inInfo, HPSqlConstant.HpPz010.QUERY, new HPPZ010());
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败"); LogUtils.setDetailMsg(inInfo, e, "查询失败");
} }
...@@ -87,12 +82,10 @@ public class ServiceHPPZ010 extends ServiceBase { ...@@ -87,12 +82,10 @@ public class ServiceHPPZ010 extends ServiceBase {
String loginName = UserSession.getUser().getUsername(); String loginName = UserSession.getUser().getUsername();
params.put("node", parentNode); params.put("node", parentNode);
params.put("loginName", loginName); params.put("loginName", loginName);
params.put("isOnlyAuth", CommonConstant.YesNo.YES); // 管理员查所有
// root:根节点或管理员查所有 params.put("isUserAdmin", LoginUserDetails.isUserAdmin(loginName) ? CommonConstant.YesNo.YES
if ("root".equals(parentNode) || LoginUserDetails.isUserAdmin(loginName)) { : CommonConstant.YesNo.NO);
params.put("isOnlyAuth", CommonConstant.YesNo.NO); List results = dao.query(HPSqlConstant.HpPz010.QUERY_TREE_NODE, params);
}
List results = dao.query("HPPZ010.queryTreeNode", params);
inInfo.addBlock(node).addRows(results); inInfo.addBlock(node).addRows(results);
} catch (Exception e) { } catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询失败"); LogUtils.setMsg(inInfo, e, "查询失败");
...@@ -152,11 +145,12 @@ public class ServiceHPPZ010 extends ServiceBase { ...@@ -152,11 +145,12 @@ public class ServiceHPPZ010 extends ServiceBase {
*/ */
private void checkSaveData(List<Map> resultRows) { private void checkSaveData(List<Map> resultRows) {
AssertUtils.isEmpty(UserSessionUtils.getCompanyCode(), "当前用户未绑定公司,无法操作数据,请联系管理员!"); AssertUtils.isEmpty(UserSessionUtils.getCompanyCode(), "当前用户未绑定公司,无法操作数据,请联系管理员!");
AssertUtils.isEmpty(UserSessionUtils.getDepCode(), "当前用户未绑定部门,无法操作数据,请联系管理员!"); AssertUtils.isEmpty(UserSessionUtils.getOrgId(), "当前用户未绑定部门,无法操作数据,请联系管理员!");
for (Map resultRow : resultRows) { for (Map resultRow : resultRows) {
HPPZ010 fPz010 = new HPPZ010(); HPPZ010 fPz010 = new HPPZ010();
fPz010.fromMap(resultRow); fPz010.fromMap(resultRow);
AssertUtils.isEmpty(fPz010.getPageEname(), "请选择菜单"); AssertUtils.isEmpty(fPz010.getPageEname(), "请选择菜单");
AssertUtils.isEmpty(fPz010.getDepAuth(), "请选择部门");
} }
} }
...@@ -170,7 +164,7 @@ public class ServiceHPPZ010 extends ServiceBase { ...@@ -170,7 +164,7 @@ public class ServiceHPPZ010 extends ServiceBase {
HPPZ010 fPz010 = new HPPZ010(); HPPZ010 fPz010 = new HPPZ010();
fPz010.fromMap(resultRow); fPz010.fromMap(resultRow);
// 当前企业是否已经设置过权限 // 当前企业是否已经设置过权限
HPPZ010 dbPz010 = HPPZTools.HpPz010.getByPage(fPz010.getPageEname()); HPPZ010 dbPz010 = HPPZTools.HpPz010.getByPage(fPz010.getPageEname(), fPz010.getDepAuth());
if (dbPz010 == null) { if (dbPz010 == null) {
DaoUtils.insert(HPPZ010.INSERT, fPz010); DaoUtils.insert(HPPZ010.INSERT, fPz010);
} else { } 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 @@ ...@@ -3,6 +3,18 @@
"http://www.ibatis.com/dtd/sql-map-2.dtd"> "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HPPZ001"> <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" <select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.pz.domain.Thppz001"> resultClass="com.baosight.hpjx.hp.pz.domain.Thppz001">
SELECT SELECT
...@@ -18,6 +30,7 @@ ...@@ -18,6 +30,7 @@
UPDATED_TIME as "updatedTime" <!-- 更新时间 --> UPDATED_TIME as "updatedTime" <!-- 更新时间 -->
FROM hpjx.t_hppz001 FROM hpjx.t_hppz001
WHERE 1=1 WHERE 1=1
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="custType"> <isNotEmpty prepend=" AND " property="custType">
CUST_TYPE LIKE CONCAT('%',CONCAT( #custType#,'%')) CUST_TYPE LIKE CONCAT('%',CONCAT( #custType#,'%'))
</isNotEmpty> </isNotEmpty>
...@@ -37,6 +50,7 @@ ...@@ -37,6 +50,7 @@
<select id="count" resultClass="int"> <select id="count" resultClass="int">
SELECT COUNT(*) FROM hpjx.t_hppz001 WHERE 1=1 SELECT COUNT(*) FROM hpjx.t_hppz001 WHERE 1=1
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
...@@ -114,4 +128,4 @@ ...@@ -114,4 +128,4 @@
ID = #id# ID = #id#
</update> </update>
</sqlMap> </sqlMap>
\ No newline at end of file
...@@ -22,8 +22,21 @@ ...@@ -22,8 +22,21 @@
PHONE_NAME as "phoneName" <!--负责人联系方式--> PHONE_NAME as "phoneName" <!--负责人联系方式-->
</sql> </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"> <sql id="condition">
AND DELETE_FLAG = 0 AND DELETE_FLAG = 0
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
......
...@@ -23,8 +23,21 @@ ...@@ -23,8 +23,21 @@
PUT_ADDRESS as "putAddress" <!--收货地址--> PUT_ADDRESS as "putAddress" <!--收货地址-->
</sql> </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"> <sql id="condition">
AND DELETE_FLAG = 0 AND DELETE_FLAG = 0
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
......
...@@ -19,8 +19,21 @@ ...@@ -19,8 +19,21 @@
DELETE_FLAG as "deleteFlag" <!-- 更新时间 --> DELETE_FLAG as "deleteFlag" <!-- 更新时间 -->
</sql> </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"> <sql id="condition">
AND DELETE_FLAG = 0 AND DELETE_FLAG = 0
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
......
...@@ -25,17 +25,24 @@ ...@@ -25,17 +25,24 @@
UPDATED_TIME as "updatedTime" <!-- 更新时间 --> UPDATED_TIME as "updatedTime" <!-- 更新时间 -->
</sql> </sql>
<sql id="condition"> <sql id="authCondition">
AND DELETE_FLAG = 0
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode"> <isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode# COMPANY_CODE = #companyCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode"> <isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode# DEP_CODE = #depCode#
</isNotEmpty> </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"> <isNotEmpty prepend=" AND " property="inventType">
INVENT_TYPE = #inventType# INVENT_TYPE = #inventType#
</isNotEmpty> </isNotEmpty>
......
...@@ -21,17 +21,24 @@ ...@@ -21,17 +21,24 @@
FACTORY_NAME as "factoryName" <!-- 工厂 --> FACTORY_NAME as "factoryName" <!-- 工厂 -->
</sql> </sql>
<sql id="condition"> <sql id="authCondition">
AND DELETE_FLAG = 0
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode"> <isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode# COMPANY_CODE = #companyCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode"> <isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode# DEP_CODE = #depCode#
</isNotEmpty> </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"> <isNotEmpty prepend=" AND " property="whType">
WH_TYPE = #whType# WH_TYPE = #whType#
</isNotEmpty> </isNotEmpty>
......
...@@ -23,6 +23,18 @@ ...@@ -23,6 +23,18 @@
--> -->
<sqlMap namespace="HPPZ008"> <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" <select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.iplat4j.hp.pz.domain.Thppz008"> resultClass="com.baosight.iplat4j.hp.pz.domain.Thppz008">
SELECT SELECT
...@@ -43,6 +55,7 @@ ...@@ -43,6 +55,7 @@
UPDATED_BY as "updatedBy", <!-- 更新人 --> UPDATED_BY as "updatedBy", <!-- 更新人 -->
UPDATED_TIME as "updatedTime" <!-- 更新时间 --> UPDATED_TIME as "updatedTime" <!-- 更新时间 -->
FROM hpjx.t_hppz008 WHERE 1=1 FROM hpjx.t_hppz008 WHERE 1=1
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
...@@ -63,6 +76,7 @@ ...@@ -63,6 +76,7 @@
<select id="count" resultClass="int"> <select id="count" resultClass="int">
SELECT COUNT(*) FROM hpjx.t_hppz008 WHERE 1=1 SELECT COUNT(*) FROM hpjx.t_hppz008 WHERE 1=1
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
...@@ -167,4 +181,4 @@ ...@@ -167,4 +181,4 @@
ID = #id# ID = #id#
</update> </update>
</sqlMap> </sqlMap>
\ No newline at end of file
...@@ -34,8 +34,17 @@ ...@@ -34,8 +34,17 @@
<isNotEmpty prepend=" AND " property="pageCname"> <isNotEmpty prepend=" AND " property="pageCname">
PAGE_CNAME = #pageCname# PAGE_CNAME = #pageCname#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="depAuth">
DEP_AUTH = #depAuth#
</isNotEmpty>
</sql> </sql>
<sql id="customCondition">
<isNotEmpty prepend=" AND " property="depAuths">
DEP_AUTH IN <iterate close=")" open="(" conjunction="," property="depAuths">#depAuths[]#</iterate>
</isNotEmpty>
</sql>
<!-- 公共修改字段 --> <!-- 公共修改字段 -->
<sql id="updateRevise"> <sql id="updateRevise">
UPDATED_BY = #updatedBy#, UPDATED_BY = #updatedBy#,
...@@ -59,13 +68,15 @@ ...@@ -59,13 +68,15 @@
FROM ${hpjxSchema}.T_HPPZ010 FROM ${hpjxSchema}.T_HPPZ010
WHERE 1=1 WHERE 1=1
<include refid="condition" /> <include refid="condition" />
<include refid="customCondition"/>
<include refid="orderBy"/> <include refid="orderBy"/>
</select> </select>
<select id="count" resultClass="int"> <select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPPZ010 WHERE 1=1 SELECT COUNT(*) FROM ${hpjxSchema}.T_HPPZ010 WHERE 1=1
<include refid="condition" /> <include refid="condition"/>
</select> <include refid="customCondition"/>
</select>
<!-- 查询树节点 --> <!-- 查询树节点 -->
<select id="queryTreeNode" resultClass="java.util.HashMap"> <select id="queryTreeNode" resultClass="java.util.HashMap">
...@@ -84,24 +95,66 @@ ...@@ -84,24 +95,66 @@
<isNotEmpty prepend=" AND " property="nodeEnames"> <isNotEmpty prepend=" AND " property="nodeEnames">
NODE_ENAME IN <iterate close=")" open="(" conjunction="," property="nodeEnames">#nodeEnames[]#</iterate> NODE_ENAME IN <iterate close=")" open="(" conjunction="," property="nodeEnames">#nodeEnames[]#</iterate>
</isNotEmpty> </isNotEmpty>
<!-- nodeType=2:目录。非目录或者非管理员非root节点仅显示有权限的菜单 --> <!-- nodeType:1-页面,2-目录。非管理员仅显示有权限的菜单 -->
<isEqual prepend=" AND " property="isOnlyAuth" compareValue="Y"> <isEqual prepend=" AND " property="isUserAdmin" compareValue="Y">
(NODE_TYPE = '2' OR NODE_ENAME IN ( (NODE_TYPE = '2' OR (NODE_TYPE = '1' AND NODE_ENAME LIKE 'HP%'))
SELECT D.RESOURCE_ENAME </isEqual>
FROM ${platSchema}.XS_USER A, <isEqual prepend=" AND " property="isUserAdmin" compareValue="N">
${platSchema}.XS_USER_GROUP_MEMBER B, (NODE_TYPE = '2' OR (NODE_TYPE = '1' AND NODE_ENAME LIKE 'HP%'
${platSchema}.XS_AUTHORIZATION C, AND NODE_ENAME IN (
${platSchema}.XS_RESOURCE D SELECT D.RESOURCE_ENAME
WHERE A.USER_ID = B.MEMBER_ID FROM ${platSchema}.XS_USER A,
AND B.PARENT_ID = C.SUBJECT_ID ${platSchema}.XS_USER_GROUP_MEMBER B,
AND C.OBJECT_ID = D.ID ${platSchema}.XS_AUTHORIZATION C,
AND A.LOGIN_NAME = #loginName# ${platSchema}.XS_RESOURCE D
AND D.TYPE = 'PAGE' WHERE A.USER_ID = B.MEMBER_ID
AND B.PARENT_ID = C.SUBJECT_ID
AND C.OBJECT_ID = D.ID
AND A.LOGIN_NAME = #loginName#
AND D.TYPE = 'PAGE'
)
)) ))
</isEqual> </isEqual>
ORDER BY NODE_SORT_ID ASC ORDER BY NODE_SORT_ID ASC
</select> </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 id="insert">
INSERT INTO ${hpjxSchema}.T_HPPZ010 ( INSERT INTO ${hpjxSchema}.T_HPPZ010 (
COMPANY_CODE, <!-- 企业编码 --> COMPANY_CODE, <!-- 企业编码 -->
......
...@@ -23,8 +23,21 @@ ...@@ -23,8 +23,21 @@
REMARK as "remark" <!-- 备注 --> REMARK as "remark" <!-- 备注 -->
</sql> </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"> <sql id="condition">
AND DELETE_FLAG = '0' AND DELETE_FLAG = '0'
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
......
...@@ -24,9 +24,22 @@ ...@@ -24,9 +24,22 @@
REMARK as "remark" <!-- 备注 --> REMARK as "remark" <!-- 备注 -->
</sql> </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"> <sql id="condition">
AND DELETE_FLAG = '0' AND DELETE_FLAG = '0'
AND COMPANY_CODE = #companyCode# AND COMPANY_CODE = #companyCode#
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
......
...@@ -24,9 +24,22 @@ ...@@ -24,9 +24,22 @@
MAN_HOUR as "manHour" <!-- 工时 --> MAN_HOUR as "manHour" <!-- 工时 -->
</sql> </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"> <sql id="condition">
AND DELETE_FLAG = '0' AND DELETE_FLAG = '0'
AND COMPANY_CODE = #companyCode# AND COMPANY_CODE = #companyCode#
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
......
...@@ -4,24 +4,37 @@ ...@@ -4,24 +4,37 @@
Version : 1.0 Version : 1.0
schema : hpjx schema : hpjx
tableName : T_HPPZ015 tableName : T_HPPZ015
ID BIGINT NOT NULL primarykey, ID BIGINT NOT NULL primarykey,
COMPANY_CODE VARCHAR, COMPANY_CODE VARCHAR,
DEP_CODE VARCHAR, DEP_CODE VARCHAR,
PROJ_CODE VARCHAR, PROJ_CODE VARCHAR,
TEMPLATE_CODE VARCHAR, TEMPLATE_CODE VARCHAR,
TEMPLATE_NAME VARCHAR, TEMPLATE_NAME VARCHAR,
REMARK VARCHAR, REMARK VARCHAR,
DELETE_FLAG TINYINT, DELETE_FLAG TINYINT,
CREATED_BY VARCHAR, CREATED_BY VARCHAR,
CREATED_NAME VARCHAR, CREATED_NAME VARCHAR,
CREATED_TIME VARCHAR, CREATED_TIME VARCHAR,
UPDATED_BY VARCHAR, UPDATED_BY VARCHAR,
UPDATED_TIME VARCHAR, UPDATED_TIME VARCHAR,
UPDATED_NAME VARCHAR UPDATED_NAME VARCHAR
--> -->
<sqlMap namespace="HPPZ015"> <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"> <sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
......
...@@ -79,7 +79,20 @@ ...@@ -79,7 +79,20 @@
B.STATUS as "pgStatus" <!-- 派工状态 --> B.STATUS as "pgStatus" <!-- 派工状态 -->
</sql> </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"> <sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
...@@ -109,7 +122,20 @@ ...@@ -109,7 +122,20 @@
</isNotEmpty> </isNotEmpty>
</sql> </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"> <sql id="condition1">
<include refid="authCondition1"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
A.ID = #id# A.ID = #id#
</isNotEmpty> </isNotEmpty>
......
...@@ -34,6 +34,7 @@ import org.apache.commons.collections.CollectionUtils; ...@@ -34,6 +34,7 @@ import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -557,21 +558,44 @@ public class HPPZTools { ...@@ -557,21 +558,44 @@ public class HPPZTools {
* 查询菜单权限 * 查询菜单权限
* *
* @param pageEname * @param pageEname
* @param depAuth
* @return * @return
*/ */
public static HPPZ010 getByPage(String pageEname) { public static HPPZ010 getByPage(String pageEname, String depAuth) {
AssertUtils.isNull(pageEname, "菜单ID不能为空"); AssertUtils.isEmpty(pageEname, "页面号不能为空");
AssertUtils.isEmpty(depAuth, "部门不能为空");
String companyCode = UserSessionUtils.getCompanyCode(); String companyCode = UserSessionUtils.getCompanyCode();
if (StringUtils.isBlank(companyCode)) { if (StringUtils.isBlank(companyCode)) {
return null; return null;
} }
Map queryMap = new HashMap(); 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_PAGE_ENAME, pageEname);
queryMap.put(HPPZ010.FIELD_DEP_AUTH, depAuth);
List<HPPZ010> results = DaoBase.getInstance().query(HPPZ010.QUERY, queryMap); List<HPPZ010> results = DaoBase.getInstance().query(HPPZ010.QUERY, queryMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0); 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);
}
} }
/** /**
...@@ -797,5 +821,5 @@ public class HPPZTools { ...@@ -797,5 +821,5 @@ public class HPPZTools {
} }
} }
} }
...@@ -3,20 +3,32 @@ ...@@ -3,20 +3,32 @@
<!-- table information <!-- table information
Generate time : 2024-02-23 15:28:50 Generate time : 2024-02-23 15:28:50
Version : 1.0 Version : 1.0
tableName :hpjx.sys_operation_log tableName :hpjx.sys_operation_log
ID BIGINT NOT NULL primarykey, ID BIGINT NOT NULL primarykey,
COMPANY_CODE VARCHAR NOT NULL, COMPANY_CODE VARCHAR NOT NULL,
CREATED_BY VARCHAR, CREATED_BY VARCHAR,
CREATED_NAME VARCHAR, CREATED_NAME VARCHAR,
CREATED_TIME VARCHAR, CREATED_TIME VARCHAR,
OPER_MODUL VARCHAR, OPER_MODUL VARCHAR,
OPER_TYPE VARCHAR, OPER_TYPE VARCHAR,
OPER_DESC VARCHAR, OPER_DESC VARCHAR,
OPER_CONTENT VARCHAR OPER_CONTENT VARCHAR
--> -->
<sqlMap namespace="HPRZ001"> <sqlMap namespace="HPRZ001">
<select id="query" parameterClass="java.util.HashMap" <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"> resultClass="com.baosight.hpjx.hp.rz.domian.HPRZ001">
SELECT SELECT
ID as "id", <!-- 主键id --> ID as "id", <!-- 主键id -->
...@@ -29,6 +41,7 @@ ...@@ -29,6 +41,7 @@
OPER_DESC as "operDesc", <!-- 操作说明 --> OPER_DESC as "operDesc", <!-- 操作说明 -->
OPER_CONTENT as "operContent" <!-- 操作内容 --> OPER_CONTENT as "operContent" <!-- 操作内容 -->
FROM hpjx.sys_operation_log WHERE 1=1 FROM hpjx.sys_operation_log WHERE 1=1
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="companyCode"> <isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode# COMPANY_CODE = #companyCode#
</isNotEmpty> </isNotEmpty>
...@@ -55,11 +68,12 @@ ...@@ -55,11 +68,12 @@
ID asc ID asc
</isEmpty> </isEmpty>
</dynamic> </dynamic>
</select> </select>
<select id="count" resultClass="int"> <select id="count" resultClass="int">
SELECT COUNT(*) FROM hpjx.sys_operation_log WHERE 1=1 SELECT COUNT(*) FROM hpjx.sys_operation_log WHERE 1=1
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="companyCode"> <isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode# COMPANY_CODE = #companyCode#
</isNotEmpty> </isNotEmpty>
...@@ -79,8 +93,8 @@ ...@@ -79,8 +93,8 @@
OPER_TYPE = #operType# OPER_TYPE = #operType#
</isNotEmpty> </isNotEmpty>
</select> </select>
<!-- <!--
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
...@@ -120,27 +134,27 @@ ...@@ -120,27 +134,27 @@
OPER_TYPE, <!-- 操作类型 --> OPER_TYPE, <!-- 操作类型 -->
OPER_DESC, <!-- 操作说明 --> OPER_DESC, <!-- 操作说明 -->
OPER_CONTENT <!-- 操作内容 --> OPER_CONTENT <!-- 操作内容 -->
) )
VALUES (#id#, #companyCode#, #createdBy#, #createdName#, #createdTime#, #operModul#, #operType#, #operDesc#, #operContent#) VALUES (#id#, #companyCode#, #createdBy#, #createdName#, #createdTime#, #operModul#, #operType#, #operDesc#, #operContent#)
</insert> </insert>
<delete id="delete"> <delete id="delete">
DELETE FROM hpjx.sys_operation_log WHERE DELETE FROM hpjx.sys_operation_log WHERE
ID = #id# ID = #id#
</delete> </delete>
<update id="update"> <update id="update">
UPDATE hpjx.sys_operation_log UPDATE hpjx.sys_operation_log
SET SET
COMPANY_CODE = #companyCode#, <!-- 企业编码 --> COMPANY_CODE = #companyCode#, <!-- 企业编码 -->
CREATED_BY = #createdBy#, <!-- 创建人 --> CREATED_BY = #createdBy#, <!-- 创建人 -->
CREATED_NAME = #createdName#, <!-- 创建人名称 --> CREATED_NAME = #createdName#, <!-- 创建人名称 -->
CREATED_TIME = #createdTime#, <!-- 创建时间 --> CREATED_TIME = #createdTime#, <!-- 创建时间 -->
OPER_MODUL = #operModul#, <!-- 操作模块 --> OPER_MODUL = #operModul#, <!-- 操作模块 -->
OPER_TYPE = #operType#, <!-- 操作类型 --> OPER_TYPE = #operType#, <!-- 操作类型 -->
OPER_DESC = #operDesc#, <!-- 操作说明 --> OPER_DESC = #operDesc#, <!-- 操作说明 -->
OPER_CONTENT = #operContent# <!-- 操作内容 --> OPER_CONTENT = #operContent# <!-- 操作内容 -->
WHERE WHERE
ID = #id# ID = #id#
</update> </update>
...@@ -163,5 +177,5 @@ ...@@ -163,5 +177,5 @@
COMPANY_CODE = #companyCode# COMPANY_CODE = #companyCode#
</isNotEmpty> </isNotEmpty>
</select> </select>
</sqlMap> </sqlMap>
\ No newline at end of file
...@@ -2,6 +2,15 @@ ...@@ -2,6 +2,15 @@
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd"> <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HPSC001"> <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" <select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.sc.domain.HPSC001"> resultClass="com.baosight.hpjx.hp.sc.domain.HPSC001">
SELECT SELECT
...@@ -21,6 +30,7 @@ ...@@ -21,6 +30,7 @@
REMARK as "remark", <!-- 备注 --> REMARK as "remark", <!-- 备注 -->
MATERIAL_STATUS as "materialStatus" MATERIAL_STATUS as "materialStatus"
FROM hpjx.t_hpsc001 WHERE 1=1 FROM hpjx.t_hpsc001 WHERE 1=1
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
...@@ -62,6 +72,7 @@ ...@@ -62,6 +72,7 @@
<select id="count" resultClass="int"> <select id="count" resultClass="int">
SELECT COUNT(*) FROM hpjx.t_hpsc001 WHERE 1=1 SELECT COUNT(*) FROM hpjx.t_hpsc001 WHERE 1=1
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
...@@ -213,6 +224,7 @@ ...@@ -213,6 +224,7 @@
REMARK as "remark", <!-- 备注 --> REMARK as "remark", <!-- 备注 -->
MATERIAL_STATUS as "materialStatus" MATERIAL_STATUS as "materialStatus"
FROM hpjx.t_hpsc001 WHERE 1=1 FROM hpjx.t_hpsc001 WHERE 1=1
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="companyCode"> <isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode# COMPANY_CODE = #companyCode#
</isNotEmpty> </isNotEmpty>
...@@ -229,27 +241,27 @@ ...@@ -229,27 +241,27 @@
UPDATE hpjx.t_hpsc001 SET MATERIAL_STATUS = #materialStatus# WHERE PROJ_CODE = #projCode# UPDATE hpjx.t_hpsc001 SET MATERIAL_STATUS = #materialStatus# WHERE PROJ_CODE = #projCode#
</update> </update>
<select id="queryDomainById" parameterClass="java.util.HashMap"
<select id="queryDomainById" parameterClass="java.util.HashMap" resultClass="com.baosight.hpjx.hp.sc.domain.HPSC001">
resultClass="com.baosight.hpjx.hp.sc.domain.HPSC001"> SELECT
SELECT ID as "id",
ID as "id", COMPANY_CODE as "companyCode", <!-- 企业编码 预留 -->
COMPANY_CODE as "companyCode", <!-- 企业编码 预留 --> PROJ_TYPE as "projType", <!-- 项目类型 -->
PROJ_TYPE as "projType", <!-- 项目类型 --> PROJ_CODE as "projCode", <!-- 项目编码 -->
PROJ_CODE as "projCode", <!-- 项目编码 --> PROJ_NAME as "projName", <!-- 项目名称 -->
PROJ_NAME as "projName", <!-- 项目名称 --> PRINC1 as "princ1", <!-- 本公司项目负责人 -->
PRINC1 as "princ1", <!-- 本公司项目负责人 --> PRINC2 as "princ2", <!-- 客户项目负责人 -->
PRINC2 as "princ2", <!-- 客户项目负责人 --> STATUS as "status", <!-- 状态 0-未提交,1-已提交 -->
STATUS as "status", <!-- 状态 0-未提交,1-已提交 --> CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_BY as "createdBy", <!-- 创建人 --> CREATED_TIME as "createdTime", <!-- 创建时间 -->
CREATED_TIME as "createdTime", <!-- 创建时间 --> UPDATED_BY as "updatedBy", <!-- 更新人 -->
UPDATED_BY as "updatedBy", <!-- 更新人 --> UPDATED_TIME as "updatedTime", <!-- 更新时间 -->
UPDATED_TIME as "updatedTime", <!-- 更新时间 --> DEP_CODE as "depCode", <!-- 部门编码 -->
DEP_CODE as "depCode", <!-- 部门编码 --> REMARK as "remark" <!-- 备注 -->
REMARK as "remark" <!-- 备注 --> FROM hpjx.t_hpsc001 WHERE 1=1
FROM hpjx.t_hpsc001 WHERE 1=1 <include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
</select> </select>
</sqlMap> </sqlMap>
...@@ -80,6 +80,7 @@ ...@@ -80,6 +80,7 @@
</sql> </sql>
<sql id="condition"> <sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
...@@ -109,7 +110,20 @@ ...@@ -109,7 +110,20 @@
</isNotEmpty> </isNotEmpty>
</sql> </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"> <sql id="condition1">
<include refid="authCondition1"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
A.ID = #id# A.ID = #id#
</isNotEmpty> </isNotEmpty>
...@@ -140,11 +154,20 @@ ...@@ -140,11 +154,20 @@
<isNotEmpty prepend=" AND " property="projCode"> <isNotEmpty prepend=" AND " property="projCode">
A.PROJ_CODE = #projCode# A.PROJ_CODE = #projCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
</sql> </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"> <sql id="order">
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isNotEmpty property="order"> <isNotEmpty property="order">
......
...@@ -27,7 +27,20 @@ ...@@ -27,7 +27,20 @@
B.RES_CNAME as "docName" <!-- 文件名称 --> B.RES_CNAME as "docName" <!-- 文件名称 -->
</sql> </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"> <sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
A.ID = #id# A.ID = #id#
</isNotEmpty> </isNotEmpty>
......
...@@ -27,7 +27,20 @@ ...@@ -27,7 +27,20 @@
B.RES_CNAME as "docName" <!-- 文件名称 --> B.RES_CNAME as "docName" <!-- 文件名称 -->
</sql> </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"> <sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
A.ID = #id# A.ID = #id#
</isNotEmpty> </isNotEmpty>
......
...@@ -3,12 +3,10 @@ ...@@ -3,12 +3,10 @@
<sqlMap namespace="HPSC003"> <sqlMap namespace="HPSC003">
<sql id="condition"> <sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projType"> <isNotEmpty prepend=" AND " property="projType">
PROJ_TYPE = #projType# PROJ_TYPE = #projType#
</isNotEmpty> </isNotEmpty>
...@@ -59,6 +57,18 @@ ...@@ -59,6 +57,18 @@
</isNotEmpty> </isNotEmpty>
</sql> </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"> <sql id="updateRevise">
UPDATED_BY = #updatedBy#, <!-- 修改人 --> UPDATED_BY = #updatedBy#, <!-- 修改人 -->
......
...@@ -49,15 +49,10 @@ ...@@ -49,15 +49,10 @@
</sql> </sql>
<sql id="condition"> <sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode"> <isNotEmpty prepend=" AND " property="projCode">
PROJ_CODE = #projCode# PROJ_CODE = #projCode#
</isNotEmpty> </isNotEmpty>
...@@ -180,6 +175,18 @@ ...@@ -180,6 +175,18 @@
</isNotEmpty> </isNotEmpty>
</sql> </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"> <sql id="updateRevise">
UPDATED_BY = #updatedBy#, <!-- 修改人 --> UPDATED_BY = #updatedBy#, <!-- 修改人 -->
......
...@@ -53,15 +53,10 @@ ...@@ -53,15 +53,10 @@
</sql> </sql>
<sql id="condition"> <sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode"> <isNotEmpty prepend=" AND " property="projCode">
PROJ_CODE like CONCAT('%', #projCode#, '%') PROJ_CODE like CONCAT('%', #projCode#, '%')
</isNotEmpty> </isNotEmpty>
...@@ -125,6 +120,18 @@ ...@@ -125,6 +120,18 @@
</isNotEmpty> </isNotEmpty>
</sql> </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"> <sql id="updateRevise">
UPDATED_BY = #updatedBy#, <!-- 修改人 --> UPDATED_BY = #updatedBy#, <!-- 修改人 -->
......
...@@ -23,7 +23,20 @@ ...@@ -23,7 +23,20 @@
UPDATED_TIME as "updatedTime" <!-- 更新时间 --> UPDATED_TIME as "updatedTime" <!-- 更新时间 -->
</sql> </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"> <sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
......
...@@ -38,7 +38,20 @@ ...@@ -38,7 +38,20 @@
C.PROD_TASK_NO as "zlprodTaskNo" C.PROD_TASK_NO as "zlprodTaskNo"
</sql> </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"> <sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="companyCode"> <isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode# A.COMPANY_CODE = #companyCode#
</isNotEmpty> </isNotEmpty>
......
...@@ -98,7 +98,20 @@ ...@@ -98,7 +98,20 @@
COALESCE(C.ACTUAL_COMPLETION_NUM,0) as "actualCompletionTotalWt"<!-- 实际完工重量 --> COALESCE(C.ACTUAL_COMPLETION_NUM,0) as "actualCompletionTotalWt"<!-- 实际完工重量 -->
</sql> </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"> <sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
......
<?xml version="1.0" encoding="UTF-8"?> <?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 <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
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
-->
<sqlMap namespace="HPSC006"> <sqlMap namespace="HPSC006">
<sql id="column"> <sql id="column">
ID as "id", ID as "id",
COMPANY_CODE as "companyCode", <!-- 企业编码 预留 --> COMPANY_CODE as "companyCode", <!-- 企业编码 预留 -->
...@@ -74,12 +39,10 @@ ...@@ -74,12 +39,10 @@
</sql> </sql>
<sql id="condition"> <sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode"> <isNotEmpty prepend=" AND " property="projCode">
PROJ_CODE = #projCode# PROJ_CODE = #projCode#
</isNotEmpty> </isNotEmpty>
...@@ -172,6 +135,18 @@ ...@@ -172,6 +135,18 @@
</isNotEmpty> </isNotEmpty>
</sql> </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"> <sql id="order">
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy"> <isNotEmpty property="orderBy">
......
...@@ -4,36 +4,36 @@ ...@@ -4,36 +4,36 @@
Version : 1.0 Version : 1.0
schema : hpjx schema : hpjx
tableName : T_HPSC006 tableName : T_HPSC006
ID BIGINT NOT NULL primarykey, ID BIGINT NOT NULL primarykey,
COMPANY_CODE VARCHAR, COMPANY_CODE VARCHAR,
PROJ_CODE VARCHAR, PROJ_CODE VARCHAR,
PROJ_NAME VARCHAR, PROJ_NAME VARCHAR,
PRODUCTION_ORDER_NO VARCHAR, PRODUCTION_ORDER_NO VARCHAR,
INVENT_TYPE TINYINT, INVENT_TYPE TINYINT,
INVENT_CODE VARCHAR, INVENT_CODE VARCHAR,
INVENT_NAME VARCHAR, INVENT_NAME VARCHAR,
INVENT_LENGTH DECIMAL, INVENT_LENGTH DECIMAL,
INVENT_WIDTH DECIMAL, INVENT_WIDTH DECIMAL,
INVENT_THICK DECIMAL, INVENT_THICK DECIMAL,
INVENT_SPEC VARCHAR, INVENT_SPEC VARCHAR,
PLAN_COMPLETION_DATE VARCHAR, PLAN_COMPLETION_DATE VARCHAR,
NUM DECIMAL, NUM DECIMAL,
UNIT_WT DECIMAL, UNIT_WT DECIMAL,
TOTAL_WT DECIMAL, TOTAL_WT DECIMAL,
ACTUAL_COMPLETION_DATE VARCHAR, ACTUAL_COMPLETION_DATE VARCHAR,
ACTUAL_COMPLETION_NUM DECIMAL, ACTUAL_COMPLETION_NUM DECIMAL,
STATUS TINYINT, STATUS TINYINT,
ORG_NO VARCHAR, ORG_NO VARCHAR,
ORG_NAME VARCHAR, ORG_NAME VARCHAR,
FACTORY_CODE VARCHAR, FACTORY_CODE VARCHAR,
FACTORY_NAME VARCHAR, FACTORY_NAME VARCHAR,
CREATED_BY VARCHAR, CREATED_BY VARCHAR,
CREATED_TIME VARCHAR, CREATED_TIME VARCHAR,
UPDATED_BY VARCHAR, UPDATED_BY VARCHAR,
UPDATED_TIME VARCHAR, UPDATED_TIME VARCHAR,
DEP_CODE VARCHAR, DEP_CODE VARCHAR,
REMARK VARCHAR, REMARK VARCHAR,
FILE_PATH1 VARCHAR, FILE_PATH1 VARCHAR,
INVENT_RECORD_ID INTEGER INVENT_RECORD_ID INTEGER
--> -->
<sqlMap namespace="HPSC006A"> <sqlMap namespace="HPSC006A">
...@@ -118,6 +118,18 @@ ...@@ -118,6 +118,18 @@
B.PART_NAME AS "partName" B.PART_NAME AS "partName"
</sql> </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"> <sql id="condition">
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
A.ID = #id# A.ID = #id#
......
<?xml version="1.0" encoding="UTF-8"?> <?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 <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
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
-->
<sqlMap namespace="HPSC007"> <sqlMap namespace="HPSC007">
<sql id="condition"> <sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="hpsc006Id"> <isNotEmpty prepend=" AND " property="hpsc006Id">
HPSC006_ID = #hpsc006Id# HPSC006_ID = #hpsc006Id#
</isNotEmpty> </isNotEmpty>
...@@ -66,10 +45,22 @@ ...@@ -66,10 +45,22 @@
</isNotEmpty> </isNotEmpty>
</sql> </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" <select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.sc.domain.HPSC007"> resultClass="com.baosight.hpjx.hp.sc.domain.HPSC007">
SELECT SELECT
ID as "id", ID as "id",
COMPANY_CODE as "companyCode", <!-- 企业编码 预留 --> COMPANY_CODE as "companyCode", <!-- 企业编码 预留 -->
HPSC006_ID as "hpsc006Id", <!-- 生产下料ID --> HPSC006_ID as "hpsc006Id", <!-- 生产下料ID -->
ACTUAL_COMPLETION_DATE as "actualCompletionDate", <!-- 实际完工日期 --> ACTUAL_COMPLETION_DATE as "actualCompletionDate", <!-- 实际完工日期 -->
......
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!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-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
-->
<sqlMap namespace="HPSC008"> <sqlMap namespace="HPSC008">
<sql id="condition"> <sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="registerDate"> <isNotEmpty prepend=" AND " property="registerDate">
REGISTER_DATE = #registerDate# REGISTER_DATE = #registerDate#
</isNotEmpty> </isNotEmpty>
...@@ -93,6 +63,18 @@ ...@@ -93,6 +63,18 @@
</isNotEmpty> </isNotEmpty>
</sql> </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" <select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.sc.domain.HPSC008"> resultClass="com.baosight.hpjx.hp.sc.domain.HPSC008">
SELECT SELECT
......
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!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"> <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" <select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.sc.domain.HPSC001"> resultClass="com.baosight.hpjx.hp.sc.domain.HPSC001">
SELECT SELECT
...@@ -38,6 +32,7 @@ ...@@ -38,6 +32,7 @@
DEP_CODE as "depCode", <!-- 部门编码 --> DEP_CODE as "depCode", <!-- 部门编码 -->
MATERIAL_STATUS as "materialStatus" MATERIAL_STATUS as "materialStatus"
FROM hpjx.t_hpsc001 WHERE 1=1 FROM hpjx.t_hpsc001 WHERE 1=1
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
...@@ -73,6 +68,7 @@ ...@@ -73,6 +68,7 @@
<select id="count" resultClass="int"> <select id="count" resultClass="int">
SELECT COUNT(*) FROM hpjx.t_hpsc001 WHERE 1=1 SELECT COUNT(*) FROM hpjx.t_hpsc001 WHERE 1=1
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
...@@ -201,4 +197,4 @@ ...@@ -201,4 +197,4 @@
<update id="check"> <update id="check">
UPDATE hpjx.t_hpsc001 SET status = #status# WHERE ID = #id# UPDATE hpjx.t_hpsc001 SET status = #status# WHERE ID = #id#
</update> </update>
</sqlMap> </sqlMap>
\ No newline at end of file
package com.baosight.hpjx.hp.xs.domain; 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 * @author:songx
* @date:2024/1/15,14:50 * @date:2024/1/15,14:50
*/ */
public class Org implements Serializable { public class Org extends DaoEPBase {
/** public static final String FIELD_COMPANY_CODE = "companyCode"; /* 企业编码*/
* 组织ID public static final String FIELD_ORG_ID = "orgId"; /* 组织机构ID*/
*/ public static final String FIELD_ORG_ENAME = "orgEname"; /* 组织机构名称*/
private String orgId; 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 = ""; /* 层级 */
/** /**
* 组织英文名 * initialize the metadata.
*/ */
private String orgEname; public void initMetaData() {
EiColumn eiColumn;
/**
* 组织中文名 eiColumn = new EiColumn(FIELD_COMPANY_CODE);
*/ eiColumn.setDescName("企业编码");
private String orgCname; eiMetadata.addMeta(eiColumn);
/** eiColumn = new EiColumn(FIELD_ORG_ID);
* 组织类型 eiColumn.setDescName("组织ID");
*/ eiMetadata.addMeta(eiColumn);
private String orgType;
eiColumn = new EiColumn(FIELD_ORG_ENAME);
/** eiColumn.setDescName("组织英文名");
* 父级组织ID eiMetadata.addMeta(eiColumn);
*/
private String parentOrgId; eiColumn = new EiColumn(FIELD_ORG_CNAME);
eiColumn.setDescName("组织中文名");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ORG_TYPE);
eiColumn.setDescName("组织类型");
eiMetadata.addMeta(eiColumn);
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 factoryCode; public Org() {
initMetaData();
}
/** public String getCompanyCode() {
* 厂区名称 return companyCode;
*/ }
private String factoryName;
/** public void setCompanyCode(String companyCode) {
* 层级 this.companyCode = companyCode;
*/ }
private String level;
public String getOrgId() { public String getOrgId() {
return orgId; return orgId;
...@@ -111,4 +155,43 @@ public class Org implements Serializable { ...@@ -111,4 +155,43 @@ public class Org implements Serializable {
public void setLevel(String level) { public void setLevel(String level) {
this.level = 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 @@ ...@@ -63,7 +63,7 @@
<include refid="customCondition"/> <include refid="customCondition"/>
</select> </select>
<!-- 查询企业所有的组织机构 --> <!-- 查询指定组织机构下所有的子集组织机构(不包含root) -->
<select id="queryAll" parameterClass="java.util.HashMap" resultClass="com.baosight.hpjx.hp.xs.domain.Org"> <select id="queryAll" parameterClass="java.util.HashMap" resultClass="com.baosight.hpjx.hp.xs.domain.Org">
SELECT SELECT
T2.LEVEL AS "level", T3.ORG_ID AS "orgId", T2.LEVEL AS "level", T3.ORG_ID AS "orgId",
...@@ -80,13 +80,19 @@ ...@@ -80,13 +80,19 @@
) AS T1, ) AS T1,
@LEVEL:=@LEVEL+1 AS LEVEL @LEVEL:=@LEVEL+1 AS LEVEL
FROM ${platSchema}.TXSOG01, FROM ${platSchema}.TXSOG01,
(SELECT @CODES:='root', @LEVEL:= 0) T4 <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 WHERE @CODES IS NOT NULL
) T2, ) T2,
${platSchema}.TXSOG01 T3 ${platSchema}.TXSOG01 T3
LEFT JOIN ${platSchema}.TXSOG01 T5 ON T3.FACTORY_CODE = T5.ORG_ID LEFT JOIN ${platSchema}.TXSOG01 T5 ON T3.FACTORY_CODE = T5.ORG_ID
WHERE 1=1 WHERE 1=1
AND FIND_IN_SET(T3.ORG_ID, T2.CODES) 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 ORDER BY T3.FACTORY_CODE ASC, T2.LEVEL ASC, T3.ORG_ID ASC
</select> </select>
......
...@@ -3,6 +3,7 @@ package com.baosight.hpjx.hp.xs.tools; ...@@ -3,6 +3,7 @@ package com.baosight.hpjx.hp.xs.tools;
import com.baosight.hpjx.core.dao.DaoBase; import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.core.enums.OrgTypeEnum; import com.baosight.hpjx.core.enums.OrgTypeEnum;
import com.baosight.hpjx.core.security.UserSessionUtils; 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.Org;
import com.baosight.hpjx.hp.xs.domain.User; import com.baosight.hpjx.hp.xs.domain.User;
import com.baosight.hpjx.util.AssertUtils; import com.baosight.hpjx.util.AssertUtils;
...@@ -18,6 +19,7 @@ import com.baosight.iplat4j.core.web.threadlocal.UserSession; ...@@ -18,6 +19,7 @@ import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import com.baosight.xservices.xs.constants.LoginConstants; import com.baosight.xservices.xs.constants.LoginConstants;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -162,7 +164,7 @@ public class HPXSTools { ...@@ -162,7 +164,7 @@ public class HPXSTools {
AssertUtils.isEmpty(orgId, "组织编码不能为空"); AssertUtils.isEmpty(orgId, "组织编码不能为空");
Map paramMap = new HashMap(); Map paramMap = new HashMap();
paramMap.put("orgId", orgId); 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)); AssertUtils.isEmpty(results, String.format("组织信息[%s]不存在", orgId));
return results.get(0); return results.get(0);
} }
...@@ -172,11 +174,14 @@ public class HPXSTools { ...@@ -172,11 +174,14 @@ public class HPXSTools {
* *
* @return * @return
*/ */
public static String getOrgId() { public static List<String> getOrgId() {
Map paramMap = new HashMap(); Map paramMap = new HashMap();
paramMap.put("userId", UserSession.getLoginName()); paramMap.put("userId", UserSession.getLoginName());
List<Map> results = DaoBase.getInstance().query("HPXSUser.queryOrgId", paramMap); List<Map> results = DaoBase.getInstance().query(HPSqlConstant.HpXsOrg.QUERY_ORG_ID, paramMap);
return CollectionUtils.isEmpty(results) ? "" : results.get(0).get("orgId").toString(); 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 { ...@@ -189,7 +194,7 @@ public class HPXSTools {
AssertUtils.isNull(orgId, "组织ID不能为空"); AssertUtils.isNull(orgId, "组织ID不能为空");
Map queryMap = new HashMap(); Map queryMap = new HashMap();
queryMap.put("orgId", orgId); 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)); AssertUtils.isNull(results, String.format("组织[%s]不存在父级信息", orgId));
return results; return results;
} }
...@@ -205,12 +210,25 @@ public class HPXSTools { ...@@ -205,12 +210,25 @@ public class HPXSTools {
Map queryMap = new HashMap(); Map queryMap = new HashMap();
queryMap.put("orgId", orgId); queryMap.put("orgId", orgId);
queryMap.put("orgType", OrgTypeEnum.FACTORY.getCode()); 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)); AssertUtils.isNull(results, String.format("组织[%s]不存在厂区信息", orgId));
return results.get(0); 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 * @return
...@@ -222,7 +240,7 @@ public class HPXSTools { ...@@ -222,7 +240,7 @@ public class HPXSTools {
} }
Map queryMap = new HashMap(); Map queryMap = new HashMap();
queryMap.put("companyCode", companyCode); 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)) { if (CollectionUtils.isEmpty(results)) {
return null; return null;
} }
...@@ -249,6 +267,41 @@ public class HPXSTools { ...@@ -249,6 +267,41 @@ public class HPXSTools {
return results; 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 @@ ...@@ -34,8 +34,21 @@
DELETE_FLAG as "deleteFlag" <!-- 是否删除 --> DELETE_FLAG as "deleteFlag" <!-- 是否删除 -->
</sql> </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"> <sql id="condition">
AND DELETE_FLAG = 0 AND DELETE_FLAG = 0
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
......
...@@ -27,7 +27,20 @@ ...@@ -27,7 +27,20 @@
B.RES_CNAME as "docName" <!-- 文件名称 --> B.RES_CNAME as "docName" <!-- 文件名称 -->
</sql> </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"> <sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
A.ID = #id# A.ID = #id#
</isNotEmpty> </isNotEmpty>
......
...@@ -2,14 +2,19 @@ package com.baosight.iplat4j.core.data.ibatis.dao; ...@@ -2,14 +2,19 @@ package com.baosight.iplat4j.core.data.ibatis.dao;
import com.baosight.hpjx.common.AuthTypeEnum; import com.baosight.hpjx.common.AuthTypeEnum;
import com.baosight.hpjx.core.security.UserSessionUtils; 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.domain.HPPZ010;
import com.baosight.hpjx.hp.pz.tools.HPPZTools; import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.util.MapUtils; import com.baosight.hpjx.hp.xs.domain.Org;
import com.baosight.hpjx.util.ObjectUtils; import com.baosight.hpjx.hp.xs.tools.HPXSTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.StringUtils; import com.baosight.hpjx.util.StringUtils;
import com.baosight.iplat4j.core.service.soa.DomainQuery.PageStatus; import com.baosight.iplat4j.core.service.soa.DomainQuery.PageStatus;
import com.baosight.iplat4j.core.util.ExceptionUtil; 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.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -29,7 +34,7 @@ public class SqlMapDaoLogProxy extends SqlMapDao { ...@@ -29,7 +34,7 @@ public class SqlMapDaoLogProxy extends SqlMapDao {
public List query(String name, Object parameters) { public List query(String name, Object parameters) {
try { try {
// 初始化参数 // 初始化参数
this.setCompanyCode(name, parameters); this.setAuthParam(name, parameters);
List ret = super.query(name, parameters); List ret = super.query(name, parameters);
return ret; return ret;
} catch (RuntimeException var4) { } catch (RuntimeException var4) {
...@@ -40,7 +45,7 @@ public class SqlMapDaoLogProxy extends SqlMapDao { ...@@ -40,7 +45,7 @@ public class SqlMapDaoLogProxy extends SqlMapDao {
public List queryAll(String name, Object parameters) { public List queryAll(String name, Object parameters) {
try { try {
// 初始化参数 // 初始化参数
this.setCompanyCode(name, parameters); this.setAuthParam(name, parameters);
List ret = super.queryAll(name, parameters); List ret = super.queryAll(name, parameters);
return ret; return ret;
} catch (RuntimeException var4) { } catch (RuntimeException var4) {
...@@ -51,7 +56,7 @@ public class SqlMapDaoLogProxy extends SqlMapDao { ...@@ -51,7 +56,7 @@ public class SqlMapDaoLogProxy extends SqlMapDao {
public List query(String name, Object parameters, int offset, int limit) { public List query(String name, Object parameters, int offset, int limit) {
try { try {
// 初始化参数 // 初始化参数
this.setCompanyCode(name, parameters); this.setAuthParam(name, parameters);
List ret = super.query(name, parameters, offset, limit); List ret = super.query(name, parameters, offset, limit);
return ret; return ret;
} catch (RuntimeException var6) { } catch (RuntimeException var6) {
...@@ -77,7 +82,7 @@ public class SqlMapDaoLogProxy extends SqlMapDao { ...@@ -77,7 +82,7 @@ public class SqlMapDaoLogProxy extends SqlMapDao {
try { try {
// 初始化参数 // 初始化参数
this.setCompanyCode(name, parameters); this.setAuthParam(name, parameters);
int ret = super.count(name, parameters); int ret = super.count(name, parameters);
return ret; return ret;
} catch (RuntimeException var5) { } catch (RuntimeException var5) {
...@@ -154,24 +159,38 @@ public class SqlMapDaoLogProxy extends SqlMapDao { ...@@ -154,24 +159,38 @@ public class SqlMapDaoLogProxy extends SqlMapDao {
} }
/** /**
* 设置企业编码 * 设置权限参数
* *
* @param name * @param name
* @param parameters * @param parameters
*/ */
private void setCompanyCode(String name, Object parameters) { private void setAuthParam(String name, Object parameters) {
// 查询登录用户信息时不设置企业编码,否则会形成死循环 // 需要过滤部分sql name,否则会形成死循环
// 仅限业务模块的查询需要设置企业编码 if (!name.startsWith("HP") || !(parameters instanceof Map)) {
if (name.startsWith("HPXSUser") || !name.startsWith("HP") || !(parameters instanceof Map)) {
return; return;
} }
if (parameters == null) { if (parameters == null) {
parameters = new HashMap(); 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("companyCode", UserSessionUtils.getCompanyCode());
// 部门编码
// ((Map) parameters).put("depCode", UserSessionUtils.getDepCode());
} }
/** /**
...@@ -181,60 +200,77 @@ public class SqlMapDaoLogProxy extends SqlMapDao { ...@@ -181,60 +200,77 @@ public class SqlMapDaoLogProxy extends SqlMapDao {
* @param parameters * @param parameters
*/ */
private void setDataAuth(String name, Object parameters) { private void setDataAuth(String name, Object parameters) {
// 仅限业务模块的查询需要设置企业编码 // 需要过滤部分sql name,否则会形成死循环
if (name.startsWith("HPXSUser") || !name.startsWith("HP") || !(parameters instanceof Map)) { String[] serviceFilter = {"HPXSUser", "HPXSOrg", "HPPZ010.query"};
if (StringUtils.startsWithAny(name, serviceFilter)) {
return; 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)) { if (StringUtils.isBlank(pageEname)) {
return; return;
} }
// 组装权限条件 // 当前用户所在的部门
HPPZ010 dbPz010 = HPPZTools.HpPz010.getByPage(pageEname); List<String> userOrgIds = UserSessionUtils.getOrgId();
if (dbPz010 == null || StringUtils.isBlank(dbPz010.getCustomAuth()) AssertUtils.isEmpty(userOrgIds, "当前用户未绑定部门,无法操作数据,请联系管理员!");
|| StringUtils.isBlank(dbPz010.getDepAuth())) { // 构建部门权限
((Map) parameters).put("dataAuthCondition", " AND DEP_CODE = 'NOT AUTH'"); buildDepAuth(pageEname, userOrgIds, parameters);
return;
}
buildCustomCondition(dbPz010);
buildDepCondition(dbPz010);
} }
/** /**
* 组装 Custom Data Auth Condition * 构建部门权限
* *
* @param dbPz010 * @param pageEname
* @param userOrgIds
* @param parameters
*/ */
private void buildCustomCondition(HPPZ010 dbPz010) { private void buildDepAuth(String pageEname, List<String> userOrgIds, Object parameters) {
if (StringUtils.isBlank(dbPz010.getCustomAuth())) { // 查询当前页面设置的所有权限
List<HPPZ010> dbPz010s = HPPZTools.HpPz010.listByPage(pageEname, userOrgIds);
if (CollectionUtils.isEmpty(dbPz010s)) {
((Map) parameters).put("depCode", AuthTypeEnum.NO_AUTH.getCode());
return; return;
} }
String[] customAuths = dbPz010.getCustomAuth().split(","); // 构建数据范围权限查询条件
for (String item : customAuths) { List<String> depCodes = new ArrayList<>();
AuthTypeEnum authTypeEnum = AuthTypeEnum.getByCode(item); for (HPPZ010 dbPz010 : dbPz010s) {
if (authTypeEnum == null) { List<String> depAuths = buildDepCondition(dbPz010);
continue; // 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 * @param dbPz010
*/ */
private void buildDepCondition(HPPZ010 dbPz010) { private List<String> buildDepCondition(HPPZ010 dbPz010) {
if (StringUtils.isBlank(dbPz010.getDepAuth())) { String customAuth = dbPz010.getCustomAuth();
return; if (StringUtils.isBlank(customAuth) || AuthTypeEnum.NO_AUTH.getCode().equals(customAuth)) {
return Arrays.asList(AuthTypeEnum.NO_AUTH.getCode());
} }
String[] depAuths = dbPz010.getDepAuth().split(","); String depAuth = dbPz010.getDepAuth();
for (String item : depAuths) { // 看全部
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 () { ...@@ -18,67 +18,78 @@ $(function () {
* 页面加载时执行 * 页面加载时执行
*/ */
$(window).load(function () { $(window).load(function () {
// 禁用checkBox // 禁用Input
disableCheckBox(true); disableInput(true);
// 全选框绑定事件 // 全选框绑定事件
allCheckBoxEvent(); allInputEvent();
// 子项绑定事件 // 子项绑定事件
customAuthCheckBoxEvent(); customAuthInputEvent();
depAuthCheckBoxEvent() // 部门绑定事件
depAuthInputEvent()
}); });
/** /**
* checkBox集合 * Input集合
* *
* @returns {*|jQuery|HTMLElement} * @returns {*|jQuery|HTMLElement}
*/ */
let listCustomCheckBox = function () { let listCustomInput = function () {
return $("input:checkbox[name='result-0-customAuth']"); return $("input:radio[name='result-0-customAuth']");
} }
/** /**
* checkBox集合 * Input集合
* *
* @returns {*|jQuery|HTMLElement} * @returns {*|jQuery|HTMLElement}
*/ */
let listDepCheckBox = function () { let listDepInput = function () {
return $("input:checkbox[name='result-0-depAuth']"); return $("input:radio[name='result-0-depAuth']");
} }
/** /**
* 清除checkBox选择 * 清除Input选择
* *
* @param bool * @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 * @param bool
*/ */
let checkedCheckBox = function (bool) { let checkedCustomInput = function (bool) {
// 权限子项 listCustomInput().prop('checked', bool);
listCustomCheckBox().prop('checked', bool); }
listDepCheckBox().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); // $("input:checkbox[name='result-0-authAll']").attr('readonly', bool);
// 权限子项 // 数据权限
listCustomCheckBox().each(function () { listCustomInput().each(function () {
$(this).attr('readonly', bool); $(this).attr('readonly', bool);
}); });
listDepCheckBox().each(function () { // 部门权限
listDepInput().each(function () {
$(this).attr('readonly', bool); $(this).attr('readonly', bool);
}); });
} }
...@@ -86,62 +97,62 @@ let disableCheckBox = function (bool) { ...@@ -86,62 +97,62 @@ let disableCheckBox = function (bool) {
/** /**
* 全选框绑定事件 * 全选框绑定事件
*/ */
let allCheckBoxEvent = function () { let allInputEvent = function () {
$("input:checkbox[name='result-0-authAll']").on("change", function () { $("input:checkbox[name='result-0-authAll']").on("change", function () {
if ($(this).prop('readonly')) { if ($(this).prop('readonly')) {
$(this).attr('checked', false); $(this).attr('checked', false);
return; return;
} }
checkedCheckBox(this.checked); listDepInput().prop('checked', this.checked);
}); });
} }
/** /**
* 子项绑定事件 * 数据权限绑定事件
*/ */
let customAuthCheckBoxEvent = function () { let customAuthInputEvent = function () {
$("input:checkbox[name='result-0-customAuth']").on("change", function () { $("input:radio[name='result-0-customAuth']").on("change", function () {
if ($(this).prop('readonly')) { if ($(this).prop('readonly')) {
$(this).prop('checked', ''); $(this).prop('checked', '');
return; return;
} }
// 判断全选框是选中还是不选中
setAllCheckBox();
}); });
} }
/** /**
* 子项绑定事件 * 组织部门绑定事件
*/ */
let depAuthCheckBoxEvent = function () { let depAuthInputEvent = function () {
$("input:checkbox[name='result-0-depAuth']").on("change", function () { $("input:radio[name='result-0-depAuth']").on("change", function () {
if ($(this).prop('readonly')) { if ($(this).prop('readonly')) {
$(this).prop('checked', ''); $(this).prop('checked', '');
return; return;
} }
// 判断全选框是选中还是不选中 // 判断全选框是选中还是不选中
setAllCheckBox(); // setAllInput();
// 加载部门权限
showAuthInput();
}); });
} }
/** /**
* 设置全选框选中或取消 * 设置全选框选中或取消
*/ */
let setAllCheckBox = function (){ let setAllInput = function (){
// 判断全选框是选中还是不选中 // 判断全选框是选中还是不选中
let allCheckBool = true; let allCheckBool = true;
listCustomCheckBox().each(function () { // listCustomInput().each(function () {
if ($(this).prop('checked') == false) { // if ($(this).prop('checked') == false) {
allCheckBool = false; // allCheckBool = false;
} // }
}) // })
listDepCheckBox().each(function () { listDepInput().each(function () {
if ($(this).prop('checked') == false) { if ($(this).prop('checked') == false) {
allCheckBool = 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) { ...@@ -154,15 +165,15 @@ let treeNodeSelect = function (nodeData) {
setSelectTreeNode(nodeData); setSelectTreeNode(nodeData);
// 非叶子节点清空显示 // 非叶子节点清空显示
if (nodeData.leaf) { if (nodeData.leaf) {
// 禁用checkBox // 禁用Input
disableCheckBox(true); disableInput(true);
// 清空选项 // 清空选项
clearCheckedCheckBox(); clearCheckedInput();
} else { } else {
// 启用checkBox // 启用Input
disableCheckBox(false); disableInput(false);
// 渲染权限 // 渲染权限
showAuthInput(nodeData.label); showAuthInput();
} }
} }
...@@ -182,13 +193,20 @@ let setSelectTreeNode = function (nodeData) { ...@@ -182,13 +193,20 @@ let setSelectTreeNode = function (nodeData) {
* *
* @param node * @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(); let inInfo = new EiInfo();
inInfo.set("inqu_status-0-depAuth", depAuth);
inInfo.set("inqu_status-0-pageEname", node); inInfo.set("inqu_status-0-pageEname", node);
EiCommunicator.send("HPPZ010", "getByPage", inInfo, { EiCommunicator.send("HPPZ010", "getByPage", inInfo, {
onSuccess: getByPageSuccess, onSuccess: getByPageSuccess,
onFail: function (res) { onFail: function (res) {
message(res.msg);
} }
}, {async: false}); }, {async: false});
} }
...@@ -199,8 +217,8 @@ let showAuthInput = function (node) { ...@@ -199,8 +217,8 @@ let showAuthInput = function (node) {
* @param res * @param res
*/ */
let getByPageSuccess = function (res) { let getByPageSuccess = function (res) {
// 清空所有选 // 清空权限子
clearCheckedCheckBox(); checkedCustomInput(false);
if (res.status < 0) { if (res.status < 0) {
message(res.msg); message(res.msg);
return; return;
...@@ -212,7 +230,7 @@ let getByPageSuccess = function (res) { ...@@ -212,7 +230,7 @@ let getByPageSuccess = function (res) {
let customAuth = resultRows[0]['customAuth']; let customAuth = resultRows[0]['customAuth'];
if(!isBlank(customAuth)){ if(!isBlank(customAuth)){
let customAuths = customAuth.split(','); let customAuths = customAuth.split(',');
listCustomCheckBox().each(function () { listCustomInput().each(function () {
for (let i = 0; i < customAuths.length; i++) { for (let i = 0; i < customAuths.length; i++) {
if ($(this).val() == customAuths[i]) { if ($(this).val() == customAuths[i]) {
$(this).prop('checked', 'true'); $(this).prop('checked', 'true');
...@@ -220,19 +238,8 @@ let getByPageSuccess = function (res) { ...@@ -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 () { ...@@ -254,19 +261,22 @@ let save = function () {
* 保存确认 * 保存确认
*/ */
let saveOk = 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 = ''; let customAuth = '';
listCustomCheckBox().each(function () { listCustomInput().each(function () {
if ($(this).prop('checked')) { if ($(this).prop('checked')) {
customAuth += ('' == customAuth ? $(this).val() : ',' + $(this).val()); 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(); let inInfo = new EiInfo();
inInfo.set("result-0-pageEname", selectTreeNode.label); inInfo.set("result-0-pageEname", selectTreeNode.label);
inInfo.set("result-0-pageCname", selectTreeNode.text); inInfo.set("result-0-pageCname", selectTreeNode.text);
......
...@@ -29,48 +29,44 @@ ...@@ -29,48 +29,44 @@
</div> </div>
<div class="col-md-9"> <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"> <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="${requestScope.orgMap}" var="entry">
<c:forEach items="${entry.value}" var="item" varStatus="i"> <c:forEach items="${entry.value}" var="item" varStatus="i">
<c:if test="${item.orgType == 'factory'}"> <c:if test="${item.orgType == 'factory'}">
<c:if test="${i.index == 0}"> <c:if test="${i.index == 0}">
<div class="row"> <div class="row">
<EF:EFInput cname="${item.orgCname}" blockId="result" ename="depAuth" row="0" <div class="col-md-9">
value="${item.orgId}" colWidth="3" type="checkbox" inline="true"/>
</div>
<div class="row">
</c:if> </c:if>
<c:if test="${i.index != 0}"> <c:if test="${i.index != 0}">
</div>
</div> </div>
<div class="row"> <div class="row">
<EF:EFInput cname="${item.orgCname}" blockId="result" ename="depAuth" row="0" <div class="col-md-9">
value="${item.orgId}" colWidth="3" type="checkbox" inline="true"/>
</div>
<div class="row">
</c:if> </c:if>
</c:if> </c:if>
<c:if test="${item.orgType != 'factory'}">
<EF:EFInput cname="${item.orgCname}" blockId="result" ename="depAuth" row="0" <EF:EFInput cname="${item.orgCname}" blockId="result" ename="depAuth" row="0"
value="${item.orgId}" colWidth="3" type="checkbox" inline="true"/> value="${item.orgId}" colWidth="3" type="radio" inline="true"/>
</c:if>
</c:forEach> </c:forEach>
</div> </div>
</div>
</c:forEach> </c:forEach>
</EF:EFRegion> </EF:EFRegion>
<EF:EFRegion title="提示"> <EF:EFRegion title="数据查看范围" id="result">
<%-- <span style="color: red">1:非叶子节点授权时,会同步将该节点下的所有子节点权限设置为当前选择的权限。</span>--%> <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> </EF:EFRegion>
</div> </div>
</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 @@ ...@@ -31,7 +31,7 @@
<EF:EFInput cname="联系方式" blockId="inqu_status" ename="mobile" row="0" colWidth="3"/> <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:EFSelect cname="状态" blockId="inqu_status" ename="status" row="0" colWidth="3">
<EF:EFOption label="全部" value=""/> <EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="ctdy.hppz.userStatus"/> <EF:EFCodeOption codeName="hpjx.hppz.userStatus"/>
</EF:EFSelect> </EF:EFSelect>
</div> </div>
</EF:EFRegion> </EF:EFRegion>
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
<EF:EFColumn ename="mobile" cname="联系方式" width="120" align="center" required="true" readonly="true"/> <EF:EFColumn ename="mobile" cname="联系方式" width="120" align="center" required="true" readonly="true"/>
<EF:EFComboColumn ename="status" cname="状态" width="80" align="center" defaultValue="1" <EF:EFComboColumn ename="status" cname="状态" width="80" align="center" defaultValue="1"
valueField="valueField" textField="textField"> valueField="valueField" textField="textField">
<EF:EFCodeOption codeName="ctdy.hppz.userStatus"/> <EF:EFCodeOption codeName="hpjx.hppz.userStatus"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="remark" cname="备注" width="150"/> <EF:EFColumn ename="remark" cname="备注" width="150"/>
</EF:EFGrid> </EF:EFGrid>
......
...@@ -521,7 +521,7 @@ $(function () { ...@@ -521,7 +521,7 @@ $(function () {
if (ei["status"] == 1) { if (ei["status"] == 1) {
var projCodeNew=ei["extAttr"]["projCode"]; var projCodeNew=ei["extAttr"]["projCode"];
JSColorbox.open({ JSColorbox.open({
href: "HPSC002C?methodName=initLoad", href: "HPSC002C?methodName=initLoad&efParentFormEname=HPSC002",
title: "<div style='text-align: center;'>选择产品模板</div>", title: "<div style='text-align: center;'>选择产品模板</div>",
width: "70%", width: "70%",
height: "70%", height: "70%",
...@@ -684,7 +684,7 @@ function openUploadFile(id) { ...@@ -684,7 +684,7 @@ function openUploadFile(id) {
*/ */
function showUploadFile(id) { function showUploadFile(id) {
JSColorbox.open({ 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>", title: "<div style='text-align: center;'>附件清单</div>",
width: "80%", width: "80%",
height: "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