Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
T
test
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
邬友楠
test
Commits
0e94b7ab
Commit
0e94b7ab
authored
Dec 25, 2019
by
雍欢
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
自定义查询SQL方言
parent
01bd2920
Show whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
953 additions
and
435 deletions
+953
-435
ApplicationContextWrapper.java
.../main/java/com/huigou/util/ApplicationContextWrapper.java
+12
-2
Agent.java
...ava/com/huigou/uasp/bmp/opm/domain/model/agent/Agent.java
+2
-0
VersionListener.java
...java/com/huigou/data/domain/listener/VersionListener.java
+8
-18
AbstractEntity.java
...ain/java/com/huigou/data/domain/model/AbstractEntity.java
+6
-1
QueryXmlModel.java
...ta/src/main/java/com/huigou/data/query/QueryXmlModel.java
+16
-0
SQLExecutorDaoImpl.java
...m/huigou/data/query/executor/impl/SQLExecutorDaoImpl.java
+2
-2
QueryDescriptor.java
...ain/java/com/huigou/data/query/model/QueryDescriptor.java
+39
-14
SQLBuilder.java
...rc/main/java/com/huigou/data/query/parser/SQLBuilder.java
+9
-10
SQLBuilderImpl.java
...ava/com/huigou/data/query/parser/impl/SQLBuilderImpl.java
+1
-0
GeneralRepositorySuper.java
...va/com/huigou/data/repository/GeneralRepositorySuper.java
+6
-1
pom.xml
huigou-uasp/pom.xml
+368
-368
BpmProcessNodeFunction.java
.../bizconfig/chart/domain/model/BpmProcessNodeFunction.java
+1
-0
MaxSerialApplicationImpl.java
...codingrule/application/impl/MaxSerialApplicationImpl.java
+10
-10
QueryXmlManager.java
...ava/com/huigou/uasp/bmp/common/query/QueryXmlManager.java
+8
-8
OpdatamanagebusinessField.java
...mp/dataManage/domain/model/OpdatamanagebusinessField.java
+1
-0
Opdatamanagedetailresource.java
...p/dataManage/domain/model/Opdatamanagedetailresource.java
+1
-0
Opdatamanagement.java
...ou/uasp/bmp/dataManage/domain/model/Opdatamanagement.java
+1
-0
bpm.xml
...sp/src/main/resources/config/uasp/query/bmp/mysql/bpm.xml
+12
-0
common.xml
...src/main/resources/config/uasp/query/bmp/mysql/common.xml
+46
-0
opm.xml
...sp/src/main/resources/config/uasp/query/bmp/mysql/opm.xml
+86
-0
org.xml
...sp/src/main/resources/config/uasp/query/bmp/mysql/org.xml
+86
-0
bpm.xml
...p/src/main/resources/config/uasp/query/bmp/oracle/bpm.xml
+12
-0
common.xml
...rc/main/resources/config/uasp/query/bmp/oracle/common.xml
+46
-0
opm.xml
...p/src/main/resources/config/uasp/query/bmp/oracle/opm.xml
+87
-0
org.xml
...p/src/main/resources/config/uasp/query/bmp/oracle/org.xml
+86
-0
pom.xml
pom.xml
+1
-1
No files found.
huigou-common/src/main/java/com/huigou/util/ApplicationContextWrapper.java
View file @
0e94b7ab
...
...
@@ -54,4 +54,14 @@ public class ApplicationContextWrapper {
}
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
);
}
}
huigou-core-api/src/main/java/com/huigou/uasp/bmp/opm/domain/model/agent/Agent.java
View file @
0e94b7ab
...
...
@@ -159,10 +159,12 @@ public class Agent extends AbstractEntity {
this
.
remark
=
remark
;
}
@Override
public
List
<
AgentProc
>
getDetails
()
{
return
details
;
}
@Override
@SuppressWarnings
(
"unchecked"
)
public
void
setDetails
(
List
<?
extends
AbstractEntity
>
details
)
{
this
.
details
=
(
List
<
AgentProc
>)
details
;
...
...
huigou-data/src/main/java/com/huigou/data/domain/listener/VersionListener.java
View file @
0e94b7ab
package
com
.
huigou
.
data
.
domain
.
listener
;
import
com.huigou.data.
jdbc.SQLQuery
;
import
com.huigou.data.
repository.GeneralRepositorySupe
r
;
import
com.huigou.data.
query.executor.SQLExecutorDao
;
import
com.huigou.data.
query.model.QueryDescripto
r
;
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
{
@Deprecated
public
final
static
String
GET_NEXT_SEQ_SQL
=
"SELECT version_seq.nextval from DUAL"
;
private
boolean
inited
=
false
;
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
;
}
Long
version
=
sqlQuery
.
getJDBCDao
().
queryToLong
(
GET_NEXT_SEQ_SQL
);
SQLExecutorDao
sqlExecutor
=
ApplicationContextWrapper
.
getBean
(
"sqlExecutorDao"
,
SQLExecutorDao
.
class
);
QueryDescriptor
queryDescriptor
=
sqlExecutor
.
getQuery
(
"config/uasp/query/bmp/common.xml"
,
"common"
);
Long
version
=
sqlExecutor
.
getSqlQuery
().
getJDBCDao
().
queryToLong
(
queryDescriptor
.
getSqlByName
(
"nextVersion"
));
return
version
;
}
@PrePersist
public
void
beforeCreate
(
IdentifiedEntity
target
)
{
//
target.setVersion(getNextId());
target
.
setVersion
(
getNextId
());
}
@PreUpdate
public
void
beforeUpdate
(
IdentifiedEntity
target
)
{
//
target.setVersion(getNextId());
target
.
setVersion
(
getNextId
());
}
}
huigou-data/src/main/java/com/huigou/data/domain/model/AbstractEntity.java
View file @
0e94b7ab
...
...
@@ -46,7 +46,6 @@ public abstract class AbstractEntity implements IdentifiedEntity, Serializable {
/**
* 实体版本号
*/
@GeneratedValue
(
strategy
=
GenerationType
.
TABLE
)
private
Long
version
;
@Transient
...
...
@@ -55,10 +54,12 @@ public abstract class AbstractEntity implements IdentifiedEntity, Serializable {
@Transient
private
List
<?
extends
AbstractEntity
>
inputDetails_
;
@Override
public
String
getId
()
{
return
id
;
}
@Override
public
void
setId
(
String
id
)
{
if
(
""
.
equals
(
id
))
{
id
=
null
;
...
...
@@ -66,10 +67,12 @@ public abstract class AbstractEntity implements IdentifiedEntity, Serializable {
this
.
id
=
id
;
}
@Override
public
Long
getVersion
()
{
return
this
.
version
;
}
@Override
public
void
setVersion
(
Long
version
)
{
this
.
version
=
version
;
}
...
...
@@ -105,6 +108,7 @@ public abstract class AbstractEntity implements IdentifiedEntity, Serializable {
return
id
==
null
?
0
:
id
.
hashCode
();
}
@Override
@JsonIgnore
public
boolean
isNew
()
{
return
StringUtil
.
isBlank
(
this
.
id
);
...
...
@@ -191,6 +195,7 @@ public abstract class AbstractEntity implements IdentifiedEntity, Serializable {
return
updateFields_
;
}
@Override
public
void
setUpdateFields_
(
Collection
<
String
>
names
)
{
if
(
names
!=
null
&&
names
.
size
()
>
0
)
{
this
.
updateFields_
=
names
.
toArray
(
new
String
[
names
.
size
()]);
...
...
huigou-data/src/main/java/com/huigou/data/query/QueryXmlModel.java
View file @
0e94b7ab
...
...
@@ -59,12 +59,28 @@ public class QueryXmlModel implements Serializable, ConfigFileVersion {
return
querys
.
get
(
0
);
}
/**
* @deprecated 已被 {@link #getDeclaredQueries(String)} 替代。
*/
@Deprecated
public
Query
getQuery
(
String
name
)
{
return
querys
.
stream
().
map
(
query
->
query
.
get
(
name
))
.
filter
(
Objects:
:
nonNull
)
.
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
)
{
this
.
version
=
version
;
}
...
...
huigou-data/src/main/java/com/huigou/data/query/executor/impl/SQLExecutorDaoImpl.java
View file @
0e94b7ab
...
...
@@ -59,7 +59,7 @@ public class SQLExecutorDaoImpl extends JDBCDaoImpl implements SQLExecutorDao {
@Override
public
QueryDescriptor
getQuery
(
String
queryFilePath
,
String
queryName
)
{
QueryXmlModel
model
=
getQueryXmlModel
(
queryFilePath
);
QueryDescriptor
queryDescriptor
=
new
QueryDescriptor
(
model
.
get
Query
(
queryName
));
QueryDescriptor
queryDescriptor
=
new
QueryDescriptor
(
model
.
get
DeclaredQueries
(
queryName
));
return
queryDescriptor
;
}
...
...
@@ -93,7 +93,7 @@ public class SQLExecutorDaoImpl extends JDBCDaoImpl implements SQLExecutorDao {
@Override
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
.
setQueryParams
(
executor
.
parseParamMap
());
queryModel
.
setSql
(
executor
.
getSql
());
...
...
huigou-data/src/main/java/com/huigou/data/query/model/QueryDescriptor.java
View file @
0e94b7ab
...
...
@@ -3,7 +3,10 @@ package com.huigou.data.query.model;
import
com.huigou.data.query.XMLParseUtil
;
import
com.huigou.exception.NotFoundException
;
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
;
/**
* 查询模型描述符
...
...
@@ -13,38 +16,60 @@ import com.huigou.uasp.bmp.query.SqlDocument.Sql;
public
class
QueryDescriptor
{
private
Query
query
;
private
List
<
Query
>
queries
;
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
()
{
return
query
;
// 优先从方言xml中取
return
queries
.
stream
().
findFirst
().
get
();
}
public
void
setQuery
(
Query
query
)
{
this
.
quer
y
=
query
;
this
.
quer
ies
=
Collections
.
singletonList
(
query
)
;
}
public
String
getName
()
{
return
query
.
getName
();
return
getQuery
()
.
getName
();
}
public
String
getLabel
()
{
return
query
.
getLabel
();
return
getQuery
()
.
getLabel
();
}
public
String
getSql
()
{
return
query
.
getSqlQuery
();
return
getQuery
()
.
getSqlQuery
();
}
public
String
getSqlByName
(
String
sqlName
)
{
for
(
Sql
sql
:
query
.
getSqlArray
())
{
if
(
sql
.
getName
().
equals
(
sqlName
)
)
{
return
XMLParseUtil
.
getNodeTextValue
(
sql
);
Query
query
=
getQuery
(
sqlName
);
if
(
query
==
null
)
{
throw
new
NotFoundException
(
String
.
format
(
"实体%s中没有SQL(%s)的配置!"
,
queries
.
get
(
0
).
getName
(),
sqlName
)
);
}
return
XMLParseUtil
.
getNodeTextValue
(
query
);
}
throw
new
NotFoundException
(
String
.
format
(
"实体%s中没有SQL(%s)的配置!"
,
query
.
getName
(),
sqlName
));
}
}
huigou-data/src/main/java/com/huigou/data/query/parser/SQLBuilder.java
View file @
0e94b7ab
...
...
@@ -2,6 +2,7 @@ package com.huigou.data.query.parser;
import
com.huigou.data.domain.query.QueryAbstractRequest
;
import
com.huigou.data.query.SQLExecutor
;
import
com.huigou.data.query.model.QueryDescriptor
;
import
com.huigou.uasp.bmp.query.QueryDocument.Query
;
public
interface
SQLBuilder
{
...
...
@@ -9,32 +10,30 @@ public interface SQLBuilder {
/**
* 构造查询SQL语句
*
* @param entity
* 实体文档对象
* @param queryRequest
* 参数
* @param entity 实体文档对象
* @param queryRequest 参数
* @return
*/
public
SQLExecutor
buildQuerySql
(
Query
query
,
QueryAbstractRequest
queryRequest
);
SQLExecutor
buildQuerySql
(
Query
query
,
QueryAbstractRequest
queryRequest
);
/**
* 根据SQLName获取配置在实体中的sql语句
*
* @author
* @param entity
* @param sqlName
* @return String
* @author
*/
public
String
getSqlByName
(
Query
query
,
String
sqlName
);
/**
* 根据SQLName获取配置在实体中的sql语句,并构造SQL
*
* @author
* @param entity
* @param sqlName
* @param queryRequest
* @return SQLExecutor
* @author
*/
public
SQLExecutor
buildSqlByName
(
Query
query
,
String
sqlName
,
QueryAbstractRequest
queryRequest
);
}
\ No newline at end of file
huigou-data/src/main/java/com/huigou/data/query/parser/impl/SQLBuilderImpl.java
View file @
0e94b7ab
...
...
@@ -7,6 +7,7 @@ import com.huigou.data.domain.query.QueryAbstractRequest;
import
com.huigou.data.query.QueryPermissionBuilder
;
import
com.huigou.data.query.SQLExecutor
;
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.model.ConditionModel
;
import
com.huigou.data.query.parser.model.DataFilterGroup
;
...
...
huigou-data/src/main/java/com/huigou/data/repository/GeneralRepositorySuper.java
View file @
0e94b7ab
...
...
@@ -42,6 +42,9 @@ import javax.persistence.criteria.Path;
import
javax.persistence.criteria.Predicate
;
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.data.domain.Page
;
import
org.springframework.data.domain.PageImpl
;
...
...
@@ -813,7 +816,9 @@ abstract public class GeneralRepositorySuper {
}
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
();
return
result
.
longValue
();
}
...
...
huigou-uasp/pom.xml
View file @
0e94b7ab
huigou-uasp/src/main/java/com/huigou/uasp/bmp/bizconfig/chart/domain/model/BpmProcessNodeFunction.java
View file @
0e94b7ab
...
...
@@ -145,6 +145,7 @@ public class BpmProcessNodeFunction extends AbstractEntity {
this
.
isFunction
=
isFunction
;
}
@Override
public
void
checkConstraints
()
{
Assert
.
hasText
(
viewId
,
"节点ID不能为空!"
);
Assert
.
hasText
(
businessProcessId
,
"流程ID不能为空!"
);
...
...
huigou-uasp/src/main/java/com/huigou/uasp/bmp/codingrule/application/impl/MaxSerialApplicationImpl.java
View file @
0e94b7ab
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.model.QueryDescriptor
;
import
com.huigou.uasp.bmp.codingrule.application.MaxSerialApplication
;
import
com.huigou.uasp.bmp.codingrule.domain.query.CodingRuleDetailDesc
;
import
com.huigou.uasp.bmp.codingrule.repository.MaxSerialRepository
;
...
...
@@ -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.util.CommonUtil
;
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"
)
public
class
MaxSerialApplicationImpl
implements
MaxSerialApplication
{
...
...
@@ -198,7 +197,8 @@ public class MaxSerialApplicationImpl implements MaxSerialApplication {
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
(),
""
,
codingRuleDetailDesc
.
getInitialValue
(),
version
);
...
...
huigou-uasp/src/main/java/com/huigou/uasp/bmp/common/query/QueryXmlManager.java
View file @
0e94b7ab
...
...
@@ -9,10 +9,8 @@ import com.huigou.util.ResourceLoadManager;
import
org.apache.commons.io.IOUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.xmlbeans.XmlException
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.core.io.ClassPathResource
;
import
org.springframework.core.io.Resource
;
import
org.springframework.util.Assert
;
import
java.io.IOException
;
import
java.io.InputStream
;
...
...
@@ -28,13 +26,20 @@ import java.util.stream.Collectors;
*
* @author xx
*/
public
class
QueryXmlManager
extends
ResourceLoadManager
<
QueryXmlModel
>
implements
QueryXmlLoadInterface
,
InitializingBean
{
public
class
QueryXmlManager
extends
ResourceLoadManager
<
QueryXmlModel
>
implements
QueryXmlLoadInterface
{
/**
* SQL 方言。
*
* @since 1.1.3
*/
private
String
sqlDialect
;
/**
* 设置SQL方言。
*
* @since 1.1.3
*/
public
void
setSqlDialect
(
String
sqlDialect
)
{
this
.
sqlDialect
=
sqlDialect
;
}
...
...
@@ -91,9 +96,4 @@ public class QueryXmlManager extends ResourceLoadManager<QueryXmlModel> implemen
Path
dialectXmlPath
=
filePath
.
getParent
().
resolve
(
sqlDialect
).
resolve
(
filePath
.
getFileName
());
return
dialectXmlPath
.
toString
();
}
@Override
public
void
afterPropertiesSet
()
throws
Exception
{
Assert
.
hasText
(
sqlDialect
,
"sql方言不能为空"
);
}
}
\ No newline at end of file
huigou-uasp/src/main/java/com/huigou/uasp/bmp/dataManage/domain/model/OpdatamanagebusinessField.java
View file @
0e94b7ab
...
...
@@ -189,6 +189,7 @@ public class OpdatamanagebusinessField extends AbstractEntity {
this
.
sequence
=
sequence
;
}
@Override
public
void
checkConstraints
()
{
Assert
.
hasText
(
datamanagebusinessId
,
"datamanagebusinessId不能为空!"
);
Assert
.
hasText
(
dataKindCode
,
"dataKindCode不能为空!"
);
...
...
huigou-uasp/src/main/java/com/huigou/uasp/bmp/dataManage/domain/model/Opdatamanagedetailresource.java
View file @
0e94b7ab
...
...
@@ -133,6 +133,7 @@ public class Opdatamanagedetailresource extends AbstractEntity {
this
.
orgDataKind
=
orgDataKind
;
}
@Override
public
void
checkConstraints
()
{
Assert
.
hasText
(
dataManagedetalId
,
"dataManagedetalId不能为空!"
);
Assert
.
hasText
(
dataKindId
,
"dataKindId不能为空!"
);
...
...
huigou-uasp/src/main/java/com/huigou/uasp/bmp/dataManage/domain/model/Opdatamanagement.java
View file @
0e94b7ab
...
...
@@ -82,6 +82,7 @@ public class Opdatamanagement extends AbstractEntity {
this
.
creator
=
creator
;
}
@Override
public
void
checkConstraints
()
{
Assert
.
hasText
(
dataManageId
,
"管理权限类别ID不能为空!"
);
Assert
.
hasText
(
dataManagedetalId
,
"管理权限数据取值定义ID不能为空!"
);
...
...
huigou-uasp/src/main/resources/config/uasp/query/bmp/mysql/bpm.xml
0 → 100644
View file @
0e94b7ab
<?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
huigou-uasp/src/main/resources/config/uasp/query/bmp/mysql/common.xml
0 → 100644
View file @
0e94b7ab
<?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
huigou-uasp/src/main/resources/config/uasp/query/bmp/mysql/opm.xml
0 → 100644
View file @
0e94b7ab
<?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
huigou-uasp/src/main/resources/config/uasp/query/bmp/mysql/org.xml
0 → 100644
View file @
0e94b7ab
<?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
huigou-uasp/src/main/resources/config/uasp/query/bmp/oracle/bpm.xml
0 → 100644
View file @
0e94b7ab
<?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
huigou-uasp/src/main/resources/config/uasp/query/bmp/oracle/common.xml
0 → 100644
View file @
0e94b7ab
<?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
huigou-uasp/src/main/resources/config/uasp/query/bmp/oracle/opm.xml
0 → 100644
View file @
0e94b7ab
<?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
huigou-uasp/src/main/resources/config/uasp/query/bmp/oracle/org.xml
0 → 100644
View file @
0e94b7ab
<?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
pom.xml
View file @
0e94b7ab
...
...
@@ -159,6 +159,7 @@
<junit.version>
4.9
</junit.version>
<spring-data-mongodb.version>
1.9.3.RELEASE
</spring-data-mongodb.version>
<huigou.uasp.version>
1.1.3-SNAPSHOT
</huigou.uasp.version>
<query.spring.version>
1.0.1-SNAPSHOT
</query.spring.version>
</properties>
<dependencyManagement>
...
...
@@ -1953,7 +1954,6 @@
<artifactId>
spring-data-mongodb
</artifactId>
<version>
${spring-data-mongodb.version}
</version>
</dependency>
</dependencies>
</dependencyManagement>
<distributionManagement>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment