基于javaweb+mysql的ssm冷链运输管理系统(java+ssm+thymeleaf+html+mysql)
私信源码获取及调试交流
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb的SSM冷链运输管理系统(java+ssm+thymeleaf+html+mysql)
一、项目运行
1.运行环境
环境配置:
Jdk1.8 + Tomcat8.5 + mysql + Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)
项目技术:
HTML +Spring+ SpringMVC + MyBatis + ThymeLeaf + JavaScript + JQuery + Ajax + Maven+ MYSQL数据库等等
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
5.是否Maven项目: 否;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目
6.数据库:MySql 5.7、8.0等版本均可;
技术栈
-
后端:Spring+springmvc+mybatis
-
前端:ThymeLeaf+HTML+javascript+jQuery
使用说明
-
使用Navicat或者其它工具,在mysql中创建对应sql文件名称的数据库,并导入项目的sql文件;
-
使用IDEA/Eclipse/MyEclipse导入项目,配置tomcat;
-
将项目中db.properties配置文件中的数据库配置改为自己的配置;
-
运行项目,在浏览器中输入地址:http://localhost:8080/项目名称
if (roleIds.length == 1) {
int res = roleService.deleteByPrimaryKey(roleIds[0]);
if (res == 1) {
map.put("status", "true");
map.put("info", "删除成功!");
return map;
map.put("status", "false");
map.put("info", "删除失败!角色已经不存在");
return map;
//批量删除
int success = 0;
int total = roleIds.length;
Customer customer = customerService.selectByPrimaryKey(customerId);
m.addAttribute("customer", customer);
return "customer/edit";
@ResponseBody
@RequestMapping("/update")
@RequiresPermissions("customer:update")
public Boolean update(Customer customer) {
int res = customerService.updateByPrimaryKeySelective(customer);
if (res == 1) {
return true;
@RequestMapping("/getCustomers")
@RequiresPermissions("customer:list")
public PageInfo<CustomerView> getCustomers(String keyWord,
@RequestParam(defaultValue = "1") Integer pageNum,
@RequestParam(defaultValue = "10") Integer pageSize) {
//开始分页,这里启动并设置页码,和每页结果数量后,后续结果会自动为分页后结果
PageHelper.startPage(pageNum, pageSize);
CustomerViewExample customerViewExample = new CustomerViewExample();
CustomerViewExample.Criteria criteria = customerViewExample.createCriteria();
/**
* StringUtils.isNotBlank 可以判断 ""/" "/null 为 false
*/
if (StringUtils.isNotBlank(keyWord)) {
return map;
map.put("status", "false");
map.put("info", "删除失败!角色已经不存在");
return map;
//批量删除
int success = 0;
int total = roleIds.length;
for(Long roleId : roleIds) {
success += roleService.deleteByPrimaryKey(roleId);
map.put("status", "true");
map.put("info", "成功删除选中 " + total + " 个角色中的 " + success + " 个角色");
return map;
@RequestMapping("/add")
map.put("info", "删除失败!角色已经不存在");
return map;
//批量删除
int success = 0;
int total = roleIds.length;
for(Long roleId : roleIds) {
success += roleService.deleteByPrimaryKey(roleId);
map.put("status", "true");
map.put("info", "成功删除选中 " + total + " 个角色中的 " + success + " 个角色");
return map;
@RequestMapping("/add")
@RequiresPermissions("role:insert")
return false;
return true;
@RequestMapping("/edit")
@RequiresPermissions("role:update")
public String edit(Model m, Long roleId) {
m.addAttribute("role", roleService.selectByPrimaryKey(roleId));
return "role/edit";
@ResponseBody
@RequestMapping("/update")
@RequiresPermissions("role:update")
int res = customerService.deleteByPrimaryKey(customerIds[0]);
if (res == 1) {
map.put("status", "true");
map.put("info", "删除成功!");
return map;
map.put("status", "false");
map.put("info", "删除失败!客户已经不存在");
return map;
//批量删除
int success = 0;
@RequestMapping("/update")
@RequiresPermissions("admin:update")
public Boolean update(User user) {
if (StringUtils.isBlank(user.getPassword())) {
user.setPassword(null);
} else {
String salt = UUID.randomUUID().toString().substring(0, 4);
String hashedPassword = new SimpleHash("md5", user.getPassword(), salt, 3).toString();
user.setPassword(hashedPassword);
user.setSalt(salt);
int res = userService.updateByPrimaryKeySelective(user);
* @param pageSize 每个页面用户容量,默认为 10/页
* @return
*/
@ResponseBody
@RequestMapping("/getAdmins")
@RequiresPermissions("admin:list")
public PageInfo<User> getAdmins(String keyWord,
@RequestParam(defaultValue = "1") Integer pageNum,
@RequestParam(defaultValue = "10") Integer pageSize) {
//开始分页,这里启动并设置页码,和每页结果数量后,后续结果会自动为分页后结果
@RequiresPermissions("admin:insert")
@RequestMapping("/add")
public String addAdmin(Model m) {
RoleExample roleExample = new RoleExample();
List<Role> roles = roleService.selectByExample(roleExample);
m.addAttribute("roles", roles);
return "admin/add";
@ResponseBody
@RequestMapping("/checkUsername")
@RequiresPermissions("admin:list")
public Boolean checkUsername(String username) {
UserExample userExample = new UserExample();
UserExample.Criteria criteria = userExample.createCriteria();
@RequiresPermissions("admin:update")
public String edit(Model m, Long userId) {
m.addAttribute("user", userService.selectByPrimaryKey(userId));
m.addAttribute("roles", roleService.selectByExample(new RoleExample()));
return "admin/edit";
@ResponseBody
@RequestMapping("/update")
@RequiresPermissions("admin:update")
public Boolean update(User user) {
if (StringUtils.isBlank(user.getPassword())) {
user.setPassword(null);
CustomerViewExample.Criteria criteria = customerViewExample.createCriteria();
/**
* StringUtils.isNotBlank 可以判断 ""/" "/null 为 false
*/
if (StringUtils.isNotBlank(keyWord)) {
//权限名条件
criteria.andCustomerNameLike("%" + keyWord + "%");
//判断当前登录用户是否为业务员,业务员只能查看自己的客户
Subject subject = SecurityUtils.getSubject();
User user = (User) subject.getPrincipal();
m.addAttribute("users", users);
return "customer/add";
@ResponseBody
@RequestMapping("/insert")
@RequiresPermissions("customer:insert")
public Boolean insert(Customer customer){
int res = customerService.insert(customer);
if (res == 1) {
return true;
return false;
@RequestMapping("/edit")
@RequiresPermissions("customer:update")
public String edit(Model m, Long customerId) {
*/
if (StringUtils.isNotBlank(keyWord)) {
//权限名条件
criteria.andCustomerNameLike("%" + keyWord + "%");
//判断当前登录用户是否为业务员,业务员只能查看自己的客户
Subject subject = SecurityUtils.getSubject();
User user = (User) subject.getPrincipal();
if (user.getRoleId() == ConstantDataField.SALESMAN_ROLE_ID) {
//客户的业务员id等于登录用户的id
criteria.andUserIdEqualTo(user.getUserId());
List<CustomerView> customers = customerViewService.selectByExample(customerViewExample);
//获得分页对象
PageInfo<CustomerView> pageInfo = new PageInfo<>(customers);
return pageInfo;
@ResponseBody
@RequestMapping("/delete")
@RequiresPermissions("customer:delete")
public Map<String, String> delete(Long[] customerIds) {
HashMap<String, String> map = new HashMap<>();
if (customerIds.length == 1) {
int res = customerService.deleteByPrimaryKey(customerIds[0]);
if (res == 1) {
map.put("status", "true");
map.put("info", "删除成功!");
return map;
User user = (User) subject.getPrincipal();
//如果是业务员进行操作,只能选择自己作为业务员
List<User> users = new ArrayList<>();
if (user.getRoleId() == ConstantDataField.SALESMAN_ROLE_ID) {
users.add(user);
} else {
UserExample userExample = new UserExample();
userExample.createCriteria().andRoleIdEqualTo(ConstantDataField.SALESMAN_ROLE_ID);
users = userService.selectByExample(userExample);
m.addAttribute("users", users);
map.put("status", "false");
map.put("info", "删除失败!角色已经不存在");
return map;
//批量删除
int success = 0;
int total = roleIds.length;
for(Long roleId : roleIds) {
success += roleService.deleteByPrimaryKey(roleId);
map.put("status", "true");
map.put("info", "成功删除选中 " + total + " 个角色中的 " + success + " 个角色");
return map;
User user = (User) subject.getPrincipal();
if (user.getRoleId() == ConstantDataField.SALESMAN_ROLE_ID) {
//客户的业务员id等于登录用户的id
criteria.andUserIdEqualTo(user.getUserId());
List<CustomerView> customers = customerViewService.selectByExample(customerViewExample);
//获得分页对象
PageInfo<CustomerView> pageInfo = new PageInfo<>(customers);
return pageInfo;
@ResponseBody
@RequestMapping("/delete")
@RequiresPermissions("customer:delete")
public Map<String, String> delete(Long[] customerIds) {