| | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.page.PageInfoBT; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.modular.system.dto.Host; |
| | | import com.stylefeng.guns.modular.system.model.AppUser; |
| | |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiResponse; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | |
| | | BeanUtils.copyProperties(host,appUser); |
| | | appUser.setInsertTime(new Date()); |
| | | appUser.setStatus(1); |
| | | appUser.setAuditStatus(2); |
| | | appUserService.insert(appUser); |
| | | return ResultUtil.success("增加成功"); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/pre/update") |
| | | @GetMapping("/pre/update") |
| | | @ApiOperation(value = "编辑前获取用户信息", tags = {"后台-用户管理"}) |
| | | public Host preupdate(Integer id){ |
| | | AppUser appUser = appUserService.selectById(id); |
| | | if (appUser.getWatchApp1()!=null){ |
| | | appUser.setWatchApp(appUser.getWatchApp1()); |
| | | } |
| | | if (appUser.getWechatQrCode1()!=null){ |
| | | appUser.setWechatQRCode(appUser.getWechatQrCode1()); |
| | | } |
| | | Host host = new Host(); |
| | | BeanUtils.copyProperties(appUser,host); |
| | | return host; |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping ("/list") |
| | | @ApiOperation(value = "查询用户", tags = {"后台-用户管理"}) |
| | | @PutMapping("/update") |
| | | @ApiOperation(value = "编辑用户信息", tags = {"后台-用户管理"}) |
| | | public ResultUtil update(@RequestBody Host host){ |
| | | AppUser appUser =new AppUser(); |
| | | |
| | | BeanUtils.copyProperties(host,appUser); |
| | | appUser.setWechatQrCode1(host.getWechatQRCode()); |
| | | appUser.setWatchApp1(host.getWatchApp()); |
| | | appUserService.updateById(appUser); |
| | | return ResultUtil.success("编辑成功"); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PutMapping("/forzen") |
| | | @ApiOperation(value = "更改状态1=正常,2=冻结,3=删除", tags = {"后台-用户管理"}) |
| | | public ResultUtil frozen(String ids,Integer status){ |
| | | String[] split = ids.split(","); |
| | | for (String s : split) { |
| | | |
| | | |
| | | AppUser appUser = appUserService.selectById(Integer.valueOf(s)); |
| | | appUser.setStatus(status); |
| | | appUserService.updateById(appUser); |
| | | } |
| | | String res = ""; |
| | | switch (status) { |
| | | case 1: |
| | | res = "解冻"; |
| | | break; |
| | | case 2: |
| | | res = "冻结"; |
| | | break; |
| | | case 3: |
| | | res = "删除"; |
| | | break; |
| | | } |
| | | return ResultUtil.success(res+"成功"); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping (value = "/list") |
| | | @ApiOperation(value = "查询用户(房东)", tags = {"后台-用户管理"},response = Host.class) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "nickname", value = "微信昵称", required = false), |
| | | @ApiImplicitParam(name = "userType", value = "用户类型(1=普通,2=房东)",dataType = "int",required = false), |
| | | @ApiImplicitParam(name = "status", value = "状态(1=正常,2=冻结,3=删除)",dataType = "int",required = false), |
| | | @ApiImplicitParam(name = "phone", value = "电话",required = false), |
| | | @ApiImplicitParam(name = "pageNo", required = false), |
| | | @ApiImplicitParam(name = "pageNum", required = false), |
| | | @ApiImplicitParam(name = "pageSize",required = false), |
| | | |
| | | }) |
| | | public List<Host> list(String nickname,Integer userType,Integer status,String phone,int pageNo, int pageSize){ |
| | | int index = (pageNo-1)*pageSize; |
| | | int size = pageSize; |
| | | List<Host> hosts = appUserService.listHost(nickname,userType,status,phone,index,size); |
| | | return hosts; |
| | | public Object list(String nickname,Integer userType,Integer status,String phone,@RequestParam() int pageNum, @RequestParam()int pageSize){ |
| | | // int index = (pageNum-1)*pageSize; |
| | | // int size = pageSize; |
| | | |
| | | |
| | | PageHelper.startPage(pageNum,pageSize); |
| | | List<Host> hosts = appUserService.listHost(nickname,userType,status,phone); |
| | | |
| | | PageInfo<Host> info=new PageInfo<>(hosts); |
| | | System.err.println(info); |
| | | |
| | | return info; |
| | | } |
| | | |
| | | } |