LIKE CONCAT 连用

SELECT
    (@i :=@i + 1) AS number,
    x.uuid,
    x.payment_code,
    x.supplier_name,
    x.receive_money,
    x.is_export_flag,
    x.export_time,
    x.payer,
    x.region_name,
    x.user_name,
    x.marketer_id ,
x.region_id
FROM
    (
        SELECT DISTINCT
            a.uuid,
            a.payment_code,
            a.supplier_name,
            a.receive_money,

        IF (
            is_export_flag = 0,
            '未导出',
            '已导出'
        ) AS is_export_flag,
        a.export_time,
        b.payer,
        d.region_name,
         GROUP_CONCAT(DISTINCT f.user_name) AS user_name,
-- ( f.user_name )AS user_name,
        e.marketer_id,
d.uuid as region_id
    FROM
        biz_lc_payment_info a,
        biz_lc_payment_invoice_info b
    LEFT JOIN biz_item_company c ON b.payer = c.item_company_name
    AND c.sys_status = 1
    LEFT JOIN biz_item_region d ON c.region_id = d.uuid
    AND d.sys_status = 1
    LEFT JOIN biz_link_marketer_region e ON e.region_id = d.uuid
    AND d.sys_status = 1
    LEFT JOIN sys_user f ON e.marketer_id LIKE CONCAT('%', f.uuid, '%')
    AND f.sys_status = 1
    WHERE
        a.payment_id = b.payment_id
    AND a.sys_status = 1
    AND b.sys_status = 1
    GROUP BY
        a.uuid
    ) x,
    (SELECT @i := 0) AS y
WHERE
--     x.marketer_id LIKE '%u1032%' 
 x.is_export_flag = '已导出' 

 String StrSql = " SELECT "
                + " CASE WHEN b.ACTIVITY_NAME = '非常规价格申请' THEN '申请中' "
                + " WHEN b.ACTIVITY_NAME = '资金部价格审批'  THEN '金融副总监审批中' "
                + " WHEN b.ACTIVITY_NAME = '总经理价格审批'  THEN '总经理审批中' "
                + " WHEN b.ACTIVITY_NAME = '董事长价格审批' and b.`status`<> '已完成'  THEN '董事长审批中' "
                + " WHEN b.ACTIVITY_NAME = '董事长价格审批' and b.`status`= '已完成'  THEN '已通过' "
                + " END AS activity_name "
            +" FROM "
                + " bpm_process_instance a, "
                + " bpm_last_activity b,"
                + " biz_un_price_apply c  "
            +" WHERE "
                + " a.instance_id = b.instance_id "
                + "    AND a.process_name = 'BusinessModel2.0/非常规价格审批流程' "
                + "    AND a.biz_uuid = c.uuid "
                + "    AND a.sys_status = 1 "
                + "    AND b.sys_status = 1 "
                + "    AND c.sys_status = 1 "
                + " AND c.pay_id = ? "  ;
                   

 

 

String getUserNames = String.format(
                        "SELECT " +
                                "    GROUP_CONCAT(user_name) AS user_names " +
                                "FROM " +
                                "    sys_user " +
                                "WHERE " +
                                "    sys_status = 1 " +

 

 


fileName = fileName.substring(0, fileName.lastIndexOf("."));                                "AND uuid IN (%s)", marketerIds);

 

    // 避免下载的的文件名重复
        // 先去掉后缀
        if (fileName.contains(".")) {
            fileName = fileName.substring(0, fileName.lastIndexOf("."));
        }

 

 

posted on 2019-07-02 10:29  小白菜好吃  阅读(3407)  评论(0编辑  收藏  举报

导航