update PPW_EMAIL.company_email_send_history set isvalid =0,updatetime=sysdate() where email=#{email}
update PPW_EMAIL.company_email_send_history set isvalid =0,updatetime=sysdate() where id in
#{id}
SELECT
cec.id,
cec.company_id,
c.company_name,
cec.email,
MAX(cesh.send_time) AS send_time,
cesh.send_remark,
cesh.send_status
FROM
PPW_EMAIL.company_email_config cec
JOIN PPW_EMAIL.company_information c
ON cec.company_id = c.company_id
LEFT JOIN PPW_EMAIL.company_email_send_history cesh
ON cec.email = cesh.email AND cesh.isvalid = 1
WHERE cec.isvalid = 1 and c.isvalid=1
and (c.company_name like concat('',#{companyName},'') or c.company_short_name like concat('',#{companyName},''))
and cec.email like concat('',#{email},'')
and cesh.send_status=#{sendStatus}
SELECT
cec.id,
cec.company_id,
c.company_name,
cec.email,
cesh.send_time,
cesh.send_remark,
cesh.send_status
FROM
PPW_EMAIL.company_email_send_history cesh
JOIN PPW_EMAIL.company_email_config cec
JOIN PPW_EMAIL.company_information c
ON cec.company_id = c.company_id
ON cec.email = cesh.email
WHERE cec.isvalid = 1
AND cesh.isvalid = 1 and c.isvalid =1
and cec.email=#{email}