史上最完整基于Springboot实现进销存管理系统

简介: 史上最完整基于Springboot实现进销存管理系统

项目编号:BS-XX-099


后台开发:Springboot+mybatis+springmvc


前台开发:bootstrap+easyui+jquery+highcharts


数据库:MYSQL


开发工具:IDEA / ECLIPSE


应用服务器:TOMCAT8.5


本系统基于springboot实现了一个功能十分完整的企业进销存系统,主要功能包括:用户的登录注册、客户信息增添改查、来往客户信息查询等、商品的进货和销售、采购订单明细、销售订单明细、库存盘点、商品查询及分类、商品价格调整、进销存报表、商品库存预警、系统退出、角色管理、用户管理、权限分配、数据统计图形报表、等等,功能可以说是十分完整,整个系统设计简洁大方,运行无误。


下面展示一下系统的主要功能:


登陆页面:

image.png

管理主页面

image.png

系统管理-角色管理

image.png

系统管理-用户管理

image.png

基础资料-供应商管理

image.png

基础资料-客户管理

image.png

基础资料-商品分类和商品管理

image.png

基础资料-期初库存管理

image.png

统计报表—供应商统计

image.png

统计报表—按日统计

image.png

库存管理-商品报损

image.png

库存管理-库存报警

image.png

销售管理—销售出货

image.png

销售管理—销售单据查询

image.png

进货管理—进货入库

image.png

进货管理—进货单据查询

image.png

进货管理—退货出库

image.png

篇幅所限,只展示部分功能,整体来说,此系统还是十分优秀,包含了进销存常见所有的功能需求。

部分核心实现代码:

package com.jude.controller.admin;
import com.jude.service.LogService;
import com.jude.entity.Customer;
import com.jude.entity.Log;
import com.jude.service.CustomerService;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * 后台管理客户Controller
 * @author znz
 *
 */
@RestController
@RequestMapping("/admin/customer")
public class CustomerAdminController {
  @Resource
  private CustomerService customerService;
  @Resource
  private LogService logService;
  /**
   * 分页查询客户信息
   * @param customer
   * @param page
   * @param rows
   * @return
   * @throws Exception
   */
  @RequestMapping("/list")
  @RequiresPermissions(value = { "客户管理" })
  public Map<String,Object> list(Customer customer, @RequestParam(value="page",required=false)Integer page, @RequestParam(value="rows",required=false)Integer rows)throws Exception{
    List<Customer> customerList=customerService.list(customer, page, rows, Direction.ASC, "id");
    Long total=customerService.getCount(customer);
    Map<String, Object> resultMap = new HashMap<>();
    resultMap.put("rows", customerList);
    resultMap.put("total", total);
    logService.save(new Log(Log.SEARCH_ACTION,"查询客户信息")); // 写入日志
    return resultMap;
  }
  /**
   * 下拉框模糊查询
   * @param q
   * @return
   * @throws Exception
   */
  @ResponseBody
  @RequestMapping("/comboList")
  @RequiresPermissions(value = {"销售出库","客户退货","销售单据查询","客户退货查询"},logical=Logical.OR)
  public List<Customer> comboList(String q)throws Exception{
    if(q==null){
      q="";
    }
    return customerService.findByName("%"+q+"%");
  }
  /**
   * 添加或者修改客户信息
   * @param customer
   * @return
   * @throws Exception
   */
  @RequestMapping("/save")
  @RequiresPermissions(value = { "客户管理" })
  public Map<String,Object> save(Customer customer)throws Exception{
    if(customer.getId()!=null){ // 写入日志
      logService.save(new Log(Log.UPDATE_ACTION,"更新客户信息"+customer)); 
    }else{
      logService.save(new Log(Log.ADD_ACTION,"添加客户信息"+customer)); 
    }
    Map<String, Object> resultMap = new HashMap<>();
    customerService.save(customer);     
    resultMap.put("success", true);
    return resultMap;
  }
  /**
   * 删除客户信息
   * @param id
   * @param response
   * @return
   * @throws Exception
   */
  @RequestMapping("/delete")
  @RequiresPermissions(value = { "客户管理" })
  public Map<String,Object> delete(String ids)throws Exception{
    Map<String, Object> resultMap = new HashMap<>();
    String []idsStr=ids.split(",");
    for(int i=0;i<idsStr.length;i++){
      int id=Integer.parseInt(idsStr[i]);
      logService.save(new Log(Log.DELETE_ACTION,"删除客户信息"+customerService.findById(id)));  // 写入日志
      customerService.delete(id);             
    }
    resultMap.put("success", true);
    return resultMap;
  }
}
package com.jude.controller.admin;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.jude.service.CustomerReturnListGoodsService;
import com.jude.service.CustomerReturnListService;
import com.jude.service.LogService;
import com.jude.util.DateUtil;
import com.jude.util.StringUtil;
import com.jude.entity.CustomerReturnList;
import com.jude.entity.CustomerReturnListGoods;
import com.jude.entity.Log;
import com.jude.service.UserService;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * 客户退货单Controller类
 * @author Administrator
 *
 */
@RestController
@RequestMapping("/admin/customerReturnList")
public class CustomerReturnListAdminController {
  @Resource
  private CustomerReturnListService customerReturnListService;
  @Resource
  private CustomerReturnListGoodsService customerReturnListGoodsService;
  @Resource
  private LogService logService;
  @Resource
  private UserService userService;
  @InitBinder
  public void initBinder(WebDataBinder binder) {
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
    dateFormat.setLenient(true);
    binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));   //true:允许输入空值,false:不能为空值
  }
  /**
   * 根据条件分页查询客户退货单信息
   * @param customerReturnList
   * @param page
   * @param rows
   * @return
   * @throws Exception
   */
  @RequestMapping("/list")
  @RequiresPermissions(value = { "客户退货查询" })
  public Map<String,Object> list(CustomerReturnList customerReturnList)throws Exception{
    Map<String, Object> resultMap = new HashMap<>();
    List<CustomerReturnList> customerReturnListList=customerReturnListService.list(customerReturnList, Direction.DESC, "customerReturnDate");
    resultMap.put("rows", customerReturnListList);
    return resultMap;
  }
  /**
   * 根据客户退货单id查询所有客户退货单商品
   * @param customerReturnListId
   * @return
   * @throws Exception
   */
  @RequestMapping("/listGoods")
  @RequiresPermissions(value = { "客户退货查询" })
  public Map<String,Object> listGoods(Integer customerReturnListId)throws Exception{
    if(customerReturnListId==null){
      return null;
    }
    Map<String, Object> resultMap = new HashMap<>();
    List<CustomerReturnListGoods> customerReturnListGoodsList=customerReturnListGoodsService.listByCustomerReturnListId(customerReturnListId);
    resultMap.put("rows", customerReturnListGoodsList);
    return resultMap;
  }
  /**
   * 客户统计 获取客户退货单的所有商品信息
   * @param purchaseList
   * @param purchaseListGoods
   * @return
   * @throws Exception
   */
  @RequestMapping("/listCount")
  @RequiresPermissions(value = { "客户统计" })
  public Map<String,Object> listCount(CustomerReturnList customerReturnList,CustomerReturnListGoods customerReturnListGoods)throws Exception{
    Map<String, Object> resultMap = new HashMap<>();
    List<CustomerReturnList> customerReturnListList=customerReturnListService.list(customerReturnList, Direction.DESC, "customerReturnDate");
    for(CustomerReturnList crl:customerReturnListList){
      customerReturnListGoods.setCustomerReturnList(crl);
      List<CustomerReturnListGoods> crlList=customerReturnListGoodsService.list(customerReturnListGoods);
      for(CustomerReturnListGoods crlg:crlList){
        crlg.setCustomerReturnList(null);
      }
      crl.setCustomerReturnListGoodsList(crlList);
    }
    resultMap.put("rows", customerReturnListList);
    return resultMap;
  }
  /**
   * 获取客户退货单号
   * @param type
   * @return
   * @throws Exception
   */
  @ResponseBody
  @RequestMapping("/getCustomerReturnNumber")
  @RequiresPermissions(value = {"客户退货"})
  public String genBillCode(String type)throws Exception{
    StringBuffer biilCodeStr=new StringBuffer();
    biilCodeStr.append("XT");
    biilCodeStr.append(DateUtil.getCurrentDateStr()); // 拼接当前日期
    String customerReturnNumber=customerReturnListService.getTodayMaxCustomerReturnNumber(); // 获取当天最大的客户退货单号
    if(customerReturnNumber!=null){
      biilCodeStr.append(StringUtil.formatCode(customerReturnNumber));
    }else{
      biilCodeStr.append("0001");
    }
    return biilCodeStr.toString();
  }
  /**
   * 添加客户退货单 以及所有客户退货单商品
   * @param customerReturnList
   * @param goodsJson
   * @return
   * @throws Exception
   */
  @ResponseBody
  @RequestMapping("/save")
  @RequiresPermissions(value = {"客户退货"})
  public Map<String,Object> save(CustomerReturnList customerReturnList,String goodsJson)throws Exception{
    Map<String, Object> resultMap = new HashMap<>();
    customerReturnList.setUser(userService.findByUserName((String) SecurityUtils.getSubject().getPrincipal())); // 设置操作用户
    Gson gson = new Gson();
    List<CustomerReturnListGoods> plgList=gson.fromJson(goodsJson, new TypeToken<List<CustomerReturnListGoods>>(){}.getType());
    customerReturnListService.save(customerReturnList, plgList);
    logService.save(new Log(Log.ADD_ACTION,"添加客户退货单"));
    resultMap.put("success", true); 
    return resultMap;
  }
  /**
   * 修改退货单的支付状态
   * @param id
   * @return
   * @throws Exception
   */
  @ResponseBody
  @RequestMapping("/update")
  @RequiresPermissions(value = {"客户统计"})
  public Map<String,Object> update(Integer id)throws Exception{
    Map<String, Object> resultMap = new HashMap<>();
    CustomerReturnList customerReturnList=customerReturnListService.findById(id);
    customerReturnList.setState(1); // 修改成支付状态
    customerReturnListService.update(customerReturnList);
    resultMap.put("success", true); 
    return resultMap;
  }
  /**
   * 根据id删除客户退货单信息 包括客户退货单里的商品
   * @param id
   * @return
   * @throws Exception
   */
  @RequestMapping("/delete")
  @RequiresPermissions(value = { "客户退货查询" })
  public Map<String,Object> delete(Integer id)throws Exception{
    Map<String, Object> resultMap = new HashMap<>();
    customerReturnListService.delete(id);
    logService.save(new Log(Log.DELETE_ACTION,"删除客户退货单信息"+customerReturnListService.findById(id)));  // 写入日志
    resultMap.put("success", true);   
    return resultMap;
  }
}
package com.jude.controller.admin;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.jude.entity.PurchaseListGoods;
import com.jude.service.LogService;
import com.jude.util.StringUtil;
import com.jude.entity.Log;
import com.jude.entity.PurchaseList;
import com.jude.service.PurchaseListGoodsService;
import com.jude.service.PurchaseListService;
import com.jude.service.UserService;
import com.jude.util.DateUtil;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * 进货单Controller类
 * @author Administrator
 *
 */
@RestController
@RequestMapping("/admin/purchaseList")
public class PurchaseListAdminController {
  @Resource
  private PurchaseListService purchaseListService;
  @Resource
  private PurchaseListGoodsService purchaseListGoodsService;
  @Resource
  private LogService logService;
  @Resource
  private UserService userService;
  @InitBinder
  public void initBinder(WebDataBinder binder) {
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
    dateFormat.setLenient(true);
    binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));   //true:允许输入空值,false:不能为空值
  }   
  /**
   * 根据条件分页查询进货单信息
   * @param purchaseList
   * @param page
   * @param rows
   * @return
   * @throws Exception
   */
  @RequestMapping("/list")
  @RequiresPermissions(value = { "进货单据查询" })
  public Map<String,Object> list(PurchaseList purchaseList)throws Exception{
    Map<String, Object> resultMap = new HashMap<>();
    List<PurchaseList> purchaseListList=purchaseListService.list(purchaseList, Direction.DESC, "purchaseDate");
    resultMap.put("rows", purchaseListList);
    return resultMap;
  }
  /**
   * 根据进货单id查询所有进货单商品
   * @param purchaseListId
   * @return
   * @throws Exception
   */
  @RequestMapping("/listGoods")
  @RequiresPermissions(value = { "进货单据查询" })
  public Map<String,Object> listGoods(Integer purchaseListId)throws Exception{
    if(purchaseListId==null){
      return null;
    }
    Map<String, Object> resultMap = new HashMap<>();
    List<PurchaseListGoods> purchaseListGoodsList=purchaseListGoodsService.listByPurchaseListId(purchaseListId);
    resultMap.put("rows", purchaseListGoodsList);
    return resultMap;
  }
  /**
   * 客户统计 获取进货单的所有商品信息
   * @param purchaseList
   * @param purchaseListGoods
   * @return
   * @throws Exception
   */
  @RequestMapping("/listCount")
  @RequiresPermissions(value = { "客户统计" })
  public Map<String,Object> listCount(PurchaseList purchaseList,PurchaseListGoods purchaseListGoods)throws Exception{
    Map<String, Object> resultMap = new HashMap<>();
    List<PurchaseList> purchaseListList=purchaseListService.list(purchaseList, Direction.DESC, "purchaseDate");
    for(PurchaseList pl:purchaseListList){
      purchaseListGoods.setPurchaseList(pl);
      List<PurchaseListGoods> plgList=purchaseListGoodsService.list(purchaseListGoods);
      for(PurchaseListGoods plg:plgList){
        plg.setPurchaseList(null);
      }
      pl.setPurchaseListGoodsList(plgList);
    }
    resultMap.put("rows", purchaseListList);
    return resultMap;
  }
  /**
   * 获取进货单号
   * @param type
   * @return
   * @throws Exception
   */
  @ResponseBody
  @RequestMapping("/getPurchaseNumber")
  @RequiresPermissions(value = {"进货入库"})
  public String genBillCode(String type)throws Exception{
    StringBuffer biilCodeStr=new StringBuffer();
    biilCodeStr.append("JH");
    biilCodeStr.append(DateUtil.getCurrentDateStr()); // 拼接当前日期
    String purchaseNumber=purchaseListService.getTodayMaxPurchaseNumber(); // 获取当天最大的进货单号
    if(purchaseNumber!=null){
      biilCodeStr.append(StringUtil.formatCode(purchaseNumber));
    }else{
      biilCodeStr.append("0001");
    }
    return biilCodeStr.toString();
  }
  /**
   * 添加进货单 以及所有进货单商品 以及 修改商品的成本均价
   * @param purchaseList
   * @param goodsJson
   * @return
   * @throws Exception
   */
  @ResponseBody
  @RequestMapping("/save")
  @RequiresPermissions(value = {"进货入库"})
  public Map<String,Object> save(PurchaseList purchaseList,String goodsJson)throws Exception{
    Map<String, Object> resultMap = new HashMap<>();
    purchaseList.setUser(userService.findByUserName((String) SecurityUtils.getSubject().getPrincipal())); // 设置操作用户
    Gson gson = new Gson();
    List<PurchaseListGoods> plgList=gson.fromJson(goodsJson, new TypeToken<List<PurchaseListGoods>>(){}.getType());
    purchaseListService.save(purchaseList, plgList);
    logService.save(new Log(Log.ADD_ACTION,"添加进货单"));
    resultMap.put("success", true); 
    return resultMap;
  }
  /**
   * 修改进货单的支付状态
   * @param id
   * @return
   * @throws Exception
   */
  @ResponseBody
  @RequestMapping("/update")
  @RequiresPermissions(value = {"供应商统计"})
  public Map<String,Object> update(Integer id)throws Exception{
    Map<String, Object> resultMap = new HashMap<>();
    PurchaseList purchaseList=purchaseListService.findById(id);
    purchaseList.setState(1); // 修改成支付状态
    purchaseListService.update(purchaseList);
    resultMap.put("success", true); 
    return resultMap;
  }
  /**
   * 根据id删除进货单信息 包括进货单里的商品
   * @param id
   * @return
   * @throws Exception
   */
  @RequestMapping("/delete")
  @RequiresPermissions(value = { "进货单据查询" })
  public Map<String,Object> delete(Integer id)throws Exception{
    Map<String, Object> resultMap = new HashMap<>();
    purchaseListService.delete(id);
    logService.save(new Log(Log.DELETE_ACTION,"删除进货单信息"+purchaseListService.findById(id)));  // 写入日志
    resultMap.put("success", true);   
    return resultMap;
  }
}
package com.jude.controller.admin;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.jude.entity.Log;
import com.jude.entity.Menu;
import com.jude.entity.Role;
import com.jude.service.*;
import com.jude.util.StringUtil;
import com.jude.entity.RoleMenu;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
/**
 * 后台管理角色Controller
 * @author znz
 *
 */
@RestController
@RequestMapping("/admin/role")
public class RoleAdminController {
  @Resource
  private RoleService roleService;
  @Resource
  private UserRoleService userRoleService;
  @Resource
  private MenuService menuService;
  @Resource
  private RoleMenuService roleMenuService;
  @Resource
  private LogService logService;
  /**
   * 查询所有角色
   * @return
   * @throws Exception
   */
  @RequestMapping("/listAll")
  @RequiresPermissions(value = { "角色管理" })
  public Map<String,Object> listAll()throws Exception{
    Map<String, Object> resultMap = new HashMap<>();
    resultMap.put("rows", roleService.listAll());
    logService.save(new Log(Log.SEARCH_ACTION,"查询所有角色信息")); // 写入日志
    return resultMap;
  }
  /**
   * 分页查询角色信息
   * @param user
   * @param page
   * @param rows
   * @return
   * @throws Exception
   */
  @RequestMapping("/list")
  @RequiresPermissions(value = { "角色管理" })
  public Map<String,Object> list(Role role, @RequestParam(value="page",required=false)Integer page, @RequestParam(value="rows",required=false)Integer rows)throws Exception{
    List<Role> roleList=roleService.list(role, page, rows, Direction.ASC, "id");
    Long total=roleService.getCount(role);
    Map<String, Object> resultMap = new HashMap<>();
    resultMap.put("rows", roleList);
    resultMap.put("total", total);
    logService.save(new Log(Log.SEARCH_ACTION,"查询角色信息")); // 写入日志
    return resultMap;
  }
  /**
   * 添加或者修改角色信息
   * @param role
   * @return
   * @throws Exception
   */
  @RequestMapping("/save")
  @RequiresPermissions(value = { "角色管理" })
  public Map<String,Object> save(Role role)throws Exception{
    if(role.getId()!=null){ // 写入日志
      logService.save(new Log(Log.UPDATE_ACTION,"更新角色信息"+role)); 
    }else{
      logService.save(new Log(Log.ADD_ACTION,"添加角色信息"+role)); 
    }
    Map<String, Object> resultMap = new HashMap<>();
    roleService.save(role);
    resultMap.put("success", true);
    return resultMap;
  }
  /**
   * 删除角色信息
   * @param id
   * @param response
   * @return
   * @throws Exception
   */
  @RequestMapping("/delete")
  @RequiresPermissions(value = { "角色管理" })
  public Map<String,Object> delete(Integer id)throws Exception{
    logService.save(new Log(Log.DELETE_ACTION,"删除角色信息"+roleService.findById(id)));  // 写入日志
    Map<String, Object> resultMap = new HashMap<>();
    userRoleService.deleteByRoleId(id); // 删除用户角色关联信息
    roleService.delete(id);       
    resultMap.put("success", true);
    return resultMap;
  }
  /**
   * 根据父节点获取所有复选框权限菜单树
   * @param parentId
   * @param roleId
   * @return
   * @throws Exception
   */
    @PostMapping("/loadCheckMenuInfo")
  @RequiresPermissions(value = { "角色管理" })
  public String loadCheckMenuInfo(Integer parentId,Integer roleId)throws Exception{
    List<Menu> menuList=menuService.findByRoleId(roleId); // 根据角色查询所有权限菜单信息
    List<Integer> menuIdList=new LinkedList<Integer>();
    for(Menu menu:menuList){
      menuIdList.add(menu.getId());
    }
    return getAllCheckedMenuByParentId(parentId,menuIdList).toString();
  }
  /**
   * 根据父节点ID和权限菜单ID集合获取复选框菜单节点
   * @param parentId
   * @param menuIdList
   * @return
   */
  private JsonArray getAllCheckedMenuByParentId(Integer parentId,List<Integer> menuIdList){
    JsonArray jsonArray=this.getCheckedMenuByParentId(parentId, menuIdList);
    for(int i=0;i<jsonArray.size();i++){
      JsonObject jsonObject=(JsonObject) jsonArray.get(i);
      if("open".equals(jsonObject.get("state").getAsString())){
          continue;
        }else{
          jsonObject.add("children", getAllCheckedMenuByParentId(jsonObject.get("id").getAsInt(),menuIdList));
        }
    }
    return jsonArray;
  }
  /**
   * 根据父节点ID和权限菜单ID集合获取复选框菜单节点
   * @param parentId
   * @param menuIdList
   * @return
   */
  private JsonArray getCheckedMenuByParentId(Integer parentId,List<Integer> menuIdList){
    List<Menu> menuList=menuService.findByParentId(parentId);
    JsonArray jsonArray=new JsonArray();
    for(Menu menu:menuList){
        JsonObject jsonObject=new JsonObject();
        int menuId=menu.getId();
        jsonObject.addProperty("id", menuId); // 节点id
        jsonObject.addProperty("text", menu.getName()); // 节点名称
        if(menu.getState()==1){
          jsonObject.addProperty("state", "closed"); // 根节点
        }else{
          jsonObject.addProperty("state", "open"); // 叶子节点
        }
        if(menuIdList.contains(menuId)){
          jsonObject.addProperty("checked", true);
        }
        jsonObject.addProperty("iconCls", menu.getIcon());
      jsonArray.add(jsonObject);
      }
    return jsonArray;
  }
  /**
   * 保存角色权限设置
   * @param menuIds
   * @param roleId
   * @return
   * @throws Exception
   */
  @RequestMapping("/saveMenuSet")
  @RequiresPermissions(value = { "角色管理" })
  public Map<String,Object> saveMenuSet(String menuIds,Integer roleId)throws Exception{
    Map<String, Object> resultMap = new HashMap<>();
    roleMenuService.deleteByRoleId(roleId); // 根据角色id删除所有角色权限关联实体
    if(StringUtil.isNotEmpty(menuIds)){
      String idsStr[]=menuIds.split(",");
      for(int i=0;i<idsStr.length;i++){ // 然后添加所有角色权限关联实体
        RoleMenu roleMenu=new RoleMenu();
        roleMenu.setRole(roleService.findById(roleId));
        roleMenu.setMenu(menuService.findById(Integer.parseInt(idsStr[i])));
        roleMenuService.save(roleMenu);
      }
    }
    resultMap.put("success", true);
    logService.save(new Log(Log.ADD_ACTION,"保存角色权限设置"));  // 写入日志
    return resultMap;
  }
}
相关实践学习
【涂鸦即艺术】基于云应用开发平台CAP部署AI实时生图绘板
【涂鸦即艺术】基于云应用开发平台CAP部署AI实时生图绘板
相关文章
|
JavaScript Java 关系型数据库
基于springboot的项目管理系统
本文探讨项目管理系统在现代企业中的应用与实现,分析其研究背景、意义及现状,阐述基于SSM、Java、MySQL和Vue等技术构建系统的关键方法,展现其在提升管理效率、协同水平与风险管控方面的价值。
基于springboot的儿童家长教育能力提升学习系统
本系统聚焦儿童家长教育能力提升,针对家庭教育中理念混乱、时间不足、个性化服务缺失等问题,构建科学、系统、个性化的在线学习平台。融合Spring Boot、Vue等先进技术,整合优质教育资源,提供高效便捷的学习路径,助力家长掌握科学育儿方法,促进儿童全面健康发展,推动家庭和谐与社会进步。
|
JavaScript Java 关系型数据库
基于springboot的古树名木保护管理系统
本研究针对古树保护面临的严峻挑战,构建基于Java、Vue、MySQL与Spring Boot技术的信息化管理系统,实现古树资源的动态监测、数据管理与科学保护,推动生态、文化与经济可持续发展。
2025基于springboot的校车预定全流程管理系统
针对传统校车管理效率低、信息不透明等问题,本研究设计并实现了一套校车预定全流程管理系统。系统采用Spring Boot、Java、Vue和MySQL等技术,实现校车信息管理、在线预定、实时监控等功能,提升学校管理效率,保障学生出行安全,推动教育信息化发展。
基于springboot的大学公文收发管理系统
本文介绍公文收发系统的研究背景与意义,分析其在数字化阅读趋势下的必要性。系统采用Vue、Java、Spring Boot与MySQL技术,实现高效、便捷的公文管理与在线阅读,提升用户体验与信息处理效率。
|
人工智能 Java 关系型数据库
基于springboot的画品交流系统
本项目构建基于Java+Vue+SpringBoot+MySQL的画品交流系统,旨在解决传统艺术交易信息不透明、流通受限等问题,融合区块链与AI技术,实现画品展示、交易、鉴赏与社交一体化,推动艺术数字化转型与文化传播。
|
JavaScript Java 关系型数据库
基于springboot的高校运动会系统
本系统基于Spring Boot、Vue与MySQL,实现高校运动会报名、赛程安排及成绩管理的全流程信息化,提升组织效率,杜绝信息错漏与冒名顶替,推动体育赛事智能化发展。
基于springboot的大学生兼职系统
本课题针对大学生兼职信息不对称、权益难保障等问题,研究基于Spring Boot、Vue、MySQL等技术的兼职系统,旨在构建安全、高效、功能完善的平台,提升大学生就业竞争力与兼职质量。
基于springboot的养老院管理系统
随着人口老龄化加剧,传统养老院管理效率低下,亟需信息化升级。本文基于Java、Spring Boot、Vue等技术构建智慧养老系统,结合MySQL与MyBatis实现数据高效管理,提升服务精准性与运营效率,推动养老服务向智能化、现代化发展。