数据库

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", "已上门");
}

原文地址:https://www.cnblogs.com/cxqbk/p/10484265.html