|
@@ -1,36 +1,37 @@
|
|
<?xml version="1.0" encoding="UTF-8" ?>
|
|
<?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" >
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
|
-<mapper namespace="cn.com.ty.lift.system.user.dao.mapper.UserRoleMapper" >
|
|
|
|
- <resultMap id="BaseResultMap" type="cn.com.ty.lift.system.user.dao.entity.UserRole" >
|
|
|
|
- <id column="id" property="id" jdbcType="BIGINT" />
|
|
|
|
- <result column="user_id" property="userId" jdbcType="BIGINT" />
|
|
|
|
- <result column="role_id" property="roleId" jdbcType="BIGINT" />
|
|
|
|
- <result column="company_id" property="companyId" jdbcType="BIGINT"/>
|
|
|
|
- </resultMap>
|
|
|
|
|
|
+<mapper namespace="cn.com.ty.lift.system.user.dao.mapper.UserRoleMapper">
|
|
|
|
+ <resultMap id="BaseResultMap" type="cn.com.ty.lift.system.user.dao.entity.UserRole">
|
|
|
|
+ <id column="id" property="id" jdbcType="BIGINT"/>
|
|
|
|
+ <result column="user_id" property="userId" jdbcType="BIGINT"/>
|
|
|
|
+ <result column="role_id" property="roleId" jdbcType="BIGINT"/>
|
|
|
|
+ <result column="company_id" property="companyId" jdbcType="BIGINT"/>
|
|
|
|
+ </resultMap>
|
|
|
|
|
|
- <sql id="Base_Column_List" >
|
|
|
|
|
|
+ <sql id="Base_Column_List">
|
|
id, user_id, role_id, company_id
|
|
id, user_id, role_id, company_id
|
|
</sql>
|
|
</sql>
|
|
|
|
|
|
- <!-- 通过用户id和公司id获取角色用户关联关系 -->
|
|
|
|
- <select id="getByUserRole" parameterType="cn.com.ty.lift.system.user.dao.entity.UserRole" resultType="cn.com.ty.lift.system.user.dao.entity.UserRole">
|
|
|
|
- select
|
|
|
|
- <include refid="Base_Column_List"/>
|
|
|
|
- from user_role
|
|
|
|
- where true
|
|
|
|
- <if test="userId != null">
|
|
|
|
- and user_id = #{userId,jdbcType=BIGINT}
|
|
|
|
- </if>
|
|
|
|
- <if test="roleId != null">
|
|
|
|
- and role_id = #{roleId,jdbcType=BIGINT}
|
|
|
|
- </if>
|
|
|
|
- <if test="companyId != null">
|
|
|
|
- and company_id = #{companyId,jdbcType=BIGINT}
|
|
|
|
- </if>
|
|
|
|
- </select>
|
|
|
|
|
|
+ <!-- 通过用户id和公司id获取角色用户关联关系 -->
|
|
|
|
+ <select id="getByUserRole" parameterType="cn.com.ty.lift.system.user.dao.entity.UserRole"
|
|
|
|
+ resultType="cn.com.ty.lift.system.user.dao.entity.UserRole">
|
|
|
|
+ select
|
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
|
+ from user_role
|
|
|
|
+ where true
|
|
|
|
+ <if test="userId != null">
|
|
|
|
+ and user_id = #{userId,jdbcType=BIGINT}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="roleId != null">
|
|
|
|
+ and role_id = #{roleId,jdbcType=BIGINT}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="companyId != null">
|
|
|
|
+ and company_id = #{companyId,jdbcType=BIGINT}
|
|
|
|
+ </if>
|
|
|
|
+ </select>
|
|
|
|
|
|
- <!-- 公司用户企管员校验 -->
|
|
|
|
- <select id="judgeEnterpriseAdmin" resultType="java.lang.Integer">
|
|
|
|
|
|
+ <!-- 公司用户企管员校验 -->
|
|
|
|
+ <select id="judgeEnterpriseAdmin" resultType="java.lang.Integer">
|
|
SELECT
|
|
SELECT
|
|
COUNT(1)
|
|
COUNT(1)
|
|
FROM
|
|
FROM
|
|
@@ -44,4 +45,19 @@
|
|
AND r.company_id = #{companyId}
|
|
AND r.company_id = #{companyId}
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
+
|
|
|
|
+ <!--查询公司下面全部的企管员-->
|
|
|
|
+ <select id="getAllEnterpriseAdmin" resultType="java.lang.Long" parameterType="long">
|
|
|
|
+ SELECT
|
|
|
|
+ ur.user_id
|
|
|
|
+ FROM
|
|
|
|
+ user_role AS ur,
|
|
|
|
+ role AS r
|
|
|
|
+ WHERE
|
|
|
|
+ ur.role_id = r.id
|
|
|
|
+ AND ur.company_id = #{mtCompanyId}
|
|
|
|
+ AND r.`code` = "ENTERPRISE_ADMIN"
|
|
|
|
+ AND r.company_id = #{mtCompanyId}
|
|
|
|
+ </select>
|
|
|
|
+
|
|
</mapper>
|
|
</mapper>
|