feiyu02
2022-11-15 23bd719cebe5feeff4e48fde925b0b39755eea93
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?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="cn.flightfeather.supervision.domain.mapper.NoticeMapper" >
  <resultMap id="BaseResultMap" type="cn.flightfeather.supervision.domain.entity.Notice" >
    <!--
      WARNING - @mbg.generated
    -->
    <id column="EC_GUID" property="ecGuid" jdbcType="VARCHAR" />
    <result column="EC_NoticeType" property="ecNoticetype" jdbcType="INTEGER" />
    <result column="EC_NoticeTypeName" property="ecNoticetypename" jdbcType="VARCHAR" />
    <result column="EC_NoticeSubType" property="ecNoticesubtype" jdbcType="INTEGER" />
    <result column="EC_NoticeSubTypeName" property="ecNoticesubtypename" jdbcType="VARCHAR" />
    <result column="EC_NoticeTitle" property="ecNoticetitle" jdbcType="VARCHAR" />
    <result column="EC_NoticeFreq" property="ecNoticefreq" jdbcType="INTEGER" />
    <result column="EC_IsInUse" property="ecIsinuse" jdbcType="BIT" />
    <result column="EC_IsPE" property="ecIspe" jdbcType="BIT" />
    <result column="EC_NoticeDtStart" property="ecNoticedtstart" jdbcType="TIMESTAMP" />
    <result column="EC_NoticeDtEnd" property="ecNoticedtend" jdbcType="TIMESTAMP" />
    <result column="EC_CreateDate" property="ecCreatedate" jdbcType="TIMESTAMP" />
    <result column="EC_CreatorId" property="ecCreatorid" jdbcType="VARCHAR" />
    <result column="EC_Creator" property="ecCreator" jdbcType="VARCHAR" />
    <result column="EC_UpdateDate" property="ecUpdatedate" jdbcType="TIMESTAMP" />
    <result column="EC_ModifierId" property="ecModifierid" jdbcType="VARCHAR" />
    <result column="EC_Modifier" property="ecModifier" jdbcType="VARCHAR" />
    <result column="EC_ReceiverType" property="ecReceivertype" jdbcType="VARCHAR" />
    <result column="EC_NeedSign" property="ecNeedsign" jdbcType="BIT" />
    <result column="EC_Extension1" property="ecExtension1" jdbcType="VARCHAR" />
    <result column="EC_Extension2" property="ecExtension2" jdbcType="VARCHAR" />
    <result column="EC_Extension3" property="ecExtension3" jdbcType="VARCHAR" />
    <result column="EC_Remark" property="ecRemark" jdbcType="VARCHAR" />
  </resultMap>
  <resultMap id="ResultMapWithBLOBs" type="cn.flightfeather.supervision.domain.entity.Notice" extends="BaseResultMap" >
    <!--
      WARNING - @mbg.generated
    -->
    <result column="EC_NoticeContent" property="ecNoticecontent" jdbcType="LONGVARCHAR" />
    <result column="EC_ReceiverId" property="ecReceiverid" jdbcType="LONGVARCHAR" />
    <result column="EC_PicUrl" property="ecPicurl" jdbcType="LONGVARCHAR" />
    <result column="EC_BodyUrl" property="ecBodyurl" jdbcType="LONGVARCHAR" />
  </resultMap>
 
  <resultMap id="NotificationVo" type="cn.flightfeather.supervision.lightshare.vo.NotificationVo" >
    <id column="EC_GUID" property="id" jdbcType="VARCHAR" />
    <result column="EC_CreatorId" property="authorId" jdbcType="VARCHAR" />
    <result column="EC_Creator" property="authorName" jdbcType="VARCHAR" />
    <result column="UI_HeadIconUrl" property="authorPicUrl" jdbcType="VARCHAR" />
    <result column="EC_NoticeType" property="typeId" jdbcType="VARCHAR" />
    <result column="EC_NoticeTypeName" property="typeName" jdbcType="VARCHAR" />
    <result column="EC_NoticeSubType" property="subTypeId" jdbcType="VARCHAR" />
    <result column="EC_NoticeSubTypeName" property="subTypeName" jdbcType="VARCHAR" />
    <result column="EC_NoticeTitle" property="title" jdbcType="VARCHAR" />
    <result column="EC_NoticeContent" property="content" jdbcType="LONGVARCHAR" />
    <result column="EC_PicUrl" property="picUrl" jdbcType="LONGVARCHAR" />
    <result column="EC_BodyUrl" property="bodyUrl" jdbcType="LONGVARCHAR" />
    <result column="EC_UpdateDate" property="updateTime" jdbcType="TIMESTAMP" />
    <result column="EC_NeedSign" property="needSigned" jdbcType="BIT" />
    <result column="NR_ReadState" property="hasRead" jdbcType="BIT" />
    <result column="NR_SignState" property="hasSigned" jdbcType="BIT" />
    <!--<result column="EC_ReceiverType" property="receiverType" jdbcType="VARCHAR" />-->
    <!--<result column="EC_ReceiverId" property="receiverId" jdbcType="LONGVARCHAR" />-->
    <!--<result column="EC_Extension1" property="district" jdbcType="VARCHAR" />-->
  </resultMap>
  <sql id="Base_Column_List" >
    <!--
      WARNING - @mbg.generated
    -->
    EC_GUID, EC_NoticeType, EC_NoticeTypeName, EC_NoticeSubType, EC_NoticeSubTypeName, 
    EC_NoticeTitle, EC_NoticeFreq, EC_IsInUse, EC_IsPE, EC_NoticeDtStart, EC_NoticeDtEnd, 
    EC_CreateDate, EC_CreatorId, EC_Creator, EC_UpdateDate, EC_ModifierId, EC_Modifier, 
    EC_ReceiverType, EC_NeedSign, EC_Extension1, EC_Extension2, EC_Extension3, EC_Remark
  </sql>
  <sql id="Blob_Column_List" >
    <!--
      WARNING - @mbg.generated
    -->
    EC_NoticeContent, EC_ReceiverId, EC_PicUrl, EC_BodyUrl
  </sql>
  
  <select id="getUnReadNotification" resultMap="NotificationVo">
    select
    a.*
    from ec_t_notice as a
    left join sm_t_userinfo as c on a.EC_CreatorId = c.UI_GUID
    where
    (
          a.EC_ReceiverId like CONCAT('%',#{param1},';%')
          or (
            a.EC_ReceiverId is null
            <if test="param3 != null">
                and (a.EC_ReceiverType like '%0;%' or a.EC_ReceiverType like CONCAT('%',#{param3},';%'))
            </if>
            <if test="param2 != null">
                and (a.EC_Extension1 like '%0;%' or a.EC_Extension1 like CONCAT('%',#{param2},';%'))
            </if>
          )
    )
    and a.EC_IsInUse = true
    order by a.EC_UpdateDate desc
  </select>
 
    <select id="selectByUser" resultMap="ResultMapWithBLOBs">
        select *
        from ec_t_notice
        where EC_IsInUse = true
        and (EC_ReceiverType like CONCAT('%',#{param1},'%') or EC_ReceiverId like #{param2}) or EC_ReceiverType = '-1'
        <if test="param2 == ''">
            and EC_NeedSign = false
        </if>
        order by EC_UpdateDate DESC
        limit #{param3}, #{param4};
    </select>
</mapper>