select标签设置默认值选择(select设置初始值的方法)

来源:国外服务器 在您之前已被浏览:1 次
导读:目前正在解读《select标签设置默认值选择(select设置初始值的方法)》的相关信息,《select标签设置默认值选择(select设置初始值的方法)》是由用户自行发布的知识型内容!下面请观看由(国外主机 - www.2bp.net)用户发布《select标签设置默认值选择(select设置初始值的方法)》的详细说明。
笨笨网美国主机,w ww.2 b p .n e t

1.Mybatis映射文件的<select>标签主要帮助我们完成SQL语句查询功能,<select>标签它包含了很多属性,下面简单对<select>标签的属性做一个归纳

  • id:唯一指定标签的名字
  • resultType:查询结构返回的数据类型,自动进行封装操作
  • parameterType:给SQL语句传递参数的数据类型
  • resultMap:查询结果返回的数据类型,会根据映射文件中<resultMap>来完成数据封装
  • parameterMap:给SQL语句传递参数的数据类型,需要和<parameterMap…/>标签连用

2.下面代码主要说明resultMap和parameterType的用法

<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"><mapper namespace="com.gxa.mapper.TeamMapper"> <resultMap type="com.gxa.pojo.Team" id="Team"> <id column="t_id" property="tid"/> <result column="t_name" property="tname"/> </resultMap> <select id="getTeam" resultMap="Team"> select * from team </select> <select id="getTeamById" resultMap="Team" parameterType="java.lang.Integer"> select * from team where t_id = #{tid} </select> <select id="getTeamById2" resultMap="Team" parameterType="com.gxa.pojo.Team"> select * from team where t_id = #{tid} and t_name = #{tname} </select> </mapper>

3.下面代码主要说明resultType的用法

<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"><mapper namespace="com.gxa.mapper.MyUserMapper"> <select id="getMyUser" resultType="com.gxa.pojo.MyUser" > select * from myuser </select> </mapper>
笨笨网美国主机,w ww.2 b p .n e t
提醒:《select标签设置默认值选择(select设置初始值的方法)》最后刷新时间 2025-03-21 11:17:40,本站为公益型个人网站,仅供个人学习和记录信息,不进行任何商业性质的盈利。如果内容、图片资源失效或内容涉及侵权,请反馈至,我们会及时处理。本站只保证内容的可读性,无法保证真实性,《select标签设置默认值选择(select设置初始值的方法)》该内容的真实性请自行鉴别。