|  |  |  | 
|---|
|  |  |  | import com.zy.asrs.framework.annotations.ManagerAuth; | 
|---|
|  |  |  | import com.zy.asrs.framework.common.Cools; | 
|---|
|  |  |  | import com.zy.asrs.framework.common.R; | 
|---|
|  |  |  | import com.zy.asrs.framework.domain.KeyValueVo; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.PathVariable; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestMapping; | 
|---|
|  |  |  | 
|---|
|  |  |  | @RequestParam Map<String, Object> param){ | 
|---|
|  |  |  | excludeTrash(param); | 
|---|
|  |  |  | LambdaQueryWrapper<User> wrapper = new LambdaQueryWrapper<>(); | 
|---|
|  |  |  | wrapper.eq(User::getHostId, param.get("host_id")); | 
|---|
|  |  |  | wrapper.orderByDesc(User::getId); | 
|---|
|  |  |  | if (9527 == getUserId()) { | 
|---|
|  |  |  | return R.ok(userService.page(new Page<>(curr, limit), wrapper)); | 
|---|
|  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/user/add/auth") | 
|---|
|  |  |  | @ManagerAuth(memo = "系统用户添加") | 
|---|
|  |  |  | public R add(User user) { | 
|---|
|  |  |  | User one = userService.getOne(new LambdaQueryWrapper<User>().eq(User::getUsername, user.getUsername())); | 
|---|
|  |  |  | if (one != null) { | 
|---|
|  |  |  | return R.error("账号已存在"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | user.setStatus(1); | 
|---|
|  |  |  | user.setCreateTime(new Date()); | 
|---|
|  |  |  | userService.save(user); | 
|---|
|  |  |  | 
|---|
|  |  |  | return R.ok(result); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /*************************************** xm-select ***********************************************/ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // xm-select 搜索商品列表 | 
|---|
|  |  |  | @RequestMapping("/user/all/get/kv") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R getUserDataKV(@RequestParam(required = false) String condition) { | 
|---|
|  |  |  | List<KeyValueVo> vos = new ArrayList<>(); | 
|---|
|  |  |  | LambdaQueryWrapper<User> wrapper = new LambdaQueryWrapper<>(); | 
|---|
|  |  |  | if (!Cools.isEmpty(condition)) { | 
|---|
|  |  |  | wrapper.like(User::getUsername, condition); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | userService.page(new Page<>(1, 30), wrapper).getRecords().forEach(item -> vos.add(new KeyValueVo(String.valueOf(item.getUsername()), item.getId()))); | 
|---|
|  |  |  | return R.ok().add(vos); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|