The nomenclature is inconsistent with the database table field name and the member variable name of the class
Nomenclature
Hump nomenclature
Big Hump Nomenclature
Purpose: Commonly used in class names, function names, attributes, and namespaces.
Little camel case means: Pascal nomenclature of the first letter of a word
is big camel case nomenclature
AaBaCcDd
MyCompanyName
Little Hump Nomenclature
Purpose: Variables are generally identified by the little hump method.
The little hump method means: except for the first word, capitalize the first letter of other words
aaBbCcDd
myCompanyName
Hungarian nomenclature
Used to determine the type of a variable. The
basic principle is: variable name = attribute + type + object description
int iMyAge; # “i”: int
char cMyName[10]; # “c”: char
float fManHeight; # “f”: float
Underscore nomenclature
Each logical breakpoint in the function name is marked by an underscore
my_company_name
aa_bb_cc_dd
The database table field name is inconsistent with the member variable name of the class
It can be seen that the name of the database is aaa_bbb type, and the member variable name of the class is aaaBbb type, the two are inconsistent
As alias (more troublesome, write out all table members)
Change the table name of the database using as to the member variable name of the class
<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>
Use resultMap in mybatis
<resultMap id="companyMap" type="company">
<id column="id" property="id"/>
<result column="expiration_date" property="expirationDate"/>
<result column="license_id" property="licenseId"/>
<result column="company_size" property="companySize"/>
</resultMap>
<select id="findAll" resultMap="companyMap">
select
*
from ss_company
</select>