
package com.tmerclub.cloud.user.controller.platform;

import com.tmerclub.cloud.common.response.ServerResponseEntity;
import com.tmerclub.cloud.user.dto.UserAdminDTO;
import com.tmerclub.cloud.user.dto.UserTagUserDTO;
import com.tmerclub.cloud.user.service.UserTagUserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 用户和标签关联表
 *
 * @author YXF
 * @date 2020-12-08 10:16:53
 */
@RestController("platformUserTagUserController")
@RequestMapping("/p/userTagUser")
@Tag(name = "platform-用户和标签关联表")
public class UserTagUserController {

    @Autowired
    private UserTagUserService userTagUserService;

    @PutMapping("/batchUpdateUserTag")
    @Operation(summary = "平台批量修改会员标签", description = "平台批量修改会员标签")
    public ServerResponseEntity<Boolean> batchUpdateUserTag(@RequestBody UserAdminDTO userAdminDTO) {
        return ServerResponseEntity.success(userTagUserService.batchUpdateUserTag(userAdminDTO));
    }

    @DeleteMapping("/deleteUserTag")
    @Operation(summary = "删除会员的某个标签", description = "删除会员的某个标签")
    public ServerResponseEntity<Boolean> deleteUserTag(@RequestBody UserTagUserDTO userTagUserDTO) {
        return ServerResponseEntity.success(userTagUserService.removeByUserIdAndTagId(userTagUserDTO.getUserId(), userTagUserDTO.getUserTagId()));
    }

}
