【MYSQL】知識積累
阿新 • • 發佈:2018-12-04
1、將電話中間換成*****
SELECT a.humbleWish_id,a.humbleWish_name, concat_ws('****', substring(a.humbleWish_tel, 1, 4), substring(a.humbleWish_tel, 9, 3)) AS humbleWish_tel ,a.humbleWish_content, DATE_FORMAT(a.input_time,'%Y-%m-%d') as input_time,b.dept_name FROM wkrj_bus_humbleWish a left join wkrj_sys_department b on a.dept_id=b.dept_id where a.isShenhe="1" order by a.input_time desc
2、mysql中的if–else
<choose> <when test="null !=is_zj and ''!=is_zj"> and a.is_zj = "1" </when> <when test="null !=is_deal and ''!=is_deal"> and a.is_deal = "1" </when> <otherwise> and (a.is_zj = "1" or a.is_deal ="1") </otherwise> </choose>
3、mysql中的if
<if test="null ==is_zj and ''==is_zj and null ==is_deal and ''==is_deal"> and (a.is_zj = "1" or a.is_deal ="1") </if> <if test="null !=is_zj and ''!=is_zj and null ==is_deal and ''==is_deal"> and a.is_zj = "1" </if> <if test="null ==is_zj and ''==is_zj and null !=is_deal and ''!=is_deal"> and a.is_deal = "1" </if>