Commit 42e16fde by yukang

Merge remote-tracking branch 'origin/dev' into dev

parents 05d67ea0 02a23e9c
...@@ -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");
ThreadLocalTools.FORM_ENAME.set("");
return;
}
// 非HP开头的页面不是业务模块的页面,无需校验数据权限
if (!formEname.startsWith("HP")) {
ThreadLocalTools.FORM_ENAME.set("");
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) {
ThreadLocalTools.FORM_ENAME.set("");
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);
ThreadLocalTools.FORM_ENAME.set("");
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")) {
ThreadLocalTools.FORM_ENAME.set("");
return;
}
ThreadLocalTools.FORM_ENAME.set(pageEname);
} catch (Exception e) {
log.error("serviceDispatchPageInfo设置切入点失败:{}", e.getMessage(), e);
}
}
}
package com.baosight.hpjx.common;
/**
* 数据权限类型
*
* @author:songx
* @date:2024/3/21,9:58
*/
public enum AuthTypeEnum {
ALL("all", "全部"),
NO_AUTH("noAuth", "不可查看"),
ONLY_COMPANY("onlyCompany", "本企业"),
ONLY_FACTORY("onlyFactory", "本厂"),
ONLY_DEPT("onlyDept", "本部门");
/**
* 编码
*/
private String code;
/**
* 中文名称
*/
private String name;
AuthTypeEnum(String code, String name) {
this.code = code;
this.name = name;
}
/**
* 根据编码获取
*
* @param code
* @return
*/
public static AuthTypeEnum getByCode(String code) {
for (AuthTypeEnum item : AuthTypeEnum.values()) {
if (item.getCode().equals(code)) {
return item;
}
}
return null;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
...@@ -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 "操作成功";
}
} }
package com.baosight.hpjx.core.configuration;
import com.baosight.iplat4j.core.ioc.spring.PlatApplicationContext;
import com.baosight.iplat4j.eu.dm.PlatFileUploadManagerByAmazonS3;
import com.baosight.iplat4j.eu.dm.util.PlatFileUploader;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import lombok.extern.slf4j.Slf4j;
/**
* 初始化注入bean
*
* @author:songx
* @date:2024/3/13,15:03
*/
@Slf4j
@Configuration
@ConditionalOnProperty(
name = {"iplat4j.admin.objectStorage.s3.switch"},
havingValue = "on"
)
public class ConfigurationBean {
@Bean(name = "platFileUploader")
public PlatFileUploader newPlatFileUploader() {
return new PlatFileUploader();
}
@Bean(name = "fileUpLoadManager")
public PlatFileUploadManagerByAmazonS3 newPlatFileUploadManagerByAmazonS3() {
return new PlatFileUploadManagerByAmazonS3();
}
}
...@@ -106,22 +106,20 @@ public class DaoUtils { ...@@ -106,22 +106,20 @@ 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.getOrgId()); BeanUtils.setProperty(bean, "depCode", orgIds.get(0));
} catch (Exception e) { } catch (Exception e) {
log.warn("写入创建人企业编码失败", e); log.warn("写入创建人部门编码失败", e);
} }
// 创建时刻 // 创建时刻
try { try {
...@@ -175,7 +173,7 @@ public class DaoUtils { ...@@ -175,7 +173,7 @@ public class DaoUtils {
} }
// 创建人部门编码 // 创建人部门编码
try { try {
map.put("depCode", HPXSTools.getOrgId()); map.put("depCode", HPXSTools.XsOrg.getOrgId());
} 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,11 +8,14 @@ import com.baosight.iplat4j.core.ei.EiInfo; ...@@ -7,11 +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 com.baosight.xservices.xs.util.LoginUserDetails; 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
...@@ -20,8 +24,6 @@ import java.util.concurrent.ConcurrentMap; ...@@ -20,8 +24,6 @@ import java.util.concurrent.ConcurrentMap;
public class UserSessionUtils extends UserSession { public class UserSessionUtils extends UserSession {
private static ConcurrentMap companyMap = new ConcurrentHashMap(); private static ConcurrentMap companyMap = new ConcurrentHashMap();
private static ConcurrentMap depMap = new ConcurrentHashMap();
private static ConcurrentMap userAdminMap = new ConcurrentHashMap();
/** /**
* 获取用户信息 * 获取用户信息
...@@ -70,40 +72,30 @@ public class UserSessionUtils extends UserSession { ...@@ -70,40 +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 null;
}
String depCode = MapUtils.getString(depMap, loginName);
if (depCode == null) {
depCode = HPXSTools.getOrgId();
depCode = depCode == null ? "" : depCode.trim();
depMap.put(loginName, depCode);
}
return depCode;
} }
/** /**
* 获取登录用户是否超级管理员 * 获取登录用户的厂区编码
* *
* @return * @return
*/ */
public static boolean isUserAdmin() { public static List<String> getFactoryCode() {
String loginName = getLoginName(); List<String> orgIds = getOrgId();
if (loginName == null) { if (CollectionUtils.isEmpty(orgIds)) {
return false; return null;
} }
Boolean isUserAdmin = MapUtils.getBoolean(userAdminMap, loginName); List<String> factoryCodes = new ArrayList<>();
if (isUserAdmin == null) { for (String orgId : orgIds) {
isUserAdmin = LoginUserDetails.isUserAdmin(loginName); Org org = HPXSTools.XsOrg.queryFactory(orgId);
userAdminMap.put(loginName, isUserAdmin); factoryCodes.add(org.getOrgId());
} }
return isUserAdmin; 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,12 +252,16 @@ public class HPSqlConstant { ...@@ -250,12 +252,16 @@ 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 INSERT = "HPPZ010.insert";
// 查询 // 查询
public static final String QUERY = "HPPZ010.query"; public static final String QUERY = "HPPZ010.query";
// 查询菜单树
public static final String QUERY_PAGE_TREE = "HPPZ010.queryPageTree";
// 查询组织树
public static final String QUERY_ORG_TREE = "HPPZ010.queryOrgTree";
// 查询用户数据权限
public static final String QUERY_USER_AUTH = "HPPZ010.queryUserAuth";
} }
/** /**
...@@ -386,7 +392,23 @@ public class HPSqlConstant { ...@@ -386,7 +392,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_AUTH_DEP_CODE = "authDepCode"; /* 权限部门编码*/
public static final String FIELD_AUTH_DEP_NAME = "authDepName"; /* 权限部门名称*/
public static final String FIELD_AUTH_TYPE = "authType"; /* 权限类型*/
public static final String FIELD_LINKAGE_FLAG = "linkageFlag"; /* 0-不联动,1-联动*/
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 authDepCode = " "; /* 权限部门编码*/
private String authDepName = " "; /* 权限部门名称*/
private String authType = " "; /* 权限类型*/
private Integer linkageFlag; /* 0-不联动,1-联动*/
/**
* 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_AUTH_DEP_CODE);
eiColumn.setDescName("权限部门编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_AUTH_DEP_NAME);
eiColumn.setDescName("权限部门名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_AUTH_TYPE);
eiColumn.setDescName("权限类型");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_LINKAGE_FLAG);
eiColumn.setDescName("0-不联动,1-联动");
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 getAuthDepCode() {
return authDepCode;
}
public void setAuthDepCode(String authDepCode) {
this.authDepCode = authDepCode;
}
public String getAuthDepName() {
return authDepName;
}
public void setAuthDepName(String authDepName) {
this.authDepName = authDepName;
}
public String getAuthType() {
return authType;
}
public void setAuthType(String authType) {
this.authType = authType;
}
public Integer getLinkageFlag() {
return linkageFlag;
}
public void setLinkageFlag(Integer linkageFlag) {
this.linkageFlag = linkageFlag;
}
/**
* 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));
setAuthDepCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_AUTH_DEP_CODE)), authDepCode));
setAuthDepName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_AUTH_DEP_NAME)), authDepName));
setAuthType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_AUTH_TYPE)), authType));
setLinkageFlag(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_LINKAGE_FLAG)), linkageFlag));
}
/**
* 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_AUTH_DEP_CODE, StringUtils.toString(authDepCode, eiMetadata.getMeta(FIELD_AUTH_DEP_CODE)));
map.put(FIELD_AUTH_DEP_NAME, StringUtils.toString(authDepName, eiMetadata.getMeta(FIELD_AUTH_DEP_NAME)));
map.put(FIELD_AUTH_TYPE, StringUtils.toString(authType, eiMetadata.getMeta(FIELD_AUTH_TYPE)));
map.put(FIELD_LINKAGE_FLAG, StringUtils.toString(linkageFlag, eiMetadata.getMeta(FIELD_LINKAGE_FLAG)));
return map;
}
}
...@@ -238,10 +238,9 @@ public class ServiceHPPZ009 extends ServiceBase { ...@@ -238,10 +238,9 @@ public class ServiceHPPZ009 extends ServiceBase {
HPPZ009 fPz009 = new HPPZ009(); HPPZ009 fPz009 = new HPPZ009();
fPz009.fromMap(resultRows.get(i)); fPz009.fromMap(resultRows.get(i));
// 校验企业下是否存在用户 // 校验企业下是否存在用户
int count = HPXSTools.countByCompany(fPz009.getCompanyCode()); int count = HPXSTools.XsUser.countByCompany(fPz009.getCompanyCode());
if (count > 0) { if (count > 0) {
throw new PlatException(String.format("企业[%s]已关联用户,请先解除用户", throw new PlatException(String.format("企业[%s]已关联用户,请先解除用户", fPz009.getCompanyName()));
fPz009.getCompanyName()));
} }
DaoUtils.update(HPPZ009.DELETE, fPz009); DaoUtils.update(HPPZ009.DELETE, fPz009);
} }
......
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;
}
}
...@@ -4,15 +4,10 @@ import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation; ...@@ -4,15 +4,10 @@ import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum; import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.constant.CommonConstant; 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.enums.UserStatusEnum;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.constant.HPSqlConstant; import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.pz.domain.HPPZ013; import com.baosight.hpjx.hp.pz.domain.HPPZ013;
import com.baosight.hpjx.hp.pz.domain.HPPZ01301;
import com.baosight.hpjx.hp.pz.domain.HPPZ014; import com.baosight.hpjx.hp.pz.domain.HPPZ014;
import com.baosight.hpjx.hp.pz.domain.HPPZ01401; import com.baosight.hpjx.hp.pz.domain.HPPZ01401;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.hp.xs.tools.HPXSTools; 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.CommonMethod; import com.baosight.hpjx.util.CommonMethod;
...@@ -23,7 +18,6 @@ import com.baosight.iplat4j.core.ei.EiConstant; ...@@ -23,7 +18,6 @@ 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.ed.util.SequenceGenerator;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
......
...@@ -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
...@@ -22,6 +22,9 @@ ...@@ -22,6 +22,9 @@
<sql id="condition"> <sql id="condition">
AND DELETE_FLAG = 0 AND DELETE_FLAG = 0
<isNotEmpty prepend=" " property="dataAuthCondition">
$dataAuthCondition$
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode"> <isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode# COMPANY_CODE = #companyCode#
</isNotEmpty> </isNotEmpty>
......
...@@ -4,43 +4,69 @@ ...@@ -4,43 +4,69 @@
<sql id="column"> <sql id="column">
ID as "id", ID as "id",
SUBJECT_ID as "subjectId", <!-- 授权主体ID --> COMPANY_CODE as "companyCode", <!-- 企业编码 -->
SUBJECT_TYPE as "subjectType", <!-- 授权主体类别 --> DEP_CODE as "depCode", <!-- 部门编码 -->
OBJECT_ID as "objectId", <!-- 授权客体ID -->
OBJECT_TYPE as "objectType", <!-- 授权客体类别 -->
CREATED_BY as "createdBy", <!-- 创建人 --> CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人名称 --> CREATED_NAME as "createdName", <!-- 创建人名称 -->
CREATED_TIME as "createdTime", <!-- 创建时间 --> CREATED_TIME as "createdTime", <!-- 创建时间 -->
UPDATED_BY as "updatedBy", <!-- 更新人 --> UPDATED_BY as "updatedBy", <!-- 更新人 -->
UPDATED_NAME as "updatedName", <!-- 更新人名称 --> UPDATED_NAME as "updatedName", <!-- 更新人名称 -->
UPDATED_TIME as "updatedTime" <!-- 更新时间 --> UPDATED_TIME as "updatedTime", <!-- 更新时间 -->
PAGE_ENAME as "pageEname", <!-- 页面英文名 -->
PAGE_CNAME as "pageCname", <!-- 页面中文名 -->
AUTH_DEP_CODE as "authDepCode", <!-- 权限部门编码 -->
AUTH_DEP_NAME as "authDepName", <!-- 权限部门名称 -->
AUTH_TYPE as "authType", <!-- 权限类型 -->
LINKAGE_FLAG as "linkageFlag" <!-- 0-不联动,1-联动 -->
</sql> </sql>
<sql id="condition"> <sql id="condition">
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="subjectId"> <isNotEmpty prepend=" AND " property="companyCode">
SUBJECT_ID = #subjectId# COMPANY_CODE = #companyCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="subjectType"> <isNotEmpty prepend=" AND " property="depCode">
SUBJECT_TYPE = #subjectType# DEP_CODE = #depCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="objectId"> <isNotEmpty prepend=" AND " property="pageEname">
OBJECT_ID = #objectId# PAGE_ENAME = #pageEname#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="objectType"> <isNotEmpty prepend=" AND " property="pageCname">
OBJECT_TYPE = #objectType# PAGE_CNAME = #pageCname#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="authDepCode">
AUTH_DEP_CODE = #authDepCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="authDepName">
AUTH_DEP_NAME = #authDepName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="authType">
AUTH_TYPE = #authType#
</isNotEmpty>
</sql> </sql>
<sql id="customCondition">
<isNotEmpty prepend=" AND " property="authDepCodes">
AUTH_DEP_CODE IN <iterate close=")" open="(" conjunction="," property="authDepCodes">#authDepCodes[]#</iterate>
</isNotEmpty>
</sql>
<!-- 公共修改字段 -->
<sql id="updateRevise">
UPDATED_BY = #updatedBy#,
UPDATED_NAME = #updatedName#,
UPDATED_TIME = #updatedTime#
</sql>
<sql id="orderBy"> <sql id="orderBy">
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy"> <isNotEmpty property="orderBy">
$orderBy$ $orderBy$
</isNotEmpty> </isNotEmpty>
<isEmpty property="orderBy"> <isEmpty property="orderBy">
ID asc ID ASC
</isEmpty> </isEmpty>
</dynamic> </dynamic>
</sql> </sql>
...@@ -50,43 +76,140 @@ ...@@ -50,43 +76,140 @@
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="queryPageTree" resultClass="java.util.HashMap">
SELECT
TREE_ENAME AS "parent",
NODE_ENAME AS "label",
NODE_CNAME AS "text",
(CASE WHEN NODE_TYPE='2' THEN 0 ELSE 1 END) AS "leaf",
NODE_SORT_ID AS "sortIndex"
FROM ${platSchema}.TEDPI10
WHERE 1=1
AND NODE_ENAME NOT IN ('EP') <!-- 排除系统页面 -->
<isNotEmpty prepend=" AND " property="node">
TREE_ENAME = #node#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="nodeEnames">
NODE_ENAME IN <iterate close=")" open="(" conjunction="," property="nodeEnames">#nodeEnames[]#</iterate>
</isNotEmpty>
<!-- nodeType:1-页面,2-目录。非管理员仅显示有权限的菜单 -->
<isEqual prepend=" AND " property="isUserAdmin" compareValue="Y">
(NODE_TYPE = '2' OR (NODE_TYPE = '1' AND NODE_ENAME LIKE 'HP%'))
</isEqual>
<isEqual prepend=" AND " property="isUserAdmin" compareValue="N">
(NODE_TYPE = '2' OR (NODE_TYPE = '1' AND NODE_ENAME LIKE 'HP%'
AND NODE_ENAME IN (
SELECT D.RESOURCE_ENAME
FROM ${platSchema}.XS_USER A,
${platSchema}.XS_USER_GROUP_MEMBER B,
${platSchema}.XS_AUTHORIZATION C,
${platSchema}.XS_RESOURCE D
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>
ORDER BY NODE_SORT_ID ASC
</select>
<!-- 组织机构子节点树查询 -->
<select id="queryOrgTree" resultClass="java.util.HashMap">
SELECT
ORG_ID as "label",
ORG_CNAME as "text",
ORG_NODE_TYPE as "leaf",
ORG_TYPE as "type",
PARENT_ORG_ID as "parentOrgId"
FROM ${platSchema}.TXSOG01
WHERE 1=1
AND IS_DELETED = '0'
AND COMPANY_CODE = #companyCode#
<isNotEmpty prepend=" AND " property="node">
PARENT_ORG_ID = #node#
</isNotEmpty>
ORDER BY SORT_INDEX ASC
</select>
<!-- 查询用户数据权限 -->
<select id="queryUserAuth" resultClass="com.baosight.hpjx.hp.pz.domain.HPPZ010A">
SELECT
A.LOGIN_NAME AS "userId",
A.USER_NAME AS "userName",
A.GENDER AS "gender",
A.MOBILE AS "mobile",
A.EMAIL AS "email",
B.ORG_ID AS "orgId",
C.ORG_CNAME AS "orgCname",
D.PAGE_ENAME AS "pageEname",
D.PAGE_CNAME AS "pageCname",
D.AUTH_TYPE AS "authType"
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.AUTH_DEP_CODE
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 (
SUBJECT_ID, <!-- 授权主体ID --> COMPANY_CODE, <!-- 企业编码 -->
SUBJECT_TYPE, <!-- 授权主体类别 --> DEP_CODE, <!-- 部门编码 -->
OBJECT_ID, <!-- 授权客体ID --> CREATED_BY, <!-- 创建人 -->
OBJECT_TYPE, <!-- 授权客体类别 --> CREATED_NAME, <!-- 创建人名称 -->
CREATED_BY, <!-- 创建人 --> CREATED_TIME, <!-- 创建时间 -->
CREATED_NAME, <!-- 创建人名称 --> PAGE_ENAME, <!-- 页面英文名 -->
CREATED_TIME <!-- 创建时间 --> PAGE_CNAME, <!-- 页面中文名 -->
AUTH_DEP_CODE, <!-- 权限部门编码 -->
AUTH_DEP_NAME, <!-- 权限部门名称 -->
AUTH_TYPE, <!-- 权限类型 -->
LINKAGE_FLAG <!-- 0-不联动,1-联动 -->
) VALUES ( ) VALUES (
#subjectId#, #subjectType#, #objectId#, #objectType#, #createdBy#, #companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#createdName#, #createdTime# #pageEname#, #pageCname#, #authDepCode#, #authDepName#, #authType#,
#linkageFlag#
) )
</insert> </insert>
<delete id="delete"> <delete id="delete">
DELETE FROM ${hpjxSchema}.T_HPPZ010 WHERE ID = #id# DELETE FROM ${hpjxSchema}.T_HPPZ010 WHERE ID = #id#
</delete> </delete>
<update id="update"> <update id="update">
UPDATE ${hpjxSchema}.T_HPPZ010 UPDATE ${hpjxSchema}.T_HPPZ010
SET SET AUTH_TYPE = #authType#, <!-- 权限类型 -->
SUBJECT_ID = #subjectId#, <!-- 授权主体ID --> LINKAGE_FLAG = #linkageFlag#, <!-- 0-不联动,1-联动 -->
SUBJECT_TYPE = #subjectType#, <!-- 授权主体类别 --> <include refid="updateRevise"/>
OBJECT_ID = #objectId#, <!-- 授权客体ID -->
OBJECT_TYPE = #objectType#, <!-- 授权客体类别 -->
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime# <!-- 更新时间 -->
WHERE ID = #id# WHERE ID = #id#
</update> </update>
......
...@@ -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>
......
...@@ -4,12 +4,14 @@ import com.baosight.hpjx.common.InventTypeEnum; ...@@ -4,12 +4,14 @@ import com.baosight.hpjx.common.InventTypeEnum;
import com.baosight.hpjx.core.constant.CommonConstant; import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoBase; import com.baosight.hpjx.core.dao.DaoBase;
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.hp.constant.HPConstant; import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.constant.HPSqlConstant; import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.pz.domain.HPPZ004; import com.baosight.hpjx.hp.pz.domain.HPPZ004;
import com.baosight.hpjx.hp.pz.domain.HPPZ006; import com.baosight.hpjx.hp.pz.domain.HPPZ006;
import com.baosight.hpjx.hp.pz.domain.HPPZ007; import com.baosight.hpjx.hp.pz.domain.HPPZ007;
import com.baosight.hpjx.hp.pz.domain.HPPZ009; import com.baosight.hpjx.hp.pz.domain.HPPZ009;
import com.baosight.hpjx.hp.pz.domain.HPPZ010;
import com.baosight.hpjx.hp.pz.domain.HPPZ011; import com.baosight.hpjx.hp.pz.domain.HPPZ011;
import com.baosight.hpjx.hp.pz.domain.HPPZ013; import com.baosight.hpjx.hp.pz.domain.HPPZ013;
import com.baosight.hpjx.hp.pz.domain.HPPZ015; import com.baosight.hpjx.hp.pz.domain.HPPZ015;
...@@ -32,6 +34,7 @@ import org.apache.commons.collections.CollectionUtils; ...@@ -32,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;
...@@ -544,6 +547,58 @@ public class HPPZTools { ...@@ -544,6 +547,58 @@ public class HPPZTools {
} }
/** /**
* 数据权限管理
*
* @author:songx
* @date:2024/3/20,14:20
*/
public static class HpPz010 {
/**
* 查询菜单权限
*
* @param pageEname
* @param depCode
* @return
*/
public static HPPZ010 getByPage(String pageEname, String depCode) {
AssertUtils.isEmpty(pageEname, "页面号不能为空");
AssertUtils.isEmpty(depCode, "部门不能为空");
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(HPPZ010.FIELD_AUTH_DEP_CODE, depCode);
List<HPPZ010> results = DaoBase.getInstance().query(HPPZ010.QUERY, queryMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
/**
* 查询菜单权限
*
* @param pageEname
* @param depCodes
* @return
*/
public static List<HPPZ010> listByPage(String pageEname, List<String> depCodes) {
AssertUtils.isEmpty(pageEname, "页面号不能为空");
String companyCode = UserSessionUtils.getCompanyCode();
if (StringUtils.isBlank(companyCode)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put(HPPZ010.FIELD_COMPANY_CODE, companyCode);
queryMap.put(HPPZ010.FIELD_PAGE_ENAME, pageEname);
queryMap.put("authDepCodes", depCodes);
return DaoBase.getInstance().query(HPPZ010.QUERY, queryMap);
}
}
/**
* @author:songx * @author:songx
* @date:2024/3/14,20:59 * @date:2024/3/14,20:59
*/ */
...@@ -766,5 +821,5 @@ public class HPPZTools { ...@@ -766,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
...@@ -53,9 +53,8 @@ public class ServiceHPSC002A extends ServiceEPBase { ...@@ -53,9 +53,8 @@ public class ServiceHPSC002A extends ServiceEPBase {
if (CollectionUtils.isNotEmpty(dbSc002s) || CollectionUtils.isNotEmpty(HPSC006)) { if (CollectionUtils.isNotEmpty(dbSc002s) || CollectionUtils.isNotEmpty(HPSC006)) {
inInfo.set("inqu_status-0-bizType", queryMap.get("bizType")); inInfo.set("inqu_status-0-bizType", queryMap.get("bizType"));
inInfo.set("inqu_status-0-matId", queryMap.get("id")); inInfo.set("inqu_status-0-matId", queryMap.get("id"));
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPSC002A().eiMetadata);
} }
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPSC002A().eiMetadata);
} catch (PlatException e) { } catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败"); LogUtils.setDetailMsg(inInfo, e, "初始化失败");
} }
......
...@@ -2,33 +2,12 @@ package com.baosight.hpjx.hp.sc.service; ...@@ -2,33 +2,12 @@ package com.baosight.hpjx.hp.sc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation; import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum; import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.HPConstants;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.hp.sc.domain.HPSC005;
import com.baosight.hpjx.hp.sc.domain.HPSC006;
import com.baosight.hpjx.hp.sc.tools.HPSCTools;
import com.baosight.hpjx.hp.xs.tools.HPXSTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.CommonMethod; import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.LogUtils; import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.StringUtil;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
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.util.NumberUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* *
......
...@@ -3,7 +3,6 @@ package com.baosight.hpjx.hp.sc.service; ...@@ -3,7 +3,6 @@ package com.baosight.hpjx.hp.sc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation; import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum; import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.ProdOrderStatusEnum; import com.baosight.hpjx.common.ProdOrderStatusEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoBase; import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.core.dao.DaoUtils; import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant; import com.baosight.hpjx.hp.constant.HPConstant;
...@@ -20,7 +19,6 @@ import com.baosight.iplat4j.core.service.impl.ServiceBase; ...@@ -20,7 +19,6 @@ import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator; import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
......
...@@ -6,8 +6,6 @@ import com.baosight.hpjx.common.ProdOrderStatusEnum; ...@@ -6,8 +6,6 @@ import com.baosight.hpjx.common.ProdOrderStatusEnum;
import com.baosight.hpjx.core.constant.CommonConstant; 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.hp.constant.HPConstant; import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.pz.domain.HPPZ011;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.hp.sc.domain.HPSC005; import com.baosight.hpjx.hp.sc.domain.HPSC005;
import com.baosight.hpjx.hp.sc.domain.HPSC005A; import com.baosight.hpjx.hp.sc.domain.HPSC005A;
import com.baosight.hpjx.hp.sc.tools.HPSCTools; import com.baosight.hpjx.hp.sc.tools.HPSCTools;
......
...@@ -2,25 +2,18 @@ package com.baosight.hpjx.hp.sc.service; ...@@ -2,25 +2,18 @@ package com.baosight.hpjx.hp.sc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation; import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum; import com.baosight.hpjx.common.DdynamicEnum;
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.hp.constant.HPConstant;
import com.baosight.hpjx.hp.pz.tools.HPPZTools; import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.hp.sc.domain.HPSC004;
import com.baosight.hpjx.hp.sc.domain.HPSC005; import com.baosight.hpjx.hp.sc.domain.HPSC005;
import com.baosight.hpjx.hp.sc.domain.HPSC006; import com.baosight.hpjx.hp.sc.domain.HPSC006;
import com.baosight.hpjx.hp.sc.domain.HPSC007; import com.baosight.hpjx.hp.sc.domain.HPSC007;
import com.baosight.hpjx.hp.sc.tools.HPSCTools; import com.baosight.hpjx.hp.sc.tools.HPSCTools;
import com.baosight.hpjx.hp.xs.domain.User;
import com.baosight.hpjx.util.*; import com.baosight.hpjx.util.*;
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 java.math.BigDecimal; import java.math.BigDecimal;
import java.text.DecimalFormat; import java.text.DecimalFormat;
......
...@@ -2,10 +2,8 @@ package com.baosight.hpjx.hp.sc.service; ...@@ -2,10 +2,8 @@ package com.baosight.hpjx.hp.sc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation; import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum; import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.hp.pz.domain.HPPZ011;
import com.baosight.hpjx.hp.sc.domain.HPSC001; import com.baosight.hpjx.hp.sc.domain.HPSC001;
import com.baosight.hpjx.hp.sc.domain.HPSC098; import com.baosight.hpjx.hp.sc.domain.HPSC098;
import com.baosight.hpjx.hp.xs.domain.Org;
import com.baosight.hpjx.util.CommonMethod; import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.LogUtils; import com.baosight.hpjx.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
......
...@@ -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("企业编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ORG_ID);
eiColumn.setDescName("组织ID");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ORG_ENAME);
eiColumn.setDescName("组织英文名");
eiMetadata.addMeta(eiColumn);
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 orgCname; public Org() {
initMetaData();
}
/** public String getCompanyCode() {
* 组织类型 return companyCode;
*/ }
private String orgType;
/** public void setCompanyCode(String companyCode) {
* 父级组织ID this.companyCode = companyCode;
*/ }
private String parentOrgId;
public String getOrgId() { public String getOrgId() {
return orgId; return orgId;
...@@ -73,4 +132,66 @@ public class Org implements Serializable { ...@@ -73,4 +132,66 @@ public class Org implements Serializable {
this.parentOrgId = parentOrgId; this.parentOrgId = parentOrgId;
} }
public String getFactoryCode() {
return factoryCode;
}
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
public String getFactoryName() {
return factoryName;
}
public void setFactoryName(String factoryName) {
this.factoryName = factoryName;
}
public String getLevel() {
return level;
}
public void setLevel(String level) {
this.level = level;
}
/**
* get the value from Map.
*
* @param map - source data map
*/
@Override
public void fromMap(Map map) {
setCompanyCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_CODE)), companyCode));
setOrgId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ORG_ID)), orgId));
setOrgEname(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ORG_ENAME)), orgEname));
setOrgCname(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ORG_CNAME)), orgCname));
setOrgType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ORG_TYPE)), orgType));
setParentOrgId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PARENT_ORG_ID)), parentOrgId));
setFactoryCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_FACTORY_CODE)), factoryCode));
setFactoryName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_FACTORY_NAME)), factoryName));
setLevel(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_LEVEL)), level));
}
/**
* set the value to Map.
*/
@Override
public Map toMap() {
Map map = new HashMap();
map.put(FIELD_COMPANY_CODE, StringUtils.toString(companyCode, eiMetadata.getMeta(FIELD_COMPANY_CODE)));
map.put(FIELD_ORG_ID, StringUtils.toString(orgId, eiMetadata.getMeta(FIELD_ORG_ID)));
map.put(FIELD_ORG_ENAME, StringUtils.toString(orgEname, eiMetadata.getMeta(FIELD_ORG_ENAME)));
map.put(FIELD_ORG_CNAME, StringUtils.toString(orgCname, eiMetadata.getMeta(FIELD_ORG_CNAME)));
map.put(FIELD_ORG_TYPE, StringUtils.toString(orgType, eiMetadata.getMeta(FIELD_ORG_TYPE)));
map.put(FIELD_PARENT_ORG_ID, StringUtils.toString(parentOrgId, eiMetadata.getMeta(FIELD_PARENT_ORG_ID)));
map.put(FIELD_FACTORY_CODE, StringUtils.toString(factoryCode, eiMetadata.getMeta(FIELD_FACTORY_CODE)));
map.put(FIELD_FACTORY_NAME, StringUtils.toString(factoryName, eiMetadata.getMeta(FIELD_FACTORY_NAME)));
map.put(FIELD_LEVEL, StringUtils.toString(level, eiMetadata.getMeta(FIELD_LEVEL)));
return map;
}
} }
package com.baosight.hpjx.hp.xs.service; package com.baosight.hpjx.hp.xs.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum; import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.security.UserSessionUtils; import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.xs.domain.User; import com.baosight.hpjx.hp.xs.domain.User;
...@@ -18,6 +17,8 @@ import java.util.List; ...@@ -18,6 +17,8 @@ import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* 当前类已屏蔽SQL自动补全企业参数,如需查询需要需自行添加企业编码参数
*
* @author:songx * @author:songx
* @date:2024/1/15,15:08 * @date:2024/1/15,15:08
*/ */
...@@ -90,6 +91,7 @@ public class ServiceHPXSUser extends ServiceBase { ...@@ -90,6 +91,7 @@ public class ServiceHPXSUser extends ServiceBase {
} }
List<DdynamicEnum> list = new ArrayList<>(); List<DdynamicEnum> list = new ArrayList<>();
list.add(DdynamicEnum.COMPANY_RECORD_BLOCK_ID); list.add(DdynamicEnum.COMPANY_RECORD_BLOCK_ID);
queryMap.put("companyCode", UserSessionUtils.getCompanyCode());
CommonMethod.initBlock(inInfo, list, queryMap, false); CommonMethod.initBlock(inInfo, list, queryMap, false);
} catch (Exception e) { } catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询企业失败"); LogUtils.setMsg(inInfo, e, "查询企业失败");
......
...@@ -4,20 +4,20 @@ ...@@ -4,20 +4,20 @@
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="HPXS002"> <sqlMap namespace="HPXS002">
......
...@@ -63,6 +63,39 @@ ...@@ -63,6 +63,39 @@
<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
T2.LEVEL AS "level", T3.ORG_ID AS "orgId",
(CASE WHEN T3.ORG_TYPE = 'factory' THEN T3.ORG_CNAME ELSE CONCAT('[',T5.FACTORY_NAME,']',T3.ORG_CNAME) END) AS "orgCname",
T3.ORG_TYPE AS "orgType", T3.FACTORY_CODE AS "factoryCode", T5.FACTORY_NAME AS "factoryName"
FROM (
SELECT
@CODES AS CODES,
(SELECT @CODES:=GROUP_CONCAT(ORG_ID)
FROM ${platSchema}.TXSOG01
WHERE FIND_IN_SET(PARENT_ORG_ID, @CODES)
AND COMPANY_CODE = #companyCode#
AND IS_DELETED = 0
) AS T1,
@LEVEL:=@LEVEL+1 AS LEVEL
FROM ${platSchema}.TXSOG01,
<isNotEmpty property="parentOrgId">
(SELECT @CODES:=#parentOrgId#, @LEVEL:= 0) T4
</isNotEmpty>
<isEmpty property="parentOrgId">
(SELECT @CODES:='root', @LEVEL:= 0) T4
</isEmpty>
WHERE @CODES IS NOT NULL
) T2,
${platSchema}.TXSOG01 T3
LEFT JOIN ${platSchema}.TXSOG01 T5 ON T3.FACTORY_CODE = T5.ORG_ID
WHERE 1=1
AND FIND_IN_SET(T3.ORG_ID, T2.CODES)
AND T3.ORG_ID != 'root'
ORDER BY T3.FACTORY_CODE ASC, T2.LEVEL ASC, T3.ORG_ID ASC
</select>
<!-- 查询父级信息(递归) --> <!-- 查询父级信息(递归) -->
<select id="queryParent" resultClass="com.baosight.hpjx.hp.xs.domain.Org"> <select id="queryParent" resultClass="com.baosight.hpjx.hp.xs.domain.Org">
SELECT SELECT
......
...@@ -2,6 +2,8 @@ package com.baosight.hpjx.hp.xs.tools; ...@@ -2,6 +2,8 @@ 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.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;
...@@ -17,6 +19,7 @@ import com.baosight.iplat4j.core.web.threadlocal.UserSession; ...@@ -17,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;
...@@ -29,31 +32,6 @@ import java.util.stream.Collectors; ...@@ -29,31 +32,6 @@ import java.util.stream.Collectors;
public class HPXSTools { public class HPXSTools {
/** /**
* 统计企业下的用户数量
*
* @param companyCode
* @return
*/
public static int countByCompany(String companyCode) {
Map paramMap = new HashMap();
paramMap.put("companyCode", companyCode);
List<Integer> results = DaoBase.getInstance().query("HPXSUser.count", paramMap);
return CollectionUtils.isEmpty(results) ? 0 : results.get(0);
}
/**
* 查询用户组织机构
*
* @return
*/
public static String getOrgId() {
Map paramMap = new HashMap();
paramMap.put("userId", UserSession.getLoginName());
List<Map> results = DaoBase.getInstance().query("HPXSUser.queryOrgId", paramMap);
return CollectionUtils.isEmpty(results) ? "" : results.get(0).get("orgId").toString();
}
/**
* @author:songx * @author:songx
* @date:2024/2/4,10:35 * @date:2024/2/4,10:35
*/ */
...@@ -102,6 +80,19 @@ public class HPXSTools { ...@@ -102,6 +80,19 @@ public class HPXSTools {
} }
/** /**
* 统计企业下的用户数量
*
* @param companyCode
* @return
*/
public static int countByCompany(String companyCode) {
Map paramMap = new HashMap();
paramMap.put("companyCode", companyCode);
List<Integer> results = DaoBase.getInstance().query("HPXSUser.count", paramMap);
return CollectionUtils.isEmpty(results) ? 0 : results.get(0);
}
/**
* 初始化新增用户 * 初始化新增用户
* *
* @param companyCode * @param companyCode
...@@ -173,12 +164,27 @@ public class HPXSTools { ...@@ -173,12 +164,27 @@ 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);
} }
/** /**
* 查询用户组织机构
*
* @return
*/
public static List<String> getOrgId() {
Map paramMap = new HashMap();
paramMap.put("userId", UserSession.getLoginName());
List<Map> results = DaoBase.getInstance().query(HPSqlConstant.HpXsOrg.QUERY_ORG_ID, paramMap);
if (CollectionUtils.isEmpty(results)) {
return null;
}
return results.stream().map(item -> item.get("orgId").toString()).collect(Collectors.toList());
}
/**
* 查询 * 查询
* *
* @param orgId * @param orgId
...@@ -188,7 +194,7 @@ public class HPXSTools { ...@@ -188,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;
} }
...@@ -204,11 +210,44 @@ public class HPXSTools { ...@@ -204,11 +210,44 @@ 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
*/
public static Map<String, List<Org>> queryAllFactoryMap() {
String companyCode = UserSessionUtils.getCompanyCode();
if (StringUtils.isBlank(companyCode)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("companyCode", companyCode);
List<Org> results = DaoBase.getInstance().query(HPSqlConstant.HpXsOrg.QUERY_ALL, queryMap);
if (CollectionUtils.isEmpty(results)) {
return null;
}
return results.stream().filter(org -> StringUtils.isNotNull(org.getFactoryCode()))
.collect(Collectors.groupingBy(Org::getFactoryCode));
}
/** /**
* 查询 * 查询
* *
...@@ -228,6 +267,41 @@ public class HPXSTools { ...@@ -228,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());
}
} }
} }
...@@ -6,8 +6,6 @@ import com.baosight.hpjx.core.constant.CommonConstant; ...@@ -6,8 +6,6 @@ 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.hp.constant.HPConstant; import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.constant.HPSqlConstant; import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.sc.tools.HPSCTools;
import com.baosight.hpjx.hp.xs.tools.HPXSTools;
import com.baosight.hpjx.hp.zl.domain.HPZL001; import com.baosight.hpjx.hp.zl.domain.HPZL001;
import com.baosight.hpjx.util.AssertUtils; import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.CommonMethod; import com.baosight.hpjx.util.CommonMethod;
...@@ -17,7 +15,6 @@ import com.baosight.hpjx.util.StringUtil; ...@@ -17,7 +15,6 @@ import com.baosight.hpjx.util.StringUtil;
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.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import com.baosight.iplat4j.ed.util.SequenceGenerator; import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
......
...@@ -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>
......
...@@ -26,26 +26,7 @@ public class LogUtils { ...@@ -26,26 +26,7 @@ public class LogUtils {
* @return * @return
*/ */
public static void setDetailMsg(EiInfo inInfo, Throwable e, String title) { public static void setDetailMsg(EiInfo inInfo, Throwable e, String title) {
title = StringUtils.isEmpty(title) ? "服务异常" : title; setMsg(inInfo, e, title);
// 打印日志
print(e, title);
// 设置EiInfo错误消息
if (inInfo == null) {
return;
}
inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg(title);
if (e == null) {
inInfo.setDetailMsg("");
return;
}
// 由于平台调用链不支持查看detailMsg的消息内容,因此这里修改成往Msg中写错误信息
inInfo.setDetailMsg(e.getMessage());
if (e instanceof PlatException) {
inInfo.setMsg(inInfo.getMsg().concat(",原因:").concat(e.getMessage()));
} else {
inInfo.setMsg(inInfo.getMsg().concat(",原因参见详细错误描述!"));
}
} }
/** /**
...@@ -70,7 +51,11 @@ public class LogUtils { ...@@ -70,7 +51,11 @@ public class LogUtils {
inInfo.setMsg(msg.concat("未知")); inInfo.setMsg(msg.concat("未知"));
return; return;
} }
inInfo.setMsg(msg.concat(e.getMessage())); if (e instanceof PlatException) {
inInfo.setMsg(msg.concat(e.getMessage()));
} else {
inInfo.setMsg(msg.concat("内部错误,请稍后再试"));
}
} }
/** /**
......
package com.baosight.iplat4j.core.data.ibatis.dao; package com.baosight.iplat4j.core.data.ibatis.dao;
import com.baosight.hpjx.common.AuthTypeEnum;
import com.baosight.hpjx.core.security.UserSessionUtils; import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.util.ObjectUtils; import com.baosight.hpjx.core.tools.ThreadLocalTools;
import com.baosight.hpjx.hp.pz.domain.HPPZ010;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.hp.xs.domain.Org;
import com.baosight.hpjx.hp.xs.tools.HPXSTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.StringUtils;
import com.baosight.iplat4j.core.ioc.spring.PlatApplicationContext;
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;
...@@ -24,7 +35,7 @@ public class SqlMapDaoLogProxy extends SqlMapDao { ...@@ -24,7 +35,7 @@ public class SqlMapDaoLogProxy extends SqlMapDao {
public List query(String name, Object parameters) { public List query(String name, Object parameters) {
try { try {
// 初始化参数 // 初始化参数
this.initParam(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) {
...@@ -35,7 +46,7 @@ public class SqlMapDaoLogProxy extends SqlMapDao { ...@@ -35,7 +46,7 @@ public class SqlMapDaoLogProxy extends SqlMapDao {
public List queryAll(String name, Object parameters) { public List queryAll(String name, Object parameters) {
try { try {
// 初始化参数 // 初始化参数
this.initParam(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) {
...@@ -46,7 +57,7 @@ public class SqlMapDaoLogProxy extends SqlMapDao { ...@@ -46,7 +57,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.initParam(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) {
...@@ -72,7 +83,7 @@ public class SqlMapDaoLogProxy extends SqlMapDao { ...@@ -72,7 +83,7 @@ public class SqlMapDaoLogProxy extends SqlMapDao {
try { try {
// 初始化参数 // 初始化参数
this.initParam(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) {
...@@ -149,23 +160,123 @@ public class SqlMapDaoLogProxy extends SqlMapDao { ...@@ -149,23 +160,123 @@ public class SqlMapDaoLogProxy extends SqlMapDao {
} }
/** /**
* 初始化参数 * 设置权限参数
* *
* @param name * @param name
* @param parameters * @param parameters
*/ */
private void initParam(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());
} }
/**
* 设置数据权限
*
* @param name
* @param parameters
*/
private void setDataAuth(String name, Object parameters) {
// 需要过滤部分sql name,否则会形成死循环
String[] serviceFilter = {"HPXSUser", "HPXSOrg", "HPPZ009.query", "HPPZ010.query"};
if (StringUtils.startsWithAny(name, serviceFilter)) {
return;
}
// 是否启用数据权限
if (!ThreadLocalTools.DATA_AUTH.get()) {
return;
}
String authEnable = PlatApplicationContext.getProperty("iplat4j.page.auth.enable");
if (StringUtils.isNotBlank(authEnable) && "0".equals(authEnable)) {
return;
}
// 页面英文名
String pageEname = ThreadLocalTools.FORM_ENAME.get();
if (StringUtils.isBlank(pageEname)) {
return;
}
// 当前用户所在的部门
List<String> userOrgIds = UserSessionUtils.getOrgId();
AssertUtils.isEmpty(userOrgIds, "当前用户未绑定部门,无法操作数据,请联系管理员!");
// 构建部门权限
buildDepAuth(pageEname, userOrgIds, parameters);
}
/**
* 构建部门权限
*
* @param pageEname
* @param userOrgIds
* @param parameters
*/
private void buildDepAuth(String pageEname, List<String> userOrgIds, Object parameters) {
// 查询当前页面设置的所有权限
List<HPPZ010> dbPz010s = HPPZTools.HpPz010.listByPage(pageEname, userOrgIds);
if (CollectionUtils.isEmpty(dbPz010s)) {
((Map) parameters).put("depCode", AuthTypeEnum.NO_AUTH.getCode());
return;
}
// 构建数据范围权限查询条件
List<String> depCodes = new ArrayList<>();
for (HPPZ010 dbPz010 : dbPz010s) {
List<String> depAuths = buildDepCondition(dbPz010);
// ALL查看所有数据,仅限本企业
if (depAuths.contains(AuthTypeEnum.ALL.getCode())) {
depCodes = null;
break;
}
depCodes.addAll(depAuths);
}
((Map) parameters).put("depCodes", depCodes);
}
/**
* 组装 Custom Data Auth Condition
*
* @param dbPz010
*/
private List<String> buildDepCondition(HPPZ010 dbPz010) {
String authType = dbPz010.getAuthType();
if (StringUtils.isBlank(authType) || AuthTypeEnum.NO_AUTH.getCode().equals(authType)) {
return Arrays.asList(AuthTypeEnum.NO_AUTH.getCode());
}
String authDepCode = dbPz010.getAuthDepCode();
// 看全部
if (AuthTypeEnum.ONLY_COMPANY.getCode().equals(authType)) {
return Arrays.asList(AuthTypeEnum.ALL.getCode());
} else if (AuthTypeEnum.ONLY_FACTORY.getCode().equals(authType)) {
// 查询当前部门所在的厂及子集
Org factoryOrg = HPXSTools.XsOrg.queryFactory(authDepCode);
return HPXSTools.XsOrg.queryChildren(factoryOrg.getOrgId());
} else if (AuthTypeEnum.ONLY_DEPT.getCode().equals(authType)) {
return HPXSTools.XsOrg.queryChildren(authDepCode);
} else {
return Arrays.asList(AuthTypeEnum.NO_AUTH.getCode());
}
}
} }
...@@ -26,7 +26,6 @@ import com.baosight.xservices.xs.util.LoginUserDetails; ...@@ -26,7 +26,6 @@ import com.baosight.xservices.xs.util.LoginUserDetails;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
......
package com.baosight.xservices.xs.og.service; package com.baosight.xservices.xs.og.service;
import com.baosight.hpjx.core.constant.CodesetConstant; import com.baosight.hpjx.core.constant.CodesetConstant;
import com.baosight.hpjx.core.constant.CommonConstant;
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.core.tools.CodeValueTools; import com.baosight.hpjx.core.tools.CodeValueTools;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC010; import com.baosight.hpjx.hp.kc.domain.HPKC010;
import com.baosight.hpjx.hp.xs.domain.Org; import com.baosight.hpjx.hp.xs.domain.Org;
import com.baosight.hpjx.hp.xs.tools.HPXSTools; import com.baosight.hpjx.hp.xs.tools.HPXSTools;
...@@ -13,19 +11,13 @@ import com.baosight.hpjx.util.DateUtils; ...@@ -13,19 +11,13 @@ import com.baosight.hpjx.util.DateUtils;
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.StringUtils;
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.service.impl.ServiceEPBase; import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.core.service.soa.XServiceManager; import com.baosight.iplat4j.core.service.soa.XServiceManager;
import com.baosight.iplat4j.core.web.threadlocal.UserSession; import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import com.baosight.xservices.xs.og.domain.XSOG01; import com.baosight.xservices.xs.og.domain.XSOG01;
import com.baosight.xservices.xs.util.LoginUserDetails;
import org.apache.commons.collections.CollectionUtils;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
......
package com.baosight.xservices.xs.service; package com.baosight.xservices.xs.service;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.iplat4j.core.FrameworkInfo; import com.baosight.iplat4j.core.FrameworkInfo;
import com.baosight.iplat4j.core.ei.EiBlockMeta; import com.baosight.iplat4j.core.ei.EiBlockMeta;
import com.baosight.iplat4j.core.ei.EiColumn; import com.baosight.iplat4j.core.ei.EiColumn;
...@@ -41,10 +40,10 @@ public class ServiceXS0705 extends MenuTreeService { ...@@ -41,10 +40,10 @@ public class ServiceXS0705 extends MenuTreeService {
public List getChildNodes(String parentLabel) { public List getChildNodes(String parentLabel) {
String manageSwitch = StringUtils.defaultIfEmpty(PlatApplicationContext.getProperty("xservices.security.manage.switch"), "off"); String manageSwitch = StringUtils.defaultIfEmpty(PlatApplicationContext.getProperty("xservices.security.manage.switch"), "off");
Map params = new HashMap();
if (StringUtils.isEmpty(parentLabel) || "$".equals(parentLabel)) { if (StringUtils.isEmpty(parentLabel) || "$".equals(parentLabel)) {
parentLabel = "root"; parentLabel = "root";
} }
Map params = new HashMap();
String loginName = UserSession.getUser().getUsername(); String loginName = UserSession.getUser().getUsername();
params.put("node", parentLabel); params.put("node", parentLabel);
params.put("loginName", loginName); params.put("loginName", loginName);
...@@ -61,46 +60,41 @@ public class ServiceXS0705 extends MenuTreeService { ...@@ -61,46 +60,41 @@ public class ServiceXS0705 extends MenuTreeService {
List ret = this.dao.query(stmt, params); List ret = this.dao.query(stmt, params);
if ("off".equals(manageSwitch)) { if ("off".equals(manageSwitch)) {
return ret; return ret;
} else { }
List ret2 = new ArrayList(); List ret2 = new ArrayList();
for (int i = 0; i < ret.size(); ++i) {
for(int i = 0; i < ret.size(); ++i) { Map node = (Map) ret.get(i);
Map node = (Map)ret.get(i); String text = node.get("text").toString();
String text = node.get("text").toString(); if (text.indexOf("[页面]") > 0) {
if (text.indexOf("[页面]") > 0) { ret2.add(0, ret.get(i));
ret2.add(0, ret.get(i)); } else {
} else { ret2.add(ret.get(i));
ret2.add(ret.get(i));
}
} }
}
List authorized = new ArrayList(); List authorized = new ArrayList();
if (!LoginUserDetails.isUserAdmin(loginName)) { if (LoginUserDetails.isUserAdmin(loginName)) {
if (AuthenticationInfo.userManageAuthentication.get(loginName) == null) { authorized = ret2;
AuthenticationInfo.getUserManageAuthentication(loginName); return authorized;
} }
if (AuthenticationInfo.userManageAuthentication.get(loginName) == null) {
List authManageList = (List)AuthenticationInfo.userManageAuthentication.get(loginName); AuthenticationInfo.getUserManageAuthentication(loginName);
}
for(int i = 0; i < ret2.size(); ++i) { List authManageList = (List) AuthenticationInfo.userManageAuthentication.get(loginName);
Map node = (Map)ret.get(i); for (int i = 0; i < ret2.size(); ++i) {
BigDecimal nodeLeaf = new BigDecimal("1"); Map node = (Map) ret.get(i);
BigDecimal leaf = (BigDecimal)node.get("leaf"); BigDecimal nodeLeaf = new BigDecimal("1");
if (nodeLeaf.equals(leaf)) { BigDecimal leaf = (BigDecimal) node.get("leaf");
String label = (String)node.get("label"); if (nodeLeaf.equals(leaf)) {
if (this.isManageResource(label, authManageList)) { String label = (String) node.get("label");
authorized.add(node); if (this.isManageResource(label, authManageList)) {
} authorized.add(node);
} else {
authorized.add(node);
}
} }
} else { } else {
authorized = ret2; authorized.add(node);
} }
return authorized;
} }
return authorized;
} }
private boolean isManageResource(String label, List authManageList) { private boolean isManageResource(String label, List authManageList) {
......
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
<isNotEmpty prepend=" AND " property="node"> <isNotEmpty prepend=" AND " property="node">
t1.node_ename like concat(#node#, '%') t1.node_ename like concat(#node#, '%')
</isNotEmpty> </isNotEmpty>
order by "sortIndex" order by sortIndex asc
</select> </select>
<select id="query2" resultClass="java.util.HashMap"> <select id="query2" resultClass="java.util.HashMap">
......
...@@ -23,3 +23,4 @@ ...@@ -23,3 +23,4 @@
</script> </script>
<script src="${ctx}/common/js/common.js"></script> <script src="${ctx}/common/js/common.js"></script>
<script src="${ctx}/common/js/jsUtils.js"></script> <script src="${ctx}/common/js/jsUtils.js"></script>
<EF:EFInput cname="parentFormEname" ename="efParentFormEname" type="hidden"/>
$(function () { $(function () {
IPLATUI.EFGrid.result = {
pageable: {
pageSize: 20,
pageSizes: [10, 20, 50, 70, 100],
},
}
// 查询 IPLATUI.EFTree = {
$("#QUERY").on("click", query); "pageTree": {
// ROOT: {label: "root", text: "系统菜单", leaf: true}
select: function (e) {
pageTreeSelect(this.dataItem(e.node));
},
selectTreeNode: {
leaf: false
}
},
"orgTree": {
// ROOT: {label: "root", text: "系统菜单", leaf: true}
select: function (e) {
orgTreeSelect(this.dataItem(e.node));
},
selectTreeNode: {
leaf: false
}
}
};
// 保存 // 保存
$("#BTN_SAVE").on("click", save); $("#SAVE").on("click", save);
// 删除
$("#BTN_DELETE").on("click", deleteFunc);
}); });
/** /**
* 页面加载时执行 * 页面加载时执行
*/ */
$(window).load(function () { $(window).load(function () {
// 查询 // 禁用Input
query(); disableInput();
// 权限类型绑定事件
authTypeInputEvent();
}); });
/** /**
* 查询 * Input集合
*
* @returns {*|jQuery|HTMLElement}
*/ */
let query = function () { let listAuthTypeInput = function () {
resultGrid.dataSource.page(1); return $("input:radio[name='result-0-authType']");
} }
/** /**
* 保存 * 清除Input选择
*
* @param bool
*/ */
let save = function () { let clearCheckedInput = function () {
let rows = resultGrid.getCheckedRows(); // 权限子项
if (rows.length < 1) { checkedAuthTypeInput(false);
message("请选择数据"); }
return;
/**
* 选中或取消Input,权限子项
*
* @param bool
*/
let checkedAuthTypeInput = function (bool) {
listAuthTypeInput().prop('checked', bool);
}
/**
* 禁用或启用Input
*/
let disableInput = function () {
let bool = false;
let orgNode = IPLATUI.EFTree.orgTree.selectTreeNode.label;
let pageNode = IPLATUI.EFTree.pageTree.selectTreeNode.label;
let pageLeaf = IPLATUI.EFTree.pageTree.selectTreeNode.leaf;
if (isBlank(orgNode) || isBlank(pageNode) || pageLeaf) {
bool = true;
} }
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", { // 数据权限
ok: function () { listAuthTypeInput().each(function () {
JSUtils.submitGridsData("result", "HPPZ009", "save", true); $(this).attr('readonly', bool);
});
}
/**
* 数据权限绑定事件
*/
let authTypeInputEvent = function () {
$("input:radio[name='result-0-authType']").on("change", function () {
if ($(this).prop('readonly')) {
$(this).prop('checked', '');
return;
} }
}); });
} }
/** /**
* 删除 * 菜单树节点选中
*
* @param e
*/
let pageTreeSelect = function (nodeData) {
// 设置选择的节点
setSelectPageTreeNode(nodeData);
// 清空选项
clearCheckedInput();
// 启用Input/禁用Input
disableInput();
// 叶子节点渲染权限
if (!nodeData.leaf) {
showAuthInput();
}
}
/**
* 组织树节点选中
*
* @param e
*/
let orgTreeSelect = function (nodeData) {
// 设置选择的节点
setSelectOrgTreeNode(nodeData);
// 非叶子节点清空显示
let pageLeaf = IPLATUI.EFTree.pageTree.selectTreeNode.leaf;
disableInput(pageLeaf);
// 清空选项
clearCheckedInput();
// 渲染权限
showAuthInput();
}
/**
* 设置选择的节点
*
* @param nodeData
*/
let setSelectPageTreeNode = function (nodeData) {
IPLATUI.EFTree.pageTree.selectTreeNode.label = nodeData.label;
IPLATUI.EFTree.pageTree.selectTreeNode.text = nodeData.text;
IPLATUI.EFTree.pageTree.selectTreeNode.leaf = nodeData.leaf;
}
/**
* 设置选择的节点
*
* @param nodeData
*/
let setSelectOrgTreeNode = function (nodeData) {
IPLATUI.EFTree.orgTree.selectTreeNode.label = nodeData.label;
IPLATUI.EFTree.orgTree.selectTreeNode.text = nodeData.text;
IPLATUI.EFTree.orgTree.selectTreeNode.leaf = nodeData.leaf;
}
/**
* 显示权限选择框
*
* @param node
*/ */
let deleteFunc = function () { let showAuthInput = function () {
let rows = resultGrid.getCheckedRows(); let depCode = IPLATUI.EFTree.orgTree.selectTreeNode.label;
if (rows.length < 1) { let pageEname = IPLATUI.EFTree.pageTree.selectTreeNode.label;
message("请选择数据"); if (isBlank(depCode) || isBlank(pageEname)) {
return; return;
} }
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作? ", { // 渲染权限
ok: function () { let inInfo = new EiInfo();
JSUtils.submitGridsData("result", "HPPZ009", "delete", true); inInfo.set("inqu_status-0-pageEname", pageEname);
inInfo.set("inqu_status-0-authDepCode", depCode);
EiCommunicator.send("HPPZ010", "getByPage", inInfo, {
onSuccess: getByPageSuccess,
onFail: function (res) {
message(res.msg);
} }
}, {async: false});
}
/**
* 获取页面权限成功
*
* @param res
*/
let getByPageSuccess = function (res) {
// 清空权限子项
checkedAuthTypeInput(false);
if (res.status < 0) {
message(res.msg);
return;
}
let resultRows = res.getBlock("result").getMappedRows();
if (resultRows.length == 0) {
return;
}
let authType = resultRows[0]['authType'];
if (!isBlank(authType)) {
listAuthTypeInput().each(function () {
if ($(this).val() == authType) {
$(this).prop('checked', 'true');
}
})
}
}
/**
* 保存
*/
let save = function () {
// 检查是否选择的叶子节点
let pageNode = IPLATUI.EFTree.pageTree.selectTreeNode;
if (isBlank(pageNode.label)) {
message("请选择菜单");
return;
}
if (pageNode.leaf) {
message("【" + pageNode.text + "】不是叶子节点,请选择菜单树叶子节点进行授权");
return;
}
let orgNode = IPLATUI.EFTree.orgTree.selectTreeNode;
if (isBlank(orgNode.label)) {
message("请选择部门");
return;
}
JSUtils.confirm("确定对勾选中的数据做\"保存\"操作? ", {
ok: saveOk(pageNode, orgNode)
}); });
} }
/**
* 保存确认
*/
let saveOk = function (pageNode, orgNode) {
let inInfo = new EiInfo();
inInfo.set("result-0-pageEname", pageNode.label);
inInfo.set("result-0-pageCname", pageNode.text);
inInfo.set("result-0-authDepCode", orgNode.label);
inInfo.set("result-0-authDepName", orgNode.text);
inInfo.set("result-0-authType", $("input:radio[name='result-0-authType']:checked").val());
EiCommunicator.send("HPPZ010", "save", inInfo, {
onSuccess: function (res) {
message(res.msg);
},
onFail: function (res) {
}
}, {async: false});
}
<%@ page import="com.baosight.hpjx.hp.xs.tools.HPXSTools" %>
<%@ page import="java.util.List" %>
<%@ page import="com.baosight.hpjx.hp.xs.domain.Org" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="com.baosight.hpjx.core.enums.OrgTypeEnum" %>
<!DOCTYPE html> <!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %> <%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %> <%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<%
Map<String, List<Org>> orgMap = HPXSTools.XsOrg.queryAllFactoryMap();
if (orgMap == null) {
orgMap = new HashMap<>();
}
request.setAttribute("orgMap", orgMap);
%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/> <c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage> <EF:EFPage>
<div class="row" style="margin: 0 -10px;"> <div class="row" style="margin: 0 -10px;">
<div class="col-md-4"> <div class="col-md-4">
<EF:EFRegion title="系统菜单树" id="tree" fitHeight="true"> <EF:EFRegion title="系统菜单树" id="tree" fitHeight="true">
<EF:EFTree bindId="groupsTree" ename="node" textField="text" valueField="label" hasChildren="leaf" <EF:EFTree bindId="pageTree" ename="node" textField="text" valueField="label" hasChildren="leaf"
serviceName="XS0705" methodName="query" style="height:435px;"> serviceName="HPPZ010" methodName="queryPageTree">
</EF:EFTree> </EF:EFTree>
</EF:EFRegion> </EF:EFRegion>
</div> </div>
<div class="col-md-8"> <div class="col-md-4">
<EF:EFRegion title="查询区" id="inqu"> <EF:EFRegion title="组织机构树" id="tree" fitHeight="true">
<div class="row" > <EF:EFTree bindId="orgTree" ename="node" textField="text" valueField="label" hasChildren="leaf"
<EF:EFInput type="hidden" cname="授权主体ID" ename="subjectId" row="0" blockId="inqu_status"/> serviceName="HPPZ010" methodName="queryOrgTree">
<EF:EFInput type="hidden" ename="objectCname" row ="0" blockId="inqu_status"/> </EF:EFTree>
<EF:EFInput type="hidden" cname="授权类别" ename="operationType" row="0" blockId="inqu_status" value="ACCESS"/>
<EF:EFInput row="0" blockId="inqu_status" ename="objectEname" cname="授权客体名称" type="hidden"/>
<div class="col-xs-4">
<div class="form-group">
<label class="col-md-5 control-label">
授权主体名称
</label>
<div class="col-md-7">
<input name="inqu_status-0-subjectName" data-query="gt" class="k-textbox input-time query-need"
placeholder="请输入授权主体名称" />
</div>
</div>
</div>
<EF:EFSelect blockId="inqu_status" cname="授权主体类别" ename="subjectType" row="0" defaultValue="全部" colWidth="4" ratio="5:7">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="iplat.xs.subjectType" textField="label" valueField="value"/>
</EF:EFSelect>
<div class="col-xs-4">
<div class="form-group">
<label class="col-md-5 control-label">
授权客体名称
</label>
<div class="col-md-7">
<input name="inqu_status-0-objectName" data-query="gt" class="k-textbox input-time query-need"
placeholder="请输入授权客体名称" />
</div>
</div>
</div>
<EF:EFSelect blockId="inqu_status" cname="授权客体类别" colWidth="4" ename="objectType" row="0" defaultValue="全部" ratio="5:7">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="xs.og.objectType" textField="label" valueField="value"/>
</EF:EFSelect>
<div class="col-xs-8" style="text-align: right" id="inqu_inside"></div>
</div>
</EF:EFRegion>
<EF:EFInput ename="objectCname" cname="授权主体名称" type="hidden"/>
<EF:EFRegion title="记录集" id="result" fitHeight="true">
<EF:EFGrid blockId="result" autoDraw="false">
<EF:EFColumn ename="subjectId" cname="授权主体ID" hidden="true"/>
<EF:EFColumn ename="subjectName" cname="授权主体名称" readonly="true" locked="true"/>
<EF:EFComboColumn enable="false" cname="授权主体类别" locked="true" ename="subjectType"
defaultValue="USER" style="text-align:center;">
<EF:EFCodeOption codeName="iplat.xs.subjectType" textField="label" valueField="value"/>
</EF:EFComboColumn>
<EF:EFColumn ename="objectId" cname="授权客体ID" hidden="true"/>
<EF:EFColumn ename="objectName" cname="授权客体名称" readonly="true" locked="true"/>
<EF:EFComboColumn enable="false" cname="授权客体类别" locked="true" ename="objectType"
defaultValue="RESOURCE" style="text-align:center;">
<EF:EFCodeOption codeName="xs.og.objectType" textField="label" valueField="value"/>
</EF:EFComboColumn>
<EF:EFComboColumn cname="操作类型" ename="operationType" readonly="true"
defaultValue="ACCESS" style="text-align:center;">
<EF:EFCodeOption codeName="services.xs.operationType" textField="label" valueField="value"/>
</EF:EFComboColumn>
<EF:EFColumn ename="sortIndex" cname="排序" style="text-align:center;"/>
<EF:EFColumn ename="recCreator" cname="创建人" style="text-align:center;" readonly="true"/>
<EF:EFColumn ename="recCreateTime" cname="创建时间" editType="datetime" readonly="true" displayType="datetime" parseFormats="['yyyyMMddHHmmss','yyyy-MM-dd HH:mm:ss']" style="text-align:center;"/>
<EF:EFColumn ename="recRevisor" cname="修改人" style="text-align:center;" readonly="true"/>
<EF:EFColumn ename="recReviseTime" cname="修改时间" readonly="true" editType="datetime" displayType="datetime" parseFormats="['yyyyMMddHHmmss','yyyy-MM-dd HH:mm:ss']" style="text-align:center;"/>
<EF:EFColumn ename="archiveFlag" cname="归档标记" style="text-align:center;"/>
</EF:EFGrid>
</EF:EFRegion> </EF:EFRegion>
</div> </div>
</div>
<EF:EFWindow id="authSubject" width="58%" top="100px" left="280px"> <div class="col-md-4">
<div id="ef_popup_gridA" > <EF:EFRegion title="数据查看范围" id="result">
<EF:EFRegion id="inquA" title="查询条件" type="query" efRegionShowClear="true" efRegionSave="true">
<div class="row"> <div class="row">
<div class="col-xs-2 control-label"> <div class="col-md-12">
<span>用户组英文名</span> <EF:EFInput cname="本公司" blockId="result" ename="authType" row="0" value="onlyCompany"
</div> colWidth="3" type="radio" inline="true"/>
<div class="col-xs-2">
<EF:EFInput ename="inqu_status-0-groupEname" cname="用户组英文名" inline="true"/>
</div> </div>
<div class="col-xs-3 control-label"> </div>
<span>用户组中文名</span> <div class="row">
<div class="col-md-9">
<EF:EFInput cname="本厂" blockId="result" ename="authType" row="0" value="onlyFactory"
colWidth="3" type="radio" inline="true"/>
</div> </div>
<div class="col-xs-2"> </div>
<EF:EFInput ename="inqu_status-0-groupCname" cname="用户组中文名" inline="true"/> <div class="row">
<div class="col-md-6">
<EF:EFInput cname="本部门" blockId="result" ename="authType" row="0" value="onlyDept"
colWidth="3" type="radio" inline="true"/>
</div> </div>
<div class="col-xs-2" style="text-align: right" id="inqua_inside"></div>
</div> </div>
</EF:EFRegion> <div class="row">
<EF:EFRegion id="resultA" title="记录集"> <div class="col-md-6">
<div class="text-right"> <EF:EFInput cname="不可查看" blockId="result" ename="authType" row="0" value="noAuth" colWidth="3"
<EF:EFButton cname="确定" ename="ef_popup_gridA_commit"></EF:EFButton> type="radio" inline="true"/>
</div>
</div> </div>
<EF:EFGrid blockId="resultA" queryMethod="queryForGridSubject" autoDraw="false">
<EF:EFColumn ename="groupId" locked="true" cname="群组ID" hidden="true" primaryKey="true"/>
<EF:EFColumn ename="groupEname" locked="true" cname="群组英文名" readonly="true" width="300"/>
<EF:EFColumn ename="groupCname" cname="群组中文名" readonly="true" width="300"/>
</EF:EFGrid>
</EF:EFRegion> </EF:EFRegion>
</div> </div>
</EF:EFWindow> </div>
<EF:EFWindow id="menuPageAuth" url="${ctx}/web/XS0707" width="78%" top="80px" left="120px"></EF:EFWindow>
</EF:EFPage> </EF:EFPage>
$(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="authType" 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>
......
...@@ -543,7 +543,7 @@ $(function () { ...@@ -543,7 +543,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%",
......
...@@ -190,8 +190,10 @@ ...@@ -190,8 +190,10 @@
href = replacePos(href, (inx + 1), "?"); href = replacePos(href, (inx + 1), "?");
} }
} else { } else {
} }
// 当前页面号
let efFormEname = __eiInfo.extAttr[EiConstant.EF_FORM_ENAME];
href = href + (href.indexOf("?") == -1 ? '?' : '&') + "efParentFormEname=" + efFormEname;
parameter["href"] = href; parameter["href"] = href;
popWindow = divhtml.data("kendoWindow"); popWindow = divhtml.data("kendoWindow");
popWindow.setOptions({ popWindow.setOptions({
......
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