Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sv-springboot
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bsoft
sv-springboot
Commits
7759c1d7
Commit
7759c1d7
authored
Nov 16, 2019
by
Suvalue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
板块数值接口修改,采用map传参
parent
44ebb846
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
117 additions
and
31 deletions
+117
-31
bsoft-api/src/main/java/com/bsoft/api/controller/BlockValuesController.java
+4
-1
bsoft-api/src/main/java/com/bsoft/api/mapper/BlockValuesMapper.java
+3
-0
bsoft-api/src/main/java/com/bsoft/api/model/SerPageBlockRs.java
+10
-0
bsoft-api/src/main/java/com/bsoft/api/service/AsynBlockValuesService.java
+7
-0
bsoft-api/src/main/java/com/bsoft/api/service/Impl/AsynBlockValuesServiceImpl.java
+29
-0
bsoft-api/src/main/java/com/bsoft/api/service/Impl/BlockValuesServiceImpl.java
+3
-3
bsoft-api/src/main/resources/mapper/BlockValuesMapper.xml
+5
-0
bsoft-api/src/main/resources/mapper/SerDiseaseMapper.xml
+48
-21
bsoft-api/src/main/resources/mapper/SerPageBlockRsMapper.xml
+8
-6
No files found.
bsoft-api/src/main/java/com/bsoft/api/controller/BlockValuesController.java
View file @
7759c1d7
...
...
@@ -13,11 +13,13 @@ import org.springframework.web.bind.annotation.GetMapping;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RestController
;
import
springfox.documentation.annotations.ApiIgnore
;
import
java.util.List
;
@Api
(
tags
=
"板块数值Api"
)
@RestController
public
class
BlockValuesController
{
@Autowired
...
...
@@ -29,7 +31,8 @@ public class BlockValuesController {
* @return
* @throws Exception
*/
@PostMapping
(
"blockValues"
)
@ApiIgnore
// @PostMapping("blockValues")
@Token
@ApiOperation
(
"根据Page查询板块数值"
)
public
Object
getBlockValuesByPageID
(
@RequestBody
BlockValues
blockValues
)
throws
InterruptedException
{
...
...
bsoft-api/src/main/java/com/bsoft/api/mapper/BlockValuesMapper.java
View file @
7759c1d7
package
com
.
bsoft
.
api
.
mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
public
interface
BlockValuesMapper
{
List
<
Map
<
String
,
Object
>>
selectByWhere
(
String
tableName
,
String
whereSql
);
List
<
Map
<
String
,
Object
>>
selectByWhereNew
(
Map
<
String
,
String
>
map
);
}
bsoft-api/src/main/java/com/bsoft/api/model/SerPageBlockRs.java
View file @
7759c1d7
...
...
@@ -15,6 +15,16 @@ public class SerPageBlockRs {
private
Long
pageId
;
private
String
whereClause
;
public
String
getWhereClause
()
{
return
whereClause
;
}
public
void
setWhereClause
(
String
whereClause
)
{
this
.
whereClause
=
whereClause
;
}
public
Long
getId
()
{
return
id
;
}
...
...
bsoft-api/src/main/java/com/bsoft/api/service/AsynBlockValuesService.java
View file @
7759c1d7
package
com
.
bsoft
.
api
.
service
;
import
com.bsoft.api.common.handlers.GlobalExceptionHandler
;
import
com.bsoft.api.model.respmodel.BlockValue
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.CountDownLatch
;
public
interface
AsynBlockValuesService
{
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
GlobalExceptionHandler
.
class
);
void
getBlockValues
(
List
<
BlockValue
>
list
,
Long
blockId
,
String
tableName
,
String
whereClause
,
CountDownLatch
latch
);
void
getBlockValuesNew
(
List
<
BlockValue
>
list
,
Long
blockId
,
Map
<
String
,
String
>
dim
,
CountDownLatch
latch
);
}
bsoft-api/src/main/java/com/bsoft/api/service/Impl/AsynBlockValuesServiceImpl.java
View file @
7759c1d7
...
...
@@ -24,6 +24,7 @@ public class AsynBlockValuesServiceImpl implements AsynBlockValuesService {
@Override
public
void
getBlockValues
(
List
<
BlockValue
>
list
,
Long
blockId
,
String
tableName
,
String
whereClause
,
CountDownLatch
latch
)
{
try
{
System
.
out
.
println
(
"开始"
+
tableName
);
List
<
Map
<
String
,
Object
>>
dataList
=
blockValuesMapper
.
selectByWhere
(
tableName
,
whereClause
);
...
...
@@ -32,7 +33,35 @@ public class AsynBlockValuesServiceImpl implements AsynBlockValuesService {
list
.
add
(
blockValue
);
}
System
.
out
.
println
(
"结束"
+
tableName
);
}
catch
(
Exception
e
){
log
.
error
(
e
.
getMessage
(),
e
);
}
finally
{
latch
.
countDown
();
}
}
@Async
@Override
public
void
getBlockValuesNew
(
List
<
BlockValue
>
list
,
Long
blockId
,
Map
<
String
,
String
>
whereClause
,
CountDownLatch
latch
)
{
try
{
System
.
out
.
println
(
"开始"
+
whereClause
.
get
(
"tableName"
));
List
<
Map
<
String
,
Object
>>
dataList
=
blockValuesMapper
.
selectByWhereNew
(
whereClause
);
BlockValue
blockValue
=
new
BlockValue
(
blockId
,
dataList
);
synchronized
(
obj
){
list
.
add
(
blockValue
);
}
System
.
out
.
println
(
"结束"
+
whereClause
.
get
(
"tableName"
));
}
catch
(
Exception
e
){
log
.
error
(
e
.
getMessage
(),
e
);
}
finally
{
latch
.
countDown
();
}
}
}
bsoft-api/src/main/java/com/bsoft/api/service/Impl/BlockValuesServiceImpl.java
View file @
7759c1d7
...
...
@@ -111,9 +111,7 @@ public class BlockValuesServiceImpl implements BlockValuesService {
int
count
=
0
;
String
inField
=
""
;
String
whereClause
=
"where 1=1"
;
for
(
Map
.
Entry
<
String
,
String
>
entry
:
dim
.
entrySet
())
{
whereClause
+=
String
.
format
(
" and "
+
entry
.
getKey
()+
"='%s'"
,
entry
.
getValue
());
inField
+=
"'"
+
entry
.
getKey
()+
"',"
;
count
++;
}
...
...
@@ -136,7 +134,9 @@ public class BlockValuesServiceImpl implements BlockValuesService {
//获取表名
Long
blockId
=
data
.
getBlockId
();
String
tableName
=
"VAL_BLOCK_VALUES_"
+
pageCode
+
"_"
+
page
.
getId
()+
"_"
+
blockId
;
asynBlockValuesServiceImpl
.
getBlockValues
(
list
,
blockId
,
tableName
,
whereClause
,
latch
);
dim
.
put
(
"tableName"
,
tableName
);
dim
.
put
(
"whereSql"
,
data
.
getWhereClause
());
asynBlockValuesServiceImpl
.
getBlockValuesNew
(
list
,
blockId
,
dim
,
latch
);
}
latch
.
await
();
...
...
bsoft-api/src/main/resources/mapper/BlockValuesMapper.xml
View file @
7759c1d7
...
...
@@ -5,4 +5,8 @@
select * from ${tableName}
${whereSql}
</select>
<select
id=
"selectByWhereNew"
resultType=
"java.util.Map"
>
select * from ${tableName}
${whereSql}
</select>
</mapper>
\ No newline at end of file
bsoft-api/src/main/resources/mapper/SerDiseaseMapper.xml
View file @
7759c1d7
...
...
@@ -61,10 +61,17 @@
where ID = #{id,jdbcType=DECIMAL}
</select>
<select
id=
"selectByCode"
resultMap=
"BaseResultMap"
>
select ID, CREATE_DATE, CREATE_USERID, STATE, MDC_CODE, MDC_NAME, "DATE", MDC_NUM,
PARENT_ID, "LEVEL", ORG_ID, ORG_NAME
from SER_DISEASE
where MDC_CODE = #{code,jdbcType=VARCHAR} and "DATE" = #{date,jdbcType=VARCHAR}
select d.ID, d.CREATE_DATE, d.CREATE_USERID, d.STATE, d.MDC_CODE, d.MDC_NAME, d."DATE",d.MDC_NUM,
d.PARENT_ID, d."LEVEL", d.ORG_ID, d.ORG_NAME
from SER_DISEASE d,SER_DISEASE_DOC_RS rs
where d.STATE=1
and rs.MDC_CODE=d.MDC_CODE and rs.MDC_CODE = #{code,jdbcType=VARCHAR} and rs."DATE" = #{date,jdbcType=VARCHAR} and d."DATE" =#{date,jdbcType=VARCHAR}
<if
test=
"docCode!=null"
>
and rs.DOC_CODE=#{docCode,jdbcType=VARCHAR}
</if>
<if
test=
"deptCode!=null"
>
and rs.DEPT_CODE=#{deptCode,jdbcType=VARCHAR}
</if>
</select>
<select
id=
"selectAll"
resultMap=
"BaseResultMap"
>
select ID, CREATE_DATE, CREATE_USERID, STATE, MDC_CODE, MDC_NAME, DATE, MDC_NUM,
...
...
@@ -84,27 +91,39 @@
</if>
</select>
<select
id=
"selectByLevel"
resultMap=
"DiseaseLevel"
>
select ID, CREATE_DATE, CREATE_USERID, STATE, MDC_CODE, MDC_NAME, "DATE",
MDC_NUM,
PARENT_ID,"LEVEL", ORG_ID,
ORG_NAME
from SER_DISEASE
where 1 = 1 and STATE=1
select DISTINCT d.ID, d.CREATE_DATE, d.CREATE_USERID, d.STATE, d.MDC_CODE, d.MDC_NAME, d."DATE",d.
MDC_NUM,
d.PARENT_ID, d."LEVEL", d.ORG_ID, d.
ORG_NAME
from SER_DISEASE d,SER_DISEASE_DOC_RS rs
where 1 = 1 and STATE=1
and rs.MDC_CODE=d.MDC_CODE
<if
test=
"date!=null"
>
and "DATE" = #{date,jdbcType=VARCHAR}
and
d."DATE" = #{date,jdbcType=VARCHAR} and rs.
"DATE" = #{date,jdbcType=VARCHAR}
</if>
<if
test=
"level!=null"
>
and "LEVEL" = #{level,jdbcType=DECIMAL}
and d."LEVEL" = #{level,jdbcType=DECIMAL}
</if>
<if
test=
"docCode!=null"
>
and rs.DOC_CODE=#{docCode,jdbcType=VARCHAR}
</if>
<if
test=
"deptCode!=null"
>
and rs.DEPT_CODE=#{deptCode,jdbcType=VARCHAR}
</if>
</select>
<select
id=
"selectByParentId"
resultMap=
"DiseaseLevel"
>
select
ID, CREATE_DATE, CREATE_USERID, STATE, MDC_CODE, MDC_NAME, "DATE",
MDC_NUM,
PARENT_ID,"LEVEL", ORG_ID,
ORG_NAME
from SER_DISEASE
where 1 = 1 and STATE=1
select
DISTINCT d.ID, d.CREATE_DATE, d.CREATE_USERID, d.STATE, d.MDC_CODE, d.MDC_NAME, d."DATE",d.
MDC_NUM,
d.PARENT_ID, d."LEVEL", d.ORG_ID, d.
ORG_NAME
from SER_DISEASE
d,SER_DISEASE_DOC_RS rs
where 1 = 1 and STATE=1
and STATE=1 and rs.MDC_CODE=d.MDC_CODE
<if
test=
"date!=null"
>
and "DATE" = #{date,jdbcType=VARCHAR}
and
d."DATE" = #{date,jdbcType=VARCHAR} and rs.
"DATE" = #{date,jdbcType=VARCHAR}
</if>
<if
test=
"parentId!=null"
>
and PARENT_ID = #{parentId,jdbcType=DECIMAL}
and d.PARENT_ID = #{parentId,jdbcType=DECIMAL}
</if>
<if
test=
"docCode!=null"
>
and rs.DOC_CODE=#{docCode,jdbcType=VARCHAR}
</if>
<if
test=
"deptCode!=null"
>
and rs.DEPT_CODE=#{deptCode,jdbcType=VARCHAR}
</if>
</select>
<select
id=
"selectParentById"
resultMap=
"DiseaseLevel"
>
...
...
@@ -119,14 +138,21 @@
</if>
</select>
<select
id=
"selectSonById"
resultMap=
"DiseaseLevel"
>
select *
from SER_DISEASE
where 1 = 1 and STATE=1
select DISTINCT d.ID, d.CREATE_DATE, d.CREATE_USERID, d.STATE, d.MDC_CODE, d.MDC_NAME, d."DATE",d.MDC_NUM,
d.PARENT_ID, d."LEVEL", d.ORG_ID, d.ORG_NAME
from SER_DISEASE d,SER_DISEASE_DOC_RS rs
where 1 = 1 and STATE=1 and STATE=1 and rs.MDC_CODE=d.MDC_CODE
<if
test=
"date!=null"
>
and "DATE" = #{date,jdbcType=VARCHAR}
and
d."DATE" = #{date,jdbcType=VARCHAR} and rs.
"DATE" = #{date,jdbcType=VARCHAR}
</if>
<if
test=
"diseaseId!=null"
>
and PARENT_ID=#{diseaseId,jdbcType=DECIMAL}
and d.PARENT_ID=#{diseaseId,jdbcType=DECIMAL}
</if>
<if
test=
"docCode!=null"
>
and rs.DOC_CODE=#{docCode,jdbcType=VARCHAR}
</if>
<if
test=
"deptCode!=null"
>
and rs.DEPT_CODE=#{deptCode,jdbcType=VARCHAR}
</if>
</select>
</mapper>
\ No newline at end of file
bsoft-api/src/main/resources/mapper/SerPageBlockRsMapper.xml
View file @
7759c1d7
...
...
@@ -8,6 +8,7 @@
<result
column=
"STATE"
jdbcType=
"DECIMAL"
property=
"state"
/>
<result
column=
"BLOCK_ID"
jdbcType=
"DECIMAL"
property=
"blockId"
/>
<result
column=
"PAGE_ID"
jdbcType=
"DECIMAL"
property=
"pageId"
/>
<result
column=
"WHERE_CLAUSE"
jdbcType=
"VARCHAR"
property=
"whereClause"
></result>
</resultMap>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Long"
>
delete from SER_PAGE_BLOCK_RS
...
...
@@ -18,9 +19,9 @@
select SEQ_SER_PAGE_BLOCK_RS_ID.nextval from dual
</selectKey>
insert into SER_PAGE_BLOCK_RS (CREATE_DATE, CREATE_USERID, STATE,
BLOCK_ID, PAGE_ID)
BLOCK_ID, PAGE_ID
,WHERE_CLAUSE
)
values (#{createDate,jdbcType=TIMESTAMP}, #{createUserid,jdbcType=DECIMAL}, #{state,jdbcType=DECIMAL},
#{blockId,jdbcType=DECIMAL}, #{pageId,jdbcType=DECIMAL})
#{blockId,jdbcType=DECIMAL}, #{pageId,jdbcType=DECIMAL}
,#{whereClause,jdbcType=DECIMAL}
)
</insert>
<update
id=
"updateByPrimaryKey"
parameterType=
"com.bsoft.api.model.SerPageBlockRs"
>
update SER_PAGE_BLOCK_RS
...
...
@@ -28,20 +29,21 @@
CREATE_USERID = #{createUserid,jdbcType=DECIMAL},
STATE = #{state,jdbcType=DECIMAL},
BLOCK_ID = #{blockId,jdbcType=DECIMAL},
PAGE_ID = #{pageId,jdbcType=DECIMAL}
PAGE_ID = #{pageId,jdbcType=DECIMAL},
WHERE_CLAUSE=#{whereClause,jdbcType=DECIMAL}
where ID = #{id,jdbcType=DECIMAL}
</update>
<select
id=
"selectByPrimaryKey"
parameterType=
"java.lang.Long"
resultMap=
"BaseResultMap"
>
select ID, CREATE_DATE, CREATE_USERID, STATE, BLOCK_ID, PAGE_ID
select ID, CREATE_DATE, CREATE_USERID, STATE, BLOCK_ID, PAGE_ID
,WHERE_CLAUSE
from SER_PAGE_BLOCK_RS
where ID = #{id,jdbcType=DECIMAL}
</select>
<select
id=
"selectAll"
resultMap=
"BaseResultMap"
>
select ID, CREATE_DATE, CREATE_USERID, STATE, BLOCK_ID, PAGE_ID
select ID, CREATE_DATE, CREATE_USERID, STATE, BLOCK_ID, PAGE_ID
,WHERE_CLAUSE
from SER_PAGE_BLOCK_RS
</select>
<select
id=
"selectByPageId"
resultMap=
"BaseResultMap"
>
select ID, CREATE_DATE, CREATE_USERID, STATE, BLOCK_ID, PAGE_ID
select ID, CREATE_DATE, CREATE_USERID, STATE, BLOCK_ID, PAGE_ID
,WHERE_CLAUSE
from SER_PAGE_BLOCK_RS
where PAGE_ID=#{pageID,jdbcType=DECIMAL}
</select>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment