<?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.casic.missiles.mapper.sys.MessagePushMapper">

    <select id="getPushByUserId" resultType="com.casic.missiles.model.system.UserPush">
        select 	id,
                client_id,
                user_id,
                create_time,
                update_time
                tag,
                type,
                enable
        from sys_user_push
        where user_id = #{userId}
          AND type = #{type}
    </select>

    <select id="getUserIdsByDeptId" resultType="java.lang.Long">
        select su.id
        from sys_user su
        join meter_staff   ms  ON su.name=ms.name
        where su.dept_id = #{deptId}
    </select>


    <select id="getEnableClientList" resultType="java.lang.String">
        select client_id
        from sys_user_push
        where enable=1
        <if test="userIds != null">
            and user_id in
            <foreach collection="userIds" item="id" index="index" open="(" close=")" separator=",">
                #{id}
            </foreach>
        </if>
    </select>

</mapper>
