数据库

 

MySQL  的两种  把数字转换成汉字      0 1   男  女

1.该sql语句

--简单Case函数

SELECT name,CASE getDoor
WHEN '1' THEN '男'
WHEN '2' THEN '女'
ELSE '其他' END from t_student

 

SELECT t.name,if(t.getDoor=1,"男","女") as getDoor from t_student t

2.在java  代码中加判断语句

if("0".equals(s.getGetDoor())){
m.put("Door", "未上门");
}else if("1".equals(s.getGetDoor())){
m.put("door", "已上门");
}

posted @ 2019-04-09 19:19  cxq前  阅读(99)  评论(0编辑  收藏  举报