基于javaweb+mysql的ssm+maven企业oa管理系统(java+ssm+html+layui+bootstrap+mysql)

基于javaweb+mysql的ssm+maven企业oa管理系统(java+ssm+html+layui+bootstrap+mysql)

私信源码获取及调试交流

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

基于javaweb的SSM+Maven企业oa管理系统(java+ssm+html+layui+bootstrap+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版本; 6.是否Maven项目:是;

技术栈

  1. 后端:Spring+SpringMVC+Mybatis 2. 前端:HTML+CSS+JavaScript+LayUI+jquery+bootstrap

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中dbconfig.properties配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入localhost:8080/ssm_esms_oa 登录 注:tomcat中需配置路径为/ssm_esms_oa,否则会有异常 管理员账号/密码:admin/admin 用户账号/密码:18080833/123456
         * json格式{"list":[{"year":"1","salary":[480,500,600,..]},{"year":"2","salary":[480,500,600...]}]}
         */
/*
        List<EchDepartmentSalary> echDepartmentSalaryList = new ArrayList<EchDepartmentSalary>();
        Map<String,List<EchDepartmentSalary>> stringListMap = new HashMap<String, List<EchDepartmentSalary>>();

        EchDepartmentSalary e1 = new EchDepartmentSalary();
        e1.setDepartment("人事部");
        List<Double> salary1 = new ArrayList<Double>();
        salary1.add(5000.00);
        salary1.add(8000.00);
        salary1.add(20000.00);
        e1.setSalary(salary1);

        EchDepartmentSalary e2 = new EchDepartmentSalary();
        e2.setDepartment("科研部");
        List<Double> salary2 = new ArrayList<Double>();
        salary2.add(6000.00);
        salary2.add(8500.00);
        salary2.add(25000.00);
        e2.setSalary(salary2);

        EchDepartmentSalary e3 = new EchDepartmentSalary();
        e3.setDepartment("策划部");
        List<Double> salary3 = new ArrayList<Double>();
        salary3.add(6000.00);
        salary3.add(8800.00);
        salary3.add(23000.00);
        e3.setSalary(salary3);

        echDepartmentSalaryList.add(e1);
        echDepartmentSalaryList.add(e2);
        echDepartmentSalaryList.add(e3);
        stringListMap.put("list",echDepartmentSalaryList);
        return stringListMap;*/
        return echartsService.getDepartmentSalary(date);
    }

    @RequestMapping(value = "/showSalaryPercent.do")
    @ResponseBody
    public Map<String,List<EchSalaryPercent>> showSalaryPercent(String date,int state){
        /*List<EchSalaryPercent> echSalaryPercentList = new ArrayList<EchSalaryPercent>();
        Map<String,List<EchSalaryPercent>> map = new HashMap<String,List<EchSalaryPercent>>();
        EchSalaryPercent s1 = new EchSalaryPercent();
        EchSalaryPercent s2 = new EchSalaryPercent();
        s1.setDepartment("人事部");
    public EmployeePages findSelective(
            @RequestParam(value="page", defaultValue="1")int pageNum,
            @RequestParam(value="limit", defaultValue="5") int limit,
            @RequestParam(value="e_account", defaultValue="") String e_account,
            @RequestParam(value="e_name", defaultValue="") String e_name,
            @RequestParam(value="d_id", defaultValue="0") int d_id) throws Exception {
        HashMap<String, Object> map = new HashMap<String, Object>();
        map.put("e_account",e_account);
        map.put("e_name",e_name);
        map.put("d_id",d_id);
        //pageNum:起始页面  pageSize:每页的大小
        PageHelper.startPage(pageNum,limit);
        //查找条件,一定要紧跟在startPage后
        List<EmployeeCustomVo> list =
                employeeCustomVoMapper.selectEmployeeSelective(map);
//        System.out.println(list.get(0).getMonthlyAttendance().getAttendanceTime()+"========================");
        PageInfo pageResult = new PageInfo(list);

        //设置前台需要的数据
        EmployeePages employeePages = new EmployeePages();
        employeePages.setCode(0);
        employeePages.setMsg("");
        employeePages.setCount((int) pageResult.getTotal());
        employeePages.setData(pageResult.getList());
        return employeePages;
    }

    /**
     * 查找一个
     * @param id
     * @return
     */
    @RequestMapping("/selectVoByPrimaryKey.do")
    @ResponseBody
    public EmployeeCustomVo selectVoByPrimaryKey(int id) {
        EmployeeCustomVo monthlyAttendanceCustomVo = new EmployeeCustomVo();
        monthlyAttendanceCustomVo = employeeCustomVoMapper.selectVoByPrimaryKey(id);
//        System.out.println(monthlyAttendanceCustomVo+"=======================");
        return monthlyAttendanceCustomVo;
    }
        //ModelAndView modelAndView = new ModelAndView();
       // modelAndView.setViewName("admin/rank-list.jsp");
         // modelAndView.addObject("pageInfo",page);
        model.addAttribute("pageInfo", page);
        return "admin/rank-list.jsp";
    }

    @RequestMapping("/findRankBonusList.do")
    @ResponseBody
    public RankBonusPages findSelective(
            @RequestParam(value="page", defaultValue="1")int pageNum,
            @RequestParam(value="limit", defaultValue="10") int limit,
            @RequestParam(value="rb_name", defaultValue="") String rb_name) throws Exception {
        /*return rb_name;*/
        List<RankBonus> list;
        //模糊查询,有多少个条件就接收多少个字段
        RankBonus rb = new RankBonus();
        rb.setRankName(rb_name);
        //pageNum:起始页面  pageSize:每页的大小
        PageHelper.startPage(pageNum,limit);
        //查找条件,一定要紧跟在startPage后
        list = service.findSelective(rb);
        PageInfo pageResult = new PageInfo(list);

        //设置前台需要的数据
        RankBonusPages rankBonusPages = new RankBonusPages();
        rankBonusPages.setCode(0);
        rankBonusPages.setMsg("");
        rankBonusPages.setCount((int) pageResult.getTotal());
        rankBonusPages.setData(pageResult.getList());
        return rankBonusPages;
    }

    //根据id删除数据
    @RequestMapping("rankBonusDelete.do")
    @ResponseBody
    public String doDelete(int id){
        if(service.CountByRbid(id)>0){
            return "exist";
        }
        if(service.moveRankBonus(id)==true)
            return "ok";
        else{
            return "no";}
    }
    //更新记录
    @RequestMapping("/updateRankBonus.do")
    @ResponseBody
    public String doUpdate(int id,String  rank,int bonus){
    @RequestMapping("/get_food_pay.do")
    public @ResponseBody KeyValue get_food_pay(){
        KeyValue keyValue=new KeyValue();
        try {
            keyValue=keyValueService.selectBykvKey("food_pay");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return keyValue;
    }
    @RequestMapping("/get_traffic_pay.do")
    public @ResponseBody KeyValue get_traffic_pay(){
        KeyValue keyValue=new KeyValue();
        try {
            keyValue=keyValueService.selectBykvKey("traffic_pay");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return keyValue;
    }
    @RequestMapping("/get_early_buckle_pay.do")
    public @ResponseBody KeyValue get_early_buckle_pay(){
        KeyValue keyValue=new KeyValue();
        try {
            keyValue=keyValueService.selectBykvKey("early_buckle_pay");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return keyValue;
    }
    @RequestMapping("/get_missionallowance.do")
    public @ResponseBody KeyValue get_missionallowance(){
        KeyValue keyValue=new KeyValue();
        try {
            keyValue=keyValueService.selectBykvKey("missionallowance");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return keyValue;
    }
    @RequestMapping("/get_full_attendance_pay.do")
    public @ResponseBody KeyValue get_full_attendance_pay(){
    @RequestMapping(value = "/showDepartmentSalary.do")
    @ResponseBody
    public Map<String,List<EchDepartmentSalary>> showDepartmentSalary(String date){
        /**
         *各年月工资对比图的数据
         * json格式{"list":[{"year":"1","salary":[480,500,600,..]},{"year":"2","salary":[480,500,600...]}]}
         */
/*
        List<EchDepartmentSalary> echDepartmentSalaryList = new ArrayList<EchDepartmentSalary>();
        Map<String,List<EchDepartmentSalary>> stringListMap = new HashMap<String, List<EchDepartmentSalary>>();

        EchDepartmentSalary e1 = new EchDepartmentSalary();
        e1.setDepartment("人事部");
        List<Double> salary1 = new ArrayList<Double>();
        salary1.add(5000.00);
        salary1.add(8000.00);
        salary1.add(20000.00);
        e1.setSalary(salary1);

        EchDepartmentSalary e2 = new EchDepartmentSalary();
        e2.setDepartment("科研部");
        List<Double> salary2 = new ArrayList<Double>();
        salary2.add(6000.00);
        salary2.add(8500.00);
        salary2.add(25000.00);
        e2.setSalary(salary2);

        EchDepartmentSalary e3 = new EchDepartmentSalary();
        e3.setDepartment("策划部");
        List<Double> salary3 = new ArrayList<Double>();
        salary3.add(6000.00);
        salary3.add(8800.00);
        salary3.add(23000.00);
        e3.setSalary(salary3);

        echDepartmentSalaryList.add(e1);
        echDepartmentSalaryList.add(e2);
        echDepartmentSalaryList.add(e3);
        stringListMap.put("list",echDepartmentSalaryList);
        return stringListMap;*/
        return echartsService.getDepartmentSalary(date);
    }

//        System.out.println(monthlyAttendanceCustomVo+"=======================");
        return monthlyAttendanceCustomVo;
    }

    /**
     * 更新
     * @param maId
     * @param sickLeaveNum
     * @param compassionateLeaveNum
     * @param overtimeHour
     * @param weekendHour
     * @param holidayHour
     * @param lateNum
     * @param earlyNum
     * @param absenceNum
     * @param businessTravelNum
     * @return
     * @throws Exception
     */
    @RequestMapping("/updateByPrimaryKeySelective.do")
    @ResponseBody
    public int updateByPrimaryKeySelective(int maId,
                                  int sickLeaveNum,
                                  int compassionateLeaveNum,
                                  double overtimeHour,
                                  double weekendHour,
                                  double holidayHour,
                                  int lateNum,
                                  int earlyNum,
                                  int absenceNum,
                                  int businessTravelNum
                                  ) throws Exception {
        MonthlyAttendance monthlyAttendance = new MonthlyAttendance();
        monthlyAttendance.setMaId(maId);
        monthlyAttendance.setSickLeaveNum(sickLeaveNum);
        monthlyAttendance.setCompassionateLeaveNum(compassionateLeaveNum);
        monthlyAttendance.setOvertimeHour(overtimeHour);
        monthlyAttendance.setWeekendHour(weekendHour);
        monthlyAttendance.setHolidayHour(holidayHour);
        monthlyAttendance.setLateNum(lateNum);
        monthlyAttendance.setEarlyNum(earlyNum);
        monthlyAttendance.setAbsenceNum(absenceNum);
            @RequestParam(value="e_name", defaultValue="") String e_name,
            @RequestParam(value="d_id", defaultValue="0") int d_id) throws Exception {
        HashMap<String, Object> map = new HashMap<String, Object>();
        map.put("e_account",e_account);
        map.put("e_name",e_name);
        map.put("d_id",d_id);
        //pageNum:起始页面  pageSize:每页的大小
        PageHelper.startPage(pageNum,limit);
        //查找条件,一定要紧跟在startPage后
        List<EmployeeCustomVo> list =
                employeeCustomVoMapper.selectEmployeeSelective(map);
//        System.out.println(list.get(0).getMonthlyAttendance().getAttendanceTime()+"========================");
        PageInfo pageResult = new PageInfo(list);

        //设置前台需要的数据
        EmployeePages employeePages = new EmployeePages();
        employeePages.setCode(0);
        employeePages.setMsg("");
        employeePages.setCount((int) pageResult.getTotal());
        employeePages.setData(pageResult.getList());
        return employeePages;
    }

    /**
     * 查找一个
     * @param id
     * @return
     */
    @RequestMapping("/selectVoByPrimaryKey.do")
    @ResponseBody
    public EmployeeCustomVo selectVoByPrimaryKey(int id) {
        EmployeeCustomVo monthlyAttendanceCustomVo = new EmployeeCustomVo();
        monthlyAttendanceCustomVo = employeeCustomVoMapper.selectVoByPrimaryKey(id);
//        System.out.println(monthlyAttendanceCustomVo+"=======================");
        return monthlyAttendanceCustomVo;
    }

    @RequestMapping("/add.do")
    @ResponseBody
    public int add(String eAccount,
                   String eName,
                   String ePassword,
                   String eIdcard,
                   int rbId,
                   String eSex,
                   String eBirthday,
                   String eDagree,
                   int dId,
                   int pId,
                   String eEntryTime,
        return "admin/importData/importReissueTable.jsp";
    }

    /**
     *上传月出勤表
     * @param excel 考勤表文件
     * @return
     */
    @RequestMapping("/importAttendance.do")
    @ResponseBody
    public Map<String,String> importAttendanceTable(@RequestParam("file") MultipartFile excel) throws Exception{
        Map<String,String> map = new HashMap<String, String>();
        if (!excel.isEmpty()) {
            String result = importDataService.insertMATable(excel);
            map.put("result",result);
            return map;
            /*if (importDataService.insertMATable(excel)) {
                //return "admin/importData/success.jsp";
                map.put("result","导入成功");
                return map;
            }
            else{
                map.put("result","只能导入Microsoft Excel 97-2003 工作表 (.xls),请检查文件是否正确");
                return map;
            }*/
        } else {
            map.put("result","导入的文件不存在,请重新选择文件");
            return map;
        }
    }

    /**
     *
     * @param excel 补发金额表excel
     * @return
     */
    @RequestMapping("/importReissue.do")
    @ResponseBody
    public Map<String,String> importReissueTable(@RequestParam("file") MultipartFile excel) throws Exception{
        Map<String,String> map = new HashMap<String, String>();
        if (!excel.isEmpty()) {
            String result = importDataService.insertReissueTable(excel);
            map.put("result",result);
            return map;
        }
        else {
            map.put("result","导入的文件不存在,请重新选择文件");
            return map;
        }
    }
}

                employee = loginService.findEmployeeByIdAndPassword(username, password);
            } catch (CustomException e) {
                map.put("msg",e.getMessage());
                map.put("status","500");
                return map;
            }
            // 保存到session
            httpSession.setAttribute("employeeId",employee.geteId());
            map.put("url","/ssm_esms_oa/loginSuccess.do");
            map.put("msg","成功");
            map.put("status","200");
            return map;
        }else{
            map.put("msg","验证码错误");
            map.put("status","0");
            return map;
        }
    }

    @RequestMapping(value = "/loginSuccess.do")
    public String loginSucceses(Model model) throws Exception
    {
        return "employee/index.html";
    }

    @RequestMapping(value = "/adminLogin.do")
    @ResponseBody
    public Map<String,String> adminLogin(Model model, HttpSession httpSession, String username,
                                            String password, String identifyingcode)
    {
        String code = (String) httpSession.getAttribute("identifyingCode");
        HashMap<String, String> map = new HashMap<String, String>();
        if(identifyingcode.equalsIgnoreCase(code)){
            SystemManager manager = null;
            try {
                 manager = loginService.findSystemManagerByIdAndPassword(username, password);
            } catch (CustomException e) {
                map.put("msg",e.getMessage());
                map.put("status","500");
                return map;
            }
            // 保存到session
            httpSession.setAttribute("admin",manager);
            map.put("url","toPage.do?url=admin/index.html");
            map.put("msg","成功");
            map.put("status","200");
            return map;
        }else{
            map.put("msg","验证码错误");
            map.put("status","0");
            return map;
        }
//        System.out.println(eUrgentPerson);
//        System.out.println(eUrgentPhone);
//        System.out.println(eHometown);

        //检测工号是否相同
        //查找是否同名
        Employee e = employeeService.findByeAccount(eAccount);
        if(e != null) {
            return 0;
        } else {
            Employee employee = new Employee();
            employee.seteAccount(eAccount);
            employee.seteName(eName);
            employee.setePassword(MD5Utils.encodeByMD5(ePassword));
            employee.seteIdcard(eIdcard);
            employee.seteRank(rbId);
            employee.seteSex(eSex);
            employee.seteBirthday(format.parse(eBirthday));
            employee.seteDagree(eDagree);
            employee.setdId(dId);
            employee.setpId(pId);
            employee.seteEntryTime(format.parse(eEntryTime));
            employee.seteBasePay(eBasePay);
            employee.setePhone(ePhone);
            employee.seteEmail(eEmail);
            employee.seteUrgentPerson(eUrgentPerson);
            employee.seteUrgentPhone(eUrgentPhone);
            employee.seteHometown(eHometown);
            employee.seteHeadPath(headPath);
            employee.seteIsdel(1);
            employeeService.insert(employee);
            return 1;
        }

    }

    @RequestMapping("/updateByPrimaryKeySelective.do")
    @ResponseBody
    public int updateByPrimaryKeySelective(
                   int eId,
                   String eName,
                   String eIdcard,
                   int rbId,
                   String eSex,
                   String eBirthday,
                   String eDagree,
                   String eDagree,
                   int dId,
                   int pId,
                   String eEntryTime,
                   double eBasePay,
                   String ePhone,
                   String eEmail,
                   String eUrgentPerson,
                   String eUrgentPhone,
                   String eHometown,
                   String headPath) throws Exception {
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");

        Employee employee = new Employee();
        employee.seteId(eId);
        employee.seteName(eName);
        employee.seteIdcard(eIdcard);
        employee.seteRank(rbId);
        employee.seteSex(eSex);
        employee.seteBirthday(format.parse(eBirthday));
        employee.seteDagree(eDagree);
        employee.setdId(dId);
        employee.setpId(pId);
        employee.seteEntryTime(format.parse(eEntryTime));
        employee.seteBasePay(eBasePay);
        employee.setePhone(ePhone);
        employee.seteEmail(eEmail);
        employee.seteUrgentPerson(eUrgentPerson);
        employee.seteUrgentPhone(eUrgentPhone);
        employee.seteHometown(eHometown);
        employee.seteHeadPath(headPath);
        employee.seteIsdel(1);
        employeeService.updateByPrimaryKeySelective(employee);
        return 1;

    }

    /**
     * 删除
     * @param id
     * @throws Exception
     */
            return map;
            /*if (importDataService.insertMATable(excel)) {
                //return "admin/importData/success.jsp";
                map.put("result","导入成功");
                return map;
            }
            else{
                map.put("result","只能导入Microsoft Excel 97-2003 工作表 (.xls),请检查文件是否正确");
                return map;
            }*/
        } else {
            map.put("result","导入的文件不存在,请重新选择文件");
            return map;
        }
    }

    /**
     *
     * @param excel 补发金额表excel
     * @return
     */
    @RequestMapping("/importReissue.do")
    @ResponseBody
    public Map<String,String> importReissueTable(@RequestParam("file") MultipartFile excel) throws Exception{
        Map<String,String> map = new HashMap<String, String>();
        if (!excel.isEmpty()) {
            String result = importDataService.insertReissueTable(excel);
            map.put("result",result);
            return map;
        }
        else {
            map.put("result","导入的文件不存在,请重新选择文件");
            return map;
        }
    }
}


    @RequestMapping("/updateByPrimaryKeySelective.do")
    @ResponseBody
    public int updateByPrimaryKeySelective(
                   int eId,
                   String eName,
                   String eIdcard,
                   int rbId,
                   String eSex,
                   String eBirthday,
                   String eDagree,
                   int dId,
                   int pId,
                   String eEntryTime,
                   double eBasePay,
                   String ePhone,
                   String eEmail,
                   String eUrgentPerson,
                   String eUrgentPhone,
                   String eHometown,
                   String headPath) throws Exception {
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");

        Employee employee = new Employee();
        employee.seteId(eId);
        employee.seteName(eName);
        employee.seteIdcard(eIdcard);
        employee.seteRank(rbId);
        employee.seteSex(eSex);
        employee.seteBirthday(format.parse(eBirthday));
        employee.seteDagree(eDagree);
        employee.setdId(dId);
        employee.setpId(pId);
        employee.seteEntryTime(format.parse(eEntryTime));
        employee.seteBasePay(eBasePay);
        employee.setePhone(ePhone);
        employee.seteEmail(eEmail);
        employee.seteUrgentPerson(eUrgentPerson);
        employee.seteUrgentPhone(eUrgentPhone);
        employee.seteHometown(eHometown);
        employee.seteHeadPath(headPath);
        employee.seteIsdel(1);
        employeeService.updateByPrimaryKeySelective(employee);
        return 1;

    }

    /**
                    out.close();
                }
                if (fileInput != null) {
                    fileInput.close();
                }
            } catch (IOException e) {
            }
        }
        Map<String, Object> map2 = new HashMap<String, Object>();
        Map<String, Object> map = new HashMap<String, Object>();
        // 返回上传后的图片地址 img/head/……jpg
        map2.put("src", "/ssm_esms_oa/img/head/" + dateStr + index + "." + prefix);
        map.put("code", 0);
        map.put("msg", "");
        map.put("data", map2);
        return map;
    }
}

public final class CaptchaUtil
{
    private CaptchaUtil(){}

    /*
     * 随机字符字典
     */
    private static final char[] CHARS = { '2', '3', '4', '5', '6', '7', '8',
            '9' };

    /*
     * 随机数
//        });

    }

}

/**
 * 
 */
@Controller
@RequestMapping("/position")
public class PositionController {
    @Autowired
    public PositionService positionService = null;

    /**
     *
     * @param pageNum
     * @param limit
     * @param p_name
     * @return
     * @throws Exception
     */
    @RequestMapping("findSelective.do")
    @ResponseBody

/**
 * @program: ssm
 * @Description:
 * @Version: 1.0
 */
@Controller
public class UserInforController {
    @Autowired
    private UserInforServiceImpl userInforService = null;

    @RequestMapping("changePassword.do")
    @ResponseBody
    public Map<String, String> changePassword(String oldPassword, String newPassword1,
                                              String newPassword2, HttpSession httpSession){
        System.out.println(oldPassword+" "+newPassword1+" "+newPassword2);
        HashMap<String, String> map = new HashMap<String, String>();
        if (newPassword1.equals(newPassword2)){
            SystemManager admin = (SystemManager) httpSession.getAttribute("admin");
            String encodeByMD5 = MD5Utils.encodeByMD5(oldPassword);
            if (encodeByMD5.equals(admin.getSmPassword())){
                String newPassword = MD5Utils.encodeByMD5(newPassword1);
                admin.setSmPassword(newPassword);
                userInforService.updateSystemManagePassword(admin.getSmId(),admin);
                map.put("status","1");
                map.put("msg","密码修改成功");
                return map;
            }else{
                map.put("status","2");
        // 在查询之前只需要调用,传入页码,以及每页的大小
        int pageSize = 10;
        PageHelper.startPage(pn, pageSize);
        // startPage后面紧跟的这个查询就是一个分页查询
        List<RankBonus> rbs = service.findAll();
        System.out.println(rbs+"=================================");
        /*for (RankBonus rb:rbs) {
         System.out.println(rb.getRankName());
        }*/
        // 使用pageInfo包装查询后的结果,只需要将pageInfo交给页面就行了。
        // 封装了详细的分页信息,包括有我们查询出来的数据,传入连续显示的页数
        PageInfo page = new PageInfo(rbs, 5);
        //ModelAndView modelAndView = new ModelAndView();
       // modelAndView.setViewName("admin/rank-list.jsp");
         // modelAndView.addObject("pageInfo",page);
        model.addAttribute("pageInfo", page);
        return "admin/rank-list.jsp";
    }

    @RequestMapping("/findRankBonusList.do")
    @ResponseBody
    public RankBonusPages findSelective(
            @RequestParam(value="page", defaultValue="1")int pageNum,
            @RequestParam(value="limit", defaultValue="10") int limit,
            @RequestParam(value="rb_name", defaultValue="") String rb_name) throws Exception {
        /*return rb_name;*/
        List<RankBonus> list;
        //模糊查询,有多少个条件就接收多少个字段
        RankBonus rb = new RankBonus();
        rb.setRankName(rb_name);
        //pageNum:起始页面  pageSize:每页的大小
        PageHelper.startPage(pageNum,limit);
        //查找条件,一定要紧跟在startPage后
        list = service.findSelective(rb);
        PageInfo pageResult = new PageInfo(list);

        //设置前台需要的数据
        RankBonusPages rankBonusPages = new RankBonusPages();
        rankBonusPages.setCode(0);
        rankBonusPages.setMsg("");
        rankBonusPages.setCount((int) pageResult.getTotal());
        rankBonusPages.setData(pageResult.getList());
        return rankBonusPages;
    }

    //根据id删除数据
    @RequestMapping("rankBonusDelete.do")
    @ResponseBody
    public String doDelete(int id){
        if(service.CountByRbid(id)>0){
            return "exist";
        }
        if(service.moveRankBonus(id)==true)
 * @Description: 管理员和员工登陆控制
 **/
@Controller
public class LoginController {
    @Autowired
    private LoginServiceImpl loginService = null;
    /**
     * @Description:
     * @Param: [request, response]
     * @Return: void
     **/
    @RequestMapping(value = "/changeCode.do")
    @ResponseBody
    public void getIdentifyingCode(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException
    {
        // 验证码存储在session的identifyingCode,属性中
        CaptchaUtil.outputCaptcha(request, response);
    }

    // 获取员工登陆界面
    @RequestMapping("/")
    public String getLoginPage(){
        return "employee/login.html";
    }

    // 获取管理员登陆界面
    @RequestMapping("/admin.do")
    public String getAdminLoginPage(){
        return "admin/adminLogin.html";
    }

    @RequestMapping(value = "/employeeLogin.do")
    @ResponseBody
    public Map<String,String> employeeLogin(Model model, HttpSession httpSession, String username,
                             String password, String identifyingcode)
    {
        String code = (String) httpSession.getAttribute("identifyingCode");
        HashMap<String, String> map = new HashMap<String, String>();
        if(identifyingcode.equalsIgnoreCase(code)){
            Employee employee = null;
            try {
                employee = loginService.findEmployeeByIdAndPassword(username, password);

请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述

  • 9
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值