package com.iformall.controller.basic;

import java.util.Arrays;

import com.iformall.annotation.SystemControllerLog;
import com.iformall.controller.base.BaseController;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.iformall.common.Result;
import com.iformall.common.ResultData;
import com.iformall.service.WxCUserTagsService;
import com.iformall.service.WxTagsService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping("wxTags")
@Api(description="标签弹窗接口")
public class WxTagsController extends BaseController {
	private final Logger logger = LoggerFactory.getLogger(this.getClass());

	@Autowired
    private WxTagsService wxTagsService;


	@Autowired
	private WxCUserTagsService wxCUserTagsService;

    @GetMapping("getAllList")
    @ApiOperation("标签弹窗接口")
    @SystemControllerLog(description = "会员管理-标签获取")
    public ResultData getAllList() {
		logger.debug("[" + getIpAddr() + "] WxTagsController::getAllList");
    	return new ResultData(wxTagsService.listAllVo());
    }

	@ApiOperation("查询会员用户人群")
	@GetMapping("findCountByTag")
    @SystemControllerLog(description = "会员管理-查询会员用户人群")
	public Result findCountByTag(Long[] tagIds) {
		logger.debug("[" + getIpAddr() + "] WxTagsController::findCountByTag");
		return new ResultData(wxCUserTagsService.findTagList(getTenantId(), Arrays.asList(tagIds)));
	}


}
