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.
118 lines
3.3 KiB
118 lines
3.3 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.CustomerMpDao">
|
|
|
|
<select id="selectByCustomerId" resultType="com.epmet.dto.CustomerMpDTO">
|
|
SELECT
|
|
id,
|
|
customer_id,
|
|
client,
|
|
app_id,
|
|
authorization_flag
|
|
FROM
|
|
customer_mp
|
|
WHERE
|
|
del_flag = '0'
|
|
AND customer_id = #{customerId}
|
|
ORDER BY
|
|
client ASC
|
|
</select>
|
|
<!-- 查询授权的数量 -->
|
|
<select id="selectAuthCount" resultType="java.lang.Integer">
|
|
SELECT
|
|
COUNT(*) AS notAuthCount
|
|
FROM
|
|
customer_mp
|
|
WHERE
|
|
del_flag = '0'
|
|
AND customer_id = #{customerId}
|
|
AND authorization_flag = 1
|
|
</select>
|
|
|
|
<!-- 回填customer_mp的appId -->
|
|
<update id="updateAppIDByCustomerIdAndClient" parameterType="com.epmet.dto.form.AuthCodeFormDTO">
|
|
UPDATE customer_mp
|
|
SET app_id = #{authAppId},authorization_flag = 1
|
|
WHERE
|
|
customer_id = #{customerId}
|
|
AND del_flag = '0'
|
|
AND client = #{clientType}
|
|
</update>
|
|
|
|
<!-- 修改小程序授权的状态 -->
|
|
<update id="updateAuthorizationFlag">
|
|
UPDATE customer_mp
|
|
SET authorization_flag = 0
|
|
WHERE
|
|
app_id = #{authAppId}
|
|
</update>
|
|
|
|
<!-- 根据 客户Id和授权方AppId查询clientType -->
|
|
<select id="selectClientTypeByCustomerIdAndAuthId" resultType="java.lang.String">
|
|
SELECT
|
|
client_type AS clientType
|
|
FROM
|
|
customer_mp
|
|
WHERE
|
|
del_flag = '0'
|
|
AND customer_id = #{customerId}
|
|
AND app_id = #{authAppId}
|
|
</select>
|
|
|
|
<select id="selectAll" resultType="com.epmet.dto.CustomerMpDTO">
|
|
SELECT
|
|
id,
|
|
customer_id,
|
|
client,
|
|
app_id,
|
|
authorization_flag
|
|
FROM
|
|
customer_mp
|
|
WHERE
|
|
del_flag = '0'
|
|
ORDER BY
|
|
customer_id ASC, client ASC
|
|
</select>
|
|
<select id="selectAuthFlag" resultType="java.lang.Boolean">
|
|
SELECT
|
|
authorization_flag
|
|
FROM
|
|
customer_mp
|
|
WHERE
|
|
del_flag = '0'
|
|
AND customer_id = #{customerId}
|
|
AND CLIENT = #{clientType}
|
|
</select>
|
|
|
|
<select id="selectByAppId" resultType="com.epmet.dto.CustomerMpDTO">
|
|
SELECT
|
|
id,
|
|
customer_id,
|
|
client,
|
|
app_id,
|
|
authorization_flag
|
|
FROM
|
|
customer_mp
|
|
WHERE
|
|
del_flag = '0'
|
|
AND app_id = #{appId}
|
|
</select>
|
|
|
|
<select id="selectCustomerByAppId" resultType="com.epmet.dto.PaCustomerDTO">
|
|
SELECT
|
|
pc.id,
|
|
pc.customer_name,
|
|
pc.is_initialize
|
|
FROM
|
|
customer_mp cm
|
|
INNER JOIN pa_customer pc ON cm.customer_id = pc.id
|
|
WHERE
|
|
cm.del_flag = '0'
|
|
AND pc.del_flag = '0'
|
|
AND pc.is_initialize = '1' <!-- 已完成客户初始化 -->
|
|
AND cm.authorization_flag = '1' <!-- 已完成小程序授权 -->
|
|
AND cm.app_id = #{appId}
|
|
</select>
|
|
|
|
</mapper>
|