package com.liquidnet.client.admin.web.controller.zhengzai.smile;


import com.liquidnet.client.admin.common.core.domain.AjaxResult;
import com.liquidnet.client.admin.zhengzai.smile.service.ISmileUserCheckService;
import com.liquidnet.client.admin.zhengzai.smile.vo.UserCheckVo;
import com.liquidnet.service.smile.entity.SmileUserCheck;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author liquidnet
 * @since 2022-03-15
 */
@RestController
@RequestMapping("/smile/user/check")
public class SmileUserCheckController {

    @Autowired
    ISmileUserCheckService smileUserCheckService;

    @GetMapping("/list")
    @ApiOperation("获取审核列表")
    @ResponseBody
    public AjaxResult list() {
        List<UserCheckVo> list = smileUserCheckService.listUserCheck();
        return AjaxResult.success(list);
    }

    @PostMapping("/create")
    @ApiOperation("创建审核")
    @ResponseBody
    public AjaxResult create(@RequestBody SmileUserCheck smileUserCheck) {
        if (smileUserCheckService.create(smileUserCheck)) {
            return AjaxResult.success();
        }
        return AjaxResult.error();
    }

    @PostMapping("/updateById")
    @ApiOperation("修改审核")
    @ResponseBody
    public AjaxResult updateById(@RequestBody SmileUserCheck smileUserCheck) {
        if (smileUserCheckService.updateById(smileUserCheck)){
            return AjaxResult.success();
        }
        return AjaxResult.error();
    }
}
