|
@@ -2,4 +2,53 @@
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="cn.com.ctop.kuaishou.modules.ai.mapper.KuaishouDirectionalPackageMapper">
|
|
|
|
|
|
+ <select id="queryList" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
+ SELECT
|
|
|
+ t1.template_id 'templateId',
|
|
|
+ t1.template_name 'templateName',
|
|
|
+ t3.project_name 'projectName',
|
|
|
+ CASE WHEN t1.platform_os =1 THEN 'Android' WHEN t1.platform_os =2 THEN 'iOS' ELSE '-' END 'platformOs',
|
|
|
+ t1.update_time 'updateTime',
|
|
|
+ IFNULL(t4.count,0) as 'accountCount',
|
|
|
+ '-' as 'unitCount'
|
|
|
+ FROM ctop_kuaishou_directional_package t1
|
|
|
+ LEFT JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
|
|
|
+ LEFT JOIN ctop_project t3 ON t3.id = t2.project_id
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT template_id,COUNT(1) 'count' FROM
|
|
|
+ ctop_kuaishou_template GROUP BY template_id
|
|
|
+ ) t4 ON t4.template_id = t1.template_id
|
|
|
+ where t1.data_status = 1
|
|
|
+ <if test="templateName !=null">
|
|
|
+ AND t1.template_name like concat('%',#{templateName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="platformOs !=null">
|
|
|
+ AND t1.platform_os = #{platformOs}
|
|
|
+ </if>
|
|
|
+ <if test="projectId !=null">
|
|
|
+ AND t3.project_id = #{projectId}
|
|
|
+ </if>
|
|
|
+ GROUP BY t1.template_id
|
|
|
+ </select>
|
|
|
+ <select id="queryListTotal" resultType="java.lang.Long">
|
|
|
+ SELECT
|
|
|
+ IFNULL(count(1),0)
|
|
|
+ from(
|
|
|
+ select t1.template_id
|
|
|
+ FROM ctop_kuaishou_directional_package t1
|
|
|
+ LEFT JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
|
|
|
+ LEFT JOIN ctop_project t3 ON t3.id = t2.project_id
|
|
|
+ where t1.data_status = 1
|
|
|
+ <if test="templateName !=null">
|
|
|
+ AND t1.template_name like concat('%',#{templateName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="platformOs !=null">
|
|
|
+ AND t1.platform_os = #{platformOs}
|
|
|
+ </if>
|
|
|
+ <if test="projectId !=null">
|
|
|
+ AND t3.project_id = #{projectId}
|
|
|
+ </if>
|
|
|
+ GROUP BY t1.template_id
|
|
|
+ ) t
|
|
|
+ </select>
|
|
|
</mapper>
|