正在显示
14 个修改的文件
包含
119 行增加
和
22 行删除
@@ -16,7 +16,7 @@ spring: | @@ -16,7 +16,7 @@ spring: | ||
16 | static-locations: classpath:/META-INF/resources/,classpath:/static,classpath:/resources/,file:${web.upload-path} | 16 | static-locations: classpath:/META-INF/resources/,classpath:/static,classpath:/resources/,file:${web.upload-path} |
17 | 17 | ||
18 | application: | 18 | application: |
19 | - name: tianbo.base.dev.devkit | 19 | + name: hqpt-user-center |
20 | 20 | ||
21 | jackson: | 21 | jackson: |
22 | serialization: | 22 | serialization: |
@@ -19,7 +19,9 @@ public class LogController { | @@ -19,7 +19,9 @@ public class LogController { | ||
19 | public PageInfo<LOGWithBLOBs> systemLog(@RequestParam(value = "pageNum",required = false,defaultValue = "1") | 19 | public PageInfo<LOGWithBLOBs> systemLog(@RequestParam(value = "pageNum",required = false,defaultValue = "1") |
20 | int pageNum, | 20 | int pageNum, |
21 | @RequestParam(value = "pageSize",required = false,defaultValue = "5") | 21 | @RequestParam(value = "pageSize",required = false,defaultValue = "5") |
22 | - int pageSize){ | ||
23 | - return logService.selectAll(pageNum,pageSize); | 22 | + int pageSize, |
23 | + @RequestParam(value = "username", required = false) String username, | ||
24 | + @RequestParam(value = "modelnamecn", required = false) String modelnamecn){ | ||
25 | + return logService.selectAll(pageNum,pageSize, username, modelnamecn); | ||
24 | } | 26 | } |
25 | } | 27 | } |
@@ -12,33 +12,83 @@ import org.springframework.security.core.context.SecurityContextHolder; | @@ -12,33 +12,83 @@ import org.springframework.security.core.context.SecurityContextHolder; | ||
12 | import org.springframework.security.core.userdetails.UserDetails; | 12 | import org.springframework.security.core.userdetails.UserDetails; |
13 | import org.springframework.web.bind.annotation.*; | 13 | import org.springframework.web.bind.annotation.*; |
14 | 14 | ||
15 | +import javax.servlet.http.HttpServletRequest; | ||
16 | +import javax.servlet.http.HttpServletResponse; | ||
17 | +import javax.validation.Valid; | ||
15 | import java.util.List; | 18 | import java.util.List; |
16 | import java.util.Map; | 19 | import java.util.Map; |
17 | 20 | ||
18 | 21 | ||
19 | @RestController() | 22 | @RestController() |
23 | +@RequestMapping("/perm") | ||
20 | public class PermssionController { | 24 | public class PermssionController { |
21 | 25 | ||
22 | @Autowired | 26 | @Autowired |
23 | PermissionService permissionService; | 27 | PermissionService permissionService; |
24 | 28 | ||
25 | - @GetMapping("/perm/list") | 29 | + @GetMapping("/list") |
26 | public PageInfo<PERMISSION> list(@RequestParam(value = "pageNum",required = false,defaultValue = "1") | 30 | public PageInfo<PERMISSION> list(@RequestParam(value = "pageNum",required = false,defaultValue = "1") |
27 | int pageNum, | 31 | int pageNum, |
28 | @RequestParam(value = "pageSize",required = false,defaultValue = "5") | 32 | @RequestParam(value = "pageSize",required = false,defaultValue = "5") |
29 | - int pageSize){ | ||
30 | - return permissionService.findAll(pageNum,pageSize); | 33 | + int pageSize, |
34 | + @RequestParam(value = "name", required = false) String name){ | ||
35 | + return permissionService.findAll(pageNum,pageSize, name); | ||
31 | 36 | ||
32 | } | 37 | } |
33 | 38 | ||
34 | @LogAnnotation(moduleName = "权限管理",operate = "权限添加") | 39 | @LogAnnotation(moduleName = "权限管理",operate = "权限添加") |
35 | - @PostMapping("/perm/add") | 40 | + @PostMapping("/add") |
36 | public ResultJson add(@RequestBody PERMISSION permission){ | 41 | public ResultJson add(@RequestBody PERMISSION permission){ |
37 | int i =permissionService.insertSelective(permission); | 42 | int i =permissionService.insertSelective(permission); |
38 | 43 | ||
39 | ResultJson resultJson = new ResultJson(); | 44 | ResultJson resultJson = new ResultJson(); |
40 | if (1==i){ | 45 | if (1==i){ |
41 | - resultJson = new ResultJson("200","添加账户成功"); | 46 | + resultJson = new ResultJson("200","添加成功"); |
47 | + }else { | ||
48 | + resultJson = new ResultJson("500","insert faild"); | ||
49 | + } | ||
50 | + return resultJson; | ||
51 | + } | ||
52 | + | ||
53 | + @LogAnnotation(moduleName = "权限管理",operate = "权限修改") | ||
54 | + @PutMapping("/edit") | ||
55 | + @ResponseBody | ||
56 | + public ResultJson edit(@RequestBody @Valid PERMISSION permission){ | ||
57 | + | ||
58 | + int i =permissionService.updateByPrimaryKeySelective(permission); | ||
59 | + | ||
60 | + ResultJson resultJson = new ResultJson(); | ||
61 | + if (1==i){ | ||
62 | + resultJson = new ResultJson("200","修改成功"); | ||
63 | + }else { | ||
64 | + resultJson = new ResultJson("500","insert faild"); | ||
65 | + } | ||
66 | + return resultJson; | ||
67 | + } | ||
68 | + | ||
69 | + @LogAnnotation(moduleName = "权限管理",operate = "权限删除") | ||
70 | + @DeleteMapping("/del") | ||
71 | + public ResultJson reomve(@RequestBody PERMISSION permission, HttpServletRequest request, HttpServletResponse response){ | ||
72 | + | ||
73 | + int i =permissionService.deleteByPrimaryKey(permission.getPermissionId().toString()); | ||
74 | + | ||
75 | + ResultJson resultJson = new ResultJson(); | ||
76 | + if (1==i){ | ||
77 | + resultJson = new ResultJson("200","删除成功"); | ||
78 | + }else { | ||
79 | + resultJson = new ResultJson("500","insert faild"); | ||
80 | + } | ||
81 | + return resultJson; | ||
82 | + } | ||
83 | + | ||
84 | + @LogAnnotation(moduleName = "权限管理",operate = "权限批量删除") | ||
85 | + @GetMapping("/batchremove") | ||
86 | + public ResultJson reomve(String ids, HttpServletRequest request, HttpServletResponse response){ | ||
87 | + | ||
88 | + ResultJson resultJson = new ResultJson(); | ||
89 | + | ||
90 | + if (permissionService.deleteByPrimaryKey(ids)>0){ | ||
91 | + resultJson = new ResultJson("200","删除成功"); | ||
42 | }else { | 92 | }else { |
43 | resultJson = new ResultJson("500","insert faild"); | 93 | resultJson = new ResultJson("500","insert faild"); |
44 | } | 94 | } |
@@ -2,6 +2,7 @@ package com.tianbo.warehouse.dao; | @@ -2,6 +2,7 @@ package com.tianbo.warehouse.dao; | ||
2 | 2 | ||
3 | import com.tianbo.warehouse.model.LOG; | 3 | import com.tianbo.warehouse.model.LOG; |
4 | import com.tianbo.warehouse.model.LOGWithBLOBs; | 4 | import com.tianbo.warehouse.model.LOGWithBLOBs; |
5 | +import org.apache.ibatis.annotations.Param; | ||
5 | 6 | ||
6 | import java.util.List; | 7 | import java.util.List; |
7 | 8 | ||
@@ -14,7 +15,7 @@ public interface LOGMapper { | @@ -14,7 +15,7 @@ public interface LOGMapper { | ||
14 | 15 | ||
15 | LOGWithBLOBs selectByPrimaryKey(Integer logid); | 16 | LOGWithBLOBs selectByPrimaryKey(Integer logid); |
16 | 17 | ||
17 | - List<LOGWithBLOBs> selectAll(); | 18 | + List<LOGWithBLOBs> selectAll(@Param("username") String username, @Param("modelnamecn") String modelnamecn); |
18 | 19 | ||
19 | int updateByPrimaryKeySelective(LOGWithBLOBs record); | 20 | int updateByPrimaryKeySelective(LOGWithBLOBs record); |
20 | 21 |
1 | package com.tianbo.warehouse.dao; | 1 | package com.tianbo.warehouse.dao; |
2 | 2 | ||
3 | import com.tianbo.warehouse.model.PERMISSION; | 3 | import com.tianbo.warehouse.model.PERMISSION; |
4 | +import org.apache.ibatis.annotations.Param; | ||
4 | 5 | ||
5 | import java.math.BigDecimal; | 6 | import java.math.BigDecimal; |
6 | import java.util.List; | 7 | import java.util.List; |
@@ -18,7 +19,7 @@ public interface PERMISSIONMapper { | @@ -18,7 +19,7 @@ public interface PERMISSIONMapper { | ||
18 | 19 | ||
19 | int updateByPrimaryKey(PERMISSION record); | 20 | int updateByPrimaryKey(PERMISSION record); |
20 | 21 | ||
21 | - List<PERMISSION> findAll(); | 22 | + List<PERMISSION> findAll(@Param("name") String name); |
22 | 23 | ||
23 | List<PERMISSION> getAllMenus(); | 24 | List<PERMISSION> getAllMenus(); |
24 | 25 |
@@ -39,7 +39,7 @@ public class USERS implements UserDetails { | @@ -39,7 +39,7 @@ public class USERS implements UserDetails { | ||
39 | 39 | ||
40 | private Boolean state; | 40 | private Boolean state; |
41 | 41 | ||
42 | - @Length(min = 11, max = 11, message = "mobilephone 长度必须为11位") | 42 | +// @Length(min = 11, max = 11, message = "mobilephone 长度必须为11位") |
43 | private String mobilephone; | 43 | private String mobilephone; |
44 | 44 | ||
45 | private Date creattime; | 45 | private Date creattime; |
@@ -49,7 +49,7 @@ public class USERS implements UserDetails { | @@ -49,7 +49,7 @@ public class USERS implements UserDetails { | ||
49 | private String userface; | 49 | private String userface; |
50 | 50 | ||
51 | private String realname; | 51 | private String realname; |
52 | - @Pattern(regexp="[a-za-z0-9._%+-]+@[a-za-z0-9.-]+\\.[a-za-z]{2,4}", message="邮件格式错误") | 52 | +// @Pattern(regexp="[a-za-z0-9._%+-]+@[a-za-z0-9.-]+\\.[a-za-z]{2,4}", message="邮件格式错误") |
53 | private String email; | 53 | private String email; |
54 | 54 | ||
55 | private Integer age; | 55 | private Integer age; |
@@ -34,7 +34,7 @@ public class MyInvocationSecurityMetadataSourceService implements FilterInvocati | @@ -34,7 +34,7 @@ public class MyInvocationSecurityMetadataSourceService implements FilterInvocati | ||
34 | map = new HashMap<>(); | 34 | map = new HashMap<>(); |
35 | Collection<ConfigAttribute> array; | 35 | Collection<ConfigAttribute> array; |
36 | ConfigAttribute cfg; | 36 | ConfigAttribute cfg; |
37 | - List<PERMISSION> permissions = permissionMapper.findAll(); | 37 | + List<PERMISSION> permissions = permissionMapper.findAll(""); |
38 | for(PERMISSION permission : permissions) { | 38 | for(PERMISSION permission : permissions) { |
39 | array = new ArrayList<>(); | 39 | array = new ArrayList<>(); |
40 | 40 | ||
@@ -74,7 +74,7 @@ public class MyInvocationSecurityMetadataSourceService implements FilterInvocati | @@ -74,7 +74,7 @@ public class MyInvocationSecurityMetadataSourceService implements FilterInvocati | ||
74 | public Collection<ConfigAttribute> loadResourceDefine(){ | 74 | public Collection<ConfigAttribute> loadResourceDefine(){ |
75 | Collection<ConfigAttribute> array; | 75 | Collection<ConfigAttribute> array; |
76 | ConfigAttribute cfg; | 76 | ConfigAttribute cfg; |
77 | - List<PERMISSION> permissions = permissionMapper.findAll(); | 77 | + List<PERMISSION> permissions = permissionMapper.findAll(""); |
78 | for(PERMISSION permission : permissions) { | 78 | for(PERMISSION permission : permissions) { |
79 | array = new ArrayList<>(); | 79 | array = new ArrayList<>(); |
80 | 80 |
@@ -8,5 +8,5 @@ public interface LogService { | @@ -8,5 +8,5 @@ public interface LogService { | ||
8 | 8 | ||
9 | int insertSelective(LOGWithBLOBs record); | 9 | int insertSelective(LOGWithBLOBs record); |
10 | 10 | ||
11 | - PageInfo<LOGWithBLOBs> selectAll(int pageNum, int pageSize); | 11 | + PageInfo<LOGWithBLOBs> selectAll(int pageNum, int pageSize, String username, String modelnamecn); |
12 | } | 12 | } |
@@ -8,7 +8,7 @@ import java.util.Map; | @@ -8,7 +8,7 @@ import java.util.Map; | ||
8 | 8 | ||
9 | public interface PermissionService { | 9 | public interface PermissionService { |
10 | 10 | ||
11 | - PageInfo<PERMISSION> findAll(int pageNum, int pageSize); | 11 | + PageInfo<PERMISSION> findAll(int pageNum, int pageSize, String name); |
12 | 12 | ||
13 | int insertSelective(PERMISSION record); | 13 | int insertSelective(PERMISSION record); |
14 | 14 | ||
@@ -18,4 +18,9 @@ public interface PermissionService { | @@ -18,4 +18,9 @@ public interface PermissionService { | ||
18 | * @return | 18 | * @return |
19 | */ | 19 | */ |
20 | Map<String,Object> getUserMenus(Integer userId); | 20 | Map<String,Object> getUserMenus(Integer userId); |
21 | + | ||
22 | + | ||
23 | + int updateByPrimaryKeySelective(PERMISSION permission); | ||
24 | + | ||
25 | + int deleteByPrimaryKey(String companyId); | ||
21 | } | 26 | } |
@@ -24,9 +24,9 @@ public class LogServiceImp implements LogService{ | @@ -24,9 +24,9 @@ public class LogServiceImp implements LogService{ | ||
24 | } | 24 | } |
25 | 25 | ||
26 | @Override | 26 | @Override |
27 | - public PageInfo<LOGWithBLOBs> selectAll(int pageNum,int pageSize){ | 27 | + public PageInfo<LOGWithBLOBs> selectAll(int pageNum,int pageSize, String username, String modelnamecn){ |
28 | Page<LOGWithBLOBs> page = PageHelper.startPage(pageNum,pageSize); | 28 | Page<LOGWithBLOBs> page = PageHelper.startPage(pageNum,pageSize); |
29 | - List<LOGWithBLOBs> list = logMapper.selectAll(); | 29 | + List<LOGWithBLOBs> list = logMapper.selectAll(username, modelnamecn); |
30 | PageInfo<LOGWithBLOBs> result = new PageInfo<LOGWithBLOBs>(list); | 30 | PageInfo<LOGWithBLOBs> result = new PageInfo<LOGWithBLOBs>(list); |
31 | return result; | 31 | return result; |
32 | } | 32 | } |
@@ -19,9 +19,9 @@ public class PermissionServiceImp implements PermissionService{ | @@ -19,9 +19,9 @@ public class PermissionServiceImp implements PermissionService{ | ||
19 | PERMISSIONMapper permissionMapper; | 19 | PERMISSIONMapper permissionMapper; |
20 | 20 | ||
21 | @Override | 21 | @Override |
22 | - public PageInfo<PERMISSION> findAll(int pageNum, int pageSize){ | 22 | + public PageInfo<PERMISSION> findAll(int pageNum, int pageSize, String name){ |
23 | Page<PERMISSION> page = PageHelper.startPage(pageNum,pageSize); | 23 | Page<PERMISSION> page = PageHelper.startPage(pageNum,pageSize); |
24 | - List<PERMISSION> list = permissionMapper.findAll(); | 24 | + List<PERMISSION> list = permissionMapper.findAll(name); |
25 | PageInfo<PERMISSION> result = new PageInfo<>(list); | 25 | PageInfo<PERMISSION> result = new PageInfo<>(list); |
26 | return result; | 26 | return result; |
27 | } | 27 | } |
@@ -94,4 +94,31 @@ public class PermissionServiceImp implements PermissionService{ | @@ -94,4 +94,31 @@ public class PermissionServiceImp implements PermissionService{ | ||
94 | } | 94 | } |
95 | return childList; | 95 | return childList; |
96 | } | 96 | } |
97 | + | ||
98 | + | ||
99 | + @Override | ||
100 | + public int updateByPrimaryKeySelective(PERMISSION permission) { | ||
101 | + return permissionMapper.updateByPrimaryKeySelective(permission); | ||
102 | + } | ||
103 | + | ||
104 | + @Override | ||
105 | + public int deleteByPrimaryKey(String permissionId) { | ||
106 | + if (permissionId.contains(",")){ | ||
107 | + try { | ||
108 | + String[] split = permissionId.split(","); | ||
109 | + for (int i=0; i<split.length; i++){ | ||
110 | + permissionMapper.deleteByPrimaryKey(Integer.valueOf(split[i])); | ||
111 | + } | ||
112 | + System.out.println(); | ||
113 | + return 1; | ||
114 | + }catch (Exception e){ | ||
115 | + e.printStackTrace(); | ||
116 | + return 0; | ||
117 | + } | ||
118 | + }else { | ||
119 | + | ||
120 | + return permissionMapper.deleteByPrimaryKey(Integer.valueOf(permissionId)); | ||
121 | + } | ||
122 | + } | ||
123 | + | ||
97 | } | 124 | } |
@@ -35,6 +35,13 @@ | @@ -35,6 +35,13 @@ | ||
35 | , | 35 | , |
36 | <include refid="Blob_Column_List" /> | 36 | <include refid="Blob_Column_List" /> |
37 | from log | 37 | from log |
38 | + where 1=1 | ||
39 | + <if test="modelnamecn != ''"> | ||
40 | + and modelNameCN = #{modelnamecn, jdbcType=VARCHAR} | ||
41 | + </if> | ||
42 | + <if test="username != ''"> | ||
43 | + and userName = #{username, jdbcType=VARCHAR} | ||
44 | + </if> | ||
38 | </select> | 45 | </select> |
39 | <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> | 46 | <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> |
40 | delete from log | 47 | delete from log |
@@ -28,7 +28,11 @@ | @@ -28,7 +28,11 @@ | ||
28 | <select id="findAll" resultMap="BaseResultMap" > | 28 | <select id="findAll" resultMap="BaseResultMap" > |
29 | select | 29 | select |
30 | <include refid="Base_Column_List" /> | 30 | <include refid="Base_Column_List" /> |
31 | - from permission ORDER BY ismenu,parent_id,permission_order | 31 | + from permission |
32 | + <if test="name != ''" > | ||
33 | + where name = #{name, jdbcType=VARCHAR} | ||
34 | + </if> | ||
35 | + ORDER BY permission_order | ||
32 | </select> | 36 | </select> |
33 | <select id="getRolePermisson" resultMap="BaseResultMap" parameterType="java.lang.Integer"> | 37 | <select id="getRolePermisson" resultMap="BaseResultMap" parameterType="java.lang.Integer"> |
34 | SELECT P.* | 38 | SELECT P.* |
@@ -22,7 +22,7 @@ | @@ -22,7 +22,7 @@ | ||
22 | SELECT | 22 | SELECT |
23 | <include refid="Base_Column_List" /> | 23 | <include refid="Base_Column_List" /> |
24 | FROM role | 24 | FROM role |
25 | - <if test="roleName != ''" > | 25 | + <if test="roleName != '' and roleName !=null" > |
26 | where role_name = #{roleName, jdbcType=VARCHAR} | 26 | where role_name = #{roleName, jdbcType=VARCHAR} |
27 | </if> | 27 | </if> |
28 | </select> | 28 | </select> |
-
请 注册 或 登录 后发表评论