package com.thinkgem.jeesite.modules.oa.web;


import com.thinkgem.jeesite.common.web.BaseController;
import com.thinkgem.jeesite.modules.oa.entity.Attendance;
import com.thinkgem.jeesite.modules.oa.service.AttendanceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

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

/**
 * 考勤Controller
 *
 * @author mojun
 */
@Controller
@RequestMapping(value = "${adminPath}/oa/attendance")
public class AttendanceController extends BaseController {

    @Autowired
    private AttendanceService attendanceService;


    /**
     * MongoDB测试
     */
    @RequestMapping(value = "mongo", method = RequestMethod.GET)
    public String mongo(HttpServletRequest request, HttpServletResponse response, Model model) {
        attendanceService.getName();
        logger.debug("MongoDB开始");
        return "MongoDB开始";
    }


    @RequestMapping(value = {"list", ""}, method = RequestMethod.GET)
    public String list(Attendance attendance, Model model) {
        insertAtt();
        List<Attendance> list = attendanceService.getAllAttendance(attendance);
        model.addAttribute("list", list);
        return "modules/oa/attendanceList";
    }

    /**
     * 查看跳转
     */
    @RequestMapping(value = "insert")
    public String attendanceUpdate() {
        return "modules/oa/attendanceInsert";
    }

    /**
     * 查看所有考勤
     */
    @RequestMapping(value = "showAll")
    public String showAllAttendance(HttpServletRequest request, HttpServletResponse response, Model model) {

        return "modules/oa/attendanceShowAll";
    }

    /**
     * 添加考勤列表
     */
    @RequestMapping(value = "attendanceSearchList")
    public String attendanceList(Attendance attendance, Model model) {
        List<Attendance> attendanceList = attendanceService.getAttendanceDateList(attendance);
        model.addAttribute("attendanceList", attendanceList);
        return "modules/oa/attendanceUpdate";
    }

    @ModelAttribute("attendance")
    public Attendance getAttendanceModel() {
        return new Attendance();
    }

    /**
     * 提交考勤列表
     */
    @RequestMapping(value = "attendanceInsertList")
    public String attendanceInsert(Attendance attendance, Model model) {

        return "modules/oa/attendanceList";
    }

    /**
     * test insert
     */
    @RequestMapping(value = "insertAtt")
    public void insertAtt() {
        attendanceService.insertAtt();
    }

    /**
     * 根据条件查询
     */
    @RequestMapping(value = "getAttendance")
    public List<Attendance> getAttendance(Attendance attendance) {
        return attendanceService.getAttendance(attendance);
    }

    /**
<<<<<<< HEAD
     * 查询所有
     */
    @RequestMapping(value = "getAllAttendance")
    public List<Attendance> getAllAttendance(Attendance attendance) {
        List<Attendance> list = attendanceService.getAllAttendance(attendance);
        return list;
    }

    /**
     * test delete
     */
    @RequestMapping(value = "delete")
    public void delete() {
        attendanceService.delete();
    }
=======
	 * 根据条件查询
	 */
	@RequestMapping(value = "getAttendance")
	public List<Attendance> getAttendance(Attendance attendance) {
		return attendanceService.getAttendance(attendance);
	}

	/**
	 * 查询所有
	 */
	@RequestMapping(value = "getAllAttendance")
	public List<Attendance> getAllAttendance(Attendance attendance) {
		List<Attendance> list = attendanceService.getAllAttendance(attendance);
		return list;
	}
	
	/**
	 * test delete
	 */
	@RequestMapping(value = "delete")
	public void delete() {
		attendanceService.delete();
	}
	
    /**
     * 查看个人考勤
     */
    @RequestMapping(value = "show")
    public String attendanceShow() {
        return "modules/oa/attendanceShow";
    }
	
>>>>>>> upload attendanceShow.jsp--查看考勤跳转
}
@@ -2992,20 +2992,8 @@
 /**%0A
-%3C%3C%3C%3C%3C%3C%3C HEAD
 %0A   
@@ -3381,538 +3381,8 @@
   %7D%0A
-=======%0A%09 * %E6%A0%B9%E6%8D%AE%E6%9D%A1%E4%BB%B6%E6%9F%A5%E8%AF%A2%0A%09 */%0A%09@RequestMapping(value = %22getAttendance%22)%0A%09public List%3CAttendance%3E getAttendance(Attendance attendance) %7B%0A%09%09return attendanceService.getAttendance(attendance);%0A%09%7D%0A%0A%09/**%0A%09 * %E6%9F%A5%E8%AF%A2%E6%89%80%E6%9C%89%0A%09 */%0A%09@RequestMapping(value = %22getAllAttendance%22)%0A%09public List%3CAttendance%3E getAllAttendance(Attendance attendance) %7B%0A%09%09List%3CAttendance%3E list = attendanceService.getAllAttendance(attendance);%0A%09%09return list;%0A%09%7D%0A%09%0A%09/**%0A%09 * test delete%0A%09 */%0A%09@RequestMapping(value = %22delete%22)%0A%09public void delete() %7B%0A%09%09attendanceService.delete();%0A%09%7D
 %0A%09%0A 
@@ -3539,47 +3539,6 @@
 %7D%0A%09%0A
-%3E%3E%3E%3E%3E%3E%3E upload attendanceShow.jsp--%E6%9F%A5%E7%9C%8B%E8%80%83%E5%8B%A4%E8%B7%B3%E8%BD%AC
 %0A%7D

update AttendanceConteoller.java