基于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+mysql的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
    }
    /**
     * 跳转到importReissueTable.jsp
     * @return
     */
    @RequestMapping("toImportReissue.do")
    public String toImportReissue(){
        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
                userInforService.updateSystemManagePassword(admin.getSmId(),admin);
                map.put("status","1");
                map.put("msg","密码修改成功");
                return map;
            }else{
                map.put("status","2");
                map.put("msg","原密码错误");
                return map;
            }
        }else{
            map.put("status","0");
            map.put("msg","两次密码不一致");
            return map;
        }
    }
    @RequestMapping("changeEmployeePassword.do")
    @ResponseBody
    public Map<String, String> changeEmployeePassword(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)){
            Integer eid = (Integer) httpSession.getAttribute("employeeId");
            try {
                userInforService.updateEmployeePassword(eid, oldPassword, newPassword1);
                map.put("status","1");
                map.put("msg","密码修改成功");
                return map;
            } catch (CustomException e) {
                map.put("status","2");
                map.put("msg","原密码错误");
                return map;
            }
        }else{
            map.put("status","0");
            map.put("msg","两次密码不一致");
            return map;
        }
    }

        Map<String,List<EchEmployeeNums>> map = new HashMap<String,List<EchEmployeeNums>>();
        EchEmployeeNums e1 = new EchEmployeeNums();
        e1.setDepartment("人事部");
        e1.setNum(123);
        EchEmployeeNums e2 = new EchEmployeeNums();
        e2.setDepartment("行政部");
        e2.setNum(123);
        echEmployeeNumsList.add(e1);
        echEmployeeNumsList.add(e2);
        map.put("list",echEmployeeNumsList);*/
        return echartsService.getEmployeeNums();
    }

    @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>();
        } catch (CustomException e) {
            stringMap.put("msg", e.getMessage());
            return stringMap;
        }
    }

    @RequestMapping("salarySettlementAll.do")
    @ResponseBody
    public Map<String, String> salarySettlementAll(String date) {
        Map<String, String> stringMap = new HashMap<String, String>();
        try {
            salaryService.insertSalaryAllByDate(date);
            stringMap.put("msg", "工资结算完成");
            return stringMap;
        } catch (CustomException e) {
            stringMap.put("msg", e.getMessage());
            return stringMap;
        }
    }

    // 删除工资项目
    @RequestMapping("deleteSalaryByEid.do")
    @ResponseBody
    public int deleteSalaryByEid(@RequestParam(value = "arr")int[] ids) {
        salaryService.deleteSalaryByEid(ids);
        return 1;
    }

    // 发放工资项目
    @RequestMapping("issueSalaryByEid.do")
    @ResponseBody
    public void issueSalaryByEid(@RequestParam(value = "arr")int[] ids) {
        salaryService.updateSalaryBySid(ids);
    }

    @RequestMapping(value = "selectSalaryByEaccountDIdDate.do",
            produces = "application/json;charset=utf-8")
    @ResponseBody
    public String selectSalaryByEaccountDIdDate(@RequestParam(value = "page", defaultValue = "1") int pageNum,
                                                @RequestParam(value = "limit", defaultValue = "5") int limit,
                                                String eAccount, Integer dId, String sTime) {
        /**
         * @Description: 工资查询
        List<MonthlyAttendanceCustomVo> monthlyAttendanceCustomVos =
                monthlyAttendanceCustomVoMapper.selectMonthlyAttendanceCustomVoMapperByeAccountAnddIdAndTime(map);
        return monthlyAttendanceCustomVos;
    }

    /**
     * 查找
     * @param pageNum
     * @param limit
     * @param e_account
     * @param d_id
     * @param attendance_time
     * @return
     * @throws Exception
     */
    @RequestMapping("/findSelective.do")
    @ResponseBody
    public MonthlyAttendancePages 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="d_id", defaultValue="0") int d_id,
            @RequestParam(value="attendance_time", defaultValue="") String attendance_time) throws Exception {
        HashMap<String, Object> map = new HashMap<String, Object>();
        map.put("e_account",e_account);
        map.put("d_id",d_id);
        map.put("attendance_time",attendance_time);
        //pageNum:起始页面  pageSize:每页的大小
        PageHelper.startPage(pageNum,limit);
        //查找条件,一定要紧跟在startPage后
        List<MonthlyAttendanceCustomVo> list =
                monthlyAttendanceCustomVoMapper.selectMonthlyAttendanceCustomVoMapperByeAccountAnddIdAndTime(map);
//        System.out.println(list.get(0).getMonthlyAttendance().getAttendanceTime()+"========================");
        PageInfo pageResult = new PageInfo(list);

        //设置前台需要的数据
        MonthlyAttendancePages monthlyAttendancePages = new MonthlyAttendancePages();
        monthlyAttendancePages.setCode(0);
        monthlyAttendancePages.setMsg("");
        monthlyAttendancePages.setCount((int) pageResult.getTotal());
            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,
                   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();
    @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(){
        KeyValue keyValue=new KeyValue();
        try {
            keyValue=keyValueService.selectBykvKey("full_attendance_pay");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return keyValue;
    }

}
        List<EchEmployeeNums> echEmployeeNumsList = new ArrayList();
        Map<String,List<EchEmployeeNums>> map = new HashMap<String,List<EchEmployeeNums>>();
        EchEmployeeNums e1 = new EchEmployeeNums();
        e1.setDepartment("人事部");
        e1.setNum(123);
        EchEmployeeNums e2 = new EchEmployeeNums();
        e2.setDepartment("行政部");
        e2.setNum(123);
        echEmployeeNumsList.add(e1);
        echEmployeeNumsList.add(e2);
        map.put("list",echEmployeeNumsList);*/
        return echartsService.getEmployeeNums();
    }

    @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>();
        }

    }

    @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);
            '9' };

    /*
     * 随机数
     */
    private static Random random = new Random();

    /*
     * 获取6位随机数
     */
    private static String getRandomString()
    {
        StringBuffer buffer = new StringBuffer();
        for(int i = 0; i < 4; i++)
        {
            buffer.append(CHARS[random.nextInt(CHARS.length)]);
        }
        return buffer.toString();
    }

    /*
     * 获取随机数颜色
     */
    private static Color getRandomColor()
    {
        return new Color(random.nextInt(255),random.nextInt(255),
                random.nextInt(255));
    }

    /*
     * 返回某颜色的反色
     */
    private static Color getReverseColor(Color c)
    {
        return new Color(255 - c.getRed(), 255 - c.getGreen(),255 - c.getBlue());
    }

    public static void outputCaptcha(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException
    {
        response.setContentType("image/jpeg");
        // 获取验证码字符串
        String identifyingCode = getRandomString();
        request.getSession(true).setAttribute("identifyingCode", identifyingCode);

        int width = 100;
        int height = 30;

        Color color = getRandomColor();
        Color reverse = getReverseColor(color);

        BufferedImage bi = new BufferedImage(width, height,
                BufferedImage.TYPE_INT_RGB);
    }
}

/**
 * @program: ssm
 * @Description:
 * @Version: 1.0
 */
@Service
public class DownloadExcelServiceImpl implements IDownloadExcelService{
    @Autowired
    private SalaryMapper salaryMapper;
    @Override
    public void getSalaryExcel(HttpServletRequest request, HttpServletResponse response,String eAccount,Integer dId,String sTime)  throws Exception{
       // response.setCharacterEncoding("utf-8");
        //response.setHeader("Content-Disposition", "text/html; charset=utf-8;attachment; filename=salary.xls");
        String excelName = "工资表.xls";
            //WritableWorkbook writableWorkbook = ExcelUtils.createTemplate(response.getOutputStream());

        WritableWorkbook writableWorkbook = null;
        Map map = new HashMap<String,Object>();
        map.put("eAccount",eAccount);
        map.put("dId",dId);
                   double eBasePay,
                   String ePhone,
                   String eEmail,
                   String eUrgentPerson,
                   String eUrgentPhone,
                   String eHometown,
                   String headPath) throws Exception {

        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
//
//        System.out.println(eAccount);
//        System.out.println(eName);
//        System.out.println(ePassword);
//        System.out.println(eIdcard);
//        System.out.println(rbId);
//        System.out.println(eSex);
//        System.out.println(format.parse(eBirthday));
//        System.out.println(eDagree);
//        System.out.println(dId);
//        System.out.println(pId);
//        System.out.println(format.parse(eEntryTime));
//        System.out.println(eBasePay);
//        System.out.println(ePhone);
//        System.out.println(eEmail);
//        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));
//    测试
    @RequestMapping("/getKeyValueById.do")
    public @ResponseBody String getKeyValueById(Model model, Integer id_id)throws Exception{
        return "error.jsp";
    }
    @RequestMapping("/changeWageItem.do")
    @ResponseBody
    public int changeWageItem(double late_buckle_pay,double early_buckle_pay,double missionallowance,double full_attendance_pay,double food_pay,double traffic_pay)throws Exception{
        /*return late_buckle_pay;*/
        int count=0;

        KeyValue kv1=new KeyValue();
        kv1.setKvKey("food_pay");
        kv1.setKvId(1);
        kv1.setKvValue(food_pay);
        count+=keyValueService.updateByPrimaryKey(kv1);

        KeyValue kv2=new KeyValue();
        kv2.setKvId(2);
        kv2.setKvKey("traffic_pay");
        kv2.setKvValue(traffic_pay);
        count+=keyValueService.updateByPrimaryKey(kv2);

        KeyValue kv3=new KeyValue();
        kv3.setKvId(3);
        kv3.setKvKey("late_buckle_pay");
        kv3.setKvValue(late_buckle_pay);
        count+=keyValueService.updateByPrimaryKey(kv3);

        KeyValue kv4=new KeyValue();
        kv4.setKvId(4);
        kv4.setKvKey("early_buckle_pay");
        kv4.setKvValue(early_buckle_pay);
        count+=keyValueService.updateByPrimaryKey(kv4);

        KeyValue kv5=new KeyValue();
        kv5.setKvId(5);
        kv5.setKvKey("missionallowance");
        kv5.setKvValue(missionallowance);
        count+=keyValueService.updateByPrimaryKey(kv5);

    public String doUpdate(int id,int year,double bonus){
        WorkingYearsBonus workingYearsBonus=service.findByYear(year);
        if(workingYearsBonus!=null&&!workingYearsBonus.getWybId().equals(id))
        {
            return "exist";
        }
        WorkingYearsBonus wyb=new WorkingYearsBonus();
        wyb.setWybId(id);
        wyb.setWybYear(year);
        wyb.setWybBonus(bonus);
        if(service.modifyWorkYearBonus(wyb)==true)
            return "ok";
        else
            return "no";
    }
}

/**
 * @program: ssm
 * @Description:
 * @Version: 1.0
 */
@Controller
public class SalaryController {
    @Autowired
    private SalaryServiceImpl salaryService = null;

    @RequestMapping("salarySettlementByAcount.do")
    @ResponseBody
    public Map<String, String> salarySettlementByAcount(String eAccount, String date) {
        Map<String, String> stringMap = new HashMap<String, String>();

/**
 * @program: ssm
 * @Description:
 * @Version: 1.0
 */
@Service
public class DownloadExcelServiceImpl implements IDownloadExcelService{
    @Autowired
    private SalaryMapper salaryMapper;
    @Override
    public void getSalaryExcel(HttpServletRequest request, HttpServletResponse response,String eAccount,Integer dId,String sTime)  throws Exception{
       // response.setCharacterEncoding("utf-8");
        //response.setHeader("Content-Disposition", "text/html; charset=utf-8;attachment; filename=salary.xls");
        String excelName = "工资表.xls";
            //WritableWorkbook writableWorkbook = ExcelUtils.createTemplate(response.getOutputStream());

        WritableWorkbook writableWorkbook = null;
        Map map = new HashMap<String,Object>();
        map.put("eAccount",eAccount);
        map.put("dId",dId);
        map.put("sTime",sTime);
        List<Salary> salaries = salaryMapper.selectByEaccountDIdDate(map);
        try {
            response.setHeader("Content-Disposition", "attachment;filename=" + new String(excelName.getBytes("gbk"),"ISO-8859-1"));
            writableWorkbook = JXLUtils.createSalaryExcel(response.getOutputStream(),salaries);
            writableWorkbook.write();
            writableWorkbook.close();
        } catch (IOException e) {
            e.printStackTrace();
            throw new CustomException("下载失败");
    }

    @RequestMapping("salarySettlementAll.do")
    @ResponseBody
    public Map<String, String> salarySettlementAll(String date) {
        Map<String, String> stringMap = new HashMap<String, String>();
        try {
            salaryService.insertSalaryAllByDate(date);
            stringMap.put("msg", "工资结算完成");
            return stringMap;
        } catch (CustomException e) {
            stringMap.put("msg", e.getMessage());
            return stringMap;
        }
    }

    // 删除工资项目
    @RequestMapping("deleteSalaryByEid.do")
    @ResponseBody
    public int deleteSalaryByEid(@RequestParam(value = "arr")int[] ids) {
        salaryService.deleteSalaryByEid(ids);
        return 1;
    }

    // 发放工资项目
    @RequestMapping("issueSalaryByEid.do")
    @ResponseBody
    public void issueSalaryByEid(@RequestParam(value = "arr")int[] ids) {
        salaryService.updateSalaryBySid(ids);
    }

    @RequestMapping(value = "selectSalaryByEaccountDIdDate.do",
            produces = "application/json;charset=utf-8")
    @ResponseBody
    public String selectSalaryByEaccountDIdDate(@RequestParam(value = "page", defaultValue = "1") int pageNum,
                                                @RequestParam(value = "limit", defaultValue = "5") int limit,
                                                String eAccount, Integer dId, String sTime) {
        /**
         * @Description: 工资查询
         * @Param: [pageNum , limit, eAccount, dId, sTime]
         * @Return: java.lang.String
         **/
        SalaryPages salaryPages = salaryService.selectSalaryByEaccountDIdDate(pageNum, limit, eAccount, dId, sTime);
        //使用fastjson以字符串形式返回数据
        JSON.DEFFAULT_DATE_FORMAT = "yyyy-MM";
        return JSON.toJSONString(salaryPages, SerializerFeature.WriteDateUseDateFormat);
    }

            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;
        }
    }
}

    @Autowired
    public DepartmentService departmentService = null;

    /**
     * 查找部门
     * @param pageNum
     * @param limit
     * @param d_name
     * @return
     * @throws Exception
     */
    @RequestMapping("/findSelective.do")
    @ResponseBody
    public DepartmentPages findSelective(
            @RequestParam(value="page", defaultValue="1")int pageNum,
            @RequestParam(value="limit", defaultValue="5") int limit,
            @RequestParam(value="d_name", defaultValue="") String d_name) throws Exception {
        List<Department> list;

        //模糊查询,有多少个条件就接收多少个字段

        Department department = new Department();
        department.setdName(d_name);

        //pageNum:起始页面  pageSize:每页的大小
        PageHelper.startPage(pageNum,limit);
        //查找条件,一定要紧跟在startPage后
        list = departmentService.findSelective(department);
        PageInfo pageResult = new PageInfo(list);

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

        return departmentPages;
    }

    /**
     * 添加部门
     * @param d_name
     * @param d_remark
     * @return
     * @throws Exception
     */
    @RequestMapping("/add.do")

请添加图片描述

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值