网站建设资讯

NEWS

网站建设资讯

如何进行Mapper多表关联查询

这期内容当中小编将会给大家带来有关如何进行Mapper多表关联查询,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。

在双河等地区,都构建了全面的区域性战略布局,加强发展的系统性、市场前瞻性、产品创新能力,以专注、极致的服务理念,为客户提供网站设计制作、成都网站设计 网站设计制作按需定制网站,公司网站建设,企业网站建设,品牌网站制作,网络营销推广,成都外贸网站制作,双河网站建设费用合理。

1、首先写sql语句

select p.id, p.create_time, p.update_time, p.create_user, p.update_user, p.project_name, p.test_user, 
    p.dev_user, p.simple_desc, p.other_desc, p.project_code, p.belong_env_id, p.status_id,u.status_name,u.description from projectinfo_temp p LEFT JOIN usestatus u on p.status_id = u.id

2、关联pojo

@ToString
public class ProjectinfoTemp {

    private Integer id;

    private Date createTime;

    private Date updateTime;

    private String createUser;

    private String updateUser;

    private String projectName;

    private String testUser;

    private String devUser;

    private String simpleDesc;

    private String otherDesc;

    private String projectCode;

    private Integer belongEnvId;

    private Integer statusId;
    /**
     *  关联状态表 激活状态
     */
    private Usestatus usestatus;

状态表

/**
 *
 * @author liwen406
 * @date 2019-04-21 09:12
 */
@ToString
public class Usestatus {
    private Integer id;

    private String statusName;

    private String description;

3编写关联sql语句

模仿写法

<sql id="WithBase_Column_List" >
p.id, p.create_time, p.update_time, p.create_user, p.update_user, p.project_name, p.test_user,
p.dev_user, p.simple_desc, p.other_desc, p.project_code, p.belong_env_id, p.status_id,u.status_name,u.description
</sql>

    select
    
      distinct
    
    
    from projectinfo_temp
    
      
    
    
      order by ${orderByClause}
    
  

  
    select
    
      distinct
    
    
    from projectinfo_temp p LEFT JOIN usestatus u on p.status_id = u.id
    
      
    
    
      order by ${orderByClause}
    
  

4前端调用写法


                                
                                    
                                    
                                        应用编号
                                        应用名称
                                        测试负责人
                                        开发负责人
                                        模块/接口/用例
                                        状态
                                        操作
                                    
                                    
                                    
                                    
                                        
                                        
                                        
                                        
                                        
                                        
                                        
                                            运行
                                            编辑
                                            删除
                                        
                                    
                                    
                                
                                
                                    
                                        
                                            ,
                                            
                                            
                                        
                                    
                                                                                                                          
  • [首 页]
  •                                             
  • [上一页]                                             
  •                                             
  • [下一页]                                             
  •                                             
  • [尾 页]
  •                                                                              
                                    
                                

    5、访问结果显示

    如何进行Mapper多表关联查询

    上述就是小编为大家分享的如何进行Mapper多表关联查询了,如果刚好有类似的疑惑,不妨参照上述分析进行理解。如果想知道更多相关知识,欢迎关注创新互联行业资讯频道。


    网站题目:如何进行Mapper多表关联查询
    文章链接:http://cdweb.net/article/ipseje.html

    其他资讯