Przeglądaj źródła

提交查询页面参数的接口

hxl13994548489 1 rok temu
rodzic
commit
1e865fd4d9

+ 12 - 0
commons/src/main/java/com/jzg/commons/entity/report/dto/ReportSearchConfigurationDto.java

@@ -67,4 +67,16 @@ public class ReportSearchConfigurationDto implements Serializable {
     @JsonIgnore
     @Schema(description = "sql")
     private String searchSql;
+
+    /**
+     * 是否默认   true 是  false 否
+     */
+    @Schema(description = "是否默认   true 是  false 否")
+    private boolean defaultFlag;
+
+    /**
+     * 是否可以选择   true 是  false 否
+     */
+    @Schema(description = "是否可以选择   true 是  false 否")
+    private boolean selectFlag;
 }

+ 17 - 0
consoleStatistics/src/main/java/com/jzg/console/controller/ReportSearchConfigurationController.java

@@ -49,6 +49,23 @@ public class ReportSearchConfigurationController extends BaseController {
             return HttpResult.error(e.getMessage());
         }
     }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/9/15 18:11
+     *  @Description: 导出任务中心-列表查询
+     */
+    @Operation(summary = "公共查询参数管理-查询页面默认参数", description = "公共查询参数管理-查询页面默认参数")
+    @GetMapping(value = "/getSearchDefaultList")
+    public HttpResult<?> getSearchDefaultList(@RequestParam(name="userId",required=true) String userId,@RequestParam(name="routerKey",required=true) String routerKey) {
+        try{
+            List<ReportSearchConfigurationDto> list = reportSearchConfigurationService.getSearchDefaultList(userId,routerKey);
+            return HttpResult.ok(list);
+        }catch (Exception e){
+            return HttpResult.error(e.getMessage());
+        }
+    }
     /**
      *  @version
      *  @author: hxl

+ 8 - 1
consoleStatistics/src/main/java/com/jzg/console/mapper/ReportSearchConfigurationMapper.java

@@ -57,9 +57,16 @@ public interface ReportSearchConfigurationMapper extends BaseMapper<ReportSearch
      *  @version
      *  @author: hxl
      *  @Date: 2025/9/17 15:09
-     *  @Description:
+     *  @Description: 通过保险公司查询合作公司三级id
      */
     List<ReportDictDto> getPartnerCompanyListByCompanyId(@Param("companyId") String companyId);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/9/18 10:41
+     *  @Description:  查看页面默认参数
+     */
+    List<ReportSearchConfigurationDto> getSearchDefaultList(@Param("routerKey") String routerKey);
 }
 
 

+ 7 - 0
consoleStatistics/src/main/java/com/jzg/console/service/ReportSearchConfigurationService.java

@@ -44,4 +44,11 @@ public interface ReportSearchConfigurationService extends IService<ReportSearchC
      *  @Description:  查询管理员列表
      */
     List<ReportDictDto> getUserManageListByUserId(String userId);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/9/18 10:34
+     *  @Description: 查询默认参数列表
+     */
+    List<ReportSearchConfigurationDto> getSearchDefaultList(String userId, String routerKey);
 }

+ 15 - 0
consoleStatistics/src/main/java/com/jzg/console/service/impl/ReportSearchConfigurationServiceImpl.java

@@ -148,6 +148,21 @@ public class ReportSearchConfigurationServiceImpl extends ServiceImpl<ReportSear
         return null;
     }
 
+    @Override
+    public List<ReportSearchConfigurationDto> getSearchDefaultList(String userId, String routerKey) {
+        List<ReportSearchConfigurationDto> list = this.getBaseMapper().getSearchDefaultList(routerKey);
+        if(list!=null  && !list.isEmpty()){
+            for (ReportSearchConfigurationDto reportSearchConfigurationDto : list) {
+                if(StringUtils.isNotBlank(reportSearchConfigurationDto.getSearchSql())){
+                    //通过配置的sql查询具体的对象
+                    List<?> searchConfigurationList = getSearchConfigurationList(userId, reportSearchConfigurationDto.getSearchSql(), reportSearchConfigurationDto.getSearchKey(), reportSearchConfigurationDto.getShowType());
+                    reportSearchConfigurationDto.setList(searchConfigurationList);
+                }
+            }
+        }
+        return list;
+    }
+
 
 }
 

+ 2 - 0
consoleStatistics/src/main/resources/application.yml

@@ -78,6 +78,8 @@ tenant:
     - sys_system_bus_perms
     - sys_system_bus_perms_link
     - company_hierarchy
+    - report_page_set_search_param
+    - report_page_select_disable
   ignoreLoginNames:
 
 data-scope:

+ 54 - 10
consoleStatistics/src/main/resources/mapper/ReportSearchConfigurationMapper.xml

@@ -5,17 +5,41 @@
 <mapper namespace="com.jzg.console.mapper.ReportSearchConfigurationMapper">
     <select id="getSearchConfigurationList"
             resultType="com.jzg.commons.entity.report.dto.ReportSearchConfigurationDto">
-        select
-          *
-        from
-        report_search_configuration
-        <where>
-            <if test="routerPath !=null and routerPath !=''">
-                AND  router_path_key  =#{ routerPath }
-            </if>
-        </where>
-        order by id
+        SELECT
+            b.search_key AS searchKey,
+            b.search_name AS searchName,
+            b.select_type AS selectType,
+            b.show_type AS showType,
+            b.search_sql AS searchSql,
+            b.id AS id,
+            a.show_flag AS showFlag,
+            CASE
+            WHEN (
+            SELECT COUNT(0)
+            FROM report_page_set_search_param
+            WHERE report_configuration_id = a.report_configuration_id
+            AND router_path_key = #{ routerPath }
+            ) > 0 THEN true
+            ELSE false
+            END AS defaultFlag,
+            CASE
+            WHEN (
+            SELECT COUNT(0)
+            FROM report_page_select_disable
+            WHERE report_configuration_id = a.report_configuration_id
+            AND router_path_key = #{ routerPath }
+            ) > 0 THEN true
+            ELSE false
+            END AS selectFlag
+        FROM
+            report_page_set_search_param a
+        LEFT JOIN report_search_configuration b ON a.report_configuration_id = b.id
+         WHERE
+             a.router_path_key = 'common'
+        ORDER BY
+            a.sort
     </select>
+
     <select id="selectDictListByCode" resultType="com.jzg.commons.entity.report.dto.ReportDictDto">
         SELECT
             p.VALUE AS value,
@@ -112,4 +136,24 @@
         WHERE
         level = 3;
     </select>
+    <select id="getSearchDefaultList"
+            resultType="com.jzg.commons.entity.report.dto.ReportSearchConfigurationDto">
+        SELECT
+            b.search_key AS searchKey,
+            b.search_name AS searchName,
+            b.select_type AS selectType,
+            b.show_type AS showType,
+            b.search_sql AS searchSql,
+            b.id AS id,
+            a.show_flag AS showFlag,
+            true  as   defaultFlag,
+            true  as  selectFlag
+        FROM
+            report_page_set_search_param a
+                LEFT JOIN report_search_configuration b ON a.report_configuration_id = b.id
+        WHERE
+            a.router_path_key = #{ routerKey }
+        ORDER BY
+            a.sort
+    </select>
 </mapper>