Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
sentinel
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
曲欣亮
sentinel
Commits
9dcf3ca6
Commit
9dcf3ca6
authored
Jan 20, 2019
by
Quxl
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://key@gitlab.egolm.com/hanxu/siff-film-api.git
parents
01386529
2f3796f3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
22 deletions
+52
-22
NewsService.java
src/main/java/com/egolm/film/api/service/NewsService.java
+1
-1
NewsServiceImpl.java
...java/com/egolm/film/api/service/impl/NewsServiceImpl.java
+30
-4
AdminNewsController.java
...ava/com/egolm/film/api/web/admin/AdminNewsController.java
+21
-17
No files found.
src/main/java/com/egolm/film/api/service/NewsService.java
View file @
9dcf3ca6
...
...
@@ -8,7 +8,7 @@ import com.egolm.film.bean.Fc_admin;
public
interface
NewsService
{
List
<
Map
<
String
,
Object
>>
queryList
(
Page
page
);
List
<
Map
<
String
,
Object
>>
queryList
(
Page
page
,
String
key
);
void
merge
(
Object
obj
);
...
...
src/main/java/com/egolm/film/api/service/impl/NewsServiceImpl.java
View file @
9dcf3ca6
...
...
@@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
com.egolm.common.StringUtil
;
import
com.egolm.common.jdbc.JdbcTemplate
;
import
com.egolm.common.jdbc.Page
;
import
com.egolm.film.api.service.NewsService
;
...
...
@@ -25,9 +26,19 @@ public class NewsServiceImpl implements NewsService {
JdbcTemplate
jdbcTemplate
;
@Override
public
List
<
Map
<
String
,
Object
>>
queryList
(
Page
page
)
{
String
sql
=
"select ns.*, a.realname creator_name from fc_news ns left join fc_admin a on a.adminid = ns.creator order by ns.create_time desc"
;
return
jdbcTemplate
.
limit
(
sql
,
page
);
public
List
<
Map
<
String
,
Object
>>
queryList
(
Page
page
,
String
key
)
{
String
beforeSql
=
"select ns.*, a.realname creator_name from fc_news ns left join fc_admin a on a.adminid = ns.creator "
;
String
centerSql
=
""
;
if
(
StringUtil
.
isNotBlank
(
key
))
{
centerSql
=
" where ns.title like ? "
;
}
String
endSql
=
"order by ns.create_time desc"
;
String
sql
=
beforeSql
+
centerSql
+
endSql
;
if
(!
""
.
equals
(
centerSql
))
{
return
jdbcTemplate
.
limit
(
sql
,
page
,
"%"
+
key
+
"%"
);
}
else
{
return
jdbcTemplate
.
limit
(
sql
,
page
);
}
}
@Override
...
...
@@ -42,7 +53,22 @@ public class NewsServiceImpl implements NewsService {
@Override
public
Map
<
String
,
Object
>
queryById
(
Integer
id
)
{
return
jdbcTemplate
.
queryForMap
(
"select * from fc_news where id = ?"
,
id
);
Map
<
String
,
Object
>
map
=
jdbcTemplate
.
queryForMap
(
"select * from fc_news where id = ?"
,
id
);
String
sql2
=
"select user_group_id, user_id from fc_news_sender where news_id = ?"
;
List
<
Map
<
String
,
Object
>>
send
=
jdbcTemplate
.
queryForList
(
sql2
,
id
);
List
<
Object
>
sendUserList
=
new
ArrayList
<>();
List
<
Object
>
sendGroupList
=
new
ArrayList
<>();
for
(
Map
<
String
,
Object
>
map2
:
send
)
{
if
(
map2
.
get
(
"user_id"
)!=
null
)
{
sendUserList
.
add
(
map2
.
get
(
"user_id"
));
}
if
(
map2
.
get
(
"user_group_id"
)!=
null
)
{
sendGroupList
.
add
(
map2
.
get
(
"user_group_id"
));
}
}
map
.
put
(
"userList"
,
sendUserList
);
map
.
put
(
"groupList"
,
sendGroupList
);
return
map
;
}
@Override
...
...
src/main/java/com/egolm/film/api/web/admin/AdminNewsController.java
View file @
9dcf3ca6
...
...
@@ -38,11 +38,11 @@ public class AdminNewsController {
@ResponseBody
@PostMapping
(
"list"
)
@ApiOperation
(
"公告列表查询"
)
public
Object
list
(
Long
index
,
Long
limit
)
{
public
Object
list
(
Long
index
,
Long
limit
,
String
key
)
{
index
=
index
==
null
?
1
:
index
;
limit
=
limit
==
null
?
20
:
limit
;
Page
page
=
new
Page
(
index
,
limit
);
List
<
Map
<
String
,
Object
>>
list
=
service
.
queryList
(
page
);
List
<
Map
<
String
,
Object
>>
list
=
service
.
queryList
(
page
,
key
);
return
Rjx
.
jsonOk
().
setData
(
list
).
setPage
(
page
);
}
...
...
@@ -76,7 +76,7 @@ public class AdminNewsController {
news
.
setLast_update_time
(
now
);
}
service
.
merge
(
news
);
return
Rjx
.
jsonOk
();
return
Rjx
.
jsonOk
()
.
setData
(
news
)
;
}
@ResponseBody
...
...
@@ -92,21 +92,25 @@ public class AdminNewsController {
LoginToken
token
=
tokenService
.
getToken
();
Integer
adminid
=
((
Number
)
token
.
getId
()).
intValue
();
List
<
Fc_news_sender
>
senders
=
new
ArrayList
<
Fc_news_sender
>();
for
(
Integer
uid
:
user_id
)
{
Fc_news_sender
sender
=
new
Fc_news_sender
();
sender
.
setNews_id
(
id
);
sender
.
setUser_id
(
uid
);
sender
.
setSender
(
adminid
);
sender
.
setSend_time
(
now
);
senders
.
add
(
sender
);
if
(
user_id
!=
null
&&
user_id
.
length
>
0
)
{
for
(
Integer
uid
:
user_id
)
{
Fc_news_sender
sender
=
new
Fc_news_sender
();
sender
.
setNews_id
(
id
);
sender
.
setUser_id
(
uid
);
sender
.
setSender
(
adminid
);
sender
.
setSend_time
(
now
);
senders
.
add
(
sender
);
}
}
for
(
Integer
gid
:
user_group_id
)
{
Fc_news_sender
sender
=
new
Fc_news_sender
();
sender
.
setNews_id
(
id
);
sender
.
setUser_group_id
(
gid
);
sender
.
setSender
(
adminid
);
sender
.
setSend_time
(
now
);
senders
.
add
(
sender
);
if
(
user_group_id
!=
null
&&
user_group_id
.
length
>
0
)
{
for
(
Integer
gid
:
user_group_id
)
{
Fc_news_sender
sender
=
new
Fc_news_sender
();
sender
.
setNews_id
(
id
);
sender
.
setUser_group_id
(
gid
);
sender
.
setSender
(
adminid
);
sender
.
setSend_time
(
now
);
senders
.
add
(
sender
);
}
}
service
.
batchSave
(
senders
);
return
Rjx
.
jsonOk
();
...
...
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