提交 2fac209a authored 作者: 宋文杰's avatar 宋文杰

feat(aroad): 解决信息上报模块sql不兼容的问题

上级 102f6660
......@@ -40,17 +40,17 @@
<select id="getPlanPage" resultMap="emergencyPlanDtoMap">
select
`plan_id`,
`plan_name`,
`plan_type`,
`plan_level`,
`plan_doc_name`,
`plan_doc_url`,
`plan_keyword`,
`publish_dept`,
`publish_time`,
`publisher`,
`publisher_id`
plan_id,
plan_name,
plan_type,
plan_level,
plan_doc_name,
plan_doc_url,
plan_keyword,
publish_dept,
publish_time,
publisher,
publisher_id
from
emergency_plan
<where>
......
......@@ -43,7 +43,7 @@
i.info_id,i.template_id,i.info_title,i.info_content,i.info_remark,i.reporter_id,i.reporter,i.reporting_time,
t.template_name,t.template_type,
r.receiver_id,r.receiver_name
from `info_templates` t
from info_templates t
right join
info_informations i
on t.template_id = i.template_id
......@@ -56,19 +56,48 @@
<!--我上报的信息-->
<select id="getIReported" resultMap="infoMap">
select
i.info_id,i.template_id,i.info_title,i.info_content,i.info_remark,i.reporter_id,i.reporter,i.reporting_time,
t.template_name,t.template_type,
r.receiver_id,group_concat(r.receiver_name) as receiver_name
from `info_templates` t
right join
info_informations i
on t.template_id = i.template_id
inner join
info_receivers r
on i.info_id = r.info_id
where i.reporter_id = #{reporterId}
group by i.info_id
order by i.reporting_time desc
SELECT
i.template_id,
i.info_title,
i.info_content,
i.info_remark,
i.reporter_id,
i.reporter,
i.reporting_time,
T.template_name,
T.template_type,
r.info_id,
r.receiver_name
from
info_templates T RIGHT JOIN info_informations i ON T.template_id = i.template_id
INNER join
(SELECT
i.info_id,
string_agg(r.receiver_name, ',') AS receiver_name
FROM
info_templates
T RIGHT JOIN info_informations i ON T.template_id = i.template_id
INNER JOIN info_receivers r ON i.info_id = r.info_id
WHERE
i.reporter_id = #{reporterId}
GROUP BY
i.info_id
ORDER BY
i.reporting_time DESC) r ON i.info_id = r.info_id
</select>
<!-- &#45;&#45; select-->
<!-- &#45;&#45; i.info_id,i.template_id,i.info_title,i.info_content,i.info_remark,i.reporter_id,i.reporter,i.reporting_time,-->
<!-- &#45;&#45; t.template_name,t.template_type,-->
<!-- &#45;&#45; r.receiver_id,group_concat(r.receiver_name) as receiver_name-->
<!-- &#45;&#45; from info_templates t-->
<!-- &#45;&#45; right join-->
<!-- &#45;&#45; info_informations i-->
<!-- &#45;&#45; on t.template_id = i.template_id-->
<!-- &#45;&#45; inner join-->
<!-- &#45;&#45; info_receivers r-->
<!-- &#45;&#45; on i.info_id = r.info_id-->
<!-- &#45;&#45; where i.reporter_id = #{reporterId}-->
<!-- &#45;&#45; group by i.info_id-->
<!-- &#45;&#45; order by i.reporting_time desc-->
</mapper>
......@@ -17,11 +17,11 @@
<select id="getInfoTemplatePage" resultMap="infoTemplatesMap">
select * from info_templates
where create_dept_id = #{createDeptId}
and is_del = 0
and is_del = '0'
</select>
<!--假删除信息模板-->
<update id="del">
update info_templates set is_del=1 where template_id = #{templateId}
update info_templates set is_del='1' where template_id = #{templateId}
</update>
</mapper>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论