mybatis给数据库字段起别名

先得弄一个bean

public class PersonnelBasicresumeVo {
    private String id;

    private String personName;

    private String sex;

    private String identifyNum;

    private String phoneNumber;

    private String workMethod;

    private String email;

    private String highestEducation;

起别名

<resultMap id="BaseResultMap_selectResume" type="com.chinacreator.c2.lhyg.positionManagement.entity.PersonnelBasicresumeVo">
    <id column="ID" jdbcType="VARCHAR" property="id" />
    <result column="PERSON_NAME" jdbcType="VARCHAR" property="personName" />
    <result column="SEX" jdbcType="VARCHAR" property="sex" />
    <result column="IDENTIFY_NUM" jdbcType="VARCHAR" property="identifyNum" />
    <result column="PHONE_NUMBER" jdbcType="VARCHAR" property="phoneNumber" />
  </resultMap>

<!-- 热点简历 -->
<select id="selectResume" resultMap="BaseResultMap_selectResume" useCache="false" flushCache="true">
	select * from
	lhyg_personnel_basicresume a
	LEFT JOIN lhyg_personnel_workexperience b on b.RESUME_ID= a.id
</select>

返回结果

public List<Map<String,Object>> selectHotRecruitment() {
		String sql="com.chinacreator.c2.lhyg.positionManagement.entity.PositionManagementMapper.selectHotRecruitment";
		List<Map<String,Object>> selectList = DaoFactory.create(PositionManagement.class).getSession().selectList(sql,Map.class);
		
		return selectList;
	}
	

 

Guess you like

Origin blog.csdn.net/GodPluto/article/details/107866680