作者 shenhailong

。。。。

@@ -67,7 +67,7 @@ public class CompanyController { @@ -67,7 +67,7 @@ public class CompanyController {
67 67
68 ResultJson resultJson = new ResultJson(); 68 ResultJson resultJson = new ResultJson();
69 if (1==i){ 69 if (1==i){
70 - resultJson = new ResultJson("200","修改成功"); 70 + resultJson = new ResultJson("200","删除成功");
71 }else { 71 }else {
72 resultJson = new ResultJson("500","insert faild"); 72 resultJson = new ResultJson("500","insert faild");
73 } 73 }
@@ -81,7 +81,7 @@ public class CompanyController { @@ -81,7 +81,7 @@ public class CompanyController {
81 ResultJson resultJson = new ResultJson(); 81 ResultJson resultJson = new ResultJson();
82 82
83 if (companyService.deleteByPrimaryKey(ids)>0){ 83 if (companyService.deleteByPrimaryKey(ids)>0){
84 - resultJson = new ResultJson("200","修改成功"); 84 + resultJson = new ResultJson("200","删除成功");
85 }else { 85 }else {
86 resultJson = new ResultJson("500","insert faild"); 86 resultJson = new ResultJson("500","insert faild");
87 } 87 }
  1 +package com.tianbo.warehouse.controller;
  2 +
  3 +import com.github.pagehelper.PageInfo;
  4 +import com.tianbo.warehouse.annotation.LogAnnotation;
  5 +import com.tianbo.warehouse.controller.response.ResultJson;
  6 +import com.tianbo.warehouse.model.Company;
  7 +import com.tianbo.warehouse.model.Department;
  8 +import com.tianbo.warehouse.service.CompanyService;
  9 +import com.tianbo.warehouse.service.DepartmentService;
  10 +import org.springframework.beans.factory.annotation.Autowired;
  11 +import org.springframework.web.bind.annotation.*;
  12 +
  13 +import javax.servlet.http.HttpServletRequest;
  14 +import javax.servlet.http.HttpServletResponse;
  15 +import javax.validation.Valid;
  16 +
  17 +@RestController
  18 +@RequestMapping("/department")
  19 +public class DeparmentController {
  20 +
  21 + @Autowired
  22 + DepartmentService departmentService;
  23 +
  24 + @GetMapping("/list")
  25 + public PageInfo<Department> list(@RequestParam(value = "pageNum",required = false,defaultValue = "1")
  26 + int pageNum,
  27 + @RequestParam(value = "pageSize",required = false,defaultValue = "5")
  28 + int pageSize){
  29 + return departmentService.findAll(pageNum,pageSize);
  30 +
  31 + }
  32 +
  33 + @LogAnnotation(moduleName = "部门管理",operate = "部门添加")
  34 + @PostMapping("/add")
  35 + public ResultJson add(@RequestBody Department department){
  36 +
  37 + int i =departmentService.insertSelective(department);
  38 +
  39 + ResultJson resultJson = new ResultJson();
  40 + if (1==i){
  41 + resultJson = new ResultJson("200","添加成功");
  42 + }else {
  43 + resultJson = new ResultJson("500","insert faild");
  44 + }
  45 + return resultJson;
  46 + }
  47 +
  48 + @LogAnnotation(moduleName = "部门管理",operate = "部门修改")
  49 + @PutMapping("/edit")
  50 + @ResponseBody
  51 + public ResultJson edit(@RequestBody @Valid Department department){
  52 +
  53 + int i =departmentService.updateByPrimaryKeySelective(department);
  54 +
  55 + ResultJson resultJson = new ResultJson();
  56 + if (1==i){
  57 + resultJson = new ResultJson("200","修改成功");
  58 + }else {
  59 + resultJson = new ResultJson("500","insert faild");
  60 + }
  61 + return resultJson;
  62 + }
  63 +
  64 + @LogAnnotation(moduleName = "部门管理",operate = "部门删除")
  65 + @DeleteMapping("/del")
  66 + public ResultJson reomve(@RequestBody Department department, HttpServletRequest request, HttpServletResponse response){
  67 +
  68 + int i =departmentService.deleteByPrimaryKey(department.getDepartmentId());
  69 +
  70 + ResultJson resultJson = new ResultJson();
  71 + if (1==i){
  72 + resultJson = new ResultJson("200","删除成功");
  73 + }else {
  74 + resultJson = new ResultJson("500","insert faild");
  75 + }
  76 + return resultJson;
  77 + }
  78 +
  79 + @LogAnnotation(moduleName = "部门管理",operate = "部门批量删除")
  80 + @GetMapping("/batchremove")
  81 + public ResultJson reomve(String ids, HttpServletRequest request, HttpServletResponse response){
  82 +
  83 + ResultJson resultJson = new ResultJson();
  84 +
  85 + if (departmentService.deleteByPrimaryKey(ids)>0){
  86 + resultJson = new ResultJson("200","删除成功");
  87 + }else {
  88 + resultJson = new ResultJson("500","insert faild");
  89 + }
  90 + return resultJson;
  91 + }
  92 +
  93 +}
  1 +package com.tianbo.warehouse.controller;
  2 +
  3 +import com.github.pagehelper.PageInfo;
  4 +import com.tianbo.warehouse.annotation.LogAnnotation;
  5 +import com.tianbo.warehouse.controller.response.ResultJson;
  6 +import com.tianbo.warehouse.model.Department;
  7 +import com.tianbo.warehouse.model.Group_company;
  8 +import com.tianbo.warehouse.service.DepartmentService;
  9 +import com.tianbo.warehouse.service.GroupCompanyService;
  10 +import org.springframework.beans.factory.annotation.Autowired;
  11 +import org.springframework.web.bind.annotation.*;
  12 +
  13 +import javax.servlet.http.HttpServletRequest;
  14 +import javax.servlet.http.HttpServletResponse;
  15 +import javax.validation.Valid;
  16 +
  17 +@RestController
  18 +@RequestMapping("/group")
  19 +public class GroupCompanyController {
  20 +
  21 + @Autowired
  22 + GroupCompanyService groupCompanyService;
  23 +
  24 + @GetMapping("/list")
  25 + public PageInfo<Group_company> list(@RequestParam(value = "pageNum",required = false,defaultValue = "1")
  26 + int pageNum,
  27 + @RequestParam(value = "pageSize",required = false,defaultValue = "5")
  28 + int pageSize){
  29 + return groupCompanyService.findAll(pageNum,pageSize);
  30 +
  31 + }
  32 +
  33 + @LogAnnotation(moduleName = "集团管理",operate = "集团添加")
  34 + @PostMapping("/add")
  35 + public ResultJson add(@RequestBody Group_company group_company){
  36 +
  37 + int i =groupCompanyService.insertSelective(group_company);
  38 +
  39 + ResultJson resultJson = new ResultJson();
  40 + if (1==i){
  41 + resultJson = new ResultJson("200","添加成功");
  42 + }else {
  43 + resultJson = new ResultJson("500","insert faild");
  44 + }
  45 + return resultJson;
  46 + }
  47 +
  48 + @LogAnnotation(moduleName = "集团管理",operate = "集团修改")
  49 + @PutMapping("/edit")
  50 + @ResponseBody
  51 + public ResultJson edit(@RequestBody @Valid Group_company group_company){
  52 +
  53 + int i =groupCompanyService.updateByPrimaryKeySelective(group_company);
  54 +
  55 + ResultJson resultJson = new ResultJson();
  56 + if (1==i){
  57 + resultJson = new ResultJson("200","修改成功");
  58 + }else {
  59 + resultJson = new ResultJson("500","insert faild");
  60 + }
  61 + return resultJson;
  62 + }
  63 +
  64 + @LogAnnotation(moduleName = "集团管理",operate = "集团删除")
  65 + @DeleteMapping("/del")
  66 + public ResultJson reomve(@RequestBody Group_company group_company, HttpServletRequest request, HttpServletResponse response){
  67 +
  68 + int i =groupCompanyService.deleteByPrimaryKey(group_company.getGroupId());
  69 +
  70 + ResultJson resultJson = new ResultJson();
  71 + if (1==i){
  72 + resultJson = new ResultJson("200","删除成功");
  73 + }else {
  74 + resultJson = new ResultJson("500","insert faild");
  75 + }
  76 + return resultJson;
  77 + }
  78 +
  79 + @LogAnnotation(moduleName = "集团管理",operate = "集团批量删除")
  80 + @GetMapping("/batchremove")
  81 + public ResultJson reomve(String ids, HttpServletRequest request, HttpServletResponse response){
  82 +
  83 + ResultJson resultJson = new ResultJson();
  84 +
  85 + if (groupCompanyService.deleteByPrimaryKey(ids)>0){
  86 + resultJson = new ResultJson("200","删除成功");
  87 + }else {
  88 + resultJson = new ResultJson("500","insert faild");
  89 + }
  90 + return resultJson;
  91 + }
  92 +
  93 +}
@@ -9,22 +9,28 @@ import com.tianbo.warehouse.service.RoleService; @@ -9,22 +9,28 @@ import com.tianbo.warehouse.service.RoleService;
9 import org.springframework.beans.factory.annotation.Autowired; 9 import org.springframework.beans.factory.annotation.Autowired;
10 import org.springframework.web.bind.annotation.*; 10 import org.springframework.web.bind.annotation.*;
11 11
  12 +import javax.servlet.http.HttpServletRequest;
  13 +import javax.servlet.http.HttpServletResponse;
  14 +import javax.validation.Valid;
  15 +
12 @RestController() 16 @RestController()
  17 +@RequestMapping("/role")
13 public class RoleController { 18 public class RoleController {
14 19
15 @Autowired 20 @Autowired
16 RoleService roleService; 21 RoleService roleService;
17 22
18 - @GetMapping("/role/list") 23 + @GetMapping("/list")
19 public PageInfo<ROLE> list(@RequestParam(value = "pageNum",required = false,defaultValue = "1") 24 public PageInfo<ROLE> list(@RequestParam(value = "pageNum",required = false,defaultValue = "1")
20 int pageNum, 25 int pageNum,
21 - @RequestParam(value = "pageSize",required = false,defaultValue = "5") 26 + @RequestParam(value = "pageSize",required = false,defaultValue = "10")
22 int pageSize){ 27 int pageSize){
  28 +
23 return roleService.findAll(pageNum,pageSize); 29 return roleService.findAll(pageNum,pageSize);
24 } 30 }
25 31
26 - @LogAnnotation(moduleName = "角色管理",operate = "角色添加")  
27 - @PostMapping("/role/add") 32 + @LogAnnotation(moduleName = "岗位/角色管理",operate = "岗位/角色添加")
  33 + @PostMapping("/add")
28 public ResultJson add(@RequestBody ROLE role){ 34 public ResultJson add(@RequestBody ROLE role){
29 int i =roleService.insertSelective(role); 35 int i =roleService.insertSelective(role);
30 return i==1 ? new ResultJson("200","添加权限成功") :new ResultJson("500","insert faild"); 36 return i==1 ? new ResultJson("200","添加权限成功") :new ResultJson("500","insert faild");
@@ -35,10 +41,56 @@ public class RoleController { @@ -35,10 +41,56 @@ public class RoleController {
35 * 设置角色的权限 41 * 设置角色的权限
36 * @return 42 * @return
37 */ 43 */
38 - @LogAnnotation(moduleName = "角色管理",operate = "权限设置")  
39 - @PutMapping("/role/permSet") 44 + @LogAnnotation(moduleName = "岗位/角色管理",operate = "权限设置")
  45 + @PutMapping("/permSet")
40 public ResultJson permissionSet(@RequestBody RolePermission rolePermission){ 46 public ResultJson permissionSet(@RequestBody RolePermission rolePermission){
41 int i = roleService.setRolePermissoin(rolePermission); 47 int i = roleService.setRolePermissoin(rolePermission);
42 return i==1 ? new ResultJson("200","设置权限成功") :new ResultJson("500","设置权限失败"); 48 return i==1 ? new ResultJson("200","设置权限成功") :new ResultJson("500","设置权限失败");
43 } 49 }
  50 +
  51 + @LogAnnotation(moduleName = "岗位/角色管理",operate = "岗位/角色修改")
  52 + @PutMapping("/edit")
  53 + @ResponseBody
  54 + public ResultJson edit(@RequestBody @Valid ROLE role){
  55 +
  56 + int i =roleService.updateByPrimaryKeySelective(role);
  57 +
  58 + ResultJson resultJson = new ResultJson();
  59 + if (1==i){
  60 + resultJson = new ResultJson("200","修改成功");
  61 + }else {
  62 + resultJson = new ResultJson("500","insert faild");
  63 + }
  64 + return resultJson;
  65 + }
  66 +
  67 + @LogAnnotation(moduleName = "岗位/角色管理",operate = "岗位/角色删除")
  68 + @DeleteMapping("/del")
  69 + public ResultJson reomve(@RequestBody ROLE role, HttpServletRequest request, HttpServletResponse response){
  70 +
  71 + int i =roleService.deleteByPrimaryKey(role.getRoleId());
  72 +
  73 + ResultJson resultJson = new ResultJson();
  74 + if (1==i){
  75 + resultJson = new ResultJson("200","删除成功");
  76 + }else {
  77 + resultJson = new ResultJson("500","insert faild");
  78 + }
  79 + return resultJson;
  80 + }
  81 +
  82 + @LogAnnotation(moduleName = "岗位/角色管理",operate = "岗位/角色批量删除")
  83 + @GetMapping("/batchremove")
  84 + public ResultJson reomve(String ids, HttpServletRequest request, HttpServletResponse response){
  85 +
  86 + ResultJson resultJson = new ResultJson();
  87 +
  88 + if (roleService.deleteByPrimaryKey(Integer.valueOf(ids))>0){
  89 + resultJson = new ResultJson("200","删除成功");
  90 + }else {
  91 + resultJson = new ResultJson("500","insert faild");
  92 + }
  93 + return resultJson;
  94 + }
  95 +
44 } 96 }
  1 +package com.tianbo.warehouse.dao;
  2 +
  3 +import com.tianbo.warehouse.model.Department;
  4 +
  5 +import java.util.List;
  6 +
  7 +public interface DepartmentMapper {
  8 + int deleteByPrimaryKey(String departmentId);
  9 +
  10 + int insert(Department record);
  11 +
  12 + int insertSelective(Department record);
  13 +
  14 + Department selectByPrimaryKey(String departmentId);
  15 +
  16 + int updateByPrimaryKeySelective(Department record);
  17 +
  18 + int updateByPrimaryKey(Department record);
  19 +
  20 + List<Department> findAll();
  21 +}
  1 +package com.tianbo.warehouse.dao;
  2 +
  3 +import com.tianbo.warehouse.model.Group_company;
  4 +
  5 +import java.util.List;
  6 +
  7 +public interface Group_companyMapper {
  8 + int deleteByPrimaryKey(String groupId);
  9 +
  10 + int insert(Group_company record);
  11 +
  12 + int insertSelective(Group_company record);
  13 +
  14 + Group_company selectByPrimaryKey(String groupId);
  15 +
  16 + int updateByPrimaryKeySelective(Group_company record);
  17 +
  18 + int updateByPrimaryKey(Group_company record);
  19 +
  20 + List<Group_company> findAll();
  21 +}
1 package com.tianbo.warehouse.dao; 1 package com.tianbo.warehouse.dao;
2 2
3 -import com.tianbo.warehouse.model.PERMISSION;  
4 import com.tianbo.warehouse.model.ROLE; 3 import com.tianbo.warehouse.model.ROLE;
5 4
6 -import java.math.BigDecimal;  
7 -import java.util.HashMap;  
8 import java.util.List; 5 import java.util.List;
9 -import java.util.Map;  
10 6
11 public interface ROLEMapper { 7 public interface ROLEMapper {
12 int deleteByPrimaryKey(Integer roleId); 8 int deleteByPrimaryKey(Integer roleId);
@@ -17,13 +13,11 @@ public interface ROLEMapper { @@ -17,13 +13,11 @@ public interface ROLEMapper {
17 13
18 ROLE selectByPrimaryKey(Integer roleId); 14 ROLE selectByPrimaryKey(Integer roleId);
19 15
20 - int updateByPrimaryKeySelective(ROLE record);  
21 -  
22 - int updateByPrimaryKey(ROLE record);  
23 -  
24 List<ROLE> findRolesByUserId(Integer userId); 16 List<ROLE> findRolesByUserId(Integer userId);
25 17
26 List<ROLE> findAll(); 18 List<ROLE> findAll();
27 19
  20 + int updateByPrimaryKeySelective(ROLE record);
28 21
  22 + int updateByPrimaryKey(ROLE record);
29 } 23 }
@@ -13,6 +13,16 @@ public class Company { @@ -13,6 +13,16 @@ public class Company {
13 13
14 private String companyStatus; 14 private String companyStatus;
15 15
  16 + private String groupName;
  17 +
  18 + public String getGroupName() {
  19 + return groupName;
  20 + }
  21 +
  22 + public void setGroupName(String groupName) {
  23 + this.groupName = groupName;
  24 + }
  25 +
16 public String getCompanyId() { 26 public String getCompanyId() {
17 return companyId; 27 return companyId;
18 } 28 }
  1 +package com.tianbo.warehouse.model;
  2 +
  3 +import java.util.Date;
  4 +
  5 +public class Department {
  6 + private String departmentId;
  7 +
  8 + private String departmentName;
  9 +
  10 + private Date creatTime;
  11 +
  12 + private String companyId;
  13 +
  14 + private String companyName;
  15 +
  16 + public String getCompanyName() {
  17 + return companyName;
  18 + }
  19 +
  20 + public void setCompanyName(String companyName) {
  21 + this.companyName = companyName;
  22 + }
  23 +
  24 + public String getDepartmentId() {
  25 + return departmentId;
  26 + }
  27 +
  28 + public void setDepartmentId(String departmentId) {
  29 + this.departmentId = departmentId == null ? null : departmentId.trim();
  30 + }
  31 +
  32 + public String getDepartmentName() {
  33 + return departmentName;
  34 + }
  35 +
  36 + public void setDepartmentName(String departmentName) {
  37 + this.departmentName = departmentName == null ? null : departmentName.trim();
  38 + }
  39 +
  40 + public Date getCreatTime() {
  41 + return creatTime;
  42 + }
  43 +
  44 + public void setCreatTime(Date creatTime) {
  45 + this.creatTime = creatTime;
  46 + }
  47 +
  48 + public String getCompanyId() {
  49 + return companyId;
  50 + }
  51 +
  52 + public void setCompanyId(String companyId) {
  53 + this.companyId = companyId == null ? null : companyId.trim();
  54 + }
  55 +}
  1 +package com.tianbo.warehouse.model;
  2 +
  3 +import java.util.Date;
  4 +
  5 +public class Group_company {
  6 + private String groupId;
  7 +
  8 + private String groupName;
  9 +
  10 + private Date creatTime;
  11 +
  12 + public String getGroupId() {
  13 + return groupId;
  14 + }
  15 +
  16 + public void setGroupId(String groupId) {
  17 + this.groupId = groupId == null ? null : groupId.trim();
  18 + }
  19 +
  20 + public String getGroupName() {
  21 + return groupName;
  22 + }
  23 +
  24 + public void setGroupName(String groupName) {
  25 + this.groupName = groupName == null ? null : groupName.trim();
  26 + }
  27 +
  28 + public Date getCreatTime() {
  29 + return creatTime;
  30 + }
  31 +
  32 + public void setCreatTime(Date creatTime) {
  33 + this.creatTime = creatTime;
  34 + }
  35 +}
@@ -5,6 +5,7 @@ import org.springframework.security.core.GrantedAuthority; @@ -5,6 +5,7 @@ import org.springframework.security.core.GrantedAuthority;
5 import java.util.List; 5 import java.util.List;
6 6
7 public class ROLE implements GrantedAuthority { 7 public class ROLE implements GrantedAuthority {
  8 +
8 private static final long serialVersionUID = 1L; 9 private static final long serialVersionUID = 1L;
9 10
10 private Integer roleId; 11 private Integer roleId;
@@ -15,8 +16,20 @@ public class ROLE implements GrantedAuthority { @@ -15,8 +16,20 @@ public class ROLE implements GrantedAuthority {
15 16
16 private String description; 17 private String description;
17 18
  19 + private String departmentId;
  20 +
  21 + private String departmentName;
  22 +
18 private List<PERMISSION> permissions; 23 private List<PERMISSION> permissions;
19 24
  25 + public String getDepartmentName() {
  26 + return departmentName;
  27 + }
  28 +
  29 + public void setDepartmentName(String departmentName) {
  30 + this.departmentName = departmentName;
  31 + }
  32 +
20 public Integer getRoleId() { 33 public Integer getRoleId() {
21 return roleId; 34 return roleId;
22 } 35 }
@@ -49,6 +62,14 @@ public class ROLE implements GrantedAuthority { @@ -49,6 +62,14 @@ public class ROLE implements GrantedAuthority {
49 this.description = description == null ? null : description.trim(); 62 this.description = description == null ? null : description.trim();
50 } 63 }
51 64
  65 + public String getDepartmentId() {
  66 + return departmentId;
  67 + }
  68 +
  69 + public void setDepartmentId(String departmentId) {
  70 + this.departmentId = departmentId == null ? null : departmentId.trim();
  71 + }
  72 +
52 public List<PERMISSION> getPermissions() { 73 public List<PERMISSION> getPermissions() {
53 return permissions; 74 return permissions;
54 } 75 }
@@ -78,7 +78,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { @@ -78,7 +78,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
78 //跨域配置 78 //跨域配置
79 .requestMatchers(CorsUtils::isPreFlightRequest).permitAll() 79 .requestMatchers(CorsUtils::isPreFlightRequest).permitAll()
80 //管理页面只允许管理员角色访问 80 //管理页面只允许管理员角色访问
81 - .antMatchers("/admin/**","/role/**","/user/**").authenticated() 81 + .antMatchers("/admin/**","/ROLE/**","/user/**").authenticated()
82 //任何请求,登录后可以访问 82 //任何请求,登录后可以访问
83 //其余的不需要验证 83 //其余的不需要验证
84 .anyRequest().permitAll() 84 .anyRequest().permitAll()
  1 +package com.tianbo.warehouse.service;
  2 +
  3 +import com.github.pagehelper.PageInfo;
  4 +import com.tianbo.warehouse.model.Department;
  5 +
  6 +public interface DepartmentService {
  7 +
  8 + PageInfo<Department> findAll(int pageNum, int pageSize);
  9 +
  10 + int insertSelective(Department department);
  11 +
  12 + int updateByPrimaryKeySelective(Department department);
  13 +
  14 + int deleteByPrimaryKey(String departmentId);
  15 +
  16 +}
  1 +package com.tianbo.warehouse.service;
  2 +
  3 +import com.github.pagehelper.PageInfo;
  4 +import com.tianbo.warehouse.model.Group_company;
  5 +
  6 +public interface GroupCompanyService {
  7 +
  8 + PageInfo<Group_company> findAll(int pageNum, int pageSize);
  9 +
  10 + int insertSelective(Group_company group_company);
  11 +
  12 + int updateByPrimaryKeySelective(Group_company group_company);
  13 +
  14 + int deleteByPrimaryKey(String departmentId);
  15 +
  16 +}
@@ -10,4 +10,8 @@ public interface RoleService { @@ -10,4 +10,8 @@ public interface RoleService {
10 int insertSelective(ROLE record); 10 int insertSelective(ROLE record);
11 11
12 int setRolePermissoin(RolePermission record); 12 int setRolePermissoin(RolePermission record);
  13 +
  14 + int updateByPrimaryKeySelective(ROLE role);
  15 +
  16 + int deleteByPrimaryKey(Integer departmentId);
13 } 17 }
@@ -4,11 +4,14 @@ import com.github.pagehelper.Page; @@ -4,11 +4,14 @@ 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.CompanyMapper; 6 import com.tianbo.warehouse.dao.CompanyMapper;
  7 +import com.tianbo.warehouse.dao.Group_companyMapper;
7 import com.tianbo.warehouse.model.Company; 8 import com.tianbo.warehouse.model.Company;
  9 +import com.tianbo.warehouse.model.Group_company;
8 import com.tianbo.warehouse.service.CompanyService; 10 import com.tianbo.warehouse.service.CompanyService;
9 import org.springframework.beans.factory.annotation.Autowired; 11 import org.springframework.beans.factory.annotation.Autowired;
10 import org.springframework.stereotype.Service; 12 import org.springframework.stereotype.Service;
11 13
  14 +import java.util.ArrayList;
12 import java.util.Date; 15 import java.util.Date;
13 import java.util.List; 16 import java.util.List;
14 import java.util.UUID; 17 import java.util.UUID;
@@ -19,10 +22,22 @@ public class CompanyServiceImp implements CompanyService { @@ -19,10 +22,22 @@ public class CompanyServiceImp implements CompanyService {
19 @Autowired 22 @Autowired
20 CompanyMapper companyMapper; 23 CompanyMapper companyMapper;
21 24
  25 + @Autowired
  26 + Group_companyMapper group_companyMapper;
  27 +
22 @Override 28 @Override
23 public PageInfo<Company> findAll(int pageNum, int pageSize) { 29 public PageInfo<Company> findAll(int pageNum, int pageSize) {
24 Page<Company> page = PageHelper.startPage(pageNum,pageSize); 30 Page<Company> page = PageHelper.startPage(pageNum,pageSize);
25 List<Company> list = companyMapper.findAll(); 31 List<Company> list = companyMapper.findAll();
  32 +
  33 + for (Company company: list){
  34 + Group_company group_company = group_companyMapper.selectByPrimaryKey(company.getGroupId());
  35 + if (group_company == null){
  36 + group_company.setGroupName("无");
  37 + }else {
  38 + company.setGroupName(group_company.getGroupName());
  39 + }
  40 + }
26 PageInfo<Company> result = new PageInfo<>(list); 41 PageInfo<Company> result = new PageInfo<>(list);
27 return result; 42 return result;
28 } 43 }
  1 +package com.tianbo.warehouse.service.imp;
  2 +
  3 +import com.github.pagehelper.Page;
  4 +import com.github.pagehelper.PageHelper;
  5 +import com.github.pagehelper.PageInfo;
  6 +import com.tianbo.warehouse.dao.CompanyMapper;
  7 +import com.tianbo.warehouse.dao.DepartmentMapper;
  8 +import com.tianbo.warehouse.model.Company;
  9 +import com.tianbo.warehouse.model.Department;
  10 +import com.tianbo.warehouse.service.DepartmentService;
  11 +import org.springframework.beans.factory.annotation.Autowired;
  12 +import org.springframework.stereotype.Service;
  13 +
  14 +import java.util.ArrayList;
  15 +import java.util.Date;
  16 +import java.util.List;
  17 +import java.util.UUID;
  18 +
  19 +@Service
  20 +public class DepartmentServiceImp implements DepartmentService {
  21 +
  22 + @Autowired
  23 + DepartmentMapper departmentMapper;
  24 +
  25 + @Autowired
  26 + CompanyMapper companyMapper;
  27 +
  28 + @Override
  29 + public PageInfo<Department> findAll(int pageNum, int pageSize) {
  30 + Page<Department> page = PageHelper.startPage(pageNum,pageSize);
  31 + List<Department> list = departmentMapper.findAll();
  32 +
  33 + for (Department department: list){
  34 + Company company = companyMapper.selectByPrimaryKey(department.getCompanyId());
  35 + if (company == null){
  36 + department.setCompanyName("无");
  37 + }else {
  38 + department.setCompanyName(company.getCompanyName());
  39 + }
  40 + }
  41 + PageInfo<Department> result = new PageInfo<>(list);
  42 + return result;
  43 + }
  44 +
  45 + @Override
  46 + public int insertSelective(Department department) {
  47 + department.setDepartmentId(UUID.randomUUID().toString());
  48 + department.setCreatTime(new Date());
  49 + return departmentMapper.insertSelective(department);
  50 + }
  51 +
  52 + @Override
  53 + public int updateByPrimaryKeySelective(Department department) {
  54 + department.setCreatTime(new Date());
  55 + return departmentMapper.updateByPrimaryKeySelective(department);
  56 + }
  57 +
  58 + @Override
  59 + public int deleteByPrimaryKey(String departmentId) {
  60 + if (departmentId.contains(",")){
  61 + try {
  62 + System.out.println();
  63 + String[] split = departmentId.split(",");
  64 + for (int i=0; i<split.length; i++){
  65 + departmentMapper.deleteByPrimaryKey(split[i]);
  66 + }
  67 + return 1;
  68 + }catch (Exception e){
  69 + e.printStackTrace();
  70 + return 0;
  71 + }
  72 + }else {
  73 + return departmentMapper.deleteByPrimaryKey(departmentId);
  74 + }
  75 + }
  76 +}
  1 +package com.tianbo.warehouse.service.imp;
  2 +
  3 +import com.github.pagehelper.Page;
  4 +import com.github.pagehelper.PageHelper;
  5 +import com.github.pagehelper.PageInfo;
  6 +import com.tianbo.warehouse.dao.DepartmentMapper;
  7 +import com.tianbo.warehouse.dao.Group_companyMapper;
  8 +import com.tianbo.warehouse.model.Department;
  9 +import com.tianbo.warehouse.model.Group_company;
  10 +import com.tianbo.warehouse.service.DepartmentService;
  11 +import com.tianbo.warehouse.service.GroupCompanyService;
  12 +import org.springframework.beans.factory.annotation.Autowired;
  13 +import org.springframework.stereotype.Service;
  14 +
  15 +import java.util.Date;
  16 +import java.util.List;
  17 +import java.util.UUID;
  18 +
  19 +@Service
  20 +public class GroupCompanyServiceImp implements GroupCompanyService {
  21 +
  22 + @Autowired
  23 + Group_companyMapper group_companyMapper;
  24 +
  25 + @Override
  26 + public PageInfo<Group_company> findAll(int pageNum, int pageSize) {
  27 + Page<Group_company> page = PageHelper.startPage(pageNum,pageSize);
  28 + List<Group_company> list = group_companyMapper.findAll();
  29 + PageInfo<Group_company> result = new PageInfo<>(list);
  30 + return result;
  31 + }
  32 +
  33 + @Override
  34 + public int insertSelective(Group_company group_company) {
  35 + group_company.setGroupId(UUID.randomUUID().toString());
  36 + group_company.setCreatTime(new Date());
  37 + return group_companyMapper.insertSelective(group_company);
  38 + }
  39 +
  40 + @Override
  41 + public int updateByPrimaryKeySelective(Group_company group_company) {
  42 + group_company.setCreatTime(new Date());
  43 + return group_companyMapper.updateByPrimaryKeySelective(group_company);
  44 + }
  45 +
  46 + @Override
  47 + public int deleteByPrimaryKey(String groupId) {
  48 + if (groupId.contains(",")){
  49 + try {
  50 + System.out.println("");
  51 + String[] split = groupId.split(",");
  52 + for (int i=0; i<split.length; i++){
  53 + group_companyMapper.deleteByPrimaryKey(split[i]);
  54 + }
  55 + return 1;
  56 + }catch (Exception e){
  57 + e.printStackTrace();
  58 + return 0;
  59 + }
  60 + }else {
  61 + return group_companyMapper.deleteByPrimaryKey(groupId);
  62 + }
  63 + }
  64 +}
@@ -3,15 +3,20 @@ package com.tianbo.warehouse.service.imp; @@ -3,15 +3,20 @@ package com.tianbo.warehouse.service.imp;
3 import com.github.pagehelper.Page; 3 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.DepartmentMapper;
6 import com.tianbo.warehouse.dao.ROLEMapper; 7 import com.tianbo.warehouse.dao.ROLEMapper;
7 import com.tianbo.warehouse.dao.RolePermissionMapper; 8 import com.tianbo.warehouse.dao.RolePermissionMapper;
  9 +import com.tianbo.warehouse.model.Department;
8 import com.tianbo.warehouse.model.ROLE; 10 import com.tianbo.warehouse.model.ROLE;
9 import com.tianbo.warehouse.model.RolePermission; 11 import com.tianbo.warehouse.model.RolePermission;
  12 +import com.tianbo.warehouse.service.DepartmentService;
10 import com.tianbo.warehouse.service.RoleService; 13 import com.tianbo.warehouse.service.RoleService;
11 import org.springframework.beans.factory.annotation.Autowired; 14 import org.springframework.beans.factory.annotation.Autowired;
12 import org.springframework.stereotype.Service; 15 import org.springframework.stereotype.Service;
13 import org.springframework.transaction.annotation.Transactional; 16 import org.springframework.transaction.annotation.Transactional;
  17 +import org.springframework.util.StringUtils;
14 18
  19 +import java.util.ArrayList;
15 import java.util.List; 20 import java.util.List;
16 21
17 @Service(value = "roleService") 22 @Service(value = "roleService")
@@ -23,11 +28,24 @@ public class RoleServiceImp implements RoleService{ @@ -23,11 +28,24 @@ public class RoleServiceImp implements RoleService{
23 @Autowired 28 @Autowired
24 private RolePermissionMapper rolePermissionMapper; 29 private RolePermissionMapper rolePermissionMapper;
25 30
  31 + @Autowired
  32 + DepartmentMapper departmentMapper;
  33 +
26 @Override 34 @Override
27 public PageInfo<ROLE> findAll(int pageNum, int pageSize){ 35 public PageInfo<ROLE> findAll(int pageNum, int pageSize){
28 Page<ROLE> page = PageHelper.startPage(pageNum,pageSize); 36 Page<ROLE> page = PageHelper.startPage(pageNum,pageSize);
29 List<ROLE> list = roleMapper.findAll(); 37 List<ROLE> list = roleMapper.findAll();
  38 +
  39 + for (ROLE role: list){
  40 + Department department = departmentMapper.selectByPrimaryKey(role.getDepartmentId());
  41 + if (department == null){
  42 + role.setDepartmentName("无");
  43 + }else {
  44 + role.setDepartmentName(department.getDepartmentName());
  45 + }
  46 + }
30 PageInfo<ROLE> result = new PageInfo<ROLE>(list); 47 PageInfo<ROLE> result = new PageInfo<ROLE>(list);
  48 +
31 return result; 49 return result;
32 } 50 }
33 51
@@ -53,4 +71,29 @@ public class RoleServiceImp implements RoleService{ @@ -53,4 +71,29 @@ public class RoleServiceImp implements RoleService{
53 return 0; 71 return 0;
54 } 72 }
55 } 73 }
  74 +
  75 + @Override
  76 + public int updateByPrimaryKeySelective(ROLE company) {
  77 + return roleMapper.updateByPrimaryKeySelective(company);
  78 + }
  79 +
  80 + @Override
  81 + public int deleteByPrimaryKey(Integer roleId) {
  82 + String s = roleId.toString();
  83 + if (s.contains(",")){
  84 + try {
  85 + String[] split = s.split(",");
  86 + for (int i=0; i<split.length; i++){
  87 + roleMapper.deleteByPrimaryKey(Integer.valueOf(split[i]));
  88 + }
  89 + return 1;
  90 + }catch (Exception e){
  91 + e.printStackTrace();
  92 + return 0;
  93 + }
  94 + }else {
  95 + return roleMapper.deleteByPrimaryKey(Integer.valueOf(roleId));
  96 + }
  97 + }
  98 +
56 } 99 }
  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.DepartmentMapper" >
  4 + <resultMap id="BaseResultMap" type="com.tianbo.warehouse.model.Department" >
  5 + <id column="department_id" property="departmentId" jdbcType="VARCHAR" />
  6 + <result column="department_name" property="departmentName" jdbcType="VARCHAR" />
  7 + <result column="creat_time" property="creatTime" jdbcType="DATE" />
  8 + <result column="company_id" property="companyId" jdbcType="VARCHAR" />
  9 + </resultMap>
  10 + <sql id="Base_Column_List" >
  11 + department_id, department_name, creat_time, company_id
  12 + </sql>
  13 + <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
  14 + select
  15 + <include refid="Base_Column_List" />
  16 + from department
  17 + where department_id = #{departmentId,jdbcType=VARCHAR}
  18 + </select>
  19 +
  20 + <select id="findAll" resultMap="BaseResultMap" >
  21 + select
  22 + <include refid="Base_Column_List" />
  23 + from department ORDER BY department_id
  24 + </select>
  25 +
  26 + <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
  27 + delete from department
  28 + where department_id = #{departmentId,jdbcType=VARCHAR}
  29 + </delete>
  30 + <insert id="insert" parameterType="com.tianbo.warehouse.model.Department" >
  31 + insert into department (department_id, department_name, creat_time,
  32 + company_id)
  33 + values (#{departmentId,jdbcType=VARCHAR}, #{departmentName,jdbcType=VARCHAR}, #{creatTime,jdbcType=DATE},
  34 + #{companyId,jdbcType=VARCHAR})
  35 + </insert>
  36 + <insert id="insertSelective" parameterType="com.tianbo.warehouse.model.Department" >
  37 + insert into department
  38 + <trim prefix="(" suffix=")" suffixOverrides="," >
  39 + <if test="departmentId != null" >
  40 + department_id,
  41 + </if>
  42 + <if test="departmentName != null" >
  43 + department_name,
  44 + </if>
  45 + <if test="creatTime != null" >
  46 + creat_time,
  47 + </if>
  48 + <if test="companyId != null" >
  49 + company_id,
  50 + </if>
  51 + </trim>
  52 + <trim prefix="values (" suffix=")" suffixOverrides="," >
  53 + <if test="departmentId != null" >
  54 + #{departmentId,jdbcType=VARCHAR},
  55 + </if>
  56 + <if test="departmentName != null" >
  57 + #{departmentName,jdbcType=VARCHAR},
  58 + </if>
  59 + <if test="creatTime != null" >
  60 + #{creatTime,jdbcType=DATE},
  61 + </if>
  62 + <if test="companyId != null" >
  63 + #{companyId,jdbcType=VARCHAR},
  64 + </if>
  65 + </trim>
  66 + </insert>
  67 + <update id="updateByPrimaryKeySelective" parameterType="com.tianbo.warehouse.model.Department" >
  68 + update department
  69 + <set >
  70 + <if test="departmentName != null" >
  71 + department_name = #{departmentName,jdbcType=VARCHAR},
  72 + </if>
  73 + <if test="creatTime != null" >
  74 + creat_time = #{creatTime,jdbcType=DATE},
  75 + </if>
  76 + <if test="companyId != null" >
  77 + company_id = #{companyId,jdbcType=VARCHAR},
  78 + </if>
  79 + </set>
  80 + where department_id = #{departmentId,jdbcType=VARCHAR}
  81 + </update>
  82 + <update id="updateByPrimaryKey" parameterType="com.tianbo.warehouse.model.Department" >
  83 + update department
  84 + set department_name = #{departmentName,jdbcType=VARCHAR},
  85 + creat_time = #{creatTime,jdbcType=DATE},
  86 + company_id = #{companyId,jdbcType=VARCHAR}
  87 + where department_id = #{departmentId,jdbcType=VARCHAR}
  88 + </update>
  89 +</mapper>
  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.Group_companyMapper" >
  4 + <resultMap id="BaseResultMap" type="com.tianbo.warehouse.model.Group_company" >
  5 + <id column="group_id" property="groupId" jdbcType="VARCHAR" />
  6 + <result column="group_name" property="groupName" jdbcType="VARCHAR" />
  7 + <result column="creat_time" property="creatTime" jdbcType="TIMESTAMP" />
  8 + </resultMap>
  9 + <sql id="Base_Column_List" >
  10 + group_id, group_name, creat_time
  11 + </sql>
  12 + <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
  13 + select
  14 + <include refid="Base_Column_List" />
  15 + from group_company
  16 + where group_id = #{groupId,jdbcType=VARCHAR}
  17 + </select>
  18 +
  19 + <select id="findAll" resultMap="BaseResultMap" >
  20 + select
  21 + <include refid="Base_Column_List" />
  22 + from group_company ORDER BY group_id
  23 + </select>
  24 +
  25 + <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
  26 + delete from group_company
  27 + where group_id = #{groupId,jdbcType=VARCHAR}
  28 + </delete>
  29 + <insert id="insert" parameterType="com.tianbo.warehouse.model.Group_company" >
  30 + insert into group_company (group_id, group_name, creat_time
  31 + )
  32 + values (#{groupId,jdbcType=VARCHAR}, #{groupName,jdbcType=VARCHAR}, #{creatTime,jdbcType=TIMESTAMP}
  33 + )
  34 + </insert>
  35 + <insert id="insertSelective" parameterType="com.tianbo.warehouse.model.Group_company" >
  36 + insert into group_company
  37 + <trim prefix="(" suffix=")" suffixOverrides="," >
  38 + <if test="groupId != null" >
  39 + group_id,
  40 + </if>
  41 + <if test="groupName != null" >
  42 + group_name,
  43 + </if>
  44 + <if test="creatTime != null" >
  45 + creat_time,
  46 + </if>
  47 + </trim>
  48 + <trim prefix="values (" suffix=")" suffixOverrides="," >
  49 + <if test="groupId != null" >
  50 + #{groupId,jdbcType=VARCHAR},
  51 + </if>
  52 + <if test="groupName != null" >
  53 + #{groupName,jdbcType=VARCHAR},
  54 + </if>
  55 + <if test="creatTime != null" >
  56 + #{creatTime,jdbcType=TIMESTAMP},
  57 + </if>
  58 + </trim>
  59 + </insert>
  60 + <update id="updateByPrimaryKeySelective" parameterType="com.tianbo.warehouse.model.Group_company" >
  61 + update group_company
  62 + <set >
  63 + <if test="groupName != null" >
  64 + group_name = #{groupName,jdbcType=VARCHAR},
  65 + </if>
  66 + <if test="creatTime != null" >
  67 + creat_time = #{creatTime,jdbcType=TIMESTAMP},
  68 + </if>
  69 + </set>
  70 + where group_id = #{groupId,jdbcType=VARCHAR}
  71 + </update>
  72 + <update id="updateByPrimaryKey" parameterType="com.tianbo.warehouse.model.Group_company" >
  73 + update group_company
  74 + set group_name = #{groupName,jdbcType=VARCHAR},
  75 + creat_time = #{creatTime,jdbcType=TIMESTAMP}
  76 + where group_id = #{groupId,jdbcType=VARCHAR}
  77 + </update>
  78 +</mapper>
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.ROLEMapper">  
4 - <resultMap id="BaseResultMap" type="com.tianbo.warehouse.model.ROLE">  
5 - <id column="role_id" jdbcType="INTEGER" property="roleId" />  
6 - <result column="role_name" jdbcType="VARCHAR" property="roleName" />  
7 - <result column="role_sign" jdbcType="VARCHAR" property="roleSign" />  
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> 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.ROLEMapper" >
  4 + <resultMap id="BaseResultMap" type="com.tianbo.warehouse.model.ROLE" >
  5 + <id column="role_id" property="roleId" jdbcType="INTEGER" />
  6 + <result column="role_name" property="roleName" jdbcType="VARCHAR" />
  7 + <result column="role_sign" property="roleSign" jdbcType="VARCHAR" />
  8 + <result column="description" property="description" jdbcType="VARCHAR" />
  9 + <result column="department_id" property="departmentId" jdbcType="VARCHAR" />
10 </resultMap> 10 </resultMap>
11 - <sql id="Base_Column_List">  
12 - role_id, role_name, role_sign, description 11 + <sql id="Base_Column_List" >
  12 + role_id, role_name, role_sign, description, department_id
13 </sql> 13 </sql>
14 - <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> 14 + <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
15 select 15 select
16 <include refid="Base_Column_List" /> 16 <include refid="Base_Column_List" />
17 from role 17 from role
18 where role_id = #{roleId,jdbcType=INTEGER} 18 where role_id = #{roleId,jdbcType=INTEGER}
19 </select> 19 </select>
  20 +
20 <select id="findAll" resultMap="BaseResultMap" > 21 <select id="findAll" resultMap="BaseResultMap" >
21 SELECT 22 SELECT
22 <include refid="Base_Column_List" /> 23 <include refid="Base_Column_List" />
@@ -31,68 +32,78 @@ @@ -31,68 +32,78 @@
31 LEFT JOIN role R ON R.role_id= UR.role_id 32 LEFT JOIN role R ON R.role_id= UR.role_id
32 where U.user_id = #{userId,jdbcType=INTEGER} 33 where U.user_id = #{userId,jdbcType=INTEGER}
33 </select> 34 </select>
34 - <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> 35 +
  36 + <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
35 delete from role 37 delete from role
36 where role_id = #{roleId,jdbcType=INTEGER} 38 where role_id = #{roleId,jdbcType=INTEGER}
37 </delete> 39 </delete>
38 - <insert id="insert" parameterType="com.tianbo.warehouse.model.ROLE"> 40 + <insert id="insert" parameterType="com.tianbo.warehouse.model.ROLE" >
39 insert into role (role_id, role_name, role_sign, 41 insert into role (role_id, role_name, role_sign,
40 - description) 42 + description, department_id)
41 values (#{roleId,jdbcType=INTEGER}, #{roleName,jdbcType=VARCHAR}, #{roleSign,jdbcType=VARCHAR}, 43 values (#{roleId,jdbcType=INTEGER}, #{roleName,jdbcType=VARCHAR}, #{roleSign,jdbcType=VARCHAR},
42 - #{description,jdbcType=VARCHAR}) 44 + #{description,jdbcType=VARCHAR}, #{departmentId,jdbcType=VARCHAR})
43 </insert> 45 </insert>
44 -  
45 - <insert id="insertSelective" parameterType="Integer"> 46 + <insert id="insertSelective" parameterType="com.tianbo.warehouse.model.ROLE" >
46 insert into role 47 insert into role
47 - <trim prefix="(" suffix=")" suffixOverrides=",">  
48 - <if test="roleId != null"> 48 + <trim prefix="(" suffix=")" suffixOverrides="," >
  49 + <if test="roleId != null" >
49 role_id, 50 role_id,
50 </if> 51 </if>
51 - <if test="roleName != null"> 52 + <if test="roleName != null" >
52 role_name, 53 role_name,
53 </if> 54 </if>
54 - <if test="roleSign != null"> 55 + <if test="roleSign != null" >
55 role_sign, 56 role_sign,
56 </if> 57 </if>
57 - <if test="description != null"> 58 + <if test="description != null" >
58 description, 59 description,
59 </if> 60 </if>
  61 + <if test="departmentId != null" >
  62 + department_id,
  63 + </if>
60 </trim> 64 </trim>
61 - <trim prefix="values (" suffix=")" suffixOverrides=",">  
62 - <if test="roleId != null"> 65 + <trim prefix="values (" suffix=")" suffixOverrides="," >
  66 + <if test="roleId != null" >
63 #{roleId,jdbcType=INTEGER}, 67 #{roleId,jdbcType=INTEGER},
64 </if> 68 </if>
65 - <if test="roleName != null"> 69 + <if test="roleName != null" >
66 #{roleName,jdbcType=VARCHAR}, 70 #{roleName,jdbcType=VARCHAR},
67 </if> 71 </if>
68 - <if test="roleSign != null"> 72 + <if test="roleSign != null" >
69 #{roleSign,jdbcType=VARCHAR}, 73 #{roleSign,jdbcType=VARCHAR},
70 </if> 74 </if>
71 - <if test="description != null"> 75 + <if test="description != null" >
72 #{description,jdbcType=VARCHAR}, 76 #{description,jdbcType=VARCHAR},
73 </if> 77 </if>
  78 + <if test="departmentId != null" >
  79 + #{departmentId,jdbcType=VARCHAR},
  80 + </if>
74 </trim> 81 </trim>
75 </insert> 82 </insert>
76 - <update id="updateByPrimaryKeySelective" parameterType="com.tianbo.warehouse.model.ROLE"> 83 + <update id="updateByPrimaryKeySelective" parameterType="com.tianbo.warehouse.model.ROLE" >
77 update role 84 update role
78 - <set>  
79 - <if test="roleName != null"> 85 + <set >
  86 + <if test="roleName != null" >
80 role_name = #{roleName,jdbcType=VARCHAR}, 87 role_name = #{roleName,jdbcType=VARCHAR},
81 </if> 88 </if>
82 - <if test="roleSign != null"> 89 + <if test="roleSign != null" >
83 role_sign = #{roleSign,jdbcType=VARCHAR}, 90 role_sign = #{roleSign,jdbcType=VARCHAR},
84 </if> 91 </if>
85 - <if test="description != null"> 92 + <if test="description != null" >
86 description = #{description,jdbcType=VARCHAR}, 93 description = #{description,jdbcType=VARCHAR},
87 </if> 94 </if>
  95 + <if test="departmentId != null" >
  96 + department_id = #{departmentId,jdbcType=VARCHAR},
  97 + </if>
88 </set> 98 </set>
89 where role_id = #{roleId,jdbcType=INTEGER} 99 where role_id = #{roleId,jdbcType=INTEGER}
90 </update> 100 </update>
91 - <update id="updateByPrimaryKey" parameterType="com.tianbo.warehouse.model.ROLE"> 101 + <update id="updateByPrimaryKey" parameterType="com.tianbo.warehouse.model.ROLE" >
92 update role 102 update role
93 set role_name = #{roleName,jdbcType=VARCHAR}, 103 set role_name = #{roleName,jdbcType=VARCHAR},
94 role_sign = #{roleSign,jdbcType=VARCHAR}, 104 role_sign = #{roleSign,jdbcType=VARCHAR},
95 - description = #{description,jdbcType=VARCHAR} 105 + description = #{description,jdbcType=VARCHAR},
  106 + department_id = #{departmentId,jdbcType=VARCHAR}
96 where role_id = #{roleId,jdbcType=INTEGER} 107 where role_id = #{roleId,jdbcType=INTEGER}
97 </update> 108 </update>
98 </mapper> 109 </mapper>