package com.mosty.yszx.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.mosty.base.model.dto.yszx.TbYsAjDelDto;
import com.mosty.base.model.dto.yszx.TbYsAjDto;
import com.mosty.base.model.dto.yszx.TbYsRyDto;
import com.mosty.base.model.entity.yszx.TbYsRy;
import com.mosty.base.model.query.yszx.TbYsAjNoPageQuery;
import com.mosty.base.model.query.yszx.TbYsAjQuery;
import com.mosty.base.model.vo.yszx.*;
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 com.mosty.yszx.service.TbYsAjService;
import com.mosty.yszx.service.TbYsRyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @author dw
 * @since 2022/11/28
 * 要素中心-人员要素接口
 **/
@Api(tags = "要素中心-人员要素接口")
@RestController
@AllArgsConstructor
@RequestMapping("/tbYsRy")
public class TbYsRyController {

    private final TbYsRyService tbYsRyService;

    @ApiOperation("查询人员详情")
    @JwtSysUser
    @GetMapping("getRyInfo")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "sfzh", value = "身份证号", required = true)
    })
    public ResponseResult<TbYsRyVo> getRyInfo(String sfzh) {
        return ResponseResult.success(this.tbYsRyService.getRyInfo(sfzh));
    }

    @ApiOperation("添加人员要素")
    @PostMapping("addRyYs")
    public ResponseResult<TbYsRyVo> addRyYs(@RequestBody TbYsRyDto dto) {
        this.tbYsRyService.addRyYs(dto);
        return ResponseResult.success();
    }

    @ApiOperation("修改人员要素")
    @PostMapping("updateRyYs")
    public ResponseResult<TbYsRyVo> updateRyYs(@RequestBody TbYsRyDto dto) {
        this.tbYsRyService.updateRyYs(dto);
        return ResponseResult.success();
    }

    @ApiOperation("修改人员标签要素")
    @PostMapping("updateRyBqYs")
    public ResponseResult<Void> updateRyBqYs(@RequestBody TbYsRyBqUpdateDto dto) {
        this.tbYsRyService.updateRyBqYs(dto);
        return ResponseResult.success();
    }

    @ApiOperation("修改人员电话要素")
    @PostMapping("updateRyDhys")
    public ResponseResult<Void> updateRyDhys(@RequestBody TbYsRyDhUpdateDto dto) {
        this.tbYsRyService.updateRyDhys(dto);
        return ResponseResult.success();
    }
}
