首页>代码>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();
    }
}
最近下载更多
crazyAndy  LV5 6月27日
一杯美式  LV5 6月16日
寒江雪2017  LV6 6月8日
local80  LV2 6月8日
cx123123  LV7 5月18日
叶柯宸  LV3 5月5日
三角阀  LV3 4月2日
最呆萌呀  LV7 3月20日
ewan007  LV24 3月10日
wanglinddad  LV51 3月1日
最近浏览更多
mengfanyun  LV9 昨天
taoshen95  LV7 昨天
asdqwdasdqwwd  LV2 昨天
楚天霸  LV1 6月29日
18435345155  LV4 6月28日
D907917690  LV1 6月25日
蛇蛇皮怪  LV14 6月23日
李问禅 6月20日
暂无贡献等级
w1572312120 6月19日
暂无贡献等级
吴兵彦 6月17日
暂无贡献等级
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友