|
@@ -137,45 +137,87 @@
|
|
|
|
|
|
<!--查询9大应用场景及分别对应的事件数量-->
|
|
|
<!--List<ApplicationScenarioEventNumber> queryApplicationScenarioEventNumber(Integer tenantId);-->
|
|
|
- <select id="queryApplicationScenarioEventNumber" resultMap="queryApplicationScenarioEventNumberMap">
|
|
|
- select label,
|
|
|
- value as applicationScenarioValue,
|
|
|
- #{tenantId} as tenantId
|
|
|
+ <!-- <select id="queryApplicationScenarioEventNumber" resultMap="queryApplicationScenarioEventNumberMap">-->
|
|
|
+ <!-- select label,-->
|
|
|
+ <!-- value as applicationScenarioValue,-->
|
|
|
+ <!-- #{tenantId} as tenantId-->
|
|
|
+ <!-- from os_system_dict-->
|
|
|
+ <!-- where type = "ENTERPRISE_APPLICATION_SCENARIO"-->
|
|
|
+ <!-- </select>-->
|
|
|
+
|
|
|
+ <!-- <resultMap id="queryApplicationScenarioEventNumberMap"-->
|
|
|
+ <!-- type="cn.cslg.pas.common.model.vo.ApplicationScenarioEventNumberVO">-->
|
|
|
+ <!-- <result column="label" property="applicationScenarioName"/>-->
|
|
|
+ <!-- <result column="value" property="applicationScenarioName"/>-->
|
|
|
+ <!-- <collection property="eventNumberFromEvent" ofType="integer"-->
|
|
|
+ <!-- select="selectEventCount1"-->
|
|
|
+ <!-- column="{applicationScenarioValue=applicationScenarioValue, tenantId=tenantId}">-->
|
|
|
+ <!-- </collection>-->
|
|
|
+ <!-- <collection property="eventNumberFromProject" ofType="integer"-->
|
|
|
+ <!-- select="selectEventCount2"-->
|
|
|
+ <!-- column="{applicationScenarioValue=applicationScenarioValue, tenantId=tenantId}">-->
|
|
|
+ <!-- </collection>-->
|
|
|
+ <!-- </resultMap>-->
|
|
|
+
|
|
|
+ <!-- <select id="selectEventCount1" resultType="integer">-->
|
|
|
+ <!-- select count(*)-->
|
|
|
+ <!-- from event-->
|
|
|
+ <!-- where find_in_set(#{applicationScenarioValue}, application_scenario)-->
|
|
|
+ <!-- and tenant_id = #{tenantId}-->
|
|
|
+ <!-- </select>-->
|
|
|
+
|
|
|
+ <!-- <select id="selectEventCount2" resultType="integer">-->
|
|
|
+ <!-- select count(*)-->
|
|
|
+ <!-- from os_thematic proj-->
|
|
|
+ <!-- join asso_event_project asso on proj.id = asso.project_id-->
|
|
|
+ <!-- join event even on asso.event_id = even.id-->
|
|
|
+ <!-- where find_in_set(#{applicationScenarioValue}, proj.scenarioid)-->
|
|
|
+ <!-- and even.application_scenario is null-->
|
|
|
+ <!-- and tenant_id = #{tenantId}-->
|
|
|
+ <!-- </select>-->
|
|
|
+
|
|
|
+ <!--查询所有应用场景-->
|
|
|
+ <!--List<ApplicationScenario> queryApplicationScenarios();-->
|
|
|
+ <select id="queryApplicationScenarios" resultMap="queryApplicationScenariosMap">
|
|
|
+ select label, value
|
|
|
from os_system_dict
|
|
|
where type = "ENTERPRISE_APPLICATION_SCENARIO"
|
|
|
</select>
|
|
|
|
|
|
- <resultMap id="queryApplicationScenarioEventNumberMap"
|
|
|
- type="cn.cslg.pas.common.model.vo.ApplicationScenarioEventNumberVO">
|
|
|
+ <resultMap id="queryApplicationScenariosMap" type="cn.cslg.pas.domain.ApplicationScenario">
|
|
|
<result column="label" property="applicationScenarioName"/>
|
|
|
- <result column="value" property="applicationScenarioName"/>
|
|
|
- <collection property="eventNumberFromEvent" ofType="integer"
|
|
|
- select="selectEventCount1"
|
|
|
- column="{applicationScenarioValue=applicationScenarioValue, tenantId=tenantId}">
|
|
|
- </collection>
|
|
|
- <collection property="eventNumberFromProject" ofType="integer"
|
|
|
- select="selectEventCount2"
|
|
|
- column="{applicationScenarioValue=applicationScenarioValue, tenantId=tenantId}">
|
|
|
- </collection>
|
|
|
+ <result column="value" property="applicationScenarioValue"/>
|
|
|
</resultMap>
|
|
|
|
|
|
- <select id="selectEventCount1" resultType="integer">
|
|
|
- select count(*)
|
|
|
+ <!--查询所有应用场景不是null的事件-->
|
|
|
+ <!--List<EventListItemVO> queryEventsDirectApplicationScenario(Integer tenantId);-->
|
|
|
+ <select id="queryEventsDirectApplicationScenario" resultMap="queryEventsHaveApplicationScenarioMap">
|
|
|
+ select application_scenario
|
|
|
from event
|
|
|
- where find_in_set(#{applicationScenarioValue}, application_scenario)
|
|
|
+ where application_scenario is not null
|
|
|
and tenant_id = #{tenantId}
|
|
|
</select>
|
|
|
|
|
|
- <select id="selectEventCount2" resultType="integer">
|
|
|
- select count(*)
|
|
|
- from os_thematic proj
|
|
|
- join asso_event_project asso on proj.id = asso.project_id
|
|
|
- join event even on asso.event_id = even.id
|
|
|
- where find_in_set(#{applicationScenarioValue}, proj.scenarioid)
|
|
|
- and even.application_scenario is null
|
|
|
- and tenant_id = #{tenantId}
|
|
|
+ <resultMap id="queryEventsHaveApplicationScenarioMap" type="cn.cslg.pas.common.model.vo.EventListItemVO">
|
|
|
+ <result column="application_scenario" property="applicationScenario"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <!--查询所有应用场景是null的事件(去关联专题库表查询出应用场景,就作为事件的应用场景)-->
|
|
|
+ <!--List<EventListItemVO> queryEventsInDirectApplicationScenario(Integer tenantId);-->
|
|
|
+ <select id="queryEventsInDirectApplicationScenario" resultMap="queryEventsInDirectApplicationScenarioMap">
|
|
|
+ select even.application_scenario, proj.scenarioid
|
|
|
+ from event even
|
|
|
+ join asso_event_project asso on even.id = asso.event_id
|
|
|
+ join os_thematic proj on asso.project_id = proj.id
|
|
|
+ where even.application_scenario is null
|
|
|
+ and proj.scenarioid is not null
|
|
|
+ and even.tenant_id = #{tenantId}
|
|
|
</select>
|
|
|
|
|
|
+ <resultMap id="queryEventsInDirectApplicationScenarioMap" type="cn.cslg.pas.common.model.vo.EventListItemVO">
|
|
|
+ <result column="scenarioid" property="applicationScenario"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
<!--根据应用场景查询调查类型-->
|
|
|
<!--List<Type> queryTypeid(Integer applicationScenario);-->
|
|
|
<select id="queryTypeid" resultMap="queryTypeidMap">
|
|
@@ -189,13 +231,13 @@
|
|
|
<result column="DICT_CHILD_LABEL" property="typeName"/>
|
|
|
</resultMap>
|
|
|
|
|
|
- <!--根据事件id查询专题库-->
|
|
|
- <!--List<Project> queryProjects(Integer eventId);-->
|
|
|
+ <!--根据应用场景和事件id查询专题库-->
|
|
|
+ <!--List<Project> queryProjects(Integer applicationScenario, Integer eventId);-->
|
|
|
<select id="queryProjects" resultMap="queryProjectsMap">
|
|
|
- select typeid
|
|
|
- from asso_event_project asso
|
|
|
- join os_thematic proj on asso.project_id = proj.id
|
|
|
- where event_id = #{eventId}
|
|
|
+ select id, typeid
|
|
|
+ from os_thematic
|
|
|
+ where find_in_set(#{applicationScenario}, scenarioid)
|
|
|
+ and id in (select project_id from asso_event_project where event_id = #{eventId})
|
|
|
</select>
|
|
|
|
|
|
<resultMap id="queryProjectsMap" type="cn.cslg.pas.domain.Project">
|