——————————DescriptionStart——————————
运行环境
Java≥8、MySQL≥5.7、Node.js≥14
开发工具
后端:eclipse/idea/myeclipse/sts等均可配置运行
前端:WebStorm/VSCode/HBuilderX等均可
❗没学过node.js的不要搞前后端分离项目
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb的SpringBoot智能物流管理系统(java+springboot+mybaits+vue+elementui+mysql)
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
4.数据库:MySql 5.7/8.0版本均可;
5.是否Maven项目:是;
技术栈
后端:SpringBoot+Mybaits
前端:Vue + elementui
使用说明
项目运行:
使用Navicat或者其它工具,在mysql中创建对应sql文件名称的数据库,并导入项目的sql文件;
使用IDEA/Eclipse/MyEclipse导入项目,导入成功后请执行maven clean;maven install命令;
将项目中application.yml配置文件中的数据库配置改为自己的配置;
运行项目,在浏览器中输入地址:
前台地址:http://localhost:8080/springbootrpj39/front/index.html
后台地址:http://localhost:8080/springbootrpj39/admin/dist/index.html
管理员 abo 密码 abo
用户:用户1 密码: 123456
注意项目文件路径中不能含有中文、空格、特殊字符等,否则图片会上传不成功。
——————————CodeStart——————————
运输点管理控制层代码:
/**
- 运输点管理控制层
*/
@RequestMapping(“/admin/transport”)
@Controller
public class TransportController {
@Autowired
private UserService userService;
@Autowired
private RoleService roleService;
@Autowired
private OperaterLogService operaterLogService;
/**
运输点列表页面
@param model
@param user
@param pageBean
@return
*/
@RequestMapping(value=”/list”)
public String list(Model model, User user, PageBean
model.addAttribute(“title”, “运输点列表”);
model.addAttribute(“username”, user.getUsername());
model.addAttribute(“pageBean”, userService.findList(pageBean,user.getUsername(), UserRoleTypeEnum.TRANSPORT));
return “admin/transport/list”;
/**
新增运输点页面
@param model
@return
*/
@RequestMapping(value=”/add”,method= RequestMethod.GET)
public String add(Model model){
model.addAttribute(“roles”, roleService.findAllByRoleType(UserRoleTypeEnum.TRANSPORT));
return “admin/transport/add”;
/**
运输点添加表单提交处理
@param user
@return
*/
@RequestMapping(value=”/add”,method= RequestMethod.POST)
@ResponseBody
public Result
//用统一验证实体方法验证是否合法
CodeMsg validate = ValidateEntityUtil.validate(user);
if(validate.getCode() != CodeMsg.SUCCESS.getCode()){
return Result.error(validate);
if(user.getAddress() == null){
return Result.error(CodeMsg.ADDRESS_ERROR);
if(user.getRole() == null || user.getRole().getId() == null){
return Result.error(CodeMsg.TRANSPORT_USER_ROLE_EMPTY);
//判断运输点名是否存在
if(userService.isExistUsername(user.getUsername(), 0L)){
return Result.error(CodeMsg.TRANSPORT_USERNAME_EXIST);
user.setUserType(UserRoleTypeEnum.TRANSPORT);
//到这说明一切符合条件,进行数据库新增
if(userService.save(user) == null){
return Result.error(CodeMsg.TRANSPORT_USE_ADD_ERROR);
operaterLogService.add(“添加运输点,运输点名:” + user.getUsername());
return Result.success(true);
/**
运输点编辑页面
@param model
@return
*/
@RequestMapping(value=”/edit”,method= RequestMethod.GET)
public String edit(Model model, @RequestParam(name=”id”)Long id){
model.addAttribute(“roles”, roleService.findAllByRoleType(UserRoleTypeEnum.TRANSPORT));
model.addAttribute(“user”, userService.find(id));
return “admin/transport/edit”;
/**
编辑运输点信息表单提交处理
@param user
@return
*/
@RequestMapping(value=”/edit”,method= RequestMethod.POST)
@ResponseBody
public Result
//用统一验证实体方法验证是否合法
CodeMsg validate = ValidateEntityUtil.validate(user);
if(validate.getCode() != CodeMsg.SUCCESS.getCode()){
return Result.error(validate);
if(user.getAddress() == null){
return Result.error(CodeMsg.ADDRESS_ERROR);
if(user.getRole() == null || user.getRole().getId() == null){
return Result.error(CodeMsg.TRANSPORT_USER_ROLE_EMPTY);
if(user.getId() == null || user.getId().longValue() <= 0){
return Result.error(CodeMsg.TRANSPORT_USE_NO_EXIST);
if(userService.isExistUsername(user.getUsername(), user.getId())){
return Result.error(CodeMsg.TRANSPORT_USERNAME_EXIST);
//到这说明一切符合条件,进行数据库保存
User findById = userService.find(user.getId());
//讲提交的运输点信息指定字段复制到已存在的user对象中,该方法会覆盖新字段内容
BeanUtils.copyProperties(user, findById, “id”,”createTime”,”updateTime”,”userType”);
if(userService.save(findById) == null){
return Result.error(CodeMsg.TRANSPORT_USE_EDIT_ERROR);
operaterLogService.add(“编辑运输点,运输点名:” + user.getUsername());
return Result.success(true);
/**
删除运输点
@param id
@return
*/
@RequestMapping(value=”/delete”,method= RequestMethod.POST)
@ResponseBody
public Result
try {
userService.delete(id);
} catch (Exception e) {
return Result.error(CodeMsg.TRANSPORT_USE_DELETE_ERROR);
operaterLogService.add(“删除运输点,运输点ID:” + id);
return Result.success(true);
登录控制层:
@RestController
public class LoginController {
@Autowired
AuthenticationManager authenticationManager;
@Autowired
private SysResourceService sysResourceService;
@Autowired
private SysRoleService sysRoleService;
@Autowired
private SysRoleResService sysRoleResService;
@Autowired
private EmployeeService employeeService;
@Autowired
private SysRoleEmpService sysRoleEmpService;
//登录
@PostMapping(value = “/login”)
public User login(@RequestBody Map<String,String> params) {
System.out.println(params.get(“pwd”));
User userInfo = SecurityUtils.login(params.get(“username”), params.get(“password”), authenticationManager);
userInfo.setResources(this.sysResourceService.user_res(userInfo.getId().intValue()));
return userInfo;
@RequestMapping(“user_res”)
public List
try {
// System.out.println(SecurityUtils.getUserInfo());
} catch (Exception e) {
e.printStackTrace();
return null;
//查询所有的角色
@RequestMapping(“selectRoleAll”)
public IPage
return this.sysRoleService.page(page);
//添加角色
@RequestMapping(“addRole”)
public SysRole addRole(@RequestBody SysRole role){
this.sysRoleService.save(role);
return role;
//修改角色
@RequestMapping(“updateRole”)
public SysRole updateRole(@RequestBody SysRole role){
this.sysRoleService.updateById(role);
return role;
//删除角色
@RequestMapping(“delRole”)
public Boolean delRole(int roleid){
return this.sysRoleService.removeById(roleid);
//查询所有的资源
@RequestMapping(“selectRes”)
public List
return this.sysResourceService.resAll();
//查询所分配资源的角色拥有的资源
@RequestMapping(“selectRo_Res”)
public List
return this.sysResourceService.selectRo_Res(roleid);
//修改角色所拥有的资源
@RequestMapping(“updateRoRes”)
public int updateRoRes(@RequestBody ResDto resDto){
this.sysRoleResService.updateRoRe(resDto);
return 1;
//查询当前网点所有用户
@RequestMapping(“findEmpBran”)
public IPage
return this.employeeService.selectEmpByBid(queryDto);
//查询所有的角色,无分页
@RequestMapping(“findRoleAll”)
public List
return this.sysRoleService.list();
//查询所分配角色的用户拥有的角色
@RequestMapping(“selectRo_Emp”)
public List
return this.sysRoleEmpService.selectRoEmp(empid);
//修改所选用户的角色
@RequestMapping(“updateRoEmp”)
public int updateRoEmp(@RequestBody ResDto resDto){
return this.sysRoleEmpService.updateRoRe(resDto);
//逻辑删除员工
@RequestMapping(“delEmp”)
public int delEmp(int empid){
this.employeeService.removeById(empid);
return 1;
班次管理控制层:
@RestController
@RequestMapping(“shift”)
public class ShiftController {
@Autowired
private ShiftService shiftService;
//查询所有班次
@RequestMapping(“findShiftAll”)
public IPage
return this.shiftService.page(page);
// 添加班次
@RequestMapping(“addShift”)
public Shift addShift(@RequestBody Shift shift){
this.shiftService.save(shift);
return shift;
//根据id查询班次
@RequestMapping(“findShiftBid”)
public Shift findShiftBid(int shiftid){
return this.shiftService.getById(shiftid);
//保存修改的班次
@RequestMapping(“updateShift”)
public int updateShift(@RequestBody Shift shift){
this.shiftService.updateById(shift);
return 1;
//删除班次
@RequestMapping(“delShift”)
public int delShift(int shiftid){
this.shiftService.removeById(shiftid);
return 1;
网点管理控制层:
@RestController
@RequestMapping(“/branch”)
public class BranchControllers {
@Autowired
private BranchService branchService;
//父子级别查询网点
@RequestMapping(“findBranch”)
public List
return this.branchService.findBranch();
//查询所有网点
@RequestMapping(“findBranchAll”)
public List
return this.branchService.list();
//根据ID查询网点
@RequestMapping(“findBranchBid”)
public Branch findBranchBid(int bid){
return this.branchService.getById(bid);
//添加网点
@RequestMapping(“addBranch”)
public Branch addBranch(@RequestBody Branch branch){
this.branchService.save(branch);
return branch;
//修改网点
@RequestMapping(“updateBranch”)
public Branch updateBranch(@RequestBody Branch branch){
this.branchService.updateById(branch);
return branch;
@RequestMapping(“findPath”)
public List
return this.branchService.findPath(wid);
——————————PayStart——————————
项目链接:
https://javayms.github.io?id=041125140706201ro
https://javayms.pages.dev?id=041125140706201ro