linwe
2023-11-10 6b14cf7b6b0b53cbfcdec105a9984fd5b1a6778a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?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>