提交 d274e217 编写于 作者: cxt104926's avatar cxt104926

bug

上级 cfeba5a7
......@@ -3,6 +3,7 @@ package com.stu.stusystem.mapper.system;
import com.stu.stusystem.common.CommonMapper;
import com.stu.stusystem.model.system.Menu;
import com.stu.stusystem.service.system.vo.MenuVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
......@@ -14,4 +15,6 @@ import java.util.List;
public interface MenuMapper extends CommonMapper<Menu> {
@Select("select id,icon_img as iconImg,url,name,pid,order_num as orderNum,menu_type as menuType from menu where is_visible = true")
List<MenuVO> getTreeMenu();
List<MenuVO> getMenuPage(@Param("name") String name);
}
......@@ -35,14 +35,7 @@ public class MenuService {
*/
public PageInfo<MenuVO> getMenuPage(OffsetPage query, String name) {
PageHelper.startPage(query.getPage(), query.getLimit());
Example example = new Example(Menu.class);
Example.Criteria criteria = example.createCriteria();
if (name != null) {
criteria.andEqualTo("name", name);
}
example.orderBy("id").asc();
List<Menu> menus = this.menuMapper.selectByExample(example);
List<MenuVO> menuVOS = CopyBeanUtil.copyList(menus, MenuVO.class);
List<MenuVO> menuVOS = this.menuMapper.getMenuPage(name);
return new PageInfo<>(menuVOS);
}
......
......@@ -30,6 +30,9 @@ public class MenuVO {
@ApiModelProperty("父级id")
private String pid;
@ApiModelProperty("父级名称")
private String pName;
@ApiModelProperty("菜单类型(M:目录,C:菜单,B:按钮)")
private String menuType;
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.stu.stusystem.mapper.system.MenuMapper">
<select id="getMenuPage" resultType="com.stu.stusystem.service.system.vo.MenuVO">
SELECT m.id,
m.icon_img AS iconImg,
m.name,
m.url,
m.code,
m.pid,
p.name AS pName,
m.menu_type AS menuType,
m.is_visible AS isVisible,
m.order_num AS orderNum
FROM menu m
left join menu p on p.pid = m.id
<where>
<if test="name != null and name != ''">
m.name = #{name}
</if>
</where>
order by id ASC
</select>
</mapper>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册