首页>代码>springboot+mybatis+bootstrap开发员工oa后台管理系统>/jboa/src/main/java/com/example/demo/controller/department/departmentLeaveController.java
package com.example.demo.controller.department;

import com.example.demo.DTO.leaveDTO;
import com.example.demo.DTO.leaveShowDTO;
import com.example.demo.DTO.lodingDTO;
import com.example.demo.dataobjece.Result;
import com.example.demo.service.department.departmentLeaveService;
import com.example.demo.utils.ResultUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * Created by zcp on 2018/7/25.
 */
@Controller
@RequestMapping("departmentLeave")
public class departmentLeaveController {
    @Autowired
    private departmentLeaveService departmentLeaveService;
    @GetMapping("findBySn")
    @ResponseBody
    public Result findBySn(HttpSession httpSession,HttpServletResponse response){
        response.setHeader("Access-Control-Allow-Origin", "*");

        lodingDTO loding =(lodingDTO) httpSession.getAttribute("loding");
/*
        在session中获取当前用户编号
*/
        String sn=loding.getEsn();
        List<leaveDTO> leaveDTOS = departmentLeaveService.deFindLeveaTwo(sn);
    /*    PageHelper.startPage(2,1);
        PageInfo<leaveDTO> pageInfo = new PageInfo<leaveDTO>(leaveDTOS);*/
        if (httpSession.getAttribute("dname").equals("人事部")){
            return ResultUtil.success(leaveDTOS,5);
        }else {
            return ResultUtil.success(leaveDTOS);
        }
    }
    @GetMapping("findBySnByTime/{createTime}/{endTime}")
    @ResponseBody
    public Result findBySnByTime(@PathVariable("createTime")String createTime,@PathVariable("endTime")String endTime,HttpSession httpSession,HttpServletResponse response){
        response.setHeader("Access-Control-Allow-Origin", "*");

        lodingDTO loding =(lodingDTO) httpSession.getAttribute("loding");
        /*在session中获取当前用户编号*/
        String sn=loding.getEsn();
        List<leaveDTO> leaveDTOS = departmentLeaveService.deFindLeveaBytime(sn,createTime,endTime);
        return ResultUtil.success(leaveDTOS);
    }
    @GetMapping("findBySnByEvent/{EVENT}")
    @ResponseBody
    public Result findBySnByEvent(@PathVariable("EVENT")String EVENT,HttpSession httpSession,HttpServletResponse response){
        response.setHeader("Access-Control-Allow-Origin", "*");

        lodingDTO loding =(lodingDTO) httpSession.getAttribute("loding");
        /*在session中获取当前用户编号*/
        String sn=loding.getEsn();
        List<leaveDTO> leaveDTOS = departmentLeaveService.deFindLeveaByStatus(sn,EVENT);
        return ResultUtil.success(leaveDTOS);
    }
    @GetMapping("findBySnByEventAndTime/{EVENT}/{createTime}/{endTime}")
    @ResponseBody
    public Result findBySnByEventAndTime(@PathVariable("createTime")String createTime,@PathVariable("endTime")String endTime,@PathVariable("EVENT")String EVENT,HttpSession httpSession,HttpServletResponse response){
        response.setHeader("Access-Control-Allow-Origin", "*");

        lodingDTO loding =(lodingDTO) httpSession.getAttribute("loding");
        /*在session中获取当前用户编号*/
        if (EVENT.equals("1")){
            EVENT="";
        }
        String sn=loding.getEsn();
        List<leaveDTO> leaveDTOS = departmentLeaveService.deFindLeveaByStatusAndtime(sn,EVENT,createTime,endTime);
        return ResultUtil.success(leaveDTOS);
    }


    /**
     * 查看请假单详情
     * @PathVariable id
     * @return
     */
    @GetMapping("deFindLeveaShow/{id}")
    @ResponseBody
    public Result deFindLeveaShow(@PathVariable("id") Integer id,HttpSession httpSession,HttpServletResponse response){
        response.setHeader("Access-Control-Allow-Origin", "*");

        leaveShowDTO leaveShow = departmentLeaveService.deFindLeveaShow(id);
        return ResultUtil.success(leaveShow);
    }

    /**
     * 修改请假单
     * @param id
     * @param status
     * @param approveOpinion
     * @return
     */
    @PostMapping("updateLevea/{id}/{status}/{approveOpinion}")
    @ResponseBody
    public Result updateLevea(@PathVariable("id") Integer id,@PathVariable("status") String status,@PathVariable("approveOpinion") String approveOpinion,HttpServletResponse response){
        response.setHeader("Access-Control-Allow-Origin", "*");

        int accotion = departmentLeaveService.accotion(id, status, approveOpinion);
        return ResultUtil.success();
    }
}
最近下载更多
zhy1989wz  LV7 2023年7月31日
gy_010203  LV2 2023年4月23日
唐唐丶  LV34 2023年3月28日
可是不知道么  LV23 2023年1月3日
呵呵哈哈哈  LV10 2022年9月1日
java萌新sc  LV4 2022年8月8日
crazyAndy  LV7 2022年6月27日
一杯美式  LV5 2022年6月16日
寒江雪2017  LV10 2022年6月8日
local80  LV2 2022年6月8日
最近浏览更多
叉烧君  LV3 3月26日
xiaohuaidan455  LV2 2月17日
lvyga1  LV2 2024年12月20日
gxh666857  LV1 2024年11月27日
微信网友_7044194812350464  LV8 2024年9月13日
Impeter  LV2 2024年8月13日
校园网  LV9 2024年8月4日
hellopei 2024年6月26日
暂无贡献等级
qwe6002  LV10 2024年5月24日
zhaoming200677  LV13 2024年5月3日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友