首页>代码>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  LV6 2023年7月31日
gy_010203  LV2 2023年4月23日
唐唐丶  LV33 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  LV9 2022年6月8日
local80  LV2 2022年6月8日
最近浏览更多
一个小学码  LV4 4月16日
zolscy  LV12 4月1日
m5433661  LV2 3月28日
jay1992  LV14 3月16日
itxiaobai 1月18日
暂无贡献等级
lvllvl  LV4 1月17日
wwvvvzz 1月9日
暂无贡献等级
admin_z  LV22 2023年12月26日
WBelong  LV7 2023年12月26日
pangzhihui  LV12 2023年12月25日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友