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

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

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