<?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.com.ctop.common.module.mapper.MailLogMapper">


    <select id="selectCountByAccountIdAndDate" resultType="java.lang.Integer">
        select
        count(1)
        from
        ctop_mail_log
        where account_id = #{accountId}
        and DATE_FORMAT(create_time,'%Y-%m-%d') = #{createTime}
        and mail_type = #{type}


    </select>
    <select id="selectMailList" resultType="java.lang.String">
     select
     t2.email
     from
     ctop_project_member t1
     left join sys_user t2
     on t1.user_id = t2.id
     where t1.project_id = #{projectId}
     and t2.`status` = 1
     and t2.email != ''
    </select>


    <select id="selectWeiXinIdList" resultType="java.lang.String">
     select
     t2.wexin_id
     from
     ctop_project_member t1
     left join ctop_corp_wexin_user t2
     on t1.user_id = t2.user_id
     LEFT JOIN sys_user t3
     on  t1.user_id = t3.id
     where t1.project_id = #{projectId}
     and t3.`status` = 1
     and t2.wexin_id != ''
    </select>

    <select id="getWChatIdByUserId" resultType="java.lang.String">
    select t1.wexin_id
    from ctop_corp_wexin_user t1
    left join  sys_user t2
    on  t1.user_id = t2.id
    where  t1.user_id = #{userId}
    and t2.`status` = 1

    </select>

    <select id="getUserNameByUserId" resultType="java.lang.String">
    select
    realname
    from sys_user
    where id = #{userId}
    </select>


</mapper>