mapper层
IPage<TenantAuditVO>TenantAuditSelectPage(@Param("page")IPage<TenantAuditVO>page, @Param("dto") TenantAuditPageDTO auditPageDTO);
service层
public PageResult<TenantAuditVO> getTenantAuditPage(TenantAuditPageDTO auditPageDTO) {
Page<TenantAuditVO> page = MyBatisUtils.buildPage(auditPageDTO);
IPage<TenantAuditVO> iPage = tenantMapper.TenantAuditSelectPage(page, auditPageDTO);
PageResult<TenantAuditVO>pageResult=new PageResult<>();
pageResult.setTotal(iPage.getTotal());
pageResult.setList(iPage.getRecords());
return pageResult;
xml文件
<select id="TenantAuditSelectPage" resultType="com.hainancrc.module.openplatform.api.tenant.vo.TenantAuditVO">
select t.tenant_account,t.company_name,
t.tenant_name,phone_number,t.create_time,a.audit_status
from tenant t,audit_order a
<where>
<if test="dto.tenantName!=null">
tenant_name like concat('%',#{dto.tenantName},'%')
</if>
<if test="dto.companyName!=null">
and company_name like concat('%',#{dto.companyName},'%')
</if>
<if test="dto.createTime!=null">
and create_time=#{dto.createTime}
</if>
<if test="dto.auditStatus!=null">
and audit_status=#{dto.auditStatus}
</if>
and t.id=a.audit_related_id
</where>
</select>