zoukankan      html  css  js  c++  java
  • 测试的sql

    幼教视频全部

    '''sql中需传的参数为:phone_no,phone_no(当前登录账号),cid(视频分类),video_type(1 幼教视频, 2 合作方视频,3校方视频),del_flag(0未删除,1删除),audit_status( 0未审核,1通过,2未通过)'''
    videolist='''SELECT a.id, a.video_name, a.cid, CONCAT( "http://happyanimation-site.oss-cn-shenzhen.aliyuncs.com/", image_uri )as image_uri, b.psy_coin, IF ( b.psy_coin = 0,''1'', ( IF ((( NOW() >= ( SELECT start_time FROM pay_free_strategy WHERE STATUS = 1 AND for_arword_view = 1 ) AND NOW() <= ( SELECT end_time FROM pay_free_strategy WHERE STATUS = 1 AND for_arword_view = 1 ))), ''1'', ( IF ( NOW() <= ( SELECT c.end_date FROM pay_vip_record c LEFT JOIN um_consumer d ON c.csid = d.id WHERE d.phone_no =% s ORDER BY c.end_date DESC LIMIT 1 ),''1'', ( IF ( a.id = ( SELECT pay_target FROM pay_vcoin_record WHERE pay_target = a.id AND TO_DAYS(create_date) = to_days(now()) AND csid = ( SELECT id FROM um_consumer WHERE phone_no =% s )),''1'',''||0||''))))))) AS is_play FROM cm_video a LEFT JOIN pay_strategy b ON a.play_price_sid = b.id WHERE a.cid = % s AND a.video_type =% s AND a.del_flag =% s AND a.audit_status =% s ORDER BY psy_coin, a.update_date DESC'''

    学校推荐

    SELECT
    a.id,
    a.video_name,
    (
    UNIX_TIMESTAMP(a.update_date) * 1000
    ) AS update_date,
    CONCAT(
    "http://happyanimation-site.oss-cn-shenzhen.aliyuncs.com/",
    image_uri
    ) AS image_uri,
    b.psy_coin,

    IF (
    b.psy_coin = 0,
    '1',
    (

    IF (
    (
    (
    NOW() >= (
    SELECT
    start_time
    FROM
    pay_free_strategy
    WHERE
    STATUS = 1
    AND for_arword_view = 1
    )
    AND NOW() <= (
    SELECT
    end_time
    FROM
    pay_free_strategy
    WHERE
    STATUS = 1
    AND for_arword_view = 1
    )
    )
    ),
    '1',
    (

    IF (
    NOW() <= (
    SELECT
    c.end_date
    FROM
    pay_vip_record c
    LEFT JOIN um_consumer d ON c.csid = d.id
    WHERE
    d.phone_no ="18780010265"
    ORDER BY
    c.end_date DESC
    LIMIT 1
    ),
    '1',
    (

    IF (
    a.id = (
    SELECT
    pay_target
    FROM
    pay_vcoin_record
    WHERE
    pay_target = a.id
    AND TO_DAYS(create_date) = to_days(now())
    AND csid = (
    SELECT
    id
    FROM
    um_consumer
    WHERE
    phone_no ="18780010265"
    )
    ),
    '1',
    '0'
    )
    )
    )
    )
    )
    )
    ) AS is_play
    FROM
    cm_video a
    LEFT JOIN pay_strategy b ON a.play_price_sid = b.id
    WHERE
    a.cid ="614313147179728896"
    AND a.video_type =1
    AND a.del_flag =0
    AND a.audit_status =1
    and a.id in (select target_id from cm_recommend where sid in (select sid from um_consumer where phone_no="18780010265"))
    ORDER BY
    psy_coin,
    a.update_date DESC

  • 相关阅读:
    ABP Xunit单元测试 第五篇
    ABP 异常处理 第四篇
    ABP Quartz 作业调度第三篇
    ABP 权限拦截 第二篇
    ABP .NET corej 版本 第一篇
    Vue生命周期
    vue中的import、export、requre的区别
    ES6最新语法
    Vux项目搭建
    对象克隆
  • 原文地址:https://www.cnblogs.com/xianhaiyan/p/7116391.html
Copyright © 2011-2022 走看看