package com.gyee.frame.controller.gen;

import com.github.pagehelper.PageInfo;
import com.gyee.frame.common.base.BaseController;
import com.gyee.frame.common.dataSources.DataSource;
import com.gyee.frame.common.dataSources.DataSourceType;
import com.gyee.frame.common.domain.AjaxResult;
import com.gyee.frame.model.auto.Gyeeorgan;
import com.gyee.frame.model.custom.TableSplitResult;
import com.gyee.frame.model.custom.Tablepar;
import com.gyee.frame.model.custom.TitleVo;
import com.gyee.frame.service.GyeeorganService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Controller
@RequestMapping("GyeeorganController")
@Api(value = "")

public class GyeeorganController extends BaseController{
	
	private String prefix = "gen/gyeeorgan";
	@Autowired
	private GyeeorganService gyeeorganService;



	@DataSource(value = DataSourceType.TICKET)
	@GetMapping("/GyeeOrganList")
	@ResponseBody
	public AjaxResult GyeeOrganList(String userid){
		List<Gyeeorgan> list=gyeeorganService.queryOrganByUserId(userid);
		if(list.isEmpty()){
			return AjaxResult.error(500, "无法获取风场权限");
			
		}else{
			return AjaxResult.successData(200, list);
		}
	}

	@DataSource(value = DataSourceType.TICKET)
	@GetMapping("/gyeeOrganAll")
	@ResponseBody
	public AjaxResult gyeeOrganAll(){
		List<Gyeeorgan> list=gyeeorganService.gyeeOrganAll();
		if(list.isEmpty()){
			return AjaxResult.error(500, "无法获取组织结构");

		}else{
			return AjaxResult.successData(200, list);
		}
	}
	
}
