发现问题:
<resultMap id="BaseResultMap" type="com.team1.vo.User" >
<id column="userID" property="userid" jdbcType="INTEGER" />
<result column="roleID" property="roleid" jdbcType="INTEGER" />
<result column="password" property="password" jdbcType="VARCHAR" />
<result column="username" property="username" jdbcType="VARCHAR" />
<result column="sex" property="sex" jdbcType="INTEGER" />
<result column="age" property="age" jdbcType="INTEGER" />
<result column="deptID" property="deptid" jdbcType="INTEGER" />
<result column="position" property="position" jdbcType="VARCHAR" />
<result column="introduction" property="introduction" jdbcType="VARCHAR" />
<result column="interests" property="interests" jdbcType="VARCHAR" />
<result column="phone" property="phone" jdbcType="VARCHAR" />
<result column="mobilephone" property="mobilephone" jdbcType="VARCHAR" />
<result column="Email" property="email" jdbcType="VARCHAR" />
<result column="Address" property="address" jdbcType="VARCHAR" />
</resultMap>
<select id="userLogin" parameterMap="BaseResultMap" resultMap="BaseResultMap">
select * from user where roleid=#{roleid}
and username=#{username} and password= MD5(#{password})
</select>解决问题
<resultMap id="BaseResultMap" type="com.team1.vo.User" >
<id column="userID" property="userid" jdbcType="INTEGER" />
<result column="roleID" property="roleid" jdbcType="INTEGER" />
<result column="password" property="password" jdbcType="VARCHAR" />
<result column="username" property="username" jdbcType="VARCHAR" />
<result column="sex" property="sex" jdbcType="INTEGER" />
<result column="age" property="age" jdbcType="INTEGER" />
<result column="deptID" property="deptid" jdbcType="INTEGER" />
<result column="position" property="position" jdbcType="VARCHAR" />
<result column="introduction" property="introduction" jdbcType="VARCHAR" />
<result column="interests" property="interests" jdbcType="VARCHAR" />
<result column="phone" property="phone" jdbcType="VARCHAR" />
<result column="mobilephone" property="mobilephone" jdbcType="VARCHAR" />
<result column="Email" property="email" jdbcType="VARCHAR" />
<result column="Address" property="address" jdbcType="VARCHAR" />
</resultMap>
<select id="userLogin" parameterType="User" resultMap="BaseResultMap">
select * from user where roleid=#{roleid}
and username=#{username} and password= MD5(#{password})
</select>parammeterMap="BaseResultMap" -------》parameterType="com.demo.sys.entity.Module"
MyBatis登录模块配置
本文介绍了一个使用MyBatis实现的登录模块配置案例,详细展示了如何定义resultMap映射和select元素,确保数据库字段与Java对象属性正确匹配,同时实现了用户认证功能。
1287

被折叠的 条评论
为什么被折叠?



