Helius
2021-07-23 297b4b60ca499969eeccc1a5113810fdc2034486
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
<?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="com.xzx.gc.system.mapper.SysNoticeMapper">
    <resultMap id="SysNoticeMap" type="com.xzx.gc.model.system.SysNoticeVo">
        <id column="notice_id" property="noticeId" />
        <result column="title" jdbcType="VARCHAR" property="title"/>
        <result column="content" jdbcType="VARCHAR" property="content"/>
        <result column="create_time" jdbcType="VARCHAR" property="createTime"/>
        <result column="create_user_id" jdbcType="VARCHAR" property="createUserId"/>
        <result column="create_user_name" jdbcType="VARCHAR" property="createUserName"/>
        <result column="picture" jdbcType="VARCHAR" property="picture"/>
        <result column="notice_type" jdbcType="VARCHAR" property="noticeType"/>
        <result column="complaint_type" jdbcType="VARCHAR" property="complaintType"/>
        <result column="read_num" jdbcType="VARCHAR" property="readNum"/>
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        notice_id,title,content,create_time,create_user_id,picture,notice_type,complaint_type,read_num
    </sql>
 
 
    <!-- 公告列表查询 -->
    <select id="getSysNoticeByType" parameterType="java.util.Map" resultMap="SysNoticeMap">
        select <include refid="Base_Column_List"/> from xzx_sys_notice
        where 1=1
        <if test="noticeType!=null and noticeType!=''">
            and  notice_type=#{noticeType}
        </if>
        order by create_time desc,read_num desc
    </select>
 
    <!-- 公告详情查询 -->
    <select id="getSysNoticeById" parameterType="java.util.Map" resultMap="SysNoticeMap">
        select  <include refid="Base_Column_List"/> from xzx_sys_notice
        where notice_id = #{noticeId}
    </select>
 
    <!-- 新增公告-->
    <insert id="addSysNotice" parameterType="java.util.Map" useGeneratedKeys="true" keyProperty="noticeId">
        insert into xzx_sys_notice(title,content,create_time,create_user_id,picture,notice_type,complaint_type )
        values (#{title},#{content},#{createTime},#{createUserId},#{picture},#{noticeType},#{complaintType})
    </insert>
    <select id="queryNoticeList" resultType="com.xzx.gc.model.admin.SysNoticeModel">
        select a.title,a.content,a.create_time as createTime,b.nick_name as nickName,b.mobile_phone as mobilePhone,b.partner_id as partnerId
        from xzx_sys_notice a
        left join xzx_user_info b on a.create_user_id=b.user_id
        where b.del_flag=0
        <if test="startTime != null and startTime != ''">
            AND  a.create_time<![CDATA[>= ]]> #{startTime}
        </if>
        <if test="endTime != null and endTime != ''">
            AND  a.create_time<![CDATA[<= ]]> #{endTime}
        </if>
        <if test="nickName != null and nickName != ''">
            AND  b.nick_name = #{nickName}
        </if>
        <if test="partnerId != null and partnerId != ''">
            AND   b.partner_id= #{partnerId}
        </if>
        <if test="mobilePhone != null and mobilePhone != ''">
            AND  b.mobile_phone like concat('%',#{mobilePhone} ,'%')
        </if>
    </select>
 
 
</mapper>