package com.bosshand.virgo.controller; import com.alibaba.fastjson.JSONObject; import com.bosshand.virgo.core.model.MgrOrganization; import com.bosshand.virgo.core.response.Response; import com.bosshand.virgo.service.OrganizationService; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.HashMap; import java.util.List; import java.util.Map; @RestController @RequestMapping("base") public class OrganizationController { @Autowired OrganizationService organizationService; @ApiOperation(value="组织列表", notes="组织列表") @RequestMapping(value = "/organization/list", method = RequestMethod.POST) public Response getOrganizationList(@RequestBody JSONObject parameter) { List list = organizationService.getList(parameter); int totalCount = organizationService.getTotalCount(parameter); Map result = new HashMap(); result.put("dataList", list); result.put("totalCount", totalCount); return Response.ok(result); } @ApiOperation(value="组织详情", notes="组织详情") @RequestMapping(value = "/organization/{id}", method = RequestMethod.GET) public Response getOrganization(@PathVariable long id) { MgrOrganization mgrOrganization = organizationService.get(id); return Response.ok(mgrOrganization); } @ApiOperation(value="组织信息更新", notes="组织信息更新") @RequestMapping(value = "/organization/update", method = RequestMethod.POST) public Response updateOrganization(@RequestBody MgrOrganization mgrOrganization) { organizationService.update(mgrOrganization); return Response.ok(); } @ApiOperation(value="组织信息审核", notes="组织信息审核") @RequestMapping(value = "/organization/updateStatus", method = RequestMethod.POST) public Response updateStatusOrganization(@RequestBody MgrOrganization mgrOrganization) { organizationService.updateStatus(mgrOrganization); return Response.ok(); } @ApiOperation(value="根据organizationIds获取组织列表", notes="根据organizationIds获取组织列表") @RequestMapping(value = "/{organizationIds}/organization", method = RequestMethod.GET) public Response organizationByIds(@PathVariable String organizationIds) { return Response.ok(organizationService.organizationByIds(organizationIds)); } @ApiOperation(value="设置组织文件", notes="设置组织文件") @RequestMapping(value = "/organization/organizedDataCenter", method = RequestMethod.PUT) public Response setOrganizedDataCenter(@RequestBody MgrOrganization mgrOrganization) { return Response.ok(organizationService.setOrganizedDataCenter(mgrOrganization)); } @ApiOperation(value="根据组织名称获取组织", notes="根据组织名称获取组织") @RequestMapping(value = "/organizationName/{name}", method = RequestMethod.GET) public Response getByOrganizationName(@PathVariable String name) { return Response.ok(organizationService.getByOrganizationName(name)); } @ApiOperation(value="根据organizationCode获取组织", notes="根据organizationCode获取组织") @RequestMapping(value = "/organizationCode/{organizationCode}", method = RequestMethod.GET) public Response getByOrganizationCode(@PathVariable String organizationCode) { MgrOrganization mgrOrganization = organizationService.getByOrganizationCode(organizationCode); return Response.ok(mgrOrganization); } }