package com.jinhetech.yogurt.sbgl.controller;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.annotation.Resource;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.authz.annotation.RequiresRoles;
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 org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import org.springframework.web.servlet.view.RedirectView;
import com.jinhetech.yogurt.dictionary.crop.service.impl.CropServiceImpl;
import com.jinhetech.yogurt.func.entity.Func;
import com.jinhetech.yogurt.func.service.FuncService;
import com.jinhetech.yogurt.menu.entity.Menu;
import com.jinhetech.yogurt.menu.service.MenuService;
import com.jinhetech.yogurt.menu.util.MenuUtil;
import com.jinhetech.yogurt.organization.entity.OrgTable;
import com.jinhetech.yogurt.organization.service.OrgService;
import com.jinhetech.yogurt.organization.util.OrgUtil;
import com.jinhetech.yogurt.role.entity.Role;
import com.jinhetech.yogurt.role.service.RoleService;
import com.jinhetech.yogurt.sbgl.dao.SbglDao;
import com.jinhetech.yogurt.sbgl.entity.Sbgl;
import com.jinhetech.yogurt.sbgl.service.SbglService;
import com.jinhetech.yogurt.sbgl.util.SbglUtil;
import com.jinhetech.yogurt.user.entity.User;
import com.jinhetech.yogurt.user.entity.UserInfo;
import com.jinhetech.yogurt.user.service.UserService;
import com.jinhetech.yogurt.user.util.UserUtil;
import com.jinhetech.yogurt.util.base.BaseController;
import com.jinhetech.yogurt.util.base.Constants;
import com.jinhetech.yogurt.util.common.TextUtils;
import com.jinhetech.yogurt.util.common.UUIDHexGenerator;/**
* 系统用户管理控制类
*
* @author Wang Hao
* @version 1.0 2014-02-28 初版*/@Controller("sbglController")
@RequestMapping("/sbgl")public classSbglController extends BaseController {//@Resource(name = "sbglDao")//private SbglDao sbglDao;
@Resource(name= "sbglService")privateSbglService sbglService;/**
* 平台权限管理导航*/@RequestMapping("/home_list")publicModelAndView home() {return new ModelAndView("iot/permis/permis_home");
}/**
* 查询设备信息列表(支持分页和多条件查询)。
**/@RequestMapping("sbgl_list")
@RequiresRoles("sbgl/sbgl_list")publicString getUserList(Model model) throws Exception {//显示设备列表//List lst=new ArrayList();//lst=(List) sbglService.getAll();
Map resultMap = null;//查询表单或分页保持请求时 请求参数的接收
Map serArgs = new HashMap();
serArgs=SbglUtil.getSelArgsToMap(request);//这个类在下面给出
resultMap= sbglService.getUserBySearch(serArgs, "wxlxdh");
model.addAttribute("resultMap", resultMap);//model.addAttribute("lst", lst);
return "sbgl/sbgl_list";
}/**
* 新增设备信息列表(支持分页和多条件查询)。
*
* @author YangZhenghua 2014-5-28
* @throws Exception*/@RequestMapping("sbgl_add_list")
@RequiresRoles("sbgl/sbgl_add_list")publicString getAddList(Model model) throws Exception {
System.out.println("aaa");
model.addAttribute("aaa","aaa");
model.addAttribute("resultMap", "hello world");return "sbgl/sbgl_add_list";
}/**
* 保存、修改用户信息。
*
* @author YangZhenghua 2014-5-28
* @throws Exception*/@RequestMapping("sbgl_save_list")
@RequiresRoles("sbgl/sbgl_save_list")publicModelAndView SaveSbgl(Sbgl sbgl) throws Exception {
String sbmc=request.getParameter("sbmc");
String sblx=request.getParameter("sblx");
String sssx=request.getParameter("sssx");
String ssjd=request.getParameter("ssjd");
String azsj=request.getParameter("azsj");
String azry=request.getParameter("azry");
String sbzt=request.getParameter("sbzt");
String sbjd=request.getParameter("sbjd");
String sbwd=request.getParameter("sbwd");
String wxlxr=request.getParameter("wxlxr");
String wxlxdh=request.getParameter("wxlxdh");
String sbywxcs=request.getParameter("sbywxcs");
String jzpylyz=request.getParameter("jzpylyz");
String mqsbcyr=request.getParameter("mqsbcyr");
String bzsm=request.getParameter("bzsm");
sbgl.setSbbm(UUIDHexGenerator.generate());
sbgl.setSbmc(sbmc);
sbgl.setSblx(sblx);
sbgl.setSssx(sssx);
sbgl.setSsjd(ssjd);
sbgl.setAzsj(azsj);
sbgl.setAzry(azry);
sbgl.setSbzt(sbzt);
sbgl.setSbjd(sbjd);
sbgl.setSbwd(sbwd);
sbgl.setWxlxr(wxlxr);
sbgl.setWxlxdh(wxlxdh);
sbgl.setSbywxcs(sbywxcs);
sbgl.setJzpylyz(jzpylyz);
sbgl.setMqsbcyr(mqsbcyr);
sbgl.setBzsm(bzsm);
sbglService.save(sbgl);return new ModelAndView(new RedirectView("sbgl_list"));
}
}