基于javaweb+mysql的ssm+maven企业oa管理系统(java+ssm+html+layui+bootstrap+mysql) 运行环境 Java≥8、MySQL≥5.7、Tomca

基于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

/**
 * @program: ssm
 * @Description:
 * @Version: 1.0
 */
@Controller
public class UploadPhotoController {
    @RequestMapping("uploadPhoto.do")
    @ResponseBody
    public Object updateHeadPhoto(@RequestParam(value = "file", required = false) MultipartFile file, HttpServletRequest request, HttpServletResponse response) throws Exception {
        // 文件后缀
        String prefix = "";
        // 时间前缀
        String dateStr = "";
        //保存上传
        OutputStream out = null;
        InputStream fileInput = null;
        // 随机数前缀
        double index = 1000 * (Math.random());
        DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        try {
            if (file != null) {
                String originalName = file.getOriginalFilename();
                prefix = originalName.substring(originalName.lastIndexOf(".") + 1);
                dateStr = format.format(new Date());
                String filepath = request.getServletContext().getRealPath("/img/head/") + dateStr + index + "." + prefix;
                filepath = filepath.replace("\\", "/");
                File files = new File(filepath);
                //打印查看上传路径
                System.out.println(filepath);
                if (!files.getParentFile().exists()) {
                    files.getParentFile().mkdirs();
                }
                file.transferTo(files);
            }
        } catch (Exception e) {
        } finally {
            try {
                if (out != null) {
                    out.close();
                }
                if (fileInput != null) {
        salary2.add(5080.00);
        salary2.add(8080.00);
        salary2.add(20080.00);
        e2.setSalary(salary2);

        EchMonthSalary e3 = new EchMonthSalary();
        List<Double> salary3 = new ArrayList<Double>();
        salary3.add(6000.00);
        salary3.add(8800.00);
        salary3.add(23000.00);
        salary3.add(6000.00);
        salary3.add(8800.00);
        salary3.add(23000.00);
        salary3.add(6000.00);
        salary3.add(8800.00);
        salary3.add(23000.00);
        salary3.add(6000.00);
        salary3.add(8800.00);
        salary3.add(23000.00);
        e3.setSalary(salary3);

        echMonthSalaryList.add(e1);
        echMonthSalaryList.add(e2);
        echMonthSalaryList.add(e3);
        stringListMap.put("list",echMonthSalaryList);
        return stringListMap;*/
        return echartsService.getMonthSalary();
    }

}
package com.esms.controller;

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

    /**
     * 批量删除
     * @param ids
     */
    @RequestMapping("/deleteByQuery.do")
    public void deleteByQuery (@RequestParam(value = "arr")int[] ids) {
        //批量删除,实则修改状态为0
        //如果有id才执行
        if(ids.length > 0) {
            positionService.deleteByQuery(ids);
        }

    }
}
package com.esms.controller;

/**
//        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());
        monthlyAttendancePages.setData(pageResult.getList());
        return monthlyAttendancePages;
    }

    /**
     * 查找一个
     * @param id
     * @return
     */
    @RequestMapping("/selectVoByPrimaryKey.do")
    @ResponseBody
    public MonthlyAttendanceCustomVo selectVoByPrimaryKey(int id) {
        MonthlyAttendanceCustomVo monthlyAttendanceCustomVo = new MonthlyAttendanceCustomVo();
        monthlyAttendanceCustomVo = monthlyAttendanceCustomVoMapper.selectVoByPrimaryKey(id);
//        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,
            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;
    }

}
package com.esms.controller;

        return departmentPages;
    }

    /**
     * 添加部门
     * @param d_name
     * @param d_remark
     * @return
     * @throws Exception
     */
    @RequestMapping("/add.do")
    @ResponseBody
    public int add(String d_name, String d_remark) throws Exception {

        Department department = departmentService.findByDname(d_name);

        //查找是否同名
        if(department != null) {
            return department.getdId();
        } else {
            Department d = new Department();
            d.setdId(null);
            d.setdName(d_name);
            d.setdRemark(d_remark);
            d.setdIsdel(1);
            departmentService.insertSelective(d);
            return 0;
        }
    }

    /**
     * 查找一个部门
     * @param id
     * @return
     * @throws Exception
     */
    @RequestMapping("/findByPrimaryKey.do")
    @ResponseBody
    public Department findByPrimaryKey(int id) throws Exception {
        Department department = departmentService.selectByPrimaryKey(id);
        return department;
    }

    /**
     * 更新部门
     * @param id
     * @param d_name
     * @param d_remark

/**
 * @program: ssm
 * @Description:
 * @Version: 1.0
 */
public class PermissionInterceptor implements HandlerInterceptor {
    @Override
    public boolean preHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o) throws Exception {
//        if (httpServletRequest.getSession().getAttribute("admin") != null){
//            return true;
//        }else{
                httpServletRequest.getRequestDispatcher("/login.do").forward(httpServletRequest, httpServletResponse);
//            httpServletResponse.sendRedirect("/admin.do");
//            return false;
//        }
        return true;
    }

    @Override
    public void postHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, ModelAndView modelAndView) throws Exception {

    }

    @Override
    public void afterCompletion(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e) throws Exception {

    }
}
package com.esms.controller;

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

    @RequestMapping("inforEmployee.do")
    public @ResponseBody EmployeeCustomVo getInforEmployee(HttpSession httpSession){
        Integer id = (Integer) httpSession.getAttribute("employeeId");
        EmployeeCustomVo employeeCustomVo = userInforService.getInforEmployee(id);
        return employeeCustomVo;
    }

    @RequestMapping("updateInforEmployee.do")
    public @ResponseBody String updateInforEmployee(HttpSession httpSession, Employee employee){
        Integer id = (Integer) httpSession.getAttribute("employeeId");
        employee.seteId(id);
        int i = userInforService.updateEmploueeById(id,employee);
        if (i==1){
            return "1";
        }else {
            return "0";
        }
    }

//    @RequestMapping("employeeSalaryList.do")
//    @ResponseBody
//    public EmployeeSalaryVO employeeSalaryList(@RequestParam(name="year",defaultValue = "1") String year,
//                                           HttpSession httpSession){
        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);

        KeyValue kv6=new KeyValue();
        kv6.setKvId(6);
        kv6.setKvKey("full_attendance_pay");
        kv6.setKvValue(full_attendance_pay);
        count+=keyValueService.updateByPrimaryKey(kv6);

        return count;
    }
    @RequestMapping("/get_late_buckle_pay.do")
    public @ResponseBody KeyValue get_late_buckle_pay(){
        KeyValue keyValue=new KeyValue();
        try {
            keyValue=keyValueService.selectBykvKey("late_buckle_pay");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return keyValue;
    }
    @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;
    @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);
            } catch (CustomException e) {
        //保存上传
        OutputStream out = null;
        InputStream fileInput = null;
        // 随机数前缀
        double index = 1000 * (Math.random());
        DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        try {
            if (file != null) {
                String originalName = file.getOriginalFilename();
                prefix = originalName.substring(originalName.lastIndexOf(".") + 1);
                dateStr = format.format(new Date());
                String filepath = request.getServletContext().getRealPath("/img/head/") + dateStr + index + "." + prefix;
                filepath = filepath.replace("\\", "/");
                File files = new File(filepath);
                //打印查看上传路径
                System.out.println(filepath);
                if (!files.getParentFile().exists()) {
                    files.getParentFile().mkdirs();
                }
                file.transferTo(files);
            }
        } catch (Exception e) {
        } finally {
            try {
                if (out != null) {
                    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;
    }
}
package com.esms.utils;


public final class CaptchaUtil
{
    private CaptchaUtil(){}

    /*
     * 随机字符字典
     */
    private static final char[] CHARS = { '2', '3', '4', '5', '6', '7', '8',
            '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));
    }

    /*
     * 返回某颜色的反色
     */
        } else {
            httpServletResponse.sendRedirect("/admin.do");
            return false;
        }
    }

    @Override
    public void postHandle(HttpServletRequest httpServletRequest,
                           HttpServletResponse httpServletResponse,
                           Object o, ModelAndView modelAndView) throws Exception {

    }

    @Override
    public void afterCompletion(HttpServletRequest httpServletRequest,
                                HttpServletResponse httpServletResponse,
                                Object o, Exception e) throws Exception {

    }
}
package com.esms.interceptor;

/**
 * @program: ssm
 * @Description:
 * @Version: 1.0
 */
public class PermissionInterceptor implements HandlerInterceptor {
    @Override
    public boolean preHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o) throws Exception {
//        if (httpServletRequest.getSession().getAttribute("admin") != null){
//            return true;
//        }else{
                httpServletRequest.getRequestDispatcher("/login.do").forward(httpServletRequest, httpServletResponse);
//            httpServletResponse.sendRedirect("/admin.do");
//            return false;
//        }
        return true;
    }

    @Override
    public void postHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, ModelAndView modelAndView) throws Exception {
        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());
        monthlyAttendancePages.setData(pageResult.getList());
        return monthlyAttendancePages;
    }

    /**
     * 查找一个
     * @param id
     * @return
     */
    @RequestMapping("/selectVoByPrimaryKey.do")
    @ResponseBody
    public MonthlyAttendanceCustomVo selectVoByPrimaryKey(int id) {
        MonthlyAttendanceCustomVo monthlyAttendanceCustomVo = new MonthlyAttendanceCustomVo();
        monthlyAttendanceCustomVo = monthlyAttendanceCustomVoMapper.selectVoByPrimaryKey(id);
//        System.out.println(monthlyAttendanceCustomVo+"=======================");
            @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;
    }

    @RequestMapping("/add.do")
    @ResponseBody
    public int add(String eAccount,
                   String eName,
                   String ePassword,
                   String eIdcard,
     */
    @RequestMapping("/deleteByPrimaryKey.do")
    @ResponseBody
    public int deleteByPrimaryKey(int id) throws Exception {

//        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");//设置日期格式
//        Date date = new Date();
//        System.out.println(df.format(new Date()));// new Date()为获取当前系统时间

        //假删除,设置离职时间
        Employee employee = new Employee();
        employee.seteId(id);
        employee.seteLeaveTime(new Date());
        employee.seteIsdel(0);
        employeeService.updateByPrimaryKeySelective(employee);
        return 1;
    }

    /**
     * 批量删除
     * @param ids
     */
    @RequestMapping("/deleteByQuery.do")
    @ResponseBody
    public int deleteByQuery (@RequestParam(value = "arr")int[] ids) {
//        System.out.println(ids+"&"+ids.length);
//        for (int i =0 ; i< ids.length;i++) {
//            System.out.println(ids[i]);
//        }
        //假删除
        //如果有id才执行
        if(ids.length > 0) {
            employeeService.deleteByQuery(ids);
        }
        return 1;

    }


    /**
     * 删除
     * @param id
     * @throws Exception
     */
    @RequestMapping("/deleteByPrimaryKey.do")
    @ResponseBody
    public int deleteByPrimaryKey(int id) throws Exception {

//        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");//设置日期格式
//        Date date = new Date();
//        System.out.println(df.format(new Date()));// new Date()为获取当前系统时间

        //假删除,设置离职时间
        Employee employee = new Employee();
        employee.seteId(id);
        employee.seteLeaveTime(new Date());
        employee.seteIsdel(0);
        employeeService.updateByPrimaryKeySelective(employee);
        return 1;
    }

    /**
     * 批量删除
     * @param ids
     */
    @RequestMapping("/deleteByQuery.do")
    @ResponseBody
    public int deleteByQuery (@RequestParam(value = "arr")int[] ids) {
//        System.out.println(ids+"&"+ids.length);
//        for (int i =0 ; i< ids.length;i++) {
//            System.out.println(ids[i]);
//        }
        //假删除
        //如果有id才执行
        if(ids.length > 0) {
            employeeService.deleteByQuery(ids);
        }
        return 1;

    }

}
package com.esms.controller;

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值