Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
research-project
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
hqzhdj
research-project
Commits
3c091ebf
Commit
3c091ebf
authored
Apr 22, 2025
by
阳浪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
4.21bug优化
parent
61b3b930
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
22 deletions
+40
-22
cloud-research-service/src/main/java/com/yizhi/research/application/mapper/ResearchMapper.xml
+40
-22
No files found.
cloud-research-service/src/main/java/com/yizhi/research/application/mapper/ResearchMapper.xml
View file @
3c091ebf
...
...
@@ -105,7 +105,7 @@
<select
id=
"apiListResearch"
resultType=
"com.yizhi.research.application.vo.domain.Research"
>
<if
test=
"state == 1"
>
select *
from (select answer.submit_time as submitTime,
from (select
distinct
answer.submit_time as submitTime,
tb.id AS id
,answer.submit_time as finishTime
,tb.research_no AS researchNo
...
...
@@ -136,12 +136,11 @@
)
-- 已完成条件过滤
and
<![CDATA[ tb.end_time > #{now} ]]>
and answer.id is not null and answer.finish = 1
group by tb.id
)t
order by t.create_time desc,t.submitTime desc
</if>
<if
test=
"state == 2"
>
select
select
distinct
answer.submit_time as submitTime,
tb.id AS id
,answer.submit_time as finishTime
...
...
@@ -174,13 +173,12 @@
-- 进行中条件过滤
and
<![CDATA[ tb.end_time > #{now} ]]>
and
<![CDATA[ tb.start_time < #{now} ]]>
and ( answer.id is null or
answer.finish = 0)
group by tb.id
order by tb.create_time desc,tb.end_time
</if>
<if
test=
"state == null"
>
select *
from (select answer.submit_time as submitTime,
from (select
distinct
answer.submit_time as submitTime,
CASE WHEN
<![CDATA[ tb.start_time > NOW() ]]>
THEN 0 ELSE
CASE WHEN
<![CDATA[ tb.start_time >= NOW() ]]>
AND answerf.finish IS NULL THEN 4 ELSE
CASE WHEN answerf.finish=1 THEN 1 ELSE
...
...
@@ -209,7 +207,7 @@
tb.create_time
from research tb
left join tr_research_answer answer on answer.research_id = tb.id and answer.account_id = #{accountId} and answer.finish=1
left join tr_research_answer answerf on answer.research_id = tb.id and answerf.account_id = #{accountId} and answerf.finish
in(0,1)
left join tr_research_answer answerf on answer.research_id = tb.id and answerf.account_id = #{accountId} and answerf.finish
=0
where
-- 状态、站点
tb.deleted = 0 and tb.site_id = #{siteId} and tb.state = 1
...
...
@@ -223,7 +221,6 @@
<if
test=
"bizType != null"
>
and tb.biz_type=#{bizType}
</if>
group by tb.id
)t
order by t.create_time desc,t.endTime desc,id
</if>
...
...
@@ -232,7 +229,7 @@
<!-- 查询进行中的我的调研 -->
<select
id=
"apiCountResearch"
resultType=
"Integer"
>
select count(*) from(
select
select
distinct
<include
refid=
"Base_Column_List"
/>
from research tb
left join tr_research_answer answer on answer.research_id = tb.id and answer.account_id = #{accountId}
...
...
@@ -249,14 +246,13 @@
-- 进行中条件过滤
and
<![CDATA[ tb.end_time > #{now} ]]>
and
<![CDATA[ tb.start_time < #{now} ]]>
and( answer.id is null or
answer.finish = 0)
group by tb.id
)r
</select>
<!-- 搜索调研 -->
<select
id=
"apiSearchPage"
resultType=
"com.yizhi.research.application.vo.domain.Research"
>
select * from(
select (case when answer.submit_time>0 then 1 else 0 end) as finishState,tb.id AS id
select
distinct
(case when answer.submit_time>0 then 1 else 0 end) as finishState,tb.id AS id
,answer.submit_time as finishTime,count(answer.id) as realCount
,tb.research_no AS researchNo
,tb.name AS name
...
...
@@ -283,7 +279,6 @@
(
<foreach
collection=
"idsInRange"
separator=
","
item=
"id"
>
#{id}
</foreach>
))
</if>
)
group by tb.id
)t
order by t.finishState,t.endTime
</select>
...
...
@@ -357,7 +352,7 @@
select count(*) from(
<if
test=
"state == 1"
>
select *
from (select answer.submit_time as submitTime,
from (select
distinct
answer.submit_time as submitTime,
tb.id AS id
,answer.submit_time as finishTime
,tb.research_no AS researchNo
...
...
@@ -386,14 +381,13 @@
)
-- 已完成条件过滤
and
<![CDATA[ tb.end_time > #{now} ]]>
and answer.id is not null and answer.finish = 1
group by tb.id
)t
order by t.create_time desc
-- order by t.submitTime desc
</if>
<if
test=
"state == 2"
>
select
select
distinct
answer.submit_time as submitTime,
tb.id AS id
,answer.submit_time as finishTime
...
...
@@ -424,15 +418,41 @@
-- 进行中条件过滤
and
<![CDATA[ tb.end_time > #{now} ]]>
and
<![CDATA[ tb.start_time < #{now} ]]>
and ( answer.id is null or
answer.finish = 0)
group by tb.id
order by tb.create_time desc
-- order by tb.end_time
</if>
<if
test=
"state == null"
>
select
tb.id AS id
select distinct answer.submit_time as submitTime,
CASE WHEN
<![CDATA[ tb.start_time > NOW() ]]>
THEN 0 ELSE
CASE WHEN
<![CDATA[ tb.start_time >= NOW() ]]>
AND answerf.finish IS NULL THEN 4 ELSE
CASE WHEN answerf.finish=1 THEN 1 ELSE
CASE WHEN
<![CDATA[ tb.end_time < NOW() ]]>
THEN 3 ELSE
2
END
END
END
END AS finishState
,tb.id AS id
,answer.submit_time as finishTime
,tb.research_no AS researchNo
,tb.name AS name
,tb.start_time AS startTime
,tb.end_time AS endTime
,tb.visible_range AS visibleRange
,tb.content AS content
,tb.state AS state
,tb.deleted AS deleted
,tb.company_id AS companyId
,tb.org_id AS orgId
,tb.site_id AS siteId
,tb.image
,tb.biz_type
,tb.page_mode,
tb.create_time
from research tb
left join tr_research_answer answer on answer.research_id = tb.id and answer.account_id = #{accountId} and answer.finish=1
left join tr_research_answer answerf on answer.research_id = tb.id and answerf.account_id = #{accountId} and answerf.finish=0
where
-- 状态、站点
tb.deleted = 0 and tb.site_id = #{siteId} and tb.state = 1
...
...
@@ -446,7 +466,6 @@
<if
test=
"bizType != null"
>
and tb.biz_type=#{bizType}
</if>
group by tb.id
order by tb.create_time desc
</if>
)ttt
...
...
@@ -598,7 +617,7 @@
</select>
<select
id=
"selectResearchDetails"
resultType=
"com.yizhi.research.application.vo.domain.ResearchVo"
>
select answer.submit_time as submitTime,
select
distinct
answer.submit_time as submitTime,
CASE WHEN
<![CDATA[ tb.start_time > NOW() ]]>
THEN 0 ELSE
CASE WHEN
<![CDATA[ tb.start_time >= NOW() ]]>
AND answerf.finish IS NULL THEN 4 ELSE
CASE WHEN answerf.finish=1 THEN 1 ELSE
...
...
@@ -622,8 +641,7 @@
,tb.biz_type
from research tb
left join tr_research_answer answer on answer.research_id = tb.id and answer.account_id = #{accountId} and answer.finish=1
left join tr_research_answer answerf on answer.research_id = tb.id and answerf.account_id = #{accountId} and answerf.finish in(0,1)
where tb.id=#{id} and tb.deleted = 0 and tb.site_id = #{siteId}
group by tb.id
left join tr_research_answer answerf on answer.research_id = tb.id and answerf.account_id = #{accountId} and answerf.finish=0
where tb.id=#{id} and tb.deleted = 0 and tb.site_id = #{siteId}
</select>
</mapper>
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