Commit bdd5a12d by Suvalue

psql返回结构转大写

parent bb6987a4
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
select ID, CREATE_DATE, CREATE_USERID, `STATE`, ORG_CODE, ORG_NAME, ORG_NO, ORG_SHORT_NAME, select ID, CREATE_DATE, CREATE_USERID, `STATE`, ORG_CODE, ORG_NAME, ORG_NO, ORG_SHORT_NAME,
ORG_GROUP, ORG_TYPE, ORG_ADDRESS, PARENT_ID,IS_NEW ORG_GROUP, ORG_TYPE, ORG_ADDRESS, PARENT_ID,IS_NEW
from sys_subject from sys_subject
where ID = #{id,jdbcType=INTEGER} where ID = #{id,jdbcType=INTEGER}
</select> </select>
<select id="selectParentAll" resultMap="DicOrgResultMap"> <select id="selectParentAll" resultMap="DicOrgResultMap">
......
package com.hs.api.common.configurations;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpHeaders;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class CorsConfig implements WebMvcConfigurer {
@Bean
public WebMvcConfigurer corsConfigurer() {
return new WebMvcConfigurer() {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**").
allowedOrigins("*"). //允许跨域的域名,可以用*表示允许任何域名使用
allowedMethods("*"). //允许任何方法(post、get等)
allowedHeaders("*"). //允许任何请求头
allowCredentials(true). //带上cookie信息
exposedHeaders(HttpHeaders.SET_COOKIE).maxAge(3600L); //maxAge(3600)表明在3600秒内,不需要再发送预检验请求,可以缓存该结果
}
};
}
}
...@@ -16,4 +16,6 @@ public interface AsynBlockValuesService { ...@@ -16,4 +16,6 @@ public interface AsynBlockValuesService {
String whereClause, CountDownLatch latch); String whereClause, CountDownLatch latch);
void getBlockValuesNew(List<BlockValue> list, Long blockId,Map<String,Object> dim, CountDownLatch latch); void getBlockValuesNew(List<BlockValue> list, Long blockId,Map<String,Object> dim, CountDownLatch latch);
void getBlockValuesNew2(List<BlockValue> list, Long blockId,Map<String,Object> dim, CountDownLatch latch);
} }
...@@ -7,8 +7,7 @@ import org.springframework.scheduling.annotation.Async; ...@@ -7,8 +7,7 @@ import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.*;
import java.util.Map;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
@Service @Service
...@@ -60,4 +59,44 @@ public class AsynBlockValuesServiceImpl implements AsynBlockValuesService { ...@@ -60,4 +59,44 @@ public class AsynBlockValuesServiceImpl implements AsynBlockValuesService {
} }
@Async
@Override
public void getBlockValuesNew2(List<BlockValue> list, Long blockId, Map<String, Object> whereClause, CountDownLatch latch) {
try {
List<Map<String, Object>> resultList = new ArrayList<>();
List<Map<String, Object>> dataList = blockValuesMapper.selectByWhereNew(whereClause);
Map<String, Object> map = null;
Set<String> inFields = null;
for (Map<String, Object> info : dataList) {
inFields = info.keySet();
map = new HashMap<>();
for (Iterator iterator = inFields.iterator(); iterator.hasNext(); ) {
Object obj = iterator.next();
Object value = info.get(obj);
if (value instanceof Object) {
map.put(String.valueOf(obj).toUpperCase(), info.get(obj));
}
}
resultList.add(map);
inFields = null;
map = null;
}
BlockValue blockValue = new BlockValue(blockId, resultList);
synchronized (obj) {
list.add(blockValue);
}
} catch (Exception e) {
log.error(e.getMessage(), e);
} finally {
latch.countDown();
}
}
} }
...@@ -150,7 +150,7 @@ public class BlockValuesServiceImpl implements BlockValuesService { ...@@ -150,7 +150,7 @@ public class BlockValuesServiceImpl implements BlockValuesService {
putAll(dim); putAll(dim);
} }
}; };
asynBlockValuesServiceImpl.getBlockValuesNew(list, blockId, map, latch); asynBlockValuesServiceImpl.getBlockValuesNew2(list, blockId, map, latch);
} }
latch.await(); latch.await();
......
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
FROM val_block_values_1_2_2 FROM val_block_values_1_2_2
where 1=1 where 1=1
<if test="date!=null"> <if test="date!=null">
and TIME = #{date} and TIME = cast(#{date} as integer)
</if> </if>
<if test="deptCode!=null"> <if test="deptCode!=null">
and KSBM = #{deptCode} and KSBM = #{deptCode}
...@@ -95,7 +95,7 @@ ...@@ -95,7 +95,7 @@
FROM val_block_values_1_5_2 FROM val_block_values_1_5_2
where 1=1 where 1=1
<if test="date!=null"> <if test="date!=null">
and TIME = #{date} and TIME = cast(#{date} as integer)
</if> </if>
<if test="deptCode!=null"> <if test="deptCode!=null">
and KSBM = #{deptCode} and KSBM = #{deptCode}
...@@ -118,14 +118,14 @@ ...@@ -118,14 +118,14 @@
d.PARENT_ID, d.LEVEL, d.ORG_ID, d.ORG_NAME,d.GROUP_TYPE,val.ZLS d.PARENT_ID, d.LEVEL, d.ORG_ID, d.ORG_NAME,d.GROUP_TYPE,val.ZLS
from dic_disease d from dic_disease d
<if test="deptCode!=null"> <if test="deptCode!=null">
join (select ZBZBM,KSBM,ZLS as ZLS join (select ZBZBM,KSBM,sum(ZLS) as ZLS
from val_block_values_1_2_2 from val_block_values_1_2_2
where TIME=#{date} and ZLS>0 where TIME=cast(#{date} as integer) and ZLS>0
and KSBM=#{deptCode,jdbcType=VARCHAR} and KSBM=#{deptCode,jdbcType=VARCHAR}
group by ZBZBM,KSBM) val on val.ZBZBM = d.MDC_CODE group by ZBZBM,KSBM) val on val.ZBZBM = d.MDC_CODE
</if> </if>
<if test="deptCode==null"> <if test="deptCode==null">
join (select ZBZBM,ZLS as ZLS join (select ZBZBM,sum(ZLS) as ZLS
from val_block_values_1_1_2 from val_block_values_1_1_2
group by ZBZBM) val on val.ZBZBM = d.MDC_CODE group by ZBZBM) val on val.ZBZBM = d.MDC_CODE
</if> </if>
...@@ -150,16 +150,16 @@ ...@@ -150,16 +150,16 @@
d.PARENT_ID, d.LEVEL, d.ORG_ID, d.ORG_NAME,d.GROUP_TYPE,val.ZLS d.PARENT_ID, d.LEVEL, d.ORG_ID, d.ORG_NAME,d.GROUP_TYPE,val.ZLS
from dic_disease d from dic_disease d
<if test="deptCode!=null"> <if test="deptCode!=null">
join (select ZBZBM,KSBM,ZLS as ZLS join (select ZBZBM,KSBM,sum(ZLS) as ZLS
from val_block_values_1_2_2 from val_block_values_1_2_2
where TIME=#{date} and ZLS>0 where TIME=cast(#{date} as integer) and ZLS>0
and KSBM=#{deptCode,jdbcType=VARCHAR} and KSBM=#{deptCode,jdbcType=VARCHAR}
group by ZBZBM,KSBM) val on val.ZBZBM = d.MDC_CODE group by ZBZBM,KSBM) val on val.ZBZBM = d.MDC_CODE
</if> </if>
<if test="deptCode==null"> <if test="deptCode==null">
join (select ZBZBM,SUM(ZLS) as ZLS join (select ZBZBM,sum(ZLS) as ZLS
from val_block_values_1_1_2 from val_block_values_1_1_2
where TIME=#{date} and ZLS>0 where TIME=cast(#{date} as integer) and ZLS>0
group by ZBZBM) val on val.ZBZBM = d.MDC_CODE group by ZBZBM) val on val.ZBZBM = d.MDC_CODE
</if> </if>
where 1 = 1 and STATE=1 and STATE=1 where 1 = 1 and STATE=1 and STATE=1
...@@ -173,16 +173,16 @@ ...@@ -173,16 +173,16 @@
d.PARENT_ID, d.LEVEL, d.ORG_ID, d.ORG_NAME,d.GROUP_TYPE,val.ZLS d.PARENT_ID, d.LEVEL, d.ORG_ID, d.ORG_NAME,d.GROUP_TYPE,val.ZLS
from dic_disease d from dic_disease d
<if test="deptCode!=null"> <if test="deptCode!=null">
join (select YJBZBM,KSBM,ZLS as ZLS join (select YJBZBM,KSBM,sum(ZLS) as ZLS
from val_block_values_1_5_2 from val_block_values_1_5_2
where TIME=#{date} where TIME=cast(#{date} as integer)
and KSBM=#{deptCode,jdbcType=VARCHAR} and KSBM=#{deptCode,jdbcType=VARCHAR}
group by YJBZBM,KSBM) val on val.YJBZBM = d.MDC_CODE group by YJBZBM,KSBM) val on val.YJBZBM = d.MDC_CODE
</if> </if>
<if test="deptCode==null"> <if test="deptCode==null">
join (select YJBZBM,ZLS as ZLS join (select YJBZBM,sum(ZLS) as ZLS
from val_block_values_1_3_2 from val_block_values_1_3_2
where TIME=#{date} where TIME=cast(#{date} as integer)
group by YJBZBM) val on val.YJBZBM = d.MDC_CODE group by YJBZBM) val on val.YJBZBM = d.MDC_CODE
</if> </if>
where 1 = 1 and STATE=1 and STATE=1 where 1 = 1 and STATE=1 and STATE=1
...@@ -194,9 +194,9 @@ ...@@ -194,9 +194,9 @@
<select id="selectParentById" resultMap="DiseaseLevel"> <select id="selectParentById" resultMap="DiseaseLevel">
select d.*,val.ZLS select d.*,val.ZLS
from dic_disease d from dic_disease d
join (select ZBZBM,ZLS as ZLS join (select ZBZBM,sum(ZLS) as ZLS
from val_block_values_1_1_2 from val_block_values_1_1_2
where TIME=#{date} and ZLS>0 where TIME=cast(#{date} as integer) and ZLS>0
group by ZBZBM) val on val.ZBZBM = d.MDC_CODE group by ZBZBM) val on val.ZBZBM = d.MDC_CODE
where 1 = 1 and d.STATE=1 where 1 = 1 and d.STATE=1
<if test="diseaseId!=null"> <if test="diseaseId!=null">
...@@ -206,7 +206,7 @@ ...@@ -206,7 +206,7 @@
<select id="selectParentByIdNoZbz" resultMap="DiseaseLevel"> <select id="selectParentByIdNoZbz" resultMap="DiseaseLevel">
select d.*,val.ZLS select d.*,val.ZLS
from dic_disease d from dic_disease d
left join val_block_values_1_3_1 val on val.ZBZBM = d.MDC_CODE and val.time=#{date} left join val_block_values_1_3_1 val on val.ZBZBM = d.MDC_CODE and val.time=cast(#{date} as integer)
where 1 = 1 and d.STATE=1 where 1 = 1 and d.STATE=1
<if test="diseaseId!=null"> <if test="diseaseId!=null">
and d.id=(select PARENT_ID from dic_disease where id = #{diseaseId,jdbcType=DECIMAL} ) and d.id=(select PARENT_ID from dic_disease where id = #{diseaseId,jdbcType=DECIMAL} )
...@@ -219,7 +219,7 @@ ...@@ -219,7 +219,7 @@
<if test="deptCode!=null"> <if test="deptCode!=null">
left join (select YJBZBM,KSBM,ZLS as ZLS left join (select YJBZBM,KSBM,ZLS as ZLS
from val_block_values_1_5_2 from val_block_values_1_5_2
where TIME=#{date} where TIME=cast(#{date} as integer)
and KSBM=#{deptCode,jdbcType=VARCHAR} and KSBM=#{deptCode,jdbcType=VARCHAR}
group by YJBZBM,KSBM) val on val.YJBZBM = d.MDC_CODE group by YJBZBM,KSBM) val on val.YJBZBM = d.MDC_CODE
</if> </if>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment