package com.hotent.portal.controller.openController;

import com.hotent.base.annotation.ApiGroup;
import com.hotent.base.annotation.OpenApi;
import com.hotent.base.constants.ApiGroupConsts;
import com.hotent.base.model.CommonResult;
import com.hotent.sys.persistence.manager.SysTypeManager;
import com.hotent.sys.persistence.model.SysType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 
 * <pre>
 * 描述：总分类表。用于显示平级或树层次结构的分类，可以允许任何层次结构。管理
 * 构建组：eip平台-bpmx-platform
 * 作者:zyp
 * 邮箱:zyp@jee-soft.cn
 * 日期:2014-1-10-下午3:29:34
 * 版权：广州宏天软件有限公司版权所有
 * </pre>
 */
@RestController
@RequestMapping("/${openApi.prefix}/sys/sysType/v1/")
@Api(tags="系统分类（对外接口）")
@ApiGroup(group= {ApiGroupConsts.GROUP_PORTAL})
@OpenApi(moduleName = "portal模块",function = "系统分类")
public class SysTypeOpenController {

    @Resource
    SysTypeManager sysTypeManager;

    @RequestMapping(value="getTypesByKey", method= RequestMethod.GET, produces = { "application/json; charset=utf-8" })
    @ApiOperation(value = "根据可以key获取分类", httpMethod = "GET", notes = "根据可以key获取分类")
    @OpenApi(description = "根据可以key获取分类")
    public CommonResult getTypesByKey(@ApiParam(name="typeKey", value="分类key", required = true)@RequestParam(value = "typeKey") String typeKey) throws Exception {
        List<SysType> res=sysTypeManager.getTypesByKey(typeKey);
        return new CommonResult().value(res);
    }
}