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
2f3796f3
Commit
2f3796f3
authored
Jan 19, 2019
by
曲欣红
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
6b9ddd17
Show 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 @
2f3796f3
...
@@ -8,7 +8,7 @@ import com.egolm.film.bean.Fc_admin;
...
@@ -8,7 +8,7 @@ import com.egolm.film.bean.Fc_admin;
public
interface
NewsService
{
public
interface
NewsService
{
List
<
Map
<
String
,
Object
>>
queryList
(
Page
page
);
List
<
Map
<
String
,
Object
>>
queryList
(
Page
page
,
String
key
);
void
merge
(
Object
obj
);
void
merge
(
Object
obj
);
...
...
src/main/java/com/egolm/film/api/service/impl/NewsServiceImpl.java
View file @
2f3796f3
...
@@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
com.egolm.common.StringUtil
;
import
com.egolm.common.jdbc.JdbcTemplate
;
import
com.egolm.common.jdbc.JdbcTemplate
;
import
com.egolm.common.jdbc.Page
;
import
com.egolm.common.jdbc.Page
;
import
com.egolm.film.api.service.NewsService
;
import
com.egolm.film.api.service.NewsService
;
...
@@ -25,10 +26,20 @@ public class NewsServiceImpl implements NewsService {
...
@@ -25,10 +26,20 @@ public class NewsServiceImpl implements NewsService {
JdbcTemplate
jdbcTemplate
;
JdbcTemplate
jdbcTemplate
;
@Override
@Override
public
List
<
Map
<
String
,
Object
>>
queryList
(
Page
page
)
{
public
List
<
Map
<
String
,
Object
>>
queryList
(
Page
page
,
String
key
)
{
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"
;
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
);
return
jdbcTemplate
.
limit
(
sql
,
page
);
}
}
}
@Override
@Override
public
void
merge
(
Object
obj
)
{
public
void
merge
(
Object
obj
)
{
...
@@ -42,7 +53,22 @@ public class NewsServiceImpl implements NewsService {
...
@@ -42,7 +53,22 @@ public class NewsServiceImpl implements NewsService {
@Override
@Override
public
Map
<
String
,
Object
>
queryById
(
Integer
id
)
{
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
@Override
...
...
src/main/java/com/egolm/film/api/web/admin/AdminNewsController.java
View file @
2f3796f3
...
@@ -38,11 +38,11 @@ public class AdminNewsController {
...
@@ -38,11 +38,11 @@ public class AdminNewsController {
@ResponseBody
@ResponseBody
@PostMapping
(
"list"
)
@PostMapping
(
"list"
)
@ApiOperation
(
"公告列表查询"
)
@ApiOperation
(
"公告列表查询"
)
public
Object
list
(
Long
index
,
Long
limit
)
{
public
Object
list
(
Long
index
,
Long
limit
,
String
key
)
{
index
=
index
==
null
?
1
:
index
;
index
=
index
==
null
?
1
:
index
;
limit
=
limit
==
null
?
20
:
limit
;
limit
=
limit
==
null
?
20
:
limit
;
Page
page
=
new
Page
(
index
,
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
);
return
Rjx
.
jsonOk
().
setData
(
list
).
setPage
(
page
);
}
}
...
@@ -76,7 +76,7 @@ public class AdminNewsController {
...
@@ -76,7 +76,7 @@ public class AdminNewsController {
news
.
setLast_update_time
(
now
);
news
.
setLast_update_time
(
now
);
}
}
service
.
merge
(
news
);
service
.
merge
(
news
);
return
Rjx
.
jsonOk
();
return
Rjx
.
jsonOk
()
.
setData
(
news
)
;
}
}
@ResponseBody
@ResponseBody
...
@@ -92,6 +92,7 @@ public class AdminNewsController {
...
@@ -92,6 +92,7 @@ public class AdminNewsController {
LoginToken
token
=
tokenService
.
getToken
();
LoginToken
token
=
tokenService
.
getToken
();
Integer
adminid
=
((
Number
)
token
.
getId
()).
intValue
();
Integer
adminid
=
((
Number
)
token
.
getId
()).
intValue
();
List
<
Fc_news_sender
>
senders
=
new
ArrayList
<
Fc_news_sender
>();
List
<
Fc_news_sender
>
senders
=
new
ArrayList
<
Fc_news_sender
>();
if
(
user_id
!=
null
&&
user_id
.
length
>
0
)
{
for
(
Integer
uid
:
user_id
)
{
for
(
Integer
uid
:
user_id
)
{
Fc_news_sender
sender
=
new
Fc_news_sender
();
Fc_news_sender
sender
=
new
Fc_news_sender
();
sender
.
setNews_id
(
id
);
sender
.
setNews_id
(
id
);
...
@@ -100,6 +101,8 @@ public class AdminNewsController {
...
@@ -100,6 +101,8 @@ public class AdminNewsController {
sender
.
setSend_time
(
now
);
sender
.
setSend_time
(
now
);
senders
.
add
(
sender
);
senders
.
add
(
sender
);
}
}
}
if
(
user_group_id
!=
null
&&
user_group_id
.
length
>
0
)
{
for
(
Integer
gid
:
user_group_id
)
{
for
(
Integer
gid
:
user_group_id
)
{
Fc_news_sender
sender
=
new
Fc_news_sender
();
Fc_news_sender
sender
=
new
Fc_news_sender
();
sender
.
setNews_id
(
id
);
sender
.
setNews_id
(
id
);
...
@@ -108,6 +111,7 @@ public class AdminNewsController {
...
@@ -108,6 +111,7 @@ public class AdminNewsController {
sender
.
setSend_time
(
now
);
sender
.
setSend_time
(
now
);
senders
.
add
(
sender
);
senders
.
add
(
sender
);
}
}
}
service
.
batchSave
(
senders
);
service
.
batchSave
(
senders
);
return
Rjx
.
jsonOk
();
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