mapper.xml速查
1.Delete
1 <?xml version="1.0" encoding="UTF-8"?> 2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 3 "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> 4 <mapper namespace="com.cy.pj.sys.dao.SysRoleMenuDao"> 5 <delete id="deleteObjectsByMenuId" 6 parameterType="int"> 7 delete from sys_role_menus 8 where menu_id=#{menuId} 9 </delete> 10 </mapper>
1 @Delete("delete from sys_role_menus where menu_id=#{menuId}") 2 int deleteObjectsByMenuId(Integer menuId);
2.select
1 <select id="getChildCount" 2 parameterType="int" 3 resultType="int"> 4 select count(*) 5 from sys_menus 6 where parentId=#{id} 7 </select> 8 9 <select id="findZtreeMenuNodes" resultType="com.cy.pj.common.vo.Node"> 10 select id,name,parentId 11 from sys_menus 12 </select>
3.insert
1 <insert id="insertObject" 2 parameterType="com.cy.pj.sys.entity.SysMenu"> 3 insert into sys_menus 4 (name,url,type,sort,note,parentId,permission,createdTime,modifiedTime,createdUser,modifiedUser) 5 values 6 (#{name},#{url},#{type},#{sort},#{note},#{parentId},#{permission},now(),now(),#{createdUser},#{modifiedUser}) 7 </insert>