<?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="org.jeecg.modules.fileupload.mapper.MaterialUsrServiceMapper">


    <select id="getAccountInfo" resultType="com.alibaba.fastjson.JSONObject">
    SELECT
	t1.account_id as 'accountId',
	t1.photo_id as 'photoId',
	t2.user_name as 'userName',
	t2.account_status as 'accountStatus'
    FROM
	(
		SELECT
			account_id,
			photo_id
		FROM
			ctop_kuaishou_video_get
		WHERE
			signature = #{code}
	) t1
    LEFT JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
    order by t2.account_status;
    </select>

    <select id="getKuiShouRelationCount" resultType="java.lang.Integer">
		SELECT count(1)  from  ctop_kuaishou_creative WHERE account_id = #{accountId} AND photo_id =  #{photoId}
	</select>
    <select id="getKuiShouRefuseRelationCount" resultType="com.alibaba.fastjson.JSONObject">
		SELECT count(1) as 'refuseCount',
		GROUP_CONCAT(DISTINCT review_detail  SEPARATOR '@#')  as 'refuseDetail'
		from  ctop_kuaishou_creative
		WHERE account_id = #{accountId}
		AND photo_id = #{photoId}
		AND `status` = 42

	</select>
    <select id="getByteDanceAccountInfo" resultType="com.alibaba.fastjson.JSONObject">
	SELECT
	CONCAT(t1.account_id,'') as 'accountId',
	t1.vid as 'vid',
	CONCAT(t1.material_id,'')  as 'materialId',
	t2.user_name as 'userName',
	t2.account_status as 'accountStatus'
    FROM
	(
		SELECT
			account_id,
			vid,
			material_id
		FROM
			ctop_bytedance_video_info
		WHERE
			signature = #{code}
	) t1
    LEFT JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
      order by t2.account_status;

	</select>
    <select id="getByteDanceRelationCount" resultType="java.lang.Integer">
		select  count(1)  from ctop_bytedance_creative where  account_id = #{accountId}
		and video_id = #{vid}

	</select>
</mapper>
