关于layui分页

前端之家收集整理的这篇文章主要介绍了关于layui分页前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

 

1.封装通用layUI分页table绑定

分享图片

2.Mapper里的方法

分享图片

3.Mapper.xml 里的处理

<!-- 查询所有信息 -->
<resultMap type="cn.itcast.ssm.po.CompanyCustom" id="selectA"
autoMapping="true">
<id column="cids" property="cids" />

<!-- 多对一 -->
<association property="positiontypeCustom"
javaType="cn.itcast.ssm.po.PositiontypeCustom" autoMapping="true">
<id column="tid" property="tid" />
</association>
</resultMap>
<!-- 查询所有信息 -->
<select id="select" resultMap="selectA">
select
c.cids,c.coid,c.compayname,c.ctel,c.caddress,c.cregisttime,c.isregister,c.cemail,p.tid,p.tname
from company c INNER JOIN positiontype p on c.coid=p.tid where 1=1
<if test="compayname!=null and compayname!=‘‘">
and compayname like ‘%${compayname}%‘
</if>
<if test="caddress != null and caddress != ‘‘">
and caddress like ‘%${caddress}%‘
</if>
limit #{page},#{limit}
</select>
<!-- 查询总条数 -->
<select id="count" resultType="int">
select count(*) from company where 1=1
<if test="compayname!=null and compayname!=‘‘">
and compayname like ‘%${compayname}%‘
</if>
<if test="caddress != null and caddress != ‘‘">
and caddress like ‘%${caddress}%‘
</if>
</select>

 

分享图片

分享图片

分享图片

Service 层

分享图片

Impl层

分享图片

Controller 层的处理

分享图片

 

 最后页面+加上模糊查询

分享图片

 

分享图片

分享图片

 

 完结。

猜你在找的XML相关文章