当前位置: 首页 > news >正文

用asp做网站有哪些功能兰州百度推广的公司

用asp做网站有哪些功能,兰州百度推广的公司,西安seo,快照关键词优化代码下载 解决字段名与属性名不一致 ①使用别名emp_name empName解决字段名和属性名不一致 <select id"getAllEmpOld" resultType"Emp"><!--①使用别名emp_name empName解决字段名和属性名不一致-->select eid,emp_name empName,age,sex,em…

代码下载

解决字段名与属性名不一致
  • ①使用别名emp_name empName解决字段名和属性名不一致
<select id="getAllEmpOld" resultType="Emp"><!--①使用别名emp_name empName解决字段名和属性名不一致-->select eid,emp_name empName,age,sex,email from t_emp;</select>
  • ②在全局配置文件中添加全局配置
<settings><!-- 将_自动映射为驼峰,emp_name:empName--><setting name="mapUnderscoreToCamelCase" value="true"/></settings>
  • ③使用resultMap
<!--resultMap:设置自定义映射关系id:唯一标识type:设置映射关系中的实体类类型id:设置主键属性:property:设置映射关系中的属性名,必须是type属性所设置的实体类类型中的属性名column:设置映射关系中的字段名,必须是SQL语句查询出的字段名--><resultMap id="empResultMap" type="Emp"><id property="eid" column="eid"/><id property="empName" column="emp_name"/><id property="age" column="age"/><id property="sex" column="sex"/><id property="email" column="email"/></resultMap><!--③使用resultMap解决字段名和属性名不一致--><select id="getAllEmp" resultMap="empResultMap">select * from t_emp;</select>
多对一映射关系
  • ①级联属性赋值
 <resultMap id="empAndDeptResultMapOne" type="Emp"><id property="eid" column="eid"/><id property="empName" column="emp_name"/><id property="age" column="age"/><id property="sex" column="sex"/><id property="email" column="email"/><id property="dept.did" column="did"/><id property="dept.deptName" column="dept_name"/></resultMap><!--Emp getEmpAndDept(@Param("eid") Integer eid);--><select id="getEmpAndDept" resultMap="empAndDeptResultMapOne">select * from t_emp left join t_dept on t_emp.did = t_dept.did where t_emp.eid=#{eid}</select>
  • ②使用association
<resultMap id="empAndDeptResultMapTwo" type="Emp"><id property="eid" column="eid"/><id property="empName" column="emp_name"/><id property="age" column="age"/><id property="sex" column="sex"/><id property="email" column="email"/><!-- association:处理多对一的映射关系javaType:该属性的类型--><association property="dept" javaType="Dept"><id property="did" column="did"/><id property="deptName" column="dept_name"/></association></resultMap><!--Emp getEmpAndDept(@Param("eid") Integer eid);--><select id="getEmpAndDept" resultMap="empAndDeptResultMapTwo">select * from t_emp left join t_dept on t_emp.did = t_dept.did where t_emp.eid=#{eid}</select>
<mapper namespace="com.lotus.mybatis.mapper.DeptMapper"><!--Dept getEmpAndDeptByStepTwo(@Param("did") Integer did);--><select id="getEmpAndDeptByStepTwo" resultType="Dept">select * from t_dept where did=#{did}</select>
</mapper>
  • ③分步查询
<resultMap id="empAndDeptByStepResultMap" type="Emp"><id property="eid" column="eid"/><id property="empName" column="emp_name"/><id property="age" column="age"/><id property="sex" column="sex"/><id property="email" column="email"/><!--select:设置分步查询的SQL唯一标识(namespace,SQLID或mapper接口的全类名.方法名)column:设置分步查询的条件fetchType(eager|lazy):当开启全局延迟加载后,通过此属性手动控制延迟加载的效果,eager表示立即加载--><association property="dept" select="com.lotus.mybatis.mapper.DeptMapper.getEmpAndDeptByStepTwo"column="did" fetchType="eager"></association></resultMap><!-- Emp getEmpAndDeptByStepOne(); --><select id="getEmpAndDeptByStepOne" resultMap="empAndDeptByStepResultMap">select * from t_emp where eid=#{eid}</select>
public interface EmpMapper {
/*** 通过分步查询查询员工以及员工所对应部门信息* 第一步,查询员工信息*/Emp getEmpAndDeptByStepOne(@Param("eid") Integer eid);}public interface DeptMapper {/*** 通过分步查询查询员工以及员工所对应部门信息* 第一步,通过did查询员工对应的部门信息*/Dept getEmpAndDeptByStepTwo(@Param("did") Integer did);
}
一对多映射关系
  • ①使用collection标签
 <resultMap id="deptAndEmpResultMap" type="Dept"><id property="did" column="did"/><id property="deptName" column="dept_name"/><collection property="emps" ofType="Emp"><id property="eid" column="eid"/><id property="empName" column="emp_name"/><id property="age" column="age"/><id property="sex" column="sex"/><id property="email" column="email"/></collection></resultMap><!--Dept getDeptAndEmp(@Param("did") Integer did);--><select id="getDeptAndEmp" resultMap="deptAndEmpResultMap">select * from t_dept left join t_emp on t_dept.did = t_emp.did where t_dept.did=#{did}</select>
/*** 获取部门及部门中所有员工信息*/Dept getDeptAndEmp(@Param("did") Integer did);
//测试代码@Testpublic void testGetDeptAndEmp() {SqlSession sqlSession = SqlSessionUtils.getSqlSession();DeptMapper mapper = sqlSession.getMapper(DeptMapper.class);Dept dept = mapper.getDeptAndEmp(1);System.out.println(dept);}
  • ②使用分步查询
<!---DeptMapper.xml>
<resultMap id="deptAndEmpByStepResultMap" type="Dept"><id property="did" column="did"/><result property="deptName" column="dept_name"/><collection property="emps"select="com.lotus.mybatis.mapper.EmpMapper.getDeptAndEmpByStepTwo"column="did"></collection></resultMap><!--Dept getDeptAndEmpByStepOne(@Param("did") Integer did);--><select id="getDeptAndEmpByStepOne" resultMap="deptAndEmpByStepResultMap">select * from t_dept where did=#{did}</select>
<!-- EmpMapper.xml -->
<!--List<Emp> getDeptAndEmpByStepTwo(@Param("did") Integer did);--><select id="getDeptAndEmpByStepTwo" resultType="Emp">select * from t_emp where did=#{did}</select>
//----DeptMapper
/*** 分步查询①查询部门信息*/Dept getDeptAndEmpByStepOne(@Param("did") Integer did);
//----EmpMapper
/*** 分步查询②根据did查询员工信息*/
List<Emp> getDeptAndEmpByStepTwo(@Param("did") Integer did);//测试代码@Testpublic void testGetDeptAndEmpStep() {SqlSession sqlSession = SqlSessionUtils.getSqlSession();DeptMapper mapper = sqlSession.getMapper(DeptMapper.class);Dept dept = mapper.getDeptAndEmpByStepOne(1);System.out.println(dept);}
http://www.tj-hxxt.cn/news/100878.html

相关文章:

  • 公司做网站哪个公司做得好网站建设制作教程
  • 上海跨境电商网站制作淘宝指数查询官网手机版
  • 天津网络优化网站建设企业邮箱登录
  • 免费做公司手机网站html网页制作成品
  • 服务范围 网站建设公司关键词优化哪家强
  • 自己建网站做微商seo搜索引擎优化工资多少钱
  • 东莞网站建设公司怎么做微信上怎么做广告推广
  • 网站有访问量 为什么没有询盘seo实战培训学校
  • 大学生网站模板互联网推广好做吗
  • 网站开发年薪网站点击快速排名
  • wordpress添加分类筛选手表百度seo优化关键词
  • 网站在线客服代码百度推广开户多少钱一个月
  • 营口做网站的公司网站搜索排名优化怎么做
  • 留坝政府网站建设关键词排名查询工具有哪些
  • 山东广疫情况长沙seo培训
  • 视频背景网站seo建站公司
  • 上海专业网站建设费营销软文是什么
  • 网站动画效果怎么做的steam交易链接是什么
  • php做网站评价网站推广及seo方案
  • 郑州酒店网站建设爱站网站
  • 苏州市住房和城乡建设局政务网站seo推广公司哪家好
  • wordpress商城安装教程李江seo
  • 长春网络建站模板跨境网站建站
  • 企业网站属于哪种网站类型互联网营销师在哪里报名
  • 通用模板做的网站不收录4p营销理论
  • 电影网站怎么做友情链接营销推广主要包括
  • 网页模板网站生成seo高手是怎样炼成的
  • 中山做app网站公司哪家好自己怎么建网站
  • 广西城乡建设局和住建局官网图片优化
  • 网站建设新手市场营销推广方案