<?xml version="1.0" encoding="UTF-8"?>
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<mapper namespace="org.springblade.modules.notice.mapper.NoticesMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="noticeResultMap" type="org.springblade.modules.notice.vo.NoticeVO">
|
<result column="id" property="id"/>
|
<result column="title" property="title"/>
|
<result column="type" property="type"/>
|
<result column="content" property="content"/>
|
<result column="url" property="url"/>
|
<result column="video_url" property="videoUrl"/>
|
<result column="source_id" property="sourceId"/>
|
<result column="source_name" property="sourceName"/>
|
<result column="article_type" property="articleType"/>
|
<result column="recommend" property="recommend"/>
|
<result column="publish" property="publish"/>
|
<result column="iscomment" property="iscomment"/>
|
<result column="view_number" property="viewNumber"/>
|
<result column="create_time" property="createTime"/>
|
<result column="update_time" property="updateTime"/>
|
<result column="update_user" property="updateUser"/>
|
<result column="create_user" property="createUser"/>
|
<result column="is_deleted" property="isDeleted"/>
|
|
<!-- <collection property="lickFlag" javaType="int"-->
|
<!-- column="id" select="selectStlLick">-->
|
<!-- </collection>-->
|
|
<collection property="countNumber" column="id" javaType="int" select="selectStlCount">
|
</collection>
|
|
</resultMap>
|
|
<!-- <select id="selectStlLick" parameterType="Long" resultType="int">-->
|
<!-- select IFNULL(jnl.id, 0) lickFlag-->
|
<!-- FROM jczz_notice jn-->
|
<!-- LEFT JOIN jczz_notice_like jnl ON jn.id = jnl.notice_id-->
|
<!-- WHERE jnl.notice_user_id = #{notice.userId}-->
|
<!-- and jn.is_deleted = 0-->
|
<!-- and jn.id = #{id}-->
|
<!-- </select>-->
|
|
<select id="selectStlCount" resultType="int">
|
select count(1) countNumber
|
FROM jczz_notice jn
|
LEFT JOIN jczz_notice_like jnl ON jn.id = jnl.notice_id
|
where jn.is_deleted = 0
|
and jnl.delete_flag = 0
|
and jn.id = #{id}
|
</select>
|
|
|
<select id="selectNoticePage" resultMap="noticeResultMap">
|
select id,
|
title,
|
type,
|
url,
|
video_url,
|
source_id,
|
source_name,
|
article_type,
|
recommend,
|
publish,
|
iscomment,
|
view_number,
|
create_time,
|
update_time,
|
update_user,
|
create_user,
|
is_deleted
|
from jczz_notice
|
where is_deleted = 0
|
and publish = 1
|
</select>
|
|
|
</mapper>
|