package io.controller;
import io.common.constant.Constant;
import io.common.page.PageData;
import io.common.utils.Result;
import io.modules.item.dto.DictDTO;
import io.modules.item.service.DictService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * 医生职称
 */
@RestController
@RequestMapping("/api/position")
@Tag(name="医生职称")
@CrossOrigin
public class PositionController {
    @Autowired
    private DictService dictService;

    @GetMapping("page")
    @Operation(summary = "分页")
    @Parameters({
        @Parameter(name = Constant.PAGE, description = "当前页码，从1开始", in = ParameterIn.QUERY, required = true, ref="int") ,
        @Parameter(name = Constant.LIMIT, description = "每页显示记录数", in = ParameterIn.QUERY,required = true, ref="int") ,
        @Parameter(name = Constant.ORDER_FIELD, description = "排序字段", in = ParameterIn.QUERY, ref="String") ,
        @Parameter(name = Constant.ORDER, description = "排序方式，可选值(asc、desc)", in = ParameterIn.QUERY, ref="String")
    })
    public Result<PageData<DictDTO>> page(@Parameter(hidden = true) @RequestParam Map<String, Object> params){
        PageData<DictDTO> page = dictService.page(params);
        return new Result<PageData<DictDTO>>().ok(page);
    }
}
