t.id_ as id
, t.activity_id_ as activityId
, t.reward_client_ as rewardClient
, t.reward_name_ as rewardName
, t.reward_type_ as rewardType
, t.reward_describe_ as rewardDescribe
, t.coupon_id_ as couponId
, t.img_url_ as imgUrl
, t.stock_ as stock
, t.num_ as num
, t.unit_ as unit
, t.status_ as status
, t.create_time_ as createTime
, t.create_by_ as createBy
, t.update_time_ as updateTime
, t.update_by_ as updateBy
, t.discount_price_ as discountPrice
SELECT
,
u.username_ as updateByName,
(select count(1) from activity_plan_reward r where t.id_ = r.reward_id_)>0 as useFlag
FROM activity_reward t
left join sys_user u on t.update_by_ = u.id_
and t.reward_name_ like concat('%',#{param.rewardName},'%')
and t.status_ = #{param.status}
and t.status_ > -1
and INTE_ARRAY(t.reward_client_,#{param.rewardClient})
and t.stock_>0
order by t.create_time_ desc