67c5a6f421f3d0b993e0caccb5410ff663e9e941.svn-base 2.88 KB
/**
 * Copyright &copy; 2015-2018 <a href="#">J-Site</a> All rights reserved.
 */
package com.thinkgem.jeesite.modules.ycsl.web.xttj;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.shiro.authz.annotation.RequiresPermissions;
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.RequestParam;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import com.thinkgem.jeesite.common.config.Global;
import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.web.BaseController;
import com.thinkgem.jeesite.common.utils.StringUtils;
import com.thinkgem.jeesite.modules.ycsl.entity.xttj.YcslXttj;
import com.thinkgem.jeesite.modules.ycsl.service.xttj.YcslXttjService;

/**
 * 一窗受理业务退件推送、调度Controller
 * @author lw
 * @version 2020-07-17
 */
@Controller
@RequestMapping(value = "${adminPath}/ycsl/xttj/ycslXttj")
public class YcslXttjController extends BaseController {

	@Autowired
	private YcslXttjService ycslXttjService;
	
	@ModelAttribute
	public YcslXttj get(@RequestParam(required=false) String id) {
		YcslXttj entity = null;
		if (StringUtils.isNotBlank(id)){
			entity = ycslXttjService.get(id);
		}
		if (entity == null){
			entity = new YcslXttj();
		}
		return entity;
	}
	
	@RequiresPermissions("ycsl:xttj:ycslXttj:view")
	@RequestMapping(value = {"list", ""})
	public String list(YcslXttj ycslXttj, HttpServletRequest request, HttpServletResponse response, Model model) {
		Page<YcslXttj> page = ycslXttjService.findPage(new Page<YcslXttj>(request, response), ycslXttj); 
		model.addAttribute("page", page);
		return "modules/ycsl/xttj/ycslXttjList";
	}

	@RequiresPermissions("ycsl:xttj:ycslXttj:view")
	@RequestMapping(value = "form")
	public String form(YcslXttj ycslXttj, Model model) {
		model.addAttribute("ycslXttj", ycslXttj);
		return "modules/ycsl/xttj/ycslXttjForm";
	}

	@RequiresPermissions("ycsl:xttj:ycslXttj:edit")
	@RequestMapping(value = "save")
	public String save(YcslXttj ycslXttj, Model model, RedirectAttributes redirectAttributes) {
		if (!beanValidator(model, ycslXttj)){
			return form(ycslXttj, model);
		}
		ycslXttjService.save(ycslXttj);
		addMessage(redirectAttributes, "保存lw成功");
		return "redirect:"+Global.getAdminPath()+"/ycsl/xttj/ycslXttj/?repage";
	}
	
	@RequiresPermissions("ycsl:xttj:ycslXttj:edit")
	@RequestMapping(value = "delete")
	public String delete(YcslXttj ycslXttj, RedirectAttributes redirectAttributes) {
		ycslXttjService.delete(ycslXttj);
		addMessage(redirectAttributes, "删除lw成功");
		return "redirect:"+Global.getAdminPath()+"/ycsl/xttj/ycslXttj/?repage";
	}

}