package com.yihu.hos.standard.controller;

import com.yihu.hos.standard.service.adapter.AdapterDictService;
import com.yihu.hos.web.framework.model.DetailModelResult;
import com.yihu.hos.web.framework.util.controller.BaseController;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * Created by LLH on 2016/1/6.
 */
@RestController("InitController")
@RequestMapping("/init")
//@Api(protocols = "https", value = "AdapterDictController", description = "适配字典管理", tags = {"适配字典"})
public class InitController extends BaseController {

    @Resource(name = AdapterDictService.BEAN_ID)
    private AdapterDictService dictService;

    @RequestMapping(value = "/searchDictList")
    @ApiOperation(value = "获取字典列表", response = DetailModelResult.class, produces = "application/json", notes = "获取字典列表")
    public DetailModelResult searchDictList(
            @ApiParam(name = "adapterVersion", value = "适配标准版本号")
            @RequestParam(value = "adapterVersion") String adapterVersion,
            @ApiParam(name = "condition", value = "查询条件：编码或名称")
            @RequestParam(value = "condition", required = false) String condition,
            @ApiParam(name = "order", value = "Order param,Must be json.ascending:asc,descending:desc")
            @RequestParam(value = "order", required = false) String order,
            @ApiParam(name = "rows", value = "Limit the size of result set. Must be an integer")
            @RequestParam(value = "rows", required = false) Integer rows,
            @ApiParam(name = "page", value = "Start position of result set. Must be an integer")
            @RequestParam(value = "page", required = false) Integer page) {
        return dictService.getDetailResult(adapterVersion, condition, order, rows, page);
    }
}
