wks 6 месяцев назад
Родитель
Сommit
6b120a0679

+ 14 - 0
commons/src/main/java/com/jzg/commons/entity/dto/SysCommonFunctionDto.java

@@ -0,0 +1,14 @@
+package com.jzg.commons.entity.dto;
+
+import lombok.Data;
+
+@Data
+public class SysCommonFunctionDto {
+
+    private String id;
+
+    private String title;
+
+    private String name;
+
+}

+ 87 - 0
commons/src/main/java/com/jzg/commons/entity/po/SysCommonFunction.java

@@ -0,0 +1,87 @@
+package com.jzg.commons.entity.po;
+
+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 java.io.Serializable;
+import lombok.Data;
+
+/**
+ * 常用功能
+ * @TableName sys_common_function
+ */
+@TableName(value ="sys_common_function")
+@Data
+public class SysCommonFunction implements Serializable {
+    /**
+     * id
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 主题名称
+     */
+    @TableField(value = "title")
+    private String title;
+
+    /**
+     * 排序
+     */
+    @TableField(value = "order_num")
+    private Integer orderNum;
+
+    /**
+     * 对应菜单ID
+     */
+    @TableField(value = "menu_id")
+    private Long menuId;
+
+    @TableField(exist = false)
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public boolean equals(Object that) {
+        if (this == that) {
+            return true;
+        }
+        if (that == null) {
+            return false;
+        }
+        if (getClass() != that.getClass()) {
+            return false;
+        }
+        SysCommonFunction other = (SysCommonFunction) that;
+        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
+            && (this.getTitle() == null ? other.getTitle() == null : this.getTitle().equals(other.getTitle()))
+            && (this.getOrderNum() == null ? other.getOrderNum() == null : this.getOrderNum().equals(other.getOrderNum()))
+            && (this.getMenuId() == null ? other.getMenuId() == null : this.getMenuId().equals(other.getMenuId()));
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
+        result = prime * result + ((getTitle() == null) ? 0 : getTitle().hashCode());
+        result = prime * result + ((getOrderNum() == null) ? 0 : getOrderNum().hashCode());
+        result = prime * result + ((getMenuId() == null) ? 0 : getMenuId().hashCode());
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", id=").append(id);
+        sb.append(", title=").append(title);
+        sb.append(", orderNum=").append(orderNum);
+        sb.append(", menuId=").append(menuId);
+        sb.append(", serialVersionUID=").append(serialVersionUID);
+        sb.append("]");
+        return sb.toString();
+    }
+}

+ 12 - 0
platform/src/main/java/com/jzg/controller/SysMenuController.java

@@ -2,10 +2,12 @@ package com.jzg.controller;
 
 import com.jzg.commons.core.base.BaseController;
 import com.jzg.commons.core.page.HttpResult;
+import com.jzg.commons.entity.dto.SysCommonFunctionDto;
 import com.jzg.commons.entity.po.SysMenu;
 import com.jzg.commons.entity.vo.SystemMenuVo;
 import com.jzg.commons.util.StringUtils;
 import com.jzg.service.SysMenuService;
+import io.swagger.v3.oas.annotations.Operation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -64,6 +66,16 @@ public class SysMenuController extends BaseController {
         return HttpResult.ok(roleMenuTree);
     }
 
+    @GetMapping("/common/functions")
+    @Operation(summary = "常用功能")
+    public HttpResult<List<SysCommonFunctionDto>> getCommonFunction() {
+        String userId = getUserId();
+        String systemCode = getSystemCode();
+        List<SysCommonFunctionDto> sysCommonFunctionDto = sysMenuService.getCommonFunction(systemCode, userId);
+        return HttpResult.ok(sysCommonFunctionDto);
+    }
+
+
     @GetMapping(value = "/getAllButtons")
     public HttpResult getAllButtons(){
         String userId = getUserId();

+ 18 - 0
platform/src/main/java/com/jzg/mapper/SysCommonFunctionMapper.java

@@ -0,0 +1,18 @@
+package com.jzg.mapper;
+
+import com.jzg.commons.entity.po.SysCommonFunction;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+* @author Administrator
+* @description 针对表【sys_common_function(常用功能)】的数据库操作Mapper
+* @createDate 2026-03-11 18:06:05
+* @Entity com.jzg.commons.entity.po.SysCommonFunction
+*/
+public interface SysCommonFunctionMapper extends BaseMapper<SysCommonFunction> {
+
+}
+
+
+
+

+ 10 - 0
platform/src/main/java/com/jzg/mapper/SysMenuMapper.java

@@ -1,6 +1,7 @@
 package com.jzg.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.jzg.commons.entity.dto.SysCommonFunctionDto;
 import com.jzg.commons.entity.po.SysMenu;
 import com.jzg.commons.entity.po.SysSystemMenu;
 import com.jzg.commons.entity.vo.SystemMenuVo;
@@ -16,4 +17,13 @@ public interface SysMenuMapper extends BaseMapper<SysMenu> {
     public List<SysMenu> getSystemMenusRecursion(String systemCode);
 
     public List<SysMenu> getMenuByRoleId(String roleId);
+
+    /**
+     * 获取常用菜单列表
+     *
+     * @param systemCode 租户编码
+     * @param userId     用户id
+     * @return 常用菜单
+     */
+    List<SysCommonFunctionDto> getCommonFunction(String systemCode, String userId);
 }

+ 13 - 0
platform/src/main/java/com/jzg/service/SysCommonFunctionService.java

@@ -0,0 +1,13 @@
+package com.jzg.service;
+
+import com.jzg.commons.entity.po.SysCommonFunction;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+* @author Administrator
+* @description 针对表【sys_common_function(常用功能)】的数据库操作Service
+* @createDate 2026-03-11 18:06:05
+*/
+public interface SysCommonFunctionService extends IService<SysCommonFunction> {
+
+}

+ 8 - 1
platform/src/main/java/com/jzg/service/SysMenuService.java

@@ -2,6 +2,7 @@ package com.jzg.service;
 
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.jzg.commons.entity.dto.SysCommonFunctionDto;
 import com.jzg.commons.entity.po.SysMenu;
 import com.jzg.commons.entity.vo.SystemMenuVo;
 
@@ -27,7 +28,13 @@ public interface SysMenuService extends IService<SysMenu> {
      */
     public List<SysMenu> getMenuByRoleId(String roleId);
 
-
+    /**
+     * 获取常用
+     * @param systemCode
+     * @param userId
+     * @return
+     */
+    List<SysCommonFunctionDto> getCommonFunction(String systemCode, String userId);
 }
 
 

+ 22 - 0
platform/src/main/java/com/jzg/service/impl/SysCommonFunctionServiceImpl.java

@@ -0,0 +1,22 @@
+package com.jzg.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.jzg.commons.entity.po.SysCommonFunction;
+import com.jzg.service.SysCommonFunctionService;
+import com.jzg.mapper.SysCommonFunctionMapper;
+import org.springframework.stereotype.Service;
+
+/**
+* @author Administrator
+* @description 针对表【sys_common_function(常用功能)】的数据库操作Service实现
+* @createDate 2026-03-11 18:06:05
+*/
+@Service
+public class SysCommonFunctionServiceImpl extends ServiceImpl<SysCommonFunctionMapper, SysCommonFunction>
+    implements SysCommonFunctionService{
+
+}
+
+
+
+

+ 5 - 1
platform/src/main/java/com/jzg/service/impl/SysMenuServiceImpl.java

@@ -2,6 +2,7 @@ package com.jzg.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.jzg.commons.entity.dto.SysCommonFunctionDto;
 import com.jzg.commons.entity.po.SysMenu;
 import com.jzg.commons.entity.po.SysSystemMenu;
 import com.jzg.commons.entity.po.SysUserRole;
@@ -201,7 +202,10 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu>
         }
     }
 
-
+    @Override
+    public List<SysCommonFunctionDto> getCommonFunction(String systemCode, String userId) {
+        return this.baseMapper.getCommonFunction(systemCode, userId);
+    }
 }
 
 

+ 17 - 0
platform/src/main/resources/mapper/SysCommonFunctionMapper.xml

@@ -0,0 +1,17 @@
+<?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.jzg.mapper.SysCommonFunctionMapper">
+
+    <resultMap id="BaseResultMap" type="com.jzg.commons.entity.po.SysCommonFunction">
+            <id property="id" column="id" />
+            <result property="title" column="title" />
+            <result property="orderNum" column="order_num" />
+            <result property="menuId" column="menu_id" />
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id,title,order_num,menu_id
+    </sql>
+</mapper>

+ 32 - 31
platform/src/main/resources/mapper/SysMenuMapper.xml

@@ -2,33 +2,23 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.jzg.mapper.SysMenuMapper">
     <select id="getSystemMenus" resultType="com.jzg.commons.entity.po.SysMenu">
-        SELECT
-            sm.*
-        FROM
-            sys_system_menu ssm
-                LEFT JOIN sys_menu sm ON ssm.menu_id = sm.id
-        WHERE
-            ssm.system_code = #{systemCode}
+        SELECT sm.*
+        FROM sys_system_menu ssm
+                 LEFT JOIN sys_menu sm ON ssm.menu_id = sm.id
+        WHERE ssm.system_code = #{systemCode}
     </select>
 
     <select id="getSystemMenusRecursion" resultType="com.jzg.commons.entity.po.SysMenu">
-        WITH RECURSIVE company_tree AS (
-            SELECT
-                sm.*
-            FROM
-                sys_system_menu ssm
-                    LEFT JOIN sys_menu sm ON ssm.menu_id = sm.id
-            WHERE
-                ssm.system_code = #{systemCode}
-
-            UNION ALL
-
-            SELECT
-                sm.*
-            FROM
-                sys_menu sm
-                    INNER JOIN company_tree mt ON sm.parent_id = mt.id
-        )
+        WITH RECURSIVE company_tree AS (SELECT sm.*
+                                        FROM sys_system_menu ssm
+                                                 LEFT JOIN sys_menu sm ON ssm.menu_id = sm.id
+                                        WHERE ssm.system_code = #{systemCode}
+
+                                        UNION ALL
+
+                                        SELECT sm.*
+                                        FROM sys_menu sm
+                                                 INNER JOIN company_tree mt ON sm.parent_id = mt.id)
         SELECT *
         FROM company_tree
         ORDER BY parent_id, id;
@@ -36,12 +26,23 @@
     </select>
 
     <select id="getMenuByRoleId" resultType="com.jzg.commons.entity.po.SysMenu">
-        SELECT
-            sm.*
-        FROM
-            sys_role_perms srp
-                LEFT JOIN sys_menu sm ON srp.perms_id = sm.id
-        WHERE
-            srp.role_id = #{roleId}
+        SELECT sm.*
+        FROM sys_role_perms srp
+                 LEFT JOIN sys_menu sm ON srp.perms_id = sm.id
+        WHERE srp.role_id = #{roleId}
+    </select>
+
+    <select id="getCommonFunction" resultType="com.jzg.commons.entity.dto.SysCommonFunctionDto">
+        select scf.id, scf.title, sm.name
+        from sys_common_function scf
+                 left join sys_menu sm on scf.menu_id = sm.id
+                 left join sys_role_menu srm on sm.id = srm.menu_id
+                 left join sys_user_role sur on sur.role_id = srm.role_id
+                 left join sys_user_jzg_info suji on suji.user_id = sur.user_id
+        where suji.user_id = #{userId}
+          and suji.system_code = #{systemCode}
+        order by scf.order_num
     </select>
+
+
 </mapper>

+ 1 - 0
platform/src/main/resources/mapper/SysUserRoleMapper.xml

@@ -17,4 +17,5 @@
             ur.is_delete = 0
           AND ur.user_id = #{userId} AND r.system_code = #{systemCode}
     </select>
+
 </mapper>

+ 0 - 6
tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/controller/HomepageDataController.java

@@ -28,12 +28,6 @@ public class HomepageDataController {
         return HttpResult.ok(dailyDataVo);
     }
 
-    @GetMapping("/common/functions")
-    @Operation(summary = "常用功能")
-    public HttpResult<Object> getCommonFunction() {
-        return HttpResult.ok();
-    }
-
     @GetMapping("/business/distribution")
     @Operation(summary = "业务员分布")
     public HttpResult<List<BusinessDistributionVo>> getBusinessDistribution(@RequestParam(value = "province") String province) {