文章目录
前言
当需要进行多表查询时,Mybatis-Plus是无法实现的,这里提供一种Mybatis+Mybatis-Plus方式。
需要查询企业表单部分信息+运营状态+企业分类。
企业(Enterprise)与运营状态为一对一关系,企业与企业分类(Category)是多对多关系
实体类
企业类的VO:
@Data
public class EnterpriseVo {
private List<Category> category;
private String operateStatus;
private Integer id;
private String name;
private Integer regionId;
private String address;
private Integer registerCapital;
private LocalDate establishDate;
private String businessScope;
private String phone;
private String logoUrl;
private Integer enterpriseUserId;
private Integer pushStatus;
private String featureProduct;
private String advantageAnalysis;
private Integer privacySetting;
private Integer operateStatusId;
private String socialCode;
private String licenseUrl;
private String legalPersonCardUrl;
private String letterUrl;
private String manager;
private String legalPerson;
private String legalPersonPhone;
private Integer auditStatus;
private String rejectionReason;
private LocalDateTime auditTime;
private LocalDateTime updateTime;
private LocalDateTime createTime;
private LocalDateTime createTimeBegin;
private LocalDateTime createTimeEnd;
private Boolean deleteFlag;
private String videoUrl;
企业分类:
@Data
public class Category {
private Integer id;
private String name;
}
企业与企业分类的关系表
EnterpriseMapper文件
EnterpriseMapper.xml文件
CategoryMapper文件
CategoryMapper.xml文件
EnterpriseService文件
EnterpriseServiceImpl文件
EnterpriseController
后台查询结果:
将查询到的每个企业的所有企业分类存到List中。
本文含有隐藏内容,请 开通VIP 后查看