问题:sqlserver中的存储时间格式为date,pojo的时间属性也是date,直接mybatis取出的时间格式是带英语的那种,不满足客户要求。
解决:将pojo的时间属性改为string类型,在mybatis的配置sql语句文件中,将得到的date格式的时间转换成string
直接在xml配置文件中,在收到 date 字段后面加上jdbcType="VARCHAR"
<resultMap type="com.soecode.lyf.entity.AuditPage" id="AuditPageList"> <id column="id" property="id" /> <result column="inputdate" property="date" jdbcType="VARCHAR" /> <result column="checkid" property="number" /> <result column="proceedingname" property="name" /> <result column="isapproved" property="zt" /> </resultMap> <select id="getAllAudit" resultMap="AuditPageList" > select top 20 id,inputdate,checkid, proceedingname,isapproved from exm001 order by inputdate desc </select>