package com.mosty.base.manager.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.mosty.base.model.entity.jcgl.TbJcglZjk;
import com.mosty.base.model.query.jcgl.TbJcglZjkQuery;
import com.mosty.base.manager.service.TbJcglZjkService;
import com.mosty.common.base.domain.ResponseResult;
import com.mosty.common.base.entity.log.BusinessType;
import com.mosty.common.base.entity.log.Log;
import com.mosty.common.token.JwtSysUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 基础管理-专家库 前端控制器
 * </p>
 *
 * @author zengbo
 * @since 2022-07-28
 */
@RestController
@AllArgsConstructor
@Api(tags = "专家库功能接口")
@RequestMapping("/tbJcglZjk")
public class TbJcglZjkController {

    private final TbJcglZjkService tbJcglZjkService;

    @GetMapping({"/queryList"})
    @JwtSysUser
    @ApiOperation(value = "查询专家库列表")
    public ResponseResult<IPage<TbJcglZjk>> queryList(TbJcglZjkQuery zjkQuery) {
        return ResponseResult.success(tbJcglZjkService.queryPage(zjkQuery));
    }

    @PostMapping({"/insert"})
    @JwtSysUser
    @Log(title = "新增专家库", businessType = BusinessType.INSERT)
    @ApiOperation(value = "新增专家库")
    public ResponseResult insert(@RequestBody TbJcglZjk zjk) {
        return ResponseResult.success(tbJcglZjkService.insert(zjk));
    }

    @PostMapping({"/update"})
    @JwtSysUser
    @Log(title = "修改专家库", businessType = BusinessType.UPDATE)
    @ApiOperation(value = "修改专家库")
    public ResponseResult update(@RequestBody TbJcglZjk zjk) {
        return ResponseResult.success(tbJcglZjkService.update(zjk));
    }

    @GetMapping({"/selectById"})
    @JwtSysUser
    @ApiOperation(value = "查询专家库详情")
    public ResponseResult selectByid(String id) {
        return ResponseResult.success(tbJcglZjkService.selectById(id));
    }

    @PostMapping({"/delete"})
    @JwtSysUser
    @Log(title = "删除专家库", businessType = BusinessType.DELETE)
    @ApiOperation(value = "删除专家库")
    public ResponseResult delete(@RequestBody List<String> list) {
        return ResponseResult.success(tbJcglZjkService.deleteById(list));
    }
}

