package com.sunxung.factoring.web.sys.workingDayManage;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.sunxung.factoring.entity.sys.workingDayManage.WorkingDayManage;
import com.sunxung.factoring.service.sys.workingDayManage.WorkingDayManageService;

/**
 * @description:工作日管理Controller
 * @author:吴端丽
 * @e-mail:1912942707@qq.com
 * @date:2018年5月31日 上午10:32:44
 */
@Controller
public class WorkingDayManageController {

    private final String PREFIX = "sys/workingDayManage/";
    @Autowired
    private WorkingDayManageService workingDayManageService;

    @RequestMapping("/workingDayManage/list")
    public String list() {
        return PREFIX + "workingDayManageList";
    }

    /**
     * 根据yyyy-MM-dd格式年月日获取对应月的所有数据. <br/>
     * 
     * @param yearMonth
     * @return
     */
    @RequestMapping("/workingDayManage/do_list")
    @ResponseBody
    public Object do_list(String yearMonth) {
        return workingDayManageService.findByMonth(yearMonth);
    }

    @RequestMapping("/workingDayManage/update")
    @ResponseBody
    public Object update(Long id) {
        return workingDayManageService.get(id);
    }

    /**
     * 修改工作日. <br/>
     * 
     * @param workingDay
     * @return
     */
    @RequestMapping("/workingDayManage/do_update")
    @ResponseBody
    public Object do_update(WorkingDayManage workingDay) {
        return workingDayManageService.update(workingDay);
    }

    @RequestMapping("/workingDayManage/do_delete")
    @ResponseBody
    public Object do_delete(Long id) {
        return workingDayManageService.delete(id);
    }

    /**
     * 获取最大年份. <br/>
     * 
     * @return
     */
    @RequestMapping("/workingDayManage/do_getMaxYear")
    @ResponseBody
    public Object do_getMaxYear() {
        return workingDayManageService.getMaxYear();
    }
}
