<?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.yeejoin.amos.supervision.business.dao.mapper.MsgSubscribeMapper">

    <select id="listMsgSubscribeByTypeAndUserIds"
            resultType="com.yeejoin.amos.supervision.business.entity.mybatis.MsgSubscribeBo">
        select * from p_msg_subscribe
        <where>
            <if test="msgType != null">
                and msg_type = #{msgType}
            </if>
            <if test="sendUserIds != null">
                and user_id in
                <foreach collection="sendUserIds" item="item" index="index" open="(" separator="," close=")">
                    #{item}
                </foreach>
            </if>
        </where>
    </select>

    <select id="listMsgSubscribeByTypeAndUserId"
            resultType="com.yeejoin.amos.supervision.business.entity.mybatis.MsgSubscribeBo">
        select * from p_msg_subscribe
        <where>
            <if test="msgType != null">
                and msg_type = #{msgType}
            </if>
            <if test="sendUserIds != null">
                and user_id = #{userId}
            </if>
        </where>
    </select>

    <select id="getSelectedCheckRecordByUserIds"
            resultType="com.yeejoin.amos.supervision.business.entity.mybatis.MsgSubscribeBo">
        select * from p_msg_subscribe
        where
            msg_type in
            ('checkRecordPushHavaRecordApp','checkRecordHavaNoPassRecordApp',
            'checkRecordHaveMissRecordApp','checkRecordNoPushApp')
        and
            user_id in
            <foreach collection="sendUserIds" item="item" index="index" open="(" separator="," close=")">
                #{item}
            </foreach>
        and
            attribute1 = 'True'
    </select>
</mapper>