package com.cloud.user.controller; import com.cloud.model.common.Page; import com.cloud.model.sys.BbEmployeeRelation; import com.cloud.user.service.BbEmployeeRelationService; import com.cloud.user.vo.BbEmployeeRelationVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import java.util.HashMap; import java.util.List; import java.util.Map; /** * 人员关系表 * 控制层 */ @RequestMapping("data/api-u") @RestController @Api(value = "BbEmployeeController", description = "人员关系表操作控制层") public class BbEmployeeRelationController { @Autowired private BbEmployeeRelationService service; /** * 添加 */ @ApiOperation(value = "人员关系添加", notes = "BbEmployeeRelation表人员关系添加模块", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ApiImplicitParams({ @ApiImplicitParam(name = "orgId", value = "分校Id", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "employeeId", value = "被关联人id", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "relationoId", value = "关联人Id", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "relation", value = "关系说明", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "phone", value = "联系电话", required = true, dataType = "String", paramType = "query") }) @RequestMapping("/BbEmployeeRelation/add") public Map add(@RequestBody List beanVOs) { return service.addBbEmployeeRelation(beanVOs); } /** * 去编辑 */ @ApiOperation(value = "人员关系修改查询", notes = "人员关系id,orgId查询要修改的人员关系信息", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ApiImplicitParams({ @ApiImplicitParam(name = "beanVO", value = "人员关系BbEmployeeRelation实例", required = true, dataType = "BbEmployeeRelationVO", paramType = "body") }) @RequestMapping("/BbEmployeeRelation/toUpdate") public BbEmployeeRelation toUpdate(BbEmployeeRelationVO beanVO) { return service.toUpdateBbEmployeeRelation(beanVO); } /** * 编辑 */ @RequestMapping("/BbEmployeeRelation/update") @ApiOperation(value = "人员关系修改更新", notes = "根据人员关系id,orgId保存要修改的人员关系信息", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ApiImplicitParams({ @ApiImplicitParam(name = "beanVO", value = "人员关系BbEmployeeRelation实例", required = true, dataType = "BbEmployeeRelationVO", paramType = "body") }) public Map update(BbEmployeeRelationVO beanVO) { return service.updateBbEmployeeRelation(beanVO); } /** * 列表 */ @RequestMapping("/BbEmployeeRelation/list") @ApiOperation(value = "查询人员关系列表", notes = "根据人员关系id,orgId查询人员关系信息列表", httpMethod = "GET", produces = MediaType.APPLICATION_FORM_URLENCODED_VALUE) @ApiImplicitParams({ @ApiImplicitParam(name = "start", value = "起始页", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "length", value = "条数", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "orgId", value = "分库orgId", required = true, dataType = "String", paramType = "query") }) public Page findBbEmployeeRelations(@RequestParam Map params) { return service.findBbEmployeeRelations(params); } /** * 删除 */ @ApiOperation(value = "删除人员关系", notes = "根据人员关系id,orgId删除人员关系信息", httpMethod = "GET", produces = MediaType.APPLICATION_FORM_URLENCODED_VALUE) @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "人员ID", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "orgId", value = "分库orgId", required = true, dataType = "String", paramType = "query") }) @RequestMapping("/BbEmployeeRelation/delete") public Map delete(@RequestParam Map params) { Integer status = service.deleteById(params, null); Map map = new HashMap<>(); if(status > 0){ map.put("code","0"); map.put("message","删除成功!"); }else { map.put("code","1"); map.put("message","删除失败!"); } return map; } /** *查询与人员id有关系的人员集合 */ @ApiOperation(value = "查询与人员id有关系的人员集合", notes = "查询与人员id有关系的人员集合", httpMethod = "GET", produces = MediaType.APPLICATION_FORM_URLENCODED_VALUE) @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "人员ID", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "orgId", value = "分库orgId", required = true, dataType = "String", paramType = "query") }) @RequestMapping("/BbEmployeeRelation/findRelationById") public Map findRelationById(@RequestParam Map params){ return service.findRelationById(params); } }