package com.jd.controller; import com.jd.code.ConstString; import com.jd.entity.basic.SsoSystem; import com.jd.service.SsoSystemService; import com.jd.util.Blank; import com.jd.util.SendUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; 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 java.util.HashMap; import java.util.Map; /** * SSO业务系统类 * @author leihy */ @RestController @RequestMapping("ssoSystem") @Api(value = "SSO业务系统", tags = {"SSO业务系统"}) public class SsoSystemController { private final SsoSystemService ssoSystemService; public SsoSystemController(SsoSystemService ssoSystemService) { this.ssoSystemService = ssoSystemService; } /** * 查询SSO业务系统列表 * @return */ @GetMapping("/getSsoSystemList") @ApiOperation(value = "查询SSO业务系统列表") public Map getSsoSystemList(String userId) { Map map = new HashMap<>(4); map.put("userId", userId); return SendUtil.send(true, ConstString.RESULT_SUCCESS, ssoSystemService.getSsoSystemList(map)); } /** * 获得sso系统列表页面 * @param page 页面 * @param limit 限制 * @param queryValue 查询值 * @return {@link Map}<{@link String}, {@link Object}> */ @GetMapping("getSsoSystemListByPage") @ApiOperation(value = "分页查询SSO业务系统列表") public Map getSsoSystemListByPage(Integer page, Integer limit, String queryValue) { if (Blank.isEmpty(page, limit)) { return SendUtil.send(false, ConstString.REQUEST_WRONGPARAMS); } Map param = new HashMap<>(4); param.put("start", (page - 1) * limit); param.put("limit", limit); param.put("queryValue", queryValue); return ssoSystemService.getSsoSystemListByPage(param); } /** * 插入sso系统 * @param ssoSystem sso系统 * @return {@link Map}<{@link String}, {@link Object}> */ @PostMapping("insertSsoSystem") @ApiOperation(value = "新增SSO业务系统") public Map insertSsoSystem(SsoSystem ssoSystem) { return ssoSystemService.insertSsoSystem(ssoSystem); } /** * 更新sso系统 * @param ssoSystem sso系统 * @return {@link Map}<{@link String}, {@link Object}> */ @PostMapping("updateSsoSystem") @ApiOperation(value = "编辑SSO业务系统") public Map updateSsoSystem(SsoSystem ssoSystem) { return ssoSystemService.updateSsoSystem(ssoSystem); } /** * 删除sso系统 * @param id id * @return {@link Map}<{@link String}, {@link Object}> */ @PostMapping("deleteSsoSystem") @ApiOperation(value = "删除SSO业务系统") public Map deleteSsoSystem(Integer id) { if (Blank.isEmpty(id)) { return SendUtil.send(false, ConstString.REQUEST_WRONGPARAMS); } return ssoSystemService.deleteSsoSystem(id); } /** * 获得sso系统信息 * @param id id * @return {@link Map}<{@link String}, {@link Object}> */ @GetMapping("getSsoSystemInfo") @ApiOperation(value = "查询SSO业务系统详情") public Map getSsoSystemInfo(Integer id) { if (Blank.isEmpty(id)) { return SendUtil.send(false, ConstString.REQUEST_WRONGPARAMS); } return ssoSystemService.getSsoSystemInfo(id); } }