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

郑州好的网站建设公司哪家好2022免费永久服务器

郑州好的网站建设公司哪家好,2022免费永久服务器,wordpress左边导航栏,新加坡二手手机网站大全1.Mybatis多表查询 1.1一对一查询 1.一对一查询的模型 用户表和订单表的关系为#xff0c;一个用户有多个订单#xff0c;一个订单只从属于一个用户 一对一查询的需求#xff1a;查询一个订单#xff0c;与此同时查询出该订单所属的用户2.创建Order和User实体public class…1.Mybatis多表查询 1.1一对一查询 1.一对一查询的模型 用户表和订单表的关系为一个用户有多个订单一个订单只从属于一个用户 一对一查询的需求查询一个订单与此同时查询出该订单所属的用户2.创建Order和User实体public class Order {         private int id;         private Date ordertime;         private double total;         //代表当前订单从属于哪一个客户         private User user; } public class User {         private int id;         private String username;         private String password;         private Date birthday; } 3.创建OrderMapp接口 public interface OrderMapper {         ListOrder findAll(); } 4.配置OrderMapper.xml mapper namespacecom.lin.mapper.OrderMapperresultMap idorderMap typeorder!--手动指定字段与实体属性的映射关系column表明字段property实体属性--id columnoid propertyid/idresult columnordertime propertyordertime/resultresult columntotal propertytotal/resultresult columnuid propertyuser.id/result!--result columnusername propertyuser.username/resultresult columnpassword propertyuser.password/resultresult columnbirthday propertyuser.birthday/result--!--property:当前实体属性order的属性名称javaType当前实体order中的属性类名称--association propertyuser javaTypeuserid columnuid propertyid/idresult columnusername propertyusername/resultresult columnpassword propertypassword/resultresult columnbirthday propertybirthday/result/association/resultMapselect idfindAll resultMaporderMapSELECT *,o.id oid FROM orders o,USER u WHERE o.uidu.id/select /mapper 1.2 一对多查询 1.一对多查询的模型 用户表和订单表的关系为一个用户有多个订单一个订单只从属于一个用户 一对多查询的需求查询一个用户与此同时查询出该用户具有的订单2.修改User实体public class Order {         private int id;         private Date ordertime;         private double total;         //代表当前订单从属于哪一个客户         private User user; } public class User {         private int id;         private String username;         private String password;         private Date birthday;         //代表当前用户具备哪些订单         private ListOrder orderList; } 4.创建UserMapper接口 public interface UserMapper {         ListUser findAll(); } 5.配置UserMapper.xml mapper namespacecom.lin.mapper.UserMapperresultMap idresultMap typeuserid columnuid propertyid/idresult columnusername propertyusername/resultresult columnpassword propertypassword/resultresult columnbirthday propertybirthday/result!--配置集合信息property:集合名称ofType: 代表当前集合的数据类型--collection propertyorderList ofTypeorderid columnoid propertyid/idresult columntotal propertytotal/resultresult columnordertime propertyordertime/result/collection/resultMapselect idfindAll resultMapresultMapSELECT*,o.id oid FROM orders o,USER u WHERE u.ido.uid/select/mapper 1.3 多对多查询 1.多对多查询的模型 用户表和角色表的关系为一个用户有多个角色一个角色被多个用户使用 多对多查询的需求查询用户同时查询出该用户的所有角色2.创建Role实体修改User实体public class User {         private int id;         private String username;         private String password;         private Date birthday;          //代表当前用户具备哪些订单         private ListOrder orderList;         //代表当前用户具备哪些角色         private ListRole roleList; } public class Role {         private int id;         private String rolename; } 3.添加UserMapper接口方法 ListUser findAllUserAndRole(); 5.配置UserMapper.xml ?xml version1.0 encodingUTF-8 ? !DOCTYPE mapper PUBLIC -//mybatis.org//DTD Mapper 3.0//EN http://mybatis.org/dtd/mybatis-3-mapper.dtd mapper namespacecom.lin.mapper.UserMapperresultMap iduserRoleMap typeuser!--封装user的信息--id columnuserid propertyid/idresult columnbirthday propertybirthday/resultresult columnusername propertyusername/resultresult columnpassword propertypassword/result!--封装roleList的信息--collection propertyroleList ofTypeRoleid columnroleid propertyid/idresult columnrolename propertyroleName/resultresult columnroleDesc propertyroleDesc/result/collection/resultMapselect idfindUserAndRoles resultMapuserRoleMapSELECT*FROM user u,sys_user_role ur,sys_role r WHERE u.idur.userid AND ur.roleidr.id/select /mapper
http://www.hkea.cn/news/14364220/

相关文章:

  • 营销型网站建设的认识海纳企业网站管理系统
  • 手机网站架构ref.so wordpress
  • 杭州房产网站建设分销平台门店端
  • 个人网站如何赚钱欧美普货专线是快递吗
  • 从零开始学手机网站开发教程微站和网站数据同步
  • 青海省高速公路建设管理局网站建筑工程总承包合同范本
  • 网站建设的目入图片wordpress网站收录
  • 网站销售如何做业绩可作外链的网站
  • 微企点做网站视频做外贸最好的网站有哪些
  • 慈溪网站开发网页设计难学吗
  • 快速网站制作django和WordPress哪个好
  • 网站策划步骤教做世界美食的网站
  • 赣州行业网站建设电子商务网站功能设计与分析
  • 自贡网站建设哪家好html可以做网站后台吗
  • WordPress站点添加ssl证书seo博客网站
  • 咸阳网站建设公司seo查询工具
  • 手机网站建设ppt管廊建设网站
  • 嘉兴网站建设低价推荐建立一个属于自己的网站
  • 佛山外贸网站设计公司石家庄铁路职业技工学校
  • 个人网站模板制作教程建筑之家
  • 网站中做背景图片位置咋写医药加盟网站模板
  • 苏州网站维护厦门企业网站建设专家
  • 济南专业网站优化网站的功能定位
  • 网站维护报价表免费购物网站源码
  • 网站建设的意见征集焊工培训
  • 共享vps可以做网站吗酒店类的电影网站模板
  • 网站制作计算机怎么做淘宝店网站收录
  • 网站搭建教学网建设网站花都
  • 怎么自己编写网站在虚拟机做网站
  • 我被朋友拉进彩票网站说做代理转行做网站