Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
store-system
Project
Project
Details
Activity
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
luoyangfei
store-system
Commits
c77e605f
Commit
c77e605f
authored
Nov 16, 2018
by
wangyihao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增 mapper 修改推荐员工
parent
75a36aea
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
92 additions
and
26 deletions
+92
-26
IndexController.java
...main/java/cn/com/fqy/controller/mapi/IndexController.java
+43
-25
WorkerDao.java
...e-system/src/main/java/cn/com/fqy/core/dao/WorkerDao.java
+8
-1
WorkerService.java
.../src/main/java/cn/com/fqy/core/service/WorkerService.java
+7
-0
WorkerServiceImpl.java
.../java/cn/com/fqy/core/service/impl/WorkerServiceImpl.java
+24
-0
WorkerMapper.xml
...system/src/main/resources/mybatis/mapper/WorkerMapper.xml
+10
-0
No files found.
2code/server/store-system/src/main/java/cn/com/fqy/controller/mapi/IndexController.java
View file @
c77e605f
package
cn
.
com
.
fqy
.
controller
.
mapi
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -44,15 +45,15 @@ public class IndexController {
*/
@RequestMapping
(
"getAdvertList"
)
@ResponseBody
public
ResultInfo
<
List
<
Map
<
String
,
Object
>>>
getAdvertList
()
{
ResultInfo
<
List
<
Map
<
String
,
Object
>>>
resultInfo
=
new
ResultInfo
<>();
List
<
Map
<
String
,
Object
>>
listQuery
=
new
ArrayList
<>();
public
ResultInfo
<
List
<
Map
<
String
,
Object
>>>
getAdvertList
()
{
ResultInfo
<
List
<
Map
<
String
,
Object
>>>
resultInfo
=
new
ResultInfo
<>();
List
<
Map
<
String
,
Object
>>
listQuery
=
new
ArrayList
<>();
Advert
advert
=
new
Advert
();
advert
.
setIsAvailable
(
1
);
// 可用
List
<
Advert
>
advList
=
advertService
.
getAdvertList
(
new
Query
(
advert
));
if
(
null
!=
advList
&&
advList
.
size
()
>
0
)
{
for
(
Advert
list:
advList
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
for
(
Advert
list
:
advList
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"advertId"
,
list
.
getAdvertId
());
map
.
put
(
"advertPicUrl"
,
list
.
getAdvertPicUrl
());
map
.
put
(
"advertContent"
,
list
.
getAdvertContent
());
...
...
@@ -80,15 +81,15 @@ public class IndexController {
store
.
setIsDeleted
(
0
);
// 未删除
store
.
setIsAuditing
(
1
);
// 店铺启用状态
store
.
setIsShopping
(
1
);
// 店铺展示状态
List
<
Store
>
stoList
=
storeService
.
getStoreList
(
new
Query
(
store
));
List
<
Store
>
stoList
=
storeService
.
getStoreList
(
new
Query
(
store
));
if
(
null
!=
stoList
&&
stoList
.
size
()
>
0
)
{
int
number
=
0
;
if
(
stoList
.
size
()>
3
)
{
number
=
3
;
}
else
{
number
=
stoList
.
size
();
int
number
=
0
;
if
(
stoList
.
size
()
>
3
)
{
number
=
3
;
}
else
{
number
=
stoList
.
size
();
}
for
(
int
i
=
0
;
i
<
number
;
i
++)
{
for
(
int
i
=
0
;
i
<
number
;
i
++)
{
listQuery
.
add
(
stoList
.
get
(
i
));
}
resultInfo
.
setData
(
listQuery
);
...
...
@@ -106,25 +107,42 @@ public class IndexController {
*/
@RequestMapping
(
"getWorkerList"
)
@ResponseBody
public
ResultInfo
<
List
<
Worker
>>
getWorkerList
(
Worker
worker
)
{
public
ResultInfo
<
List
<
Worker
>>
getWorkerList
(
String
cityId
)
{
ResultInfo
<
List
<
Worker
>>
resultInfo
=
new
ResultInfo
<
List
<
Worker
>>();
List
<
Worker
>
listQuery
=
new
ArrayList
<>();
worker
.
setIsDeleted
(
0
);
// 未删除
worker
.
setIsShopping
(
1
);
// 员工展示状态
worker
.
setIsAuditing
(
1
);
List
<
Worker
>
workerList
=
workerService
.
getWorkerList
(
new
Query
(
worker
));
List
<
String
>
stoListQuery
=
new
ArrayList
<>();
if
(
cityId
==
null
||
""
.
equals
(
cityId
))
{
resultInfo
.
setCode
(
"0"
);
resultInfo
.
setMsg
(
"市 ID 参数为空"
);
return
resultInfo
;
}
Store
store
=
new
Store
();
store
.
setCityId
(
cityId
);
// 通过城市ID查询返回店铺ID
List
<
Store
>
stoList
=
storeService
.
getStoreList
(
new
Query
(
store
));
if
(
stoList
!=
null
&&
stoList
.
size
()
>
0
)
{
for
(
Store
list
:
stoList
)
{
stoListQuery
.
add
(
list
.
getStoreId
());
}
}
else
{
resultInfo
.
setCode
(
Constant
.
FAIL
);
resultInfo
.
setMsg
(
"暂无数据"
);
return
resultInfo
;
}
// 将storeId的集合转换数组
String
[]
strArray
=
stoListQuery
.
toArray
(
new
String
[
stoListQuery
.
size
()]);
// 通过storeId查询返回员工列表
List
<
Worker
>
workerList
=
workerService
.
getWorkerSByIds
(
strArray
);
if
(
null
!=
workerList
&&
workerList
.
size
()
>
0
)
{
int
number
=
0
;
if
(
workerList
.
size
()>
9
)
{
number
=
9
;
}
else
{
number
=
workerList
.
size
();
int
number
=
0
;
if
(
workerList
.
size
()
>
9
)
{
number
=
9
;
}
else
{
number
=
workerList
.
size
();
}
for
(
int
i
=
0
;
i
<
number
;
i
++)
{
for
(
int
i
=
0
;
i
<
number
;
i
++)
{
listQuery
.
add
(
workerList
.
get
(
i
));
}
resultInfo
.
setData
(
listQuery
);
resultInfo
.
setCode
(
Constant
.
SUCCESS
);
resultInfo
.
setMsg
(
"请求成功"
);
...
...
2code/server/store-system/src/main/java/cn/com/fqy/core/dao/WorkerDao.java
View file @
c77e605f
package
cn
.
com
.
fqy
.
core
.
dao
;
import
java.util.List
;
import
cn.com.fqy.core.common.BaseDao
;
import
cn.com.fqy.core.model.Worker
;
...
...
@@ -7,5 +9,10 @@ import cn.com.fqy.core.model.Worker;
* Worker 数据库处理类
*/
public
interface
WorkerDao
extends
BaseDao
<
Worker
,
String
>
{
/**
* 根据 一组ID 查询返回一个对象集合
* @param ids
* @return
*/
public
List
<
Worker
>
getWorkerByIds
(
String
[]
ids
);
}
2code/server/store-system/src/main/java/cn/com/fqy/core/service/WorkerService.java
View file @
c77e605f
...
...
@@ -78,4 +78,11 @@ public interface WorkerService extends BaseService {
*/
public
void
fillDefaultValues
(
Worker
obj
);
/**
* 根据 一组ID 查询返回一个对象集合
* @param ids
* @return
*/
public
List
<
Worker
>
getWorkerSByIds
(
String
[]
ids
);
}
2code/server/store-system/src/main/java/cn/com/fqy/core/service/impl/WorkerServiceImpl.java
View file @
c77e605f
...
...
@@ -296,4 +296,28 @@ public class WorkerServiceImpl implements WorkerService {
}
}
/**
* 根据主键数组,查询并返回一组Worker对象
* @param ids 主键数组,数组中的主键值应当无重复值,如有重复值时,则返回的列表长度可能小于传入的数组长度
* @return
*/
@Transactional
(
propagation
=
Propagation
.
SUPPORTS
)
public
List
<
Worker
>
getWorkerSByIds
(
String
[]
ids
)
{
List
<
Worker
>
list
=
null
;
if
(
ids
==
null
||
ids
.
length
==
0
)
{
log
.
info
(
Constant
.
ERR_MSG_INVALID_ARG
+
" ids is null or empty array."
);
}
else
{
try
{
//调用dao,根据主键数组查询
list
=
workerDao
.
getWorkerByIds
(
ids
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
}
}
//如list为null时,则改为返回一个空列表
list
=
list
==
null
?
new
ArrayList
<
Worker
>(
0
)
:
list
;
return
list
;
}
}
2code/server/store-system/src/main/resources/mybatis/mapper/WorkerMapper.xml
View file @
c77e605f
...
...
@@ -246,6 +246,16 @@ UPDATE_TIME,OPERATOR_ID,OPERATOR_TYPE,SERIAL_NUMBER,IS_DELETED,STORE_NAME,BRIEF
</where>
</select>
<select
id=
"getWorkerByIds"
resultMap=
"Worker"
>
select
<include
refid=
"AllColumnlist"
/>
from T_WORKER
<where>
STORE_ID in
<foreach
item=
"item"
index=
"index"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
AND IS_DELETED=0
AND IS_AUDITING=1
AND IS_SHOPPING=1
</where>
</select>
<select
id=
"getByIds"
resultMap=
"Worker"
>
select
<include
refid=
"AllColumnlist"
/>
from T_WORKER
<where>
...
...
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