package com.pj.project.app_menu;

import java.util.List;

import com.pj.current.satoken.StpAPPUserUtil;
import com.pj.utils.so.SoMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import com.pj.utils.sg.*;
import com.pj.project4sp.SP;

import com.pj.current.satoken.StpUserUtil;
import cn.dev33.satoken.annotation.SaCheckPermission;


/**
 * Controller: app_menu -- app菜单管理
 * @author qzy 
 */
@RestController
@RequestMapping("/app/AppMenu/")
public class AppMenuController {

	/** 底层 Service 对象 */
	@Autowired
	AppMenuService appMenuService;



	/** 查集合 - 根据条件（参数为空时代表忽略指定条件） */  
	@RequestMapping("getList")
	public AjaxJson getList() {
		SoMap so = SoMap.getRequestSoMap();
		so.put("sortType","5");
		so.put("enable","1");
		List<AppMenu> list = appMenuService.getList(so.startPage());
		return AjaxJson.getPageData(so.getDataCount(), list);
	}



	
	
	/** 改 - 状态(0=禁用,1=启用) */  
	@RequestMapping("updateEnable")
//	@SaCheckPermission(AppMenu.PERMISSION_CODE_EDIT)
	public AjaxJson updateEnable(Long id, String value){
		int line = SP.publicMapper.updateColumnById(AppMenu.TABLE_NAME, "enable", value, id);
		return AjaxJson.getByLine(line);
	}
	
	/** 改 - 是否认证后访问(0=否,1=是) */  
	@RequestMapping("updateAuth")
//	@SaCheckPermission(AppMenu.PERMISSION_CODE_EDIT)
	public AjaxJson updateAuth(Long id, String value){
		int line = SP.publicMapper.updateColumnById(AppMenu.TABLE_NAME, "auth", value, id);
		return AjaxJson.getByLine(line);
	}
	
	

	
	
	

}
