Commit 0e94b7ab authored by 雍欢's avatar 雍欢

自定义查询SQL方言

parent 01bd2920
...@@ -4,7 +4,7 @@ import org.springframework.context.ApplicationContext; ...@@ -4,7 +4,7 @@ import org.springframework.context.ApplicationContext;
/** /**
* spring 环境包装类 * spring 环境包装类
* *
* @author xx * @author xx
*/ */
public class ApplicationContextWrapper { public class ApplicationContextWrapper {
...@@ -43,7 +43,7 @@ public class ApplicationContextWrapper { ...@@ -43,7 +43,7 @@ public class ApplicationContextWrapper {
/** /**
* 根据服务器上下文获取 Spring 管理的bean * 根据服务器上下文获取 Spring 管理的bean
* *
* @param name * @param name
* @param type * @param type
* @return * @return
...@@ -54,4 +54,14 @@ public class ApplicationContextWrapper { ...@@ -54,4 +54,14 @@ public class ApplicationContextWrapper {
} }
return getInstance().getApplicationContext().getBean(name, type); return getInstance().getApplicationContext().getBean(name, type);
} }
/**
* @since 1.1.3
*/
public static <T> T getBean(Class<T> type) {
if (getInstance().getApplicationContext() == null) {
return null;
}
return getInstance().getApplicationContext().getBean(type);
}
} }
...@@ -159,10 +159,12 @@ public class Agent extends AbstractEntity { ...@@ -159,10 +159,12 @@ public class Agent extends AbstractEntity {
this.remark = remark; this.remark = remark;
} }
@Override
public List<AgentProc> getDetails() { public List<AgentProc> getDetails() {
return details; return details;
} }
@Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void setDetails(List<? extends AbstractEntity> details) { public void setDetails(List<? extends AbstractEntity> details) {
this.details = (List<AgentProc>) details; this.details = (List<AgentProc>) details;
......
package com.huigou.data.domain.listener; package com.huigou.data.domain.listener;
import com.huigou.data.jdbc.SQLQuery; import com.huigou.data.query.executor.SQLExecutorDao;
import com.huigou.data.repository.GeneralRepositorySuper; import com.huigou.data.query.model.QueryDescriptor;
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 org.springframework.beans.factory.annotation.Configurable;
import javax.persistence.EntityManager;
import javax.persistence.PrePersist; import javax.persistence.PrePersist;
import javax.persistence.PreUpdate; import javax.persistence.PreUpdate;
import javax.persistence.metamodel.Metamodel;
@Configurable @Configurable
public class VersionListener { public class VersionListener {
@Deprecated
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 SQLQuery sqlQuery;
private Long getNextId() { private Long getNextId() {
GeneralRepositorySuper generalRepository = ApplicationContextWrapper.getBean("generalRepository", GeneralRepositorySuper.class); SQLExecutorDao sqlExecutor = ApplicationContextWrapper.getBean("sqlExecutorDao", SQLExecutorDao.class);
EntityManager em = generalRepository.getEntityManager(); QueryDescriptor queryDescriptor = sqlExecutor.getQuery("config/uasp/query/bmp/common.xml", "common");
Metamodel metamodel = em.getMetamodel(); Long version = sqlExecutor.getSqlQuery().getJDBCDao().queryToLong(queryDescriptor.getSqlByName("nextVersion"));
if (!inited) {
sqlQuery = ApplicationContextWrapper.getBean("sqlQuery", SQLQuery.class);
inited = true;
}
Long version = sqlQuery.getJDBCDao().queryToLong(GET_NEXT_SEQ_SQL);
return version; return version;
} }
@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());
} }
} }
...@@ -46,7 +46,6 @@ public abstract class AbstractEntity implements IdentifiedEntity, Serializable { ...@@ -46,7 +46,6 @@ public abstract class AbstractEntity implements IdentifiedEntity, Serializable {
/** /**
* 实体版本号 * 实体版本号
*/ */
@GeneratedValue(strategy = GenerationType.TABLE)
private Long version; private Long version;
@Transient @Transient
...@@ -55,10 +54,12 @@ public abstract class AbstractEntity implements IdentifiedEntity, Serializable { ...@@ -55,10 +54,12 @@ public abstract class AbstractEntity implements IdentifiedEntity, Serializable {
@Transient @Transient
private List<? extends AbstractEntity> inputDetails_; private List<? extends AbstractEntity> inputDetails_;
@Override
public String getId() { public String getId() {
return id; return id;
} }
@Override
public void setId(String id) { public void setId(String id) {
if ("".equals(id)) { if ("".equals(id)) {
id = null; id = null;
...@@ -66,10 +67,12 @@ public abstract class AbstractEntity implements IdentifiedEntity, Serializable { ...@@ -66,10 +67,12 @@ public abstract class AbstractEntity implements IdentifiedEntity, Serializable {
this.id = id; this.id = id;
} }
@Override
public Long getVersion() { public Long getVersion() {
return this.version; return this.version;
} }
@Override
public void setVersion(Long version) { public void setVersion(Long version) {
this.version = version; this.version = version;
} }
...@@ -105,6 +108,7 @@ public abstract class AbstractEntity implements IdentifiedEntity, Serializable { ...@@ -105,6 +108,7 @@ public abstract class AbstractEntity implements IdentifiedEntity, Serializable {
return id == null ? 0 : id.hashCode(); return id == null ? 0 : id.hashCode();
} }
@Override
@JsonIgnore @JsonIgnore
public boolean isNew() { public boolean isNew() {
return StringUtil.isBlank(this.id); return StringUtil.isBlank(this.id);
...@@ -191,6 +195,7 @@ public abstract class AbstractEntity implements IdentifiedEntity, Serializable { ...@@ -191,6 +195,7 @@ public abstract class AbstractEntity implements IdentifiedEntity, Serializable {
return updateFields_; return updateFields_;
} }
@Override
public void setUpdateFields_(Collection<String> names) { public void setUpdateFields_(Collection<String> names) {
if (names != null && names.size() > 0) { if (names != null && names.size() > 0) {
this.updateFields_ = names.toArray(new String[names.size()]); this.updateFields_ = names.toArray(new String[names.size()]);
......
...@@ -59,12 +59,28 @@ public class QueryXmlModel implements Serializable, ConfigFileVersion { ...@@ -59,12 +59,28 @@ public class QueryXmlModel implements Serializable, ConfigFileVersion {
return querys.get(0); return querys.get(0);
} }
/**
* @deprecated 已被 {@link #getDeclaredQueries(String)} 替代。
*/
@Deprecated
public Query getQuery(String name) { public Query getQuery(String name) {
return querys.stream().map(query -> query.get(name)) return querys.stream().map(query -> query.get(name))
.filter(Objects::nonNull) .filter(Objects::nonNull)
.findFirst().get(); .findFirst().get();
} }
/**
* 获取所有同名的query。
*
* @param name queryName
* @since 1.1.3
*/
public List<Query> getDeclaredQueries(String name) {
return querys.stream().map(query -> query.get(name))
.filter(Objects::nonNull)
.collect(Collectors.toList());
}
public void setVersion(Long version) { public void setVersion(Long version) {
this.version = version; this.version = version;
} }
......
...@@ -59,7 +59,7 @@ public class SQLExecutorDaoImpl extends JDBCDaoImpl implements SQLExecutorDao { ...@@ -59,7 +59,7 @@ public class SQLExecutorDaoImpl extends JDBCDaoImpl implements SQLExecutorDao {
@Override @Override
public QueryDescriptor getQuery(String queryFilePath, String queryName) { public QueryDescriptor getQuery(String queryFilePath, String queryName) {
QueryXmlModel model = getQueryXmlModel(queryFilePath); QueryXmlModel model = getQueryXmlModel(queryFilePath);
QueryDescriptor queryDescriptor = new QueryDescriptor(model.getQuery(queryName)); QueryDescriptor queryDescriptor = new QueryDescriptor(model.getDeclaredQueries(queryName));
return queryDescriptor; return queryDescriptor;
} }
...@@ -93,7 +93,7 @@ public class SQLExecutorDaoImpl extends JDBCDaoImpl implements SQLExecutorDao { ...@@ -93,7 +93,7 @@ public class SQLExecutorDaoImpl extends JDBCDaoImpl implements SQLExecutorDao {
@Override @Override
public QueryModel getQueryModel(QueryDescriptor queryDescriptor, QueryAbstractRequest queryRequest, String sqlName) throws EntityExecutorException { public QueryModel getQueryModel(QueryDescriptor queryDescriptor, QueryAbstractRequest queryRequest, String sqlName) throws EntityExecutorException {
SQLExecutor executor = sqlBuilder.buildSqlByName(queryDescriptor.getQuery(), sqlName, queryRequest); SQLExecutor executor = sqlBuilder.buildSqlByName(queryDescriptor.getQuery(sqlName), sqlName, queryRequest);
QueryModel queryModel = queryRequest.initQueryModel(); QueryModel queryModel = queryRequest.initQueryModel();
queryModel.setQueryParams(executor.parseParamMap()); queryModel.setQueryParams(executor.parseParamMap());
queryModel.setSql(executor.getSql()); queryModel.setSql(executor.getSql());
......
...@@ -3,48 +3,73 @@ package com.huigou.data.query.model; ...@@ -3,48 +3,73 @@ package com.huigou.data.query.model;
import com.huigou.data.query.XMLParseUtil; import com.huigou.data.query.XMLParseUtil;
import com.huigou.exception.NotFoundException; import com.huigou.exception.NotFoundException;
import com.huigou.uasp.bmp.query.QueryDocument.Query; import com.huigou.uasp.bmp.query.QueryDocument.Query;
import com.huigou.uasp.bmp.query.SqlDocument.Sql;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
/** /**
* 查询模型描述符 * 查询模型描述符
* *
* @author xx * @author xx
*/ */
public class QueryDescriptor { public class QueryDescriptor {
private Query query; private List<Query> queries;
public QueryDescriptor(Query query) { public QueryDescriptor(Query query) {
this.query = query; this.queries = Collections.singletonList(query);
}
/**
* @since 1.1.3
*/
public QueryDescriptor(List<Query> queries) {
this.queries = queries;
}
/**
* 根据sqlName获取 Query对象。
*
* @param sqlName sql名称
* @return Query对象
* @since 1.1.3
*/
public Query getQuery(String sqlName) {
return queries.stream()
.filter(query -> Arrays.stream(query.getSqlArray()).filter(sql -> sql.getName().equals(sqlName)).findFirst().isPresent())
.findFirst()
.get();
} }
public Query getQuery() { public Query getQuery() {
return query; // 优先从方言xml中取
return queries.stream().findFirst().get();
} }
public void setQuery(Query query) { public void setQuery(Query query) {
this.query = query; this.queries = Collections.singletonList(query);
} }
public String getName() { public String getName() {
return query.getName(); return getQuery().getName();
} }
public String getLabel() { public String getLabel() {
return query.getLabel(); return getQuery().getLabel();
} }
public String getSql() { public String getSql() {
return query.getSqlQuery(); return getQuery().getSqlQuery();
} }
public String getSqlByName(String sqlName) { public String getSqlByName(String sqlName) {
for (Sql sql : query.getSqlArray()) { Query query = getQuery(sqlName);
if (sql.getName().equals(sqlName)) { if (query == null) {
return XMLParseUtil.getNodeTextValue(sql); throw new NotFoundException(String.format("实体%s中没有SQL(%s)的配置!", queries.get(0).getName(), sqlName));
}
} }
throw new NotFoundException(String.format("实体%s中没有SQL(%s)的配置!", query.getName(), sqlName)); return XMLParseUtil.getNodeTextValue(query);
} }
} }
...@@ -2,39 +2,38 @@ package com.huigou.data.query.parser; ...@@ -2,39 +2,38 @@ package com.huigou.data.query.parser;
import com.huigou.data.domain.query.QueryAbstractRequest; import com.huigou.data.domain.query.QueryAbstractRequest;
import com.huigou.data.query.SQLExecutor; import com.huigou.data.query.SQLExecutor;
import com.huigou.data.query.model.QueryDescriptor;
import com.huigou.uasp.bmp.query.QueryDocument.Query; import com.huigou.uasp.bmp.query.QueryDocument.Query;
public interface SQLBuilder { public interface SQLBuilder {
/** /**
* 构造查询SQL语句 * 构造查询SQL语句
* *
* @param entity * @param entity 实体文档对象
* 实体文档对象 * @param queryRequest 参数
* @param queryRequest
* 参数
* @return * @return
*/ */
public SQLExecutor buildQuerySql(Query query, QueryAbstractRequest queryRequest); SQLExecutor buildQuerySql(Query query, QueryAbstractRequest queryRequest);
/** /**
* 根据SQLName获取配置在实体中的sql语句 * 根据SQLName获取配置在实体中的sql语句
* *
* @author
* @param entity * @param entity
* @param sqlName * @param sqlName
* @return String * @return String
* @author
*/ */
public String getSqlByName(Query query, String sqlName); public String getSqlByName(Query query, String sqlName);
/** /**
* 根据SQLName获取配置在实体中的sql语句,并构造SQL * 根据SQLName获取配置在实体中的sql语句,并构造SQL
* *
* @author
* @param entity * @param entity
* @param sqlName * @param sqlName
* @param queryRequest * @param queryRequest
* @return SQLExecutor * @return SQLExecutor
* @author
*/ */
public SQLExecutor buildSqlByName(Query query, String sqlName, QueryAbstractRequest queryRequest); public SQLExecutor buildSqlByName(Query query, String sqlName, QueryAbstractRequest queryRequest);
} }
\ No newline at end of file
...@@ -7,6 +7,7 @@ import com.huigou.data.domain.query.QueryAbstractRequest; ...@@ -7,6 +7,7 @@ import com.huigou.data.domain.query.QueryAbstractRequest;
import com.huigou.data.query.QueryPermissionBuilder; import com.huigou.data.query.QueryPermissionBuilder;
import com.huigou.data.query.SQLExecutor; import com.huigou.data.query.SQLExecutor;
import com.huigou.data.query.XMLParseUtil; import com.huigou.data.query.XMLParseUtil;
import com.huigou.data.query.model.QueryDescriptor;
import com.huigou.data.query.parser.SQLBuilder; import com.huigou.data.query.parser.SQLBuilder;
import com.huigou.data.query.parser.model.ConditionModel; import com.huigou.data.query.parser.model.ConditionModel;
import com.huigou.data.query.parser.model.DataFilterGroup; import com.huigou.data.query.parser.model.DataFilterGroup;
......
...@@ -42,6 +42,9 @@ import javax.persistence.criteria.Path; ...@@ -42,6 +42,9 @@ import javax.persistence.criteria.Path;
import javax.persistence.criteria.Predicate; import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root; import javax.persistence.criteria.Root;
import com.huigou.data.query.executor.SQLExecutorDao;
import com.huigou.data.query.model.QueryDescriptor;
import com.huigou.util.ApplicationContextWrapper;
import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.PageImpl;
...@@ -813,7 +816,9 @@ abstract public class GeneralRepositorySuper { ...@@ -813,7 +816,9 @@ abstract public class GeneralRepositorySuper {
} }
private long getNextId(String sequenceName) { private long getNextId(String sequenceName) {
Query q = getEntityManager().createNativeQuery(String.format("SELECT %s.nextval from DUAL", sequenceName)); SQLExecutorDao sqlExecutor = ApplicationContextWrapper.getBean("sqlExecutorDao", SQLExecutorDao.class);
QueryDescriptor queryDescriptor = sqlExecutor.getQuery("config/uasp/query/bmp/common.xml", "common");
Query q = getEntityManager().createNativeQuery(String.format(queryDescriptor.getSqlByName("nextVersion"), sequenceName));
BigDecimal result = (BigDecimal) q.getSingleResult(); BigDecimal result = (BigDecimal) q.getSingleResult();
return result.longValue(); return result.longValue();
} }
......
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>com.huigou</groupId> <groupId>com.huigou</groupId>
<artifactId>root</artifactId> <artifactId>root</artifactId>
<version>1.1.3-SNAPSHOT</version> <version>1.1.3-SNAPSHOT</version>
</parent> </parent>
<artifactId>huigou-uasp</artifactId> <artifactId>huigou-uasp</artifactId>
<name>huigou-uasp</name> <name>huigou-uasp</name>
<description>huigou-uasp</description> <description>huigou-uasp</description>
<dependencies> <dependencies>
<!-- 公用的组件包 --> <!-- 公用的组件包 -->
<dependency> <dependency>
<groupId>commons-lang</groupId> <groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId> <artifactId>commons-lang</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-beanutils</groupId> <groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId> <artifactId>commons-beanutils</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-io</groupId> <groupId>commons-io</groupId>
<artifactId>commons-io</artifactId> <artifactId>commons-io</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-fileupload</groupId> <groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId> <artifactId>commons-fileupload</artifactId>
</dependency> </dependency>
<!-- <!--
<dependency> <dependency>
<groupId>commons-collections</groupId> <groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId> <artifactId>commons-collections</artifactId>
</dependency> </dependency>
--> -->
<!-- JSON --> <!-- JSON -->
<dependency> <dependency>
<groupId>net.sf.json-lib</groupId> <groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId> <artifactId>json-lib</artifactId>
<classifier>jdk15</classifier> <classifier>jdk15</classifier>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.json</groupId> <groupId>org.json</groupId>
<artifactId>json</artifactId> <artifactId>json</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.jsoup</groupId> <groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId> <artifactId>jsoup</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.sf.ezmorph</groupId> <groupId>net.sf.ezmorph</groupId>
<artifactId>ezmorph</artifactId> <artifactId>ezmorph</artifactId>
</dependency> </dependency>
<!-- 缓存 --> <!-- 缓存 -->
<dependency> <dependency>
<groupId>net.sf.ehcache</groupId> <groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId> <artifactId>ehcache</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.googlecode.xmemcached</groupId> <groupId>com.googlecode.xmemcached</groupId>
<artifactId>xmemcached</artifactId> <artifactId>xmemcached</artifactId>
</dependency> </dependency>
<!-- 日志 --> <!-- 日志 -->
<dependency> <dependency>
<groupId>commons-logging</groupId> <groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId> <artifactId>commons-logging</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId> <artifactId>slf4j-log4j12</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>log4j</groupId> <groupId>log4j</groupId>
<artifactId>log4j</artifactId> <artifactId>log4j</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>javax.servlet</groupId> <groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId> <artifactId>servlet-api</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>javax.servlet.jsp</groupId> <groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId> <artifactId>jsp-api</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.oracle</groupId> <groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId> <artifactId>ojdbc6</artifactId>
</dependency> </dependency>
<!-- 工作流 --> <!-- 工作流 -->
<dependency> <dependency>
<groupId>org.activiti</groupId> <groupId>org.activiti</groupId>
<artifactId>activiti-engine</artifactId> <artifactId>activiti-engine</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.activiti</groupId> <groupId>org.activiti</groupId>
<artifactId>activiti-spring</artifactId> <artifactId>activiti-spring</artifactId>
</dependency> </dependency>
<!-- 面向切面的框架 --> <!-- 面向切面的框架 -->
<dependency> <dependency>
<groupId>org.aspectj</groupId> <groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId> <artifactId>aspectjrt</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.xhtmlrenderer</groupId> <groupId>org.xhtmlrenderer</groupId>
<artifactId>flying-saucer-pdf-itext5</artifactId> <artifactId>flying-saucer-pdf-itext5</artifactId>
</dependency> </dependency>
<!-- freemarker --> <!-- freemarker -->
<dependency> <dependency>
<groupId>org.freemarker</groupId> <groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId> <artifactId>freemarker</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.sun.mail</groupId> <groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId> <artifactId>javax.mail</artifactId>
</dependency> </dependency>
<!-- spring --> <!-- spring -->
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId> <artifactId>spring-context-support</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId> <artifactId>spring-web</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId> <artifactId>spring-webmvc</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId> <artifactId>spring-tx</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId> <artifactId>spring-expression</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-instrument-tomcat</artifactId> <artifactId>spring-instrument-tomcat</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-instrument</artifactId> <artifactId>spring-instrument</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId> <artifactId>spring-jdbc</artifactId>
</dependency> </dependency>
<!-- mybatis --> <!-- mybatis -->
<dependency> <dependency>
<groupId>org.mybatis</groupId> <groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId> <artifactId>mybatis</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.mybatis</groupId> <groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId> <artifactId>mybatis-spring</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.hibernate</groupId> <groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId> <artifactId>hibernate-entitymanager</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.hibernate.javax.persistence</groupId> <groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId> <artifactId>hibernate-jpa-2.1-api</artifactId>
</dependency> </dependency>
<!-- 汉字转换拼音 --> <!-- 汉字转换拼音 -->
<dependency> <dependency>
<groupId>com.belerweb</groupId> <groupId>com.belerweb</groupId>
<artifactId>pinyin4j</artifactId> <artifactId>pinyin4j</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>dom4j</groupId> <groupId>dom4j</groupId>
<artifactId>dom4j</artifactId> <artifactId>dom4j</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.googlecode.ehcache-spring-annotations</groupId> <groupId>com.googlecode.ehcache-spring-annotations</groupId>
<artifactId>ehcache-spring-annotations</artifactId> <artifactId>ehcache-spring-annotations</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>wsdl4j</groupId> <groupId>wsdl4j</groupId>
<artifactId>wsdl4j</artifactId> <artifactId>wsdl4j</artifactId>
</dependency> </dependency>
<!-- 内部项目依赖 --> <!-- 内部项目依赖 -->
<dependency> <dependency>
<groupId>com.huigou</groupId> <groupId>com.huigou</groupId>
<artifactId>huigou-query</artifactId> <artifactId>huigou-query</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.huigou</groupId> <groupId>com.huigou</groupId>
<artifactId>huigou-easysearch</artifactId> <artifactId>huigou-easysearch</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.huigou</groupId> <groupId>com.huigou</groupId>
<artifactId>huigou-treeview</artifactId> <artifactId>huigou-treeview</artifactId>
</dependency> </dependency>
<!-- 解析XML文件 --> <!-- 解析XML文件 -->
<dependency> <dependency>
<groupId>org.apache.xmlbeans</groupId> <groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId> <artifactId>xmlbeans</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>xerces</groupId> <groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId> <artifactId>xercesImpl</artifactId>
</dependency> </dependency>
<!-- Microsoft Office格式档案读和写 --> <!-- Microsoft Office格式档案读和写 -->
<dependency> <dependency>
<groupId>org.apache.poi</groupId> <groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId> <artifactId>poi</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.poi</groupId> <groupId>org.apache.poi</groupId>
<artifactId>poi-excelant</artifactId> <artifactId>poi-excelant</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.poi</groupId> <groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId> <artifactId>poi-ooxml</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.poi</groupId> <groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId> <artifactId>poi-ooxml-schemas</artifactId>
</dependency> </dependency>
<!-- 规则引擎 --> <!-- 规则引擎 -->
<dependency> <dependency>
<groupId>com.alibaba</groupId> <groupId>com.alibaba</groupId>
<artifactId>QLExpress</artifactId> <artifactId>QLExpress</artifactId>
</dependency> </dependency>
<!-- 表达式语言 --> <!-- 表达式语言 -->
<dependency> <dependency>
<groupId>ognl</groupId> <groupId>ognl</groupId>
<artifactId>ognl</artifactId> <artifactId>ognl</artifactId>
</dependency> </dependency>
<!-- 分析、编辑和创建Java字节码 --> <!-- 分析、编辑和创建Java字节码 -->
<!--<dependency> <!--<dependency>
<groupId>javassist</groupId> <groupId>javassist</groupId>
<artifactId>javassist</artifactId> <artifactId>javassist</artifactId>
</dependency>--> </dependency>-->
<!-- 生成PDF报表 --> <!-- 生成PDF报表 -->
<dependency> <dependency>
<groupId>com.lowagie</groupId> <groupId>com.lowagie</groupId>
<artifactId>itext</artifactId> <artifactId>itext</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.data</groupId> <groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId> <artifactId>spring-data-jpa</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
</dependency> </dependency>
<!-- Shiro dependencies --> <!-- Shiro dependencies -->
<dependency> <dependency>
<groupId>org.apache.shiro</groupId> <groupId>org.apache.shiro</groupId>
<artifactId>shiro-core</artifactId> <artifactId>shiro-core</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.shiro</groupId> <groupId>org.apache.shiro</groupId>
<artifactId>shiro-spring</artifactId> <artifactId>shiro-spring</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>javax.ws.rs</groupId> <groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId> <artifactId>javax.ws.rs-api</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.cxf</groupId> <groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId> <artifactId>cxf-rt-frontend-jaxrs</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.cxf</groupId> <groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId> <artifactId>cxf-rt-frontend-jaxws</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.cxf</groupId> <groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId> <artifactId>cxf-rt-transports-http</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.cxf</groupId> <groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-service-description</artifactId> <artifactId>cxf-rt-rs-service-description</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>redis.clients</groupId> <groupId>redis.clients</groupId>
<artifactId>jedis</artifactId> <artifactId>jedis</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.crazycake</groupId> <groupId>org.crazycake</groupId>
<artifactId>shiro-redis</artifactId> <artifactId>shiro-redis</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.shiro</groupId> <groupId>org.apache.shiro</groupId>
<artifactId>shiro-cas</artifactId> <artifactId>shiro-cas</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-ehcache</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.jasig.cas.client</groupId> <groupId>org.apache.shiro</groupId>
<artifactId>cas-client-core</artifactId> <artifactId>shiro-ehcache</artifactId>
</dependency> </dependency>
<!-- MongoDB依赖 --> <dependency>
<dependency> <groupId>org.jasig.cas.client</groupId>
<groupId>org.springframework.data</groupId> <artifactId>cas-client-core</artifactId>
<artifactId>spring-data-mongodb</artifactId> </dependency>
</dependency>
<dependency> <!-- MongoDB依赖 -->
<groupId>com.google.code.gson</groupId> <dependency>
<artifactId>gson</artifactId> <groupId>org.springframework.data</groupId>
</dependency> <artifactId>spring-data-mongodb</artifactId>
<!-- 微信 --> </dependency>
<dependency> <dependency>
<groupId>com.github.binarywang</groupId> <groupId>com.google.code.gson</groupId>
<artifactId>weixin-java-cp</artifactId> <artifactId>gson</artifactId>
<version>2.4.3</version> </dependency>
<exclusions> <!-- 微信 -->
<exclusion> <dependency>
<groupId>redis.clients</groupId> <groupId>com.github.binarywang</groupId>
<artifactId>jedis</artifactId> <artifactId>weixin-java-cp</artifactId>
</exclusion> <version>2.4.3</version>
</exclusions> <exclusions>
</dependency> <exclusion>
<dependency> <groupId>redis.clients</groupId>
<groupId>com.huigou</groupId> <artifactId>jedis</artifactId>
<artifactId>huigou-core-api</artifactId> </exclusion>
</dependency> </exclusions>
<dependency> </dependency>
<groupId>com.huigou</groupId> <dependency>
<artifactId>huigou-core-proxy</artifactId> <groupId>com.huigou</groupId>
</dependency> <artifactId>huigou-core-api</artifactId>
<dependency> </dependency>
<groupId>com.huigou</groupId> <dependency>
<artifactId>huigou-data</artifactId> <groupId>com.huigou</groupId>
</dependency> <artifactId>huigou-core-proxy</artifactId>
<dependency> </dependency>
<groupId>com.huigou</groupId> <dependency>
<artifactId>huigou-common</artifactId> <groupId>com.huigou</groupId>
</dependency> <artifactId>huigou-data</artifactId>
</dependencies> </dependency>
<build> <dependency>
<plugins> <groupId>com.huigou</groupId>
<plugin> <artifactId>huigou-common</artifactId>
<artifactId>maven-source-plugin</artifactId> </dependency>
</plugin> </dependencies>
<plugin> <build>
<groupId>org.apache.maven.plugins</groupId> <plugins>
<artifactId>maven-resources-plugin</artifactId> <plugin>
<configuration> <artifactId>maven-source-plugin</artifactId>
<encoding>UTF-8</encoding> </plugin>
</configuration> <plugin>
<executions> <groupId>org.apache.maven.plugins</groupId>
<execution> <artifactId>maven-resources-plugin</artifactId>
<id>copy-dev-resources</id> <configuration>
<phase>process-resources</phase> <encoding>UTF-8</encoding>
<goals> </configuration>
<goal>copy-resources</goal> <executions>
</goals> <execution>
<configuration> <id>copy-dev-resources</id>
<overwrite>true</overwrite> <phase>process-resources</phase>
<outputDirectory>${basedir}/target/classes</outputDirectory> <goals>
<resources> <goal>copy-resources</goal>
<resource> </goals>
<directory>src/main/resources</directory> <configuration>
</resource> <overwrite>true</overwrite>
</resources> <outputDirectory>${basedir}/target/classes</outputDirectory>
</configuration> <resources>
</execution> <resource>
</executions> <directory>src/main/resources</directory>
</plugin> </resource>
</plugins> </resources>
</build> </configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project> </project>
\ No newline at end of file
...@@ -145,6 +145,7 @@ public class BpmProcessNodeFunction extends AbstractEntity { ...@@ -145,6 +145,7 @@ public class BpmProcessNodeFunction extends AbstractEntity {
this.isFunction = isFunction; this.isFunction = isFunction;
} }
@Override
public void checkConstraints() { public void checkConstraints() {
Assert.hasText(viewId, "节点ID不能为空!"); Assert.hasText(viewId, "节点ID不能为空!");
Assert.hasText(businessProcessId, "流程ID不能为空!"); Assert.hasText(businessProcessId, "流程ID不能为空!");
......
package com.huigou.uasp.bmp.codingrule.application.impl; package com.huigou.uasp.bmp.codingrule.application.impl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.huigou.data.domain.listener.VersionListener;
import com.huigou.data.query.executor.SQLExecutorDao; import com.huigou.data.query.executor.SQLExecutorDao;
import com.huigou.data.query.model.QueryDescriptor;
import com.huigou.uasp.bmp.codingrule.application.MaxSerialApplication; import com.huigou.uasp.bmp.codingrule.application.MaxSerialApplication;
import com.huigou.uasp.bmp.codingrule.domain.query.CodingRuleDetailDesc; import com.huigou.uasp.bmp.codingrule.domain.query.CodingRuleDetailDesc;
import com.huigou.uasp.bmp.codingrule.repository.MaxSerialRepository; import com.huigou.uasp.bmp.codingrule.repository.MaxSerialRepository;
...@@ -17,6 +9,13 @@ import com.huigou.uasp.bmp.configuration.domain.query.IntermilCodeDesc; ...@@ -17,6 +9,13 @@ import com.huigou.uasp.bmp.configuration.domain.query.IntermilCodeDesc;
import com.huigou.uasp.bmp.configuration.domain.query.MaxSerialDesc; import com.huigou.uasp.bmp.configuration.domain.query.MaxSerialDesc;
import com.huigou.util.CommonUtil; import com.huigou.util.CommonUtil;
import com.huigou.util.StringUtil; import com.huigou.util.StringUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
@Service("maxSerialApplication") @Service("maxSerialApplication")
public class MaxSerialApplicationImpl implements MaxSerialApplication { public class MaxSerialApplicationImpl implements MaxSerialApplication {
...@@ -198,7 +197,8 @@ public class MaxSerialApplicationImpl implements MaxSerialApplication { ...@@ -198,7 +197,8 @@ public class MaxSerialApplicationImpl implements MaxSerialApplication {
maxSerialId = CommonUtil.createGUID(); maxSerialId = CommonUtil.createGUID();
Long version = this.sqlExecutorDao.queryToLong(VersionListener.GET_NEXT_SEQ_SQL); QueryDescriptor queryDescriptor = sqlExecutorDao.getQuery("config/uasp/query/bmp/common.xml", "common");
Long version = sqlExecutorDao.getSqlQuery().getJDBCDao().queryToLong(queryDescriptor.getSqlByName("nextVersion"));
this.sqlExecutorDao.executeUpdate(sb.toString(), maxSerialId, codingRuleDetailDesc.getId(), sortItemValue, codingRuleDetailDesc.getInitialValue(), this.sqlExecutorDao.executeUpdate(sb.toString(), maxSerialId, codingRuleDetailDesc.getId(), sortItemValue, codingRuleDetailDesc.getInitialValue(),
"", codingRuleDetailDesc.getInitialValue(), version); "", codingRuleDetailDesc.getInitialValue(), version);
......
...@@ -9,10 +9,8 @@ import com.huigou.util.ResourceLoadManager; ...@@ -9,10 +9,8 @@ import com.huigou.util.ResourceLoadManager;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.xmlbeans.XmlException; import org.apache.xmlbeans.XmlException;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import org.springframework.util.Assert;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
...@@ -28,13 +26,20 @@ import java.util.stream.Collectors; ...@@ -28,13 +26,20 @@ import java.util.stream.Collectors;
* *
* @author xx * @author xx
*/ */
public class QueryXmlManager extends ResourceLoadManager<QueryXmlModel> implements QueryXmlLoadInterface, InitializingBean { public class QueryXmlManager extends ResourceLoadManager<QueryXmlModel> implements QueryXmlLoadInterface {
/** /**
* SQL 方言。 * SQL 方言。
*
* @since 1.1.3
*/ */
private String sqlDialect; private String sqlDialect;
/**
* 设置SQL方言。
*
* @since 1.1.3
*/
public void setSqlDialect(String sqlDialect) { public void setSqlDialect(String sqlDialect) {
this.sqlDialect = sqlDialect; this.sqlDialect = sqlDialect;
} }
...@@ -91,9 +96,4 @@ public class QueryXmlManager extends ResourceLoadManager<QueryXmlModel> implemen ...@@ -91,9 +96,4 @@ public class QueryXmlManager extends ResourceLoadManager<QueryXmlModel> implemen
Path dialectXmlPath = filePath.getParent().resolve(sqlDialect).resolve(filePath.getFileName()); Path dialectXmlPath = filePath.getParent().resolve(sqlDialect).resolve(filePath.getFileName());
return dialectXmlPath.toString(); return dialectXmlPath.toString();
} }
@Override
public void afterPropertiesSet() throws Exception {
Assert.hasText(sqlDialect, "sql方言不能为空");
}
} }
\ No newline at end of file
...@@ -189,6 +189,7 @@ public class OpdatamanagebusinessField extends AbstractEntity { ...@@ -189,6 +189,7 @@ public class OpdatamanagebusinessField extends AbstractEntity {
this.sequence = sequence; this.sequence = sequence;
} }
@Override
public void checkConstraints() { public void checkConstraints() {
Assert.hasText(datamanagebusinessId, "datamanagebusinessId不能为空!"); Assert.hasText(datamanagebusinessId, "datamanagebusinessId不能为空!");
Assert.hasText(dataKindCode, "dataKindCode不能为空!"); Assert.hasText(dataKindCode, "dataKindCode不能为空!");
......
...@@ -133,6 +133,7 @@ public class Opdatamanagedetailresource extends AbstractEntity { ...@@ -133,6 +133,7 @@ public class Opdatamanagedetailresource extends AbstractEntity {
this.orgDataKind = orgDataKind; this.orgDataKind = orgDataKind;
} }
@Override
public void checkConstraints() { public void checkConstraints() {
Assert.hasText(dataManagedetalId, "dataManagedetalId不能为空!"); Assert.hasText(dataManagedetalId, "dataManagedetalId不能为空!");
Assert.hasText(dataKindId, "dataKindId不能为空!"); Assert.hasText(dataKindId, "dataKindId不能为空!");
......
...@@ -82,6 +82,7 @@ public class Opdatamanagement extends AbstractEntity { ...@@ -82,6 +82,7 @@ public class Opdatamanagement extends AbstractEntity {
this.creator = creator; this.creator = creator;
} }
@Override
public void checkConstraints() { public void checkConstraints() {
Assert.hasText(dataManageId, "管理权限类别ID不能为空!"); Assert.hasText(dataManageId, "管理权限类别ID不能为空!");
Assert.hasText(dataManagedetalId, "管理权限数据取值定义ID不能为空!"); Assert.hasText(dataManagedetalId, "管理权限数据取值定义ID不能为空!");
......
<?xml version="1.0" encoding="UTF-8"?>
<query-mappings>
<query name="approvalRule" label="审批规则">
<sql name="updateChildrenFullName">
update WF_ApprovalRule
set full_name = concat(:newFullName, substr(full_name, length(:oldFullName) + 1, length(full_name))),
full_id = concat(:newFullId, substr(full_Id, length(:oldFullId) + 1, length(full_Id))),
version = (select next_sequence('version_seq'))
where full_Id like :fullId
</sql>
</query>
</query-mappings>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<query-mappings>
<query name="common" label="通用sql">
<sql name="nextVersion">
select next_sequence('version_seq')
</sql>
<sql name="nextSequence">
SELECT next_sequence(%s)
</sql>
<sql name="updateFullName">
update %s
set full_Name = concat(:newFullName, substr(full_Name,
length(:oldFullName) + 1,
length(full_Name))),
version = (select next_sequence('version_seq'))
where full_id like :fullId
</sql>
<sql name="updateFullIdAndName">
update %s
set full_id = concat(:parentNewFullId,
substr(full_Id,
length(:parentOldFullId) + 1,
length(full_Id))),
full_Name = concat(:parentNewFullName,
substr(full_Name, length(:parentOldFullName) + 1,
length(full_Name))),
version = (select next_sequence('version_seq'))
where full_Id like :likeFullId
</sql>
<sql name="moveSqlByFolderId">
update %s set folder_Id = :folderId, version = (select next_sequence('version_seq')) where id in :ids
</sql>
<sql name="moveSqlByParentId">
update %s set %s = :parentId, version = (select next_sequence('version_seq')) where id in :ids
</sql>
<sql name="updateStatusSql">
update %s set status = :status, version = (select next_sequence('version_seq')) where id = :id
</sql>
<sql name="updateStatusesSql">
update %s set status = :status, version = (select next_sequence('version_seq')) where id in :ids
</sql>
<sql name="updateSequenceSql">
update %s set sequence = :sequence, version = (select next_sequence('version_seq')) where id = :id
</sql>
</query>
</query-mappings>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<query-mappings>
<query name="org" label="组织机构">
<sql name="updateChildrenStatus">
update SA_OPOrg o
set o.status = :newStatus, o.version = (select next_sequence('version_seq'))
where o.status in (:oldStatus)
and o.full_Id like :fullId
and (o.org_Kind_Id != 'psm' or
(select p.status from SA_OPPerson p where p.id = o.person_Id) >= :newStatus)
</sql>
<sql name="updateSubordinatePsmStatus">
update SA_OPOrg o
set o.status = :newStatus, o.version = (select next_sequence('version_seq'))
where o.org_Kind_Id = 'psm'
and o.status in (:oldStatus)
and (select p.status from SA_OPOrg p where p.id = o.parent_Id) >= :newStatus
and exists (select 1
from SA_OPPerson person, SA_OPOrg org
where person.status = :newStatus
and org.org_Kind_Id = 'psm'
and org.status in (:oldStatus)
and org.full_Id like :fullId
and person.main_Org_Id = org.parent_Id
and person.id = org.person_Id
and o.person_Id = person.id
and o.parent_Id != person.main_Org_Id)
</sql>
<sql name="updateMainOrgPersonStatus">
update SA_OPPerson p
set p.status = :newStatus, p.version = (select next_sequence('version_seq'))
where (p.Status in (:oldStatus))
and exists (select 1
from SA_OPOrg o
where (o.org_Kind_Id = 'psm')
and (p.main_Org_Id = o.parent_Id)
and (p.id = o.person_Id)
and (o.status in (:oldStatus))
and (o.full_Id like :fullId))
</sql>
<sql name="updateOrgChildrenFullCodeAndName">
update SA_OPOrg
set full_Code = concat(:parentNewFullCode,
substr(full_Code,
length(:parentOldFullCode) + 1,
length(full_Code))),
full_Name = concat(:parentNewFullName,
substr(full_Name,
length(:parentOldFullName) + 1,
length(full_Name))), version = (select next_sequence('version_seq'))
where full_Id like :likeFullId
</sql>
<sql name="updateRedundantData">
update SA_OPOrg t
set t.org_Id = :orgId, t.org_Code = :orgCode, t.org_Name = :orgName,
t.dept_Id = :deptId, t.dept_Code = :deptCode, t.dept_Name = :deptName,
t.position_Id = :positionId, t.position_Code = :positionCode,
t.position_Name = :positionName, version = (select next_sequence('version_seq'))
where t.id = :id
</sql>
<sql name="updateOrgChildrenFullOrgKindId">
update SA_OPOrg
set full_OrgKind_Id = concat(:parentNewFullOrgKindId,
substr(full_Org_Kind_Id,
length(:parentOldOrgKindId) + 1,
length(full_Org_Kind_Id))),
version = (select next_sequence('version_seq'))
where full_Id like :likeFullId
</sql>
<sql name="updateOrgChildrenFullSequence">
update SA_OPOrg
set full_Sequence = concat(:parentNewSequence,
substr(full_Sequence,
length(:parentOldSequence) + 1,
length(full_Sequence))),
version = (select next_sequence('version_seq'))
where full_Id like :fullId
</sql>
<sql name="updateOrgSequence">
update SA_OPOrg
set full_sequence = :fullSequence, sequence = :sequence,
version = (select next_sequence('version_seq'))
where id = :id
</sql>
</query>
</query-mappings>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<query-mappings>
<query name="org" label="组织机构">
<sql name="updateChildrenStatus">
update SA_OPOrg o
set o.status = :newStatus, o.version = (select next_sequence('version_seq'))
where o.status in (:oldStatus)
and o.full_Id like :fullId
and (o.org_Kind_Id != 'psm' or
(select p.status from SA_OPPerson p where p.id = o.person_Id) >= :newStatus)
</sql>
<sql name="updateSubordinatePsmStatus">
update SA_OPOrg o
set o.status = :newStatus, o.version = (select next_sequence('version_seq'))
where o.org_Kind_Id = 'psm'
and o.status in (:oldStatus)
and (select p.status from SA_OPOrg p where p.id = o.parent_Id) >= :newStatus
and exists (select 1
from SA_OPPerson person, SA_OPOrg org
where person.status = :newStatus
and org.org_Kind_Id = 'psm'
and org.status in (:oldStatus)
and org.full_Id like :fullId
and person.main_Org_Id = org.parent_Id
and person.id = org.person_Id
and o.person_Id = person.id
and o.parent_Id != person.main_Org_Id)
</sql>
<sql name="updateMainOrgPersonStatus">
update SA_OPPerson p
set p.status = :newStatus, p.version = (select next_sequence('version_seq'))
where (p.Status in (:oldStatus))
and exists (select 1
from SA_OPOrg o
where (o.org_Kind_Id = 'psm')
and (p.main_Org_Id = o.parent_Id)
and (p.id = o.person_Id)
and (o.status in (:oldStatus))
and (o.full_Id like :fullId))
</sql>
<sql name="updateOrgChildrenFullCodeAndName">
update SA_OPOrg
set full_Code = concat(:parentNewFullCode,
substr(full_Code,
length(:parentOldFullCode) + 1,
length(full_Code))),
full_Name = concat(:parentNewFullName,
substr(full_Name,
length(:parentOldFullName) + 1,
length(full_Name))), version = (select next_sequence('version_seq'))
where full_Id like :likeFullId
</sql>
<sql name="updateRedundantData">
update SA_OPOrg t
set t.org_Id = :orgId, t.org_Code = :orgCode, t.org_Name = :orgName,
t.dept_Id = :deptId, t.dept_Code = :deptCode, t.dept_Name = :deptName,
t.position_Id = :positionId, t.position_Code = :positionCode,
t.position_Name = :positionName, version = (select next_sequence('version_seq'))
where t.id = :id
</sql>
<sql name="updateOrgChildrenFullOrgKindId">
update SA_OPOrg
set full_OrgKind_Id = concat(:parentNewFullOrgKindId,
substr(full_Org_Kind_Id,
length(:parentOldOrgKindId) + 1,
length(full_Org_Kind_Id))),
version = (select next_sequence('version_seq'))
where full_Id like :likeFullId
</sql>
<sql name="updateOrgChildrenFullSequence">
update SA_OPOrg
set full_Sequence = concat(:parentNewSequence,
substr(full_Sequence,
length(:parentOldSequence) + 1,
length(full_Sequence))),
version = (select next_sequence('version_seq'))
where full_Id like :fullId
</sql>
<sql name="updateOrgSequence">
update SA_OPOrg
set full_sequence = :fullSequence, sequence = :sequence,
version = (select next_sequence('version_seq'))
where id = :id
</sql>
</query>
</query-mappings>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<query-mappings>
<query name="approvalRule" label="审批规则">
<sql name="updateChildrenFullName">
update WF_ApprovalRule
set full_name = concat(:newFullName, substr(full_name, length(:oldFullName) + 1, length(full_name))),
full_id = concat(:newFullId, substr(full_Id, length(:oldFullId) + 1, length(full_Id))),
version = version_seq.Nextval
where full_Id like :fullId
</sql>
</query>
</query-mappings>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<query-mappings>
<query name="common" label="通用sql">
<sql name="nextVersion">
SELECT version_seq.nextval from DUAL
</sql>
<sql name="nextSequence">
SELECT %s.nextval from DUAL
</sql>
<sql name="updateFullName">
update %s
set full_Name = concat(:newFullName, substr(full_Name,
length(:oldFullName) + 1,
length(full_Name))),
version = version_seq.nextval
where full_id like :fullId
</sql>
<sql name="updateFullIdAndName">
update %s
set full_id = concat(:parentNewFullId,
substr(full_Id,
length(:parentOldFullId) + 1,
length(full_Id))),
full_Name = concat(:parentNewFullName,
substr(full_Name, length(:parentOldFullName) + 1,
length(full_Name))),
version = version_seq.nextval
where full_Id like :likeFullId
</sql>
<sql name="moveSqlByFolderId">
update %s set folder_Id = :folderId, version = version_seq.nextval where id in :ids
</sql>
<sql name="moveSqlByParentId">
update %s set %s = :parentId, version = version_seq.nextval where id in :ids
</sql>
<sql name="updateStatusSql">
update %s set status = :status, version = version_seq.nextval where id = :id
</sql>
<sql name="updateStatusesSql">
update %s set status = :status, version = version_seq.nextval where id in :ids
</sql>
<sql name="updateSequenceSql">
update %s set sequence = :sequence, version = version_seq.nextval where id = :id
</sql>
</query>
</query-mappings>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<query-mappings>
<query name="org" label="组织机构">
<sql name="updateChildrenStatus">
update SA_OPOrg o
set o.status = :newStatus, o.version = version_seq.nextval
where o.status in (:oldStatus)
and o.full_Id like :fullId
and (o.org_Kind_Id != 'psm' or
(select p.status from SA_OPPerson p where p.id = o.person_Id) >= :newStatus)
</sql>
<sql name="updateSubordinatePsmStatus">
update SA_OPOrg o
set o.status = :newStatus, o.version = version_seq.Nextval
where o.org_Kind_Id = 'psm'
and o.status in (:oldStatus)
and (select p.status from SA_OPOrg p where p.id = o.parent_Id) >= :newStatus
and exists (select 1
from SA_OPPerson person, SA_OPOrg org
where person.status = :newStatus
and org.org_Kind_Id = 'psm'
and org.status in (:oldStatus)
and org.full_Id like :fullId
and person.main_Org_Id = org.parent_Id
and person.id = org.person_Id
and o.person_Id = person.id
and o.parent_Id != person.main_Org_Id)
</sql>
<sql name="updateMainOrgPersonStatus">
update SA_OPPerson p
set p.status = :newStatus, p.version = version_seq.nextval
where (p.Status in (:oldStatus))
and exists (select 1
from SA_OPOrg o
where (o.org_Kind_Id = 'psm')
and (p.main_Org_Id = o.parent_Id)
and (p.id = o.person_Id)
and (o.status in (:oldStatus))
and (o.full_Id like :fullId))
</sql>
<sql name="updateOrgChildrenFullCodeAndName">
update SA_OPOrg
set full_Code = concat(:parentNewFullCode,
substr(full_Code,
length(:parentOldFullCode) + 1,
length(full_Code))),
full_Name = concat(:parentNewFullName,
substr(full_Name,
length(:parentOldFullName) + 1,
length(full_Name))), version = version_seq.Nextval
where full_Id like :likeFullId
</sql>
<sql name="updateRedundantData">
update SA_OPOrg t
set t.org_Id = :orgId, t.org_Code = :orgCode, t.org_Name = :orgName,
t.dept_Id = :deptId, t.dept_Code = :deptCode, t.dept_Name = :deptName,
t.position_Id = :positionId, t.position_Code = :positionCode,
t.position_Name = :positionName, version = version_seq.Nextval
where t.id = :id
</sql>
<sql name="updateOrgChildrenFullOrgKindId">
update SA_OPOrg
set full_OrgKind_Id = concat(:parentNewFullOrgKindId,
substr(full_Org_Kind_Id,
length(:parentOldOrgKindId) + 1,
length(full_Org_Kind_Id))),
version = version_seq.Nextval
where full_Id like :likeFullId
</sql>
<sql name="updateOrgChildrenFullSequence">
update SA_OPOrg
set full_Sequence = concat(:parentNewSequence,
substr(full_Sequence,
length(:parentOldSequence) + 1,
length(full_Sequence))),
version = version_seq.nextval
where full_Id like :fullId
</sql>
<sql name="updateOrgSequence">
update SA_OPOrg
set full_sequence = :fullSequence, sequence = :sequence,
version = version_seq.Nextval
where id = :id
</sql>
</query>
</query-mappings>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<query-mappings>
<query name="org" label="组织机构">
<sql name="updateChildrenStatus">
update SA_OPOrg o
set o.status = :newStatus, o.version = version_seq.nextval
where o.status in (:oldStatus)
and o.full_Id like :fullId
and (o.org_Kind_Id != 'psm' or
(select p.status from SA_OPPerson p where p.id = o.person_Id) >= :newStatus)
</sql>
<sql name="updateSubordinatePsmStatus">
update SA_OPOrg o
set o.status = :newStatus, o.version = version_seq.Nextval
where o.org_Kind_Id = 'psm'
and o.status in (:oldStatus)
and (select p.status from SA_OPOrg p where p.id = o.parent_Id) >= :newStatus
and exists (select 1
from SA_OPPerson person, SA_OPOrg org
where person.status = :newStatus
and org.org_Kind_Id = 'psm'
and org.status in (:oldStatus)
and org.full_Id like :fullId
and person.main_Org_Id = org.parent_Id
and person.id = org.person_Id
and o.person_Id = person.id
and o.parent_Id != person.main_Org_Id)
</sql>
<sql name="updateMainOrgPersonStatus">
update SA_OPPerson p
set p.status = :newStatus, p.version = version_seq.nextval
where (p.Status in (:oldStatus))
and exists (select 1
from SA_OPOrg o
where (o.org_Kind_Id = 'psm')
and (p.main_Org_Id = o.parent_Id)
and (p.id = o.person_Id)
and (o.status in (:oldStatus))
and (o.full_Id like :fullId))
</sql>
<sql name="updateOrgChildrenFullCodeAndName">
update SA_OPOrg
set full_Code = concat(:parentNewFullCode,
substr(full_Code,
length(:parentOldFullCode) + 1,
length(full_Code))),
full_Name = concat(:parentNewFullName,
substr(full_Name,
length(:parentOldFullName) + 1,
length(full_Name))), version = version_seq.Nextval
where full_Id like :likeFullId
</sql>
<sql name="updateRedundantData">
update SA_OPOrg t
set t.org_Id = :orgId, t.org_Code = :orgCode, t.org_Name = :orgName,
t.dept_Id = :deptId, t.dept_Code = :deptCode, t.dept_Name = :deptName,
t.position_Id = :positionId, t.position_Code = :positionCode,
t.position_Name = :positionName, version = version_seq.Nextval
where t.id = :id
</sql>
<sql name="updateOrgChildrenFullOrgKindId">
update SA_OPOrg
set full_OrgKind_Id = concat(:parentNewFullOrgKindId,
substr(full_Org_Kind_Id,
length(:parentOldOrgKindId) + 1,
length(full_Org_Kind_Id))),
version = version_seq.Nextval
where full_Id like :likeFullId
</sql>
<sql name="updateOrgChildrenFullSequence">
update SA_OPOrg
set full_Sequence = concat(:parentNewSequence,
substr(full_Sequence,
length(:parentOldSequence) + 1,
length(full_Sequence))),
version = version_seq.nextval
where full_Id like :fullId
</sql>
<sql name="updateOrgSequence">
update SA_OPOrg
set full_sequence = :fullSequence, sequence = :sequence,
version = version_seq.Nextval
where id = :id
</sql>
</query>
</query-mappings>
\ No newline at end of file
...@@ -159,6 +159,7 @@ ...@@ -159,6 +159,7 @@
<junit.version>4.9</junit.version> <junit.version>4.9</junit.version>
<spring-data-mongodb.version>1.9.3.RELEASE</spring-data-mongodb.version> <spring-data-mongodb.version>1.9.3.RELEASE</spring-data-mongodb.version>
<huigou.uasp.version>1.1.3-SNAPSHOT</huigou.uasp.version> <huigou.uasp.version>1.1.3-SNAPSHOT</huigou.uasp.version>
<query.spring.version>1.0.1-SNAPSHOT</query.spring.version>
</properties> </properties>
<dependencyManagement> <dependencyManagement>
...@@ -1953,7 +1954,6 @@ ...@@ -1953,7 +1954,6 @@
<artifactId>spring-data-mongodb</artifactId> <artifactId>spring-data-mongodb</artifactId>
<version>${spring-data-mongodb.version}</version> <version>${spring-data-mongodb.version}</version>
</dependency> </dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
<distributionManagement> <distributionManagement>
......
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