正在显示
23 个修改的文件
包含
346 行增加
和
101 行删除
1 | package com.tianbo.warehouse.controller; | 1 | package com.tianbo.warehouse.controller; |
2 | 2 | ||
3 | -import com.tianbo.warehouse.model.PERMISSION; | ||
4 | -import com.tianbo.warehouse.model.USERS; | ||
5 | -import com.tianbo.warehouse.service.UserService; | ||
6 | -import org.springframework.beans.factory.annotation.Autowired; | ||
7 | import org.springframework.stereotype.Controller; | 3 | import org.springframework.stereotype.Controller; |
8 | -import org.springframework.ui.Model; | ||
9 | import org.springframework.web.bind.annotation.RequestMapping; | 4 | import org.springframework.web.bind.annotation.RequestMapping; |
10 | import org.springframework.web.bind.annotation.ResponseBody; | 5 | import org.springframework.web.bind.annotation.ResponseBody; |
11 | 6 | ||
12 | -import java.util.List; | ||
13 | - | ||
14 | @Controller | 7 | @Controller |
15 | public class ImfLog { | 8 | public class ImfLog { |
16 | 9 | ||
17 | - @Autowired | ||
18 | - UserService userService; | ||
19 | 10 | ||
20 | @RequestMapping("/log/imf") | 11 | @RequestMapping("/log/imf") |
21 | public String IMFlog(){ | 12 | public String IMFlog(){ |
22 | return "log/imf"; | 13 | return "log/imf"; |
23 | } | 14 | } |
24 | 15 | ||
25 | - @RequestMapping("/home") | ||
26 | - public String Home(Model model){ | ||
27 | - PERMISSION msg = new PERMISSION(); | ||
28 | - msg.setDescription("权限描述"); | ||
29 | - msg.setName("权限名称"); | ||
30 | - msg.setPermissionOrder("权限路径"); | ||
31 | - model.addAttribute("msg", msg); | ||
32 | - return "home"; | ||
33 | - } | ||
34 | 16 | ||
35 | @RequestMapping("/logs") | 17 | @RequestMapping("/logs") |
36 | @ResponseBody | 18 | @ResponseBody |
1 | +package com.tianbo.warehouse.controller; | ||
2 | + | ||
3 | + | ||
4 | +import com.github.pagehelper.PageInfo; | ||
5 | +import com.tianbo.warehouse.model.LOGWithBLOBs; | ||
6 | +import com.tianbo.warehouse.service.LogService; | ||
7 | +import org.springframework.beans.factory.annotation.Autowired; | ||
8 | +import org.springframework.web.bind.annotation.GetMapping; | ||
9 | +import org.springframework.web.bind.annotation.RequestParam; | ||
10 | +import org.springframework.web.bind.annotation.RestController; | ||
11 | + | ||
12 | +@RestController | ||
13 | +public class LogController { | ||
14 | + | ||
15 | + @Autowired | ||
16 | + private LogService logService; | ||
17 | + | ||
18 | + @GetMapping("/system/log/list") | ||
19 | + public PageInfo<LOGWithBLOBs> systemLog(@RequestParam(value = "pageNum",required = false,defaultValue = "1") | ||
20 | + int pageNum, | ||
21 | + @RequestParam(value = "pageSize",required = false,defaultValue = "5") | ||
22 | + int pageSize){ | ||
23 | + return logService.selectAll(pageNum,pageSize); | ||
24 | + } | ||
25 | +} |
1 | package com.tianbo.warehouse.controller; | 1 | package com.tianbo.warehouse.controller; |
2 | 2 | ||
3 | import com.github.pagehelper.PageInfo; | 3 | import com.github.pagehelper.PageInfo; |
4 | +import com.tianbo.warehouse.annotation.LogAnnotation; | ||
4 | import com.tianbo.warehouse.controller.response.ResultJson; | 5 | import com.tianbo.warehouse.controller.response.ResultJson; |
5 | import com.tianbo.warehouse.dao.PERMISSIONMapper; | 6 | import com.tianbo.warehouse.dao.PERMISSIONMapper; |
6 | import com.tianbo.warehouse.model.PERMISSION; | 7 | import com.tianbo.warehouse.model.PERMISSION; |
@@ -32,6 +33,7 @@ public class PermssionController { | @@ -32,6 +33,7 @@ public class PermssionController { | ||
32 | 33 | ||
33 | } | 34 | } |
34 | 35 | ||
36 | + @LogAnnotation(moduleName = "权限管理",operate = "权限添加") | ||
35 | @PostMapping("/perm/add") | 37 | @PostMapping("/perm/add") |
36 | public ResultJson add(@RequestBody PERMISSION permission){ | 38 | public ResultJson add(@RequestBody PERMISSION permission){ |
37 | int i =permissionService.insertSelective(permission); | 39 | int i =permissionService.insertSelective(permission); |
1 | package com.tianbo.warehouse.controller; | 1 | package com.tianbo.warehouse.controller; |
2 | 2 | ||
3 | import com.github.pagehelper.PageInfo; | 3 | import com.github.pagehelper.PageInfo; |
4 | +import com.tianbo.warehouse.annotation.LogAnnotation; | ||
4 | import com.tianbo.warehouse.controller.response.ResultJson; | 5 | import com.tianbo.warehouse.controller.response.ResultJson; |
5 | import com.tianbo.warehouse.model.ROLE; | 6 | import com.tianbo.warehouse.model.ROLE; |
7 | +import com.tianbo.warehouse.model.RolePermission; | ||
6 | import com.tianbo.warehouse.service.RoleService; | 8 | import com.tianbo.warehouse.service.RoleService; |
7 | import org.springframework.beans.factory.annotation.Autowired; | 9 | import org.springframework.beans.factory.annotation.Autowired; |
8 | import org.springframework.web.bind.annotation.*; | 10 | import org.springframework.web.bind.annotation.*; |
@@ -21,17 +23,22 @@ public class RoleController { | @@ -21,17 +23,22 @@ public class RoleController { | ||
21 | return roleService.findAll(pageNum,pageSize); | 23 | return roleService.findAll(pageNum,pageSize); |
22 | } | 24 | } |
23 | 25 | ||
26 | + @LogAnnotation(moduleName = "角色管理",operate = "角色添加") | ||
24 | @PostMapping("/role/add") | 27 | @PostMapping("/role/add") |
25 | public ResultJson add(@RequestBody ROLE role){ | 28 | public ResultJson add(@RequestBody ROLE role){ |
26 | int i =roleService.insertSelective(role); | 29 | int i =roleService.insertSelective(role); |
30 | + return i==1 ? new ResultJson("200","添加权限成功") :new ResultJson("500","insert faild"); | ||
27 | 31 | ||
28 | - ResultJson resultJson = new ResultJson(); | ||
29 | - if (1==i){ | ||
30 | - resultJson = new ResultJson("200","添加账户成功"); | ||
31 | - }else { | ||
32 | - resultJson = new ResultJson("500","insert faild"); | ||
33 | - } | ||
34 | - return resultJson; | ||
35 | } | 32 | } |
36 | 33 | ||
34 | + /** | ||
35 | + * 设置角色的权限 | ||
36 | + * @return | ||
37 | + */ | ||
38 | + @LogAnnotation(moduleName = "角色管理",operate = "权限设置") | ||
39 | + @PutMapping("/role/permSet") | ||
40 | + public ResultJson permissionSet(@RequestBody RolePermission rolePermission){ | ||
41 | + int i = roleService.setRolePermissoin(rolePermission); | ||
42 | + return i==1 ? new ResultJson("200","设置权限成功") :new ResultJson("500","设置权限失败"); | ||
43 | + } | ||
37 | } | 44 | } |
@@ -78,7 +78,7 @@ public class UserController { | @@ -78,7 +78,7 @@ public class UserController { | ||
78 | 78 | ||
79 | int i = userService.setUserRole(userRole); | 79 | int i = userService.setUserRole(userRole); |
80 | 80 | ||
81 | - return i==1 ? new ResultJson("200","设置权限成功") :new ResultJson("500","设置权限失败"); | 81 | + return i==1 ? new ResultJson("200","设置角色成功") :new ResultJson("500","设置角色失败"); |
82 | 82 | ||
83 | } | 83 | } |
84 | 84 |
@@ -3,6 +3,8 @@ package com.tianbo.warehouse.dao; | @@ -3,6 +3,8 @@ package com.tianbo.warehouse.dao; | ||
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 | 5 | ||
6 | +import java.util.List; | ||
7 | + | ||
6 | public interface LOGMapper { | 8 | public interface LOGMapper { |
7 | int deleteByPrimaryKey(Integer logid); | 9 | int deleteByPrimaryKey(Integer logid); |
8 | 10 | ||
@@ -12,6 +14,8 @@ public interface LOGMapper { | @@ -12,6 +14,8 @@ public interface LOGMapper { | ||
12 | 14 | ||
13 | LOGWithBLOBs selectByPrimaryKey(Integer logid); | 15 | LOGWithBLOBs selectByPrimaryKey(Integer logid); |
14 | 16 | ||
17 | + List<LOGWithBLOBs> selectAll(); | ||
18 | + | ||
15 | int updateByPrimaryKeySelective(LOGWithBLOBs record); | 19 | int updateByPrimaryKeySelective(LOGWithBLOBs record); |
16 | 20 | ||
17 | int updateByPrimaryKeyWithBLOBs(LOGWithBLOBs record); | 21 | int updateByPrimaryKeyWithBLOBs(LOGWithBLOBs record); |
@@ -25,4 +25,6 @@ public interface PERMISSIONMapper { | @@ -25,4 +25,6 @@ public interface PERMISSIONMapper { | ||
25 | List<PERMISSION> findByUserId(Integer userId); | 25 | List<PERMISSION> findByUserId(Integer userId); |
26 | 26 | ||
27 | List<String> findRoleListByUrl(String permissionUrl); | 27 | List<String> findRoleListByUrl(String permissionUrl); |
28 | + | ||
29 | + List<PERMISSION> getRolePermisson(Integer roleId); | ||
28 | } | 30 | } |
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.ROLE; | 4 | import com.tianbo.warehouse.model.ROLE; |
4 | 5 | ||
5 | import java.math.BigDecimal; | 6 | import java.math.BigDecimal; |
7 | +import java.util.HashMap; | ||
6 | import java.util.List; | 8 | import java.util.List; |
9 | +import java.util.Map; | ||
7 | 10 | ||
8 | public interface ROLEMapper { | 11 | public interface ROLEMapper { |
9 | int deleteByPrimaryKey(Integer roleId); | 12 | int deleteByPrimaryKey(Integer roleId); |
@@ -21,4 +24,6 @@ public interface ROLEMapper { | @@ -21,4 +24,6 @@ public interface ROLEMapper { | ||
21 | List<ROLE> findRolesByUserId(Integer userId); | 24 | List<ROLE> findRolesByUserId(Integer userId); |
22 | 25 | ||
23 | List<ROLE> findAll(); | 26 | List<ROLE> findAll(); |
27 | + | ||
28 | + | ||
24 | } | 29 | } |
1 | +package com.tianbo.warehouse.dao; | ||
2 | + | ||
3 | +import com.tianbo.warehouse.model.RolePermission; | ||
4 | + | ||
5 | +import java.util.Map; | ||
6 | + | ||
7 | +public interface RolePermissionMapper { | ||
8 | + int deleteByPrimaryKey(Integer id); | ||
9 | + | ||
10 | + int insert(RolePermission record); | ||
11 | + | ||
12 | + int insertSelective(RolePermission record); | ||
13 | + | ||
14 | + RolePermission selectByPrimaryKey(Integer id); | ||
15 | + | ||
16 | + int updateByPrimaryKeySelective(RolePermission record); | ||
17 | + | ||
18 | + int updateByPrimaryKey(RolePermission record); | ||
19 | + | ||
20 | + int insertRolePerm(RolePermission record); | ||
21 | + | ||
22 | + int delPermByRoleId(Integer roleId); | ||
23 | + | ||
24 | +} |
@@ -2,6 +2,8 @@ package com.tianbo.warehouse.model; | @@ -2,6 +2,8 @@ package com.tianbo.warehouse.model; | ||
2 | 2 | ||
3 | import org.springframework.security.core.GrantedAuthority; | 3 | import org.springframework.security.core.GrantedAuthority; |
4 | 4 | ||
5 | +import java.util.List; | ||
6 | + | ||
5 | public class ROLE implements GrantedAuthority { | 7 | public class ROLE implements GrantedAuthority { |
6 | private static final long serialVersionUID = 1L; | 8 | private static final long serialVersionUID = 1L; |
7 | 9 | ||
@@ -13,6 +15,8 @@ public class ROLE implements GrantedAuthority { | @@ -13,6 +15,8 @@ public class ROLE implements GrantedAuthority { | ||
13 | 15 | ||
14 | private String description; | 16 | private String description; |
15 | 17 | ||
18 | + private List<PERMISSION> permissions; | ||
19 | + | ||
16 | public Integer getRoleId() { | 20 | public Integer getRoleId() { |
17 | return roleId; | 21 | return roleId; |
18 | } | 22 | } |
@@ -45,6 +49,14 @@ public class ROLE implements GrantedAuthority { | @@ -45,6 +49,14 @@ public class ROLE implements GrantedAuthority { | ||
45 | this.description = description == null ? null : description.trim(); | 49 | this.description = description == null ? null : description.trim(); |
46 | } | 50 | } |
47 | 51 | ||
52 | + public List<PERMISSION> getPermissions() { | ||
53 | + return permissions; | ||
54 | + } | ||
55 | + | ||
56 | + public void setPermissions(List<PERMISSION> permissions) { | ||
57 | + this.permissions = permissions; | ||
58 | + } | ||
59 | + | ||
48 | @Override | 60 | @Override |
49 | public String getAuthority(){ | 61 | public String getAuthority(){ |
50 | return this.getRoleName(); | 62 | return this.getRoleName(); |
1 | +package com.tianbo.warehouse.model; | ||
2 | + | ||
3 | +import java.util.List; | ||
4 | + | ||
5 | +public class RolePermission { | ||
6 | + private Integer id; | ||
7 | + | ||
8 | + private Integer roleId; | ||
9 | + | ||
10 | + private Integer permissionId; | ||
11 | + | ||
12 | + //处理前端提交过来的权限ID列表 | ||
13 | + private List<Integer> permissionIds; | ||
14 | + | ||
15 | + public Integer getId() { | ||
16 | + return id; | ||
17 | + } | ||
18 | + | ||
19 | + public void setId(Integer id) { | ||
20 | + this.id = id; | ||
21 | + } | ||
22 | + | ||
23 | + public Integer getRoleId() { | ||
24 | + return roleId; | ||
25 | + } | ||
26 | + | ||
27 | + public void setRoleId(Integer roleId) { | ||
28 | + this.roleId = roleId; | ||
29 | + } | ||
30 | + | ||
31 | + public Integer getPermissionId() { | ||
32 | + return permissionId; | ||
33 | + } | ||
34 | + | ||
35 | + public void setPermissionId(Integer permissionId) { | ||
36 | + this.permissionId = permissionId; | ||
37 | + } | ||
38 | + | ||
39 | + public List<Integer> getPermissionIds() { | ||
40 | + return permissionIds; | ||
41 | + } | ||
42 | + | ||
43 | + public void setPermissionIds(List<Integer> permissionIds) { | ||
44 | + this.permissionIds = permissionIds; | ||
45 | + } | ||
46 | +} |
@@ -2,15 +2,19 @@ package com.tianbo.warehouse.model; | @@ -2,15 +2,19 @@ package com.tianbo.warehouse.model; | ||
2 | 2 | ||
3 | import lombok.Data; | 3 | import lombok.Data; |
4 | 4 | ||
5 | +import javax.validation.constraints.DecimalMin; | ||
5 | import java.util.List; | 6 | import java.util.List; |
6 | 7 | ||
7 | @Data | 8 | @Data |
8 | public class UserRole { | 9 | public class UserRole { |
9 | 10 | ||
11 | + @DecimalMin("1") | ||
10 | private Integer id; | 12 | private Integer id; |
11 | 13 | ||
14 | + @DecimalMin("1") | ||
12 | private Integer userId; | 15 | private Integer userId; |
13 | 16 | ||
17 | + @DecimalMin("1") | ||
14 | private Integer roleId; | 18 | private Integer roleId; |
15 | 19 | ||
16 | private List<Integer> roleIds; | 20 | private List<Integer> roleIds; |
1 | package com.tianbo.warehouse.service; | 1 | package com.tianbo.warehouse.service; |
2 | 2 | ||
3 | +import com.github.pagehelper.PageInfo; | ||
3 | import com.tianbo.warehouse.model.LOG; | 4 | import com.tianbo.warehouse.model.LOG; |
4 | import com.tianbo.warehouse.model.LOGWithBLOBs; | 5 | import com.tianbo.warehouse.model.LOGWithBLOBs; |
5 | 6 | ||
6 | public interface LogService { | 7 | public interface LogService { |
7 | 8 | ||
8 | int insertSelective(LOGWithBLOBs record); | 9 | int insertSelective(LOGWithBLOBs record); |
10 | + | ||
11 | + PageInfo<LOGWithBLOBs> selectAll(int pageNum, int pageSize); | ||
9 | } | 12 | } |
@@ -2,9 +2,12 @@ package com.tianbo.warehouse.service; | @@ -2,9 +2,12 @@ package com.tianbo.warehouse.service; | ||
2 | 2 | ||
3 | import com.github.pagehelper.PageInfo; | 3 | import com.github.pagehelper.PageInfo; |
4 | import com.tianbo.warehouse.model.ROLE; | 4 | import com.tianbo.warehouse.model.ROLE; |
5 | +import com.tianbo.warehouse.model.RolePermission; | ||
5 | 6 | ||
6 | public interface RoleService { | 7 | public interface RoleService { |
7 | PageInfo<ROLE> findAll(int pageNum, int pageSize); | 8 | PageInfo<ROLE> findAll(int pageNum, int pageSize); |
8 | 9 | ||
9 | int insertSelective(ROLE record); | 10 | int insertSelective(ROLE record); |
11 | + | ||
12 | + int setRolePermissoin(RolePermission record); | ||
10 | } | 13 | } |
1 | package com.tianbo.warehouse.service.imp; | 1 | package com.tianbo.warehouse.service.imp; |
2 | 2 | ||
3 | +import com.github.pagehelper.Page; | ||
4 | +import com.github.pagehelper.PageHelper; | ||
5 | +import com.github.pagehelper.PageInfo; | ||
3 | import com.tianbo.warehouse.dao.LOGMapper; | 6 | import com.tianbo.warehouse.dao.LOGMapper; |
4 | -import com.tianbo.warehouse.model.LOG; | ||
5 | import com.tianbo.warehouse.model.LOGWithBLOBs; | 7 | import com.tianbo.warehouse.model.LOGWithBLOBs; |
6 | import com.tianbo.warehouse.service.LogService; | 8 | import com.tianbo.warehouse.service.LogService; |
7 | import org.springframework.beans.factory.annotation.Autowired; | 9 | import org.springframework.beans.factory.annotation.Autowired; |
8 | import org.springframework.stereotype.Service; | 10 | import org.springframework.stereotype.Service; |
9 | 11 | ||
12 | +import java.util.List; | ||
13 | + | ||
10 | 14 | ||
11 | @Service("webLog") | 15 | @Service("webLog") |
12 | public class LogServiceImp implements LogService{ | 16 | public class LogServiceImp implements LogService{ |
@@ -18,4 +22,12 @@ public class LogServiceImp implements LogService{ | @@ -18,4 +22,12 @@ public class LogServiceImp implements LogService{ | ||
18 | public int insertSelective(LOGWithBLOBs record){ | 22 | public int insertSelective(LOGWithBLOBs record){ |
19 | return logMapper.insertSelective(record); | 23 | return logMapper.insertSelective(record); |
20 | } | 24 | } |
25 | + | ||
26 | + @Override | ||
27 | + public PageInfo<LOGWithBLOBs> selectAll(int pageNum,int pageSize){ | ||
28 | + Page<LOGWithBLOBs> page = PageHelper.startPage(pageNum,pageSize); | ||
29 | + List<LOGWithBLOBs> list = logMapper.selectAll(); | ||
30 | + PageInfo<LOGWithBLOBs> result = new PageInfo<LOGWithBLOBs>(list); | ||
31 | + return result; | ||
32 | + } | ||
21 | } | 33 | } |
@@ -4,12 +4,13 @@ import com.github.pagehelper.Page; | @@ -4,12 +4,13 @@ import com.github.pagehelper.Page; | ||
4 | import com.github.pagehelper.PageHelper; | 4 | import com.github.pagehelper.PageHelper; |
5 | import com.github.pagehelper.PageInfo; | 5 | import com.github.pagehelper.PageInfo; |
6 | import com.tianbo.warehouse.dao.ROLEMapper; | 6 | import com.tianbo.warehouse.dao.ROLEMapper; |
7 | -import com.tianbo.warehouse.model.PERMISSION; | 7 | +import com.tianbo.warehouse.dao.RolePermissionMapper; |
8 | import com.tianbo.warehouse.model.ROLE; | 8 | import com.tianbo.warehouse.model.ROLE; |
9 | -import com.tianbo.warehouse.model.USERS; | 9 | +import com.tianbo.warehouse.model.RolePermission; |
10 | import com.tianbo.warehouse.service.RoleService; | 10 | import com.tianbo.warehouse.service.RoleService; |
11 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
12 | import org.springframework.stereotype.Service; | 12 | import org.springframework.stereotype.Service; |
13 | +import org.springframework.transaction.annotation.Transactional; | ||
13 | 14 | ||
14 | import java.util.List; | 15 | import java.util.List; |
15 | 16 | ||
@@ -17,7 +18,10 @@ import java.util.List; | @@ -17,7 +18,10 @@ import java.util.List; | ||
17 | public class RoleServiceImp implements RoleService{ | 18 | public class RoleServiceImp implements RoleService{ |
18 | 19 | ||
19 | @Autowired | 20 | @Autowired |
20 | - ROLEMapper roleMapper; | 21 | + private ROLEMapper roleMapper; |
22 | + | ||
23 | + @Autowired | ||
24 | + private RolePermissionMapper rolePermissionMapper; | ||
21 | 25 | ||
22 | @Override | 26 | @Override |
23 | public PageInfo<ROLE> findAll(int pageNum, int pageSize){ | 27 | public PageInfo<ROLE> findAll(int pageNum, int pageSize){ |
@@ -31,4 +35,22 @@ public class RoleServiceImp implements RoleService{ | @@ -31,4 +35,22 @@ public class RoleServiceImp implements RoleService{ | ||
31 | public int insertSelective(ROLE record){ | 35 | public int insertSelective(ROLE record){ |
32 | return roleMapper.insertSelective(record); | 36 | return roleMapper.insertSelective(record); |
33 | } | 37 | } |
38 | + | ||
39 | + @Transactional(rollbackFor = Exception.class) | ||
40 | + @Override | ||
41 | + public int setRolePermissoin(RolePermission record){ | ||
42 | + try{ | ||
43 | + Integer roleId = record.getRoleId(); | ||
44 | + List<Integer> permissions = record.getPermissionIds(); | ||
45 | + //这里加个判定,如果前端提交的权限列表是空的,代表清空这个角色的所有权限,防止SQL出错 | ||
46 | + if (null!=permissions && !permissions.isEmpty()){ | ||
47 | + rolePermissionMapper.delPermByRoleId(roleId); | ||
48 | + rolePermissionMapper.insertRolePerm(record); | ||
49 | + } | ||
50 | + return 1; | ||
51 | + }catch (Exception e){ | ||
52 | + e.printStackTrace(); | ||
53 | + return 0; | ||
54 | + } | ||
55 | + } | ||
34 | } | 56 | } |
@@ -97,7 +97,7 @@ public class UserServiceImpl implements UserService{ | @@ -97,7 +97,7 @@ public class UserServiceImpl implements UserService{ | ||
97 | } | 97 | } |
98 | } | 98 | } |
99 | 99 | ||
100 | - /**重置用户的权限 | 100 | + /**重置用户的权限,每次设置用户权限关系前,先删除用户所有权限,再重新分配用户权限 |
101 | *这里需要开启事务,删除 或者插入不生效就回滚 | 101 | *这里需要开启事务,删除 或者插入不生效就回滚 |
102 | * @param userRole | 102 | * @param userRole |
103 | * @return | 103 | * @return |
@@ -45,6 +45,6 @@ | @@ -45,6 +45,6 @@ | ||
45 | <property name="enableSubPackages" value="true"/> | 45 | <property name="enableSubPackages" value="true"/> |
46 | </javaClientGenerator> | 46 | </javaClientGenerator> |
47 | <!-- 要生成的表 tableName是数据库中的表名或视图名 domainObjectName是实体类名--> | 47 | <!-- 要生成的表 tableName是数据库中的表名或视图名 domainObjectName是实体类名--> |
48 | - <table tableName="user_role" domainObjectName="UserRole" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table> | 48 | + <table tableName="log" domainObjectName="LOG" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table> |
49 | </context> | 49 | </context> |
50 | </generatorConfiguration> | 50 | </generatorConfiguration> |
1 | -<?xml version="1.0" encoding="UTF-8" ?> | ||
2 | -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > | ||
3 | -<mapper namespace="com.tianbo.warehouse.dao.LOGMapper" > | ||
4 | - <resultMap id="BaseResultMap" type="com.tianbo.warehouse.model.LOG" > | ||
5 | - <id column="logId" property="logid" jdbcType="INTEGER" /> | ||
6 | - <result column="userName" property="username" jdbcType="VARCHAR" /> | ||
7 | - <result column="ip" property="ip" jdbcType="VARCHAR" /> | ||
8 | - <result column="logCreatTime" property="logcreattime" jdbcType="TIMESTAMP" /> | ||
9 | - <result column="methodName" property="methodname" jdbcType="VARCHAR" /> | ||
10 | - <result column="modelNameCN" property="modelnamecn" jdbcType="VARCHAR" /> | ||
11 | - <result column="operateNameCN" property="operatenamecn" jdbcType="VARCHAR" /> | ||
12 | - <result column="className" property="classname" jdbcType="VARCHAR" /> | 1 | +<?xml version="1.0" encoding="UTF-8"?> |
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
3 | +<mapper namespace="com.tianbo.warehouse.dao.LOGMapper"> | ||
4 | + <resultMap id="BaseResultMap" type="com.tianbo.warehouse.model.LOG"> | ||
5 | + <id column="logId" jdbcType="INTEGER" property="logid" /> | ||
6 | + <result column="userName" jdbcType="VARCHAR" property="username" /> | ||
7 | + <result column="ip" jdbcType="VARCHAR" property="ip" /> | ||
8 | + <result column="logCreatTime" jdbcType="TIMESTAMP" property="logcreattime" /> | ||
9 | + <result column="methodName" jdbcType="VARCHAR" property="methodname" /> | ||
10 | + <result column="modelNameCN" jdbcType="VARCHAR" property="modelnamecn" /> | ||
11 | + <result column="operateNameCN" jdbcType="VARCHAR" property="operatenamecn" /> | ||
12 | + <result column="className" jdbcType="VARCHAR" property="classname" /> | ||
13 | </resultMap> | 13 | </resultMap> |
14 | - <resultMap id="ResultMapWithBLOBs" type="com.tianbo.warehouse.model.LOGWithBLOBs" extends="BaseResultMap" > | ||
15 | - <result column="parameters" property="parameters" jdbcType="LONGVARCHAR" /> | ||
16 | - <result column="result" property="result" jdbcType="LONGVARCHAR" /> | 14 | + <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.tianbo.warehouse.model.LOGWithBLOBs"> |
15 | + <result column="parameters" jdbcType="LONGVARCHAR" property="parameters" /> | ||
16 | + <result column="result" jdbcType="LONGVARCHAR" property="result" /> | ||
17 | </resultMap> | 17 | </resultMap> |
18 | - <sql id="Base_Column_List" > | 18 | + <sql id="Base_Column_List"> |
19 | logId, userName, ip, logCreatTime, methodName, modelNameCN, operateNameCN, className | 19 | logId, userName, ip, logCreatTime, methodName, modelNameCN, operateNameCN, className |
20 | </sql> | 20 | </sql> |
21 | - <sql id="Blob_Column_List" > | 21 | + <sql id="Blob_Column_List"> |
22 | parameters, result | 22 | parameters, result |
23 | </sql> | 23 | </sql> |
24 | - <select id="selectByPrimaryKey" resultMap="ResultMapWithBLOBs" parameterType="java.lang.Integer" > | 24 | + <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="ResultMapWithBLOBs"> |
25 | select | 25 | select |
26 | <include refid="Base_Column_List" /> | 26 | <include refid="Base_Column_List" /> |
27 | , | 27 | , |
@@ -29,11 +29,18 @@ | @@ -29,11 +29,18 @@ | ||
29 | from log | 29 | from log |
30 | where logId = #{logid,jdbcType=INTEGER} | 30 | where logId = #{logid,jdbcType=INTEGER} |
31 | </select> | 31 | </select> |
32 | - <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" > | 32 | + <select id="selectAll" resultMap="ResultMapWithBLOBs"> |
33 | + select | ||
34 | + <include refid="Base_Column_List" /> | ||
35 | + , | ||
36 | + <include refid="Blob_Column_List" /> | ||
37 | + from log | ||
38 | + </select> | ||
39 | + <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> | ||
33 | delete from log | 40 | delete from log |
34 | where logId = #{logid,jdbcType=INTEGER} | 41 | where logId = #{logid,jdbcType=INTEGER} |
35 | </delete> | 42 | </delete> |
36 | - <insert id="insert" parameterType="com.tianbo.warehouse.model.LOGWithBLOBs" > | 43 | + <insert id="insert" parameterType="com.tianbo.warehouse.model.LOGWithBLOBs"> |
37 | insert into log (logId, userName, ip, | 44 | insert into log (logId, userName, ip, |
38 | logCreatTime, methodName, modelNameCN, | 45 | logCreatTime, methodName, modelNameCN, |
39 | operateNameCN, className, parameters, | 46 | operateNameCN, className, parameters, |
@@ -43,107 +50,107 @@ | @@ -43,107 +50,107 @@ | ||
43 | #{operatenamecn,jdbcType=VARCHAR}, #{classname,jdbcType=VARCHAR}, #{parameters,jdbcType=LONGVARCHAR}, | 50 | #{operatenamecn,jdbcType=VARCHAR}, #{classname,jdbcType=VARCHAR}, #{parameters,jdbcType=LONGVARCHAR}, |
44 | #{result,jdbcType=LONGVARCHAR}) | 51 | #{result,jdbcType=LONGVARCHAR}) |
45 | </insert> | 52 | </insert> |
46 | - <insert id="insertSelective" parameterType="com.tianbo.warehouse.model.LOGWithBLOBs" > | 53 | + <insert id="insertSelective" parameterType="com.tianbo.warehouse.model.LOGWithBLOBs"> |
47 | insert into log | 54 | insert into log |
48 | - <trim prefix="(" suffix=")" suffixOverrides="," > | ||
49 | - <if test="logid != null" > | 55 | + <trim prefix="(" suffix=")" suffixOverrides=","> |
56 | + <if test="logid != null"> | ||
50 | logId, | 57 | logId, |
51 | </if> | 58 | </if> |
52 | - <if test="username != null" > | 59 | + <if test="username != null"> |
53 | userName, | 60 | userName, |
54 | </if> | 61 | </if> |
55 | - <if test="ip != null" > | 62 | + <if test="ip != null"> |
56 | ip, | 63 | ip, |
57 | </if> | 64 | </if> |
58 | - <if test="logcreattime != null" > | 65 | + <if test="logcreattime != null"> |
59 | logCreatTime, | 66 | logCreatTime, |
60 | </if> | 67 | </if> |
61 | - <if test="methodname != null" > | 68 | + <if test="methodname != null"> |
62 | methodName, | 69 | methodName, |
63 | </if> | 70 | </if> |
64 | - <if test="modelnamecn != null" > | 71 | + <if test="modelnamecn != null"> |
65 | modelNameCN, | 72 | modelNameCN, |
66 | </if> | 73 | </if> |
67 | - <if test="operatenamecn != null" > | 74 | + <if test="operatenamecn != null"> |
68 | operateNameCN, | 75 | operateNameCN, |
69 | </if> | 76 | </if> |
70 | - <if test="classname != null" > | 77 | + <if test="classname != null"> |
71 | className, | 78 | className, |
72 | </if> | 79 | </if> |
73 | - <if test="parameters != null" > | 80 | + <if test="parameters != null"> |
74 | parameters, | 81 | parameters, |
75 | </if> | 82 | </if> |
76 | - <if test="result != null" > | 83 | + <if test="result != null"> |
77 | result, | 84 | result, |
78 | </if> | 85 | </if> |
79 | </trim> | 86 | </trim> |
80 | - <trim prefix="values (" suffix=")" suffixOverrides="," > | ||
81 | - <if test="logid != null" > | 87 | + <trim prefix="values (" suffix=")" suffixOverrides=","> |
88 | + <if test="logid != null"> | ||
82 | #{logid,jdbcType=INTEGER}, | 89 | #{logid,jdbcType=INTEGER}, |
83 | </if> | 90 | </if> |
84 | - <if test="username != null" > | 91 | + <if test="username != null"> |
85 | #{username,jdbcType=VARCHAR}, | 92 | #{username,jdbcType=VARCHAR}, |
86 | </if> | 93 | </if> |
87 | - <if test="ip != null" > | 94 | + <if test="ip != null"> |
88 | #{ip,jdbcType=VARCHAR}, | 95 | #{ip,jdbcType=VARCHAR}, |
89 | </if> | 96 | </if> |
90 | - <if test="logcreattime != null" > | 97 | + <if test="logcreattime != null"> |
91 | #{logcreattime,jdbcType=TIMESTAMP}, | 98 | #{logcreattime,jdbcType=TIMESTAMP}, |
92 | </if> | 99 | </if> |
93 | - <if test="methodname != null" > | 100 | + <if test="methodname != null"> |
94 | #{methodname,jdbcType=VARCHAR}, | 101 | #{methodname,jdbcType=VARCHAR}, |
95 | </if> | 102 | </if> |
96 | - <if test="modelnamecn != null" > | 103 | + <if test="modelnamecn != null"> |
97 | #{modelnamecn,jdbcType=VARCHAR}, | 104 | #{modelnamecn,jdbcType=VARCHAR}, |
98 | </if> | 105 | </if> |
99 | - <if test="operatenamecn != null" > | 106 | + <if test="operatenamecn != null"> |
100 | #{operatenamecn,jdbcType=VARCHAR}, | 107 | #{operatenamecn,jdbcType=VARCHAR}, |
101 | </if> | 108 | </if> |
102 | - <if test="classname != null" > | 109 | + <if test="classname != null"> |
103 | #{classname,jdbcType=VARCHAR}, | 110 | #{classname,jdbcType=VARCHAR}, |
104 | </if> | 111 | </if> |
105 | - <if test="parameters != null" > | 112 | + <if test="parameters != null"> |
106 | #{parameters,jdbcType=LONGVARCHAR}, | 113 | #{parameters,jdbcType=LONGVARCHAR}, |
107 | </if> | 114 | </if> |
108 | - <if test="result != null" > | 115 | + <if test="result != null"> |
109 | #{result,jdbcType=LONGVARCHAR}, | 116 | #{result,jdbcType=LONGVARCHAR}, |
110 | </if> | 117 | </if> |
111 | </trim> | 118 | </trim> |
112 | </insert> | 119 | </insert> |
113 | - <update id="updateByPrimaryKeySelective" parameterType="com.tianbo.warehouse.model.LOGWithBLOBs" > | 120 | + <update id="updateByPrimaryKeySelective" parameterType="com.tianbo.warehouse.model.LOGWithBLOBs"> |
114 | update log | 121 | update log |
115 | - <set > | ||
116 | - <if test="username != null" > | 122 | + <set> |
123 | + <if test="username != null"> | ||
117 | userName = #{username,jdbcType=VARCHAR}, | 124 | userName = #{username,jdbcType=VARCHAR}, |
118 | </if> | 125 | </if> |
119 | - <if test="ip != null" > | 126 | + <if test="ip != null"> |
120 | ip = #{ip,jdbcType=VARCHAR}, | 127 | ip = #{ip,jdbcType=VARCHAR}, |
121 | </if> | 128 | </if> |
122 | - <if test="logcreattime != null" > | 129 | + <if test="logcreattime != null"> |
123 | logCreatTime = #{logcreattime,jdbcType=TIMESTAMP}, | 130 | logCreatTime = #{logcreattime,jdbcType=TIMESTAMP}, |
124 | </if> | 131 | </if> |
125 | - <if test="methodname != null" > | 132 | + <if test="methodname != null"> |
126 | methodName = #{methodname,jdbcType=VARCHAR}, | 133 | methodName = #{methodname,jdbcType=VARCHAR}, |
127 | </if> | 134 | </if> |
128 | - <if test="modelnamecn != null" > | 135 | + <if test="modelnamecn != null"> |
129 | modelNameCN = #{modelnamecn,jdbcType=VARCHAR}, | 136 | modelNameCN = #{modelnamecn,jdbcType=VARCHAR}, |
130 | </if> | 137 | </if> |
131 | - <if test="operatenamecn != null" > | 138 | + <if test="operatenamecn != null"> |
132 | operateNameCN = #{operatenamecn,jdbcType=VARCHAR}, | 139 | operateNameCN = #{operatenamecn,jdbcType=VARCHAR}, |
133 | </if> | 140 | </if> |
134 | - <if test="classname != null" > | 141 | + <if test="classname != null"> |
135 | className = #{classname,jdbcType=VARCHAR}, | 142 | className = #{classname,jdbcType=VARCHAR}, |
136 | </if> | 143 | </if> |
137 | - <if test="parameters != null" > | 144 | + <if test="parameters != null"> |
138 | parameters = #{parameters,jdbcType=LONGVARCHAR}, | 145 | parameters = #{parameters,jdbcType=LONGVARCHAR}, |
139 | </if> | 146 | </if> |
140 | - <if test="result != null" > | 147 | + <if test="result != null"> |
141 | result = #{result,jdbcType=LONGVARCHAR}, | 148 | result = #{result,jdbcType=LONGVARCHAR}, |
142 | </if> | 149 | </if> |
143 | </set> | 150 | </set> |
144 | where logId = #{logid,jdbcType=INTEGER} | 151 | where logId = #{logid,jdbcType=INTEGER} |
145 | </update> | 152 | </update> |
146 | - <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.tianbo.warehouse.model.LOGWithBLOBs" > | 153 | + <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.tianbo.warehouse.model.LOGWithBLOBs"> |
147 | update log | 154 | update log |
148 | set userName = #{username,jdbcType=VARCHAR}, | 155 | set userName = #{username,jdbcType=VARCHAR}, |
149 | ip = #{ip,jdbcType=VARCHAR}, | 156 | ip = #{ip,jdbcType=VARCHAR}, |
@@ -156,7 +163,7 @@ | @@ -156,7 +163,7 @@ | ||
156 | result = #{result,jdbcType=LONGVARCHAR} | 163 | result = #{result,jdbcType=LONGVARCHAR} |
157 | where logId = #{logid,jdbcType=INTEGER} | 164 | where logId = #{logid,jdbcType=INTEGER} |
158 | </update> | 165 | </update> |
159 | - <update id="updateByPrimaryKey" parameterType="com.tianbo.warehouse.model.LOG" > | 166 | + <update id="updateByPrimaryKey" parameterType="com.tianbo.warehouse.model.LOG"> |
160 | update log | 167 | update log |
161 | set userName = #{username,jdbcType=VARCHAR}, | 168 | set userName = #{username,jdbcType=VARCHAR}, |
162 | ip = #{ip,jdbcType=VARCHAR}, | 169 | ip = #{ip,jdbcType=VARCHAR}, |
@@ -28,9 +28,16 @@ | @@ -28,9 +28,16 @@ | ||
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 permission_order | 31 | + from permission ORDER BY ismenu,parent_id,permission_order |
32 | + </select> | ||
33 | + <select id="getRolePermisson" resultMap="BaseResultMap" parameterType="java.lang.Integer"> | ||
34 | + SELECT P.* | ||
35 | + FROM role R | ||
36 | + LEFT JOIN role_permission RP ON R.role_id = RP.role_id | ||
37 | + LEFT JOIN permission P ON RP.permission_id = P.permission_id | ||
38 | + WHERE r.role_id=#{roleId,jdbcType=INTEGER} | ||
39 | + ORDER BY P.ismenu,P.name,p.permission_order DESC | ||
32 | </select> | 40 | </select> |
33 | - | ||
34 | <select id="getAllMenus" resultMap="BaseResultMap" > | 41 | <select id="getAllMenus" resultMap="BaseResultMap" > |
35 | SELECT | 42 | SELECT |
36 | P .* | 43 | P .* |
@@ -6,6 +6,7 @@ | @@ -6,6 +6,7 @@ | ||
6 | <result column="role_name" jdbcType="VARCHAR" property="roleName" /> | 6 | <result column="role_name" jdbcType="VARCHAR" property="roleName" /> |
7 | <result column="role_sign" jdbcType="VARCHAR" property="roleSign" /> | 7 | <result column="role_sign" jdbcType="VARCHAR" property="roleSign" /> |
8 | <result column="description" jdbcType="VARCHAR" property="description" /> | 8 | <result column="description" jdbcType="VARCHAR" property="description" /> |
9 | + <collection property="permissions" ofType="PERMISSION" javaType="java.util.ArrayList" select="com.tianbo.warehouse.dao.PERMISSIONMapper.getRolePermisson" column="role_id"></collection> | ||
9 | </resultMap> | 10 | </resultMap> |
10 | <sql id="Base_Column_List"> | 11 | <sql id="Base_Column_List"> |
11 | role_id, role_name, role_sign, description | 12 | role_id, role_name, role_sign, description |
@@ -17,9 +18,9 @@ | @@ -17,9 +18,9 @@ | ||
17 | where role_id = #{roleId,jdbcType=INTEGER} | 18 | where role_id = #{roleId,jdbcType=INTEGER} |
18 | </select> | 19 | </select> |
19 | <select id="findAll" resultMap="BaseResultMap" > | 20 | <select id="findAll" resultMap="BaseResultMap" > |
20 | - select | 21 | + SELECT |
21 | <include refid="Base_Column_List" /> | 22 | <include refid="Base_Column_List" /> |
22 | - from role | 23 | + FROM role |
23 | </select> | 24 | </select> |
24 | <select id="findRolesByUserId" parameterType="java.lang.Integer" resultMap="BaseResultMap"> | 25 | <select id="findRolesByUserId" parameterType="java.lang.Integer" resultMap="BaseResultMap"> |
25 | SELECT | 26 | SELECT |
@@ -40,7 +41,8 @@ | @@ -40,7 +41,8 @@ | ||
40 | values (#{roleId,jdbcType=INTEGER}, #{roleName,jdbcType=VARCHAR}, #{roleSign,jdbcType=VARCHAR}, | 41 | values (#{roleId,jdbcType=INTEGER}, #{roleName,jdbcType=VARCHAR}, #{roleSign,jdbcType=VARCHAR}, |
41 | #{description,jdbcType=VARCHAR}) | 42 | #{description,jdbcType=VARCHAR}) |
42 | </insert> | 43 | </insert> |
43 | - <insert id="insertSelective" parameterType="com.tianbo.warehouse.model.ROLE"> | 44 | + |
45 | + <insert id="insertSelective" parameterType="Integer"> | ||
44 | insert into role | 46 | insert into role |
45 | <trim prefix="(" suffix=")" suffixOverrides=","> | 47 | <trim prefix="(" suffix=")" suffixOverrides=","> |
46 | <if test="roleId != null"> | 48 | <if test="roleId != null"> |
1 | +<?xml version="1.0" encoding="UTF-8" ?> | ||
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > | ||
3 | +<mapper namespace="com.tianbo.warehouse.dao.RolePermissionMapper" > | ||
4 | + <resultMap id="BaseResultMap" type="com.tianbo.warehouse.model.RolePermission" > | ||
5 | + <id column="id" property="id" jdbcType="INTEGER" /> | ||
6 | + <result column="role_id" property="roleId" jdbcType="INTEGER" /> | ||
7 | + <result column="permission_id" property="permissionId" jdbcType="INTEGER" /> | ||
8 | + </resultMap> | ||
9 | + <sql id="Base_Column_List" > | ||
10 | + id, role_id, permission_id | ||
11 | + </sql> | ||
12 | + <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" > | ||
13 | + select | ||
14 | + <include refid="Base_Column_List" /> | ||
15 | + from role_permission | ||
16 | + where id = #{id,jdbcType=INTEGER} | ||
17 | + </select> | ||
18 | + <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" > | ||
19 | + delete from role_permission | ||
20 | + where id = #{id,jdbcType=INTEGER} | ||
21 | + </delete> | ||
22 | + <delete id="delPermByRoleId" parameterType="java.lang.Integer"> | ||
23 | + delete from role_permission | ||
24 | + where role_id = #{roleId,jdbcType=INTEGER} | ||
25 | + </delete> | ||
26 | + <insert id="insert" parameterType="com.tianbo.warehouse.model.RolePermission" > | ||
27 | + insert into role_permission (id, role_id, permission_id | ||
28 | + ) | ||
29 | + values (#{id,jdbcType=INTEGER}, #{roleId,jdbcType=INTEGER}, #{permissionId,jdbcType=INTEGER} | ||
30 | + ) | ||
31 | + </insert> | ||
32 | + <insert id="insertRolePerm" parameterType="RolePermission"> | ||
33 | + insert into role_permission(role_id, permission_id) | ||
34 | + values | ||
35 | + <foreach collection="permissionIds" item="rolePem" index="index" separator=","> | ||
36 | + (#{roleId,jdbcType=INTEGER},#{rolePem,jdbcType=INTEGER}) | ||
37 | + </foreach> | ||
38 | + </insert> | ||
39 | + <insert id="insertSelective" parameterType="com.tianbo.warehouse.model.RolePermission" > | ||
40 | + insert into role_permission | ||
41 | + <trim prefix="(" suffix=")" suffixOverrides="," > | ||
42 | + <if test="id != null" > | ||
43 | + id, | ||
44 | + </if> | ||
45 | + <if test="roleId != null" > | ||
46 | + role_id, | ||
47 | + </if> | ||
48 | + <if test="permissionId != null" > | ||
49 | + permission_id, | ||
50 | + </if> | ||
51 | + </trim> | ||
52 | + <trim prefix="values (" suffix=")" suffixOverrides="," > | ||
53 | + <if test="id != null" > | ||
54 | + #{id,jdbcType=INTEGER}, | ||
55 | + </if> | ||
56 | + <if test="roleId != null" > | ||
57 | + #{roleId,jdbcType=INTEGER}, | ||
58 | + </if> | ||
59 | + <if test="permissionId != null" > | ||
60 | + #{permissionId,jdbcType=INTEGER}, | ||
61 | + </if> | ||
62 | + </trim> | ||
63 | + </insert> | ||
64 | + <update id="updateByPrimaryKeySelective" parameterType="com.tianbo.warehouse.model.RolePermission" > | ||
65 | + update role_permission | ||
66 | + <set > | ||
67 | + <if test="roleId != null" > | ||
68 | + role_id = #{roleId,jdbcType=INTEGER}, | ||
69 | + </if> | ||
70 | + <if test="permissionId != null" > | ||
71 | + permission_id = #{permissionId,jdbcType=INTEGER}, | ||
72 | + </if> | ||
73 | + </set> | ||
74 | + where id = #{id,jdbcType=INTEGER} | ||
75 | + </update> | ||
76 | + <update id="updateByPrimaryKey" parameterType="com.tianbo.warehouse.model.RolePermission" > | ||
77 | + update role_permission | ||
78 | + set role_id = #{roleId,jdbcType=INTEGER}, | ||
79 | + permission_id = #{permissionId,jdbcType=INTEGER} | ||
80 | + where id = #{id,jdbcType=INTEGER} | ||
81 | + </update> | ||
82 | +</mapper> |
@@ -24,17 +24,14 @@ | @@ -24,17 +24,14 @@ | ||
24 | where user_id = #{userId,jdbcType=INTEGER} | 24 | where user_id = #{userId,jdbcType=INTEGER} |
25 | </delete> | 25 | </delete> |
26 | <insert id="insert" parameterType="com.tianbo.warehouse.model.UserRole" > | 26 | <insert id="insert" parameterType="com.tianbo.warehouse.model.UserRole" > |
27 | - insert into user_role (id, user_id, role_id | 27 | + insert into user_role (user_id, role_id |
28 | ) | 28 | ) |
29 | - values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{roleId,jdbcType=INTEGER} | 29 | + values (#{userId,jdbcType=INTEGER}, #{roleId,jdbcType=INTEGER} |
30 | ) | 30 | ) |
31 | </insert> | 31 | </insert> |
32 | <insert id="insertSelective" parameterType="com.tianbo.warehouse.model.UserRole" > | 32 | <insert id="insertSelective" parameterType="com.tianbo.warehouse.model.UserRole" > |
33 | insert into user_role | 33 | insert into user_role |
34 | <trim prefix="(" suffix=")" suffixOverrides="," > | 34 | <trim prefix="(" suffix=")" suffixOverrides="," > |
35 | - <if test="id != null" > | ||
36 | - id, | ||
37 | - </if> | ||
38 | <if test="userId != null" > | 35 | <if test="userId != null" > |
39 | user_id, | 36 | user_id, |
40 | </if> | 37 | </if> |
@@ -43,9 +40,6 @@ | @@ -43,9 +40,6 @@ | ||
43 | </if> | 40 | </if> |
44 | </trim> | 41 | </trim> |
45 | <trim prefix="values (" suffix=")" suffixOverrides="," > | 42 | <trim prefix="values (" suffix=")" suffixOverrides="," > |
46 | - <if test="id != null" > | ||
47 | - #{id,jdbcType=INTEGER}, | ||
48 | - </if> | ||
49 | <if test="userId != null" > | 43 | <if test="userId != null" > |
50 | #{userId,jdbcType=INTEGER}, | 44 | #{userId,jdbcType=INTEGER}, |
51 | </if> | 45 | </if> |
-
请 注册 或 登录 后发表评论