From 1300cd0e47d9f0890d972bafeba888d10395ed38 Mon Sep 17 00:00:00 2001
From: luo <2855143437@qq.com>
Date: 星期五, 08 十二月 2023 09:08:25 +0800
Subject: [PATCH] 12.8

---
 guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/HostController.java |   57 +++++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 53 insertions(+), 4 deletions(-)

diff --git a/guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/HostController.java b/guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/HostController.java
index 6d83bcf..fb4ab48 100644
--- a/guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/HostController.java
+++ b/guns-management/src/main/java/com/stylefeng/guns/modular/code/controller/HostController.java
@@ -3,7 +3,10 @@
 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;
@@ -32,19 +35,20 @@
     @ResponseBody
     @PostMapping("/add")
     @ApiOperation(value = "添加用户", tags = {"后台-用户管理"})
-    public ResultUtil addHost(@RequestBody Host host){
+    public ResultUtil addHost( Host host){
        System.out.println("===================添加房东==");
        AppUser appUser = new AppUser();
         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);
@@ -52,9 +56,46 @@
         BeanUtils.copyProperties(appUser,host);
         return host;
     }
+
+
+    @ResponseBody
+    @PutMapping("/update")
+    @ApiOperation(value = "编辑用户信息", tags = {"后台-用户管理"})
+    public ResultUtil update(Host host){
+        AppUser appUser =new AppUser();
+        BeanUtils.copyProperties(host,appUser);
+        appUserService.updateById(appUser);
+        return ResultUtil.success("编辑成功");
+    }
+
+    @ResponseBody
+    @PutMapping("/forzen")
+    @ApiOperation(value = "更改状态1=正常,2=冻结,3=删除", tags = {"后台-用户管理"})
+    public ResultUtil frozen(Integer id,Integer status){
+        AppUser appUser = appUserService.selectById(id);
+        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 ("/list")
-    @ApiOperation(value = "查询用户", tags = {"后台-用户管理"})
+    @ApiOperation(value = "查询用户(房东)", tags = {"后台-用户管理"})
     @ApiImplicitParams({
             @ApiImplicitParam(name = "nickname", value = "微信昵称", required = false),
             @ApiImplicitParam(name = "userType", value = "用户类型(1=普通,2=房东)",dataType = "int",required = false),
@@ -64,10 +105,18 @@
             @ApiImplicitParam(name = "pageSize",required = false),
 
     })
-    public List<Host> list(String nickname,Integer userType,Integer status,String phone,int pageNo, int pageSize){
+    public List<Host> list(String nickname,Integer userType,Integer status,String phone,@RequestParam() int pageNo, @RequestParam()int pageSize){
         int index = (pageNo-1)*pageSize;
         int size = pageSize;
+
+
+
         List<Host>  hosts =  appUserService.listHost(nickname,userType,status,phone,index,size);
+
+        PageHelper.startPage(0,4);
+        PageInfo<Host> info=new PageInfo<>(hosts);
+        System.err.println(info);
+
         return hosts;
     }
 

--
Gitblit v1.7.1