/**
 * Company Name : 中贸促信息技术有限责任公司
 * Project Name:project
 * File Name:LogInfoController.java
 * Package Name:ccpit.base.logManage
 * Date:2015年10月19日上午10:23:09
 * Copyright (c) 2015, dingwei@ccpit.org All Rights Reserved.
 *
*/

package org.ccpit.base.logManage;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import net.sf.json.JSONArray;

import org.ccpit.base.controller.BaseController;
import org.ccpit.base.controller.Page;
import org.ccpit.base.controller.PageRequest;
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 org.springframework.web.servlet.ModelAndView;

/**
 * ClassName:LogInfoController <br/>
 * Function: TODO 日志管理 controller. <br/>
 * Reason:	 TODO ADD REASON. <br/>
 * Date:     2015年10月19日 上午10:23:09 <br/>
 * @author   dingwei
 * @version  
 * @since    JDK 1.6
 * @see 	 
 */
@Controller
@RequestMapping("/admin/logManage")
public class LogInfoController extends BaseController {

	@Autowired
	private LogInfoService logInfoService;
	
	/*
	 * 进入议题组管理列表界面(英文)
	 */
	@RequestMapping("/goinLogInfoListPage")
	public Object goinTopicWorkTeamListPage_en() {
		ModelAndView mv = new ModelAndView("admin/logManage/logInfoListPage");
		return mv;
	}
	
	@RequestMapping("/getAllLogInfos")
    @ResponseBody
    public Object getAllLogInfos(HttpServletRequest request){
        PageRequest pageRequest = getPage(request);
        Page<LogInfo> pageRole = logInfoService.queryLinkInfos(pageRequest);
        return logInfoService.convert(pageRole);
    }

	public void addLogInfo(LogInfo logInfo) {
		boolean b = logInfoService.addLogInfo(logInfo);
	}

	
	
	/**
	 * 根据id删除
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping("/deleteTopicWorkTeamById")
	@ResponseBody
	public Object deleteTopicWorkTeamById(HttpServletRequest request){
		Map result = new HashMap();
		String jsonIds = request.getParameter("ids");
		JSONArray jsonArray = JSONArray.fromObject(jsonIds);
		Object[] ids = jsonArray.toArray();
		boolean flag = false;
		for(Object workTopicTeamId : ids){
			flag = logInfoService.delLogInfoById(Integer.valueOf((Integer) workTopicTeamId));
		}
		result.put("flag", flag);
		return result;
	}
}

