<select id="findMapByCondition" resultType="java.util.HashMap">
SELECT
pc_user_id as userId,
username as username,
password as password,
email as email,
cellphone as cellphone,
nickname as nickname,
realname as realname,
photo as photo,
signature as signature,
lvl as lvl,
experience as experience,
credits as credits,
<!-- DATE_FORMAT(login_time , '%Y-%m-%d %H:%i') as loginTime, -->
CAST(login_time AS CHAR) AS loginTime,
email_authentication as emailAuthentication,
cellphone_authentication as cellphoneAuthentication,
realname_authentication as realnameAuthentication,
status as status,
image_name as imageName,
image_path as imagePath,
expand_info_id as expandInfoId,
school_id as schoolId,
school_name as schoolName,
area_id as areaId,
specialty_id as specialtyId,
specialty_name as specialtyName,
year_of_admission as yearOfAdmission,
year_of_graduate as yearOfGraduate
FROM view_user
${whereCondition}
SELECT
pc_user_id as userId,
username as username,
password as password,
email as email,
cellphone as cellphone,
nickname as nickname,
realname as realname,
photo as photo,
signature as signature,
lvl as lvl,
experience as experience,
credits as credits,
<!-- DATE_FORMAT(login_time , '%Y-%m-%d %H:%i') as loginTime, -->
CAST(login_time AS CHAR) AS loginTime,
email_authentication as emailAuthentication,
cellphone_authentication as cellphoneAuthentication,
realname_authentication as realnameAuthentication,
status as status,
image_name as imageName,
image_path as imagePath,
expand_info_id as expandInfoId,
school_id as schoolId,
school_name as schoolName,
area_id as areaId,
specialty_id as specialtyId,
specialty_name as specialtyName,
year_of_admission as yearOfAdmission,
year_of_graduate as yearOfGraduate
FROM view_user
${whereCondition}
</select>
前提:model和数据库字段属性全为date
若使用
DATE_FORMAT(login_time , '%Y-%m-%d %H:%i') as loginTime,
查询出来没问题,但是修改时,若会报
Caused by: java.lang.NumberFormatException: For input string: "2013-10-29 10:10",
若改成 CAST(login_time AS CHAR) AS loginTime,则解决问题