package com.hz.pm.api.organization.controller;


import com.hz.pm.api.organization.manage.GovBusinessStripManage;
import com.hz.pm.api.organization.model.vo.GovBusinessStripTreeVO;
import com.hz.pm.api.organization.model.vo.ProvincialGovBusinessStripVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author Liuxinxin
 * @since 2023-03-08
 */
@Controller
@Slf4j
@Validated
@RestController
@RequiredArgsConstructor
@Api(value = "GovBusinessStripController", tags = "条线管理")
@RequestMapping("/api/v1/gov-business-strip")
public class GovBusinessStripController {

    private final GovBusinessStripManage govBusinessStripManage;

    @GetMapping("/get-child-list")
    @ApiOperation("获取条线标签的的树状结构")
    public List<GovBusinessStripTreeVO> getChildOrganizationList(@RequestParam(value = "parentCode", required = false) String parentCode) {
        return govBusinessStripManage.getChildOrganizationList(parentCode);
    }


    @GetMapping("/list")
    @ApiOperation("获取省局条线列表")
    public List<ProvincialGovBusinessStripVO> getProvincialGovBusinessStripList(@RequestParam(value = "businessStripName", required = false) String businessStripName) {
        return govBusinessStripManage.getProvincialGovBusinessStripList(businessStripName);
    }

}
