package com.sunxung.factoring.web.sys;

import java.util.List;

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

import com.sunxung.factoring.dict.impl.LogTypeDict;
import com.sunxung.factoring.entity.sys.Dictionary;
import com.sunxung.factoring.entity.sys.vo.SearchLoginLogVo;
import com.sunxung.factoring.service.sys.DictionaryService;
import com.sunxung.factoring.service.sys.LoginLogService;

/**
 * @className:LoginLogController
 * @description:登录日志controller
 * @author:杜小姣
 * @e-mail:1261237207@qq.com
 * @date:2018年1月23日 下午4:08:06
 */
@Controller
public class LoginLogController {

    private static String PREFIX = "sys/log/";
    @Autowired
    private LoginLogService loginLogService;
    @Autowired
    private DictionaryService dictionaryService;

    @RequestMapping(value = "/loginLog/list")
    public String list(Model model) {
        List<Dictionary> dictList = dictionaryService.findByParentCode(LogTypeDict.CODE);
        model.addAttribute("dictList", dictList);
        return PREFIX + "loginLogList";
    }

    @RequestMapping(value = "/loginLog/do_list", method = RequestMethod.GET)
    @ResponseBody
    public Object do_list(SearchLoginLogVo search) {
        return loginLogService.findBySearch(search);
    }
}
