package com.starry.admin.modules.clerk.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.starry.admin.modules.clerk.module.vo.PlayClerkDataReviewQueryVo;
import com.starry.admin.modules.clerk.module.vo.PlayClerkDataReviewReturnVo;
import com.starry.admin.modules.clerk.module.vo.PlayClerkDataReviewStateEditVo;
import com.starry.admin.modules.clerk.service.IPlayClerkDataReviewInfoService;
import com.starry.common.annotation.Log;
import com.starry.common.enums.BusinessType;
import com.starry.common.result.R;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 店员资料审核Controller
 *
 * @author admin
 * @since 2024-05-19
 */
@RestController
@RequestMapping("/clerk/data/review")
public class PlayClerkDataReviewInfoController {

    @Resource
    private IPlayClerkDataReviewInfoService playClerkDataReviewInfoService;


    /**
     * 查询店员资料审核列表
     */
    @PostMapping("/listByPage")
    public R list(@Validated @RequestBody PlayClerkDataReviewQueryVo vo) {
        IPage<PlayClerkDataReviewReturnVo> list = playClerkDataReviewInfoService.selectByPage(vo);
        return R.ok(list);
    }

    /**
     * 修改店员资料审核
     */
    //@PreAuthorize("@customSs.hasPermission('clerk:dataReview:update')")
    @Log(title = "店员资料审核", businessType = BusinessType.UPDATE)
    @PostMapping(value = "/update")
    public R update(@Validated @RequestBody PlayClerkDataReviewStateEditVo vo) {
        playClerkDataReviewInfoService.updateDataReviewState(vo);
        return R.ok();
    }

    /**
     * 删除店员资料审核
     */
    //@PreAuthorize("@customSs.hasPermission('clerk:dataReview:delete')")
    @Log(title = "店员资料审核", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public R remove(@PathVariable String[] ids) {
        return R.ok(playClerkDataReviewInfoService.deletePlayClerkDataReviewInfoByIds(ids));
    }
}
