select DISTINCT case hg.group_card_type when (hg.group_card_type IN ( 'X', 'Y','V' ,'T') ) then '门市充值' else '团单' end as card_source from qianxun_wash_groupcard hg where hg.create_unit='101'
) hg
where 1=1
${if(len(card_source)>0," and hg.card_source ='"+card_source+"'","")}
fanruan大头兵(提问者) SELECT
sd.email,
consume_phone phone, case hg.group_card_kind when '1' then '赠洗卡' else '现金卡' end as card_type,
CASE
WHEN hg.group_card_type IN ('X', 'Y', 'V', 'T') THEN '门市充值'
ELSE '团单'
END as card_source,
FROM
qianxun_wash_consume hs
LEFT JOIN qianxun_wash_groupcard hg ON (hs.consume_phone = hg.group_phone and hs.consume_card_kind=hg.group_card_kind)
LEFT JOIN sys_dept sd on sd.dept_id=hg.create_dept
WHERE
consume_subtract_card != '0' and hs.consume_card_type IS NOT NULL
and hs.create_unit='101'
and hs.consume_card_type <> ' '
AND hs.consume_type IN
( '200', '220' )
${if(startdate!=''," and DATE_FORMAT(hs.create_time, '%Y-%m-%d') >='"+startdate+"'","")}
${if(enddate!=''," and DATE_FORMAT(hs.create_time, '%Y-%m-%d') ='"+times+"'","")}
ORDER BY
times DESC我是这样写的,我现在的下拉框只能展示不能搜索