Java项目:SSM服装出租服装店租赁服装管理系统

Source

作者主页:源码空间站2022

 简介:Java领域优质创作者、Java项目、学习资料、技术互助

文末获取源码

项目介绍

本项目为后台管理系统;
管理员角色包含以下功能:
管理员登录,用户管理,公告管理,服装类型管理,服装信息管理,客户信息管理,服装出租管理,服装归还管理,查询租还记录,修改个人信息,修改密码等功能。

由于本程序规模不大,可供课程设计,毕业设计学习演示之用

环境需要

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版本;

技术栈

1. 后端:Spring SpringMVC MyBatis

2. 前端:JSP+bootstrap+jQuery

使用说明

1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;

2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;

若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;

3. 将项目中db.properties配置文件中的数据库配置改为自己的配置;
4. 运行项目,输入localhost:8080/

管理员账号/密码:admin/admin

运行截图

代码相关

用户管理控制器

@Controller
@RequestMapping(value = "user/admin", method = {RequestMethod.POST})
public class AdminController {

    @Autowired
    AdminService adminService;

    /**
     * 登录Controller
     * @param request HttpServletRequest 对象
     * @param username 用户名
     * @param password 密码
     * @return Map 返回相关状态
     * @throws Exception 异常
     */
    @RequestMapping(value = "login")
    public @ResponseBody
    Map<String, String> login(HttpServletRequest request, @RequestParam(value = "username", defaultValue = "") String username,
                              @RequestParam(value = "password", defaultValue = "") String password) throws Exception {
        Admin admin = adminService.loginCheck(username, password);
        Map<String, String> resultMap =new HashMap<String, String>();
        if (admin != null) {
            request.getSession().setAttribute("userid", admin.getUid());
            request.getSession().setAttribute("username", admin.getUsername());
            request.getSession().setAttribute("identity", "admin");
            resultMap.put("state", "success");
        } else {
            resultMap.put("state", "fail");
            resultMap.put("reason", ErrorInfoUtil.getErrorInfo("user.login.check.null"));
        }
        return resultMap;
    }

    /**
     * 获取管理员总量
     * @return Map 返回相关状态及信息
     * @throws Exception 异常
     */
    @RequestMapping(value = "getAdminCount")
    public @ResponseBody
    Map<String, Object> getAdminCount() throws Exception {
        int count = adminService.count();
        Map<String, Object> result = new HashMap<String, Object>();
        if (count > 0) {
            result.put("state", "success");
            result.put("result", count);
        } else {
            result.put("state", "fail");
            result.put("reason", 0);
        }
        return result;
    }

    /**
     * 获取指定数量的管理员信息
     * @param offset 偏移量
     * @param limit 限制返回条数
     * @return Map 返回相关状态及信息
     * @throws Exception 异常
     */
    @RequestMapping(value = "getLimitAdmin")
    public @ResponseBody
    Map<String, Object> getLimitAdmin(@RequestParam(value = "offset") int offset,
                                     @RequestParam(value = "limit") int limit) throws Exception {
        List<Admin> adminList = adminService.getLimitAdmin(offset, limit);
        Map<String, Object> result = new HashMap<String, Object>();
        if (adminList.size() > 0) {
            result.put("state", "success");
            result.put("result", adminList);
        } else {
            result.put("state", "fail");
            result.put("reason", null);
        }
        return result;
    }

    /**
     * 根据管理员ID更新管理员信息
     * @param admin 新的管理员信息
     * @return Map 返回相关状态及信息
     * @throws Exception 异常
     */
    @RequestMapping(value = "updateAdminById")
    public @ResponseBody
    Map<String, Object> updateAdminById(@RequestBody Admin admin) throws Exception {
        int updateCount = adminService.updateById(admin);
        Map<String, Object> result = new HashMap<String, Object>();
        if (updateCount > 0) {
            result.put("state", "success");
            result.put("result", updateCount);
        } else {
            result.put("state", "fail");
            result.put("reason", 0);
        }
        return result;
    }

    /**
     * 根据管理员ID数组删除一些管理员信息
     * @param adminIds 管理员ID数组
     * @return Map 返回相关状态及信息
     * @throws Exception 异常
     */
    @RequestMapping(value = "deleteSomeAdmin")
    public @ResponseBody
    Map<String, Object> deleteSomeAdmin(@RequestParam(value = "adminIds[]") String[] adminIds) throws Exception {
        int deleteNum = adminService.deleteSomeAdmin(adminIds);
        Map<String, Object> result = new HashMap<String, Object>();
        if (deleteNum > 0) {
            result.put("state", "success");
            result.put("result", deleteNum);
        } else {
            result.put("state", "fail");
            result.put("reason", null);
        }
        return result;
    }

    /**
     * 添加管理员
     * @param admin 用户信息
     * @return Map 返回相关状态及信息
     * @throws Exception 异常
     */
    @RequestMapping(value = "addAdmin")
    public @ResponseBody
    Map<String, Object> addAdmin(@RequestBody Admin admin) throws Exception {
        int addCount = adminService.addAdmin(admin);
        Map<String, Object> result = new HashMap<String, Object>();
        if (addCount > 0) {
            result.put("state", "success");
            result.put("result", addCount);
        } else {
            result.put("state", "fail");
            result.put("reason", 0);
        }
        return result;
    }

    /**
     * 根据管理员ID更新用户密码
     * @param uid 管理员ID
     * @param originalPasswd 原密码
     * @param newPasswd 新密码
     * @return Map 返回相关状态及信息
     * @throws Exception 异常
     */
    @RequestMapping(value = "updateAdminPasswdById")
    public @ResponseBody
    Map<String, Object> updateAdminPasswdById(@RequestParam(value = "uid", defaultValue = "") String uid,
                                             @RequestParam(value = "originalPasswd", defaultValue = "") String originalPasswd,
                                             @RequestParam(value = "newPasswd", defaultValue = "") String newPasswd) throws Exception {
        int updateCount = adminService.updatePasswdById(uid, originalPasswd, newPasswd);
        Map<String, Object> result = new HashMap<String, Object>();
        if (updateCount > 0) {
            result.put("state", "success");
            result.put("result", updateCount);
        } else {
            result.put("state", "fail");
            result.put("reason", 0);
        }
        return result;
    }

}

如果也想学习本系统,下面领取。回复:220ssm