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

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.starry.admin.modules.clerk.module.vo.PlayClerkUserReviewQueryVo;
import com.starry.admin.modules.clerk.module.vo.PlayClerkUserReviewReturnVo;
import com.starry.admin.modules.clerk.module.vo.PlayClerkUserReviewStateEditVo;
import com.starry.admin.modules.clerk.service.IPlayClerkUserReviewInfoService;
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/user/review")
public class PlayClerkUserReviewInfoController {
    @Resource
    private IPlayClerkUserReviewInfoService playClerkUserReviewInfoService;

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

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

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