<?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="pwc.taxtech.atms.dao.UserRoleMapper"> <resultMap id="BaseResultMap" type="pwc.taxtech.atms.entitiy.UserRole"> <!-- WARNING - @mbg.generated This element is automatically generated by MyBatis Generator, do not modify. --> <id column="ID" jdbcType="VARCHAR" property="ID" /> <result column="UserID" jdbcType="VARCHAR" property="userID" /> <result column="RoleID" jdbcType="VARCHAR" property="roleID" /> <result column="ProjectID" jdbcType="VARCHAR" property="projectID" /> <result column="ServiceTypeID" jdbcType="VARCHAR" property="serviceTypeID" /> </resultMap> <sql id="Example_Where_Clause"> <!-- WARNING - @mbg.generated This element is automatically generated by MyBatis Generator, do not modify. --> <where> <foreach collection="oredCriteria" item="criteria" separator="or"> <if test="criteria.valid"> <trim prefix="(" prefixOverrides="and" suffix=")"> <foreach collection="criteria.criteria" item="criterion"> <choose> <when test="criterion.noValue"> and ${criterion.condition} </when> <when test="criterion.singleValue"> and ${criterion.condition} #{criterion.value} </when> <when test="criterion.betweenValue"> and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} </when> <when test="criterion.listValue"> and ${criterion.condition} <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> #{listItem} </foreach> </when> </choose> </foreach> </trim> </if> </foreach> </where> </sql> <sql id="Update_By_Example_Where_Clause"> <!-- WARNING - @mbg.generated This element is automatically generated by MyBatis Generator, do not modify. --> <where> <foreach collection="example.oredCriteria" item="criteria" separator="or"> <if test="criteria.valid"> <trim prefix="(" prefixOverrides="and" suffix=")"> <foreach collection="criteria.criteria" item="criterion"> <choose> <when test="criterion.noValue"> and ${criterion.condition} </when> <when test="criterion.singleValue"> and ${criterion.condition} #{criterion.value} </when> <when test="criterion.betweenValue"> and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} </when> <when test="criterion.listValue"> and ${criterion.condition} <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> #{listItem} </foreach> </when> </choose> </foreach> </trim> </if> </foreach> </where> </sql> <sql id="Base_Column_List"> <!-- WARNING - @mbg.generated This element is automatically generated by MyBatis Generator, do not modify. --> ID, UserID, RoleID, ProjectID, ServiceTypeID </sql> <select id="selectByExample" parameterType="pwc.taxtech.atms.entitiy.UserRoleExample" resultMap="BaseResultMap"> <!-- WARNING - @mbg.generated This element is automatically generated by MyBatis Generator, do not modify. --> select <if test="distinct"> distinct </if> <include refid="Base_Column_List" /> from UserRole <if test="_parameter != null"> <include refid="Example_Where_Clause" /> </if> <if test="orderByClause != null"> order by ${orderByClause} </if> </select> <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap"> <!-- WARNING - @mbg.generated This element is automatically generated by MyBatis Generator, do not modify. --> select <include refid="Base_Column_List" /> from UserRole where ID = #{ID,jdbcType=VARCHAR} </select> <delete id="deleteByPrimaryKey" parameterType="java.lang.String"> <!-- WARNING - @mbg.generated This element is automatically generated by MyBatis Generator, do not modify. --> delete from UserRole where ID = #{ID,jdbcType=VARCHAR} </delete> <delete id="deleteByExample" parameterType="pwc.taxtech.atms.entitiy.UserRoleExample"> <!-- WARNING - @mbg.generated This element is automatically generated by MyBatis Generator, do not modify. --> delete from UserRole <if test="_parameter != null"> <include refid="Example_Where_Clause" /> </if> </delete> <insert id="insert" parameterType="pwc.taxtech.atms.entitiy.UserRole"> <!-- WARNING - @mbg.generated This element is automatically generated by MyBatis Generator, do not modify. --> insert into UserRole (ID, UserID, RoleID, ProjectID, ServiceTypeID) values (#{ID,jdbcType=VARCHAR}, #{userID,jdbcType=VARCHAR}, #{roleID,jdbcType=VARCHAR}, #{projectID,jdbcType=VARCHAR}, #{serviceTypeID,jdbcType=VARCHAR}) </insert> <insert id="insertSelective" parameterType="pwc.taxtech.atms.entitiy.UserRole"> <!-- WARNING - @mbg.generated This element is automatically generated by MyBatis Generator, do not modify. --> insert into UserRole <trim prefix="(" suffix=")" suffixOverrides=","> <if test="ID != null"> ID, </if> <if test="userID != null"> UserID, </if> <if test="roleID != null"> RoleID, </if> <if test="projectID != null"> ProjectID, </if> <if test="serviceTypeID != null"> ServiceTypeID, </if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="ID != null"> #{ID,jdbcType=VARCHAR}, </if> <if test="userID != null"> #{userID,jdbcType=VARCHAR}, </if> <if test="roleID != null"> #{roleID,jdbcType=VARCHAR}, </if> <if test="projectID != null"> #{projectID,jdbcType=VARCHAR}, </if> <if test="serviceTypeID != null"> #{serviceTypeID,jdbcType=VARCHAR}, </if> </trim> </insert> <select id="countByExample" parameterType="pwc.taxtech.atms.entitiy.UserRoleExample" resultType="java.lang.Long"> <!-- WARNING - @mbg.generated This element is automatically generated by MyBatis Generator, do not modify. --> select count(*) from UserRole <if test="_parameter != null"> <include refid="Example_Where_Clause" /> </if> </select> <update id="updateByExampleSelective" parameterType="map"> <!-- WARNING - @mbg.generated This element is automatically generated by MyBatis Generator, do not modify. --> update UserRole <set> <if test="record.ID != null"> ID = #{record.ID,jdbcType=VARCHAR}, </if> <if test="record.userID != null"> UserID = #{record.userID,jdbcType=VARCHAR}, </if> <if test="record.roleID != null"> RoleID = #{record.roleID,jdbcType=VARCHAR}, </if> <if test="record.projectID != null"> ProjectID = #{record.projectID,jdbcType=VARCHAR}, </if> <if test="record.serviceTypeID != null"> ServiceTypeID = #{record.serviceTypeID,jdbcType=VARCHAR}, </if> </set> <if test="_parameter != null"> <include refid="Update_By_Example_Where_Clause" /> </if> </update> <update id="updateByExample" parameterType="map"> <!-- WARNING - @mbg.generated This element is automatically generated by MyBatis Generator, do not modify. --> update UserRole set ID = #{record.ID,jdbcType=VARCHAR}, UserID = #{record.userID,jdbcType=VARCHAR}, RoleID = #{record.roleID,jdbcType=VARCHAR}, ProjectID = #{record.projectID,jdbcType=VARCHAR}, ServiceTypeID = #{record.serviceTypeID,jdbcType=VARCHAR} <if test="_parameter != null"> <include refid="Update_By_Example_Where_Clause" /> </if> </update> <update id="updateByPrimaryKeySelective" parameterType="pwc.taxtech.atms.entitiy.UserRole"> <!-- WARNING - @mbg.generated This element is automatically generated by MyBatis Generator, do not modify. --> update UserRole <set> <if test="userID != null"> UserID = #{userID,jdbcType=VARCHAR}, </if> <if test="roleID != null"> RoleID = #{roleID,jdbcType=VARCHAR}, </if> <if test="projectID != null"> ProjectID = #{projectID,jdbcType=VARCHAR}, </if> <if test="serviceTypeID != null"> ServiceTypeID = #{serviceTypeID,jdbcType=VARCHAR}, </if> </set> where ID = #{ID,jdbcType=VARCHAR} </update> <update id="updateByPrimaryKey" parameterType="pwc.taxtech.atms.entitiy.UserRole"> <!-- WARNING - @mbg.generated This element is automatically generated by MyBatis Generator, do not modify. --> update UserRole set UserID = #{userID,jdbcType=VARCHAR}, RoleID = #{roleID,jdbcType=VARCHAR}, ProjectID = #{projectID,jdbcType=VARCHAR}, ServiceTypeID = #{serviceTypeID,jdbcType=VARCHAR} where ID = #{ID,jdbcType=VARCHAR} </update> <select id="selectByExampleWithRowbounds" parameterType="pwc.taxtech.atms.entitiy.UserRoleExample" resultMap="BaseResultMap"> <!-- WARNING - @mbg.generated This element is automatically generated by MyBatis Generator, do not modify. --> select <if test="distinct"> distinct </if> <include refid="Base_Column_List" /> from UserRole <if test="_parameter != null"> <include refid="Example_Where_Clause" /> </if> <if test="orderByClause != null"> order by ${orderByClause} </if> </select> <resultMap id="UserRoleQuery" type="pwc.taxtech.atms.dto.user.UserRoleQuery"> <id column="ID" jdbcType="VARCHAR" property="ID" /> <result column="UserID" jdbcType="VARCHAR" property="userID" /> <result column="UserName" jdbcType="VARCHAR" property="userName" /> <result column="RoleID" jdbcType="VARCHAR" property="roleID" /> <result column="RoleName" jdbcType="VARCHAR" property="roleName" /> <result column="ServiceTypeName" jdbcType="VARCHAR" property="serviceTypeName" /> <result column="ServiceTypeID" jdbcType="VARCHAR" property="serviceTypeID" /> <result column="RoleCategoryID" jdbcType="VARCHAR" property="roleCategoryID" /> <result column="RoleCatetoryName" jdbcType="VARCHAR" property="roleCatetoryName" /> <result column="OrgID" jdbcType="VARCHAR" property="orgID" /> <result column="OrgName" jdbcType="VARCHAR" property="orgName" /> <result column="Email" jdbcType="VARCHAR" property="email" /> <result column="Status" jdbcType="INTEGER" property="status" /> </resultMap> <select id="selectUserRoleQueryByServiceTypeID" parameterType="java.lang.String" resultMap="UserRoleQuery"> select ur.ID as ID, u.ID as UserID, u.UserName as UserName, ur.RoleID as RoleID, r.Name as RoleName, s.Name as ServiceTypeName, s.ID as ServiceTypeID, rc.ID as RoleCategoryID, rc.Name as RoleCatetoryName, org.ID as OrgID, org.Name as OrgName, u.Email as Email, u.Status as Status from User as u left join UserRole as ur on u.ID = ur.UserID left join Role as r on ur.RoleID = r.ID left join ServiceType as s on s.ID = r.ServiceTypeID and s.IsActive = 1 and s.ID = #{serviceTypeID} left join RoleCategory as rc on rc.ID = r.RoleCategoryID and rc.IsActive = 1 left join Organization as org on u.OrganizationID = org.ID where u.Status = 1 and u.IsSuperAdmin = 0 order by UserName </select> <resultMap id="UserOrgRoleDto" type="pwc.taxtech.atms.dto.user.UserOrgRoleDto"> <id column="ID" jdbcType="VARCHAR" property="ID" /> <result column="UserID" jdbcType="VARCHAR" property="userID" /> <result column="RoleID" jdbcType="VARCHAR" property="roleID" /> <result column="RoleName" jdbcType="VARCHAR" property="roleName" /> </resultMap> <select id="getOriginalRoleList" resultMap="UserOrgRoleDto"> select ur.UserID as UserID, r.ID as RoleID, r.Name as RoleName from UserRole as ur join Role as r on ur.RoleID = r.ID </select> </mapper>