xiaoyong931011
2022-06-10 93e281b3cc60c8d24a0ed5547d3d399c03f9bab6
20220606
1 files added
25 files modified
287 ■■■■ changed files
src/main/java/com/xcong/farmer/cms/modules/system/Controller/AdminBelongController.java 8 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/farmer/cms/modules/system/Controller/AdminUserController.java 6 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/farmer/cms/modules/system/dto/AdminAddArticleDto.java 5 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/farmer/cms/modules/system/dto/AdminUpdateArticleDto.java 5 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/farmer/cms/modules/system/entity/ArticleEntity.java 4 ●●● patch | view | raw | blame | history
src/main/java/com/xcong/farmer/cms/modules/system/entity/MenuEntity.java 2 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/farmer/cms/modules/system/entity/RoleEntity.java 11 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/farmer/cms/modules/system/entity/UserEntity.java 9 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/farmer/cms/modules/system/mapper/MenuMapper.java 6 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/farmer/cms/modules/system/service/IBelongService.java 3 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/farmer/cms/modules/system/service/IUserService.java 2 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/ArticleServiceImpl.java 18 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/BelongServiceImpl.java 27 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/ColumnServiceImpl.java 6 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/MenuServiceImpl.java 25 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/NavigationBarServiceImpl.java 6 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/RoleServiceImpl.java 12 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/UserServiceImpl.java 54 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/WebSetServiceImpl.java 4 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/farmer/cms/modules/system/vo/AdminArticleVo.java 5 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/farmer/cms/modules/system/vo/AdminSeeArticleInfoVo.java 5 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/farmer/cms/modules/system/vo/AdminUserInfoVo.java 25 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/farmer/cms/modules/system/vo/AdminUserMenuVo.java 3 ●●●●● patch | view | raw | blame | history
src/main/resources/mapper/BelongMapper.xml 3 ●●●●● patch | view | raw | blame | history
src/main/resources/mapper/MenuMapper.xml 29 ●●●● patch | view | raw | blame | history
src/main/resources/mapper/UserMapper.xml 4 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/farmer/cms/modules/system/Controller/AdminBelongController.java
@@ -32,7 +32,7 @@
    @ApiOperation(value = "系统所属公司列表", notes = "系统所属公司列表")
    @ApiResponses({@ApiResponse(code = 200, message = "ok", response = AdminBelongVo.class)})
    @PostMapping(value = "/belongInList")
    @GetMapping(value = "/belongInList")
    public Result getBelongInList() {
        return iBelongService.getBelongInList();
    }
@@ -54,4 +54,10 @@
    public Result updateBelong(@RequestBody @Valid AdminUpdateBelongDto adminUpdateBelongDto) {
        return iBelongService.updateBelong(adminUpdateBelongDto);
    }
    @ApiOperation(value = "删除系统所属公司", notes = "删除系统所属公司")
    @PostMapping(value = "/delObjs")
    public Result delObjs(@RequestBody @Valid AdminDeleteDto adminDeleteDto) {
        return iBelongService.delObjs(adminDeleteDto);
    }
}
src/main/java/com/xcong/farmer/cms/modules/system/Controller/AdminUserController.java
@@ -64,6 +64,12 @@
        return iUserService.seeUserInfo(id);
    }
    @ApiOperation(value = "个人中心", notes = "个人中心")
    @GetMapping(value = "/userInfo")
    public Result userInfo() {
        return iUserService.userInfo();
    }
    @ApiOperation(value = "更新系统用户", notes = "更新系统用户")
    @PostMapping(value = "/updateUser")
    public Result updateUser(@RequestBody @Valid AdminUpdateUserDto adminUpdateUserDto) {
src/main/java/com/xcong/farmer/cms/modules/system/dto/AdminAddArticleDto.java
@@ -19,6 +19,9 @@
    @ApiModelProperty(value = "作者")
    private String author;
    @ApiModelProperty(value = "作者所属单位")
    private String authorBelong;
    @ApiModelProperty(value = "描述")
    private String remark;
@@ -35,7 +38,7 @@
    private String atlas;
    @ApiModelProperty(value = "发布时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date releaseTime;
    @ApiModelProperty(value = "是否立即发布 0:否 1:是")
src/main/java/com/xcong/farmer/cms/modules/system/dto/AdminUpdateArticleDto.java
@@ -23,6 +23,9 @@
    @ApiModelProperty(value = "作者")
    private String author;
    @ApiModelProperty(value = "作者所属单位")
    private String authorBelong;
    @ApiModelProperty(value = "描述")
    private String remark;
@@ -39,7 +42,7 @@
    private String atlas;
    @ApiModelProperty(value = "发布时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date releaseTime;
    @ApiModelProperty(value = "是否立即发布 0:否 1:是")
src/main/java/com/xcong/farmer/cms/modules/system/entity/ArticleEntity.java
@@ -40,6 +40,8 @@
    private String childTitle;
    //作者
    private String author;
    //作者所属单位
    private String authorBelong;
    //描述
    private String remark;
    //所属栏目ID
@@ -51,7 +53,7 @@
    //图集
    private String atlas;
    //发布时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date releaseTime;
    //是否立即发布 0:否 1:是
    private Integer releaseStatus;
src/main/java/com/xcong/farmer/cms/modules/system/entity/MenuEntity.java
@@ -32,6 +32,4 @@
    private Integer orderNum;
    //父级ID
    private Long parentId;
    //所属ID
    private Long belongId;
}
src/main/java/com/xcong/farmer/cms/modules/system/entity/RoleEntity.java
@@ -10,6 +10,17 @@
@Data
@TableName("t_role")
public class RoleEntity extends BaseEntity {
    /**
     * 超级管理员
     */
    public static final String ROLE_SUPER_NAME = "超级管理员";
    /**
     * 普通管理员(没有菜单管理权限和公司管理权限)
     */
    public static final String ROLE_ADMIN_NAME = "普通管理员";
    //角色名称
    private String roleName;
    //拓展备注
src/main/java/com/xcong/farmer/cms/modules/system/entity/UserEntity.java
@@ -1,6 +1,8 @@
package com.xcong.farmer.cms.modules.system.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.google.type.Date;
import com.xcong.farmer.cms.common.system.base.BaseEntity;
import lombok.Data;
@@ -18,6 +20,10 @@
     * 默认密码
     */
    public static final String PASSWORD_DEFAULT = "123456";
    /**
     * 系统最高账户的所属默认
     */
    public static final Long USER_BELONG_TOP = 0L;
    /**
     * 账号状态 - 禁用
     */
@@ -42,4 +48,7 @@
    private String remark;
    //所属ID
    private Long belongId;
    @TableField(exist = false)
    private String roleName;
}
src/main/java/com/xcong/farmer/cms/modules/system/mapper/MenuMapper.java
@@ -16,7 +16,11 @@
    AdminUserMenuVo selectAdminRoleMenuVoById(@Param("id")Long parentId);
    List<AdminMenuVo> selectAdminMenuVoInListByParentId(@Param("parentId")Long parentIdDefault,@Param("belongId")Long belongId);
    List<AdminMenuVo> selectAdminMenuVoInListByParentId(@Param("parentId")Long parentIdDefault);
    MenuEntity selectMenuEntityByIdAndParentId(@Param("menuId")Long menuId, @Param("parentId")Long parentidDefault);
    List<AdminUserMenuVo> selectAdminUserMenuVoOrderByOrderNum(@Param("list") List<Long> menuIds);
    List<AdminMenuVo> selectAdminMenuVoOrderByOrderNum(@Param("list") List<Long> menuIds);
}
src/main/java/com/xcong/farmer/cms/modules/system/service/IBelongService.java
@@ -4,6 +4,7 @@
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.AdminDeleteDto;
import com.xcong.farmer.cms.modules.system.dto.AdminUpdateBelongDto;
import com.xcong.farmer.cms.modules.system.entity.BelongEntity;
@@ -18,4 +19,6 @@
    Result updateBelong(AdminUpdateBelongDto adminUpdateBelongDto);
    Result getBelongInList();
    Result delObjs(AdminDeleteDto adminDeleteDto);
}
src/main/java/com/xcong/farmer/cms/modules/system/service/IUserService.java
@@ -28,4 +28,6 @@
    Result delObjs(AdminDeleteDto adminDeleteDto);
    Result updatePassword(AdminUpdatePasswordDto adminUpdatePasswordDto);
    Result userInfo();
}
src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/ArticleServiceImpl.java
@@ -43,7 +43,7 @@
    @Override
    public Result getArticleInPage(AdminArticleDto adminArticleDto) {
        UserEntity userlogin = LoginUserUtil.getLoginUser();
        long belongId = userlogin.getBelongId() == null ? 0L : userlogin.getBelongId();
        long belongId = userlogin.getBelongId() == null ? UserEntity.USER_BELONG_TOP : userlogin.getBelongId();
        Page<AdminArticleVo> page = new Page<>(adminArticleDto.getPageNum(), adminArticleDto.getPageSize());
        ArticleEntity articleEntity = new ArticleEntity();
        Long columnId = adminArticleDto.getColumnId() == null ? 0L : adminArticleDto.getColumnId();
@@ -54,7 +54,9 @@
        if(StrUtil.isNotEmpty(title)){
            articleEntity.setTitle(title);
        }
        if(UserEntity.USER_BELONG_TOP != belongId){
        articleEntity.setBelongId(belongId);
        }
        IPage<AdminArticleVo> list = this.baseMapper.selectAdminArticleInPage(page,articleEntity);
        return Result.ok(list);
    }
@@ -63,7 +65,7 @@
    @Transactional
    public Result addArticle(AdminAddArticleDto adminAddArticleDto) {
        UserEntity userlogin = LoginUserUtil.getLoginUser();
        long belongId = userlogin.getBelongId() == null ? 0L : userlogin.getBelongId();
        long belongId = userlogin.getBelongId() == null ? UserEntity.USER_BELONG_TOP : userlogin.getBelongId();
        ArticleEntity articleEntity = new ArticleEntity();
        articleEntity.setBelongId(belongId);
        String title = adminAddArticleDto.getTitle();
@@ -78,6 +80,10 @@
        String author = adminAddArticleDto.getAuthor();
        if(StrUtil.isNotEmpty(author)){
            articleEntity.setAuthor(author);
        }
        String authorBelong = adminAddArticleDto.getAuthorBelong();
        if(StrUtil.isNotEmpty(authorBelong)){
            articleEntity.setAuthorBelong(authorBelong);
        }
        String remark = adminAddArticleDto.getRemark();
        if(StrUtil.isNotEmpty(remark)){
@@ -154,18 +160,12 @@
        }
        articleEntity.setTitle(title);
        String childTitle = adminUpdateArticleDto.getChildTitle();
        if(StrUtil.isNotEmpty(childTitle)){
            articleEntity.setChildTitle(childTitle);
        }
        String author = adminUpdateArticleDto.getAuthor();
        if(StrUtil.isNotEmpty(author)){
            articleEntity.setAuthor(author);
        }
        String remark = adminUpdateArticleDto.getRemark();
        if(StrUtil.isNotEmpty(remark)){
            articleEntity.setRemark(remark);
        }
        long columnId = adminUpdateArticleDto.getColumnId() == null ? 0L : adminUpdateArticleDto.getColumnId();
        if(columnId == 0L){
            return Result.fail("请选择文章栏目");
@@ -178,9 +178,7 @@
        Integer visits = adminUpdateArticleDto.getVisits() == null ? 0 : adminUpdateArticleDto.getVisits();
        articleEntity.setVisits(visits);
        String mainDiagram = adminUpdateArticleDto.getMainDiagram();
        if(StrUtil.isNotEmpty(mainDiagram)){
            articleEntity.setMainDiagram(mainDiagram);
        }
        String atlas = adminUpdateArticleDto.getAtlas();
        articleEntity.setAtlas(atlas);
        Date releaseTime = adminUpdateArticleDto.getReleaseTime();
src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/BelongServiceImpl.java
@@ -3,14 +3,17 @@
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.core.toolkit.StringPool;
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.AdminDeleteDto;
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.entity.UserRoleEntity;
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;
@@ -31,11 +34,16 @@
public class BelongServiceImpl extends ServiceImpl<BelongMapper, BelongEntity> implements IBelongService {
    @Override
    public Result getBelongInPage(AdminBelongDto adminBelongDto) {
        UserEntity userlogin = LoginUserUtil.getLoginUser();
        Long belongId = userlogin.getBelongId();
        Page<AdminBelongVo> page = new Page<>(adminBelongDto.getPageNum(), adminBelongDto.getPageSize());
        BelongEntity belongEntity = new BelongEntity();
        String name = adminBelongDto.getName();
        if(StrUtil.isNotEmpty(name)){
            belongEntity.setName(name);
        }
        if(belongId != UserEntity.USER_BELONG_TOP){
            belongEntity.setId(belongId);
        }
        IPage<AdminBelongVo> list = this.baseMapper.selectAdminBelongInPage(page,belongEntity);
        return Result.ok(list);
@@ -131,7 +139,7 @@
        UserEntity userlogin = LoginUserUtil.getLoginUser();
        Long belongId = userlogin.getBelongId();
        QueryWrapper<BelongEntity> objectQueryWrapper = new QueryWrapper<>();
        if(belongId != 0L){
        if(belongId != UserEntity.USER_BELONG_TOP){
            objectQueryWrapper.eq("id",belongId);
        }
        List<BelongEntity> belongEntities = this.baseMapper.selectList(objectQueryWrapper);
@@ -147,4 +155,21 @@
        }
        return Result.ok(adminBelongVos);
    }
    @Override
    public Result delObjs(AdminDeleteDto adminDeleteDto) {
        String ids = adminDeleteDto.getIds();
        UserEntity userlogin = LoginUserUtil.getLoginUser();
        if(userlogin.getBelongId() != UserEntity.USER_BELONG_TOP){
            return Result.fail("没有删除权限");
        }
        if(StrUtil.isNotEmpty(ids)){
            String[] belongIds = ids.split(StringPool.COMMA);
            for(String belongIdStr : belongIds){
                Long belongId = Long.valueOf(belongIdStr);
                this.baseMapper.deleteById(belongId);
            }
        }
        return Result.ok("删除成功");
    }
}
src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/ColumnServiceImpl.java
@@ -35,7 +35,7 @@
    @Override
    public Result getColumnInPage(AdminColumnDto adminColumnDto) {
        UserEntity userlogin = LoginUserUtil.getLoginUser();
        long belongId = userlogin.getBelongId() == null ? 0L : userlogin.getBelongId();
        long belongId = userlogin.getBelongId() == null ? UserEntity.USER_BELONG_TOP : userlogin.getBelongId();
        Page<AdminColumnVo> page = new Page<>(adminColumnDto.getPageNum(), adminColumnDto.getPageSize());
        ColumnEntity columnEntity = new ColumnEntity();
        columnEntity.setBelongId(belongId);
@@ -72,7 +72,7 @@
    @Transactional
    public Result addColumn(AdminAddColumnDto adminAddColumnDto) {
        UserEntity userlogin = LoginUserUtil.getLoginUser();
        long belongId = userlogin.getBelongId() == null ? 0L : userlogin.getBelongId();
        long belongId = userlogin.getBelongId() == null ? UserEntity.USER_BELONG_TOP : userlogin.getBelongId();
        ColumnEntity columnEntity = new ColumnEntity();
        columnEntity.setBelongId(belongId);
        String columnName = adminAddColumnDto.getColumnName();
@@ -199,7 +199,7 @@
    @Override
    public Result getColumnInList() {
        UserEntity userlogin = LoginUserUtil.getLoginUser();
        long belongId = userlogin.getBelongId() == null ? 0L : userlogin.getBelongId();
        long belongId = userlogin.getBelongId() == null ? UserEntity.USER_BELONG_TOP : userlogin.getBelongId();
        List<AdminColumnVo> records = this.baseMapper.selectColumnInListByParentId(ColumnEntity.PARENTID_DEFAULT,belongId);
        if(CollUtil.isNotEmpty(records)){
            for(AdminColumnVo adminColumnVo : records){
src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/MenuServiceImpl.java
@@ -21,6 +21,7 @@
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 com.xcong.farmer.cms.modules.system.vo.AdminUserMenuVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@@ -46,7 +47,7 @@
        UserEntity userlogin = LoginUserUtil.getLoginUser();
        MenuEntity menuEntity = new MenuEntity();
        menuEntity.setParentId(MenuEntity.PARENTID_DEFAULT);
        menuEntity.setBelongId(userlogin.getBelongId()==null?0L:userlogin.getBelongId());
//        menuEntity.setBelongId(userlogin.getBelongId()==null?UserEntity.USER_BELONG_TOP:userlogin.getBelongId());
        IPage<AdminMenuVo> list = this.baseMapper.selectAdminMenuVoInPage(page,menuEntity);
        List<AdminMenuVo> records = list.getRecords();
        if(CollUtil.isNotEmpty(records)){
@@ -78,7 +79,6 @@
    @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("请输入菜单名称");
@@ -104,7 +104,6 @@
        if(StrUtil.isNotEmpty(routeUrl)){
            menuEntity.setRouteUrl(routeUrl);
        }
        menuEntity.setBelongId(belongId);
        this.baseMapper.insert(menuEntity);
        return Result.ok("新增成功");
    }
@@ -202,14 +201,13 @@
    @Override
    public Result getMenuInList() {
        UserEntity userlogin = LoginUserUtil.getLoginUser();
        long belongId = userlogin.getBelongId() == null ? 0L : userlogin.getBelongId();
        List<AdminMenuVo> records = this.baseMapper.selectAdminMenuVoInListByParentId(MenuEntity.PARENTID_DEFAULT,belongId);
        List<AdminMenuVo> records = this.baseMapper.selectAdminMenuVoInListByParentId(MenuEntity.PARENTID_DEFAULT);
        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);
//                objectQueryWrapper.eq("belong_id",belongId);
                List<MenuEntity> menuEntities = this.baseMapper.selectList(objectQueryWrapper);
                List<AdminMenuVo> adminMenuVoChilds = new ArrayList<>();
                if(CollUtil.isNotEmpty(menuEntities)){
@@ -227,6 +225,21 @@
                adminMenuVo.setChild(adminMenuVoChilds);
            }
        }
        if(CollUtil.isNotEmpty(records)){
            for(AdminMenuVo adminMenuVo : records){
                List<AdminMenuVo> child = adminMenuVo.getChild();
                if(CollUtil.isNotEmpty(child)){
                    List<Long> menuIds = new ArrayList<>();
                    for(AdminMenuVo adminMenuVoChild : child){
                        Long id = adminMenuVoChild.getId();
                        menuIds.add(id);
                    }
                    List<AdminMenuVo> adminMenuVoByOrderNum = this.baseMapper.selectAdminMenuVoOrderByOrderNum(menuIds);
                    adminMenuVo.setChild(adminMenuVoByOrderNum);
                }
            }
        }
        return Result.ok(records);
    }
}
src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/NavigationBarServiceImpl.java
@@ -42,7 +42,7 @@
    @Override
    public Result getBarInPage(AdminNavigationBarDto adminNavigationBarDto) {
        UserEntity userlogin = LoginUserUtil.getLoginUser();
        long belongId = userlogin.getBelongId() == null ? 0L : userlogin.getBelongId();
        long belongId = userlogin.getBelongId() == null ? UserEntity.USER_BELONG_TOP : userlogin.getBelongId();
        Page<AdminNavigationBarVo> page = new Page<>(adminNavigationBarDto.getPageNum(), adminNavigationBarDto.getPageSize());
        NavigationBarEntity navigationBarEntity = new NavigationBarEntity();
        navigationBarEntity.setParentId(NavigationBarEntity.PARENTID_DEFAULT);
@@ -78,7 +78,7 @@
    @Transactional
    public Result addBar(AdminAddBarDto adminAddBarDto) {
        UserEntity userlogin = LoginUserUtil.getLoginUser();
        long belongId = userlogin.getBelongId() == null ? 0L : userlogin.getBelongId();
        long belongId = userlogin.getBelongId() == null ? UserEntity.USER_BELONG_TOP : userlogin.getBelongId();
        NavigationBarEntity navigationBarEntity = new NavigationBarEntity();
        navigationBarEntity.setBelongId(belongId);
        String barName = adminAddBarDto.getBarName();
@@ -191,7 +191,7 @@
    @Override
    public Result getBarInList() {
        UserEntity userlogin = LoginUserUtil.getLoginUser();
        long belongId = userlogin.getBelongId() == null ? 0L : userlogin.getBelongId();
        long belongId = userlogin.getBelongId() == null ? UserEntity.USER_BELONG_TOP : userlogin.getBelongId();
        List<AdminNavigationBarVo> records = navigationBarMapper.selectAdminNavigationBarVoByParentId(NavigationBarEntity.PARENTID_DEFAULT,belongId);
        if(CollUtil.isNotEmpty(records)){
            for(AdminNavigationBarVo adminNavigationBarVo : records){
src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/RoleServiceImpl.java
@@ -50,11 +50,11 @@
        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();
        Long belongId = userlogin.getBelongId() == null ? UserEntity.USER_BELONG_TOP : userlogin.getBelongId();
        if(StrUtil.isNotEmpty(adminRoleDto.getRoleName())){
            roleEntity.setRoleName(adminRoleDto.getRoleName());
        }
        if(belongId > 0L){
        if(belongId > UserEntity.USER_BELONG_TOP){
            roleEntity.setBelongId(belongId);
        }
        IPage<AdminRoleVo> list = this.baseMapper.selectAdminRoleVoInPage(page,roleEntity);
@@ -79,7 +79,7 @@
            roleEntity.setRemark(remark);
        }
        roleEntity.setRoleName(roleName);
        roleEntity.setBelongId(userlogin.getBelongId() == null?0L:userlogin.getBelongId());
        roleEntity.setBelongId(userlogin.getBelongId() == null?UserEntity.USER_BELONG_TOP:userlogin.getBelongId());
        int insert = this.baseMapper.insert(roleEntity);
        if(insert > 0){
            saveRoleMenus(menuIds,roleEntity.getId());
@@ -178,7 +178,11 @@
            String[] roleIds = ids.split(StringPool.COMMA);
            for(String roleIdStr : roleIds){
                Long roleId = Long.valueOf(roleIdStr);
                RoleEntity roleEntity = this.baseMapper.selectById(roleId);
                if(RoleEntity.ROLE_ADMIN_NAME.equals(roleEntity.getRoleName())
                || RoleEntity.ROLE_SUPER_NAME.equals(roleEntity.getRoleName())){
                    return Result.fail(RoleEntity.ROLE_ADMIN_NAME + RoleEntity.ROLE_SUPER_NAME +"角色无法删除");
                }
                QueryWrapper<UserRoleEntity> objectQueryWrapper = new QueryWrapper<>();
                objectQueryWrapper.eq("role_id",roleId);
                userRoleMapper.delete(objectQueryWrapper);
src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/UserServiceImpl.java
@@ -12,10 +12,7 @@
import com.xcong.farmer.cms.modules.system.mapper.*;
import com.xcong.farmer.cms.modules.system.service.IUserService;
import com.xcong.farmer.cms.modules.system.util.LoginUserUtil;
import com.xcong.farmer.cms.modules.system.vo.AdminRoleVo;
import com.xcong.farmer.cms.modules.system.vo.AdminSeeUserInfoVo;
import com.xcong.farmer.cms.modules.system.vo.AdminUserMenuVo;
import com.xcong.farmer.cms.modules.system.vo.AdminUserVo;
import com.xcong.farmer.cms.modules.system.vo.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import cn.hutool.core.util.StrUtil;
@@ -46,9 +43,12 @@
        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){
        long belongId = userlogin.getBelongId() == null ? UserEntity.USER_BELONG_TOP : userlogin.getBelongId();
        if(belongId > UserEntity.USER_BELONG_TOP){
            userEntity.setBelongId(belongId);
            userEntity.setRoleName(RoleEntity.ROLE_ADMIN_NAME);
        }else if(belongId == UserEntity.USER_BELONG_TOP){
            userEntity.setRoleName(RoleEntity.ROLE_SUPER_NAME);
        }
        if(StrUtil.isNotEmpty(adminUserDto.getUsername())){
            userEntity.setUsername(adminUserDto.getUsername());
@@ -85,6 +85,13 @@
        if(StrUtil.isEmpty(username)){
            return Result.fail("请输入用户名");
        }
        QueryWrapper<UserEntity> objectQueryWrapper = new QueryWrapper<>();
        objectQueryWrapper.eq("username",username);
//        objectQueryWrapper.eq("belong_id",userlogin.getBelongId());
        List<UserEntity> userEntities = this.baseMapper.selectList(objectQueryWrapper);
        if(CollUtil.isNotEmpty(userEntities)){
            return Result.fail("用户名重复");
        }
        String roleIds = adminAddUserDto.getRoleIds();
        if(StrUtil.isEmpty(roleIds)){
            return Result.fail("请选择用户角色");
@@ -93,8 +100,8 @@
        if(StrUtil.isEmpty(phone)){
            return Result.fail("请输入联系电话");
        }
        Long belongId = adminAddUserDto.getBelongId() == null ? 0L:adminAddUserDto.getBelongId();
        if(belongId == 0L){
        Long belongId = adminAddUserDto.getBelongId() == null ? UserEntity.USER_BELONG_TOP:adminAddUserDto.getBelongId();
        if(belongId == UserEntity.USER_BELONG_TOP){
            return Result.fail("请选择所属公司");
        }
        UserEntity userEntity = new UserEntity();
@@ -301,6 +308,20 @@
            }
        }
        if(CollUtil.isNotEmpty(adminUserMenuVos)){
            for(AdminUserMenuVo adminUserMenuVo : adminUserMenuVos){
                List<AdminUserMenuVo> child = adminUserMenuVo.getChild();
                if(CollUtil.isNotEmpty(child)){
                    List<Long> menuIdChilds = new ArrayList<>();
                    for(AdminUserMenuVo adminUserMenuVoChild : child){
                        Long id = adminUserMenuVoChild.getId();
                        menuIdChilds.add(id);
                    }
                    List<AdminUserMenuVo> adminUserMenuVoByOrderNum = menuMapper.selectAdminUserMenuVoOrderByOrderNum(menuIdChilds);
                    adminUserMenuVo.setChild(adminUserMenuVoByOrderNum);
                }
            }
        }
        return Result.ok(adminUserMenuVos);
    }
@@ -350,6 +371,23 @@
        return Result.ok("修改成功");
    }
    @Override
    public Result userInfo() {
        UserEntity loginUser = LoginUserUtil.getLoginUser();
        Long id = loginUser.getId();
        UserEntity userEntity = this.baseMapper.selectById(id);
        if(ObjectUtil.isEmpty(userEntity)){
            return Result.fail("用户不存在");
        }
        AdminUserInfoVo adminUserInfoVo = new AdminUserInfoVo();
        adminUserInfoVo.setId(userEntity.getId());
        adminUserInfoVo.setUsername(userEntity.getUsername());
        adminUserInfoVo.setNickname(userEntity.getNickname());
        adminUserInfoVo.setPhone(userEntity.getPhone());
        adminUserInfoVo.setEmail(userEntity.getEmail());
        return Result.ok(adminUserInfoVo);
    }
    private void saveUserRole(String roleIds,Long userId) {
        if (StrUtil.isNotEmpty(roleIds)) {
            String[] roleIdList = roleIds.split(StringPool.COMMA);
src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/WebSetServiceImpl.java
@@ -25,7 +25,7 @@
    @Override
    public Result seeWebSetInfo() {
        UserEntity userlogin = LoginUserUtil.getLoginUser();
        long belongId = userlogin.getBelongId() == null ? 0L : userlogin.getBelongId();
        long belongId = userlogin.getBelongId() == null ? UserEntity.USER_BELONG_TOP : userlogin.getBelongId();
        AdminSeeWebSetInfoVo adminSeeWebSetInfoVo = new AdminSeeWebSetInfoVo();
        QueryWrapper<WebSetEntity> objectQueryWrapper = new QueryWrapper<>();
        objectQueryWrapper.eq("belong_id",belongId);
@@ -44,7 +44,7 @@
    @Override
    public Result updateWebSet(AdminUpdateWebSetDto adminUpdateWebSetDto) {
        UserEntity userlogin = LoginUserUtil.getLoginUser();
        long belongId = userlogin.getBelongId() == null ? 0L : userlogin.getBelongId();
        long belongId = userlogin.getBelongId() == null ? UserEntity.USER_BELONG_TOP : userlogin.getBelongId();
        String webTitle = adminUpdateWebSetDto.getWebTitle();
        if(StrUtil.isEmpty(webTitle)){
            return Result.fail("请输入网页标题");
src/main/java/com/xcong/farmer/cms/modules/system/vo/AdminArticleVo.java
@@ -21,6 +21,9 @@
    @ApiModelProperty(value = "作者")
    private String author;
    @ApiModelProperty(value = "作者所属单位")
    private String authorBelong;
    @ApiModelProperty(value = "描述")
    private String remark;
@@ -40,7 +43,7 @@
    private String atlas;
    @ApiModelProperty(value = "发布时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date releaseTime;
    @ApiModelProperty(value = "是否立即发布 0:否 1:是")
src/main/java/com/xcong/farmer/cms/modules/system/vo/AdminSeeArticleInfoVo.java
@@ -21,6 +21,9 @@
    @ApiModelProperty(value = "作者")
    private String author;
    @ApiModelProperty(value = "作者所属单位")
    private String authorBelong;
    @ApiModelProperty(value = "描述")
    private String remark;
@@ -37,7 +40,7 @@
    private String atlas;
    @ApiModelProperty(value = "发布时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date releaseTime;
    @ApiModelProperty(value = "是否立即发布 0:否 1:是")
src/main/java/com/xcong/farmer/cms/modules/system/vo/AdminUserInfoVo.java
New file
@@ -0,0 +1,25 @@
package com.xcong.farmer.cms.modules.system.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "AdminUserInfoVo", description = "返回")
public class AdminUserInfoVo {
    @ApiModelProperty(value = "用户ID")
    private Long id;
    @ApiModelProperty(value = "用户名")
    private String username;
    @ApiModelProperty(value = "昵称")
    private String nickname;
    @ApiModelProperty(value = "联系电话")
    private String phone;
    @ApiModelProperty(value = "邮箱")
    private String email;
}
src/main/java/com/xcong/farmer/cms/modules/system/vo/AdminUserMenuVo.java
@@ -19,6 +19,9 @@
    @ApiModelProperty(value = "菜单类型 1:菜单 2:按钮")
    private Integer menuType;
    @ApiModelProperty(value = "排序")
    private Integer orderNum;
    @ApiModelProperty(value = "路由地址")
    private String routeUrl;
src/main/resources/mapper/BelongMapper.xml
@@ -12,6 +12,9 @@
                <if test="record.name!=null">
                    and a.name like concat ('%',#{record.name},'%')
                </if>
                <if test="record.id!=null">
                    and a.id = #{record.id}
                </if>
            </if>
        </where>
    </select>
src/main/resources/mapper/MenuMapper.xml
@@ -12,9 +12,6 @@
                <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
@@ -31,7 +28,13 @@
        SELECT
            a.*
        FROM
            t_menu a where a.parent_id = #{parentId} and a.belong_id = #{belongId}
            t_menu a
        <where>
                <if test="parentId != null">
                    and a.parent_id = #{parentId}
                </if>
        </where>
    </select>
    <select id="selectMenuEntityByIdAndParentId" resultType="com.xcong.farmer.cms.modules.system.entity.MenuEntity">
@@ -41,4 +44,22 @@
            t_menu a where a.parent_id != #{parentId} and a.id = #{menuId}
    </select>
    <select id="selectAdminUserMenuVoOrderByOrderNum" resultType="com.xcong.farmer.cms.modules.system.vo.AdminUserMenuVo">
        select a.* from t_menu a
        where a.id IN
        <foreach collection = "list" item = "item"  separator=","  open = "(" close = ")" >
            #{item}
        </foreach >
        order by a.order_num ASC
    </select>
    <select id="selectAdminMenuVoOrderByOrderNum" resultType="com.xcong.farmer.cms.modules.system.vo.AdminMenuVo">
        select a.* from t_menu a
        where a.id IN
        <foreach collection = "list" item = "item"  separator=","  open = "(" close = ")" >
            #{item}
        </foreach >
        order by a.order_num ASC
    </select>
</mapper>
src/main/resources/mapper/UserMapper.xml
@@ -9,6 +9,10 @@
        t_user a
        left join t_belong b on a.belong_id = b.id
        <where>
            and a.id not in (
            SELECT b.user_id FROM t_user_role b
            WHERE b.role_id = ( SELECT id FROM t_role WHERE role_name = #{record.roleName})
            )
            <if test="record != null" >
                <if test="record.username!=null">
                    and a.username like concat ('%',#{record.username},'%')