RoleMapper.java 758 Bytes
package com.uccc.admin.mapper;

import com.uccc.pretty.common.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;

/**
 * Created by bert on 2021-09-13 22:23
 */
public interface RoleMapper {
    static final String TABLE_NAME_1 = "user_role";

    @Insert({
            "<script>",
            "insert into user_role (",
            "role_id, user_id, cts, uts ) values (",
            "#{roleId}, #{userId}, now(), now() )",
            "</script>",
    })
    int createUserRole(@Param("userId") Long userId, @Param("roleId") int roleId);

    @Delete("delete from " + TABLE_NAME_1 + " where user_id = #{user.id}")
    int deleteUserRole(@Param("user") User user);
}