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

建设银行面试通知网站优化大师win7

建设银行面试通知网站,优化大师win7,asp网站收录后换成php网站转向链接 要注意什么,开发建设网站这篇需结合 Mybatis XML 配置文件那一篇博客一起看 工作中尽量避免使用多表查询,尤其是对性能要求非常高的项目 我们之前建了个用户表(代码在Mybatis XML配置文件那篇博客里),这次再建一个文章表,代码如下 : -- 创建⽂章表 DROP TABLE IF EXISTS articleinf…这篇需结合 Mybatis XML 配置文件那一篇博客一起看 工作中尽量避免使用多表查询,尤其是对性能要求非常高的项目 我们之前建了个用户表(代码在Mybatis XML配置文件那篇博客里),这次再建一个文章表,代码如下 : -- 创建⽂章表 DROP TABLE IF EXISTS articleinfo; CREATE TABLE articleinfo (id INT PRIMARY KEY auto_increment,title VARCHAR ( 100 ) NOT NULL,content TEXT NOT NULL,uid INT NOT NULL,delete_flag TINYINT ( 4 ) DEFAULT 0 COMMENT 0-正常, 1-删除,create_time DATETIME DEFAULT now(),update_time DATETIME DEFAULT now() ) DEFAULT charset utf8mb4; -- 插⼊测试数据 INSERT INTO articleinfo ( title, content, uid ) VALUES( Java, Java正⽂, 1 ); 如何根据文章ID,获取作者的名字和年龄呢?( ta 是表 articleInfo , tb 是表 userinfo ) select ta.*,tb.username,tb.age from articleinfo ta left join userinfo tb on ta.uid tb.id where ta.id 1; 这样就能拿到文章 id 为1的作者的相关信息了 接下来我们就要跟java联系起来了 先创建一个 java 类,写与 articleinfo 表的字段一一映射的java对象 package com.example.mybatisdemo.model;import lombok.Data;import java.util.Date;Data public class ArticleInfo {//文章相关信息private Integer id;private String title;private String content;private Integer uid;private Integer deleteFlag;private Date createTime;private Date updateTime; } 然后再创建一个接口,名为ArticleInfoMapper package com.example.mybatisdemo.mapper;import com.example.mybatisdemo.model.ArticleInfo; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Select;Mapper public interface ArticleInfoMapper {Select( select ta.*,tb.username,tb.age from articleinfo ta left join userinfo tb on ta.uid tb.id where ta.id #{id})ArticleInfo selectArticleAndUserById(Integer articleId);} 然后右键,Generate,test,勾选 selectArticleAndUserById ,ok,补充代码 package com.example.mybatisdemo.mapper;import com.example.mybatisdemo.model.ArticleInfo; import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest;import static org.junit.jupiter.api.Assertions.*;Slf4j SpringBootTest class ArticleInfoMapperTest {Autowiredprivate ArticleInfoMapper articleInfoMapper;Testvoid selectArticleAndUserById() {ArticleInfo articleInfo articleInfoMapper.selectArticleAndUserById(1);log.info(articleInfo.toString());} } 成功  但是因为 ArticleInfo 并没有 username 和 age ,所以返回对象为 ArticleInfo 的时候是无法返回 username 和 age 的 所以我们就需要在类 ArticleInfo 里面添加 username 和 age package com.example.mybatisdemo.model; import lombok.Data; import java.util.Date; Data public class ArticleInfo {//文章相关信息private Integer id;private String title;private String content;private Integer uid;private Integer deleteFlag;private Date createTime;private Date updateTime;//用户相关信息private String username;private Integer age; } 再次运行就能拿到 username 和 age 了
http://www.huolong8.cn/news/211708/

相关文章:

  • 上海网站建设设计公司排名网络排名优化软件
  • 如何自己建一个公司网站松江建网站
  • 网站虚拟主机里的内容强制删除施工企业主要负责人对安全生产的
  • 杭州网站seo如何在手机上制作动画
  • 网络建站流程网站设计好后如何发布
  • 企业网站建站企业属于网站建设过程规划和准备阶段的是
  • 公司网站建设调研背景济南外贸建站
  • 大通证券手机版下载官方网站下载怎样做支付网站
  • 怎样给网站做超链接重庆企业网站建设公司
  • 网站域名去哪买wordpress pdf阅读
  • 加强网站建设 实施政务公开设计师网站十大网站
  • 网站建设如何盈利中铁韩城建设公司网站
  • 网站搭建费用企业网站的功能有哪些
  • 漯河公司做网站网站推广策略的控制和效果评价
  • 中国诚信建设网站怎么写代码做网站
  • 教做视频的网站江苏中兴建设有限公司网站
  • 长沙企业网站建设服务常见的cms网站程序有哪些
  • 出名的网站建设软件wordpress 按钮美化
  • 王店镇建设中学网站看小视频的浏览器有哪些
  • 网站模板制作教程济宁专业网站建设
  • 网站幻灯软件技术好就业吗
  • 做网站包括什么关键词优化包年推广
  • 怎么美化网站网站建设需求方案文档
  • 专门做面包和蛋糕的网站重庆怎么做平台软件
  • 石龙东莞网站建设新手seo入门教程
  • 做网站如何买量东莞网站制作搭建
  • 黑龙江生产建设兵团知识网站手机app开发工具下载
  • 手表网站排名186信息网河北网站建设服务
  • 网站建设与实训wordpress基础版
  • 学校网站建设调研报告wordpress html调用php