赞
踩
基于javaweb+mysql的springboot仓库管理系统设计和实现(java+ssm+springboot+layui+thymeleaf+html)
运行环境
Java≥8、MySQL≥5.7
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SpringBoot仓库管理系统设计和实现(java+ssm+springboot+layui+thymeleaf+html)
主要功能模块
1.用户模块管理:用户登录、用户注册、用户的查询、添加、删除操作、
2.客户信息管理:.客户列表的展示、添加、修改、删除操作、
3.供应商管理:供应商详情列表的查看、添加、删除等操作、
4.退货管理和退货查询
5.公告信息管理:公告信息的查看、添加、修改、删除操作、
6.角色管理:角色查询、添加、删除、
7.系统管理、菜单管理以及权限控制
8.管理员信息管理:管理员信息的查看、修改
给大家截一部分效果图:
主要技术:springboot Java、springmvc mysql layui jquery mybatis
if (!(goodsVo.getGoodsimg()!=null&&goodsVo.getGoodsimg().equals(Constast.DEFAULT_IMG_GOODS))){ if (goodsVo.getGoodsimg().endsWith("_temp")){ String newName = AppFileUtils.renameFile(goodsVo.getGoodsimg()); goodsVo.setGoodsimg(newName); //删除原先的图片 String oldPath = goodsService.getById(goodsVo.getId()).getGoodsimg(); AppFileUtils.removeFileByPath(oldPath); } } goodsService.updateById(goodsVo); return ResultObj.UPDATE_SUCCESS; } catch (Exception e) { e.printStackTrace(); return ResultObj.UPDATE_ERROR; } } /** * 删除商品 * @param id 商品id * @return */ @RequestMapping("deleteGoods") public ResultObj deleteGoods(Integer id,String goodsimg){ try { //删除商品的图片 AppFileUtils.removeFileByPath(goodsimg); // goodsService.removeById(id); goodsService.deleteGoodsById(id); return ResultObj.DELETE_SUCCESS; } catch (Exception e) { e.printStackTrace(); return ResultObj.DELETE_ERROR; } } /** * 加载所有可用的商品 * @return */
*/ @RequestMapping("loadPermissionMaxOrderNum") public Map<String,Object> loadPermissionMaxOrderNum(){ Map<String,Object> map = new HashMap<String,Object>(); QueryWrapper<Permission> queryWrapper = new QueryWrapper<>(); queryWrapper.orderByDesc("ordernum"); IPage<Permission> page = new Page<>(1,1); List<Permission> list = permissionService.page(page,queryWrapper).getRecords(); if (list.size()>0){ map.put("value",list.get(0).getOrdernum()+1); }else { map.put("value",1); } return map; } /** * 更新权限 * @param permissionVo * @return */ @RequestMapping("updatePermission") public ResultObj updatePermission(PermissionVo permissionVo){ try { permissionService.updateById(permissionVo); return ResultObj.UPDATE_SUCCESS; } catch (Exception e) { e.printStackTrace(); return ResultObj.UPDATE_ERROR; } } /** * 检查当前权限是否有子权限 * @param permissionVo * @return */ @RequestMapping("checkPermissionHasChildrenNode") public Map<String,Object> checkPermissionHasChildrenNode(PermissionVo permissionVo){ Map<String,Object> map = new HashMap<String, Object>(); QueryWrapper<Permission> queryWrapper = new QueryWrapper<>(); queryWrapper.eq("pid",permissionVo.getId()); List<Permission> list = permissionService.list(queryWrapper); if (list.size()>0){ map.put("value",true);
/** * <p> * InnoDB free: 9216 kB; (`providerid`) REFER `warehouse/bus_provider`(`id`); (`goo 前端控制器 * </p> * */ @RestController @RequestMapping("inport") public class InportController { @Autowired private IInportService inportService; @Autowired private IProviderService providerService; @Autowired private IGoodsService goodsService; /** * 查询商品进货 * @param inportVo * @return */ @RequestMapping("loadAllInport") public DataGridView loadAllInport(InportVo inportVo){ IPage<Inport> page = new Page<Inport>(inportVo.getPage(),inportVo.getLimit()); QueryWrapper<Inport> queryWrapper = new QueryWrapper<Inport>(); //对供应商进行查询 queryWrapper.eq(inportVo.getProviderid()!=null&&inportVo.getProviderid()!=0,"providerid",inportVo.getProviderid()); //对商品进行查询 queryWrapper.eq(inportVo.getGoodsid()!=null&&inportVo.getGoodsid()!=0,"goodsid",inportVo.getGoodsid());
} } /** * 批量删除 * @param loginfoVo * @return */ @RequestMapping("batchDeleteLoginfo") public ResultObj batchDeleteLoginfo(LoginfoVo loginfoVo) { try { Collection<Serializable> idList = new ArrayList<Serializable>(); for (Integer id : loginfoVo.getIds()) { idList.add(id); } this.loginfoService.removeByIds(idList); return ResultObj.DELETE_SUCCESS; } catch (Exception e) { e.printStackTrace(); return ResultObj.DELETE_ERROR; } } } package com.yeqifu.sys.controller; /** * 缓存管理控制器
return ResultObj.UPDATE_SUCCESS; } catch (Exception e) { e.printStackTrace(); return ResultObj.UPDATE_ERROR; } } /** * 检查当前权限是否有子权限 * @param permissionVo * @return */ @RequestMapping("checkPermissionHasChildrenNode") public Map<String,Object> checkPermissionHasChildrenNode(PermissionVo permissionVo){ Map<String,Object> map = new HashMap<String, Object>(); QueryWrapper<Permission> queryWrapper = new QueryWrapper<>(); queryWrapper.eq("pid",permissionVo.getId()); List<Permission> list = permissionService.list(queryWrapper); if (list.size()>0){ map.put("value",true); }else { map.put("value",false); } return map; } /** * 删除权限 * @param permissionVo * @return */ @RequestMapping("deletePermission") public ResultObj deletePermission(PermissionVo permissionVo){ try { permissionService.removeById(permissionVo.getId()); return ResultObj.DELETE_SUCCESS; } catch (Exception e) { e.printStackTrace(); return ResultObj.DELETE_ERROR; } } }
public ResultObj queryMgrByUserId(Integer userId){ Boolean isMgr = userService.queryMgrByUserId(userId); if (isMgr){ return ResultObj.DELETE_ERROR_NEWS; }else { return ResultObj.DELETE_QUERY; } } /** * 重置用户密码 * @param id * @return */ @RequestMapping("resetPwd/{id}") public ResultObj resetPwd(@PathVariable("id") Integer id){ try { User user = new User(); user.setId(id); //设置盐 32位(大写英文字母(A-Z)加数字(0-9)) String salt = IdUtil.simpleUUID().toUpperCase(); user.setSalt(salt); //设置密码 user.setPwd(new Md5Hash(Constast.USER_DEFAULT_PWD,salt,2).toString()); userService.updateById(user); return ResultObj.RESET_SUCCESS; } catch (Exception e) { e.printStackTrace(); return ResultObj.RESET_ERROR; } } /** * 根据用户id查询角色并选中已拥有的角色 * @param id 用户id * @return */ @RequestMapping("initRoleByUserId") public DataGridView initRoleByUserId(Integer id){ //1.查询所有可用的角色 QueryWrapper<Role> queryWrapper = new QueryWrapper<>(); queryWrapper.eq("available",Constast.AVAILABLE_TRUE); List<Map<String, Object>> listMaps = roleService.listMaps(queryWrapper); //2.查询当前用户拥有的角色ID集合 List<Integer> currentUserRoleIds = roleService.queryUserRoleIdsByUid(id); for (Map<String, Object> map : listMaps) { Boolean LAY_CHECKED=false; Integer roleId = (Integer) map.get("id"); for (Integer rid : currentUserRoleIds) { //如果当前用户已有该角色,则让LAY_CHECKED为true。LAY_CHECKED为true时,复选框选中 if (rid.equals(roleId)){ LAY_CHECKED=true; break; }
* 删除单条日志 * @param id * @return */ @RequestMapping("deleteLoginfo") public ResultObj deleteLoginfo(Integer id) { try { loginfoService.removeById(id); return ResultObj.DELETE_SUCCESS; } catch (Exception e) { e.printStackTrace(); return ResultObj.DELETE_ERROR; } } /** * 批量删除 * @param loginfoVo * @return */ @RequestMapping("batchDeleteLoginfo") public ResultObj batchDeleteLoginfo(LoginfoVo loginfoVo) { try { Collection<Serializable> idList = new ArrayList<Serializable>(); for (Integer id : loginfoVo.getIds()) { idList.add(id); } this.loginfoService.removeByIds(idList); return ResultObj.DELETE_SUCCESS; } catch (Exception e) { e.printStackTrace(); return ResultObj.DELETE_ERROR; } } } package com.yeqifu.sys.controller;
* 加载排序码 * @return */ @RequestMapping("loadUserMaxOrderNum") public Map<String,Object> loadUserMaxOrderNum(){ Map<String,Object> map = new HashMap<String,Object>(); QueryWrapper<User> queryWrapper = new QueryWrapper<User>(); queryWrapper.orderByDesc("ordernum"); IPage<User> page = new Page<>(1,1); List<User> list = userService.page(page,queryWrapper).getRecords(); if (list.size()>0){ map.put("value",list.get(0).getOrdernum()+1); }else { map.put("value",1); } return map; } /** * 根据部门ID查询用户 * @param deptId * @return */ @RequestMapping("loadUsersByDeptId") public DataGridView loadUsersByDeptIp(Integer deptId){ QueryWrapper<User> queryWrapper = new QueryWrapper<User>(); queryWrapper.eq(deptId!=null,"deptid",deptId); queryWrapper.eq("available",Constast.AVAILABLE_TRUE); queryWrapper.eq("type",Constast.USER_TYPE_NORMAL); List<User> list = userService.list(queryWrapper); for (User user : list) { System.out.println(user.toString()); } return new DataGridView(list); } /** * 把用户名转成拼音 * @param username * @return */ @RequestMapping("changeChineseToPinyin")
//设置user的部门名称 user.setDeptname(one.getName()); } Integer mgr = user.getMgr(); if (mgr!=null&&mgr!=0){ User one = userService.getById(mgr); //设置user的领导名称 user.setLeadername(one.getName()); } } return new DataGridView(page.getTotal(),list); } /** * 加载排序码 * @return */ @RequestMapping("loadUserMaxOrderNum") public Map<String,Object> loadUserMaxOrderNum(){ Map<String,Object> map = new HashMap<String,Object>(); QueryWrapper<User> queryWrapper = new QueryWrapper<User>(); queryWrapper.orderByDesc("ordernum"); IPage<User> page = new Page<>(1,1); List<User> list = userService.page(page,queryWrapper).getRecords(); if (list.size()>0){ map.put("value",list.get(0).getOrdernum()+1); }else { map.put("value",1); } return map; } /** * 根据部门ID查询用户 * @param deptId * @return */ @RequestMapping("loadUsersByDeptId") public DataGridView loadUsersByDeptIp(Integer deptId){ QueryWrapper<User> queryWrapper = new QueryWrapper<User>(); queryWrapper.eq(deptId!=null,"deptid",deptId); queryWrapper.eq("available",Constast.AVAILABLE_TRUE); queryWrapper.eq("type",Constast.USER_TYPE_NORMAL); List<User> list = userService.list(queryWrapper); for (User user : list) { System.out.println(user.toString()); } return new DataGridView(list); } /** * 把用户名转成拼音
public ResultObj batchDeleteNotice(NoticeVo noticeVo){ try { Collection<Serializable> idList = new ArrayList<>(); for (Integer id : noticeVo.getIds()) { idList.add(id); } noticeService.removeByIds(idList); return ResultObj.DELETE_SUCCESS; } catch (Exception e) { e.printStackTrace(); return ResultObj.DELETE_ERROR; } } } package com.yeqifu.sys.controller; /** * 系统进行跳转的路由 */ @Controller @RequestMapping("sys") public class SystemController { /** * 跳转到登陆页面 * @return */ @RequestMapping("toLogin") public String toLogin(){ return "system/index/login"; } /** * 跳转到个人资料页面 * @return */
/** * 添加进货商品 * @param inportVo * @return */ @RequestMapping("addInport") public ResultObj addInport(InportVo inportVo){ try { //获得当前系统用户 User user = (User) WebUtils.getSession().getAttribute("user"); //设置操作人 inportVo.setOperateperson(user.getName()); //设置进货时间 inportVo.setInporttime(new Date()); inportService.save(inportVo); return ResultObj.ADD_SUCCESS; } catch (Exception e) { e.printStackTrace(); return ResultObj.ADD_ERROR; } } /** * 更新进货商品 * @param inportVo * @return */ @RequestMapping("updateInport") public ResultObj updateInport(InportVo inportVo){ try { inportService.updateById(inportVo); return ResultObj.UPDATE_SUCCESS; } catch (Exception e) { e.printStackTrace(); return ResultObj.UPDATE_ERROR; } } /** * 删除进货商品 * @param id * @return */ @RequestMapping("deleteInport") public ResultObj deleteInport(Integer id){ try {
*/ @RequestMapping("updateMenu") public ResultObj updateMenu(PermissionVo permissionVo){ try { permissionService.updateById(permissionVo); return ResultObj.UPDATE_SUCCESS; } catch (Exception e) { e.printStackTrace(); return ResultObj.UPDATE_ERROR; } } /** * 检查当前菜单是否有子菜单 * @param permissionVo * @return */ @RequestMapping("checkMenuHasChildrenNode") public Map<String,Object> checkMenuHasChildrenNode(PermissionVo permissionVo){ Map<String,Object> map = new HashMap<String, Object>(); QueryWrapper<Permission> queryWrapper = new QueryWrapper<>(); queryWrapper.eq("pid",permissionVo.getId()); List<Permission> list = permissionService.list(queryWrapper); if (list.size()>0){ map.put("value",true); }else { map.put("value",false); } return map; } /** * 删除菜单 * @param permissionVo * @return */ @RequestMapping("deleteMenu") public ResultObj deleteMenu(PermissionVo permissionVo){ try { permissionService.removeById(permissionVo.getId()); return ResultObj.DELETE_SUCCESS; } catch (Exception e) { e.printStackTrace(); return ResultObj.DELETE_ERROR; } }
//设置user的部门名称 user.setDeptname(one.getName()); } Integer mgr = user.getMgr(); if (mgr!=null&&mgr!=0){ User one = userService.getById(mgr); //设置user的领导名称 user.setLeadername(one.getName()); } } return new DataGridView(page.getTotal(),list); } /** * 加载排序码 * @return */ @RequestMapping("loadUserMaxOrderNum") public Map<String,Object> loadUserMaxOrderNum(){ Map<String,Object> map = new HashMap<String,Object>(); QueryWrapper<User> queryWrapper = new QueryWrapper<User>(); queryWrapper.orderByDesc("ordernum"); IPage<User> page = new Page<>(1,1); List<User> list = userService.page(page,queryWrapper).getRecords(); if (list.size()>0){ map.put("value",list.get(0).getOrdernum()+1); }else { map.put("value",1); } return map; } /** * 根据部门ID查询用户 * @param deptId * @return */ @RequestMapping("loadUsersByDeptId") public DataGridView loadUsersByDeptIp(Integer deptId){ QueryWrapper<User> queryWrapper = new QueryWrapper<User>(); queryWrapper.eq(deptId!=null,"deptid",deptId); queryWrapper.eq("available",Constast.AVAILABLE_TRUE); queryWrapper.eq("type",Constast.USER_TYPE_NORMAL); List<User> list = userService.list(queryWrapper); for (User user : list) {
/** * <p> * InnoDB free: 9216 kB 前端控制器 * </p> * */ @RestController @RequestMapping("loginfo") public class LoginfoController { @Autowired private ILoginfoService loginfoService; /** * 查询所有登陆日志的信息 * @param loginfoVo * @return */ @RequestMapping("loadAllLoginfo") public DataGridView loadAllLoginfo(LoginfoVo loginfoVo) { IPage<Loginfo> page = new Page<Loginfo>(loginfoVo.getPage(), loginfoVo.getLimit()); QueryWrapper<Loginfo> queryWrapper = new QueryWrapper<Loginfo>(); // 进行模糊查询 queryWrapper.like(StringUtils.isNotBlank(loginfoVo.getLoginname()), "loginname", loginfoVo.getLoginname()); queryWrapper.like(StringUtils.isNotBlank(loginfoVo.getLoginip()), "loginip", loginfoVo.getLoginip()); // 数据库中登陆时间要大于用户输入的开始时间且小于用户登陆的结束时间 queryWrapper.ge(loginfoVo.getStartTime() != null, "logintime", loginfoVo.getStartTime()); queryWrapper.le(loginfoVo.getEndTime() != null, "logintime", loginfoVo.getEndTime()); // 根据登陆时间进行降序排序 queryWrapper.orderByDesc("logintime"); loginfoService.page(page, queryWrapper); return new DataGridView(page.getTotal(), page.getRecords()); }
/** * <p> * InnoDB free: 9216 kB 前端控制器 * </p> * */ @RestController @RequestMapping("/outport") public class OutportController { @Autowired private IOutportService outportService; @Autowired private IProviderService providerService; @Autowired private IGoodsService goodsService; /** * 添加退货信息 * @param id 进货单ID * @param number 退货数量 * @param remark 备注 * @return */ @RequestMapping("addOutport") public ResultObj addOutport(Integer id,Integer number,String remark){ try { outportService.addOutport(id,number,remark); return ResultObj.BACKINPORT_SUCCESS; } catch (Exception e) { e.printStackTrace(); return ResultObj.BACKINPORT_ERROR;
* @return */ @RequestMapping("loadPermissionMaxOrderNum") public Map<String,Object> loadPermissionMaxOrderNum(){ Map<String,Object> map = new HashMap<String,Object>(); QueryWrapper<Permission> queryWrapper = new QueryWrapper<>(); queryWrapper.orderByDesc("ordernum"); IPage<Permission> page = new Page<>(1,1); List<Permission> list = permissionService.page(page,queryWrapper).getRecords(); if (list.size()>0){ map.put("value",list.get(0).getOrdernum()+1); }else { map.put("value",1); } return map; } /** * 更新权限 * @param permissionVo * @return */ @RequestMapping("updatePermission") public ResultObj updatePermission(PermissionVo permissionVo){ try { permissionService.updateById(permissionVo); return ResultObj.UPDATE_SUCCESS; } catch (Exception e) { e.printStackTrace(); return ResultObj.UPDATE_ERROR; } } /** * 检查当前权限是否有子权限 * @param permissionVo * @return */ @RequestMapping("checkPermissionHasChildrenNode") public Map<String,Object> checkPermissionHasChildrenNode(PermissionVo permissionVo){ Map<String,Object> map = new HashMap<String, Object>(); QueryWrapper<Permission> queryWrapper = new QueryWrapper<>(); queryWrapper.eq("pid",permissionVo.getId()); List<Permission> list = permissionService.list(queryWrapper);
*/ @RestController @RequestMapping("/dept") public class DeptController { @Autowired private IDeptService deptService; /** * 加载部门左边的菜单树 * @param deptVo * @return */ @RequestMapping("loadDeptManagerLeftTreeJson") public DataGridView loadManagerLeftTreeJson(DeptVo deptVo){ //查询出所有的部门,存放进list中 // QueryWrapper<Dept> queryWrapper = new QueryWrapper<>(); // queryWrapper.eq('1'); List<Dept> list = deptService.list(); List<TreeNode> treeNodes = new ArrayList<>(); //将部门放入treeNodes中,组装成json for (Dept dept : list) { Boolean open = dept.getOpen()==1?true:false; treeNodes.add(new TreeNode(dept.getId(),dept.getPid(),dept.getName(),open)); } return new DataGridView(treeNodes); } /** * 查询所有部门数据 * @param deptVo * @return */ @RequestMapping("loadAllDept") public DataGridView loadAllDept(DeptVo deptVo){ IPage<Dept> page = new Page<>(deptVo.getPage(),deptVo.getLimit()); //进行模糊查询 QueryWrapper<Dept> queryWrapper = new QueryWrapper<>(); queryWrapper.like(StringUtils.isNotBlank(deptVo.getName()),"name",deptVo.getName()); queryWrapper.like(StringUtils.isNotBlank(deptVo.getRemark()),"remark",deptVo.getRemark()); queryWrapper.like(StringUtils.isNotBlank(deptVo.getAddress()),"address",deptVo.getAddress()); queryWrapper.eq(deptVo.getId()!=null,"id",deptVo.getId()).or().eq(deptVo.getId()!=null,"pid",deptVo.getId()); queryWrapper.orderByAsc("ordernum"); //进行查询 deptService.page(page,queryWrapper); //返回DataGridView return new DataGridView(page.getTotal(),page.getRecords()); }
} } /** * 根据用户ID查询当前用户是否是其他用户的直属领导 * @param userId * @return */ @RequestMapping("queryMgrByUserId") public ResultObj queryMgrByUserId(Integer userId){ Boolean isMgr = userService.queryMgrByUserId(userId); if (isMgr){ return ResultObj.DELETE_ERROR_NEWS; }else { return ResultObj.DELETE_QUERY; } } /** * 重置用户密码 * @param id * @return */ @RequestMapping("resetPwd/{id}") public ResultObj resetPwd(@PathVariable("id") Integer id){ try { User user = new User(); user.setId(id); //设置盐 32位(大写英文字母(A-Z)加数字(0-9)) String salt = IdUtil.simpleUUID().toUpperCase(); user.setSalt(salt); //设置密码 user.setPwd(new Md5Hash(Constast.USER_DEFAULT_PWD,salt,2).toString()); userService.updateById(user); return ResultObj.RESET_SUCCESS; } catch (Exception e) { e.printStackTrace(); return ResultObj.RESET_ERROR; } } /** * 根据用户id查询角色并选中已拥有的角色 * @param id 用户id * @return */ @RequestMapping("initRoleByUserId")
IPage<Dept> page = new Page<>(deptVo.getPage(),deptVo.getLimit()); //进行模糊查询 QueryWrapper<Dept> queryWrapper = new QueryWrapper<>(); queryWrapper.like(StringUtils.isNotBlank(deptVo.getName()),"name",deptVo.getName()); queryWrapper.like(StringUtils.isNotBlank(deptVo.getRemark()),"remark",deptVo.getRemark()); queryWrapper.like(StringUtils.isNotBlank(deptVo.getAddress()),"address",deptVo.getAddress()); queryWrapper.eq(deptVo.getId()!=null,"id",deptVo.getId()).or().eq(deptVo.getId()!=null,"pid",deptVo.getId()); queryWrapper.orderByAsc("ordernum"); //进行查询 deptService.page(page,queryWrapper); //返回DataGridView return new DataGridView(page.getTotal(),page.getRecords()); } /** * 添加部门 * @param deptVo * @return */ @RequestMapping("addDept") public ResultObj addDept(DeptVo deptVo){ try { deptVo.setCreatetime(new Date()); deptService.save(deptVo); return ResultObj.ADD_SUCCESS; } catch (Exception e) { e.printStackTrace(); return ResultObj.ADD_ERROR; } } /** * 加载排序码 * @return */ @RequestMapping("loadDeptMaxOrderNum") public Map<String,Object> loadDeptMaxOrderNum(){ Map<String,Object> map = new HashMap<String,Object>(); QueryWrapper<Dept> queryWrapper = new QueryWrapper<>(); queryWrapper.orderByDesc("ordernum"); IPage<Dept> page = new Page<>(1,1); List<Dept> list = deptService.page(page,queryWrapper).getRecords(); if (list.size()>0){ map.put("value",list.get(0).getOrdernum()+1); }else { map.put("value",1); } return map; } /** * 更新部门 * @param deptVo * @return
/** * <p> * InnoDB free: 9216 kB 前端控制器 * </p> * */ @RestController @RequestMapping("/salesback") public class SalesbackController { @Autowired private ISalesbackService salesbackService; @Autowired private ICustomerService customerService; @Autowired private IGoodsService goodsService; /** * 添加退货信息 * @param id 进货单ID * @param number 退货数量 * @param remark 备注 * @return */ @RequestMapping("addSalesback") public ResultObj addSalesback(Integer id,Integer number,String remark){ try { salesbackService.addSalesback(id,number,remark); return ResultObj.BACKINPORT_SUCCESS; } catch (Exception e) { e.printStackTrace();
try { outportService.addOutport(id,number,remark); return ResultObj.BACKINPORT_SUCCESS; } catch (Exception e) { e.printStackTrace(); return ResultObj.BACKINPORT_ERROR; } } /**t * 查询商品退货 * @param outportVo * @return */ @RequestMapping("loadAllOutport") public DataGridView loadAllOuport(OutportVo outportVo){ IPage<Outport> page = new Page<Outport>(outportVo.getPage(),outportVo.getLimit()); QueryWrapper<Outport> queryWrapper = new QueryWrapper<Outport>(); //对供应商进行查询 queryWrapper.eq(outportVo.getProviderid()!=null&&outportVo.getProviderid()!=0,"providerid",outportVo.getProviderid()); //对商品进行查询 queryWrapper.eq(outportVo.getGoodsid()!=null&&outportVo.getGoodsid()!=0,"goodsid",outportVo.getGoodsid()); //对时间进行查询要求大于开始时间小于结束时间 queryWrapper.ge(outportVo.getStartTime()!=null,"outputtime",outportVo.getStartTime()); queryWrapper.le(outportVo.getEndTime()!=null,"outputtime",outportVo.getEndTime()); //通过进货时间对商品进行排序 queryWrapper.orderByDesc("outputtime"); IPage<Outport> page1 = outportService.page(page, queryWrapper); List<Outport> records = page1.getRecords(); for (Outport ouport : records) { Provider provider = providerService.getById(ouport.getProviderid()); if (provider!=null){ //设置供应商姓名 ouport.setProvidername(provider.getProvidername()); } Goods goods = goodsService.getById(ouport.getGoodsid()); if (goods!=null){ //设置商品名称 ouport.setGoodsname(goods.getGoodsname()); //设置商品规格 ouport.setSize(goods.getSize()); } } return new DataGridView(page1.getTotal(),page1.getRecords()); } /** * 删除退货信息 * @param id
public DataGridView loadAllCache(){ List<CacheBean> list = new ArrayList<>(); Set<Map.Entry<String, Object>> entrySet = CACHE_CONTAINER.entrySet(); for (Map.Entry<String, Object> entry : entrySet) { list.add(new CacheBean(entry.getKey(),entry.getValue())); } return new DataGridView(list); } /** * 删除缓存 * @param key * @return */ @RequestMapping("deleteCache") public ResultObj deleteCache(String key){ CachePool.removeCacheByKey(key); return ResultObj.DELETE_SUCCESS; } /** * 清空所有缓存 * @return */ @RequestMapping("removeAllCache") public ResultObj removeAllCache(){ CachePool.removeAll(); return ResultObj.DELETE_SUCCESS; } /** * 同步缓存 * @return */ @RequestMapping("syncCache") public ResultObj syncCache(){ CachePool.syncData(); return ResultObj.SYNCCACHE_SUCCESS; }
/** * <p> * InnoDB free: 9216 kB 前端控制器 * </p> * */ @RestController @RequestMapping("notice") public class NoticeController { @Autowired private INoticeService noticeService; /** * 公告的查询 * @param noticeVo * @return */ @RequestMapping("loadAllNotice") public DataGridView loadAllNotice(NoticeVo noticeVo){ IPage<Notice> page = new Page<Notice>(noticeVo.getPage(),noticeVo.getLimit()); QueryWrapper<Notice> queryWrapper = new QueryWrapper<Notice>(); //进行模糊查询 queryWrapper.like(StringUtils.isNotBlank(noticeVo.getTitle()),"title",noticeVo.getTitle()); queryWrapper.like(StringUtils.isNotBlank(noticeVo.getOpername()),"opername",noticeVo.getOpername()); //公告创建时间应该大于搜索开始时间小于搜索结束时间
/** * 系统进行跳转的路由 */ @Controller @RequestMapping("sys") public class SystemController { /** * 跳转到登陆页面 * @return */ @RequestMapping("toLogin") public String toLogin(){ return "system/index/login"; } /** * 跳转到个人资料页面 * @return */ @RequestMapping("toUserInfo") public String toUserInfo(){ return "system/user/userInfo"; } /** * 跳转到修改密码页面 * @return */ @RequestMapping("toChangePassword") public String toChangePassword(){ return "system/user/changePassword"; }
} } goodsService.updateById(goodsVo); return ResultObj.UPDATE_SUCCESS; } catch (Exception e) { e.printStackTrace(); return ResultObj.UPDATE_ERROR; } } /** * 删除商品 * @param id 商品id * @return */ @RequestMapping("deleteGoods") public ResultObj deleteGoods(Integer id,String goodsimg){ try { //删除商品的图片 AppFileUtils.removeFileByPath(goodsimg); // goodsService.removeById(id); goodsService.deleteGoodsById(id); return ResultObj.DELETE_SUCCESS; } catch (Exception e) { e.printStackTrace(); return ResultObj.DELETE_ERROR; } } /** * 加载所有可用的商品 * @return */ @RequestMapping("loadAllGoodsForSelect") public DataGridView loadAllGoodsForSelect(){ QueryWrapper<Goods> queryWrapper = new QueryWrapper<Goods>(); queryWrapper.eq("available",Constast.AVAILABLE_TRUE); List<Goods> list = goodsService.list(queryWrapper); for (Goods goods : list) { Provider provider = providerService.getById(goods.getProviderid()); if (null!=provider){ goods.setProvidername(provider.getProvidername()); } } return new DataGridView(list); } /** * 根据供应商ID查询商品信息 * @param providerid 供应商ID * @return
@Autowired private ICustomerService customerService; @Autowired private IGoodsService goodsService; /** * 查询所有商品销售信息 * @param salesVo * @return */ @RequestMapping("loadAllSales") public DataGridView loadAllSales(SalesVo salesVo){ IPage<Sales> page = new Page<>(salesVo.getPage(),salesVo.getLimit()); QueryWrapper<Sales> queryWrapper = new QueryWrapper<Sales>(); //根据客户进行模糊查询 queryWrapper.eq(salesVo.getCustomerid()!=null&&salesVo.getCustomerid()!=0,"customerid",salesVo.getCustomerid()); //根据商品模糊查询 queryWrapper.eq(salesVo.getGoodsid()!=null&&salesVo.getGoodsid()!=0,"goodsid",salesVo.getGoodsid()); //根据时间进行模糊查询 queryWrapper.ge(salesVo.getStartTime()!=null,"salestime",salesVo.getStartTime()); queryWrapper.le(salesVo.getEndTime()!=null,"salestime",salesVo.getEndTime()); IPage<Sales> page1 = salesService.page(page, queryWrapper); List<Sales> records = page1.getRecords(); for (Sales sales : records) { //设置客户姓名 Customer customer = customerService.getById(sales.getCustomerid()); if(null!=customer){ sales.setCustomername(customer.getCustomername()); } //设置商品名称 Goods goods = goodsService.getById(sales.getGoodsid()); if (null!=goods){ //设置商品名称 sales.setGoodsname(goods.getGoodsname()); //设置商品规格 sales.setSize(goods.getSize()); } } return new DataGridView(page1.getTotal(),page1.getRecords()); } /** * 添加商品销售信息 * @param salesVo
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。