Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
yangxiujun
/
paidan_demo
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 309b416f
authored
Jul 24, 2023
by
丁伟峰
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop' into develop
2 parents
b3f05263
9c0965db
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
2 deletions
project-order/src/main/java/com/dituhui/pea/order/service/impl/EngineerBusinessServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/EngineerBusinessServiceImpl.java
View file @
309b416
...
@@ -8,12 +8,14 @@ import com.dituhui.pea.order.dto.EngineerBusinessDTO;
...
@@ -8,12 +8,14 @@ import com.dituhui.pea.order.dto.EngineerBusinessDTO;
import
com.dituhui.pea.order.entity.*
;
import
com.dituhui.pea.order.entity.*
;
import
com.dituhui.pea.order.service.EngineerBusinessService
;
import
com.dituhui.pea.order.service.EngineerBusinessService
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.jdbc.core.BeanPropertyRowMapper
;
import
org.springframework.jdbc.core.BeanPropertyRowMapper
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.jdbc.core.RowMapper
;
import
org.springframework.jdbc.core.RowMapper
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -43,10 +45,25 @@ public class EngineerBusinessServiceImpl implements EngineerBusinessService {
...
@@ -43,10 +45,25 @@ public class EngineerBusinessServiceImpl implements EngineerBusinessService {
public
List
<
EngineerBusinessDTO
.
Engineer
>
getEngineerCenterList
(
EngineerBusinessDTO
.
Request
engineerReq
)
{
public
List
<
EngineerBusinessDTO
.
Engineer
>
getEngineerCenterList
(
EngineerBusinessDTO
.
Request
engineerReq
)
{
String
sql
=
"select a.engineer_code , b.address, b.x, b.y from engineer_info a left join engineer_business b on a.engineer_code= b.engineer_code\n"
+
String
sql
=
"select a.engineer_code , b.address, b.x, b.y from engineer_info a left join engineer_business b on a.engineer_code= b.engineer_code\n"
+
" where a.group_id=?"
;
" where a.group_id=? "
;
List
<
Object
>
params
=
new
ArrayList
<>();
params
.
add
(
engineerReq
.
getLevelValue
());
if
(
StringUtils
.
isNotEmpty
(
engineerReq
.
getKind
()))
{
if
(
"fullJob"
.
equals
(
engineerReq
.
getKind
()))
{
sql
=
sql
+
" and a.kind=1 "
;
}
else
if
(
"partJob"
.
equals
(
engineerReq
.
getKind
()))
{
sql
=
sql
+
" and a.kind=2 "
;
}
}
if
(
StringUtils
.
isNotEmpty
(
engineerReq
.
getKey
()))
{
sql
=
sql
+
" and (a.engineer_code like ? or a.name like ? ) "
;
params
.
add
(
"%"
+
engineerReq
.
getKey
()
+
"%"
);
params
.
add
(
"%"
+
engineerReq
.
getKey
()
+
"%"
);
}
// 创建一个新的BeanPropertyRowMapper对象
// 创建一个新的BeanPropertyRowMapper对象
RowMapper
<
EngineerBusinessEntity
>
rowMapper
=
new
BeanPropertyRowMapper
<>(
EngineerBusinessEntity
.
class
);
RowMapper
<
EngineerBusinessEntity
>
rowMapper
=
new
BeanPropertyRowMapper
<>(
EngineerBusinessEntity
.
class
);
List
<
EngineerBusinessEntity
>
engineerEntiryList
=
this
.
jdbcTemplate
.
query
(
sql
,
rowMapper
,
engineerReq
.
getLevelValue
()
);
List
<
EngineerBusinessEntity
>
engineerEntiryList
=
this
.
jdbcTemplate
.
query
(
sql
,
params
.
toArray
(),
rowMapper
);
Map
<
String
,
String
>
codeNameMap
=
engineerInfoDao
.
findByGroupId
(
engineerReq
.
getLevelValue
()).
stream
().
collect
(
Collectors
.
toMap
(
EngineerInfoEntity:
:
getEngineerCode
,
EngineerInfoEntity:
:
getName
));
Map
<
String
,
String
>
codeNameMap
=
engineerInfoDao
.
findByGroupId
(
engineerReq
.
getLevelValue
()).
stream
().
collect
(
Collectors
.
toMap
(
EngineerInfoEntity:
:
getEngineerCode
,
EngineerInfoEntity:
:
getName
));
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment