insert into hosted_email_info(company_id,email,creatorid,createtime,updaterid,updatetime,isvalid,open_status)
values
(#{companyId},#{email},#{creatorId},#{createTime},#{updaterId},#{updateTime},#{isvalid},#{openStatus})
update hosted_email_info set isvalid=0,updaterid=#{userId} where id in
#{id}
select hei.id,
hei.company_id,
ci.company_name,
hei.open_status,
hei.email,
hei.creatorid,
hei.createtime,
hei.updaterid,
hei.updatetime,
hei.isvalid
from hosted_email_info hei
join pvn_company_info ci
on ci.company_id = hei.company_id
where hei.isvalid=1 and ci.isvalid=1 and hei.email=#{email}
select hei.id,
hei.company_id,
ci.company_name,
hei.email,
hei.open_status,
hei.creatorid,
hei.createtime,
hei.updaterid,
hei.updatetime,
hei.isvalid
from hosted_email_info hei
join pvn_company_info ci
on ci.company_id = hei.company_id
where hei.isvalid=1 and ci.isvalid=1
and (ci.company_name like concat('%',#{companyName},'%') or ci.company_short_name like concat('%',#{companyName},'%'))
and hei.email like concat('%',#{email},'%')
and hei.open_status =#{openStatus}
limit #{offset},#{pageSize}
select count(hei.id)
from hosted_email_info hei
join pvn_company_info ci
on ci.company_id = hei.company_id
where hei.isvalid=1 and ci.isvalid=1
and (ci.company_name like concat('%',#{companyName},'%') or ci.company_short_name like concat('%',#{companyName},'%'))
and hei.email like concat('%',#{email},'%')
and hei.open_status =#{openStatus}
select email from hosted_email_info where isvalid=1 and open_status=1 group by email