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
1c3d04f9
Commit
1c3d04f9
authored
Aug 10, 2021
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改实例化关系
parent
aee91ed5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
11 deletions
+14
-11
YzgError.java
...til-base/src/main/java/com/yanzuoguang/util/YzgError.java
+10
-8
BaseDaoSql.java
...db/src/main/java/com/yanzuoguang/dao/impl/BaseDaoSql.java
+4
-3
No files found.
yzg-util-base/src/main/java/com/yanzuoguang/util/YzgError.java
View file @
1c3d04f9
...
...
@@ -13,7 +13,9 @@ public class YzgError {
private
static
YzgErrorData
error
=
new
YzgErrorData
(
"999."
);
private
static
void
init
()
{
error
.
add
(
"001"
,
""
);
error
.
add
(
"001"
,
"该页面未绑定表"
);
error
.
add
(
"002"
,
"类%s未发现表结构"
);
error
.
add
(
"003"
,
"类%未发现SQL语句%s"
);
}
private
static
void
initTemp
()
{
...
...
@@ -36,7 +38,7 @@ public class YzgError {
* @param code
* @param args
*/
public
CodeException
throwException
(
Exception
ex
,
String
code
,
Object
...
args
)
{
public
static
CodeException
throwException
(
Exception
ex
,
String
code
,
Object
...
args
)
{
throw
error
.
getCodeException
(
ex
,
code
,
args
);
}
...
...
@@ -46,7 +48,7 @@ public class YzgError {
* @param code
* @param args
*/
public
CodeException
getException
(
String
code
,
Object
...
args
)
{
public
static
CodeException
getException
(
String
code
,
Object
...
args
)
{
return
error
.
getCodeException
(
null
,
code
,
args
);
}
...
...
@@ -56,7 +58,7 @@ public class YzgError {
* @param code
* @param args
*/
public
CodeException
getException
(
Exception
ex
,
String
code
,
Object
...
args
)
{
public
static
CodeException
getException
(
Exception
ex
,
String
code
,
Object
...
args
)
{
return
error
.
getCodeException
(
ex
,
code
,
args
);
}
...
...
@@ -66,7 +68,7 @@ public class YzgError {
* @param code
* @param args
*/
public
RuntimeCodeException
throwRuntimeException
(
String
code
,
Object
...
args
)
{
public
static
RuntimeCodeException
throwRuntimeException
(
String
code
,
Object
...
args
)
{
throw
error
.
getRuntimeException
(
null
,
code
,
args
);
}
...
...
@@ -76,7 +78,7 @@ public class YzgError {
* @param code
* @param args
*/
public
RuntimeCodeException
throwRuntimeException
(
Exception
ex
,
String
code
,
Object
...
args
)
{
public
static
RuntimeCodeException
throwRuntimeException
(
Exception
ex
,
String
code
,
Object
...
args
)
{
throw
error
.
getRuntimeException
(
ex
,
code
,
args
);
}
...
...
@@ -86,7 +88,7 @@ public class YzgError {
* @param code
* @param args
*/
public
RuntimeCodeException
getRuntimeException
(
String
code
,
Object
...
args
)
{
public
static
RuntimeCodeException
getRuntimeException
(
String
code
,
Object
...
args
)
{
return
error
.
getRuntimeException
(
null
,
code
,
args
);
}
...
...
@@ -96,7 +98,7 @@ public class YzgError {
* @param code
* @param args
*/
public
RuntimeCodeException
getRuntimeException
(
Exception
ex
,
String
code
,
Object
...
args
)
{
public
static
RuntimeCodeException
getRuntimeException
(
Exception
ex
,
String
code
,
Object
...
args
)
{
return
error
.
getRuntimeException
(
ex
,
code
,
args
);
}
...
...
yzg-util-db/src/main/java/com/yanzuoguang/dao/impl/BaseDaoSql.java
View file @
1c3d04f9
...
...
@@ -5,6 +5,7 @@ import com.yanzuoguang.dao.QueryPara;
import
com.yanzuoguang.dao.TableAnnotation
;
import
com.yanzuoguang.db.DbExecute
;
import
com.yanzuoguang.db.impl.DbRow
;
import
com.yanzuoguang.util.YzgError
;
import
com.yanzuoguang.util.base.ObjectHelper
;
import
com.yanzuoguang.util.cache.MemoryCache
;
import
com.yanzuoguang.util.helper.ArrayHelper
;
...
...
@@ -114,7 +115,7 @@ public abstract class BaseDaoSql {
protected
TableSqlCache
register
(
Class
<?>
clsModel
)
{
TableAnnotation
annotation
=
clsModel
.
getAnnotation
(
TableAnnotation
.
class
);
if
(
annotation
==
null
)
{
throw
new
RuntimeException
(
"该页面未绑定表
"
);
throw
YzgError
.
getRuntimeException
(
"001
"
);
}
return
this
.
register
(
annotation
.
value
(),
clsModel
);
}
...
...
@@ -152,11 +153,11 @@ public abstract class BaseDaoSql {
*/
public
SqlData
getSql
(
String
name
,
boolean
isThrow
)
{
if
(
this
.
table
==
null
)
{
throw
new
RuntimeException
(
"类"
+
this
.
getClass
().
getName
()
+
"未发现表结构"
);
throw
YzgError
.
getRuntimeException
(
"002"
,
this
.
getClass
().
getName
()
);
}
SqlData
sql
=
this
.
table
.
getNameCache
().
get
(
name
);
if
(
isThrow
&&
sql
==
null
)
{
throw
new
RuntimeException
(
"类"
+
this
.
getClass
().
getName
()
+
"未发现SQL语句"
+
name
);
throw
YzgError
.
getRuntimeException
(
"003"
,
this
.
getClass
().
getName
(),
name
);
}
return
sql
;
}
...
...
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