Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
Y
yzg-util
Project
Project
Details
Activity
Releases
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
YZG
yzg-util
Commits
7758a4eb
Commit
7758a4eb
authored
Jun 18, 2019
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
常规BUG的修改
parent
1f2ce7b6
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
186 additions
and
150 deletions
+186
-150
BaseDaoImpl.java
...b/src/main/java/com/yanzuoguang/dao/impl/BaseDaoImpl.java
+5
-0
BaseDaoSql.java
...db/src/main/java/com/yanzuoguang/dao/impl/BaseDaoSql.java
+2
-2
SqlData.java
...il-db/src/main/java/com/yanzuoguang/dao/impl/SqlData.java
+5
-5
SqlDataField.java
.../src/main/java/com/yanzuoguang/dao/impl/SqlDataField.java
+6
-2
TableFieldVo.java
.../src/main/java/com/yanzuoguang/dao/impl/TableFieldVo.java
+15
-1
TableSqlCache.java
...src/main/java/com/yanzuoguang/dao/impl/TableSqlCache.java
+12
-12
TableStruct.java
...b/src/main/java/com/yanzuoguang/dao/impl/TableStruct.java
+141
-128
No files found.
yzg-util-db/src/main/java/com/yanzuoguang/dao/impl/BaseDaoImpl.java
View file @
7758a4eb
...
...
@@ -13,6 +13,11 @@ import java.util.*;
/**
* 数据库操作的基本工具类
* 1. 实现了基本的增删该查
* 2. 实现了统计的增肌和修改
* 3. 实现了一定功能的基本验证,验证数据是否存在
* 4. 数据主键的获取等功能。
* 5. 获取自增等功能
*
* @author 颜佐光
*/
...
...
yzg-util-db/src/main/java/com/yanzuoguang/dao/impl/BaseDaoSql.java
View file @
7758a4eb
...
...
@@ -19,7 +19,7 @@ import java.util.regex.Matcher;
import
java.util.regex.Pattern
;
/**
* SQL语句基本操作类
* SQL语句基本操作类
,包括SQL语句的解析,参数的组装,查询缓存的处理
*
* @author 颜佐光
*/
...
...
@@ -131,7 +131,7 @@ public abstract class BaseDaoSql {
if
(
this
.
table
==
null
)
{
throw
new
CodeException
(
"类"
+
this
.
getClass
().
getName
()
+
"未发现表结构"
);
}
SqlData
sql
=
this
.
table
.
get
Sqls
().
get
(
name
);
SqlData
sql
=
this
.
table
.
get
NameCache
().
get
(
name
);
if
(
isThrow
&&
sql
==
null
)
{
throw
new
CodeException
(
"类"
+
this
.
getClass
().
getName
()
+
"未发现SQL语句"
+
name
);
}
...
...
yzg-util-db/src/main/java/com/yanzuoguang/dao/impl/SqlData.java
View file @
7758a4eb
...
...
@@ -16,11 +16,6 @@ public class SqlData {
*/
private
int
sqlType
=
DaoConst
.
SQL_TYPE_COMMON
;
/**
* 对应的参数顺序
*/
private
List
<
SqlDataField
>
sqlDataFields
=
new
ArrayList
<
SqlDataField
>();
/**
* SQL语句的名称
*/
...
...
@@ -31,6 +26,11 @@ public class SqlData {
*/
private
String
sql
;
/**
* 对应的参数顺序
*/
private
List
<
SqlDataField
>
sqlDataFields
=
new
ArrayList
<
SqlDataField
>();
/**
* 构造函数
*/
...
...
yzg-util-db/src/main/java/com/yanzuoguang/dao/impl/SqlDataField.java
View file @
7758a4eb
package
com
.
yanzuoguang
.
dao
.
impl
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -12,9 +14,11 @@ public class SqlDataField {
/**
* 前台参数名称,当没有前台参数时,则把当前字段当常量代码片段处理
*/
public
String
paraName
=
""
;
public
String
paraName
=
StringHelper
.
EMPTY
;
/**
* 是否根据前台参数自动添加,false时保持永久添加模式
* 是否根据前台参数自动添加,false时保持永久添加模式,
* 1. true为条件模式,即前台不输入参数时,则不增加相关代码片段
* 2. false为敞亮模式,不管前台是否输入,该参数和片段必然会增加到后台执行语句中
*/
public
boolean
auto
=
true
;
/**
...
...
yzg-util-db/src/main/java/com/yanzuoguang/dao/impl/TableFieldVo.java
View file @
7758a4eb
...
...
@@ -28,14 +28,28 @@ public class TableFieldVo {
this
.
type
=
type
;
}
/**
* 表字段的原名称
*/
public
String
name
;
/**
* 表子弹的名称小写
*/
public
String
lName
;
/**
* 前台输入参数的名称
*/
public
String
inputName
;
/**
* 前台输入的参数的小写
*/
public
String
inputLName
;
/**
* 实体的参数的类型
*/
public
Class
<?>
type
=
String
.
class
;
;
}
yzg-util-db/src/main/java/com/yanzuoguang/dao/impl/TableSqlCache.java
View file @
7758a4eb
...
...
@@ -25,19 +25,19 @@ public class TableSqlCache {
public
static
final
String
PAGE_SIZE_TAG
=
"_PageSize"
;
/**
* 表信息
* 表
结构
信息
*/
private
TableStruct
table
;
/**
* 缓存的SQL信息
* 缓存的SQL信息
,按照名称进行缓存
*/
private
MemoryCache
<
SqlData
>
sqls
=
new
MemoryCache
<
SqlData
>();
private
MemoryCache
<
SqlData
>
nameCache
=
new
MemoryCache
<
SqlData
>();
/**
* 根据Sql语句类型进行缓存
* 根据Sql语句类型进行缓存
,按照类型进行缓存
*/
private
MemoryCache
<
List
<
SqlData
>>
sqlTypes
=
new
MemoryCache
<>();
private
MemoryCache
<
List
<
SqlData
>>
typeCache
=
new
MemoryCache
<>();
/**
* 构造函数
...
...
@@ -64,9 +64,9 @@ public class TableSqlCache {
*/
public
SqlData
add
(
SqlData
sql
)
{
if
(
sql
!=
null
)
{
this
.
sqls
.
put
(
sql
.
getName
(),
sql
);
this
.
nameCache
.
put
(
sql
.
getName
(),
sql
);
String
keyType
=
String
.
valueOf
(
sql
.
getSqlType
());
this
.
sqlTypes
.
get
(
keyType
,
new
ArrayList
<>()).
add
(
sql
);
this
.
typeCache
.
get
(
keyType
,
new
ArrayList
<>()).
add
(
sql
);
}
return
sql
;
}
...
...
@@ -80,7 +80,7 @@ public class TableSqlCache {
*/
public
List
<
SqlData
>
getSqlType
(
int
sqlType
)
{
String
keyType
=
String
.
valueOf
(
sqlType
);
return
sqlTypes
.
get
(
keyType
);
return
typeCache
.
get
(
keyType
);
}
/**
...
...
@@ -312,11 +312,11 @@ public class TableSqlCache {
this
.
table
=
table
;
}
public
MemoryCache
<
SqlData
>
get
Sqls
()
{
return
sqls
;
public
MemoryCache
<
SqlData
>
get
NameCache
()
{
return
nameCache
;
}
public
void
set
Sqls
(
MemoryCache
<
SqlData
>
sqls
)
{
this
.
sqls
=
sqls
;
public
void
set
NameCache
(
MemoryCache
<
SqlData
>
nameCache
)
{
this
.
nameCache
=
nameCache
;
}
}
yzg-util-db/src/main/java/com/yanzuoguang/dao/impl/TableStruct.java
View file @
7758a4eb
This diff is collapsed.
Click to expand it.
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