package com.tofly.feesapi.yhgl.controller;

import com.tofly.feesapi.common.core.ResultRespone;

import com.tofly.feesapi.yhgl.entity.vo.YhSjQxVo;
import com.tofly.feesapi.yhgl.entity.vo.YhsjqxReq;
import com.tofly.feesapi.yhgl.service.YhsjqxService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("api/yhgl/sjqx")
@Api(tags = "用户管理-用户数据权限")
public class YhSjQxController {

    @Autowired
    private YhsjqxService yhsjqxService;

    @PostMapping("/add")
    @ApiOperation(value = "账号添加抄表册权限")
    public ResultRespone<Void> add(@RequestBody YhsjqxReq req) {
        yhsjqxService.add(req);
        return ResultRespone.success();
    }

    @GetMapping("/query")
    @ApiOperation(value = "查看用户抄表册权限")
    @ApiImplicitParam(name = "keyWord", value = "搜索关键字")
    public ResultRespone<List<YhSjQxVo>> queryByKeyWord(@RequestParam("keyWord") String keyWord) {
        return ResultRespone.success(yhsjqxService.queryByKeyWord(keyWord));
    }

}
