liuxiaolong
2019-05-06 f99bc8c6a1d10610373738edd7d0aa0181c81d99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
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<String, Object> 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<String,Object> 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<String, Object> 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<BbEmployee> findBbEmployees(@RequestParam Map<String, Object> 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<String, Object> 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<String, Object> 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<String,Object> findInfoByEmployeeId(@RequestParam Map<String, Object> params) {
        return service.findInfoByEmployeeId(params);
    }
    
    
    /**
     * 查找老师和学生
     *
     */
    @RequestMapping("/BbEmployee/feign/findStudentAndTeachers")
    @ApiOperation(value = "查找老师和学生", notes = "查找老师和学生", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiImplicitParams({
    })
    public Map<String,Object> findStudentAndTeachers(@RequestParam Map<String, Object> params, @RequestParam String access_token) {
        return service.findStudentAndTeachers(params);
    }
 
    /**
     * 根据家长ID查询孩子信息
     * @param params
     * @return
     */
    @RequestMapping("/BbEmployee/feign/findStuByEmpId")
    public List<BbEmployee> findStuByEmpId(@RequestParam Map<String,Object> 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<String,Object> findTeacherByPin(@RequestParam Map<String, Object> 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<String,Object> findOfficeNameById(@RequestParam Map<String, Object> 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<BbEmployee> findBbEmployee(@RequestParam Map<String, Object> params){
        return service.findBbEmployeeList(params);
    }
}