resultMap的使用
XXXX.xml:
<!----> <resultMap id="getUserMap" type="com.handsight.platform.fras.pojo.EntityMap.VoUser"> <result property="useraccount" column="USERACCOUNT" ></result> <result property="devicefigure" column="DEVICEFIGURE" ></result> <result property="platform" column="PLATFORM" ></result> <result property="pushkey" column="PUSHKEY"></result> </resultMap> <--property对应VoUser的属性字段,column是数据库的对应的字段--> <select id="saveUserInfoAndRedis" resultMap="getUserMap"> select USERACCOUNT ,DEVICEFIGURE,PLATFORM,PUSHKEY from T_user </select>
VoUser:
@Data @NoArgsConstructor @AllArgsConstructor public class VoUser implements Serializable { private String useraccount; private String devicefigure; private String platform; private String pushkey; }
UserMapper.java:
/** * @Description : */ List<VoUser> saveUserInfoAndRedis();
结构测试: