package com.skr.mdm.api.common.controller;

import com.skr.mdm.api.common.service.PublicService;
import com.skr.mdm.dto.LoginAdminDTO;
import com.skr.mdm.result.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;


/**
 * @ProjectName: mdm_new
 * @Package: com.skr.mdm.publicController
 * @ClassName: Controller
 * @Author: Tty
 * @Description:
 * @Date: 2020/7/31 16:26
 * @Version: 1.0
 */
@RestController
@RequestMapping("public")
@Api(tags = "公共接口")
public class PublicController {
	@Autowired
	private PublicService publicService;

	@PostMapping("password/check")
	@ApiOperation(value = "登录密码校验")
	public ResponseResult list(String password, @ApiIgnore Authentication authentication) {
		LoginAdminDTO loginAdminDTO = (LoginAdminDTO) authentication.getPrincipal();
		return publicService.checkPassword(password, loginAdminDTO.getId());
	}

}