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

多数据库支持

parent 265886b4
......@@ -189,7 +189,7 @@ public class OrgQueryModel extends QueryModel {
}
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);
}
......@@ -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);
if (status != null) {
statuses.add(status);
......
......@@ -16,30 +16,51 @@ public interface TMAuthorizeRepository extends JpaRepository<TMAuthorize, String
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")
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")
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);
/**
* 查找三员授权
*
* @param managerId
* 管理者ID
* @param subordinationId
* 下属ID
* @param systemId
* 系统ID
* @param managerId 管理者ID
* @param subordinationId 下属ID
* @param systemId 系统ID
* @return 三员授权实体
* @deprecated 该方法只支持Oracle数据库查询,请使用 {@link #findFirstByManagerIdAndSubordinationIdAndSystemId(String, String, String)} 替代。
*/
@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")
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
......@@ -21,8 +21,7 @@ public interface ProcDefinitionApplication {
/**
* 保存流程定义
*
* @param procDefinition
* 流程定义
* @param procDefinition 流程定义
* @return
*/
String insertProcDefinition(ProcDefinition procDefinition);
......@@ -30,16 +29,14 @@ public interface ProcDefinitionApplication {
/**
* 修改流程定义
*
* @param procDefinition
* 流程定义
* @param procDefinition 流程定义
*/
void updateProcDefinition(ProcDefinition procDefinition);
/**
* 加载流程定义
*
* @param id
* 流程定义ID
* @param id 流程定义ID
* @return
*/
ProcDefinition loadProcDefinition(String id);
......@@ -47,8 +44,7 @@ public interface ProcDefinitionApplication {
/**
* 通过流程ID加载流程定义
*
* @param procId
* 流程定义ID
* @param procId 流程定义ID
* @return
*/
ProcDefinition loadProcDefinitionByProcId(String procId);
......@@ -56,10 +52,8 @@ public interface ProcDefinitionApplication {
/**
* 加载流程定义
*
* @param procId
* 流程定义ID
* @param procUnitId
* 流程环节ID
* @param procId 流程定义ID
* @param procUnitId 流程环节ID
* @return
*/
ProcDefinition loadProcDefinitionByProcAndProcUnitId(String procId, String procUnitId);
......@@ -67,39 +61,34 @@ public interface ProcDefinitionApplication {
/**
* 删除流程定义
*
* @param ids
* 流程定义ID列表
* @param ids 流程定义ID列表
*/
void deleteProcDefinitions(List<String> ids);
/**
* 查询流程定义
*
* @param parentId
* 父ID
* @param code
* 编码
* @param name
* 名称
* @param includeProcUnit
* 包括流程环节
* @param pageable
* 分页信息
* @return
* @param parentId 父ID
* @param code 编码
* @param name 名称
* @param includeProcUnit 包括流程环节
* @param pageable 分页信息
* @deprecated 请使用 {@link #findProcDefinitions(boolean, ParentAndCodeAndNameQueryRequest)} 替代。
*/
@Deprecated
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);
/**
* 得到下一个排序号
*
......@@ -126,18 +115,15 @@ public interface ProcDefinitionApplication {
/**
* 绑定Activiti流程定义
*
* @param id
* 流程定义ID
* @param procId
* Activiti流程ID
* @param id 流程定义ID
* @param procId Activiti流程ID
*/
void bindActivitiProcDefinition(String id, String procId);
/**
* 导入流程环节
*
* @param parentId
* 父ID
* @param parentId 父ID
*/
void importProcUnits(String parentId);
......@@ -159,8 +145,7 @@ public interface ProcDefinitionApplication {
* 查询流程环节,用于排序
*/
/**
* @param processDefinitionKey
* 流程定义Key
* @param processDefinitionKey 流程定义Key
* @return
*/
List<ProcDefinition> queryProcUnitsForSequence(String processDefinitionKey);
......
......@@ -3,12 +3,13 @@ package com.huigou.uasp.bpm.managment.repository;
import java.util.List;
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.repository.query.Param;
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);
long countByParentId(String parentId);
......
......@@ -90,7 +90,7 @@ public class TMAuthorizeApplicationImpl extends BaseApplication implements TMAut
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())) {
org = this.orgApplication.loadOrg(authorize.getManagerId());
ApplicationSystem applicationSystem = applicationSystemApplication.loadApplicationSystem(authorize.getSystemId());
......@@ -117,7 +117,7 @@ public class TMAuthorizeApplicationImpl extends BaseApplication implements TMAut
throw new ApplicationException(message);
}
authorize = this.tmAuthorizeRepository.findByManagerIdNotRole(item.getManagerId(), item.getRoleKindId());
authorize = this.tmAuthorizeRepository.findFirstByManagerIdAndRoleKindIdNot(item.getManagerId(), item.getRoleKindId());
if (authorize != null) {
Org personOrg = this.orgApplication.loadOrg(authorize.getManagerId());
roleName = RoleKind.fromId(authorize.getRoleKindId()).getDisplayName();
......@@ -178,7 +178,7 @@ public class TMAuthorizeApplicationImpl extends BaseApplication implements TMAut
// throw new ApplicationException("您没有权限操作此功能。");
} 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()) {
OrgQueryModel orgQueryModel = new OrgQueryModel(sdo);
......
......@@ -280,7 +280,7 @@ public enum Dialect {
* @return String
*/
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;
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.repository.GeneralRepositorySuper;
import com.huigou.domain.IdentifiedEntity;
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
public class VersionListener {
......@@ -19,6 +21,9 @@ public class VersionListener {
private SQLQuery sqlQuery;
private Long getNextId() {
GeneralRepositorySuper generalRepository = ApplicationContextWrapper.getBean("generalRepository", GeneralRepositorySuper.class);
EntityManager em = generalRepository.getEntityManager();
Metamodel metamodel = em.getMetamodel();
if (!inited) {
sqlQuery = ApplicationContextWrapper.getBean("sqlQuery", SQLQuery.class);
inited = true;
......@@ -29,12 +34,12 @@ public class VersionListener {
@PrePersist
public void beforeCreate(IdentifiedEntity target) {
target.setVersion(getNextId());
// target.setVersion(getNextId());
}
@PreUpdate
public void beforeUpdate(IdentifiedEntity target) {
target.setVersion(getNextId());
// target.setVersion(getNextId());
}
}
......@@ -7,11 +7,7 @@ import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.Transient;
import javax.persistence.*;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.NotImplementedException;
......@@ -32,7 +28,7 @@ import com.huigou.util.StringUtil;
* @author gongmm
*/
@MappedSuperclass
@EntityListeners({ VersionListener.class })
@EntityListeners({VersionListener.class})
public abstract class AbstractEntity implements IdentifiedEntity, Serializable {
private static final long serialVersionUID = 352956443971788977L;
......@@ -50,6 +46,7 @@ public abstract class AbstractEntity implements IdentifiedEntity, Serializable {
/**
* 实体版本号
*/
@GeneratedValue(strategy = GenerationType.TABLE)
private Long version;
@Transient
......@@ -116,13 +113,12 @@ public abstract class AbstractEntity implements IdentifiedEntity, Serializable {
/**
* 删除明细
*
* @param ids
* 明细ID
* @param ids 明细ID
*/
public void removeDetails(List<String> ids) {
Assert.notEmpty(ids, "参数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())) {
iter.remove();
}
......@@ -131,7 +127,7 @@ public abstract class AbstractEntity implements IdentifiedEntity, Serializable {
}
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())) {
iter.remove();
}
......
......@@ -163,7 +163,7 @@ public class SQLQueryImpl implements SQLQuery {
if (!StringUtil.isBlank(queryModel.getManageType())) {
sb.append(sql);
} else {
sb.append("select * from (").append(sql).append(") __t__");
sb.append("select * from (").append(sql).append(") t_");
sb.append(" where 1=1 ");
}
sb.append(queryModel.parseSortFields());
......
......@@ -194,13 +194,13 @@ public class QueryPermissionBuilderImpl implements QueryPermissionBuilder {
return sqlModel;
}
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 ");
List<OrgUnit> list = findSubordinations(operator.getUserId(), operator.getPersonMemberFullIds(), manageType);
if (StringUtil.hasField(sql, "full_id")) {
if (null != list && list.size() > 0) {
int length = list.size();
Map<String, Object> map = new HashMap<String, Object>(length);
Map<String, Object> map = new HashMap<>(length);
sb.append(" and (");
for (int i = 0; i < length; i++) {
OrgUnit ou = list.get(i);
......
......@@ -14,7 +14,7 @@ public class GeneralRepository extends GeneralRepositorySuper {
private EntityManager em;
@Override
protected EntityManager getEntityManager() {
public EntityManager getEntityManager() {
return em;
}
......
......@@ -69,7 +69,7 @@ import org.springframework.util.Assert;
@Transactional()
abstract public class GeneralRepositorySuper {
abstract protected EntityManager getEntityManager();
abstract public EntityManager getEntityManager();
private static final String ID_MUST_NOT_BE_NULL = "ID不能为空。";
......
......@@ -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")
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);
}
......@@ -26,7 +26,7 @@ public interface ProcUnitHandlerRepository extends JpaRepository<ProcUnitHandler
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"
+ " 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 cooperationModelId != 'cc'\n" + " and o.procUnitId = :procUnitId\n"
+ " and o.status = 0\n" + " and o.groupId > :groupId)")
......@@ -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'")
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);
@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);
/**
* 删除回收后继处理人
*/
@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);
}
......@@ -6,12 +6,18 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
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.impl.persistence.entity.ProcessDefinitionEntity;
import org.activiti.engine.impl.pvm.process.ActivityImpl;
import org.activiti.engine.repository.ProcessDefinition;
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.transaction.annotation.Transactional;
import org.springframework.util.Assert;
......@@ -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.repository.ProcDefinitionRespository;
import javax.persistence.criteria.Predicate;
@Service("procDefinitionApplication")
public class ProcDefinitionApplicationImpl extends BaseApplication implements ProcDefinitionApplication {
......@@ -109,7 +117,7 @@ public class ProcDefinitionApplicationImpl extends BaseApplication implements Pr
QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery(QUERY_XML_FILE_PATH, "procDefinition");
QueryModel queryModel = this.sqlExecutorDao.getQueryModel(queryDescriptor, queryRequest);
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("nodeKindId2", "proc");
}
......@@ -117,6 +125,46 @@ public class ProcDefinitionApplicationImpl extends BaseApplication implements Pr
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
public Map<String, Object> slicedQueryProcDefinitions(ParentIdQueryRequest queryRequest) {
QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery(QUERY_XML_FILE_PATH, "procDefinition");
......
......@@ -53,15 +53,17 @@ public class DBLogApplicationImpl implements LogApplication {
public void savelog(BizLog bizLog, BizLogDetail bizLogDetail) {
Assert.notNull(bizLog, "参数bizlog不能为空。");
Assert.notNull(bizLogDetail, "参数bizlogDetail不能为空。");
bizLog = this.dbBizLogRepository.save((DBBizLog) bizLog);
bizLogDetail.setBizLogId(bizLog.getId());
this.dbBizLogDetailRepository.save((DBBizLogDetail) bizLogDetail);
// TODO 保存日志
// bizLog = this.dbBizLogRepository.save((DBBizLog) bizLog);
// bizLogDetail.setBizLogId(bizLog.getId());
// this.dbBizLogDetailRepository.save((DBBizLogDetail) bizLogDetail);
}
@Override
public void savelog(BizLog bizLog) {
Assert.notNull(bizLog, "参数bizlog不能为空。");
bizLog = this.dbBizLogRepository.save((DBBizLog) bizLog);
// TODO 保存日志
// bizLog = this.dbBizLogRepository.save((DBBizLog) bizLog);
}
@Override
......
......@@ -238,7 +238,9 @@ public class MessageRemindApplicationImpl extends BaseApplication implements Mes
List<Object> list = new java.util.ArrayList<Object>();
QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery("config/uasp/query/bmp/messageRemind.xml", "messageRemind");
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) {
Object obj = parseRemindFun(messageRemind);
if (obj != null) {
......
......@@ -150,20 +150,18 @@
te.start_time_ start_time, te.end_time_ end_time,
round(te.duration_ / (60 * 60 * 1000), 2) duration,
te.status_id_ status_id, te.status_name_ status_name,
te.executor_ogn_name_ || '.' || executor_dept_name_ || '.' ||
te.executor_person_member_name_ executor_full_name,
concat(te.executor_ogn_name_,concat('.',concat(executor_dept_name_,concat('.',te.executor_person_member_name_)))) executor_full_name,
te.proc_unit_handler_id_, uh.approval_rule_handler_id,
uh.approval_rule_id, uh.group_id
from act_hi_taskinst_extension te,
wf_procunithandler uh
from act_hi_taskinst_extension te
left join wf_procunithandler uh on te.proc_unit_handler_id_ = uh.id
where te.proc_inst_id_ = :procInstId
and te.proc_unit_handler_id_ = uh.id(+)
order by te.id_
</sql>
<sql name="queryBackTasksByBizCode">
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,
te.status_name_ status_name, nvl(p.group_id, 0) group_id, pd.sequence process_definition_group_id,
concat(te.executor_dept_name_,concat('.',te.executor_person_member_name_)) executor_full_name,
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
from act_hi_taskinst_extension te
left join wf_procdef pd
......@@ -176,7 +174,7 @@
where te.business_code_ = ?
and te.status_id_ in ('completed')
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_
</sql>
<sql name="queryApplicantByProcInstId">
......
......@@ -124,8 +124,8 @@
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,
o.version
from SA_OPOrg o, SA_OPPerson p
where o.person_id = p.id(+)
from SA_OPOrg o left join SA_OPPerson p on o.person_id = p.id
where 1=1
</sql>
<sql name="queryOrgExcludePos">
select o.id, o.type_id, o.code, o.name, o.long_Name, o.parent_Id, o.full_Id,
......@@ -135,14 +135,13 @@
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.version
from V_SA_OPOrg_Exclude_Pos o, SA_OPPerson p
where o.person_id = p.id(+)
from V_SA_OPOrg_Exclude_Pos o left join SA_OPPerson on p o.person_id = p.id
where 1=1
</sql>
<sql name="queryCount">
select count(o.id)
from SA_OPOrg o, SA_OPPerson p
where o.person_id = p.id(+)
and o.parent_id = :parentId
from SA_OPOrg o left join SA_OPPerson p on o.person_id = p.id
where o.parent_id = :parentId
</sql>
<sql name="deleteOrgChildren">
delete from SA_OPOrg where full_id like ?
......@@ -793,8 +792,8 @@
<query name="baseManagementType" label="基础管理权限类别">
<sql-query>
select a.*, b.name as biz_Management_Type_Name,b.code as biz_Management_Type_code
from SA_OPBaseManagementType a, SA_OPBizManagementType b
where a.biz_management_type_id = b.id(+)
from SA_OPBaseManagementType a left join SA_OPBizManagementType b on a.biz_management_type_id = b.id
where 1=1
</sql-query>
<condition column="folder_id" name="folderId" symbol="=" alias="a"/>
<condition column="code" name="code" symbol="like" alias="a"/>
......
......@@ -126,8 +126,8 @@
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.version
from SA_OPOrg o, SA_OPPerson p
where o.person_id = p.id(+)
from SA_OPOrg o left join SA_OPPerson p on o.person_id = p.id
where 1=1
</sql>
<sql name="queryOrgExcludePos">
select o.id, o.type_id, o.code, o.name, o.long_Name, o.parent_Id, o.full_Id,
......@@ -137,14 +137,13 @@
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.version
from V_SA_OPOrg_Exclude_Pos o, SA_OPPerson p
where o.person_id = p.id(+)
from V_SA_OPOrg_Exclude_Pos o left join SA_OPPerson p on o.person_id = p.id
where 1=1
</sql>
<sql name="queryCount">
select count(o.id)
from SA_OPOrg o, SA_OPPerson p
where o.person_id = p.id(+)
and o.parent_id = :parentId
from SA_OPOrg o left join SA_OPPerson p on o.person_id = p.id
where o.parent_id = :parentId
</sql>
</query>
......
......@@ -12,7 +12,7 @@
t.APPLICANT_DEPT_NAME_ as dept_name
from act_hi_procinst p, act_hi_procinst_extension t, wf_procdef c
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 t.status_id_ = 'executing'
and not exists
......@@ -44,7 +44,7 @@
t.APPLICANT_DEPT_NAME_ as dept_Name
from act_hi_procinst p, act_hi_procinst_extension t, wf_procdef c
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 t.status_id_ = 'completed'
and not exists
......
......@@ -449,6 +449,11 @@
<artifactId>mysql-connector-java</artifactId>
<version>8.0.17</version>
</dependency>
<dependency>
<groupId>com.huigou</groupId>
<artifactId>huigou-demo</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<finalName>huigou-xt</finalName>
......
......@@ -22,6 +22,11 @@
<property name="queryXmlManager" ref="queryXmlManager" />
</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>
......
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