using Microsoft.AspNetCore.Mvc;
using NewPdaSqlServer.Dto.Simple;
using NewPdaSqlServer.service.Simple;
namespace NewPdaSqlServer.Controllers.Simple;
///
/// ¿´°åĿ¼½Ó¿Ú¿ØÖÆÆ÷
/// ·ÓÉǰ׺: /simple (ÓëJava°æ±¾ÍêȫһÖÂ)
/// ʵÏÖÓëJava SimpleControllerÍêÈ«ÏàͬµÄ½Ó¿Ú
///
[Route("simple")]
[ApiController]
public class SimpleController : ControllerBase
{
private readonly SimpleManager _simpleManager = new();
///
/// »ñÈ¡Ê÷Ðβ˵¥
/// ¶ÔÓ¦Java: @PostMapping("/getTree")
///
/// Ê÷Ðβ˵¥Êý¾Ý
///
/// ÇëÇóʾÀý:
/// POST /simple/getTree
/// Content-Type: application/json
///
/// ·µ»ØÊý¾Ý½á¹¹:
/// {
/// "code": 0,
/// "msg": "ÇëÇó³É¹¦",
/// "count": 2,
/// "data": [
/// {
/// "id": 1,
/// "title": "Éú²ú¿´°å",
/// "field": "production",
/// "spread": true,
/// "children": [...]
/// }
/// ]
/// }
///
/// ³É¹¦»ñÈ¡Ê÷Ðβ˵¥
[HttpPost("getTree")]
public ResultDto> GetTree()
{
return _simpleManager.GetTree();
}
///
/// »ñÈ¡²Ëµ¥Áбí
/// ¶ÔÓ¦Java: @PostMapping("/list")
/// ×¢Òâ: ´Ë½Ó¿ÚÒÑ»ù±¾·ÏÆú£¬Ç°¶Ë¸ÄÓÃÊ÷Ðβ˵¥·½Ê½Õ¹Ê¾
///
/// ²Ëµ¥ÁбíÊý¾Ý
///
/// ÇëÇóʾÀý:
/// POST /simple/list
/// Content-Type: application/json
///
/// ·µ»ØÊý¾Ý½á¹¹:
/// {
/// "code": 0,
/// "msg": "ÇëÇó³É¹¦",
/// "count": 5,
/// "data": [
/// {
/// "id": 1,
/// "isTop": 1,
/// "fid": 0,
/// "title": "Éú²úЧÂÊ¿´°å",
/// "field": "efficiency",
/// "href": "http://bi.example.com/dashboard1",
/// "spread": 0,
/// "disabled": 0,
/// "lbtime": 10
/// }
/// ]
/// }
///
/// ³É¹¦»ñÈ¡²Ëµ¥Áбí
[HttpPost("list")]
public ResultDto> GetList()
{
return _simpleManager.GetMenuList();
}
///
/// ¸ù¾Ý²Ëµ¥ID»ñÈ¡BIÊÓͼÁбí
/// ¶ÔÓ¦Java: @GetMapping("/listByMenuId/{menuId}")
/// ºËÐĽӿڣºÓÃÓÚ»ñÈ¡ÂÖ²¥Ò³ÃæµÄBI¿´°åÁ´½ÓÁбí
///
/// ²Ëµ¥ID (·¾¶²ÎÊý)
/// BIÊÓͼÁбí
///
/// ÇëÇóʾÀý:
/// GET /simple/listByMenuId/102
///
/// ·µ»ØÊý¾Ý½á¹¹:
/// {
/// "code": 0,
/// "msg": "ÇëÇó³É¹¦",
/// "count": 3,
/// "data": [
/// {
/// "id": 1001,
/// "pid": 102,
/// "name": "ÖÊÁ¿Ç÷ÊÆ·ÖÎö",
/// "href": "http://bi.example.com/quality/trend",
/// "lbtime": 10
/// }
/// ]
/// }
///
/// ÒµÎñ˵Ã÷:
/// - ·µ»ØÖ¸¶¨²Ëµ¥ÏÂËùÓеÄBI¿´°åÁ´½Ó
/// - lbtime×ֶδӸ¸²Ëµ¥¼Ì³Ð£¨MES_SIMPLE±í£©
/// - ǰ¶ËʹÓôËÊý¾Ý´´½¨iframe½øÐÐÂÖ²¥Õ¹Ê¾
///
/// ³É¹¦»ñÈ¡BIÊÓͼÁбí
[HttpGet("listByMenuId/{menuId}")]
public ResultDto> GetBiViews(int menuId)
{
return _simpleManager.GetBiViewsByMenuId(menuId);
}
}