SocialSignOnListController.java 2.4 KB
Newer Older
MaxKey单点登录官方's avatar
MaxKey单点登录官方 已提交
1
/*
M
MaxKey 已提交
2
 * Copyright [2022] [MaxKey of copyright http://www.maxkey.top]
MaxKey单点登录官方's avatar
MaxKey单点登录官方 已提交
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *     http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
 

MaxKey单点登录官方's avatar
init  
MaxKey单点登录官方 已提交
18 19 20 21
package org.maxkey.web.contorller;

import java.util.List;

M
3.5.0  
MaxKey 已提交
22 23
import org.maxkey.authn.annotation.CurrentUser;
import org.maxkey.entity.Message;
M
MaxKey 已提交
24
import org.maxkey.entity.SocialsAssociate;
M
3.5.0  
MaxKey 已提交
25
import org.maxkey.entity.UserInfo;
M
MaxKey 已提交
26
import org.maxkey.entity.apps.Apps;
M
3.5.0  
MaxKey 已提交
27
import org.maxkey.persistence.service.SocialsAssociatesService;
MaxKey单点登录官方's avatar
init  
MaxKey单点登录官方 已提交
28 29 30
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
M
MaxKey 已提交
31
import org.springframework.http.MediaType;
M
3.5.0  
MaxKey 已提交
32
import org.springframework.http.ResponseEntity;
MaxKey单点登录官方's avatar
init  
MaxKey单点登录官方 已提交
33 34
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
M
MaxKey 已提交
35
import org.springframework.web.bind.annotation.RequestParam;
M
3.5.0  
MaxKey 已提交
36
import org.springframework.web.bind.annotation.ResponseBody;
MaxKey单点登录官方's avatar
init  
MaxKey单点登录官方 已提交
37 38 39


@Controller
M
3.5.0  
MaxKey 已提交
40
@RequestMapping(value={"/config/socialsignon"})
MaxKey单点登录官方's avatar
init  
MaxKey单点登录官方 已提交
41 42 43 44
public class SocialSignOnListController {
	final static Logger _logger = LoggerFactory.getLogger(SocialSignOnListController.class);
	
	@Autowired
M
3.5.0  
MaxKey 已提交
45
	protected SocialsAssociatesService socialsAssociatesService;
MaxKey单点登录官方's avatar
init  
MaxKey单点登录官方 已提交
46
	
M
3.5.0  
MaxKey 已提交
47 48 49
	@RequestMapping(value={"/fetch"})
	@ResponseBody
	public ResponseEntity<?> fetch(@CurrentUser UserInfo currentUser){
M
MaxKey 已提交
50
		
M
3.5.0  
MaxKey 已提交
51 52
		List<SocialsAssociate>  listSocialsAssociate= 
				socialsAssociatesService.queryByUser(currentUser);
M
MaxKey 已提交
53
		
M
3.5.0  
MaxKey 已提交
54
		return new Message<List<SocialsAssociate>>(listSocialsAssociate).buildResponse();
MaxKey单点登录官方's avatar
init  
MaxKey单点登录官方 已提交
55 56
	}
	
M
MaxKey 已提交
57 58 59 60 61 62 63 64 65 66 67
	@ResponseBody
	@RequestMapping(value={"/delete"}, produces = {MediaType.APPLICATION_JSON_VALUE})
	public ResponseEntity<?> delete(@RequestParam("ids") String ids,@CurrentUser UserInfo currentUser) {
		_logger.debug("-delete  ids : {} " , ids);
		if (socialsAssociatesService.deleteBatch(ids)) {
			 return new Message<Apps>(Message.SUCCESS).buildResponse();
		} else {
			return new Message<Apps>(Message.FAIL).buildResponse();
		}
	}
	
MaxKey单点登录官方's avatar
init  
MaxKey单点登录官方 已提交
68
}