package com.cloud.user.controller; import com.cloud.model.common.Page; import com.cloud.model.sys.BbEmployee; import com.cloud.user.service.BbEmployeeService; import com.cloud.user.vo.BbEmployeeVO; import io.swagger.annotations.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.*; import java.util.HashMap; import java.util.List; import java.util.Map; /** * 人员 控制层 */ @RestController @Api(value = "BbEmployeeController", description = "人员表操作控制层Feign调用") @RequestMapping("data") public class BbEmployeeFeignController { @Autowired private BbEmployeeService service; /** * 添加 */ @RequestMapping("/BbEmployee/feign/add") @ApiOperation(value = "人员添加", notes = "Employee表人员添加模块", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ApiImplicitParams({ @ApiImplicitParam(name = "jsonData", value = "", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "access_token", value = "", required = true, dataType = "String", paramType = "query") }) public Map add(@RequestBody String jsonData, @RequestParam String access_token) { // service.addBbEmployee(BbEmployeeVO.beanVOFromJson(jsonData)); return new HashMap<>(); } /** * 访客添加 */ @RequestMapping("/BbEmployee/feign/addVisitor") @ApiOperation(value = "访客人员添加", notes = "Employee表访客人员添加模块", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ApiImplicitParams({ @ApiImplicitParam(name = "jsonData", value = "", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "access_token", value = "", required = true, dataType = "String", paramType = "query") }) public Map addVisitor(@RequestBody BbEmployee bbEmployee){ return service.addVisitor(bbEmployee); } /** * 去编辑 */ @RequestMapping("/BbEmployee/feign/toUpdate") @ApiOperation(value = "人员修改查询", notes = "根据用户id,orgId查询要修改的人员信息", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ApiImplicitParams({ @ApiImplicitParam(name = "beanVO", value = "", required = true, dataType = "BbEmployee", paramType = "body"), @ApiImplicitParam(name = "access_token", value = "", required = true, dataType = "String", paramType = "query") }) public Map toUpdate(BbEmployee bean, @RequestParam String access_token) { return service.toUpdateBbEmployee(bean); } /** * 编辑 */ @RequestMapping("/BbEmployee/feign/update") @ApiOperation(value = "人员修改更新", notes = "根据用户id,orgId保存要修改的人员信息", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ApiImplicitParams({ @ApiImplicitParam(name = "jsonData", value = "", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "access_token", value = "", required = true, dataType = "String", paramType = "query") }) public void update(@RequestParam String jsonData,@RequestParam String access_token) { service.updateBbEmployee(BbEmployeeVO.beanVOFromJson(jsonData)); } /** * 列表 */ @RequestMapping("/BbEmployee/feign/list") @ApiOperation(value = "查询人员列表", notes = "根据用户id,orgId查询人员信息列表", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_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"), @ApiImplicitParam(name = "name", value = "姓名", required = true, dataType = "String", paramType = "query") }) public Page findBbEmployees(@RequestParam Map params) { return service.findBbEmployees(params); } /** * 查询人员 */ @GetMapping("/BbEmployee/feign/findById") @ApiOperation(value = "查询人员", notes = "根据用户id,orgId查询人员信息", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ApiImplicitParams({}) public BbEmployee findById(@RequestParam Map params, @RequestParam String access_token) { System.out.println(params.get("id")); String id = null; Object idStr = params.get("id"); if (idStr == null) { return new BbEmployee(); } if (idStr != null) { id = idStr.toString(); } Object orgIdStr = params.get("orgId"); Long orgId = null; if (orgIdStr != null) { orgId = Long.parseLong(orgIdStr+""); } return service.findById(id, orgId); } /** * 删除 * * @param ids * 主键 */ @RequestMapping("/BbEmployee/feign/delete") @ApiOperation(value = "删除人员", notes = "根据用户id,orgId删除人员信息", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "人员ID", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "orgId", value = "分库orgId", required = true, dataType = "String", paramType = "query") }) public Integer deleteByIds(@RequestParam String ids, @RequestParam String access_token) { Map params = new HashMap(); params.put("ids", ids); return service.deleteByIds(params, null); } /** * 删除 * * @param params * 主键 */ @RequestMapping("/BbEmployee/feign/findInfoByEmployeeId") @ApiOperation(value = "查询人员信息及家人信息", notes = "查询人员信息及家人信息", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "人员ID", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "orgId", value = "分库orgId", required = true, dataType = "String", paramType = "query") }) public Map findInfoByEmployeeId(@RequestParam Map params) { return service.findInfoByEmployeeId(params); } /** * 查找老师和学生 * */ @RequestMapping("/BbEmployee/feign/findStudentAndTeachers") @ApiOperation(value = "查找老师和学生", notes = "查找老师和学生", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ApiImplicitParams({ }) public Map findStudentAndTeachers(@RequestParam Map params, @RequestParam String access_token) { return service.findStudentAndTeachers(params); } /** * 根据家长ID查询孩子信息 * @param params * @return */ @RequestMapping("/BbEmployee/feign/findStuByEmpId") public List findStuByEmpId(@RequestParam Map params){ return service.findStuByEmpId(params); } /** * 教师模糊查询根据拼音 */ @RequestMapping("/BbEmployee/feign/findTeacherByPin") @ApiOperation(value = "教师模糊查询根据拼音",notes = "教师模糊查询根据拼音", httpMethod ="GET", produces = MediaType.APPLICATION_FORM_URLENCODED_VALUE) @ApiImplicitParams({ @ApiImplicitParam(name = "orgId", value = "分库orgId", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "namecode", value = "教师拼音", required = true, dataType = "String", paramType = "query") }) public Map findTeacherByPin(@RequestParam Map params, @RequestParam String access_token){ return service.findTeacherByPin(params); } /** * 根据人员id查询部门 */ @RequestMapping("/BbEmployee/feign/findOfficeNameById") @ApiOperation(value = "根据人员id查询部门", notes = "根据人员id查询部门", httpMethod ="GET", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ApiImplicitParams({ @ApiImplicitParam(name = "orgId", value = "分库orgId", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "id", value = "id", required = true, dataType = "String", paramType = "query") }) public Map findOfficeNameById(@RequestParam Map params){ return service.findOfficeNameById(params); } /** * 根据人员id查询部门 */ @RequestMapping("/BbEmployee/feign/findBbEmployee") @ApiOperation(value = "根据人员id查询部门", notes = "根据人员id查询部门", httpMethod ="GET", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ApiImplicitParams({ @ApiImplicitParam(name = "orgId", value = "分库orgId", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "id", value = "id", required = true, dataType = "String", paramType = "query") }) public List findBbEmployee(@RequestParam Map params){ return service.findBbEmployeeList(params); } }