package com.yonge.cooleshow.auth.web.controller;

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

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.yonge.cooleshow.auth.service.SysUserDeviceService;
import com.yonge.cooleshow.auth.service.SysUserService;
import com.yonge.cooleshow.auth.web.controller.queryInfo.SysUserDeviceQueryInfo;
import com.yonge.cooleshow.common.controller.BaseController;
import com.yonge.toolset.log.model.AuditLogAnnotation;

@RestController()
@RequestMapping("userDevice")
@Api(tags = "会员设备服务")
public class UserDeviceController extends BaseController {

	@Autowired
	private SysUserService sysUserService;
	
	@Autowired
	private SysUserDeviceService sysUserDeviceService;

	@ApiOperation(value = "分页查询用户信息")
	@GetMapping(value = "/queryPage")
	public Object queryPage(SysUserDeviceQueryInfo queryInfo) {
		return succeed(sysUserDeviceService.queryPage(queryInfo));
	}

	@ApiOperation(value = "设备号解除绑定")
	@PostMapping(value = "/unbind")
	@AuditLogAnnotation(operateName = "设备号解除绑定",interfaceURL = "userDevice/unbind")
	public Object unbind(Long id) {
		return succeed(sysUserDeviceService.deleteWithLogic(id));
	}

}
