mybatis.mapper.s_sys_user_role.xml Maven / Gradle / Ivy
<?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"> <!-- Automatic generated on 2023-09-06 19:11:12 by CrudCodeGenerator wirtten by Gerald Chen --> <mapper namespace="com.github.javaclub.base.mapper.UserRoleMapper"> <resultMap type="com.github.javaclub.base.domain.UserRole" id="userRoleMap"> <result property="id" column="id" /> <result property="userId" column="user_id" /> <result property="roleId" column="role_id" /> <result property="createdTime" column="created_time" /> <result property="modifiedTime" column="modified_time" /> </resultMap> <sql id="Base_Column_List"> id, user_id, role_id, created_time, modified_time </sql> <delete id="deleteBatch"> delete from s_sys_user_role where role_id in <foreach item="roleId" collection="roleIds" open="(" separator="," close=")"> #{roleId} </foreach> </delete> <delete id="deleteByUserId"> delete from s_sys_user_role where user_id = #{userId} </delete> <insert id="insertUserAndUserRole"> insert into s_sys_user_role (user_id,role_id,creator_id) values <foreach collection="roleIdList" item="roleId" separator=","> (#{userId},#{roleId},#{creatorId}) </foreach> </insert> </mapper>