Commit 82d25f2a authored by 雍欢's avatar 雍欢

多数据库支持

parent 265886b4
...@@ -189,7 +189,7 @@ public class OrgQueryModel extends QueryModel { ...@@ -189,7 +189,7 @@ public class OrgQueryModel extends QueryModel {
} }
if (!getShowVirtualOrg()) { if (!getShowVirtualOrg()) {
condition.append(" and nvl(o.is_Virtual, 0) = :isVirtual"); condition.append(" and (case when o.is_Virtual is null then 0 else o.is_Virtual end) = :isVirtual");
this.putParam("isVirtual", 0); this.putParam("isVirtual", 0);
} }
...@@ -244,7 +244,7 @@ public class OrgQueryModel extends QueryModel { ...@@ -244,7 +244,7 @@ public class OrgQueryModel extends QueryModel {
} }
// 状态条件 // 状态条件
List<Integer> statuses = new ArrayList<Integer>(); List<Integer> statuses = new ArrayList<>();
Integer status = this.inputParams.getInteger(CommonDomainConstants.STATUS_FIELD_NAME); Integer status = this.inputParams.getInteger(CommonDomainConstants.STATUS_FIELD_NAME);
if (status != null) { if (status != null) {
statuses.add(status); statuses.add(status);
......
...@@ -16,30 +16,51 @@ public interface TMAuthorizeRepository extends JpaRepository<TMAuthorize, String ...@@ -16,30 +16,51 @@ public interface TMAuthorizeRepository extends JpaRepository<TMAuthorize, String
List<TMAuthorize> findBySubordinationIdAndSystemIdAndRoleKindId(String subordinationId, String systemId, String roleKindId); List<TMAuthorize> findBySubordinationIdAndSystemIdAndRoleKindId(String subordinationId, String systemId, String roleKindId);
/**
* @deprecated 该方法只支持Oracle数据库查询,请使用 {@link #findFirstByManagerIdAndRoleKindIdNot(String, String)} 替代。
*/
@Query(name = "tmAuthorize.findByManagerIdNotRole", nativeQuery = true, value = "select * from SA_TMAuthorize where manager_Id = :managerId and role_kind_id <> :roleKindId and rownum=1") @Query(name = "tmAuthorize.findByManagerIdNotRole", nativeQuery = true, value = "select * from SA_TMAuthorize where manager_Id = :managerId and role_kind_id <> :roleKindId and rownum=1")
TMAuthorize findByManagerIdNotRole(@Param("managerId") String managerId, @Param("roleKindId") String roleKindId); TMAuthorize findByManagerIdNotRole(@Param("managerId") String managerId, @Param("roleKindId") String roleKindId);
/**
* @since 1.1.3
*/
TMAuthorize findFirstByManagerIdAndRoleKindIdNot(String managerId, String roleKindId);
/**
* @deprecated 该方法只支持Oracle数据库查询,请使用 {@link #findFirstBySubordinationIdAndManagerIdNot(String, String)} 替代。
*/
@Deprecated
@Query(name = "tmAuthorize.findBySubordinationIdAndManagerId", nativeQuery = true, value = "select * from SA_TMAuthorize where subordination_Id = :subordinationId and manager_Id = :managerId and rownum=1") @Query(name = "tmAuthorize.findBySubordinationIdAndManagerId", nativeQuery = true, value = "select * from SA_TMAuthorize where subordination_Id = :subordinationId and manager_Id = :managerId and rownum=1")
TMAuthorize findBySubordinationIdAndManagerId( @Param("managerId") String managerId, @Param("subordinationId") String subordinationId); TMAuthorize findBySubordinationIdAndManagerId(@Param("managerId") String managerId, @Param("subordinationId") String subordinationId);
/**
* @since 1.1.3
*/
TMAuthorize findFirstBySubordinationIdAndManagerIdNot(String managerId, String subordinationId);
/** /**
* 查找三员授权 * 查找三员授权
*/ */
@Query(name = "tmAuthorize.findOneTMAuthorize", nativeQuery = true, value = "select * from SA_TMAuthorize where (:subordinationFullId like subordination_full_id || '%' or subordination_full_id like :subordinationFullId || '%') and (system_id = :systemId or system_id = '*') and role_kind_id = :roleKindId and manager_Id = :managerId") @Query(name = "tmAuthorize.findOneTMAuthorize", value = "from TMAuthorize where (:subordinationFullId like CONCAT(subordinationFullId,'%') or subordinationFullId like CONCAT(:subordinationFullId,'%')) and (systemId = :systemId or systemId = '*') and roleKindId = :roleKindId and managerId = :managerId")
TMAuthorize findOneTMAuthorize(@Param("managerId") String managerId, @Param("subordinationFullId") String subordinationFullId, @Param("systemId") String systemId, @Param("roleKindId") String roleKindId); TMAuthorize findOneTMAuthorize(@Param("managerId") String managerId, @Param("subordinationFullId") String subordinationFullId, @Param("systemId") String systemId, @Param("roleKindId") String roleKindId);
/** /**
* 查找三员授权 * 查找三员授权
* *
* @param managerId * @param managerId 管理者ID
* 管理者ID * @param subordinationId 下属ID
* @param subordinationId * @param systemId 系统ID
* 下属ID * @return 三员授权实体
* @param systemId * @deprecated 该方法只支持Oracle数据库查询,请使用 {@link #findFirstByManagerIdAndSubordinationIdAndSystemId(String, String, String)} 替代。
* 系统ID */
* @return 三员授权实体 @Deprecated
*/
@Query(name = "tmAuthorize.findOneTMAuthorize2", nativeQuery = true, value = "select * from SA_TMAuthorize where subordination_id = :subordinationId and system_id = :systemId and manager_id = :managerId and rownum=1") @Query(name = "tmAuthorize.findOneTMAuthorize2", nativeQuery = true, value = "select * from SA_TMAuthorize where subordination_id = :subordinationId and system_id = :systemId and manager_id = :managerId and rownum=1")
TMAuthorize findOneTMAuthorize(@Param("managerId") String managerId, @Param("subordinationId") String subordinationId, @Param("systemId") String systemId); TMAuthorize findOneTMAuthorize(@Param("managerId") String managerId, @Param("subordinationId") String subordinationId, @Param("systemId") String systemId);
/**
* @since 1.1.3
*/
TMAuthorize findFirstByManagerIdAndSubordinationIdAndSystemId(@Param("managerId") String managerId, @Param("subordinationId") String subordinationId, @Param("systemId") String systemId);
} }
\ No newline at end of file
...@@ -9,7 +9,7 @@ import com.huigou.uasp.bpm.managment.domain.model.ProcDefinition; ...@@ -9,7 +9,7 @@ import com.huigou.uasp.bpm.managment.domain.model.ProcDefinition;
/** /**
* 流程定义 * 流程定义
* *
* @author gongmm * @author gongmm
*/ */
public interface ProcDefinitionApplication { public interface ProcDefinitionApplication {
...@@ -20,89 +20,78 @@ public interface ProcDefinitionApplication { ...@@ -20,89 +20,78 @@ public interface ProcDefinitionApplication {
/** /**
* 保存流程定义 * 保存流程定义
* *
* @param procDefinition * @param procDefinition 流程定义
* 流程定义
* @return * @return
*/ */
String insertProcDefinition(ProcDefinition procDefinition); String insertProcDefinition(ProcDefinition procDefinition);
/** /**
* 修改流程定义 * 修改流程定义
* *
* @param procDefinition * @param procDefinition 流程定义
* 流程定义
*/ */
void updateProcDefinition(ProcDefinition procDefinition); void updateProcDefinition(ProcDefinition procDefinition);
/** /**
* 加载流程定义 * 加载流程定义
* *
* @param id * @param id 流程定义ID
* 流程定义ID
* @return * @return
*/ */
ProcDefinition loadProcDefinition(String id); ProcDefinition loadProcDefinition(String id);
/** /**
* 通过流程ID加载流程定义 * 通过流程ID加载流程定义
* *
* @param procId * @param procId 流程定义ID
* 流程定义ID
* @return * @return
*/ */
ProcDefinition loadProcDefinitionByProcId(String procId); ProcDefinition loadProcDefinitionByProcId(String procId);
/** /**
* 加载流程定义 * 加载流程定义
* *
* @param procId * @param procId 流程定义ID
* 流程定义ID * @param procUnitId 流程环节ID
* @param procUnitId
* 流程环节ID
* @return * @return
*/ */
ProcDefinition loadProcDefinitionByProcAndProcUnitId(String procId, String procUnitId); ProcDefinition loadProcDefinitionByProcAndProcUnitId(String procId, String procUnitId);
/** /**
* 删除流程定义 * 删除流程定义
* *
* @param ids * @param ids 流程定义ID列表
* 流程定义ID列表
*/ */
void deleteProcDefinitions(List<String> ids); void deleteProcDefinitions(List<String> ids);
/** /**
* 查询流程定义 * 查询流程定义
* *
* @param parentId * @param parentId 父ID
* 父ID * @param code 编码
* @param code * @param name 名称
* 编码 * @param includeProcUnit 包括流程环节
* @param name * @param pageable 分页信息
* 名称 * @deprecated 请使用 {@link #findProcDefinitions(boolean, ParentAndCodeAndNameQueryRequest)} 替代。
* @param includeProcUnit */
* 包括流程环节 @Deprecated
* @param pageable
* 分页信息
* @return
*/
Map<String, Object> queryProcDefinitions(boolean includeProcUnit, ParentAndCodeAndNameQueryRequest queryRequest); Map<String, Object> queryProcDefinitions(boolean includeProcUnit, ParentAndCodeAndNameQueryRequest queryRequest);
/**
* @since 1.1.3
*/
Map<String, Object> findProcDefinitions(boolean includeProcUnit, ParentAndCodeAndNameQueryRequest queryRequest);
/** /**
* 分页查询流程定义 * 分页查询流程定义
*
* @param parentId
* 父ID
* @param queryModel
* 查询模型
* @return
*/ */
Map<String, Object> slicedQueryProcDefinitions(ParentIdQueryRequest queryRequest); Map<String, Object> slicedQueryProcDefinitions(ParentIdQueryRequest queryRequest);
/** /**
* 得到下一个排序号 * 得到下一个排序号
* *
* @param parentId * @param parentId
* @return * @return
*/ */
...@@ -110,14 +99,14 @@ public interface ProcDefinitionApplication { ...@@ -110,14 +99,14 @@ public interface ProcDefinitionApplication {
/** /**
* 更改流程定义排序号 * 更改流程定义排序号
* *
* @param params * @param params
*/ */
void updateProcDefinitionSequence(Map<String, Integer> params); void updateProcDefinitionSequence(Map<String, Integer> params);
/** /**
* 移动流程定义 * 移动流程定义
* *
* @param ids * @param ids
* @param parentId * @param parentId
*/ */
...@@ -125,32 +114,29 @@ public interface ProcDefinitionApplication { ...@@ -125,32 +114,29 @@ public interface ProcDefinitionApplication {
/** /**
* 绑定Activiti流程定义 * 绑定Activiti流程定义
* *
* @param id * @param id 流程定义ID
* 流程定义ID * @param procId Activiti流程ID
* @param procId
* Activiti流程ID
*/ */
void bindActivitiProcDefinition(String id, String procId); void bindActivitiProcDefinition(String id, String procId);
/** /**
* 导入流程环节 * 导入流程环节
* *
* @param parentId * @param parentId 父ID
* 父ID
*/ */
void importProcUnits(String parentId); void importProcUnits(String parentId);
/** /**
* 查询一级流程定义 * 查询一级流程定义
* *
* @return * @return
*/ */
List<Map<String, Object>> queryOneLevelProcDefinitions(); List<Map<String, Object>> queryOneLevelProcDefinitions();
/** /**
* 从Activiti中读取流程环节 * 从Activiti中读取流程环节
* *
* @param procId * @param procId
*/ */
List<Map<String, Object>> queryProcUnitsFromActiviti(String processDefinitionKey); List<Map<String, Object>> queryProcUnitsFromActiviti(String processDefinitionKey);
...@@ -159,8 +145,7 @@ public interface ProcDefinitionApplication { ...@@ -159,8 +145,7 @@ public interface ProcDefinitionApplication {
* 查询流程环节,用于排序 * 查询流程环节,用于排序
*/ */
/** /**
* @param processDefinitionKey * @param processDefinitionKey 流程定义Key
* 流程定义Key
* @return * @return
*/ */
List<ProcDefinition> queryProcUnitsForSequence(String processDefinitionKey); List<ProcDefinition> queryProcUnitsForSequence(String processDefinitionKey);
......
...@@ -3,12 +3,13 @@ package com.huigou.uasp.bpm.managment.repository; ...@@ -3,12 +3,13 @@ package com.huigou.uasp.bpm.managment.repository;
import java.util.List; import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param; import org.springframework.data.repository.query.Param;
import com.huigou.uasp.bpm.managment.domain.model.ProcDefinition; import com.huigou.uasp.bpm.managment.domain.model.ProcDefinition;
public interface ProcDefinitionRespository extends JpaRepository<ProcDefinition, String> { public interface ProcDefinitionRespository extends JpaRepository<ProcDefinition, String>, JpaSpecificationExecutor<ProcDefinition> {
ProcDefinition findByProcIdAndCode(String procId, String code); ProcDefinition findByProcIdAndCode(String procId, String code);
long countByParentId(String parentId); long countByParentId(String parentId);
......
...@@ -90,7 +90,7 @@ public class TMAuthorizeApplicationImpl extends BaseApplication implements TMAut ...@@ -90,7 +90,7 @@ public class TMAuthorizeApplicationImpl extends BaseApplication implements TMAut
for (TMAuthorize item : tmAuthorizes) { for (TMAuthorize item : tmAuthorizes) {
// 验证是否管理所有系统 // 验证是否管理所有系统
authorize = this.tmAuthorizeRepository.findOneTMAuthorize(item.getManagerId(), item.getSubordinationId(), ALL_SYSTEM_ID); authorize = this.tmAuthorizeRepository.findFirstByManagerIdAndSubordinationIdAndSystemId(item.getManagerId(), item.getSubordinationId(), ALL_SYSTEM_ID);
if (authorize != null && !item.getSystemId().equals(authorize.getSystemId())) { if (authorize != null && !item.getSystemId().equals(authorize.getSystemId())) {
org = this.orgApplication.loadOrg(authorize.getManagerId()); org = this.orgApplication.loadOrg(authorize.getManagerId());
ApplicationSystem applicationSystem = applicationSystemApplication.loadApplicationSystem(authorize.getSystemId()); ApplicationSystem applicationSystem = applicationSystemApplication.loadApplicationSystem(authorize.getSystemId());
...@@ -117,7 +117,7 @@ public class TMAuthorizeApplicationImpl extends BaseApplication implements TMAut ...@@ -117,7 +117,7 @@ public class TMAuthorizeApplicationImpl extends BaseApplication implements TMAut
throw new ApplicationException(message); throw new ApplicationException(message);
} }
authorize = this.tmAuthorizeRepository.findByManagerIdNotRole(item.getManagerId(), item.getRoleKindId()); authorize = this.tmAuthorizeRepository.findFirstByManagerIdAndRoleKindIdNot(item.getManagerId(), item.getRoleKindId());
if (authorize != null) { if (authorize != null) {
Org personOrg = this.orgApplication.loadOrg(authorize.getManagerId()); Org personOrg = this.orgApplication.loadOrg(authorize.getManagerId());
roleName = RoleKind.fromId(authorize.getRoleKindId()).getDisplayName(); roleName = RoleKind.fromId(authorize.getRoleKindId()).getDisplayName();
...@@ -178,7 +178,7 @@ public class TMAuthorizeApplicationImpl extends BaseApplication implements TMAut ...@@ -178,7 +178,7 @@ public class TMAuthorizeApplicationImpl extends BaseApplication implements TMAut
// throw new ApplicationException("您没有权限操作此功能。"); // throw new ApplicationException("您没有权限操作此功能。");
} else { } else {
// 管理所有组织的授权 // 管理所有组织的授权
tmAuthorize = this.tmAuthorizeRepository.findBySubordinationIdAndManagerId(operator.getPersonMemberId(), ALL_ORG_ID); tmAuthorize = this.tmAuthorizeRepository.findFirstBySubordinationIdAndManagerIdNot(operator.getPersonMemberId(), ALL_ORG_ID);
} }
if (operator.getRoleKind() == RoleKind.SUPER_ADMINISTRATOR || tmAuthorize != null || !tmspmConifg.isEnableTspm()) { if (operator.getRoleKind() == RoleKind.SUPER_ADMINISTRATOR || tmAuthorize != null || !tmspmConifg.isEnableTspm()) {
OrgQueryModel orgQueryModel = new OrgQueryModel(sdo); OrgQueryModel orgQueryModel = new OrgQueryModel(sdo);
......
...@@ -280,7 +280,7 @@ public enum Dialect { ...@@ -280,7 +280,7 @@ public enum Dialect {
* @return String * @return String
*/ */
public static String getTotalSql(String sql) { public static String getTotalSql(String sql) {
return "select count(0) from (" + sql + ") __t__"; return "select count(0) from (" + sql + ") t_";
} }
/** /**
......
package com.huigou.data.domain.listener; package com.huigou.data.domain.listener;
import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;
import org.springframework.beans.factory.annotation.Configurable;
import com.huigou.data.jdbc.SQLQuery; import com.huigou.data.jdbc.SQLQuery;
import com.huigou.data.repository.GeneralRepositorySuper;
import com.huigou.domain.IdentifiedEntity; import com.huigou.domain.IdentifiedEntity;
import com.huigou.util.ApplicationContextWrapper; import com.huigou.util.ApplicationContextWrapper;
import org.springframework.beans.factory.annotation.Configurable;
import javax.persistence.EntityManager;
import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;
import javax.persistence.metamodel.Metamodel;
@Configurable @Configurable
public class VersionListener { public class VersionListener {
public final static String GET_NEXT_SEQ_SQL = "SELECT version_seq.nextval from DUAL"; public final static String GET_NEXT_SEQ_SQL = "SELECT version_seq.nextval from DUAL";
private boolean inited = false; private boolean inited = false;
private SQLQuery sqlQuery; private SQLQuery sqlQuery;
private Long getNextId() { private Long getNextId() {
GeneralRepositorySuper generalRepository = ApplicationContextWrapper.getBean("generalRepository", GeneralRepositorySuper.class);
EntityManager em = generalRepository.getEntityManager();
Metamodel metamodel = em.getMetamodel();
if (!inited) { if (!inited) {
sqlQuery = ApplicationContextWrapper.getBean("sqlQuery", SQLQuery.class); sqlQuery = ApplicationContextWrapper.getBean("sqlQuery", SQLQuery.class);
inited = true; inited = true;
...@@ -29,12 +34,12 @@ public class VersionListener { ...@@ -29,12 +34,12 @@ public class VersionListener {
@PrePersist @PrePersist
public void beforeCreate(IdentifiedEntity target) { public void beforeCreate(IdentifiedEntity target) {
target.setVersion(getNextId()); // target.setVersion(getNextId());
} }
@PreUpdate @PreUpdate
public void beforeUpdate(IdentifiedEntity target) { public void beforeUpdate(IdentifiedEntity target) {
target.setVersion(getNextId()); // target.setVersion(getNextId());
} }
} }
...@@ -7,11 +7,7 @@ import java.util.Collection; ...@@ -7,11 +7,7 @@ import java.util.Collection;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import javax.persistence.EntityListeners; import javax.persistence.*;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.Transient;
import org.apache.commons.lang.ArrayUtils; import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.NotImplementedException; import org.apache.commons.lang.NotImplementedException;
...@@ -28,11 +24,11 @@ import com.huigou.util.StringUtil; ...@@ -28,11 +24,11 @@ import com.huigou.util.StringUtil;
* 抽象类体实 * 抽象类体实
* <p> * <p>
* 所有实体的基类,主要包括实体标识ID和版本属性。 * 所有实体的基类,主要包括实体标识ID和版本属性。
* *
* @author gongmm * @author gongmm
*/ */
@MappedSuperclass @MappedSuperclass
@EntityListeners({ VersionListener.class }) @EntityListeners({VersionListener.class})
public abstract class AbstractEntity implements IdentifiedEntity, Serializable { public abstract class AbstractEntity implements IdentifiedEntity, Serializable {
private static final long serialVersionUID = 352956443971788977L; private static final long serialVersionUID = 352956443971788977L;
...@@ -50,6 +46,7 @@ public abstract class AbstractEntity implements IdentifiedEntity, Serializable { ...@@ -50,6 +46,7 @@ public abstract class AbstractEntity implements IdentifiedEntity, Serializable {
/** /**
* 实体版本号 * 实体版本号
*/ */
@GeneratedValue(strategy = GenerationType.TABLE)
private Long version; private Long version;
@Transient @Transient
...@@ -115,14 +112,13 @@ public abstract class AbstractEntity implements IdentifiedEntity, Serializable { ...@@ -115,14 +112,13 @@ public abstract class AbstractEntity implements IdentifiedEntity, Serializable {
/** /**
* 删除明细 * 删除明细
* *
* @param ids * @param ids 明细ID
* 明细ID
*/ */
public void removeDetails(List<String> ids) { public void removeDetails(List<String> ids) {
Assert.notEmpty(ids, "参数ids不能为空。"); Assert.notEmpty(ids, "参数ids不能为空。");
for (String id : ids) { for (String id : ids) {
for (Iterator<? extends AbstractEntity> iter = this.getDetails().iterator(); iter.hasNext();) { for (Iterator<? extends AbstractEntity> iter = this.getDetails().iterator(); iter.hasNext(); ) {
if (id.equals(iter.next().getId())) { if (id.equals(iter.next().getId())) {
iter.remove(); iter.remove();
} }
...@@ -131,7 +127,7 @@ public abstract class AbstractEntity implements IdentifiedEntity, Serializable { ...@@ -131,7 +127,7 @@ public abstract class AbstractEntity implements IdentifiedEntity, Serializable {
} }
public void removeDetails(List<? extends AbstractEntity> entities, List<String> ids) { public void removeDetails(List<? extends AbstractEntity> entities, List<String> ids) {
for (Iterator<? extends AbstractEntity> iter = entities.iterator(); iter.hasNext();) { for (Iterator<? extends AbstractEntity> iter = entities.iterator(); iter.hasNext(); ) {
if (ids.contains(iter.next().getId())) { if (ids.contains(iter.next().getId())) {
iter.remove(); iter.remove();
} }
...@@ -223,7 +219,7 @@ public abstract class AbstractEntity implements IdentifiedEntity, Serializable { ...@@ -223,7 +219,7 @@ public abstract class AbstractEntity implements IdentifiedEntity, Serializable {
for (String name : otherEntity.getUpdateFields_()) { for (String name : otherEntity.getUpdateFields_()) {
if (propertyNames.contains(name)) { if (propertyNames.contains(name)) {
field = ClassHelper.getField(otherEntity, name); field = ClassHelper.getField(otherEntity, name);
if (field != null) { if (field != null) {
// value = ClassHelper.getProperty(otherEntity, name); // 返回为String // value = ClassHelper.getProperty(otherEntity, name); // 返回为String
value = ClassHelper.getFieldValue(otherEntity, name); value = ClassHelper.getFieldValue(otherEntity, name);
if (field.getType().isEnum() && value == null) { if (field.getType().isEnum() && value == null) {
......
...@@ -163,7 +163,7 @@ public class SQLQueryImpl implements SQLQuery { ...@@ -163,7 +163,7 @@ public class SQLQueryImpl implements SQLQuery {
if (!StringUtil.isBlank(queryModel.getManageType())) { if (!StringUtil.isBlank(queryModel.getManageType())) {
sb.append(sql); sb.append(sql);
} else { } else {
sb.append("select * from (").append(sql).append(") __t__"); sb.append("select * from (").append(sql).append(") t_");
sb.append(" where 1=1 "); sb.append(" where 1=1 ");
} }
sb.append(queryModel.parseSortFields()); sb.append(queryModel.parseSortFields());
......
...@@ -194,13 +194,13 @@ public class QueryPermissionBuilderImpl implements QueryPermissionBuilder { ...@@ -194,13 +194,13 @@ public class QueryPermissionBuilderImpl implements QueryPermissionBuilder {
return sqlModel; return sqlModel;
} }
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
sb.append("select * from (").append(sql).append(")"); sb.append("select * from (").append(sql).append(") t_t_ ");
sb.append(" where 1=1 "); sb.append(" where 1=1 ");
List<OrgUnit> list = findSubordinations(operator.getUserId(), operator.getPersonMemberFullIds(), manageType); List<OrgUnit> list = findSubordinations(operator.getUserId(), operator.getPersonMemberFullIds(), manageType);
if (StringUtil.hasField(sql, "full_id")) { if (StringUtil.hasField(sql, "full_id")) {
if (null != list && list.size() > 0) { if (null != list && list.size() > 0) {
int length = list.size(); int length = list.size();
Map<String, Object> map = new HashMap<String, Object>(length); Map<String, Object> map = new HashMap<>(length);
sb.append(" and ("); sb.append(" and (");
for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++) {
OrgUnit ou = list.get(i); OrgUnit ou = list.get(i);
......
...@@ -14,7 +14,7 @@ public class GeneralRepository extends GeneralRepositorySuper { ...@@ -14,7 +14,7 @@ public class GeneralRepository extends GeneralRepositorySuper {
private EntityManager em; private EntityManager em;
@Override @Override
protected EntityManager getEntityManager() { public EntityManager getEntityManager() {
return em; return em;
} }
......
...@@ -69,7 +69,7 @@ import org.springframework.util.Assert; ...@@ -69,7 +69,7 @@ import org.springframework.util.Assert;
@Transactional() @Transactional()
abstract public class GeneralRepositorySuper { abstract public class GeneralRepositorySuper {
abstract protected EntityManager getEntityManager(); abstract public EntityManager getEntityManager();
private static final String ID_MUST_NOT_BE_NULL = "ID不能为空。"; private static final String ID_MUST_NOT_BE_NULL = "ID不能为空。";
......
...@@ -13,7 +13,7 @@ public interface PersonQuerySchemeRepository extends JpaRepository<PersonQuerySc ...@@ -13,7 +13,7 @@ public interface PersonQuerySchemeRepository extends JpaRepository<PersonQuerySc
@Query(name = "personQuery.findPersonQuerySchemes", value = "select o from PersonQueryScheme o where personId = :personId and kindId = :kindId order by sequence") @Query(name = "personQuery.findPersonQuerySchemes", value = "select o from PersonQueryScheme o where personId = :personId and kindId = :kindId order by sequence")
List<PersonQueryScheme> findPersonQuerySchemes(@Param("personId") String personId, @Param("kindId") String kindId); List<PersonQueryScheme> findPersonQuerySchemes(@Param("personId") String personId, @Param("kindId") String kindId);
@Query(name = "personQuery.getMaxSequence", value = "select nvl(max(sequence), 0) from PersonQueryScheme o where o.personId = :personId and o.kindId = :kindId") @Query(name = "personQuery.getMaxSequence", value = "select coalesce(max(sequence), 0) from PersonQueryScheme o where o.personId = :personId and o.kindId = :kindId")
Integer getMaxSequence(@Param("personId") String personId, @Param("kindId") String kindId); Integer getMaxSequence(@Param("personId") String personId, @Param("kindId") String kindId);
} }
...@@ -26,7 +26,7 @@ public interface ProcUnitHandlerRepository extends JpaRepository<ProcUnitHandler ...@@ -26,7 +26,7 @@ public interface ProcUnitHandlerRepository extends JpaRepository<ProcUnitHandler
List<ProcUnitHandler> findAllNextProcUnitHandlers(@Param("bizId") String bizId, @Param("groupId") Integer groupId); List<ProcUnitHandler> findAllNextProcUnitHandlers(@Param("bizId") String bizId, @Param("groupId") Integer groupId);
@Query(name = "procUnitHandler.findNextGroupProcUnitHandlers", value = "select t from ProcUnitHandler t where t.bizId = :bizId\n" @Query(name = "procUnitHandler.findNextGroupProcUnitHandlers", value = "select t from ProcUnitHandler t where t.bizId = :bizId\n"
+ " and t.procUnitId = :procUnitId\n" + " and status = 0\n" + " and nvl(result, 0) != 4\n" + " and cooperationModelId != 'cc'\n" + " and t.procUnitId = :procUnitId\n" + " and status = 0\n" + " and coalesce(result, 0) != 4\n" + " and cooperationModelId != 'cc'\n"
+ " and groupId = (select min(o.groupId)\n" + " from ProcUnitHandler o\n" + " where o.bizId = :bizId\n" + " and groupId = (select min(o.groupId)\n" + " from ProcUnitHandler o\n" + " where o.bizId = :bizId\n"
+ " and cooperationModelId != 'cc'\n" + " and o.procUnitId = :procUnitId\n" + " and cooperationModelId != 'cc'\n" + " and o.procUnitId = :procUnitId\n"
+ " and o.status = 0\n" + " and o.groupId > :groupId)") + " and o.status = 0\n" + " and o.groupId > :groupId)")
...@@ -82,16 +82,16 @@ public interface ProcUnitHandlerRepository extends JpaRepository<ProcUnitHandler ...@@ -82,16 +82,16 @@ public interface ProcUnitHandlerRepository extends JpaRepository<ProcUnitHandler
@Query(name = "procUnitHandler.getMaxGrouId", value = "select max(groupId) from ProcUnitHandler o where o.bizId = :bizId and o.procUnitId = :procUnitId and cooperationModelId = 'chief'") @Query(name = "procUnitHandler.getMaxGrouId", value = "select max(groupId) from ProcUnitHandler o where o.bizId = :bizId and o.procUnitId = :procUnitId and cooperationModelId = 'chief'")
Integer getMaxGrouId(@Param("bizId") String bizId, @Param("procUnitId") String procUnitId); Integer getMaxGrouId(@Param("bizId") String bizId, @Param("procUnitId") String procUnitId);
@Query(name = "procUnitHandler.getExecutionTimes", value = "select nvl(max(executionTimes), 0) from ProcUnitHandler o where o.bizId = :bizId and o.procUnitId = :procUnitId and cooperationModelId = 'chief'") @Query(name = "procUnitHandler.getExecutionTimes", value = "select coalesce(max(executionTimes), 0) from ProcUnitHandler o where o.bizId = :bizId and o.procUnitId = :procUnitId and cooperationModelId = 'chief'")
Integer getExecutionTimes(@Param("bizId") String bizId, @Param("procUnitId") String procUnitId); Integer getExecutionTimes(@Param("bizId") String bizId, @Param("procUnitId") String procUnitId);
@Query(name = "procUnitHandler.getMaxSequence", value = "select nvl(max(sequence), 0) from ProcUnitHandler o where o.bizId = :bizId and o.procUnitId = :procUnitId and cooperationModelId = 'chief'") @Query(name = "procUnitHandler.getMaxSequence", value = "select coalesce(max(sequence), 0) from ProcUnitHandler o where o.bizId = :bizId and o.procUnitId = :procUnitId and cooperationModelId = 'chief'")
Integer getMaxSequence(@Param("bizId") String bizId, @Param("procUnitId") String procUnitId); Integer getMaxSequence(@Param("bizId") String bizId, @Param("procUnitId") String procUnitId);
/** /**
* 删除回收后继处理人 * 删除回收后继处理人
*/ */
@Modifying @Modifying
@Query(name = "procUnitHandler.deleteWithdrawSucceedingHandlers", nativeQuery = true, value = "delete from wf_procunithandler t where t.id in (select i.proc_unit_handler_id_ from act_hi_taskinst_extension i where i.business_key_ = :bizId and i.previous_id_ = :taskId)") @Query(name = "procUnitHandler.deleteWithdrawSucceedingHandlers", value = "delete from ProcUnitHandler t where t.id in (select i.procUnitHandlerId from HistoricTaskInstExtension i where i.businessKey = :bizId and i.previousId = :taskId)")
void deleteWithdrawSucceedingHandlers(@Param("bizId") String bizId, @Param("taskId") String taskId); void deleteWithdrawSucceedingHandlers(@Param("bizId") String bizId, @Param("taskId") String taskId);
} }
...@@ -6,12 +6,18 @@ import java.util.HashSet; ...@@ -6,12 +6,18 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors;
import com.huigou.util.ClassHelper;
import com.huigou.util.Constants;
import org.activiti.engine.RepositoryService; import org.activiti.engine.RepositoryService;
import org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity; import org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity;
import org.activiti.engine.impl.pvm.process.ActivityImpl; import org.activiti.engine.impl.pvm.process.ActivityImpl;
import org.activiti.engine.repository.ProcessDefinition; import org.activiti.engine.repository.ProcessDefinition;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert; import org.springframework.util.Assert;
...@@ -33,6 +39,8 @@ import com.huigou.uasp.bpm.managment.application.ProcDefinitionApplication; ...@@ -33,6 +39,8 @@ import com.huigou.uasp.bpm.managment.application.ProcDefinitionApplication;
import com.huigou.uasp.bpm.managment.domain.model.ProcDefinition; import com.huigou.uasp.bpm.managment.domain.model.ProcDefinition;
import com.huigou.uasp.bpm.managment.repository.ProcDefinitionRespository; import com.huigou.uasp.bpm.managment.repository.ProcDefinitionRespository;
import javax.persistence.criteria.Predicate;
@Service("procDefinitionApplication") @Service("procDefinitionApplication")
public class ProcDefinitionApplicationImpl extends BaseApplication implements ProcDefinitionApplication { public class ProcDefinitionApplicationImpl extends BaseApplication implements ProcDefinitionApplication {
...@@ -58,7 +66,7 @@ public class ProcDefinitionApplicationImpl extends BaseApplication implements Pr ...@@ -58,7 +66,7 @@ public class ProcDefinitionApplicationImpl extends BaseApplication implements Pr
Assert.notNull(procDefinition, MessageSourceContext.getMessage(MessageConstants.PARAMETER_NOT_NULL_FORMAT, "procDefinition")); Assert.notNull(procDefinition, MessageSourceContext.getMessage(MessageConstants.PARAMETER_NOT_NULL_FORMAT, "procDefinition"));
ProcDefinition dbProcDefinition = this.loadProcDefinition(procDefinition.getId()); ProcDefinition dbProcDefinition = this.loadProcDefinition(procDefinition.getId());
Assert.notNull(dbProcDefinition, Assert.notNull(dbProcDefinition,
MessageSourceContext.getMessage(MessageConstants.OBJECT_NOT_FOUND_BY_ID, procDefinition.getId(), procDefinition.getClass().getName())); MessageSourceContext.getMessage(MessageConstants.OBJECT_NOT_FOUND_BY_ID, procDefinition.getId(), procDefinition.getClass().getName()));
String oldName = dbProcDefinition.getName(); String oldName = dbProcDefinition.getName();
dbProcDefinition.fromEntity(procDefinition); dbProcDefinition.fromEntity(procDefinition);
...@@ -109,7 +117,7 @@ public class ProcDefinitionApplicationImpl extends BaseApplication implements Pr ...@@ -109,7 +117,7 @@ public class ProcDefinitionApplicationImpl extends BaseApplication implements Pr
QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery(QUERY_XML_FILE_PATH, "procDefinition"); QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery(QUERY_XML_FILE_PATH, "procDefinition");
QueryModel queryModel = this.sqlExecutorDao.getQueryModel(queryDescriptor, queryRequest); QueryModel queryModel = this.sqlExecutorDao.getQueryModel(queryDescriptor, queryRequest);
if (!includeProcUnit) { if (!includeProcUnit) {
queryModel.addCriteria(" and nvl(node_kind_id, 'folder') in (:nodeKindId1, :nodeKindId2)"); queryModel.addCriteria(" and ((case when node_kind_id is null then 'folder' else node_kind_id end) in (:nodeKindId1, :nodeKindId2))");
queryModel.putParam("nodeKindId1", "folder"); queryModel.putParam("nodeKindId1", "folder");
queryModel.putParam("nodeKindId2", "proc"); queryModel.putParam("nodeKindId2", "proc");
} }
...@@ -117,6 +125,46 @@ public class ProcDefinitionApplicationImpl extends BaseApplication implements Pr ...@@ -117,6 +125,46 @@ public class ProcDefinitionApplicationImpl extends BaseApplication implements Pr
return this.sqlExecutorDao.executeQuery(queryModel); return this.sqlExecutorDao.executeQuery(queryModel);
} }
@Override
public Map<String, Object> findProcDefinitions(boolean includeProcUnit, ParentAndCodeAndNameQueryRequest queryRequest) {
Specification<ProcDefinition> spec = (root, query, cb) -> {
ArrayList<Predicate> predicates = new ArrayList<>(10);
if (queryRequest.getParentId() != null) {
predicates.add(cb.equal(root.get("parentId"), queryRequest.getParentId()));
}
if (queryRequest.getCode() != null) {
predicates.add(cb.like(root.get("code"), String.join("", "%", queryRequest.getCode(), "%")));
}
if (queryRequest.getName() != null) {
predicates.add(cb.like(root.get("name"), String.join("", "%", queryRequest.getCode(), "%")));
}
if (!includeProcUnit) {
predicates.add(cb.coalesce(root.get("nodeKindId"), "folder").in("folder", "proc"));
}
return cb.and(predicates.toArray(new Predicate[predicates.size()]));
};
PageRequest pageRequest = null;
if (queryRequest.getPageModel() != null) {
pageRequest = new PageRequest(queryRequest.getPageModel().getPageIndex() - 1, queryRequest.getPageModel().getPageSize());
}
Page<ProcDefinition> page = procDefinitionRespository.findAll(spec, pageRequest);
List<Map<String, Object>> rows = page.getContent()
.stream()
.map(def -> {
Map<String, Object> map = ClassHelper.beanToMap(def);
map.put("hasChildren", procDefinitionRespository.countByParentId(def.getId()));
map.put("mergeHandlerKindTextView", MergeHandlerKind.fromId(def.getMergeHandlerKind()).getDisplayName());
return map;
})
.collect(Collectors.toList());
Map<String, Object> result = new HashMap<>(3);
result.put(Constants.ROWS, rows);
result.put("Total", page.getTotalElements());
result.put("page", page.getNumber() + 1);
return result;
}
@Override @Override
public Map<String, Object> slicedQueryProcDefinitions(ParentIdQueryRequest queryRequest) { public Map<String, Object> slicedQueryProcDefinitions(ParentIdQueryRequest queryRequest) {
QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery(QUERY_XML_FILE_PATH, "procDefinition"); QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery(QUERY_XML_FILE_PATH, "procDefinition");
...@@ -152,7 +200,7 @@ public class ProcDefinitionApplicationImpl extends BaseApplication implements Pr ...@@ -152,7 +200,7 @@ public class ProcDefinitionApplicationImpl extends BaseApplication implements Pr
Assert.notNull(parent, MessageSourceContext.getMessage(MessageConstants.OBJECT_NOT_FOUND_BY_ID, parentId, "流程定义")); Assert.notNull(parent, MessageSourceContext.getMessage(MessageConstants.OBJECT_NOT_FOUND_BY_ID, parentId, "流程定义"));
ProcessDefinition lastVersionProcessDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionKey(parent.getProcId()) ProcessDefinition lastVersionProcessDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionKey(parent.getProcId())
.latestVersion().singleResult(); .latestVersion().singleResult();
Assert.notNull(lastVersionProcessDefinition, MessageSourceContext.getMessage(MessageConstants.OBJECT_NOT_FOUND_BY_ID, parent.getProcId(), "流程模板")); Assert.notNull(lastVersionProcessDefinition, MessageSourceContext.getMessage(MessageConstants.OBJECT_NOT_FOUND_BY_ID, parent.getProcId(), "流程模板"));
List<ProcUnit> userTaskActivities = this.workflowService.getUserTaskActivitiesByProcessDefinitionId(lastVersionProcessDefinition.getId()); List<ProcUnit> userTaskActivities = this.workflowService.getUserTaskActivitiesByProcessDefinitionId(lastVersionProcessDefinition.getId());
......
...@@ -53,15 +53,17 @@ public class DBLogApplicationImpl implements LogApplication { ...@@ -53,15 +53,17 @@ public class DBLogApplicationImpl implements LogApplication {
public void savelog(BizLog bizLog, BizLogDetail bizLogDetail) { public void savelog(BizLog bizLog, BizLogDetail bizLogDetail) {
Assert.notNull(bizLog, "参数bizlog不能为空。"); Assert.notNull(bizLog, "参数bizlog不能为空。");
Assert.notNull(bizLogDetail, "参数bizlogDetail不能为空。"); Assert.notNull(bizLogDetail, "参数bizlogDetail不能为空。");
bizLog = this.dbBizLogRepository.save((DBBizLog) bizLog); // TODO 保存日志
bizLogDetail.setBizLogId(bizLog.getId()); // bizLog = this.dbBizLogRepository.save((DBBizLog) bizLog);
this.dbBizLogDetailRepository.save((DBBizLogDetail) bizLogDetail); // bizLogDetail.setBizLogId(bizLog.getId());
// this.dbBizLogDetailRepository.save((DBBizLogDetail) bizLogDetail);
} }
@Override @Override
public void savelog(BizLog bizLog) { public void savelog(BizLog bizLog) {
Assert.notNull(bizLog, "参数bizlog不能为空。"); Assert.notNull(bizLog, "参数bizlog不能为空。");
bizLog = this.dbBizLogRepository.save((DBBizLog) bizLog); // TODO 保存日志
// bizLog = this.dbBizLogRepository.save((DBBizLog) bizLog);
} }
@Override @Override
......
...@@ -238,7 +238,9 @@ public class MessageRemindApplicationImpl extends BaseApplication implements Mes ...@@ -238,7 +238,9 @@ public class MessageRemindApplicationImpl extends BaseApplication implements Mes
List<Object> list = new java.util.ArrayList<Object>(); List<Object> list = new java.util.ArrayList<Object>();
QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery("config/uasp/query/bmp/messageRemind.xml", "messageRemind"); QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery("config/uasp/query/bmp/messageRemind.xml", "messageRemind");
String sql = queryDescriptor.getSqlByName("queryRemindByPersonId"); String sql = queryDescriptor.getSqlByName("queryRemindByPersonId");
List<MessageRemind> reminds = this.sqlExecutorDao.queryToList(sql, MessageRemind.class, personId); Map<String, Object> params = new HashMap<>(1);
params.put("personId", personId);
List<MessageRemind> reminds = this.sqlExecutorDao.queryToListByMapParam(sql, MessageRemind.class, params);
for (MessageRemind messageRemind : reminds) { for (MessageRemind messageRemind : reminds) {
Object obj = parseRemindFun(messageRemind); Object obj = parseRemindFun(messageRemind);
if (obj != null) { if (obj != null) {
......
...@@ -150,20 +150,18 @@ ...@@ -150,20 +150,18 @@
te.start_time_ start_time, te.end_time_ end_time, te.start_time_ start_time, te.end_time_ end_time,
round(te.duration_ / (60 * 60 * 1000), 2) duration, round(te.duration_ / (60 * 60 * 1000), 2) duration,
te.status_id_ status_id, te.status_name_ status_name, te.status_id_ status_id, te.status_name_ status_name,
te.executor_ogn_name_ || '.' || executor_dept_name_ || '.' || concat(te.executor_ogn_name_,concat('.',concat(executor_dept_name_,concat('.',te.executor_person_member_name_)))) executor_full_name,
te.executor_person_member_name_ executor_full_name,
te.proc_unit_handler_id_, uh.approval_rule_handler_id, te.proc_unit_handler_id_, uh.approval_rule_handler_id,
uh.approval_rule_id, uh.group_id uh.approval_rule_id, uh.group_id
from act_hi_taskinst_extension te, from act_hi_taskinst_extension te
wf_procunithandler uh left join wf_procunithandler uh on te.proc_unit_handler_id_ = uh.id
where te.proc_inst_id_ = :procInstId where te.proc_inst_id_ = :procInstId
and te.proc_unit_handler_id_ = uh.id(+)
order by te.id_ order by te.id_
</sql> </sql>
<sql name="queryBackTasksByBizCode"> <sql name="queryBackTasksByBizCode">
select te.id_ id, te.task_def_key_ task_def_key, te.name_ name, p.sub_proc_unit_name, select te.id_ id, te.task_def_key_ task_def_key, te.name_ name, p.sub_proc_unit_name,
te.executor_dept_name_ || '.' || te.executor_person_member_name_ executor_full_name, concat(te.executor_dept_name_,concat('.',te.executor_person_member_name_)) executor_full_name,
te.status_name_ status_name, nvl(p.group_id, 0) group_id, pd.sequence process_definition_group_id, te.status_name_ status_name, (case when p.group_id is null then 0 else p.group_id end) group_id, pd.sequence process_definition_group_id,
te.proc_unit_handler_id_ proc_unit_handler_id te.proc_unit_handler_id_ proc_unit_handler_id
from act_hi_taskinst_extension te from act_hi_taskinst_extension te
left join wf_procdef pd left join wf_procdef pd
...@@ -176,7 +174,7 @@ ...@@ -176,7 +174,7 @@
where te.business_code_ = ? where te.business_code_ = ?
and te.status_id_ in ('completed') and te.status_id_ in ('completed')
and te.kind_id_ in ('task') and te.kind_id_ in ('task')
and nvl(te.cooperation_model_id_, 'chief') = 'chief' and (case when te.cooperation_model_id_ is null then 'chief' else te.cooperation_model_id_ end)='chief'
order by te.version_ order by te.version_
</sql> </sql>
<sql name="queryApplicantByProcInstId"> <sql name="queryApplicantByProcInstId">
......
...@@ -124,8 +124,8 @@ ...@@ -124,8 +124,8 @@
o.full_Org_Kind_Id, p.main_Org_Id, o.is_Virtual, o.sequence, o.full_Org_Kind_Id, p.main_Org_Id, o.is_Virtual, o.sequence,
(select pos.name from SA_OPOrg pos where pos.id = p.main_org_id) main_org_name, (select pos.name from SA_OPOrg pos where pos.id = p.main_org_id) main_org_name,
o.version o.version
from SA_OPOrg o, SA_OPPerson p from SA_OPOrg o left join SA_OPPerson p on o.person_id = p.id
where o.person_id = p.id(+) where 1=1
</sql> </sql>
<sql name="queryOrgExcludePos"> <sql name="queryOrgExcludePos">
select o.id, o.type_id, o.code, o.name, o.long_Name, o.parent_Id, o.full_Id, select o.id, o.type_id, o.code, o.name, o.long_Name, o.parent_Id, o.full_Id,
...@@ -135,14 +135,13 @@ ...@@ -135,14 +135,13 @@
o.status, o.full_Sequence, p.sex, p.certificate_no, p.status as personStatus, o.status, o.full_Sequence, p.sex, p.certificate_no, p.status as personStatus,
o.full_Org_Kind_Id, p.main_Org_Id, o.is_Virtual, o.sequence, o.full_Org_Kind_Id, p.main_Org_Id, o.is_Virtual, o.sequence,
o.version o.version
from V_SA_OPOrg_Exclude_Pos o, SA_OPPerson p from V_SA_OPOrg_Exclude_Pos o left join SA_OPPerson on p o.person_id = p.id
where o.person_id = p.id(+) where 1=1
</sql> </sql>
<sql name="queryCount"> <sql name="queryCount">
select count(o.id) select count(o.id)
from SA_OPOrg o, SA_OPPerson p from SA_OPOrg o left join SA_OPPerson p on o.person_id = p.id
where o.person_id = p.id(+) where o.parent_id = :parentId
and o.parent_id = :parentId
</sql> </sql>
<sql name="deleteOrgChildren"> <sql name="deleteOrgChildren">
delete from SA_OPOrg where full_id like ? delete from SA_OPOrg where full_id like ?
...@@ -793,8 +792,8 @@ ...@@ -793,8 +792,8 @@
<query name="baseManagementType" label="基础管理权限类别"> <query name="baseManagementType" label="基础管理权限类别">
<sql-query> <sql-query>
select a.*, b.name as biz_Management_Type_Name,b.code as biz_Management_Type_code select a.*, b.name as biz_Management_Type_Name,b.code as biz_Management_Type_code
from SA_OPBaseManagementType a, SA_OPBizManagementType b from SA_OPBaseManagementType a left join SA_OPBizManagementType b on a.biz_management_type_id = b.id
where a.biz_management_type_id = b.id(+) where 1=1
</sql-query> </sql-query>
<condition column="folder_id" name="folderId" symbol="=" alias="a"/> <condition column="folder_id" name="folderId" symbol="=" alias="a"/>
<condition column="code" name="code" symbol="like" alias="a"/> <condition column="code" name="code" symbol="like" alias="a"/>
......
...@@ -126,8 +126,8 @@ ...@@ -126,8 +126,8 @@
o.status, o.full_Sequence, p.sex, p.certificate_no, p.status as personStatus, o.status, o.full_Sequence, p.sex, p.certificate_no, p.status as personStatus,
o.full_Org_Kind_Id, p.main_Org_Id, o.is_Virtual, o.sequence, o.full_Org_Kind_Id, p.main_Org_Id, o.is_Virtual, o.sequence,
o.version o.version
from SA_OPOrg o, SA_OPPerson p from SA_OPOrg o left join SA_OPPerson p on o.person_id = p.id
where o.person_id = p.id(+) where 1=1
</sql> </sql>
<sql name="queryOrgExcludePos"> <sql name="queryOrgExcludePos">
select o.id, o.type_id, o.code, o.name, o.long_Name, o.parent_Id, o.full_Id, select o.id, o.type_id, o.code, o.name, o.long_Name, o.parent_Id, o.full_Id,
...@@ -137,14 +137,13 @@ ...@@ -137,14 +137,13 @@
o.status, o.full_Sequence, p.sex, p.certificate_no, p.status as personStatus, o.status, o.full_Sequence, p.sex, p.certificate_no, p.status as personStatus,
o.full_Org_Kind_Id, p.main_Org_Id, o.is_Virtual, o.sequence, o.full_Org_Kind_Id, p.main_Org_Id, o.is_Virtual, o.sequence,
o.version o.version
from V_SA_OPOrg_Exclude_Pos o, SA_OPPerson p from V_SA_OPOrg_Exclude_Pos o left join SA_OPPerson p on o.person_id = p.id
where o.person_id = p.id(+) where 1=1
</sql> </sql>
<sql name="queryCount"> <sql name="queryCount">
select count(o.id) select count(o.id)
from SA_OPOrg o, SA_OPPerson p from SA_OPOrg o left join SA_OPPerson p on o.person_id = p.id
where o.person_id = p.id(+) where o.parent_id = :parentId
and o.parent_id = :parentId
</sql> </sql>
</query> </query>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
t.APPLICANT_DEPT_NAME_ as dept_name t.APPLICANT_DEPT_NAME_ as dept_name
from act_hi_procinst p, act_hi_procinst_extension t, wf_procdef c from act_hi_procinst p, act_hi_procinst_extension t, wf_procdef c
where p.id_ = t.proc_inst_id_ where p.id_ = t.proc_inst_id_
and p.proc_def_id_ like c.proc_id || ':%' and p.proc_def_id_ like concat(c.proc_id,':%')
and c.node_kind_id = 'proc' and c.node_kind_id = 'proc'
and t.status_id_ = 'executing' and t.status_id_ = 'executing'
and not exists and not exists
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
t.APPLICANT_DEPT_NAME_ as dept_Name t.APPLICANT_DEPT_NAME_ as dept_Name
from act_hi_procinst p, act_hi_procinst_extension t, wf_procdef c from act_hi_procinst p, act_hi_procinst_extension t, wf_procdef c
where p.id_ = t.proc_inst_id_ where p.id_ = t.proc_inst_id_
and p.proc_def_id_ like c.proc_id || ':%' and p.proc_def_id_ like concat(c.proc_id,':%')
and c.node_kind_id = 'proc' and c.node_kind_id = 'proc'
and t.status_id_ = 'completed' and t.status_id_ = 'completed'
and not exists and not exists
......
...@@ -449,6 +449,11 @@ ...@@ -449,6 +449,11 @@
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-java</artifactId>
<version>8.0.17</version> <version>8.0.17</version>
</dependency> </dependency>
<dependency>
<groupId>com.huigou</groupId>
<artifactId>huigou-demo</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
<finalName>huigou-xt</finalName> <finalName>huigou-xt</finalName>
......
...@@ -21,6 +21,11 @@ ...@@ -21,6 +21,11 @@
<property name="sqlQuery" ref="sqlQuery" /> <property name="sqlQuery" ref="sqlQuery" />
<property name="queryXmlManager" ref="queryXmlManager" /> <property name="queryXmlManager" ref="queryXmlManager" />
</bean> </bean>
<bean id="mapperScannerConfigurer" class="com.topsunit.query.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.huigou.**.mapper"/>
<property name="sqlExecutorBeanName" value="sqlExecutorDao" />
</bean>
<bean id="generalRepository" class="com.huigou.data.repository.GeneralRepository"> <bean id="generalRepository" class="com.huigou.data.repository.GeneralRepository">
</bean> </bean>
......
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