From 3f9ebf19e687c33287b0eaec64d4564a212f57db Mon Sep 17 00:00:00 2001
From: mg <maokecheng@163.com>
Date: 星期三, 12 十月 2022 16:59:57 +0800
Subject: [PATCH] Merge branch 'master' of http://42.193.1.25:9521/r/sccg_server

---
 ycl-common/src/main/java/com/ycl/entity/user/AdminMenuRelation.java                  |   49 ++++++++
 ycl-common/src/main/resources/mapper/user/AdminMenuRelationMapper.xml                |   18 +++
 ycl-common/src/main/java/com/ycl/mapper/user/UmsMenuMapper.java                      |    3 
 ycl-common/src/main/java/com/ycl/service/user/IAdminMenuRelationService.java         |   16 ++
 ycl-common/src/main/java/com/ycl/aspect/LogAspect.java                               |   65 ++++++++++
 ycl-common/src/main/resources/mapper/user/UmsMenuMapper.xml                          |   12 ++
 ycl-common/src/main/java/com/ycl/service/user/UmsMenuService.java                    |    4 
 ycl-common/src/main/java/com/ycl/service/user/impl/AdminMenuRelationServiceImpl.java |   20 +++
 ycl-common/src/main/java/com/ycl/annotation/LogSave.java                             |   13 ++
 ycl-common/src/main/java/com/ycl/service/user/impl/UmsAdminServiceImpl.java          |   45 ++++++-
 ycl-common/src/main/java/com/ycl/mapper/user/AdminMenuRelationMapper.java            |   16 ++
 ycl-common/src/main/java/com/ycl/entity/user/vo/UmsMenuVo.java                       |   10 +
 ycl-platform/src/main/java/com/ycl/controller/portal/UmsWebsitePortalController.java |   24 ++++
 ycl-common/pom.xml                                                                   |    5 
 ycl-common/src/main/java/com/ycl/entity/user/UmsAdminLoginLog.java                   |    4 
 ycl-common/src/main/java/com/ycl/service/user/impl/UmsMenuServiceImpl.java           |   35 +++++
 16 files changed, 325 insertions(+), 14 deletions(-)

diff --git a/ycl-common/pom.xml b/ycl-common/pom.xml
index e990e7f..36dde88 100644
--- a/ycl-common/pom.xml
+++ b/ycl-common/pom.xml
@@ -27,6 +27,11 @@
 
         <dependency>
             <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-aop</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-test</artifactId>
             <scope>test</scope>
         </dependency>
diff --git a/ycl-common/src/main/java/com/ycl/annotation/LogSave.java b/ycl-common/src/main/java/com/ycl/annotation/LogSave.java
new file mode 100644
index 0000000..7b1872f
--- /dev/null
+++ b/ycl-common/src/main/java/com/ycl/annotation/LogSave.java
@@ -0,0 +1,13 @@
+package com.ycl.annotation;
+
+import java.lang.annotation.*;
+
+@Documented
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface LogSave {
+
+    String operationType() default "";
+
+    String contain() default "";
+}
diff --git a/ycl-common/src/main/java/com/ycl/aspect/LogAspect.java b/ycl-common/src/main/java/com/ycl/aspect/LogAspect.java
new file mode 100644
index 0000000..85d7ba7
--- /dev/null
+++ b/ycl-common/src/main/java/com/ycl/aspect/LogAspect.java
@@ -0,0 +1,65 @@
+package com.ycl.aspect;
+
+import com.ycl.annotation.LogSave;
+import com.ycl.bo.AdminUserDetails;
+import com.ycl.entity.user.UmsAdminLoginLog;
+import com.ycl.mapper.user.UmsAdminLoginLogMapper;
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Before;
+import org.aspectj.lang.annotation.Pointcut;
+import org.aspectj.lang.reflect.MethodSignature;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.stereotype.Component;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import java.lang.reflect.Method;
+import java.util.Date;
+
+@Component
+@Aspect
+public class LogAspect {
+
+    @Resource
+    UmsAdminLoginLogMapper umsAdminLoginLogMapper;
+
+    @Pointcut("@annotation(com.ycl.annotation.LogSave)")
+    public void pointCut() {
+    }
+
+    @Before("pointCut()")
+    public void handle(JoinPoint joinPoint) {
+        MethodSignature signature = (MethodSignature) joinPoint.getSignature();
+        Method method = signature.getMethod();
+        LogSave annotation = method.getAnnotation(LogSave.class);
+        AdminUserDetails adminUserDetails = (AdminUserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
+        UmsAdminLoginLog loginLog = new UmsAdminLoginLog();
+        loginLog.setAdminId(adminUserDetails.getUserId());
+        loginLog.setCreateTime(new Date());
+        ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
+        HttpServletRequest request = attributes.getRequest();
+        loginLog.setIp(request.getRemoteAddr());
+        String header = request.getHeader("user-agent");
+        if (header.contains("Windows NT")) {
+            loginLog.setUserAgent("Web绔�");
+        }
+        else if(header.contains("Android")) {
+            loginLog.setUserAgent("Android绔�");
+        }
+        else if(header.contains("iPhone")) {
+            loginLog.setUserAgent("ios绔�");
+        }
+        else if(header.contains("iPad")) {
+            loginLog.setUserAgent("iPad绔�");
+        }else {
+            loginLog.setUserAgent("Web绔�");
+        }
+        loginLog.setOperationType(annotation.operationType());
+        loginLog.setContain(annotation.contain());
+        umsAdminLoginLogMapper.insert(loginLog);
+    }
+
+}
diff --git a/ycl-common/src/main/java/com/ycl/entity/user/AdminMenuRelation.java b/ycl-common/src/main/java/com/ycl/entity/user/AdminMenuRelation.java
new file mode 100644
index 0000000..7536626
--- /dev/null
+++ b/ycl-common/src/main/java/com/ycl/entity/user/AdminMenuRelation.java
@@ -0,0 +1,49 @@
+package com.ycl.entity.user;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 鍚庡彴鐢ㄦ埛鑿滃崟鍏崇郴琛�
+ * </p>
+ *
+ * @author zhanghua
+ * @since 2022-10-12
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@TableName("ums_admin_menu_relation")
+public class AdminMenuRelation implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 瑙掕壊ID
+     */
+    @TableField("admin_id")
+    private Long adminId;
+
+    /**
+     * 鑿滃崟ID
+     */
+    @TableField("menu_id")
+    private Long menuId;
+
+    /**
+     * 鏄惁鍚敤(1鍚敤)
+     */
+    @TableField("is_start")
+    private Integer isStart;
+
+
+}
diff --git a/ycl-common/src/main/java/com/ycl/entity/user/UmsAdminLoginLog.java b/ycl-common/src/main/java/com/ycl/entity/user/UmsAdminLoginLog.java
index 8ee790a..b210d2c 100644
--- a/ycl-common/src/main/java/com/ycl/entity/user/UmsAdminLoginLog.java
+++ b/ycl-common/src/main/java/com/ycl/entity/user/UmsAdminLoginLog.java
@@ -41,5 +41,9 @@
     @ApiModelProperty(value = "娴忚鍣ㄧ櫥褰曠被鍨�")
     private String userAgent;
 
+    @ApiModelProperty(value = "鎿嶄綔绫诲瀷")
+    private String operationType;
 
+    @ApiModelProperty(value = "鎿嶄綔鍐呭")
+    private String contain;
 }
diff --git a/ycl-common/src/main/java/com/ycl/entity/user/vo/UmsMenuVo.java b/ycl-common/src/main/java/com/ycl/entity/user/vo/UmsMenuVo.java
index 053a5cd..c39b185 100644
--- a/ycl-common/src/main/java/com/ycl/entity/user/vo/UmsMenuVo.java
+++ b/ycl-common/src/main/java/com/ycl/entity/user/vo/UmsMenuVo.java
@@ -23,10 +23,10 @@
 @Data
 @EqualsAndHashCode(callSuper = false)
 @TableName("ums_menu")
-@ApiModel(value="UmsMenuVo瀵硅薄", description="鑷畾涔夎彍鍗曡緭鍑�")
+@ApiModel(value = "UmsMenuVo瀵硅薄", description = "鑷畾涔夎彍鍗曡緭鍑�")
 public class UmsMenuVo implements Serializable {
 
-    private static final long serialVersionUID=1L;
+    private static final long serialVersionUID = 1L;
 
     @TableId(value = "id", type = IdType.AUTO)
     private Long id;
@@ -55,5 +55,11 @@
     @ApiModelProperty(value = "鍓嶇闅愯棌")
     private Integer hidden;
 
+    @ApiModelProperty(value = "鍏崇郴id")
+    private Long relationId;
+
+    @ApiModelProperty(value = "鏄惁寮�鍚�")
+    private Integer isStart;
+
     List<UmsMenuVo> menuVoArrayList;
 }
diff --git a/ycl-common/src/main/java/com/ycl/mapper/user/AdminMenuRelationMapper.java b/ycl-common/src/main/java/com/ycl/mapper/user/AdminMenuRelationMapper.java
new file mode 100644
index 0000000..59694fa
--- /dev/null
+++ b/ycl-common/src/main/java/com/ycl/mapper/user/AdminMenuRelationMapper.java
@@ -0,0 +1,16 @@
+package com.ycl.mapper.user;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ycl.entity.user.AdminMenuRelation;
+
+/**
+ * <p>
+ * 鍚庡彴瑙掕壊鑿滃崟鍏崇郴琛� Mapper 鎺ュ彛
+ * </p>
+ *
+ * @author zhanghua
+ * @since 2022-10-12
+ */
+public interface AdminMenuRelationMapper extends BaseMapper<AdminMenuRelation> {
+
+}
diff --git a/ycl-common/src/main/java/com/ycl/mapper/user/UmsMenuMapper.java b/ycl-common/src/main/java/com/ycl/mapper/user/UmsMenuMapper.java
index a5fd464..03e1231 100644
--- a/ycl-common/src/main/java/com/ycl/mapper/user/UmsMenuMapper.java
+++ b/ycl-common/src/main/java/com/ycl/mapper/user/UmsMenuMapper.java
@@ -2,6 +2,7 @@
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ycl.entity.user.UmsMenu;
+import com.ycl.entity.user.vo.UmsMenuVo;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -25,4 +26,6 @@
      */
     List<UmsMenu> getMenuListByRoleId(@Param("roleId") Long roleId);
 
+    List<UmsMenuVo> adminMenuRelation(@Param("id") Long id);
+
 }
diff --git a/ycl-common/src/main/java/com/ycl/service/user/IAdminMenuRelationService.java b/ycl-common/src/main/java/com/ycl/service/user/IAdminMenuRelationService.java
new file mode 100644
index 0000000..4d3de92
--- /dev/null
+++ b/ycl-common/src/main/java/com/ycl/service/user/IAdminMenuRelationService.java
@@ -0,0 +1,16 @@
+package com.ycl.service.user;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ycl.entity.user.AdminMenuRelation;
+
+/**
+ * <p>
+ * 鍚庡彴瑙掕壊鑿滃崟鍏崇郴琛� 鏈嶅姟绫�
+ * </p>
+ *
+ * @author zhanghua
+ * @since 2022-10-12
+ */
+public interface IAdminMenuRelationService extends IService<AdminMenuRelation> {
+
+}
diff --git a/ycl-common/src/main/java/com/ycl/service/user/UmsMenuService.java b/ycl-common/src/main/java/com/ycl/service/user/UmsMenuService.java
index 7a19c1d..70ed2e3 100644
--- a/ycl-common/src/main/java/com/ycl/service/user/UmsMenuService.java
+++ b/ycl-common/src/main/java/com/ycl/service/user/UmsMenuService.java
@@ -5,6 +5,7 @@
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.ycl.dto.UmsMenuNode;
 import com.ycl.entity.user.UmsMenu;
+import com.ycl.entity.user.vo.UmsMenuVo;
 
 import java.util.List;
 
@@ -37,4 +38,7 @@
      * 淇敼鑿滃崟鏄剧ず鐘舵��
      */
     boolean updateHidden(Long id, Integer hidden);
+
+
+    List<UmsMenuVo> ListTreeMyself(Long id);
 }
diff --git a/ycl-common/src/main/java/com/ycl/service/user/impl/AdminMenuRelationServiceImpl.java b/ycl-common/src/main/java/com/ycl/service/user/impl/AdminMenuRelationServiceImpl.java
new file mode 100644
index 0000000..caeba68
--- /dev/null
+++ b/ycl-common/src/main/java/com/ycl/service/user/impl/AdminMenuRelationServiceImpl.java
@@ -0,0 +1,20 @@
+package com.ycl.service.user.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ycl.entity.user.AdminMenuRelation;
+import com.ycl.mapper.user.AdminMenuRelationMapper;
+import com.ycl.service.user.IAdminMenuRelationService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 鍚庡彴瑙掕壊鑿滃崟鍏崇郴琛� 鏈嶅姟瀹炵幇绫�
+ * </p>
+ *
+ * @author zhanghua
+ * @since 2022-10-12
+ */
+@Service
+public class AdminMenuRelationServiceImpl extends ServiceImpl<AdminMenuRelationMapper, AdminMenuRelation> implements IAdminMenuRelationService {
+
+}
diff --git a/ycl-common/src/main/java/com/ycl/service/user/impl/UmsAdminServiceImpl.java b/ycl-common/src/main/java/com/ycl/service/user/impl/UmsAdminServiceImpl.java
index 4c6c5a6..9125d9e 100644
--- a/ycl-common/src/main/java/com/ycl/service/user/impl/UmsAdminServiceImpl.java
+++ b/ycl-common/src/main/java/com/ycl/service/user/impl/UmsAdminServiceImpl.java
@@ -77,6 +77,10 @@
     private RedisService redisService;
     @Resource
     private UmsDepartManageMapper umsDepartManageMapper;
+    @Resource
+    UmsRoleMenuRelationMapper umsRoleMenuRelationMapper;
+    @Resource
+    AdminMenuRelationMapper adminMenuRelationMapper;
 
     @Override
     public UmsAdmin getAdminByUsername(String username) {
@@ -118,13 +122,38 @@
         List<Long> ids = umsAdminParam.getRoleIds();
         if (!ids.isEmpty()) {
             List<UmsAdminRoleRelation> roleIds = new ArrayList<>();
-            for(Long id:ids){
+            for (Long id : ids) {
                 UmsAdminRoleRelation urr = new UmsAdminRoleRelation();
                 urr.setAdminId(umsAdmin.getId());
                 urr.setRoleId(id);
                 roleIds.add(urr);
-             }
+            }
             umsAdminRoleRelationService.saveBatch(roleIds);
+        }
+        //缁戝畾鑿滃崟浜庣敤鎴�
+        if (!ids.isEmpty()) {
+            Integer size = 0;
+            Long maxId = null;
+            for (Long id : ids) {
+                if (size < umsRoleMenuRelationMapper
+                        .selectList(new LambdaQueryWrapper<UmsRoleMenuRelation>()
+                                .eq(UmsRoleMenuRelation::getRoleId, id)).size()) {
+                    size = umsRoleMenuRelationMapper
+                            .selectList(new LambdaQueryWrapper<UmsRoleMenuRelation>()
+                                    .eq(UmsRoleMenuRelation::getRoleId, id)).size();
+                    maxId = id;
+                }
+            }
+            umsRoleMenuRelationMapper
+                    .selectList(new LambdaQueryWrapper<UmsRoleMenuRelation>()
+                            .eq(UmsRoleMenuRelation::getRoleId, maxId))
+                    .stream()
+                    .forEach(item->{
+                        AdminMenuRelation adminMenuRelation = new AdminMenuRelation();
+                        adminMenuRelation.setAdminId(umsAdmin.getId());
+                        adminMenuRelation.setMenuId(item.getMenuId());
+                        adminMenuRelationMapper.insert(adminMenuRelation);
+                    });
         }
         //瀵圭敤鎴峰悕绯荤粺榛樿娣诲姞
         umsAdmin.setNickName(RandomUtils.getUserId(umsAdmin.getId()));
@@ -341,8 +370,8 @@
                     e.setDepartName(umsDepart.getDepartName());
                 }
                 //鑾峰彇瑙掕壊鍒楄〃
-               List<UmsRole> roles = umsRoleMapper.getRoleList(e.getId());
-               e.setRoles(roles);
+                List<UmsRole> roles = umsRoleMapper.getRoleList(e.getId());
+                e.setRoles(roles);
             });
         }
         return page1;
@@ -359,11 +388,11 @@
     public boolean updateStatusBatch(List<Long> ids, Integer status) {
         List<UmsAdmin> users = new ArrayList<>();
         for (Long id : ids) {
-            UmsAdmin umsAdmin =  UmsAdmin.builder().
+            UmsAdmin umsAdmin = UmsAdmin.builder().
                     id(id).status(status).build();
             users.add(umsAdmin);
         }
-        updateBatchById(users,users.size());
+        updateBatchById(users, users.size());
         getCacheService().delBatchAdmin(ids);
         return true;
     }
@@ -372,8 +401,8 @@
     public List<UmsAdmin> getDepartUser(Long departId) {
         QueryWrapper<UmsDepartManage> wrapper = new QueryWrapper<>();
         wrapper.lambda().eq(UmsDepartManage::getDepartId, departId);
-        List<UmsDepartManage>  list = umsDepartManageMapper.selectList(wrapper);
-        List<Long> userIds  = list.stream().map(UmsDepartManage::getUserId).collect(Collectors.toList());
+        List<UmsDepartManage> list = umsDepartManageMapper.selectList(wrapper);
+        List<Long> userIds = list.stream().map(UmsDepartManage::getUserId).collect(Collectors.toList());
         QueryWrapper<UmsAdmin> wrapperUser = new QueryWrapper<>();
         wrapperUser.in("id", userIds);
         List<UmsAdmin> adminList = baseMapper.selectList(wrapperUser);
diff --git a/ycl-common/src/main/java/com/ycl/service/user/impl/UmsMenuServiceImpl.java b/ycl-common/src/main/java/com/ycl/service/user/impl/UmsMenuServiceImpl.java
index 1370b28..1ce1c77 100644
--- a/ycl-common/src/main/java/com/ycl/service/user/impl/UmsMenuServiceImpl.java
+++ b/ycl-common/src/main/java/com/ycl/service/user/impl/UmsMenuServiceImpl.java
@@ -5,20 +5,29 @@
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ycl.dto.UmsMenuNode;
 import com.ycl.entity.user.UmsMenu;
+import com.ycl.entity.user.vo.UmsMenuVo;
+import com.ycl.mapper.user.AdminMenuRelationMapper;
 import com.ycl.mapper.user.UmsMenuMapper;
 import com.ycl.service.user.UmsMenuService;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
 import java.util.Date;
 import java.util.List;
+import java.util.Objects;
 import java.util.stream.Collectors;
 
 /**
  * 鍚庡彴鑿滃崟绠$悊Service瀹炵幇绫�
  */
 @Service
-public class UmsMenuServiceImpl extends ServiceImpl<UmsMenuMapper, UmsMenu>implements UmsMenuService {
+public class UmsMenuServiceImpl extends ServiceImpl<UmsMenuMapper, UmsMenu> implements UmsMenuService {
+
+    @Resource
+    AdminMenuRelationMapper adminMenuRelationMapper;
+    @Resource
+    UmsMenuMapper umsMenuMapper;
 
     @Override
     public boolean create(UmsMenu umsMenu) {
@@ -26,6 +35,7 @@
         updateLevel(umsMenu);
         return save(umsMenu);
     }
+
 
     /**
      * 淇敼鑿滃崟灞傜骇
@@ -54,11 +64,11 @@
 
     @Override
     public Page<UmsMenu> list(Long parentId, Integer pageSize, Integer pageNum) {
-        Page<UmsMenu> page = new Page<>(pageNum,pageSize);
+        Page<UmsMenu> page = new Page<>(pageNum, pageSize);
         QueryWrapper<UmsMenu> wrapper = new QueryWrapper<>();
-        wrapper.lambda().eq(UmsMenu::getParentId,parentId)
+        wrapper.lambda().eq(UmsMenu::getParentId, parentId)
                 .orderByDesc(UmsMenu::getSort);
-        return page(page,wrapper);
+        return page(page, wrapper);
     }
 
     @Override
@@ -78,6 +88,23 @@
         return updateById(umsMenu);
     }
 
+    @Override
+    public List<UmsMenuVo> ListTreeMyself(Long id) {
+        List<UmsMenuVo> fatherUmsMenuVoList = umsMenuMapper.adminMenuRelation(id);
+        List<UmsMenuVo> umsMenuVoList = fatherUmsMenuVoList.stream()
+                .filter(item -> item.getParentId() == 0L)
+                .peek(item -> item.setMenuVoArrayList(getChildren(item, fatherUmsMenuVoList)))
+                .collect(Collectors.toList());
+        return umsMenuVoList;
+    }
+
+    public List<UmsMenuVo> getChildren(UmsMenuVo root, List<UmsMenuVo> allMenus) {
+        return allMenus.stream()
+                .filter(menu -> Objects.equals(menu.getParentId(), root.getId()))
+                .peek(menu -> menu.setMenuVoArrayList(getChildren(menu, allMenus)))
+                .collect(Collectors.toList());
+    }
+
     /**
      * 灏哢msMenu杞寲涓篣msMenuNode骞惰缃甤hildren灞炴��
      */
diff --git a/ycl-common/src/main/resources/mapper/user/AdminMenuRelationMapper.xml b/ycl-common/src/main/resources/mapper/user/AdminMenuRelationMapper.xml
new file mode 100644
index 0000000..7ee3aa9
--- /dev/null
+++ b/ycl-common/src/main/resources/mapper/user/AdminMenuRelationMapper.xml
@@ -0,0 +1,18 @@
+<?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.ycl.mapper.user.AdminMenuRelationMapper">
+
+    <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+    <resultMap id="BaseResultMap" type="com.ycl.entity.user.AdminMenuRelation">
+        <id column="id" property="id" />
+        <result column="admin_id" property="adminId" />
+        <result column="menu_id" property="menuId" />
+        <result column="is_start" property="isStart" />
+    </resultMap>
+
+    <!-- 閫氱敤鏌ヨ缁撴灉鍒� -->
+    <sql id="Base_Column_List">
+        id, admin_id, menu_id, is_start
+    </sql>
+
+</mapper>
diff --git a/ycl-common/src/main/resources/mapper/user/UmsMenuMapper.xml b/ycl-common/src/main/resources/mapper/user/UmsMenuMapper.xml
index 11212c6..3d8bac3 100644
--- a/ycl-common/src/main/resources/mapper/user/UmsMenuMapper.xml
+++ b/ycl-common/src/main/resources/mapper/user/UmsMenuMapper.xml
@@ -58,4 +58,16 @@
             m.id
     </select>
 
+    <select id="adminMenuRelation" resultType="com.ycl.entity.user.vo.UmsMenuVo">
+        SELECT
+            amr.id AS relationId,
+            amr.is_start AS isStart,
+            m.*
+        FROM
+            `ums_admin_menu_relation` AS amr
+                JOIN ums_menu AS m ON amr.menu_id = m.id
+        WHERE
+            amr.admin_id = #{id}
+    </select>
+
 </mapper>
diff --git a/ycl-platform/src/main/java/com/ycl/controller/portal/UmsWebsitePortalController.java b/ycl-platform/src/main/java/com/ycl/controller/portal/UmsWebsitePortalController.java
index d8a7d90..3fde2c6 100644
--- a/ycl-platform/src/main/java/com/ycl/controller/portal/UmsWebsitePortalController.java
+++ b/ycl-platform/src/main/java/com/ycl/controller/portal/UmsWebsitePortalController.java
@@ -2,18 +2,23 @@
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ycl.annotation.LogSave;
 import com.ycl.api.CommonResult;
+import com.ycl.bo.AdminUserDetails;
 import com.ycl.entity.portal.ThirdApplications;
 import com.ycl.entity.portal.WebsiteLogo;
+import com.ycl.entity.user.AdminMenuRelation;
 import com.ycl.entity.user.UmsMenu;
 import com.ycl.entity.user.vo.UmsMenuVo;
 import com.ycl.service.portal.UmsThirdApplicationsService;
 import com.ycl.service.portal.UmsWebsiteLogoService;
+import com.ycl.service.user.IAdminMenuRelationService;
 import com.ycl.service.user.UmsMenuService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.core.context.SecurityContextHolder;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
@@ -31,6 +36,8 @@
     UmsMenuService umsMenuService;
     @Autowired
     UmsThirdApplicationsService umsThirdApplicationsService;
+    @Autowired
+    IAdminMenuRelationService iAdminMenuRelationService;
 
     @ApiOperation("logo绠$悊-娣诲姞logo")
     @PostMapping("/logo/add")
@@ -101,6 +108,23 @@
         return CommonResult.success(menus);
     }
 
+    @ApiOperation("鑿滃崟鏉冮檺-涓汉鑿滃崟鏌ヨ")
+    @GetMapping("/menu/search_myself")
+    @LogSave(contain = "鐧诲綍鎷垮埌涓汉鑿滃崟",operationType = "涓汉鎿嶄綔")
+    public CommonResult searchMenusMyself() {
+        AdminUserDetails user = (AdminUserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
+        return CommonResult.success(umsMenuService.ListTreeMyself(user.getUserId()));
+    }
+
+    @ApiOperation("鑿滃崟鏉冮檺-涓汉鑿滃崟鐘舵�佷慨鏀�")
+    @PutMapping("/menu/modification_myself")
+    public CommonResult modifyMenusMyself(@RequestParam Long relationId, Integer status) {
+        AdminMenuRelation adminMenuRelation = new AdminMenuRelation();
+        adminMenuRelation.setId(relationId);
+        adminMenuRelation.setIsStart(status);
+        return CommonResult.success(iAdminMenuRelationService.updateById(adminMenuRelation));
+    }
+
     @ApiOperation("鑷畾涔夎彍鍗�-娣诲姞鑿滃崟")
     @PostMapping("/menu/add")
     public CommonResult addMenu(@RequestBody UmsMenu umsMenu) {

--
Gitblit v1.8.0