Jelajahi Sumber

add 客户端用户

he2802 4 tahun lalu
induk
melakukan
e52365d77d

+ 112 - 0
zhongzheng-admin/src/main/java/com/zhongzheng/controller/user/UserController.java

@@ -0,0 +1,112 @@
+package com.zhongzheng.controller.user;
+
+import java.util.List;
+import java.util.Arrays;
+
+import com.zhongzheng.modules.user.bo.UserAddBo;
+import com.zhongzheng.modules.user.bo.UserEditBo;
+import com.zhongzheng.modules.user.bo.UserQueryBo;
+import com.zhongzheng.modules.user.service.IUserService;
+import com.zhongzheng.modules.user.vo.UserVo;
+import lombok.RequiredArgsConstructor;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.zhongzheng.common.annotation.Log;
+import com.zhongzheng.common.core.controller.BaseController;
+import com.zhongzheng.common.core.domain.AjaxResult;
+import com.zhongzheng.common.enums.BusinessType;
+import com.zhongzheng.common.utils.poi.ExcelUtil;
+import com.zhongzheng.common.core.page.TableDataInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+/**
+ * 客户端用户Controller
+ *
+ * @author ruoyi
+ * @date 2021-06-08
+ */
+@Api(value = "客户端用户控制器", tags = {"客户端用户管理"})
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
+@RestController
+@RequestMapping("/app/user")
+public class UserController extends BaseController {
+
+    private final IUserService iUserService;
+
+    /**
+     * 查询客户端用户列表
+     */
+    @ApiOperation("查询客户端用户列表")
+    @PreAuthorize("@ss.hasPermi('system:user:list')")
+    @GetMapping("/list")
+    public TableDataInfo<UserVo> list(UserQueryBo bo) {
+        startPage();
+        List<UserVo> list = iUserService.queryList(bo);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出客户端用户列表
+     */
+    @ApiOperation("导出客户端用户列表")
+    @PreAuthorize("@ss.hasPermi('system:user:export')")
+    @Log(title = "客户端用户", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult<UserVo> export(UserQueryBo bo) {
+        List<UserVo> list = iUserService.queryList(bo);
+        ExcelUtil<UserVo> util = new ExcelUtil<UserVo>(UserVo.class);
+        return util.exportExcel(list, "客户端用户");
+    }
+
+    /**
+     * 获取客户端用户详细信息
+     */
+    @ApiOperation("获取客户端用户详细信息")
+    @PreAuthorize("@ss.hasPermi('system:user:query')")
+    @GetMapping("/{userId}")
+    public AjaxResult<UserVo> getInfo(@PathVariable("userId" ) Long userId) {
+        return AjaxResult.success(iUserService.queryById(userId));
+    }
+
+    /**
+     * 新增客户端用户
+     */
+    @ApiOperation("新增客户端用户")
+    @PreAuthorize("@ss.hasPermi('system:user:add')")
+    @Log(title = "客户端用户", businessType = BusinessType.INSERT)
+    @PostMapping()
+    public AjaxResult<Void> add(@RequestBody UserAddBo bo) {
+        return toAjax(iUserService.insertByAddBo(bo) ? 1 : 0);
+    }
+
+    /**
+     * 修改客户端用户
+     */
+    @ApiOperation("修改客户端用户")
+    @PreAuthorize("@ss.hasPermi('system:user:edit')")
+    @Log(title = "客户端用户", businessType = BusinessType.UPDATE)
+    @PostMapping("/edit")
+    public AjaxResult<Void> edit(@RequestBody UserEditBo bo) {
+        return toAjax(iUserService.updateByEditBo(bo) ? 1 : 0);
+    }
+
+    /**
+     * 删除客户端用户
+     */
+    @ApiOperation("删除客户端用户")
+    @PreAuthorize("@ss.hasPermi('system:user:remove')")
+    @Log(title = "客户端用户" , businessType = BusinessType.DELETE)
+    @PostMapping("/delete")
+    public AjaxResult<Void> remove(@PathVariable Long[] userIds) {
+        return toAjax(iUserService.deleteWithValidByIds(Arrays.asList(userIds), true) ? 1 : 0);
+    }
+}

+ 13 - 4
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/bo/UserAddBo.java

@@ -9,13 +9,13 @@ import java.util.Date;
 
 
 /**
- * 用户添加对象 user
+ * 客户端用户添加对象 user
  *
- * @author change
- * @date 2021-05-25
+ * @author ruoyi
+ * @date 2021-06-08
  */
 @Data
-@ApiModel("用户添加对象")
+@ApiModel("客户端用户添加对象")
 public class UserAddBo {
 
     /** 账号 */
@@ -78,4 +78,13 @@ public class UserAddBo {
     /** 用户积分 */
     @ApiModelProperty("用户积分")
     private Long integral;
+    /** 添加时间 */
+    @ApiModelProperty("添加时间")
+    private Long createTime;
+    /** 修改时间 */
+    @ApiModelProperty("修改时间")
+    private Long updateTime;
+    /** 状态 1正常 0关闭 */
+    @ApiModelProperty("状态 1正常 0关闭")
+    private Integer status;
 }

+ 12 - 4
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/bo/UserEditBo.java

@@ -8,13 +8,13 @@ import java.util.Date;
 
 
 /**
- * 用户编辑对象 user
+ * 客户端用户编辑对象 user
  *
- * @author change
- * @date 2021-05-25
+ * @author ruoyi
+ * @date 2021-06-08
  */
 @Data
-@ApiModel("用户编辑对象")
+@ApiModel("客户端用户编辑对象")
 public class UserEditBo {
 
 
@@ -101,4 +101,12 @@ public class UserEditBo {
     /** 用户积分 */
     @ApiModelProperty("用户积分")
     private Long integral;
+
+    /** 修改时间 */
+    @ApiModelProperty("修改时间")
+    private Long updateTime;
+
+    /** 状态 1正常 0关闭 */
+    @ApiModelProperty("状态 1正常 0关闭")
+    private Integer status;
 }

+ 8 - 4
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/bo/UserQueryBo.java

@@ -6,20 +6,21 @@ import lombok.Data;
 import lombok.EqualsAndHashCode;
 
 import java.util.Date;
+import java.util.List;
 import java.util.Map;
 import java.util.HashMap;
 
 import com.zhongzheng.common.core.domain.BaseEntity;
 
 /**
- * 用户分页查询对象 user
+ * 客户端用户分页查询对象 user
  *
- * @author change
- * @date 2021-05-25
+ * @author ruoyi
+ * @date 2021-06-08
  */
 @Data
 @EqualsAndHashCode(callSuper = true)
-@ApiModel("用户分页查询对象")
+@ApiModel("客户端用户分页查询对象")
 public class UserQueryBo extends BaseEntity {
 
 	/** 分页大小 */
@@ -96,5 +97,8 @@ public class UserQueryBo extends BaseEntity {
 	/** 用户积分 */
 	@ApiModelProperty("用户积分")
 	private Long integral;
+	/** 状态 1正常 0关闭 */
+	@ApiModelProperty("状态 1正常 0关闭")
+	private List<Integer> status;
 
 }

+ 12 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/domain/User.java

@@ -11,7 +11,7 @@ import com.zhongzheng.common.annotation.Excel;
 
 /**
  * 用户对象 user
- * 
+ *
  * @author change
  * @date 2021-05-25
  */
@@ -88,4 +88,15 @@ private static final long serialVersionUID=1L;
     /** 用户积分 */
     private Long integral;
 
+    /** 添加时间 */
+    @TableField(fill = FieldFill.INSERT)
+    private Long createTime;
+
+    /** 修改时间 */
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private Long updateTime;
+
+    /** 状态 1正常 0关闭 */
+    private Integer status;
+
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserServiceImpl.java

@@ -59,6 +59,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
         lqw.eq(StrUtil.isNotBlank(bo.getProvince()), User::getProvince, bo.getProvince());
         lqw.eq(StrUtil.isNotBlank(bo.getCity()), User::getCity, bo.getCity());
         lqw.eq(bo.getIntegral() != null, User::getIntegral, bo.getIntegral());
+        lqw.in(bo.getStatus() != null, User::getStatus, bo.getStatus());
         return entity2Vo(this.list(lqw));
     }
 
@@ -86,6 +87,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
     public Boolean insertByAddBo(UserAddBo bo) {
         User add = BeanUtil.toBean(bo, User.class);
         validEntityBeforeSave(add);
+        add.setCreateTime(DateUtils.getNowTime());
+        add.setUpdateTime(DateUtils.getNowTime());
         return this.save(add);
     }
 
@@ -93,6 +96,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
     public Boolean updateByEditBo(UserEditBo bo) {
         User update = BeanUtil.toBean(bo, User.class);
         validEntityBeforeSave(update);
+        update.setUpdateTime(DateUtils.getNowTime());
         return this.updateById(update);
     }
 

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/vo/UserVo.java

@@ -104,5 +104,9 @@ public class UserVo {
 	@Excel(name = "用户积分")
 	@ApiModelProperty("用户积分")
 	private Long integral;
+	/** 状态 1正常 0关闭 */
+	@Excel(name = "状态 1正常 0关闭")
+	@ApiModelProperty("状态 1正常 0关闭")
+	private Integer status;
 
 }

+ 4 - 1
zhongzheng-system/src/main/resources/mapper/modules/user/UserMapper.xml

@@ -26,7 +26,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="province" column="province"/>
         <result property="city" column="city"/>
         <result property="integral" column="integral"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="status" column="status"/>
     </resultMap>
 
 
-</mapper>
+</mapper>