liurunyu
2023-11-07 4ef44fad498ddfb2b157d6c74c515e4041ee71ea
增加角色Role、权限Privilege及他们关系实体,实体Mapper等内容
1 文件已重命名
7个文件已添加
8个文件已修改
1个文件已删除
527 ■■■■ 已修改文件
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaPrivilegeMapper.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaRoleMapper.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaRolePrivilegeMapper.java 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaUserMapper.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaUserRoleMapper.java 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaPrivilege.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaRole.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaRolePriviledge.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaRolePrivilege.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaUser.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaUserRole.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaPrivilegeMapper.xml 89 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaRoleMapper.xml 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaRolePrivilegeMapper.xml 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaUserMapper.xml 38 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaUserRoleMapper.xml 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/DemoRoleMapper.xml 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaPrivilegeMapper.java
New file
@@ -0,0 +1,43 @@
package com.dy.pipIrrGlobal.daoBa;
import com.dy.pipIrrGlobal.pojoBa.BaPrivilege;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface BaPrivilegeMapper extends com.baomidou.mybatisplus.core.mapper.Mapper<BaPrivilege> {
     /**
     * 查询全部
     * @return List<BaPrivilege>
     */
    List<BaPrivilege> selectAll() ;
    /**
     * 查询某个用户所隶属所有角色的所有权限
     * @param userId 用户ID
     * @return List<Integer>
     */
    List<Integer> selectPrivilegeByUserId(@Param("userId") Long userId) ;
    /**
     * 查询某个角色所隶属于该角色的所有权限
     * @param roleId 用户ID
     * @return List<Integer>
     */
    List<Integer> selectPrivilegeByRoleId(@Param("roleId") Long roleId) ;
    /**
     * insert record to table
     * @param record the record
     * @return insert count
     */
    int insert(BaPrivilege record);
    /**
     * insert record to table selective
     * @param record the record
     * @return insert count
     */
    int insertSelective(BaPrivilege record);
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaRoleMapper.java
@@ -2,6 +2,7 @@
import com.dy.pipIrrGlobal.pojoBa.BaRole;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -21,5 +22,16 @@
     */
    int insertSelective(BaRole record);
    List<BaRole> select() ;
    /**
     * 查询全部
     * @return List<BaRole>
     */
    List<BaRole> selectAll() ;
    /**
     * 查询某个用户所隶属于的角色
     * @param userId 用户ID
     * @return List<BaRole>
     */
    List<BaRole> selectByUserId(@Param("userId") Long userId) ;
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaRolePrivilegeMapper.java
New file
@@ -0,0 +1,46 @@
package com.dy.pipIrrGlobal.daoBa;
import com.dy.pipIrrGlobal.pojoBa.BaRolePrivilege;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface BaRolePrivilegeMapper {
    /**
     * insert record to table
     * @param record the record
     * @return insert count
     */
    int insert(BaRolePrivilege record);
    /**
     * insert record to table selective
     * @param record the record
     * @return insert count
     */
    int insertSelective(BaRolePrivilege record);
    /**
     * delete by primary key
     * @param roleId primaryKey
     * @param privilegeId primaryKey
     * @return deleteCount
     */
    int deleteByPrimaryKey(@Param("roleId") Long roleId, @Param("privilegeId") Long privilegeId);
    /**
     * delete by roleId
     * @param roleId 角色ID
     * @return deleteCount
     */
    int deleteByRoleId(@Param("roleId") Long roleId);
    /**
     * delete by roleId
     * @param privilegeId 权限ID
     * @return deleteCount
     */
    int deleteByPrivilegeId(@Param("privilegeId") Long privilegeId);
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaUserMapper.java
@@ -4,18 +4,14 @@
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
//public interface BaUserMapper extends com.baomidou.mybatisplus.core.mapper.Mapper<BaUser> {
//public interface BaUserMapper extends com.baomidou.mybatisplus.core.mapper.BaseMapper<BaUser> {
public interface BaUserMapper {
public interface BaUserMapper extends com.baomidou.mybatisplus.core.mapper.Mapper<BaUser> {
    /**
     * 用户登录
     * @param phone
     * @param password
     * @return
     * @param phone 手机号
     * @param password 密码
     * @return BaUser
     */
    BaUser login(@Param("phone") String phone, @Param("password") String password) ;
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaUserRoleMapper.java
New file
@@ -0,0 +1,45 @@
package com.dy.pipIrrGlobal.daoBa;
import com.dy.pipIrrGlobal.pojoBa.BaUserRole;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface BaUserRoleMapper {
    /**
     * insert record to table
     * @param record the record
     * @return insert count
     */
    int insert(BaUserRole record);
    /**
     * insert record to table selective
     * @param record the record
     * @return insert count
     */
    int insertSelective(BaUserRole record);
    /**
     * delete by primary key
     * @param userId primaryKey
     * @param roleId primaryKey
     * @return deleteCount
     */
    int deleteByPrimaryKey(@Param("userId") Long userId, @Param("roleId") Long roleId);
    /**
     * delete by primary key
     * @param userId primaryKey
     * @return deleteCount
     */
    int deleteByUserId(@Param("userId") Long userId);
    /**
     * delete by primary key
     * @param roleId primaryKey
     * @return deleteCount
     */
    int deleteByRoleId(@Param("roleId") Long roleId);
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaPrivilege.java
File was renamed from pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaPriviledge.java
@@ -14,7 +14,7 @@
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class BaPriviledge implements BaseEntity {
public class BaPrivilege implements BaseEntity {
    public static final long serialVersionUID = 202310211551001L;
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaRole.java
@@ -4,7 +4,6 @@
import com.alibaba.fastjson2.annotation.JSONField;
import com.alibaba.fastjson2.writer.ObjectWriterImplToString;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.dy.common.mybatis.envm.Deleted;
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaRolePriviledge.java
File was deleted
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaRolePrivilege.java
New file
@@ -0,0 +1,20 @@
package com.dy.pipIrrGlobal.pojoBa;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
@TableName(autoResultMap = true)
@Data
@Builder
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class BaRolePrivilege {
    public static final long serialVersionUID = 202311062027001L;
    public Long roleId;
    public Long privilegeId;
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaUser.java
@@ -8,11 +8,11 @@
import com.dy.common.po.BaseEntity;
import lombok.*;
import java.io.Serializable;
import java.util.List;
/**
 * @TableName(value = “a”, autoResultMap = true)
 * TableName(value = “a”, autoResultMap = true)
 * autoResultMap参数为true时,表明个别字段在查询处理的时候自动转换为对象,
 * 只适合设置了TypeHandler、jdbcTyped的情况。autoResultMap 自动映射,
 * 通常配合 @TableField() 一起使用,确定映射规范性。
@@ -66,7 +66,7 @@
    /**
     * 是否超级管理员 1:是,0:否
     */
    public Byte superAdmin;
    public Byte supperAdmin;
    /**
     * 是否禁用 0:否,1:是
@@ -77,4 +77,10 @@
     * 是否删除: 0表示未删除  1表示删除.
     */
    public Deleted deleted;
    /**
     * 用户所拥有的权限
     */
    @TableField(exist=false)
    public List<Integer> privileges;
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaUserRole.java
@@ -1,13 +1,7 @@
package com.dy.pipIrrGlobal.pojoBa;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.dy.common.po.BaseEntity;
import lombok.*;
import java.io.Serializable;
@TableName(autoResultMap = true)
@Data
@@ -15,13 +9,12 @@
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class BaUserRole implements BaseEntity {
public class BaUserRole {
    public static final long serialVersionUID = 202310211554001L;
    public static final long serialVersionUID = 202311061942001L;
    @TableId(value = "userId", type = IdType.INPUT)
    public Long userId ;
    private Long userId;
    @TableId(value = "roleId", type = IdType.INPUT)
    public Long roleId ;
}
    private Long roleId;
}
pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaPrivilegeMapper.xml
New file
@@ -0,0 +1,89 @@
<?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.dy.pipIrrGlobal.daoBa.BaPrivilegeMapper">
    <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoBa.BaPrivilege">
        <!--@mbg.generated-->
        <!--@Table ba_priviledge-->
        <result column="id" jdbcType="BIGINT" property="id" />
        <result column="num" jdbcType="INTEGER" property="num" />
        <result column="name" jdbcType="VARCHAR" property="name" />
        <result column="type" jdbcType="VARCHAR" property="type" />
    </resultMap>
    <sql id="Base_Column_List">
        <!--@mbg.generated-->
        id, num, name, type
    </sql>
    <select id="selectAll" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from ba_priviledge
    </select>
    <select id="selectPrivilegeByUserId" resultType="Integer">
        select p.num
        from ba_priviledge p
        inner join ba_role_privilege rp on p.id = rp.privilegeId
        inner join ba_user_role ur on rp.roleId = ur.roleId
        inner join ba_role r on ur.roleId = r.id
        where r.deleted != 1
        <if test="userId != null">
            and ur.userId = #{userId, jdbcType=BIGINT}
        </if>
    </select>
    <select id="selectPrivilegeByRoleId" resultType="Integer">
        select p.num
        from ba_priviledge p
        inner join ba_role_privilege rp on p.id = rp.privilegeId
        <if test="roleId != null">
            where rp.roleId = #{roleId, jdbcType=BIGINT}
        </if>
    </select>
    <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoBa.BaPrivilege">
        <!--@mbg.generated-->
        insert into ba_priviledge (id, num, name, type
        )
        values (#{id,jdbcType=BIGINT},
        #{num,jdbcType=INTEGER},
        #{name,jdbcType=VARCHAR},
        #{type, jdbcType=VARCHAR}
        )
    </insert>
    <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaPrivilege">
        <!--@mbg.generated-->
        insert into ba_priviledge
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                id,
            </if>
            <if test="num != null">
                id,
            </if>
            <if test="name != null">
                name,
            </if>
            <if test="type != null">
                type,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">
                #{id,jdbcType=BIGINT},
            </if>
            <if test="num != null">
                #{name,jdbcType=INTEGER},
            </if>
            <if test="name != null">
                #{name,jdbcType=VARCHAR},
            </if>
            <if test="type != null">
                #{type,jdbcType=VARCHAR},
            </if>
        </trim>
    </insert>
</mapper>
pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaRoleMapper.xml
@@ -1,24 +1,44 @@
<?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.dy.pipIrrGlobal.daoBa.BaRoleMapper">
  <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoBa.BaRole">
    <!--@mbg.generated-->
    <!--@Table ba_role-->
    <result column="id" jdbcType="BIGINT" property="id" />
    <result column="name" jdbcType="VARCHAR" property="name" />
    <result column="deleted" jdbcType="TINYINT" property="deleted" />
    <result property="deleted" column="deleted" typeHandler="com.dy.common.mybatis.envm.EnumCodeTypeHandler" javaType="com.dy.common.mybatis.envm.Deleted"/>
  </resultMap>
  <select id="select" resultMap="BaseResultMap">
    select *
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, name, deleted
  </sql>
  <select id="selectAll" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from ba_role
  </select>
  <select id="selectByUserId" resultMap="BaseResultMap">
    select <include refid="Base_Column_List" />
    from ba_role r
    inner join ba_user_role ur on r.id = ur.roleId
    where r.deleted != 1
    <if test="userId != null">
      and ur.userId = #{userId,jdbcType=BIGINT}
    </if>
  </select>
  <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoBa.BaRole">
    <!--@mbg.generated-->
    insert into ba_role (id, `name`, deleted
      )
    values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{deleted,jdbcType=TINYINT}
    values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{deleted, typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaRole">
    <!--@mbg.generated-->
    insert into ba_role
pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaRolePrivilegeMapper.xml
New file
@@ -0,0 +1,61 @@
<?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.dy.pipIrrGlobal.daoBa.BaRolePrivilegeMapper">
  <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoBa.BaRolePrivilege">
    <!--@mbg.generated-->
    <!--@Table ba_role_privilege-->
    <id column="roleId" jdbcType="BIGINT" property="roleId" />
    <id column="privilegeId" jdbcType="BIGINT" property="privilegeId" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    roleId, privilegeId
  </sql>
  <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoBa.BaRolePrivilege">
    <!--@mbg.generated-->
    insert into ba_role_privilege (roleId, privilegeId)
    values (#{roleId,jdbcType=BIGINT}, #{privilegeId,jdbcType=BIGINT})
  </insert>
  <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaRolePrivilege">
    <!--@mbg.generated-->
    insert into ba_role_privilege
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="roleId != null">
        roleId,
      </if>
      <if test="privilegeId != null">
        privilegeId,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="roleId != null">
        #{roleId,jdbcType=BIGINT},
      </if>
      <if test="privilegeId != null">
        #{privilegeId,jdbcType=BIGINT},
      </if>
    </trim>
  </insert>
  <delete id="deleteByPrimaryKey" parameterType="map">
    <!--@mbg.generated-->
    delete from ba_role_privilege
    where roleId = #{roleId,jdbcType=BIGINT}
    and privilegeId = #{privilegeId,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByRoleId" parameterType="long">
    delete from ba_role_privilege
    where roleId = #{roleId,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByPrivilegeId" parameterType="long">
    delete from ba_role_privilege
    where privilegeId = #{privilegeId,jdbcType=BIGINT}
  </delete>
</mapper>
pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaUserMapper.xml
@@ -3,24 +3,40 @@
<!--namespace对应mapper接口所在的位置-->
<mapper namespace="com.dy.pipIrrGlobal.daoBa.BaUserMapper">
    <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoBa.BaUser">
        <!--@mbg.generated-->
        <!--@Table ba_user-->
        <id property="id" column="id" />
        <result property="name" column="name"/>
        <result property="phone" column="phone"/>
        <result property="password" column="password"/>
        <result property="orgTag" column="orgTag"/>
        <result property="supperAdmin" column="supperAdmin"/>
        <result property="disabled" column="deleted"/>
    </resultMap>
    <resultMap id="login" type="com.dy.pipIrrGlobal.pojoBa.BaUser">
        <id property="id" column="id" />
        <result property="name" column="name"/>
        <result property="phone" column="phone"/>
        <result property="orgTag" column="orgTag"/>
        <result property="supperAdmin" column="supperAdmin"/>
    </resultMap>
    <!--
        <select id="login" resultMap="login">
            select id, name, phone, orgTag
            from ba_user
            where disabled=0 and deleted=0 and phone=#{phone} and password=#{password}
        </select>
        <select id="login" resultType="com.dy.pipIrrGlobal.pojoBa.BaUser">
            select id, name, phone, orgTag
        -->
    <sql id="Base_Column_List">
        <!--@mbg.generated-->
        id, name, phone, password, orgTag, supperAdmin, deleted
    </sql>
    <sql id="Login_Column_List">
        <!--@mbg.generated-->
        id, name, phone, orgTag, supperAdmin
    </sql>
    <select id="login" resultMap="login" >
        select *
        from ba_user r
        select
        <include refid="Login_Column_List" />
        from ba_user
        where disabled=0 and deleted=0 and phone=#{phone} and password=#{password}
    </select>
pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaUserRoleMapper.xml
New file
@@ -0,0 +1,63 @@
<?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.dy.pipIrrGlobal.daoBa.BaUserRoleMapper">
  <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoBa.BaUserRole">
    <!--@mbg.generated-->
    <!--@Table ba_user_role-->
    <id column="userId" jdbcType="BIGINT" property="userId" />
    <id column="roleId" jdbcType="BIGINT" property="roleId" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    userId, roleId
  </sql>
  <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoBa.BaUserRole">
    <!--@mbg.generated-->
    insert into ba_user_role (userId, roleId)
    values (#{userId,jdbcType=BIGINT}, #{roleId,jdbcType=BIGINT})
  </insert>
  <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaUserRole">
    <!--@mbg.generated-->
    insert into ba_user_role
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="userId != null">
        userId,
      </if>
      <if test="roleId != null">
        roleId,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="userId != null">
        #{userId,jdbcType=BIGINT},
      </if>
      <if test="roleId != null">
        #{roleId,jdbcType=BIGINT},
      </if>
    </trim>
  </insert>
  <delete id="deleteByPrimaryKey" parameterType="map">
    <!--@mbg.generated-->
    delete from ba_user_role
    where userId = #{userId,jdbcType=BIGINT}
    and roleId = #{roleId,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByUserId" parameterType="long">
    <!--@mbg.generated-->
    delete from ba_user_role
    where userId = #{userId,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByRoleId" parameterType="long">
    <!--@mbg.generated-->
    delete from ba_user_role
    where userId = #{roleId,jdbcType=BIGINT}
  </delete>
</mapper>
pipIrr-platform/pipIrr-global/src/main/resources/mapper/DemoRoleMapper.xml
@@ -1,17 +1,20 @@
<?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.dy.pipIrrGlobal.daoDemo.DemoRoleMapper">
  <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoDemo.DemoRole">
    <!--@mbg.generated-->
    <!--@Table demo_role-->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="name" jdbcType="VARCHAR" property="name" />
    <result column="deleted" jdbcType="TINYINT" property="deleted" />
    <result property="deleted" column="deleted" typeHandler="com.dy.common.mybatis.envm.EnumCodeTypeHandler" javaType="com.dy.common.mybatis.envm.Deleted"/>
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, `name`, deleted
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select 
@@ -19,11 +22,13 @@
    from demo_role
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--@mbg.generated-->
    delete from demo_role
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoDemo.DemoRole">
    <!--@mbg.generated-->
    insert into demo_role (id, `name`, deleted
@@ -31,6 +36,7 @@
    values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{deleted,jdbcType=TINYINT}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoDemo.DemoRole">
    <!--@mbg.generated-->
    insert into demo_role