| | |
| | | |
| | | import cn.huge.base.common.utils.ReturnFailUtils; |
| | | import cn.huge.base.common.utils.ReturnSucUtils; |
| | | import cn.huge.base.config.CurrentUser; |
| | | import cn.huge.module.ctuser.domain.po.CtUser; |
| | | import cn.huge.module.ctuser.service.CtUserService; |
| | | import com.google.common.collect.Maps; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 条件查询多个 |
| | | * @url {ctx}/api/web/ctUser/listQuery |
| | | * web端-人员信息管理-新增/新用户信息 |
| | | * @url {ctx}/api/v1/ctUser/saveCtUser |
| | | * @param userId |
| | | * @return Object |
| | | */ |
| | | @GetMapping("/listQuery") |
| | | public Object listQuery() { |
| | | try { |
| | | Map<String, Object> terms = getParameter(); |
| | | return ReturnSucUtils.getRepInfo(service.listTerms(terms)); |
| | | } catch (Exception e) { |
| | | return ReturnFailUtils.getRepInfo(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 条件分页查询 |
| | | * @url {ctx}/api/web/ctUser/pageQuery |
| | | * @param page 页码 |
| | | * @param size 每页数量 |
| | | * @return Object |
| | | */ |
| | | @GetMapping("/pageQuery") |
| | | public Object pageQuery(@RequestParam(value = "page") int page, @RequestParam(value = "size") int size) { |
| | | try { |
| | | Map<String, Object> terms = getParameter(); |
| | | Sort sort = Sort.by(Sort.Direction.DESC, "create_time"); |
| | | PageRequest pageRequest = PageRequest.of(page-1, size, sort); |
| | | Page<CtUser> ctUserPage = service.pageQuery(pageRequest, terms); |
| | | return ReturnSucUtils.getRepInfo( "处理成功", ctUserPage); |
| | | } catch (Exception e) { |
| | | return ReturnFailUtils.getRepInfo(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据编号查询单个 |
| | | * @url {ctx}/api/web/ctUser/getById |
| | | * @param id 主键编号 |
| | | * @return Object |
| | | */ |
| | | @GetMapping("/getById") |
| | | public Object getById(@RequestParam(value = "id") String id) { |
| | | try { |
| | | return ReturnSucUtils.getRepInfo(service.getById(id)); |
| | | } catch (Exception e) { |
| | | return ReturnFailUtils.getRepInfo(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据主键单个 |
| | | * @url {ctx}/api/web/ctUser/deleteById |
| | | * @param id 主键编号 |
| | | * @return Object |
| | | */ |
| | | @GetMapping("/deleteById") |
| | | public Object deleteById(@RequestParam(value = "id") String id) { |
| | | try { |
| | | service.removeById(id); |
| | | return ReturnSucUtils.getRepInfo(); |
| | | } catch (Exception e) { |
| | | return ReturnFailUtils.getRepInfo(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 新增或更新对象 |
| | | * @url {ctx}/api/web/ctUser/saveCtUser |
| | | * @param ctUser 实体对象 |
| | | * @return Object |
| | | * @throws Exception |
| | | */ |
| | | @PostMapping("/saveCtUser") |
| | | public Object saveCtUser(@RequestBody CtUser ctUser) { |
| | | public Object saveCtUser(@RequestBody CtUser ctUser, @CurrentUser String userId) { |
| | | try { |
| | | service.saveCtUser(ctUser); |
| | | // 保存更新用户信息 |
| | | service.webSaveCtUser(ctUser, userId); |
| | | return ReturnSucUtils.getRepInfo(); |
| | | } catch (Exception e) { |
| | | return ReturnFailUtils.getRepInfo(); |