设计需求
1 设计要求
物流基本信息管理系统总体功能需求包括登录管理、商品管理、运输管理、业务管理、用户管理、系统管理、等。本系统根据用户的类型不同分为两类:普通用户和超级管理员。在系统中,要求对不同的用户设置不同的权限,超级管理员可以进行商品管理,运输管理,业务管理,用户管理,系统管理。普通用户只能进行商品管理和系统管理功能。现将系统为用户提供的服务总结如下:
(1)超级管理员:运输管理可以对物流运输信息进行添加,删除,修改,查询。当要选择添加商品的时候可以对商品进行添加,对不满意的商品进行删除,修改,还可以进行商品查询。业务管理可以对进行业务查询,将每个商品的所有的信息展示出来,并且当业务信息过多的时候可以根据业务号进行查询业务。用户管理可以对用户信息进行添加,删除,修改,查询。系统管理可以进行修改密码,并且退出该系统,需要重新登录,退出功能可以安全退出该系统。
(2)普通用户:可以进行商品管理,对商品信息进行添加,删除,修改,删除,用户管理可以对当前用户进行密码修改,并且有退出系统功能
系统功能结构
dao层代码
package com.wlxy.logistics.dao;
import com.wlxy.logistics.pojo.Transportation;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface BusinessMapper {
public List<Transportation> getAllBusiness();
public List<Transportation> searchBusiness(@Param("yno") String yno,@Param("goodsName") String goodsName);
}
package com.wlxy.logistics.dao;
import com.wlxy.logistics.pojo.Goods;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface GoodsMapper {
List<Goods> getAllGoods();
int addGoods(Goods goods);
int modifyGoods(Goods goods);
int deleteGoods(Goods goods);
Goods getGoodsByGno(Goods goods);
List<String> getAllYno();
List<Goods> searchGoods(@Param("goodsName") String goodsName,@Param("goodsType") String goodsType);
}
package com.wlxy.logistics.dao;
import com.wlxy.logistics.pojo.Transportation;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface TransportationMapper {
int addTransportation(Transportation transportation);
int deleteTransportation(Transportation transportation);
int updateTransportation(Transportation transportation);
List<Transportation> getAllTransportation();
Transportation getTransportationByYno(Transportation transportation);
List<Transportation> searchTransportation(@Param("yno") String yno, @Param("receiptCity") String receiptCity);
}
package com.wlxy.logistics.dao;
import com.wlxy.logistics.pojo.Transportation;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface TransportationMapper {
int addTransportation(Transportation transportation);
int deleteTransportation(Transportation transportation);
int updateTransportation(Transportation transportation);
List<Transportation> getAllTransportation();
Transportation getTransportationByYno(Transportation transportation);
List<Transportation> searchTransportation(@Param("yno") String yno, @Param("receiptCity") String receiptCity);
}
package com.wlxy.logistics.controller;
import com.wlxy.logistics.pojo.User;
import com.wlxy.logistics.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpSession;
import java.util.List;
@Controller
public class UserController {
@Autowired
private UserService userService;
@RequestMapping("/login")
public String login(User user, HttpSession session) {
System.out.println(user);
User login = userService.login(user);
session.setAttribute("user", login);
System.out.println(login + "--------------------------");
if (login != null) {
//不同用户根据id跳入不同界面
Integer role = login.getRoleId();
//在index.jsp文件中判断
session.setAttribute("role", role);
return "redirect:/index";
}
return null;
}
/**
* 修改密码功能
*
* @return
*/
@PostMapping("/update/password")
public String updatePassword(Model model, String oldPassword, String newPassword, HttpSession session) {
User user = (User) session.getAttribute("user");
String password = user.getPassword();
//当用户输入的密码和之前登录的密码保持不一致的时候
if (!password .equals(oldPassword) ) {
model.addAttribute("error", "输入的旧密码错误,请重新输入密码");
return "changepwd";
}else {
user.setPassword(newPassword);
boolean flag = userService.updatePassword(user);
//修改成功后该用户信息要在session中删除
if (flag) {
session.invalidate();
}
System.out.println(session.getAttribute("user"));
return "redirect:/";
}
}
/**
* 退出功能
*
* @return
*/
@RequestMapping("/exit")
public String exit(HttpSession session) {
session.invalidate();
return "redirect:/";
}
@RequestMapping("/user/getAllUser")
public String getAllUserInfo(Model model) {
List<User> userList = userService.getAllUserInfo();
model.addAttribute("userList", userList);
return "user_list";
}
@RequestMapping("/user/{id}")
public String getUserById(@PathVariable("id") Integer id, Model model) {
User user = new User();
user.setId(id);
User userById = userService.getUserById(user);
model.addAttribute("userById", userById);
return "user_modify";
}
@ResponseBody
@RequestMapping("/update")
public String updateUserInfo(User user) {
User userById = userService.getUserById(user);
userById.setUsername(user.getUsername());
userById.setGender(user.getGender());
userById.setEmail(user.getEmail());
userById.setTelephone(user.getTelephone());
boolean flag = userService.updateUser(userById);
if (flag) {
return "修改成功";
}else {
return "修改失败";
}
}
@ResponseBody
@RequestMapping("/user1/{id}")
public String deleteUser(@PathVariable("id") Integer id) {
User user = new User();
user.setId(id);
boolean flag = userService.deleteUser(user);
if (flag) {
return "删除成功";
}else {
return "删除失败";
}
}
@ResponseBody
@RequestMapping("/user/add")
public String addUser(User user) {
boolean flag = userService.addUser(user);
if (flag) {
return "添加成功";
}else {
return "添加失败";
}
}
@RequestMapping("/user/search")
public String searchUser(String username, String telephone, Model model) {
List<User> userList = userService.searchUser(username, telephone);
model.addAttribute("userList", userList);
return "user_list";
}
}
部分功能截图
v:18771627417