package com.mosty.sjzx.controller;

import com.mosty.base.model.dto.sjzx.TbCaseTypeDto;
import com.mosty.base.model.entity.sjzx.TbCaseType;
import com.mosty.common.base.domain.BaseController;
import com.mosty.common.base.domain.ResponseResult;
import com.mosty.common.token.JwtSysUser;
import com.mosty.sjzx.service.TbCaseTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 案由表控制层
 *
 * @author
 * @since 2022-09-13 20:44:48
 */
@AllArgsConstructor
@RestController
@Api(tags = "案由相关接口")
@RequestMapping("/tbCase")
public class TbCaseTypeController extends BaseController {

    @Resource
    private TbCaseTypeService tbCaseTypeService;

    @ApiOperation(value = "根据code查询案由上级拼接")
    @GetMapping("/code")
    @JwtSysUser
    public ResponseResult<String> queryCaseByCode(TbCaseTypeDto dto) {
        return ResponseResult.success(tbCaseTypeService.queryCaseByCode(dto.getCode()));
    }

    @ApiOperation(value = "根据code查询案由信息")
    @GetMapping("/codeObj")
    @JwtSysUser
    public ResponseResult<TbCaseType> queryCaseObjByCode(TbCaseTypeDto dto) {
        return ResponseResult.success(tbCaseTypeService.queryCase(dto.getCode()));
    }

}


