岗位配置模糊查询分页

This commit is contained in:
zhaokaiyao@91isoft.com
2021-10-19 16:49:48 +08:00
parent 6b914c1430
commit 4d1876b8c4
3 changed files with 26 additions and 2 deletions
@@ -57,6 +57,14 @@ public interface TsPositionDao extends BaseMapper<TsPosition> {
*/
List<TsPosition> selectPositionAndRole(TsPosition tsPosition);
/**
* 总数
* @param tsPosition
* @return
*/
Integer countPositionAndRole(TsPosition tsPosition);
/**
* 通过岗位列表查询绑定的角色列表
* @param positionIds:岗位列表
@@ -44,9 +44,10 @@ public class TsPositionServiceImpl extends ServiceImpl<TsPositionDao, TsPosition
@Override
public IPage<TsPosition> getPosition(TsPosition tsPosition) {
IPage page=new Page();
page.setTotal(tsPositionDao.pageTotal());
// page.setTotal(tsPositionDao.pageTotal());
page.setTotal(tsPositionDao.countPositionAndRole(tsPosition));
page.setRecords(tsPositionDao.selectPositionAndRole(tsPosition));
page.setTotal(page.getTotal());
page.setCurrent(tsPosition.getCurrent());
page.setSize(tsPosition.getPageSize());
System.out.println(page.getTotal());
@@ -31,12 +31,27 @@
<if test="name!=null">
p.name like concat(concat('%',#{name}),'%')
</if>
order by locate(#{name},p.name)
</where>
<if test=" null!= pageSize ">
limit ${(current-1) * pageSize},${pageSize}
</if>
</select>
<select id="countPositionAndRole" resultType="java.lang.Integer">
select count(1) from ts_position p
left join ts_position_role pr
on p.id=pr.position_id
left join ts_role r
on pr.role_id=r.id
<where>
<if test="name!=null">
p.name like concat(concat('%',#{name}),'%')
</if>
</where>
</select>
<select id="pageTotal" resultType="Long">
select count(1) as total from ts_position
</select>