forked from luyan/epmet-cloud-lingshan
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.7 KiB
55 lines
1.7 KiB
<?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.epmet.dao.AuthCodeDao">
|
|
|
|
<insert id="insertRedirectAuthCode" parameterType="com.epmet.dto.form.AuthCodeFormDTO">
|
|
INSERT INTO auth_code ( ID, CUSTOMER_ID, CLIENT_TYPE, AUTH_CODE, EXPIRES_IN_TIME, DEL_FLAG, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME )
|
|
VALUES
|
|
(
|
|
REPLACE ( UUID(), '-', '' ),
|
|
#{customerId},
|
|
#{clientType},
|
|
#{authCode},
|
|
#{expiresInTime},
|
|
#{delFlag},
|
|
#{createdBy},
|
|
NOW(),
|
|
#{updatedBy},
|
|
NOW()
|
|
)
|
|
</insert>
|
|
|
|
<!-- 回填 auth_code表 authAppId -->
|
|
<update id="updateAppId">
|
|
UPDATE auth_code
|
|
SET auth_appid = #{authAppId}
|
|
WHERE
|
|
del_flag = 0
|
|
AND customer_id = #{customerId}
|
|
AND client_type = #{clientType}
|
|
</update>
|
|
|
|
<!-- 根据authCode查询客户ID和客户端类型 -->
|
|
<select id="selectCustomerIdByAuthCode" resultType="com.epmet.dto.result.AuthCodeResultDTO">
|
|
SELECT
|
|
customer_id AS customerId,
|
|
client_type AS clientType
|
|
FROM
|
|
auth_code
|
|
WHERE
|
|
del_flag = 0
|
|
AND auth_code = #{authCode}
|
|
</select>
|
|
|
|
<!-- 逻辑删除客户下的授权码,保持一个授权码有用 -->
|
|
<update id="deleteCustomerAuthCode">
|
|
UPDATE auth_code
|
|
SET del_flag = 1
|
|
where
|
|
del_flag = 0
|
|
AND customer_id = #{customerId}
|
|
AND client_type = #{clientType}
|
|
</update>
|
|
|
|
</mapper>
|