From 7fa0a141a3c88ca90c67c966260bf26f03f255da Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Tue, 07 Jun 2022 16:00:09 +0800
Subject: [PATCH] 20220606

---
 src/main/java/com/xcong/farmer/cms/modules/system/entity/WebSetEntity.java                   |    2 
 src/main/java/com/xcong/farmer/cms/modules/system/dto/AdminUpdatePasswordDto.java            |   16 +
 src/main/java/com/xcong/farmer/cms/modules/system/service/IBelongService.java                |   21 +
 src/main/java/com/xcong/farmer/cms/modules/system/Controller/AdminBelongController.java      |   57 +++++
 src/main/java/com/xcong/farmer/cms/modules/system/mapper/BelongMapper.java                   |   14 +
 src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/UserServiceImpl.java          |   46 +++
 src/main/java/com/xcong/farmer/cms/modules/system/vo/AdminSeeBelongInfoVo.java               |   27 ++
 src/main/java/com/xcong/farmer/cms/modules/system/dto/AdminUpdateBelongDto.java              |   27 ++
 src/main/java/com/xcong/farmer/cms/modules/system/mapper/MenuMapper.java                     |    2 
 src/main/java/com/xcong/farmer/cms/modules/system/entity/ColumnEntity.java                   |    2 
 src/main/resources/mapper/UserMapper.xml                                                     |    4 
 src/main/java/com/xcong/farmer/cms/modules/system/dto/AdminAddUserDto.java                   |    3 
 src/main/java/com/xcong/farmer/cms/modules/system/entity/ArticleEntity.java                  |    2 
 src/main/java/com/xcong/farmer/cms/modules/system/vo/AdminUserVo.java                        |    3 
 src/main/java/com/xcong/farmer/cms/modules/system/entity/MenuEntity.java                     |    2 
 src/main/java/com/xcong/farmer/cms/modules/system/service/IUserService.java                  |    7 
 src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/RoleServiceImpl.java          |    8 
 src/main/java/com/xcong/farmer/cms/modules/system/entity/NavigationBarEntity.java            |    2 
 src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/WebSetServiceImpl.java        |   14 +
 src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/NavigationBarServiceImpl.java |   14 +
 src/main/java/com/xcong/farmer/cms/modules/system/vo/AdminBelongVo.java                      |   27 ++
 src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/BelongServiceImpl.java        |  150 +++++++++++++
 src/main/resources/mapper/NavigationBarMapper.xml                                            |    5 
 src/main/resources/mapper/RoleMapper.xml                                                     |    3 
 src/main/resources/mapper/ArticleMapper.xml                                                  |    3 
 src/main/java/com/xcong/farmer/cms/modules/system/Controller/AdminUserController.java        |   11 
 src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/ColumnServiceImpl.java        |   14 +
 src/main/resources/mapper/ColumnMapper.xml                                                   |    5 
 src/main/java/com/xcong/farmer/cms/modules/system/dto/AdminAddBelongDto.java                 |   26 ++
 src/main/resources/mapper/BelongMapper.xml                                                   |   19 +
 src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/MenuServiceImpl.java          |   12 +
 src/main/resources/mapper/MenuMapper.xml                                                     |    5 
 src/main/java/com/xcong/farmer/cms/modules/system/entity/UserEntity.java                     |    2 
 src/main/java/com/xcong/farmer/cms/modules/system/mapper/ColumnMapper.java                   |    2 
 src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/ArticleServiceImpl.java       |   16 
 src/main/java/com/xcong/farmer/cms/modules/system/entity/RoleEntity.java                     |    2 
 src/main/java/com/xcong/farmer/cms/modules/system/entity/BelongEntity.java                   |   28 ++
 src/main/java/com/xcong/farmer/cms/modules/system/mapper/NavigationBarMapper.java            |    4 
 src/main/java/com/xcong/farmer/cms/modules/system/dto/AdminBelongDto.java                    |   19 +
 39 files changed, 596 insertions(+), 30 deletions(-)

diff --git a/src/main/java/com/xcong/farmer/cms/modules/system/Controller/AdminBelongController.java b/src/main/java/com/xcong/farmer/cms/modules/system/Controller/AdminBelongController.java
new file mode 100644
index 0000000..dd2dd6e
--- /dev/null
+++ b/src/main/java/com/xcong/farmer/cms/modules/system/Controller/AdminBelongController.java
@@ -0,0 +1,57 @@
+package com.xcong.farmer.cms.modules.system.Controller;
+
+import com.xcong.farmer.cms.common.response.Result;
+import com.xcong.farmer.cms.modules.system.dto.*;
+import com.xcong.farmer.cms.modules.system.service.IBelongService;
+import com.xcong.farmer.cms.modules.system.vo.AdminBelongVo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.validation.Valid;
+
+@RestController
+@RequestMapping(value = "/api/belong")
+@Slf4j
+@Api(value = "系统所属公司", tags = "系统所属公司")
+public class AdminBelongController {
+
+    @Resource
+    private IBelongService iBelongService;
+
+    @ApiOperation(value = "系统所属公司分页列表", notes = "系统所属公司分页列表")
+    @ApiResponses({@ApiResponse(code = 200, message = "ok", response = AdminBelongVo.class)})
+    @PostMapping(value = "/belongInPage")
+    public Result getBelongInPage(@RequestBody @Valid AdminBelongDto adminBelongDto) {
+        return iBelongService.getBelongInPage(adminBelongDto);
+    }
+
+    @ApiOperation(value = "系统所属公司列表", notes = "系统所属公司列表")
+    @ApiResponses({@ApiResponse(code = 200, message = "ok", response = AdminBelongVo.class)})
+    @PostMapping(value = "/belongInList")
+    public Result getBelongInList() {
+        return iBelongService.getBelongInList();
+    }
+
+    @ApiOperation(value = "添加系统所属公司", notes = "添加系统所属公司")
+    @PostMapping(value = "/addBelong")
+    public Result addBelong(@RequestBody @Valid AdminAddBelongDto adminAddBelongDto) {
+        return iBelongService.addBelong(adminAddBelongDto);
+    }
+
+    @ApiOperation(value = "查看系统所属公司", notes = "查看系统所属公司")
+    @GetMapping(value = "/seeBelongInfo/{id}")
+    public Result seeBelongInfo(@PathVariable(value = "id") Long id) {
+        return iBelongService.seeBelongInfo(id);
+    }
+
+    @ApiOperation(value = "更新系统所属公司", notes = "更新系统所属公司")
+    @PostMapping(value = "/updateBelong")
+    public Result updateBelong(@RequestBody @Valid AdminUpdateBelongDto adminUpdateBelongDto) {
+        return iBelongService.updateBelong(adminUpdateBelongDto);
+    }
+}
diff --git a/src/main/java/com/xcong/farmer/cms/modules/system/Controller/AdminUserController.java b/src/main/java/com/xcong/farmer/cms/modules/system/Controller/AdminUserController.java
index c4b342b..7495b3c 100644
--- a/src/main/java/com/xcong/farmer/cms/modules/system/Controller/AdminUserController.java
+++ b/src/main/java/com/xcong/farmer/cms/modules/system/Controller/AdminUserController.java
@@ -1,10 +1,7 @@
 package com.xcong.farmer.cms.modules.system.Controller;
 
 import com.xcong.farmer.cms.common.response.Result;
-import com.xcong.farmer.cms.modules.system.dto.AdminAddUserDto;
-import com.xcong.farmer.cms.modules.system.dto.AdminDeleteDto;
-import com.xcong.farmer.cms.modules.system.dto.AdminUpdateUserDto;
-import com.xcong.farmer.cms.modules.system.dto.AdminUserDto;
+import com.xcong.farmer.cms.modules.system.dto.*;
 import com.xcong.farmer.cms.modules.system.service.IUserService;
 import com.xcong.farmer.cms.modules.system.vo.AdminUserVo;
 import com.xcong.farmer.cms.modules.test.dto.TestUserDto;
@@ -73,6 +70,12 @@
         return iUserService.updateUser(adminUpdateUserDto);
     }
 
+    @ApiOperation(value = "修改密码", notes = "修改密码")
+    @PostMapping(value = "/updatePassword")
+    public Result updatePassword(@RequestBody @Valid AdminUpdatePasswordDto adminUpdatePasswordDto) {
+        return iUserService.updatePassword(adminUpdatePasswordDto);
+    }
+
     @ApiOperation(value = "重置密码", notes = "重置密码")
     @GetMapping(value = "/resetPassword/{id}")
     public Result resetPassword(@PathVariable(value = "id") Long id) {
diff --git a/src/main/java/com/xcong/farmer/cms/modules/system/dto/AdminAddBelongDto.java b/src/main/java/com/xcong/farmer/cms/modules/system/dto/AdminAddBelongDto.java
new file mode 100644
index 0000000..760e55e
--- /dev/null
+++ b/src/main/java/com/xcong/farmer/cms/modules/system/dto/AdminAddBelongDto.java
@@ -0,0 +1,26 @@
+package com.xcong.farmer.cms.modules.system.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+@ApiModel(value = "AdminAddBelongDto", description = "参数接收类")
+public class AdminAddBelongDto {
+
+    @ApiModelProperty(value = "名称")
+    private String name;
+
+    @ApiModelProperty(value = "编码")
+    private String code;
+
+    @ApiModelProperty(value = "网址")
+    private String webAddress;
+
+    @ApiModelProperty(value = "备注")
+    private String remark;
+
+    @ApiModelProperty(value = "图片")
+    private String pic;
+
+}
diff --git a/src/main/java/com/xcong/farmer/cms/modules/system/dto/AdminAddUserDto.java b/src/main/java/com/xcong/farmer/cms/modules/system/dto/AdminAddUserDto.java
index 489c9fd..eb49617 100644
--- a/src/main/java/com/xcong/farmer/cms/modules/system/dto/AdminAddUserDto.java
+++ b/src/main/java/com/xcong/farmer/cms/modules/system/dto/AdminAddUserDto.java
@@ -16,6 +16,9 @@
     @ApiModelProperty(value = "昵称")
     private String nickname;
 
+    @ApiModelProperty(value = "所属公司ID")
+    private Long belongId;
+
     @ApiModelProperty(value = "角色IDS")
     private String roleIds;
 
diff --git a/src/main/java/com/xcong/farmer/cms/modules/system/dto/AdminBelongDto.java b/src/main/java/com/xcong/farmer/cms/modules/system/dto/AdminBelongDto.java
new file mode 100644
index 0000000..ed678b2
--- /dev/null
+++ b/src/main/java/com/xcong/farmer/cms/modules/system/dto/AdminBelongDto.java
@@ -0,0 +1,19 @@
+package com.xcong.farmer.cms.modules.system.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+@ApiModel(value = "AdminBelongDto", description = "参数接收类")
+public class AdminBelongDto {
+
+    @ApiModelProperty(value = "名称", example = "公司")
+    private String name;
+
+    @ApiModelProperty(value = "每页条数", example = "10")
+    private Integer pageSize;
+
+    @ApiModelProperty(value = "第几页", example = "1")
+    private Integer pageNum;
+}
diff --git a/src/main/java/com/xcong/farmer/cms/modules/system/dto/AdminUpdateBelongDto.java b/src/main/java/com/xcong/farmer/cms/modules/system/dto/AdminUpdateBelongDto.java
new file mode 100644
index 0000000..a305a9c
--- /dev/null
+++ b/src/main/java/com/xcong/farmer/cms/modules/system/dto/AdminUpdateBelongDto.java
@@ -0,0 +1,27 @@
+package com.xcong.farmer.cms.modules.system.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+@ApiModel(value = "AdminUpdateBelongDto", description = "参数接收类")
+public class AdminUpdateBelongDto {
+
+    private Long id;
+
+    @ApiModelProperty(value = "名称")
+    private String name;
+
+    @ApiModelProperty(value = "编码")
+    private String code;
+
+    @ApiModelProperty(value = "网址")
+    private String webAddress;
+
+    @ApiModelProperty(value = "备注")
+    private String remark;
+
+    @ApiModelProperty(value = "图片")
+    private String pic;
+}
diff --git a/src/main/java/com/xcong/farmer/cms/modules/system/dto/AdminUpdatePasswordDto.java b/src/main/java/com/xcong/farmer/cms/modules/system/dto/AdminUpdatePasswordDto.java
new file mode 100644
index 0000000..63647c6
--- /dev/null
+++ b/src/main/java/com/xcong/farmer/cms/modules/system/dto/AdminUpdatePasswordDto.java
@@ -0,0 +1,16 @@
+package com.xcong.farmer.cms.modules.system.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+@ApiModel(value = "AdminUpdateBelongDto", description = "参数接收类")
+public class AdminUpdatePasswordDto {
+
+    @ApiModelProperty(value = "原密码")
+    private String oldPassword;
+
+    @ApiModelProperty(value = "新密码")
+    private String newPassword;
+}
diff --git a/src/main/java/com/xcong/farmer/cms/modules/system/entity/ArticleEntity.java b/src/main/java/com/xcong/farmer/cms/modules/system/entity/ArticleEntity.java
index cf303de..f7b1576 100644
--- a/src/main/java/com/xcong/farmer/cms/modules/system/entity/ArticleEntity.java
+++ b/src/main/java/com/xcong/farmer/cms/modules/system/entity/ArticleEntity.java
@@ -59,5 +59,7 @@
     private String articleDetails;
     //是否删除 0:已删除 1:未删除
     private Integer delStatus;
+    //所属ID
+    private Long belongId;
 
 }
diff --git a/src/main/java/com/xcong/farmer/cms/modules/system/entity/BelongEntity.java b/src/main/java/com/xcong/farmer/cms/modules/system/entity/BelongEntity.java
new file mode 100644
index 0000000..16bd355
--- /dev/null
+++ b/src/main/java/com/xcong/farmer/cms/modules/system/entity/BelongEntity.java
@@ -0,0 +1,28 @@
+package com.xcong.farmer.cms.modules.system.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+/**
+ * 所属公司范围表
+ */
+@Data
+@TableName("t_belong")
+public class BelongEntity {
+    //ID
+
+    @TableId(value = "id",type = IdType.AUTO)
+    private Long id;
+    //名称
+    private String name;
+    //编码
+    private String code;
+    //网址
+    private String webAddress;
+    //备注
+    private String remark;
+    //图片
+    private String pic;
+}
diff --git a/src/main/java/com/xcong/farmer/cms/modules/system/entity/ColumnEntity.java b/src/main/java/com/xcong/farmer/cms/modules/system/entity/ColumnEntity.java
index 8604dde..314d22f 100644
--- a/src/main/java/com/xcong/farmer/cms/modules/system/entity/ColumnEntity.java
+++ b/src/main/java/com/xcong/farmer/cms/modules/system/entity/ColumnEntity.java
@@ -27,4 +27,6 @@
     private String pic;
     //上级类目ID
     private Long parentId;
+    //所属ID
+    private Long belongId;
 }
diff --git a/src/main/java/com/xcong/farmer/cms/modules/system/entity/MenuEntity.java b/src/main/java/com/xcong/farmer/cms/modules/system/entity/MenuEntity.java
index 239a893..88bac4d 100644
--- a/src/main/java/com/xcong/farmer/cms/modules/system/entity/MenuEntity.java
+++ b/src/main/java/com/xcong/farmer/cms/modules/system/entity/MenuEntity.java
@@ -32,4 +32,6 @@
     private Integer orderNum;
     //父级ID
     private Long parentId;
+    //所属ID
+    private Long belongId;
 }
diff --git a/src/main/java/com/xcong/farmer/cms/modules/system/entity/NavigationBarEntity.java b/src/main/java/com/xcong/farmer/cms/modules/system/entity/NavigationBarEntity.java
index 7872f53..ec6af4b 100644
--- a/src/main/java/com/xcong/farmer/cms/modules/system/entity/NavigationBarEntity.java
+++ b/src/main/java/com/xcong/farmer/cms/modules/system/entity/NavigationBarEntity.java
@@ -27,5 +27,7 @@
     private String pic;
     //上级类目ID
     private Long parentId;
+    //所属ID
+    private Long belongId;
 
 }
diff --git a/src/main/java/com/xcong/farmer/cms/modules/system/entity/RoleEntity.java b/src/main/java/com/xcong/farmer/cms/modules/system/entity/RoleEntity.java
index 153ce47..94f2778 100644
--- a/src/main/java/com/xcong/farmer/cms/modules/system/entity/RoleEntity.java
+++ b/src/main/java/com/xcong/farmer/cms/modules/system/entity/RoleEntity.java
@@ -14,4 +14,6 @@
     private String roleName;
     //拓展备注
     private String remark;
+    //所属ID
+    private Long belongId;
 }
diff --git a/src/main/java/com/xcong/farmer/cms/modules/system/entity/UserEntity.java b/src/main/java/com/xcong/farmer/cms/modules/system/entity/UserEntity.java
index 10e9376..bd346e4 100644
--- a/src/main/java/com/xcong/farmer/cms/modules/system/entity/UserEntity.java
+++ b/src/main/java/com/xcong/farmer/cms/modules/system/entity/UserEntity.java
@@ -40,4 +40,6 @@
     private Integer status;
     //拓展备注
     private String remark;
+    //所属ID
+    private Long belongId;
 }
diff --git a/src/main/java/com/xcong/farmer/cms/modules/system/entity/WebSetEntity.java b/src/main/java/com/xcong/farmer/cms/modules/system/entity/WebSetEntity.java
index 85f0774..24d6a2c 100644
--- a/src/main/java/com/xcong/farmer/cms/modules/system/entity/WebSetEntity.java
+++ b/src/main/java/com/xcong/farmer/cms/modules/system/entity/WebSetEntity.java
@@ -23,4 +23,6 @@
     private String webRemark;
     //网页LOGO
     private String webPic;
+    //所属ID
+    private Long belongId;
 }
diff --git a/src/main/java/com/xcong/farmer/cms/modules/system/mapper/BelongMapper.java b/src/main/java/com/xcong/farmer/cms/modules/system/mapper/BelongMapper.java
new file mode 100644
index 0000000..5b4473f
--- /dev/null
+++ b/src/main/java/com/xcong/farmer/cms/modules/system/mapper/BelongMapper.java
@@ -0,0 +1,14 @@
+package com.xcong.farmer.cms.modules.system.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.xcong.farmer.cms.modules.system.entity.BelongEntity;
+import com.xcong.farmer.cms.modules.system.vo.AdminBelongVo;
+import org.apache.ibatis.annotations.Param;
+
+public interface BelongMapper extends BaseMapper<BelongEntity> {
+
+    IPage<AdminBelongVo> selectAdminBelongInPage(Page<AdminBelongVo> page, @Param("record")BelongEntity belongEntity);
+
+}
diff --git a/src/main/java/com/xcong/farmer/cms/modules/system/mapper/ColumnMapper.java b/src/main/java/com/xcong/farmer/cms/modules/system/mapper/ColumnMapper.java
index e23ce47..cf96271 100644
--- a/src/main/java/com/xcong/farmer/cms/modules/system/mapper/ColumnMapper.java
+++ b/src/main/java/com/xcong/farmer/cms/modules/system/mapper/ColumnMapper.java
@@ -13,5 +13,5 @@
 
     IPage<AdminColumnVo> selectAdminColumnVoInPage(Page<AdminColumnVo> page, @Param("record")ColumnEntity columnEntity);
 
-    List<AdminColumnVo> selectColumnInListByParentId(@Param("parentId")Long parentidDefault);
+    List<AdminColumnVo> selectColumnInListByParentId(@Param("parentId")Long parentidDefault,@Param("belongId")Long belongId);
 }
diff --git a/src/main/java/com/xcong/farmer/cms/modules/system/mapper/MenuMapper.java b/src/main/java/com/xcong/farmer/cms/modules/system/mapper/MenuMapper.java
index 8c4c131..8a82006 100644
--- a/src/main/java/com/xcong/farmer/cms/modules/system/mapper/MenuMapper.java
+++ b/src/main/java/com/xcong/farmer/cms/modules/system/mapper/MenuMapper.java
@@ -16,7 +16,7 @@
 
     AdminUserMenuVo selectAdminRoleMenuVoById(@Param("id")Long parentId);
 
-    List<AdminMenuVo> selectAdminMenuVoInListByParentId(@Param("parentId")Long parentIdDefault);
+    List<AdminMenuVo> selectAdminMenuVoInListByParentId(@Param("parentId")Long parentIdDefault,@Param("belongId")Long belongId);
 
     MenuEntity selectMenuEntityByIdAndParentId(@Param("menuId")Long menuId, @Param("parentId")Long parentidDefault);
 }
diff --git a/src/main/java/com/xcong/farmer/cms/modules/system/mapper/NavigationBarMapper.java b/src/main/java/com/xcong/farmer/cms/modules/system/mapper/NavigationBarMapper.java
index a63e11b..3493e79 100644
--- a/src/main/java/com/xcong/farmer/cms/modules/system/mapper/NavigationBarMapper.java
+++ b/src/main/java/com/xcong/farmer/cms/modules/system/mapper/NavigationBarMapper.java
@@ -13,7 +13,7 @@
 
     IPage<AdminNavigationBarVo> selectAdminNavigationBarVoInPage(Page<AdminNavigationBarVo> page, @Param("record")NavigationBarEntity navigationBarEntity);
 
-    List<AdminNavigationBarVo> selectAdminNavigationBarVoByParentId(@Param("parentId")Long parentidDefault);
+    List<AdminNavigationBarVo> selectAdminNavigationBarVoByParentId(@Param("parentId")Long parentidDefault,@Param("belongId")Long belongId);
 
-    List<NavigationBarEntity> selectListByParentId(@Param("parentId")Long id);
+    List<NavigationBarEntity> selectListByParentId(@Param("parentId")Long id,@Param("belongId")Long belongId);
 }
diff --git a/src/main/java/com/xcong/farmer/cms/modules/system/service/IBelongService.java b/src/main/java/com/xcong/farmer/cms/modules/system/service/IBelongService.java
new file mode 100644
index 0000000..0d6c778
--- /dev/null
+++ b/src/main/java/com/xcong/farmer/cms/modules/system/service/IBelongService.java
@@ -0,0 +1,21 @@
+package com.xcong.farmer.cms.modules.system.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.xcong.farmer.cms.common.response.Result;
+import com.xcong.farmer.cms.modules.system.dto.AdminAddBelongDto;
+import com.xcong.farmer.cms.modules.system.dto.AdminBelongDto;
+import com.xcong.farmer.cms.modules.system.dto.AdminUpdateBelongDto;
+import com.xcong.farmer.cms.modules.system.entity.BelongEntity;
+
+public interface IBelongService  extends IService<BelongEntity> {
+
+    Result getBelongInPage(AdminBelongDto adminBelongDto);
+
+    Result addBelong(AdminAddBelongDto adminAddBelongDto);
+
+    Result seeBelongInfo(Long id);
+
+    Result updateBelong(AdminUpdateBelongDto adminUpdateBelongDto);
+
+    Result getBelongInList();
+}
diff --git a/src/main/java/com/xcong/farmer/cms/modules/system/service/IUserService.java b/src/main/java/com/xcong/farmer/cms/modules/system/service/IUserService.java
index 42816ec..c060d58 100644
--- a/src/main/java/com/xcong/farmer/cms/modules/system/service/IUserService.java
+++ b/src/main/java/com/xcong/farmer/cms/modules/system/service/IUserService.java
@@ -2,10 +2,7 @@
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.xcong.farmer.cms.common.response.Result;
-import com.xcong.farmer.cms.modules.system.dto.AdminAddUserDto;
-import com.xcong.farmer.cms.modules.system.dto.AdminDeleteDto;
-import com.xcong.farmer.cms.modules.system.dto.AdminUpdateUserDto;
-import com.xcong.farmer.cms.modules.system.dto.AdminUserDto;
+import com.xcong.farmer.cms.modules.system.dto.*;
 import com.xcong.farmer.cms.modules.system.entity.UserEntity;
 
 public interface IUserService extends IService<UserEntity> {
@@ -29,4 +26,6 @@
     Result userMenu();
 
     Result delObjs(AdminDeleteDto adminDeleteDto);
+
+    Result updatePassword(AdminUpdatePasswordDto adminUpdatePasswordDto);
 }
diff --git a/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/ArticleServiceImpl.java b/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/ArticleServiceImpl.java
index 475b739..4bf31f5 100644
--- a/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/ArticleServiceImpl.java
+++ b/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/ArticleServiceImpl.java
@@ -12,10 +12,12 @@
 import com.xcong.farmer.cms.modules.system.dto.AdminUpdateArticleDto;
 import com.xcong.farmer.cms.modules.system.entity.ArticleEntity;
 import com.xcong.farmer.cms.modules.system.entity.ColumnEntity;
+import com.xcong.farmer.cms.modules.system.entity.UserEntity;
 import com.xcong.farmer.cms.modules.system.entity.UserRoleEntity;
 import com.xcong.farmer.cms.modules.system.mapper.ArticleMapper;
 import com.xcong.farmer.cms.modules.system.mapper.ColumnMapper;
 import com.xcong.farmer.cms.modules.system.service.IArticleService;
+import com.xcong.farmer.cms.modules.system.util.LoginUserUtil;
 import com.xcong.farmer.cms.modules.system.vo.AdminArticleVo;
 import com.xcong.farmer.cms.modules.system.vo.AdminSeeArticleInfoVo;
 import lombok.extern.slf4j.Slf4j;
@@ -40,6 +42,8 @@
 
     @Override
     public Result getArticleInPage(AdminArticleDto adminArticleDto) {
+        UserEntity userlogin = LoginUserUtil.getLoginUser();
+        long belongId = userlogin.getBelongId() == null ? 0L : userlogin.getBelongId();
         Page<AdminArticleVo> page = new Page<>(adminArticleDto.getPageNum(), adminArticleDto.getPageSize());
         ArticleEntity articleEntity = new ArticleEntity();
         Long columnId = adminArticleDto.getColumnId() == null ? 0L : adminArticleDto.getColumnId();
@@ -50,6 +54,7 @@
         if(StrUtil.isNotEmpty(title)){
             articleEntity.setTitle(title);
         }
+        articleEntity.setBelongId(belongId);
         IPage<AdminArticleVo> list = this.baseMapper.selectAdminArticleInPage(page,articleEntity);
         return Result.ok(list);
     }
@@ -57,7 +62,10 @@
     @Override
     @Transactional
     public Result addArticle(AdminAddArticleDto adminAddArticleDto) {
+        UserEntity userlogin = LoginUserUtil.getLoginUser();
+        long belongId = userlogin.getBelongId() == null ? 0L : userlogin.getBelongId();
         ArticleEntity articleEntity = new ArticleEntity();
+        articleEntity.setBelongId(belongId);
         String title = adminAddArticleDto.getTitle();
         if(StrUtil.isEmpty(title)){
             return Result.fail("请输入文章标题");
@@ -174,9 +182,7 @@
             articleEntity.setMainDiagram(mainDiagram);
         }
         String atlas = adminUpdateArticleDto.getAtlas();
-        if(StrUtil.isNotEmpty(atlas)){
-            articleEntity.setAtlas(atlas);
-        }
+        articleEntity.setAtlas(atlas);
         Date releaseTime = adminUpdateArticleDto.getReleaseTime();
         if(ObjectUtil.isNotEmpty(releaseTime)){
             articleEntity.setReleaseTime(releaseTime);
@@ -187,9 +193,7 @@
         }
         articleEntity.setReleaseStatus(releaseStatus);
         String articleDetails = adminUpdateArticleDto.getArticleDetails();
-        if(StrUtil.isNotEmpty(articleDetails)){
-            articleEntity.setArticleDetails(articleDetails);
-        }
+        articleEntity.setArticleDetails(articleDetails);
         this.baseMapper.updateById(articleEntity);
         return Result.ok("更新成功");
     }
diff --git a/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/BelongServiceImpl.java b/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/BelongServiceImpl.java
new file mode 100644
index 0000000..e4ff304
--- /dev/null
+++ b/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/BelongServiceImpl.java
@@ -0,0 +1,150 @@
+package com.xcong.farmer.cms.modules.system.service.Impl;
+
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.xcong.farmer.cms.common.response.Result;
+import com.xcong.farmer.cms.modules.system.dto.AdminAddBelongDto;
+import com.xcong.farmer.cms.modules.system.dto.AdminBelongDto;
+import com.xcong.farmer.cms.modules.system.dto.AdminUpdateBelongDto;
+import com.xcong.farmer.cms.modules.system.entity.BelongEntity;
+import com.xcong.farmer.cms.modules.system.entity.UserEntity;
+import com.xcong.farmer.cms.modules.system.mapper.BelongMapper;
+import com.xcong.farmer.cms.modules.system.service.IBelongService;
+import com.xcong.farmer.cms.modules.system.util.LoginUserUtil;
+import com.xcong.farmer.cms.modules.system.vo.AdminBelongVo;
+import com.xcong.farmer.cms.modules.system.vo.AdminSeeBelongInfoVo;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+import cn.hutool.core.collection.CollUtil;
+
+import cn.hutool.core.util.ObjectUtil;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+@Slf4j
+public class BelongServiceImpl extends ServiceImpl<BelongMapper, BelongEntity> implements IBelongService {
+    @Override
+    public Result getBelongInPage(AdminBelongDto adminBelongDto) {
+        Page<AdminBelongVo> page = new Page<>(adminBelongDto.getPageNum(), adminBelongDto.getPageSize());
+        BelongEntity belongEntity = new BelongEntity();
+        String name = adminBelongDto.getName();
+        if(StrUtil.isNotEmpty(name)){
+            belongEntity.setName(name);
+        }
+        IPage<AdminBelongVo> list = this.baseMapper.selectAdminBelongInPage(page,belongEntity);
+        return Result.ok(list);
+    }
+
+    @Override
+    @Transactional
+    public Result addBelong(AdminAddBelongDto adminAddBelongDto) {
+        String name = adminAddBelongDto.getName();
+        if(StrUtil.isEmpty(name)){
+            return Result.fail("请输入名称");
+        }
+        String code = adminAddBelongDto.getCode();
+        if(StrUtil.isEmpty(code)){
+            return Result.fail("请输入编码");
+        }
+        QueryWrapper<BelongEntity> objectQueryWrapper = new QueryWrapper<>();
+        objectQueryWrapper.eq("code",code);
+        List<BelongEntity> belongEntities = this.baseMapper.selectList(objectQueryWrapper);
+        if(CollUtil.isNotEmpty(belongEntities)){
+            return Result.fail("编码已存在,请重新输入");
+        }
+        BelongEntity belongEntity = new BelongEntity();
+        belongEntity.setName(name);
+        belongEntity.setCode(code);
+        String webAddress = adminAddBelongDto.getWebAddress();
+        if(StrUtil.isNotEmpty(webAddress)){
+            belongEntity.setWebAddress(webAddress);
+        }
+        String remark = adminAddBelongDto.getRemark();
+        if(StrUtil.isNotEmpty(remark)){
+            belongEntity.setRemark(remark);
+        }
+        String pic = adminAddBelongDto.getPic();
+        if(StrUtil.isNotEmpty(pic)){
+            belongEntity.setPic(pic);
+        }
+        this.baseMapper.insert(belongEntity);
+        return Result.ok("添加成功");
+    }
+
+    @Override
+    public Result seeBelongInfo(Long id) {
+        BelongEntity belongEntity = this.baseMapper.selectById(id);
+        if(ObjectUtil.isEmpty(belongEntity)){
+            Result.fail("所属公司不存在");
+        }
+        AdminSeeBelongInfoVo adminSeeBelongInfoVo = new AdminSeeBelongInfoVo();
+        adminSeeBelongInfoVo.setId(belongEntity.getId());
+        adminSeeBelongInfoVo.setName(belongEntity.getName());
+        adminSeeBelongInfoVo.setCode(belongEntity.getCode());
+        adminSeeBelongInfoVo.setRemark(belongEntity.getRemark());
+        adminSeeBelongInfoVo.setWebAddress(belongEntity.getWebAddress());
+        adminSeeBelongInfoVo.setPic(belongEntity.getPic());
+        return Result.ok(adminSeeBelongInfoVo);
+    }
+
+    @Override
+    @Transactional
+    public Result updateBelong(AdminUpdateBelongDto adminUpdateBelongDto) {
+        Long id = adminUpdateBelongDto.getId();
+        BelongEntity belongEntity = this.baseMapper.selectById(id);
+        if(ObjectUtil.isEmpty(belongEntity)){
+            Result.fail("所属公司不存在");
+        }
+        String name = adminUpdateBelongDto.getName();
+        if(StrUtil.isEmpty(name)){
+            return Result.fail("请输入名称");
+        }
+        belongEntity.setName(name);
+        String code = adminUpdateBelongDto.getCode();
+        if(StrUtil.isEmpty(code)){
+            return Result.fail("请输入编码");
+        }
+        if(!belongEntity.getCode().equals(code)){
+            QueryWrapper<BelongEntity> objectQueryWrapper = new QueryWrapper<>();
+            objectQueryWrapper.eq("code",code);
+            List<BelongEntity> belongEntities = this.baseMapper.selectList(objectQueryWrapper);
+            if(CollUtil.isNotEmpty(belongEntities)){
+                return Result.fail("编码已存在,请重新输入");
+            }
+            belongEntity.setCode(code);
+        }
+        belongEntity.setWebAddress(adminUpdateBelongDto.getWebAddress());
+        belongEntity.setRemark(adminUpdateBelongDto.getRemark());
+        belongEntity.setPic(adminUpdateBelongDto.getPic());
+        this.baseMapper.updateById(belongEntity);
+        return Result.ok("更新成功");
+    }
+
+    @Override
+    public Result getBelongInList() {
+        UserEntity userlogin = LoginUserUtil.getLoginUser();
+        Long belongId = userlogin.getBelongId();
+        QueryWrapper<BelongEntity> objectQueryWrapper = new QueryWrapper<>();
+        if(belongId != 0L){
+            objectQueryWrapper.eq("id",belongId);
+        }
+        List<BelongEntity> belongEntities = this.baseMapper.selectList(objectQueryWrapper);
+        List<AdminBelongVo> adminBelongVos = new ArrayList<>();
+        if(CollUtil.isNotEmpty(belongEntities)){
+            for(BelongEntity belongEntity : belongEntities){
+                AdminBelongVo adminBelongVo = new AdminBelongVo();
+                adminBelongVo.setId(belongEntity.getId());
+                adminBelongVo.setName(belongEntity.getName());
+                adminBelongVo.setCode(belongEntity.getCode());
+                adminBelongVos.add(adminBelongVo);
+            }
+        }
+        return Result.ok(adminBelongVos);
+    }
+}
diff --git a/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/ColumnServiceImpl.java b/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/ColumnServiceImpl.java
index 934ac05..d5aeb3a 100644
--- a/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/ColumnServiceImpl.java
+++ b/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/ColumnServiceImpl.java
@@ -13,8 +13,10 @@
 import com.xcong.farmer.cms.modules.system.dto.AdminUpdateColumnDto;
 import com.xcong.farmer.cms.modules.system.entity.ColumnEntity;
 import com.xcong.farmer.cms.modules.system.entity.NavigationBarEntity;
+import com.xcong.farmer.cms.modules.system.entity.UserEntity;
 import com.xcong.farmer.cms.modules.system.mapper.ColumnMapper;
 import com.xcong.farmer.cms.modules.system.service.IColumnService;
+import com.xcong.farmer.cms.modules.system.util.LoginUserUtil;
 import com.xcong.farmer.cms.modules.system.vo.AdminColumnVo;
 import com.xcong.farmer.cms.modules.system.vo.AdminSeeColumnInfoVo;
 import lombok.extern.slf4j.Slf4j;
@@ -32,8 +34,11 @@
 public class ColumnServiceImpl extends ServiceImpl<ColumnMapper, ColumnEntity> implements IColumnService {
     @Override
     public Result getColumnInPage(AdminColumnDto adminColumnDto) {
+        UserEntity userlogin = LoginUserUtil.getLoginUser();
+        long belongId = userlogin.getBelongId() == null ? 0L : userlogin.getBelongId();
         Page<AdminColumnVo> page = new Page<>(adminColumnDto.getPageNum(), adminColumnDto.getPageSize());
         ColumnEntity columnEntity = new ColumnEntity();
+        columnEntity.setBelongId(belongId);
         columnEntity.setParentId(ColumnEntity.PARENTID_DEFAULT);
         IPage<AdminColumnVo> list = this.baseMapper.selectAdminColumnVoInPage(page,columnEntity);
         List<AdminColumnVo> records = list.getRecords();
@@ -42,6 +47,7 @@
                 Long id = adminColumnVo.getId();
                 QueryWrapper<ColumnEntity> objectQueryWrapper = new QueryWrapper<>();
                 objectQueryWrapper.eq("parent_id",id);
+                objectQueryWrapper.eq("belong_id",belongId);
                 List<ColumnEntity> columnEntities = this.baseMapper.selectList(objectQueryWrapper);
                 List<AdminColumnVo> adminColumnVoChilds = new ArrayList<>();
                 if(CollUtil.isNotEmpty(columnEntities)){
@@ -65,7 +71,10 @@
     @Override
     @Transactional
     public Result addColumn(AdminAddColumnDto adminAddColumnDto) {
+        UserEntity userlogin = LoginUserUtil.getLoginUser();
+        long belongId = userlogin.getBelongId() == null ? 0L : userlogin.getBelongId();
         ColumnEntity columnEntity = new ColumnEntity();
+        columnEntity.setBelongId(belongId);
         String columnName = adminAddColumnDto.getColumnName();
         if(StrUtil.isEmpty(columnName)){
             return Result.fail("请输入栏目名称");
@@ -189,12 +198,15 @@
 
     @Override
     public Result getColumnInList() {
-        List<AdminColumnVo> records = this.baseMapper.selectColumnInListByParentId(ColumnEntity.PARENTID_DEFAULT);
+        UserEntity userlogin = LoginUserUtil.getLoginUser();
+        long belongId = userlogin.getBelongId() == null ? 0L : userlogin.getBelongId();
+        List<AdminColumnVo> records = this.baseMapper.selectColumnInListByParentId(ColumnEntity.PARENTID_DEFAULT,belongId);
         if(CollUtil.isNotEmpty(records)){
             for(AdminColumnVo adminColumnVo : records){
                 Long id = adminColumnVo.getId();
                 QueryWrapper<ColumnEntity> objectQueryWrapper = new QueryWrapper<>();
                 objectQueryWrapper.eq("parent_id",id);
+                objectQueryWrapper.eq("belong_id",belongId);
                 List<ColumnEntity> columnEntities = this.baseMapper.selectList(objectQueryWrapper);
                 List<AdminColumnVo> adminColumnVoChilds = new ArrayList<>();
                 if(CollUtil.isNotEmpty(columnEntities)){
diff --git a/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/MenuServiceImpl.java b/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/MenuServiceImpl.java
index 6507b54..044e6da 100644
--- a/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/MenuServiceImpl.java
+++ b/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/MenuServiceImpl.java
@@ -13,10 +13,12 @@
 import com.xcong.farmer.cms.modules.system.dto.AdminUpdateMenuDto;
 import com.xcong.farmer.cms.modules.system.entity.MenuEntity;
 import com.xcong.farmer.cms.modules.system.entity.RoleMenuEntity;
+import com.xcong.farmer.cms.modules.system.entity.UserEntity;
 import com.xcong.farmer.cms.modules.system.entity.UserRoleEntity;
 import com.xcong.farmer.cms.modules.system.mapper.MenuMapper;
 import com.xcong.farmer.cms.modules.system.mapper.RoleMenuMapper;
 import com.xcong.farmer.cms.modules.system.service.IMenuService;
+import com.xcong.farmer.cms.modules.system.util.LoginUserUtil;
 import com.xcong.farmer.cms.modules.system.vo.AdminMenuVo;
 import com.xcong.farmer.cms.modules.system.vo.AdminSeeMenuInfoVo;
 import lombok.extern.slf4j.Slf4j;
@@ -41,8 +43,10 @@
     @Override
     public Result getMenuInPage(AdminMenuDto adminMenuDto) {
         Page<AdminMenuVo> page = new Page<>(adminMenuDto.getPageNum(), adminMenuDto.getPageSize());
+        UserEntity userlogin = LoginUserUtil.getLoginUser();
         MenuEntity menuEntity = new MenuEntity();
         menuEntity.setParentId(MenuEntity.PARENTID_DEFAULT);
+        menuEntity.setBelongId(userlogin.getBelongId()==null?0L:userlogin.getBelongId());
         IPage<AdminMenuVo> list = this.baseMapper.selectAdminMenuVoInPage(page,menuEntity);
         List<AdminMenuVo> records = list.getRecords();
         if(CollUtil.isNotEmpty(records)){
@@ -73,6 +77,8 @@
     @Override
     @Transactional
     public Result addMenu(AdminAddMenuDto adminAddMenuDto) {
+        UserEntity userlogin = LoginUserUtil.getLoginUser();
+        long belongId = userlogin.getBelongId() == null ? 0L : userlogin.getBelongId();
         String menuName = adminAddMenuDto.getMenuName();
         if(StrUtil.isEmpty(menuName)){
             return Result.fail("请输入菜单名称");
@@ -98,6 +104,7 @@
         if(StrUtil.isNotEmpty(routeUrl)){
             menuEntity.setRouteUrl(routeUrl);
         }
+        menuEntity.setBelongId(belongId);
         this.baseMapper.insert(menuEntity);
         return Result.ok("新增成功");
     }
@@ -194,12 +201,15 @@
 
     @Override
     public Result getMenuInList() {
-        List<AdminMenuVo> records = this.baseMapper.selectAdminMenuVoInListByParentId(MenuEntity.PARENTID_DEFAULT);
+        UserEntity userlogin = LoginUserUtil.getLoginUser();
+        long belongId = userlogin.getBelongId() == null ? 0L : userlogin.getBelongId();
+        List<AdminMenuVo> records = this.baseMapper.selectAdminMenuVoInListByParentId(MenuEntity.PARENTID_DEFAULT,belongId);
         if(CollUtil.isNotEmpty(records)){
             for(AdminMenuVo adminMenuVo : records){
                 Long id = adminMenuVo.getId();
                 QueryWrapper<MenuEntity> objectQueryWrapper = new QueryWrapper<>();
                 objectQueryWrapper.eq("parent_id",id);
+                objectQueryWrapper.eq("belong_id",belongId);
                 List<MenuEntity> menuEntities = this.baseMapper.selectList(objectQueryWrapper);
                 List<AdminMenuVo> adminMenuVoChilds = new ArrayList<>();
                 if(CollUtil.isNotEmpty(menuEntities)){
diff --git a/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/NavigationBarServiceImpl.java b/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/NavigationBarServiceImpl.java
index f72cd93..795bc8c 100644
--- a/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/NavigationBarServiceImpl.java
+++ b/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/NavigationBarServiceImpl.java
@@ -12,9 +12,11 @@
 import com.xcong.farmer.cms.modules.system.dto.AdminNavigationBarDto;
 import com.xcong.farmer.cms.modules.system.dto.AdminUpdateBarDto;
 import com.xcong.farmer.cms.modules.system.entity.NavigationBarEntity;
+import com.xcong.farmer.cms.modules.system.entity.UserEntity;
 import com.xcong.farmer.cms.modules.system.mapper.NavigationBarMapper;
 import com.xcong.farmer.cms.modules.system.mapper.UserRoleMapper;
 import com.xcong.farmer.cms.modules.system.service.INavigationBarService;
+import com.xcong.farmer.cms.modules.system.util.LoginUserUtil;
 import com.xcong.farmer.cms.modules.system.vo.AdminNavigationBarVo;
 import com.xcong.farmer.cms.modules.system.vo.AdminSeeBarInfoVo;
 import lombok.extern.slf4j.Slf4j;
@@ -39,9 +41,12 @@
 
     @Override
     public Result getBarInPage(AdminNavigationBarDto adminNavigationBarDto) {
+        UserEntity userlogin = LoginUserUtil.getLoginUser();
+        long belongId = userlogin.getBelongId() == null ? 0L : userlogin.getBelongId();
         Page<AdminNavigationBarVo> page = new Page<>(adminNavigationBarDto.getPageNum(), adminNavigationBarDto.getPageSize());
         NavigationBarEntity navigationBarEntity = new NavigationBarEntity();
         navigationBarEntity.setParentId(NavigationBarEntity.PARENTID_DEFAULT);
+        navigationBarEntity.setBelongId(belongId);
         IPage<AdminNavigationBarVo> list = navigationBarMapper.selectAdminNavigationBarVoInPage(page,navigationBarEntity);
         List<AdminNavigationBarVo> records = list.getRecords();
         if(CollUtil.isNotEmpty(records)){
@@ -72,7 +77,10 @@
     @Override
     @Transactional
     public Result addBar(AdminAddBarDto adminAddBarDto) {
+        UserEntity userlogin = LoginUserUtil.getLoginUser();
+        long belongId = userlogin.getBelongId() == null ? 0L : userlogin.getBelongId();
         NavigationBarEntity navigationBarEntity = new NavigationBarEntity();
+        navigationBarEntity.setBelongId(belongId);
         String barName = adminAddBarDto.getBarName();
         if(StrUtil.isEmpty(barName)){
             return Result.fail("请输入导航栏标题");
@@ -182,11 +190,13 @@
 
     @Override
     public Result getBarInList() {
-        List<AdminNavigationBarVo> records = navigationBarMapper.selectAdminNavigationBarVoByParentId(NavigationBarEntity.PARENTID_DEFAULT);
+        UserEntity userlogin = LoginUserUtil.getLoginUser();
+        long belongId = userlogin.getBelongId() == null ? 0L : userlogin.getBelongId();
+        List<AdminNavigationBarVo> records = navigationBarMapper.selectAdminNavigationBarVoByParentId(NavigationBarEntity.PARENTID_DEFAULT,belongId);
         if(CollUtil.isNotEmpty(records)){
             for(AdminNavigationBarVo adminNavigationBarVo : records){
                 Long id = adminNavigationBarVo.getId();
-                List<NavigationBarEntity> navigationBarEntities = navigationBarMapper.selectListByParentId(id);
+                List<NavigationBarEntity> navigationBarEntities = navigationBarMapper.selectListByParentId(id,belongId);
                 List<AdminNavigationBarVo> adminNavigationBarVoChilds = new ArrayList<>();
                 if(CollUtil.isNotEmpty(navigationBarEntities)){
                     for(NavigationBarEntity navigationBarEntityChild : navigationBarEntities){
diff --git a/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/RoleServiceImpl.java b/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/RoleServiceImpl.java
index 8411b92..aca6db1 100644
--- a/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/RoleServiceImpl.java
+++ b/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/RoleServiceImpl.java
@@ -15,6 +15,7 @@
 import com.xcong.farmer.cms.modules.system.entity.*;
 import com.xcong.farmer.cms.modules.system.mapper.*;
 import com.xcong.farmer.cms.modules.system.service.IRoleService;
+import com.xcong.farmer.cms.modules.system.util.LoginUserUtil;
 import com.xcong.farmer.cms.modules.system.vo.AdminMenuInfoVo;
 import com.xcong.farmer.cms.modules.system.vo.AdminRoleVo;
 import com.xcong.farmer.cms.modules.system.vo.AdminSeeRoleInfoVo;
@@ -46,10 +47,15 @@
 
     @Override
     public Result getRoleInPage(AdminRoleDto adminRoleDto) {
+        UserEntity userlogin = LoginUserUtil.getLoginUser();
         Page<AdminRoleVo> page = new Page<>(adminRoleDto.getPageNum(), adminRoleDto.getPageSize());
         RoleEntity roleEntity = new RoleEntity();
+        Long belongId = userlogin.getBelongId() == null ? 0L : userlogin.getBelongId();
         if(StrUtil.isNotEmpty(adminRoleDto.getRoleName())){
             roleEntity.setRoleName(adminRoleDto.getRoleName());
+        }
+        if(belongId > 0L){
+            roleEntity.setBelongId(belongId);
         }
         IPage<AdminRoleVo> list = this.baseMapper.selectAdminRoleVoInPage(page,roleEntity);
         return Result.ok(list);
@@ -58,6 +64,7 @@
     @Override
     @Transactional
     public Result addRole(AdminAddRoleDto adminAddRoleDto) {
+        UserEntity userlogin = LoginUserUtil.getLoginUser();
         String roleName = adminAddRoleDto.getRoleName();
         if(StrUtil.isEmpty(roleName)){
             return Result.fail("请输入角色名称");
@@ -72,6 +79,7 @@
             roleEntity.setRemark(remark);
         }
         roleEntity.setRoleName(roleName);
+        roleEntity.setBelongId(userlogin.getBelongId() == null?0L:userlogin.getBelongId());
         int insert = this.baseMapper.insert(roleEntity);
         if(insert > 0){
             saveRoleMenus(menuIds,roleEntity.getId());
diff --git a/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/UserServiceImpl.java b/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/UserServiceImpl.java
index 7d13ef2..fa9b606 100644
--- a/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/UserServiceImpl.java
+++ b/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/UserServiceImpl.java
@@ -7,10 +7,7 @@
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.xcong.farmer.cms.common.response.Result;
-import com.xcong.farmer.cms.modules.system.dto.AdminAddUserDto;
-import com.xcong.farmer.cms.modules.system.dto.AdminDeleteDto;
-import com.xcong.farmer.cms.modules.system.dto.AdminUpdateUserDto;
-import com.xcong.farmer.cms.modules.system.dto.AdminUserDto;
+import com.xcong.farmer.cms.modules.system.dto.*;
 import com.xcong.farmer.cms.modules.system.entity.*;
 import com.xcong.farmer.cms.modules.system.mapper.*;
 import com.xcong.farmer.cms.modules.system.service.IUserService;
@@ -28,6 +25,7 @@
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
+import java.io.Serializable;
 import java.util.*;
 
 @Service
@@ -45,8 +43,13 @@
 
     @Override
     public Result getUserInPage(AdminUserDto adminUserDto) {
+        UserEntity userlogin = LoginUserUtil.getLoginUser();
         Page<AdminUserVo> page = new Page<>(adminUserDto.getPageNum(), adminUserDto.getPageSize());
         UserEntity userEntity = new UserEntity();
+        long belongId = userlogin.getBelongId() == null ? 0L : userlogin.getBelongId();
+        if(belongId > 0L){
+            userEntity.setBelongId(belongId);
+        }
         if(StrUtil.isNotEmpty(adminUserDto.getUsername())){
             userEntity.setUsername(adminUserDto.getUsername());
         }
@@ -77,6 +80,7 @@
     @Override
     @Transactional
     public Result addUser(AdminAddUserDto adminAddUserDto) {
+        UserEntity userlogin = LoginUserUtil.getLoginUser();
         String username = adminAddUserDto.getUsername();
         if(StrUtil.isEmpty(username)){
             return Result.fail("请输入用户名");
@@ -89,6 +93,10 @@
         if(StrUtil.isEmpty(phone)){
             return Result.fail("请输入联系电话");
         }
+        Long belongId = adminAddUserDto.getBelongId() == null ? 0L:adminAddUserDto.getBelongId();
+        if(belongId == 0L){
+            return Result.fail("请选择所属公司");
+        }
         UserEntity userEntity = new UserEntity();
         userEntity.setUsername(username);
         userEntity.setPhone(phone);
@@ -100,6 +108,7 @@
         }
         userEntity.setPassword(SecureUtil.md5(UserEntity.PASSWORD_DEFAULT));
         userEntity.setStatus(UserEntity.STATUS_ENABLE);
+        userEntity.setBelongId(belongId);
         int insert = this.baseMapper.insert(userEntity);
         if(insert > 0){
             saveUserRole(roleIds,userEntity.getId());
@@ -230,7 +239,8 @@
 
     @Override
     public Result userMenu() {
-        Long userId = LoginUserUtil.getLoginUser().getId();
+        UserEntity loginUser = LoginUserUtil.getLoginUser();
+        Long userId = loginUser.getId();
         List<AdminUserMenuVo> adminUserMenuVos = new ArrayList<>();
 
         QueryWrapper<UserRoleEntity> userRoleQueryWrapper = new QueryWrapper<>();
@@ -314,6 +324,32 @@
         return Result.ok("删除成功");
     }
 
+    @Override
+    @Transactional
+    public Result updatePassword(AdminUpdatePasswordDto adminUpdatePasswordDto) {
+        UserEntity loginUser = LoginUserUtil.getLoginUser();
+        Long userId = loginUser.getId();
+        UserEntity userEntity =  this.baseMapper.selectById(userId);
+        if(ObjectUtil.isEmpty(userEntity)){
+            return Result.fail("用户不存在");
+        }
+        String oldPassword = adminUpdatePasswordDto.getOldPassword();
+        if(StrUtil.isEmpty(oldPassword)){
+            return Result.fail("请输入原密码");
+        }
+        String newPassword = adminUpdatePasswordDto.getNewPassword();
+        if(StrUtil.isEmpty(newPassword)){
+            return Result.fail("请输入新密码");
+        }
+        String s = SecureUtil.md5(oldPassword);
+        if(!userEntity.getPassword().equals(s)){
+            return Result.fail("原密码不正确,请联系管理员重置密码");
+        }
+        userEntity.setPassword(SecureUtil.md5(newPassword));
+        this.baseMapper.updateById(userEntity);
+        return Result.ok("修改成功");
+    }
+
     private void saveUserRole(String roleIds,Long userId) {
         if (StrUtil.isNotEmpty(roleIds)) {
             String[] roleIdList = roleIds.split(StringPool.COMMA);
diff --git a/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/WebSetServiceImpl.java b/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/WebSetServiceImpl.java
index 3ba0015..d814c95 100644
--- a/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/WebSetServiceImpl.java
+++ b/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/WebSetServiceImpl.java
@@ -4,9 +4,11 @@
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.xcong.farmer.cms.common.response.Result;
 import com.xcong.farmer.cms.modules.system.dto.AdminUpdateWebSetDto;
+import com.xcong.farmer.cms.modules.system.entity.UserEntity;
 import com.xcong.farmer.cms.modules.system.entity.WebSetEntity;
 import com.xcong.farmer.cms.modules.system.mapper.WebSetMapper;
 import com.xcong.farmer.cms.modules.system.service.IWebSetService;
+import com.xcong.farmer.cms.modules.system.util.LoginUserUtil;
 import com.xcong.farmer.cms.modules.system.vo.AdminSeeWebSetInfoVo;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
@@ -22,7 +24,11 @@
 public class WebSetServiceImpl extends ServiceImpl<WebSetMapper, WebSetEntity> implements IWebSetService {
     @Override
     public Result seeWebSetInfo() {
+        UserEntity userlogin = LoginUserUtil.getLoginUser();
+        long belongId = userlogin.getBelongId() == null ? 0L : userlogin.getBelongId();
         AdminSeeWebSetInfoVo adminSeeWebSetInfoVo = new AdminSeeWebSetInfoVo();
+        QueryWrapper<WebSetEntity> objectQueryWrapper = new QueryWrapper<>();
+        objectQueryWrapper.eq("belong_id",belongId);
         List<WebSetEntity> webSetEntities = this.baseMapper.selectList(new QueryWrapper<>());
         if(CollUtil.isNotEmpty(webSetEntities)){
             WebSetEntity webSetEntity = webSetEntities.get(0);
@@ -37,6 +43,8 @@
 
     @Override
     public Result updateWebSet(AdminUpdateWebSetDto adminUpdateWebSetDto) {
+        UserEntity userlogin = LoginUserUtil.getLoginUser();
+        long belongId = userlogin.getBelongId() == null ? 0L : userlogin.getBelongId();
         String webTitle = adminUpdateWebSetDto.getWebTitle();
         if(StrUtil.isEmpty(webTitle)){
             return Result.fail("请输入网页标题");
@@ -46,7 +54,10 @@
             return Result.fail("请输入网页关键字");
         }
         Long id = adminUpdateWebSetDto.getId() == null ? 0L : adminUpdateWebSetDto.getId();
-        WebSetEntity webSetEntity = this.baseMapper.selectById(id);
+        QueryWrapper<WebSetEntity> objectQueryWrapper = new QueryWrapper<>();
+        objectQueryWrapper.eq("belong_id",belongId);
+        WebSetEntity webSetEntity = this.baseMapper.selectOne(objectQueryWrapper);
+//        WebSetEntity webSetEntity = this.baseMapper.selectById(id);
         if(ObjectUtil.isEmpty(webSetEntity)){
             WebSetEntity webSetEntityAdd = new WebSetEntity();
             webSetEntityAdd.setWebTitle(webTitle);
@@ -59,6 +70,7 @@
             if(StrUtil.isNotEmpty(webPic)){
                 webSetEntityAdd.setWebPic(webPic);
             }
+            webSetEntityAdd.setBelongId(belongId);
             this.baseMapper.insert(webSetEntityAdd);
             return Result.ok("保存成功");
         }
diff --git a/src/main/java/com/xcong/farmer/cms/modules/system/vo/AdminBelongVo.java b/src/main/java/com/xcong/farmer/cms/modules/system/vo/AdminBelongVo.java
new file mode 100644
index 0000000..0661cb3
--- /dev/null
+++ b/src/main/java/com/xcong/farmer/cms/modules/system/vo/AdminBelongVo.java
@@ -0,0 +1,27 @@
+package com.xcong.farmer.cms.modules.system.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+@ApiModel(value = "AdminBelongVo", description = "所属公司列表返回")
+public class AdminBelongVo {
+
+    private Long id;
+
+    @ApiModelProperty(value = "名称")
+    private String name;
+
+    @ApiModelProperty(value = "编码")
+    private String code;
+
+    @ApiModelProperty(value = "网址")
+    private String webAddress;
+
+    @ApiModelProperty(value = "备注")
+    private String remark;
+
+    @ApiModelProperty(value = "图片")
+    private String pic;
+}
diff --git a/src/main/java/com/xcong/farmer/cms/modules/system/vo/AdminSeeBelongInfoVo.java b/src/main/java/com/xcong/farmer/cms/modules/system/vo/AdminSeeBelongInfoVo.java
new file mode 100644
index 0000000..272bb51
--- /dev/null
+++ b/src/main/java/com/xcong/farmer/cms/modules/system/vo/AdminSeeBelongInfoVo.java
@@ -0,0 +1,27 @@
+package com.xcong.farmer.cms.modules.system.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+@ApiModel(value = "AdminSeeBelongInfoVo", description = "所属公司返回")
+public class AdminSeeBelongInfoVo {
+
+    private Long id;
+
+    @ApiModelProperty(value = "名称")
+    private String name;
+
+    @ApiModelProperty(value = "编码")
+    private String code;
+
+    @ApiModelProperty(value = "网址")
+    private String webAddress;
+
+    @ApiModelProperty(value = "备注")
+    private String remark;
+
+    @ApiModelProperty(value = "图片")
+    private String pic;
+}
diff --git a/src/main/java/com/xcong/farmer/cms/modules/system/vo/AdminUserVo.java b/src/main/java/com/xcong/farmer/cms/modules/system/vo/AdminUserVo.java
index 44f266c..e4b1093 100644
--- a/src/main/java/com/xcong/farmer/cms/modules/system/vo/AdminUserVo.java
+++ b/src/main/java/com/xcong/farmer/cms/modules/system/vo/AdminUserVo.java
@@ -15,6 +15,9 @@
     @ApiModelProperty(value = "用户ID")
     private Long id;
 
+    @ApiModelProperty(value = "所属ID")
+    private Long belongId;
+
     @ApiModelProperty(value = "用户名")
     private String username;
 
diff --git a/src/main/resources/mapper/ArticleMapper.xml b/src/main/resources/mapper/ArticleMapper.xml
index c576f46..5fb25f7 100644
--- a/src/main/resources/mapper/ArticleMapper.xml
+++ b/src/main/resources/mapper/ArticleMapper.xml
@@ -15,6 +15,9 @@
                 <if test="record.columnId != null">
                     and a.column_id = #{record.columnId}
                 </if>
+                <if test="record.belongId != null">
+                    and a.belong_id = #{record.belongId}
+                </if>
                 <if test="record.title!=null">
                     and a.title like concat ('%',#{record.title},'%')
                 </if>
diff --git a/src/main/resources/mapper/BelongMapper.xml b/src/main/resources/mapper/BelongMapper.xml
new file mode 100644
index 0000000..f41ef4b
--- /dev/null
+++ b/src/main/resources/mapper/BelongMapper.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.xcong.farmer.cms.modules.system.mapper.BelongMapper">
+
+    <select id="selectAdminBelongInPage" resultType="com.xcong.farmer.cms.modules.system.vo.AdminBelongVo">
+        SELECT
+        a.*
+        FROM
+        t_belong a
+        <where>
+            <if test="record != null" >
+                <if test="record.name!=null">
+                    and a.name like concat ('%',#{record.name},'%')
+                </if>
+            </if>
+        </where>
+    </select>
+
+</mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/ColumnMapper.xml b/src/main/resources/mapper/ColumnMapper.xml
index 9aedea4..81380ce 100644
--- a/src/main/resources/mapper/ColumnMapper.xml
+++ b/src/main/resources/mapper/ColumnMapper.xml
@@ -12,6 +12,9 @@
                 <if test="record.parentId != null">
                     and a.parent_id = #{record.parentId}
                 </if>
+                <if test="record.belongId != null">
+                    and a.belong_id = #{record.belongId}
+                </if>
             </if>
         </where>
         order by a.create_time desc
@@ -22,7 +25,7 @@
         a.*
         FROM
         t_column a
-        where a.parent_id = #{parentId}
+        where a.parent_id = #{parentId} and a.belong_id = #{belongId}
         order by a.create_time desc
     </select>
 
diff --git a/src/main/resources/mapper/MenuMapper.xml b/src/main/resources/mapper/MenuMapper.xml
index 28ead9c..ad782b3 100644
--- a/src/main/resources/mapper/MenuMapper.xml
+++ b/src/main/resources/mapper/MenuMapper.xml
@@ -12,6 +12,9 @@
                 <if test="record.parentId != null">
                     and a.parent_id = #{record.parentId}
                 </if>
+                <if test="record.belongId != null">
+                    and a.belong_id = #{record.belongId}
+                </if>
             </if>
         </where>
         order by a.create_time desc
@@ -28,7 +31,7 @@
         SELECT
             a.*
         FROM
-            t_menu a where a.parent_id = #{parentId}
+            t_menu a where a.parent_id = #{parentId} and a.belong_id = #{belongId}
     </select>
 
     <select id="selectMenuEntityByIdAndParentId" resultType="com.xcong.farmer.cms.modules.system.entity.MenuEntity">
diff --git a/src/main/resources/mapper/NavigationBarMapper.xml b/src/main/resources/mapper/NavigationBarMapper.xml
index 9d564e7..347307a 100644
--- a/src/main/resources/mapper/NavigationBarMapper.xml
+++ b/src/main/resources/mapper/NavigationBarMapper.xml
@@ -12,6 +12,9 @@
                 <if test="record.parentId != null">
                     and a.parent_id = #{record.parentId}
                 </if>
+                <if test="record.belongId != null">
+                    and a.belong_id = #{record.belongId}
+                </if>
             </if>
         </where>
         order by a.create_time desc
@@ -23,6 +26,7 @@
         FROM
         t_navigation_bar a
         where a.parent_id = #{parentId}
+          and a.belong_id = #{belongId}
         order by a.create_time desc
     </select>
 
@@ -32,6 +36,7 @@
         FROM
             t_navigation_bar a
         where a.parent_id = #{parentId}
+          and a.belong_id = #{belongId}
         order by a.create_time desc
     </select>
 
diff --git a/src/main/resources/mapper/RoleMapper.xml b/src/main/resources/mapper/RoleMapper.xml
index 92d5440..8757072 100644
--- a/src/main/resources/mapper/RoleMapper.xml
+++ b/src/main/resources/mapper/RoleMapper.xml
@@ -12,6 +12,9 @@
                 <if test="record.roleName!=null">
                     and a.role_name like concat ('%',#{record.roleName},'%')
                 </if>
+                <if test="record.belongId!=null">
+                    and a.belong_id = #{record.belongId}
+                </if>
             </if>
         </where>
         order by a.create_time desc
diff --git a/src/main/resources/mapper/UserMapper.xml b/src/main/resources/mapper/UserMapper.xml
index 1545105..1ca8883 100644
--- a/src/main/resources/mapper/UserMapper.xml
+++ b/src/main/resources/mapper/UserMapper.xml
@@ -7,11 +7,15 @@
         a.*
         FROM
         t_user a
+        left join t_belong b on a.belong_id = b.id
         <where>
             <if test="record != null" >
                 <if test="record.username!=null">
                     and a.username like concat ('%',#{record.username},'%')
                 </if>
+                <if test="record.belongId!=null">
+                    and a.belong_id = #{record.belongId}
+                </if>
             </if>
         </where>
         order by a.create_time desc

--
Gitblit v1.9.1