zjh
2025-02-07 45b5e3f63283e622f4321f3d03992343636dabf8
zjh20250207
4个文件已修改
23 ■■■■■ 已修改文件
ltkj-framework/src/main/java/com/ltkj/framework/config/WebConfig.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ltkj-framework/src/main/java/com/ltkj/framework/interceptor/DBChangeInterceptor.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ltkj-hosp/src/main/java/com/ltkj/hosp/domain/DictHosp.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ltkj-hosp/src/main/resources/mapper/hosp/DictHospMapper.xml 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ltkj-framework/src/main/java/com/ltkj/framework/config/WebConfig.java
@@ -38,7 +38,7 @@
                .excludePathPatterns(new String[]{
                        "/system/dict/data/**",
                        "/system/dict/type/**",
                        "/captchaImage"
                        "/captchaImage","/getCaptchaConfigKey/**"
//                        ,
//                        "/login", "/register", "/captchaImage","/cus/**","/getCaptchaConfigKey","/report/jmreport/**",
//                        "/sqlserver/getdata/**","/api/His/**","/system/config/zx","/system/config/gxxmpym","/system/report/savePdf",
ltkj-framework/src/main/java/com/ltkj/framework/interceptor/DBChangeInterceptor.java
@@ -40,23 +40,24 @@
            response.getWriter().write("{\"message\":\"401:找不到院区编号\"}");
            return false;
        }
        DictHosp hosp = null;
//        DictHosp hosp = null;
        try {
            DataSourceContextHolder.setDataSourceKey("default");
            LambdaQueryWrapper<DictHosp> wrapper = new LambdaQueryWrapper<>();
            wrapper.eq(DictHosp::getCode,hospId);
            hosp = dictHospService.getOne(wrapper);
            if (hosp == null || hosp.getDatabase() == null || hosp.getDatabase().trim().isEmpty()) {
            DictHosp hosp = dictHospService.getOne(wrapper);
            if (hosp == null || hosp.getDbname() == null || hosp.getDbname().trim().isEmpty()) {
                response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
                response.setContentType("application/json;charset=UTF-8");
                response.getWriter().write("{\"message\":\"401:找不到院区数据\"}");
                return false;
            }
            dataSourceConfig.addDataSource(hosp.getDatabase());
            dataSourceConfig.addDataSource(hosp.getDbname());
            DataSourceContextHolder.setDataSourceKey(hosp.getDbname());
        } catch (IOException e) {
            return false;
        }
        DataSourceContextHolder.setDataSourceKey(hosp.getDatabase());
        return true;
    }
ltkj-hosp/src/main/java/com/ltkj/hosp/domain/DictHosp.java
@@ -174,7 +174,7 @@
    private Date expirationTime;
//    数据库名
    private String database;
    private String dbname;
    @Override
@@ -206,7 +206,6 @@
                .append("updateByName", getUpdateByName())
                .append("imgbase64", getImgbase64())
                .append("deleted", getDeleted())
                .append("database", getDatabase())
                .toString();
    }
}
ltkj-hosp/src/main/resources/mapper/hosp/DictHospMapper.xml
@@ -31,7 +31,7 @@
        <result property="updateByName" column="update_by_name"/>
        <result property="imgbase64" column="imgBase64"/>
        <result property="deleted" column="deleted"/>
        <result property="database" column="database"/>
<!--        <result property="dbname" column="dbname"/>-->
    </resultMap>
    <sql id="selectDictHospVo">
@@ -60,7 +60,7 @@
               create_by_name,
               update_by_name,
               imgBase64,
               deleted,database
               deleted
        from dict_hosp
    </sql>
@@ -117,7 +117,6 @@
            <if test="updateByName != null and updateByName != ''">update_by_name,</if>
            <if test="imgbase64 != null">imgBase64,</if>
            <if test="deleted != null">deleted,</if>
            <if test="database != null">database,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="hospAreaId != null">#{hospAreaId},</if>
@@ -146,7 +145,6 @@
            <if test="updateByName != null and updateByName != ''">#{updateByName},</if>
            <if test="imgbase64 != null">#{imgbase64},</if>
            <if test="deleted != null">#{deleted},</if>
            <if test="database != null">#{database},</if>
        </trim>
    </insert>
@@ -178,7 +176,6 @@
            <if test="updateByName != null and updateByName != ''">update_by_name = #{updateByName},</if>
            <if test="imgbase64 != null">imgBase64 = #{imgbase64},</if>
            <if test="deleted != null">deleted = #{deleted},</if>
            <if test="database != null">database = #{database},</if>
        </trim>
        where hosp_area_id = #{hospAreaId}
    </update>