4 个回答
使用java Bean传参法,示例如下:
public User selectUser(User user);
<select id="selectUser" parameterType="com.jourwon.pojo.User" resultMap="UserResultMap">
select * from user where user_name = #{userName} and dept_id = #{deptId}
</select>
发布于:1周前 (04-21) IP属地:四川省
使用map传参法,示例如下:
public User selectUser(Map<String, Object> params);
<select id="selectUser" parameterType="java.util.Map" resultMap="UserResultMap">
select * from user where user_name = #{userName} and dept_id = #{deptId}
</select>
发布于:1周前 (04-21) IP属地:四川省
使用params注解传参法,示例如下:
public User selectUser(@Param("userName") String name, int @Param("deptId") deptId);
<select id="selectUser" resultMap="UserResultMap">
select * from user where user_name = #{userName} and dept_id = #{deptId}
</select>
发布于:1周前 (04-21) IP属地:四川省
使用顺序传参法,示例如下:
public User selectUser(String name, int deptId);
<select id="selectUser" resultMap="UserResultMap">
select * from user where user_name = #{0} and dept_id = #{1}
</select>
发布于:1周前 (04-21) IP属地:四川省
我来回答
您需要 登录 后回答此问题!