package com.njcn.serviceimpl.user;

import com.njcn.mapper.user.UserMapper;
import com.njcn.mapper.user.WebInfoMapper;
import com.njcn.pojo.user.WebInfo;
import com.njcn.service.user.WebInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
@Service
public class WebInfoServiceImpl implements WebInfoService {
	@Autowired
	private WebInfoMapper wim;
	@Autowired
	UserMapper um;
	
	@Override
	public List<List> getWebInfo() {
		List<List> lists=new ArrayList<List>();
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		List<WebInfo> list=wim.selectAll();
		if(!list.isEmpty()){
			for(WebInfo webInfo:list){
				List<String> temp=new ArrayList<String>();
				temp.add(webInfo.getWeb_Index());//网站序号
				temp.add(webInfo.getName());//网站名称
				temp.add(webInfo.getDescription());//网站描述
				temp.add(webInfo.getCopyright());//版权
				temp.add(sdf.format(webInfo.getUpdateTime()));//更新时间
				int state=webInfo.getState();
				if(state==1){
					temp.add("正常");
				}else{
					temp.add("删除");
				}
				lists.add(temp);
			}
		}
		return lists;
	}

}
