Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
guns-vip
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenjunxiong
guns-vip
Commits
f7f76eb7
Commit
f7f76eb7
authored
May 09, 2017
by
fsn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改通知列表的发布者为真实姓名
parent
43e3080d
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
2 deletions
+47
-2
src/main/java/com/stylefeng/guns/common/constant/factory/ConstantFactory.java
+18
-0
src/main/java/com/stylefeng/guns/modular/system/controller/NoticeController.java
+2
-1
src/main/java/com/stylefeng/guns/modular/system/warpper/NoticeWrapper.java
+26
-0
src/main/webapp/static/modular/system/notice/notice.js
+1
-1
No files found.
src/main/java/com/stylefeng/guns/common/constant/factory/ConstantFactory.java
View file @
f7f76eb7
...
...
@@ -13,9 +13,11 @@ import com.stylefeng.guns.core.util.ToolUtil;
import
com.stylefeng.guns.persistence.dao.DeptMapper
;
import
com.stylefeng.guns.persistence.dao.DictMapper
;
import
com.stylefeng.guns.persistence.dao.RoleMapper
;
import
com.stylefeng.guns.persistence.dao.UserMapper
;
import
com.stylefeng.guns.persistence.model.Dept
;
import
com.stylefeng.guns.persistence.model.Dict
;
import
com.stylefeng.guns.persistence.model.Role
;
import
com.stylefeng.guns.persistence.model.User
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.context.annotation.DependsOn
;
import
org.springframework.stereotype.Component
;
...
...
@@ -35,12 +37,28 @@ public class ConstantFactory {
private
RoleMapper
roleMapper
=
SpringContextHolder
.
getBean
(
RoleMapper
.
class
);
private
DeptMapper
deptMapper
=
SpringContextHolder
.
getBean
(
DeptMapper
.
class
);
private
DictMapper
dictMapper
=
SpringContextHolder
.
getBean
(
DictMapper
.
class
);
private
UserMapper
userMapper
=
SpringContextHolder
.
getBean
(
UserMapper
.
class
);
public
static
ConstantFactory
me
()
{
return
SpringContextHolder
.
getBean
(
"constantFactory"
);
}
/**
* 根据用户id获取用户名称
*
* @author stylefeng
* @Date 2017/5/9 23:41
*/
public
String
getUserNameById
(
Integer
userId
){
User
user
=
userMapper
.
selectById
(
userId
);
if
(
user
!=
null
){
return
user
.
getName
();
}
else
{
return
"--"
;
}
}
/**
* 通过角色ids获取角色名称
*/
@Cacheable
(
value
=
Cache
.
CONSTANT
,
key
=
"'"
+
CacheKey
.
ROLES_NAME
+
"'+#roleIds"
)
...
...
src/main/java/com/stylefeng/guns/modular/system/controller/NoticeController.java
View file @
f7f76eb7
...
...
@@ -6,6 +6,7 @@ import com.stylefeng.guns.common.exception.BussinessException;
import
com.stylefeng.guns.core.shiro.ShiroKit
;
import
com.stylefeng.guns.core.util.ToolUtil
;
import
com.stylefeng.guns.modular.system.dao.NoticeDao
;
import
com.stylefeng.guns.modular.system.warpper.NoticeWrapper
;
import
com.stylefeng.guns.persistence.dao.NoticeMapper
;
import
com.stylefeng.guns.persistence.model.Notice
;
import
org.springframework.stereotype.Controller
;
...
...
@@ -71,7 +72,7 @@ public class NoticeController extends BaseController {
@ResponseBody
public
Object
list
(
String
condition
)
{
List
<
Map
<
String
,
Object
>>
list
=
this
.
noticeDao
.
list
(
condition
);
return
list
;
return
super
.
warpObject
(
new
NoticeWrapper
(
list
))
;
}
/**
...
...
src/main/java/com/stylefeng/guns/modular/system/warpper/NoticeWrapper.java
0 → 100644
View file @
f7f76eb7
package
com
.
stylefeng
.
guns
.
modular
.
system
.
warpper
;
import
com.stylefeng.guns.common.constant.factory.ConstantFactory
;
import
com.stylefeng.guns.common.warpper.BaseControllerWarpper
;
import
java.util.Map
;
/**
* 部门列表的包装
*
* @author fengshuonan
* @date 2017年4月25日 18:10:31
*/
public
class
NoticeWrapper
extends
BaseControllerWarpper
{
public
NoticeWrapper
(
Object
list
)
{
super
(
list
);
}
@Override
public
void
warpTheMap
(
Map
<
String
,
Object
>
map
)
{
Integer
creater
=
(
Integer
)
map
.
get
(
"creater"
);
map
.
put
(
"createrName"
,
ConstantFactory
.
me
().
getUserNameById
(
creater
));
}
}
src/main/webapp/static/modular/system/notice/notice.js
View file @
f7f76eb7
...
...
@@ -17,7 +17,7 @@ Notice.initColumn = function () {
{
title
:
'id'
,
field
:
'id'
,
visible
:
false
,
align
:
'center'
,
valign
:
'middle'
},
{
title
:
'标题'
,
field
:
'title'
,
align
:
'center'
,
valign
:
'middle'
},
{
title
:
'内容'
,
field
:
'content'
,
align
:
'center'
,
valign
:
'middle'
},
{
title
:
'发布者'
,
field
:
'creater'
,
align
:
'center'
,
valign
:
'middle'
},
{
title
:
'发布者'
,
field
:
'creater
Name
'
,
align
:
'center'
,
valign
:
'middle'
},
{
title
:
'创建时间'
,
field
:
'createtime'
,
align
:
'center'
,
valign
:
'middle'
}
];
};
...
...
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