基于javaweb+mysql的ssm企业官方平台(java+ssm+html+javascript+jsp+mysql)
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SSM企业官方平台(java+ssm+html+javascript+jsp+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.数据库:MySql 5.7版本;
技术栈
- 后端:Spring+SpringMVC+Mybatis 2. 前端:HTML+CSS+JavaScript+jsp
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中application.yml配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入localhost:8080/ 登录
@Autowired
IRoleService iRoleService;
@Autowired
IPermissionService iPermissionService;
/**
* @描述 页面跳转
*/
@RequestMapping("/tolist")
@RequiresPermissions("role:list")
public String tolist()
return result(iUserService.insertSelective(user));
/**
* @描述 批量删除
*/
@RequestMapping("/del")
@RequiresPermissions("user:del")
@Operlog(modal = "用户模块", descr = "删除用户")
@ResponseBody
public AjaxResult delByUserIds(String[] ids)
try
int i = iUserService.deleteByPrimaryKeys(ids);
@Operlog(modal = "用户管理", descr = "修改用户信息")
@ResponseBody
public AjaxResult save(User user)
if (StringUtils.isNotNull(user.getUid()) && User.isBoss(user.getUid()))
return error("不允许修改管理员用户");
if(user.getPwd()!=null){
user.setSalt(ShiroUtils.randomSalt());
SimpleHash md5 = new SimpleHash("MD5", user.getPwd(), user.getSalt(), 1024);
user.setPwd(md5.toHex());
return result(iUserService.updateByPrimaryKeySelective(user));
/**
* @描述 添加用户页面
@RequiresPermissions("role:del")
@Operlog(modal = "角色管理",descr = "删除角色")
@ResponseBody
public AjaxResult del(Integer[] ids)
try
iRoleService.deleteByPrimaryKeys(ids);
catch (Exception e)
return error(e.getMessage());
return success();
/**
* @描述 添加保存
/**
* 校验名称唯一
*/
@PostMapping("/checkRoleNameUnique")
@ResponseBody
public String checkDeptNameUnique(Role role)
String uniqueFlag = "0";
if (role != null)
uniqueFlag = iRoleService.checkRoleNameUnique(role);
return uniqueFlag;
登录管理控制层:
@RequestMapping("/oa")
public class LoginController extends BaseController{
user.setPwd(md5.toHex());
user.setUid(getUserId());
int i = iUserService.updateByPrimaryKeySelective(user);
if (i > 0)
//更新shiro中的信息
ShiroUtils.reloadUser(iUserService.selectByPrimaryKey(getUserId()));
return success();
return error();
/**
* 编辑用户头像修改
*/
@RequestMapping("/updateAvatar")
public String toupdateAvatar(Model model)
* @描述 添加用户页面
*/
@RequestMapping("/toAdd")
@RequiresPermissions("user:add")
public String toaddUser(Model model)
Map<String, Object> role_post_dept = getRole_Post_Dept();
model.addAttribute("depts", role_post_dept.get("dept"));
model.addAttribute("roles", role_post_dept.get("role"));
model.addAttribute("positions", role_post_dept.get("position"));
String uniqueFlag = "0";
if (user != null)
uniqueFlag = iUserService.checkLoginNameUnique(user);
return uniqueFlag;
public Map<String, Object> getRole_Post_Dept()
Map<String, Object> map = new HashMap<>();
// 角色
List<Role> roles = iRoleService.selectRoleList(new Role());
// 部门信息
List<Dept> depts = iDeptService.selectDeptList(new Dept());
// 岗位
@ResponseBody
public AjaxResult save(Role role)
int i = 0;
try
i = iRoleService.updateByPrimaryKeySelective(role);
catch (Exception e)
return error(e.getMessage());
return result(i);
/**
* @描述 修改角色权限信息保存
public AjaxResult delByUserIds(String[] ids)
try
int i = iUserService.deleteByPrimaryKeys(ids);
catch (Exception e)
return error(e.getMessage());
return success();
/**
* @描述 编辑密码修改页面
*/
@RequestMapping("/resetPwd/{userId}")
model.addAttribute("depts", role_post_dept.get("dept"));
model.addAttribute("roles", role_post_dept.get("role"));
model.addAttribute("positions", role_post_dept.get("position"));
model.addAttribute("user", user);
return prefix + "edit";
/**
* @描述 保存用户
*/
@PostMapping("/editSave")
@RequiresPermissions("user:update")
@Operlog(modal = "用户管理", descr = "修改用户信息")
@ResponseBody
IUserService iUserService;
@Autowired
IRoleService iRoleService;
@Autowired
IDeptService iDeptService;
@Autowired
IPositionService iPositionService;
@Autowired
private SysPasswordService passwordService;
/**
* @描述 跳转到用户页面
uniqueFlag = iUserService.checkLoginNameUnique(user);
return uniqueFlag;
public Map<String, Object> getRole_Post_Dept()
Map<String, Object> map = new HashMap<>();
// 角色
List<Role> roles = iRoleService.selectRoleList(new Role());
// 部门信息
List<Dept> depts = iDeptService.selectDeptList(new Dept());
// 岗位
List<Position> positions = iPositionService.selectPositionList(new Position());
map.put("role", roles);
map.put("dept", depts);
map.put("position", positions);
@RequestMapping("/tolist")
@RequiresPermissions("user:list")
public String toUserList()
return prefix + "user";
/**
* @描述 用户数据
*/
@RequestMapping("/tableList")
@ResponseBody
public TableDataInfo list(User user)
startPage();
@RequiresPermissions("role:update")
@Operlog(modal = "角色管理",descr = "修改角色权限")
@ResponseBody
public AjaxResult editPowerSave(Role role, Integer[] ids)
int i = 0;
try
if (StringUtils.isEmpty(ids))
ids = new Integer[0];
i = iRoleService.updateByPrimaryKeyPowerSelective(role, ids);
catch (Exception e)
return error(e.getMessage());
*/
@PostMapping("/checkLoginNameUnique")
@ResponseBody
public String checkLoginNameUnique(User user)
String uniqueFlag = "0";
if (user != null)
uniqueFlag = iUserService.checkLoginNameUnique(user);
return uniqueFlag;
public Map<String, Object> getRole_Post_Dept()
@RequiresPermissions("role:update")
public String editPower(@PathVariable("id") Integer id, Model model)
Role role = iRoleService.selectByPrimaryKey(id);
model.addAttribute("Role", role);
return prefix + "editPower";
/**
* @描述 修改角色信息保存
*/
@RequestMapping("/editSave")
@RequiresPermissions("role:update")
@Operlog(modal = "角色管理",descr = "修改角色信息")
@ResponseBody
public AjaxResult save(Role role)