Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
schbrain-parent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
framework
schbrain-parent
Commits
1215e1bc
Commit
1215e1bc
authored
Jan 17, 2024
by
liaozan
🏀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
entity to dto
parent
e6e05305
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
4 deletions
+25
-4
starters/mybatis-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/mybatis/base/BaseServiceExtImpl.java
...mework/autoconfigure/mybatis/base/BaseServiceExtImpl.java
+25
-4
No files found.
starters/mybatis-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/mybatis/base/BaseServiceExtImpl.java
View file @
1215e1bc
package
com.schbrain.framework.autoconfigure.mybatis.base
;
package
com.schbrain.framework.autoconfigure.mybatis.base
;
import
com.schbrain.common.util.BeanCopyUtils
;
import
com.schbrain.common.util.BeanCopyUtils
;
import
com.schbrain.common.util.StreamUtils
;
import
org.springframework.core.ResolvableType
;
import
org.springframework.core.ResolvableType
;
import
java.util.List
;
import
java.util.List
;
...
@@ -19,19 +20,39 @@ public class BaseServiceExtImpl<M extends BaseMapper<Source>, Source extends Bas
...
@@ -19,19 +20,39 @@ public class BaseServiceExtImpl<M extends BaseMapper<Source>, Source extends Bas
}
}
protected
Target
toTarget
(
Source
entity
)
{
protected
Target
toTarget
(
Source
entity
)
{
return
BeanCopyUtils
.
copy
(
entity
,
targetType
);
Target
target
=
BeanCopyUtils
.
copy
(
entity
,
targetType
);
return
toTarget
(
entity
,
target
);
}
protected
Target
toTarget
(
Source
source
,
Target
target
)
{
editTarget
(
source
,
target
);
return
target
;
}
protected
void
editTarget
(
Source
source
,
Target
target
)
{
}
}
protected
List
<
Target
>
toTargetList
(
List
<
Source
>
entityList
)
{
protected
List
<
Target
>
toTargetList
(
List
<
Source
>
entityList
)
{
return
BeanCopyUtils
.
copyList
(
entityList
,
targetType
);
return
StreamUtils
.
toList
(
entityList
,
this
::
toTarget
);
}
}
protected
Source
fromTarget
(
Target
target
)
{
protected
Source
fromTarget
(
Target
target
)
{
return
BeanCopyUtils
.
copy
(
target
,
entityClass
);
Source
source
=
BeanCopyUtils
.
copy
(
target
,
entityClass
);
return
fromTarget
(
source
,
target
);
}
protected
Source
fromTarget
(
Source
source
,
Target
target
)
{
editSource
(
source
,
target
);
return
source
;
}
protected
void
editSource
(
Source
source
,
Target
target
)
{
}
}
protected
List
<
Source
>
fromTargetList
(
List
<
Target
>
targetList
)
{
protected
List
<
Source
>
fromTargetList
(
List
<
Target
>
targetList
)
{
return
BeanCopyUtils
.
copyList
(
targetList
,
entityClass
);
return
StreamUtils
.
toList
(
targetList
,
this
::
fromTarget
);
}
}
}
}
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