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
648e5ce3
Commit
648e5ce3
authored
Aug 30, 2023
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.3版本修改,增加删除功能
parent
96f6d082
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
14 deletions
+16
-14
DataDaoVoTest.java
yzg-util-base/src/test/java/helper/DataDaoVoTest.java
+14
-12
DaoConst.java
yzg-util-db/src/main/java/com/yanzuoguang/dao/DaoConst.java
+1
-1
TableStruct.java
...b/src/main/java/com/yanzuoguang/dao/impl/TableStruct.java
+1
-1
No files found.
yzg-util-base/src/test/java/helper/DataDaoVoTest.java
View file @
648e5ce3
...
@@ -39,18 +39,19 @@ public class DataDaoVoTest {
...
@@ -39,18 +39,19 @@ public class DataDaoVoTest {
@Test
@Test
public
void
testEn
()
{
public
void
testEn
()
{
int
id
=
1
;
int
id
=
1
;
Temp
last
=
new
Temp
(
id
++,
"产品3"
,
"类型3"
,
4
,
0
);
List
<
Temp
>
his
=
Arrays
.
asList
(
List
<
Temp
>
his
=
Arrays
.
asList
(
new
Temp
(
id
++,
"产品1"
,
"类型1"
,
1
,
0
),
new
Temp
(
id
++,
"产品1"
,
"类型1"
,
1
,
0
),
new
Temp
(
id
++,
"产品1"
,
"类型1"
,
2
,
1
),
new
Temp
(
id
++,
"产品1"
,
"类型1"
,
2
,
1
),
new
Temp
(
id
++,
"产品1"
,
"类型1"
,
3
,
1
),
new
Temp
(
id
++,
"产品1"
,
"类型1"
,
3
,
1
),
new
Temp
(
id
++,
"产品1"
,
"类型1"
,
4
,
1
),
new
Temp
(
id
++,
"产品1"
,
"类型1"
,
4
,
1
),
new
Temp
(
id
++,
"产品2"
,
"类型2"
,
4
,
0
),
new
Temp
(
id
++,
"产品2"
,
"类型2"
,
4
,
0
),
new
Temp
(
id
++,
"产品3"
,
"类型3"
,
4
,
0
)
last
);
);
List
<
Temp
>
now
=
Arrays
.
asList
(
List
<
Temp
>
now
=
Arrays
.
asList
(
new
Temp
(
id
++,
"产品1"
,
"类型1"
,
9
,
0
),
new
Temp
(
id
++,
"产品1"
,
"类型1"
,
9
,
0
),
new
Temp
(
id
++,
"产品2"
,
"类型2"
,
43
,
0
),
new
Temp
(
id
++,
"产品2"
,
"类型2"
,
43
,
0
),
new
Temp
(
id
++,
"产品4"
,
"类型4"
,
95
,
0
)
new
Temp
(
id
++,
"产品4"
,
"类型4"
,
95
,
0
)
);
);
DataDaoVo
<
Temp
>
init
=
DataDaoVo
.
init
(
his
,
now
,
new
DataDaoKey
<
Temp
>()
{
DataDaoVo
<
Temp
>
init
=
DataDaoVo
.
init
(
his
,
now
,
new
DataDaoKey
<
Temp
>()
{
@Override
@Override
...
@@ -58,8 +59,9 @@ public class DataDaoVoTest {
...
@@ -58,8 +59,9 @@ public class DataDaoVoTest {
return
StringHelper
.
getId
(
from
.
productId
,
from
.
productType
);
return
StringHelper
.
getId
(
from
.
productId
,
from
.
productType
);
}
}
});
});
Assert
.
assertEquals
(
init
.
getCreates
().
size
(),
1
);
Assert
.
assertEquals
(
init
.
getCreates
().
size
(),
1
);
Assert
.
assertEquals
(
init
.
getUpdates
().
size
(),
2
);
Assert
.
assertEquals
(
init
.
getUpdates
().
size
(),
2
);
Assert
.
assertEquals
(
init
.
getRemoves
().
size
(),
4
);
Assert
.
assertEquals
(
init
.
getRemoves
().
size
(),
4
);
Assert
.
assertEquals
(
last
.
removeFlag
,
1
);
}
}
}
}
yzg-util-db/src/main/java/com/yanzuoguang/dao/DaoConst.java
View file @
648e5ce3
...
@@ -141,7 +141,7 @@ public class DaoConst {
...
@@ -141,7 +141,7 @@ public class DaoConst {
/**
/**
* 更新字段模板参数
* 更新字段模板参数
*/
*/
public
static
final
String
CODE_UPDATE_FIELD_REMOVE
=
",a.%s=
IFNULL(?,1)
"
;
public
static
final
String
CODE_UPDATE_FIELD_REMOVE
=
",a.%s=
CASE WHEN a.%s THEN 0 AND IFNULL(?,0)=0 THEN 1 ELSE IFNULL(?,1) END
"
;
/**
/**
* 等于条件
* 等于条件
*/
*/
...
...
yzg-util-db/src/main/java/com/yanzuoguang/dao/impl/TableStruct.java
View file @
648e5ce3
...
@@ -692,7 +692,7 @@ public class TableStruct {
...
@@ -692,7 +692,7 @@ public class TableStruct {
// 设置删除标记可以通过前台传入
// 设置删除标记可以通过前台传入
if
(
remove
!=
null
)
{
if
(
remove
!=
null
)
{
sql
.
addParaConst
(
remove
.
inputName
,
sql
.
addParaConst
(
remove
.
inputName
,
CODE_FIELD
,
String
.
format
(
CODE_UPDATE_FIELD_REMOVE
,
remove
.
name
));
CODE_FIELD
,
String
.
format
(
CODE_UPDATE_FIELD_REMOVE
,
remove
.
name
,
remove
.
name
));
}
}
}
}
...
...
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