120 lines
4.5 KiB
XML
120 lines
4.5 KiB
XML
<?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.njzscloud.supervisory.sys.auth.mapper.AuthMapper">
|
|
<resultMap id="selectUserMap" autoMapping="true" type="com.njzscloud.supervisory.sys.auth.pojo.result.MyResult">
|
|
<result property="accountId" column="account_id"/>
|
|
<result property="userId" column="user_id"/>
|
|
<result property="secret" column="secret"/>
|
|
<result property="nickname" column="nickname"/>
|
|
<result property="tenantId" column="tenant_id"/>
|
|
<result property="bizObj" column="biz_obj" typeHandler="com.njzscloud.common.mp.support.handler.e.EnumTypeHandlerDealer"/>
|
|
<result property="tenantName" column="tenant_name"/>
|
|
<result property="disabled" column="disabled"/>
|
|
</resultMap>
|
|
<select id="selectUser" resultMap="selectUserMap">
|
|
SELECT a.id account_id,
|
|
a.user_id,
|
|
a.user_id id,
|
|
a.secret,
|
|
b.nickname,
|
|
b.avatar,
|
|
b.phone,
|
|
b.tenant_id,
|
|
b.biz_obj,
|
|
c.tenant_name,
|
|
a.disabled
|
|
FROM sys_user_account a
|
|
INNER JOIN sys_user b ON a.user_id = b.id AND b.deleted = 0
|
|
INNER JOIN sys_tenant c ON c.id = b.tenant_id AND c.deleted = 0
|
|
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
|
|
${ew.customSqlSegment}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="selectUserMenu" resultType="com.njzscloud.common.security.support.MenuResource">
|
|
SELECT DISTINCT a.id,
|
|
a.sn,
|
|
a.pid,
|
|
a.title,
|
|
a.icon,
|
|
a.tier,
|
|
a.breadcrumb,
|
|
a.sort,
|
|
a.route_name,
|
|
a.menu_category
|
|
FROM sys_menu a
|
|
INNER JOIN sys_role_resource b ON b.data_id = a.id AND b.table_name = 'sys_menu'
|
|
AND b.role_id IN (SELECT a.id
|
|
FROM sys_role a
|
|
INNER JOIN sys_user_role b ON b.role_id = a.id AND b.user_id = #{userId}
|
|
WHERE a.deleted = 0)
|
|
WHERE a.deleted = 0
|
|
</select>
|
|
|
|
<select id="selectUserEndpoint" resultType="com.njzscloud.common.security.support.EndpointResource">
|
|
SELECT DISTINCT a.id,
|
|
a.request_method,
|
|
a.routing_path,
|
|
a.endpoint_path,
|
|
a.access_model,
|
|
a.memo,
|
|
a.creator_id,
|
|
a.modifier_id,
|
|
a.create_time,
|
|
a.modify_time,
|
|
a.deleted
|
|
FROM sys_endpoint a
|
|
INNER JOIN sys_role_resource b ON b.data_id = a.id AND b.table_name = 'sys_endpoint'
|
|
AND b.role_id IN (SELECT a.id
|
|
FROM sys_role a
|
|
INNER JOIN sys_user_role b ON b.role_id = a.id AND b.user_id = #{userId}
|
|
WHERE a.deleted = 0)
|
|
WHERE a.deleted = 0
|
|
</select>
|
|
<select id="selectRoleByUserId" resultType="java.lang.String">
|
|
SELECT a.role_code
|
|
FROM sys_role a
|
|
INNER JOIN sys_user_role b ON b.role_id = a.id AND b.user_id = #{userId}
|
|
WHERE a.deleted = 0
|
|
</select>
|
|
<select id="selectCompanyInfo" resultType="com.njzscloud.supervisory.biz.pojo.result.SearchCompanyResult">
|
|
SELECT
|
|
bc.id,
|
|
bc.user_id,
|
|
bc.station,
|
|
bc.uscc,
|
|
bc.company_name,
|
|
bc.business_license,
|
|
bc.license_start_time,
|
|
bc.license_end_time,
|
|
bc.legal_representative,
|
|
bc.province,
|
|
bc.city,
|
|
bc.area,
|
|
bc.town,
|
|
bc.province_name,
|
|
bc.city_name,
|
|
bc.area_name,
|
|
bc.town_name,
|
|
bc.address,
|
|
bc.lng,
|
|
bc.lat,
|
|
bc.contacts,
|
|
bc.phone,
|
|
bc.audit_status,
|
|
bc.audit_memo,
|
|
ma.money
|
|
FROM
|
|
biz_company bc
|
|
LEFT JOIN money_account ma ON bc.id = ma.station_id
|
|
WHERE bc.user_id = #{userId}
|
|
</select>
|
|
|
|
<select id="selectWechatOpenidByUserId" resultType="java.lang.String">
|
|
SELECT wechat_openid
|
|
FROM sys_user_account
|
|
WHERE user_id = #{userId} AND deleted = 0
|
|
</select>
|
|
</mapper>
|