update ta_help_initiate_record a
left join ta_help_activity b on a.help_activity_id = b.help_activity_id
set a.status = '2'
where (NOW() > b.end_date or b.activity_status = '2') and a.`status` = '1' and a.status != '0'
SELECT
hi.*
FROM
ta_help_initiate_record as hi
LEFT JOIN ta_help_activity ha ON hi.help_activity_id = ha.help_activity_id
hi.help_activity_id = #{helpActivityId}
AND hi.verification !='null'
AND hi.verification !=''
and (hi.verification is null OR hi.verification = '')
AND hi.`status` = 1
and (hi.verification is null
OR hi.verification = '')
AND hi.`status` = 2
and hi.phone like concat('%',#{tel},'%')
SELECT
b.name as name,
b.create_date as createDate,
b.phone as phone,
b.succeed_date as succeedDate,
if(b.verification_status = 0, '未核销', if(b.verification_status = 1, '已核销', '未知')) as verificationStatus
from ta_help_initiate_record b
where b.help_activity_id = #{helpActivityId}
AND b.verification !='null'
AND b.verification !=''
and b.phone like concat('%',#{tel},'%')
order by b.create_date desc
limit #{pageCode}, #{pageSize}
SELECT
b.name as name,
b.create_date as createDate,
b.phone as phone
from ta_help_initiate_record b
where b.help_activity_id = #{helpActivityId}
AND b.verification !='null'
AND b.verification !=''
and (b.verification is null OR b.verification = '')
AND b.`status` = 1
and (b.verification is null
OR b.verification = '')
AND b.`status` = 2
and b.phone like concat('%',#{tel},'%')
order by b.create_date desc
limit #{pageCode}, #{pageSize}
SELECT
t.*,
a.title,
a.list_img as img,
a.activity_status,
a.end_date
FROM
ta_help_initiate_record t
LEFT JOIN ta_help_activity a ON t.help_activity_id = a.help_activity_id
WHERE
t.org_id = #{orgId}
AND t.person_id = #{personId}
ORDER BY t.status, t.create_date desc