export_dao
-
(1)數字庫 表欄位 與類的成員變數 不一致

解決方法
- sql陳述句 使用
as - mybatis里面使用 resultMap
方法 1:sql別名
<select id="findAll" resultType="company">
select
id,
name ,
expiration_date as expirationDate ,
address,
license_id as licenseId ,
representative ,
phone ,
company_size as companySize ,
industry ,
remarks ,
state,
balance ,
city
from ss_company
</select>
方法2: resultMap標簽


<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<!--namespace: 需要映射的Dao介面型別-->
<mapper namespace="com.lbl.dao.company.ICompanyDao">
<resultMap id="companyMap" type="company" autoMapping="true">
<id property="id" column="id"></id>
<result property="expirationDate" column="expiration_date"></result>
<result property="licenseId" column="license_id"></result>
<result property="companySize" column="company_size"></result>
</resultMap>
<select id="findAll" resultMap="companyMap">
select * from ss_company
</select>
</mapper>
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/189780.html
標籤:其他
上一篇:Mysql、Oracle、PostgreSql資料庫索引失效場景詳細講解
下一篇:資料庫面試常問的一些基本概念
