首页信息查询接口 增加根据类型查询条件

This commit is contained in:
zhangqinbin
2022-04-02 14:45:48 +08:00
parent f6f4aae302
commit 8b1063e2a4
2 changed files with 15 additions and 9 deletions

View File

@ -23,22 +23,30 @@
FROM biz_message FROM biz_message
left join biz_message_template on biz_message.templatecode = biz_message_template.code left join biz_message_template on biz_message.templatecode = biz_message_template.code
WHERE authorize = 0 WHERE authorize = 0
<if test="userId!=null and userId!=''">
UNION ALL
SELECT a.*,IFNULL(b.state,1) as authorizestate
FROM ( SELECT biz_message.*,biz_message_template.type as templatetype
FROM biz_message
left join biz_message_template on biz_message.templatecode = biz_message_template.code
WHERE authorize = 1) a
INNER JOIN
( SELECT * FROM biz_message_authorize WHERE user_id = #{userId}) b ON a.id = b.message_id
</if>
<if test="templatecodes!=null and templatecodes.size()>0 "> <if test="templatecodes!=null and templatecodes.size()>0 ">
and biz_message.templatecode in and biz_message.templatecode in
<foreach item="item" collection="templatecodes" separator="," open="(" close=")" index=""> <foreach item="item" collection="templatecodes" separator="," open="(" close=")" index="">
#{item, jdbcType=NUMERIC} #{item, jdbcType=NUMERIC}
</foreach> </foreach>
</if> </if>
<if test="userId!=null and userId!=''">
UNION ALL
SELECT a.*,IFNULL(b.state,1) as authorizestate
FROM ( SELECT biz_message.*,biz_message_template.type as templatetype
FROM biz_message
left join biz_message_template on biz_message.templatecode = biz_message_template.code
WHERE authorize = 1
<if test="templatecodes!=null and templatecodes.size()>0 ">
and biz_message.templatecode in
<foreach item="item" collection="templatecodes" separator="," open="(" close=")" index="">
#{item, jdbcType=NUMERIC}
</foreach>
</if>
) a
INNER JOIN
( SELECT * FROM biz_message_authorize WHERE user_id = #{userId}) b ON a.id = b.message_id
</if>
ORDER BY createtime DESC ORDER BY createtime DESC
</select> </select>

View File

@ -12,6 +12,4 @@ public class BizMessageVo extends BizMessage{
private String userId; private String userId;
private Long datanum; private Long datanum;
private Integer size; private Integer size;
private List<String> templatecodes;
} }