<?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.ycwl.basic.mapper.PermissionMapper">
    <!-- 新增插入语句 -->
    <insert id="insertPermission">
        INSERT INTO account_permission (user_id, perm_str, menu_str, create_time, update_time)
        VALUES (#{userId}, #{permString}, #{menuString}, NOW(), NOW())
    </insert>

    <!-- 新增更新语句 -->
    <update id="updatePermission">
        UPDATE account_permission
        SET perm_str = #{permString}, menu_str = #{menuString}, update_time = NOW()
        WHERE user_id = #{userId}
    </update>
    <select id="selectByUserId" resultType="com.ycwl.basic.model.pc.permission.entity.PermissionEntity">
        SELECT id, user_id, perm_str as permString, menu_str as menuString, create_time, update_time
        FROM account_permission
        WHERE user_id = #{userId}
        limit 1
    </select>
</mapper>