SELECT a.shipper_id,
a.user_id,
a.parent_shipper_id,
a.shipper_type,
a.shipper_enterprise_name,
a.shipper_enterprise_social_credit_code,
a.shipper_enterprise_phone,
a.shipper_enterprise_address,
a.shipper_enterprise_license_date_from,
a.shipper_enterprise_license_date_to,
a.shipper_enterprise_taxpayer,
a.shipper_enterprise_license_long,
a.shipper_enterprise_license_front_url,
a.shipper_corp,
a.shipper_corp_name,
a.shipper_corp_legal_name,
a.shipper_corp_idcard_number,
a.shipper_corp_idcard_number_des,
a.shipper_corp_idcard_date_from,
a.shipper_corp_idcard_date_to,
a.shipper_corp_idcard_long,
a.shipper_corp_idcard_front_url,
a.shipper_corp_idcard_back_url,
a.shipper_corp_idcard_inhand_url,
a.create_time,
a.create_by,
a.create_by_name,
a.update_time,
a.update_by,
a.update_by_name,
a.del_flag,
a.shipper_fill,
a.shipper_fill_time,
a.shipper_enterprise_fill,
a.shipper_enterprise_fill_time,
a.shipper_fill_remark,
a.shipper_enterprise_fill_remark,
b.user_phone,
b.user_name,
b.role_name,
b.organization_name,
b.user_account,
b.user_member_code,
b.user_idcard_number,
b.user_idcard_date_from,
b.user_idcard_date_to,
b.user_idcard_long,
b.user_idcard_front_url,
b.user_idcard_back_url,
b.user_idcard_inhand_url,
b.user_area_county_id,
b.user_area_name,
b.user_area_address,
b.user_remark,
b.avatar,
b.user_birthday,
a.company_account_id,
a.esign_auth_status,
a.esign_enterprise_status,
a.esign_seal_auth_id
FROM user_shipper a
LEFT JOIN "USER" b ON a.user_id = b.user_id
WHERE a.del_flag = 1
AND b.del_flag = 1
SELECT b.shipper_id,
a.user_id,
b.parent_shipper_id,
b.shipper_type,
b.shipper_enterprise_name,
b.shipper_enterprise_social_credit_code,
b.shipper_enterprise_phone,
b.shipper_enterprise_address,
b.shipper_enterprise_license_date_from,
b.shipper_enterprise_license_date_to,
b.shipper_enterprise_taxpayer,
b.shipper_enterprise_license_long,
b.shipper_enterprise_license_front_url,
b.shipper_corp,
b.shipper_corp_name,
b.shipper_corp_legal_name,
b.shipper_corp_idcard_number,
b.shipper_corp_idcard_number_des,
b.shipper_corp_idcard_date_from,
b.shipper_corp_idcard_date_to,
b.shipper_corp_idcard_long,
b.shipper_corp_idcard_front_url,
b.shipper_corp_idcard_back_url,
b.shipper_corp_idcard_inhand_url,
a.create_time,
a.create_by,
a.create_by_name,
a.update_time,
a.update_by,
a.update_by_name,
b.del_flag,
b.shipper_fill,
b.shipper_fill_time,
b.shipper_enterprise_fill,
b.shipper_enterprise_fill_time,
b.shipper_fill_remark,
b.shipper_enterprise_fill_remark,
b.shipper_fill_auth_id,
b.shipper_fill_auth_name,
b.shipper_enterprisel_auth_name,
b.shipper_enterprisel_auth_id,
a.user_phone,
a.user_name,
a.organization_name,
a.user_account,
a.user_member_code,
a.user_idcard_number,
a.user_idcard_date_from,
a.user_idcard_date_to,
a.user_idcard_long,
a.user_idcard_front_url,
a.user_idcard_back_url,
a.user_idcard_inhand_url,
a.user_area_county_id,
a.user_area_name,
a.user_area_address,
a.user_remark,
a.avatar,
a.user_birthday,
b.authorized_quota,
b.settlement_day,
b.remark,
b.authorized_used_amount,
r.roleName,
b.is_auto_audit_order,
b.monthly_settlement_flag,
a.user_auth_status,
b.original_receipt_flag,
b.freight_node,b.customer_nc_code
FROM "USER" a
LEFT JOIN user_shipper b ON a.user_id = b.user_id
left join (select user_id, LISTAGG(DISTINCT r.role_name, '&') WITHIN GROUP(ORDER BY r.role_name) AS roleName
from role r
left join user_role ur on r.role_id = ur.role_id and ur.del_flag = 1
where r.del_flag = 1
and role_code in ('shipper', 'company')
group by user_id) r on r.user_id = a.user_id
WHERE a.del_flag = 1
AND (b.del_flag = 1 OR b.del_flag IS NULL)
AND a.business_type IN (1,3)
and a.user_Id = #{userId}
/*一级组织ID*/
and a.top_organization_id = #{topOrganizationId}
and b.parent_shipper_id = #{parentShipperId}
/*用户组织ID*/
and a.organization_id = #{organizationId}
/*组织名称*/
and a.organization_name like concat('%' , #{organizationName} , '%')
/*姓名*/
/*姓名/手机号/邮箱*/
AND concat( a.user_name, a.user_phone, a.user_email ) LIKE concat ('%' , #{userName} , '%')
/*登录账号*/
and a.user_account like concat('%' , #{userAccount} , '%')
/*手机号*/
and a.user_phone like concat('%' , #{userPhone} , '%')
/*身份证号*/
and a.user_idcard_number like concat('%' , #{userIdcardNumber} , '%')
/*角色*/
and r.roleName like concat('%' , #{roleName} , '%')
/*实名认证状态*/
and a.user_auth_status = #{userAuthStatus}
/*托运人认证*/
and b.shipper_fill = #{shipperAuthStatus}
/*托运企业认证*/
and b.shipper_enterprise_fill = #{shipperEnterpriseFill}
/*身份证有效期*/
and DATE_FORMAT(a.user_idcard_date_from,'%Y-%m-%d') =]]>
DATE_FORMAT(#{userIdcardDateFrom},'%Y-%m-%d')
and DATE_FORMAT(a.user_idcard_date_to,'%Y-%m-%d')
DATE_FORMAT(#{userIdcardDateTo},'%Y-%m-%d')
/*详细地址*/
and a.user_area_address like concat('%' , #{userAreaAddress} , '%')
/*添加人员*/
and a.create_by_name like concat('%' , #{createByName} , '%')
/*审核人员*/
and b.shipper_fill_auth_name like concat('%' , #{shipperAuthByUsername} , '%')
/*添加时间*/
and DATE_FORMAT(a.create_time,'%Y-%m-%d') =]]>
DATE_FORMAT(#{createTimeFrom},'%Y-%m-%d')
and DATE_FORMAT(a.create_time,'%Y-%m-%d')
DATE_FORMAT(#{createTimeTo},'%Y-%m-%d')
/*审核时间*/
and DATE_FORMAT(b.shipper_fill_time,'%Y-%m-%d') =]]>
DATE_FORMAT(#{userAuthTimeFrom},'%Y-%m-%d')
and DATE_FORMAT(b.shipper_fill_time,'%Y-%m-%d')
DATE_FORMAT(#{userAuthTimeTo},'%Y-%m-%d')
/*企业名称*/
and b.shipper_enterprise_name like concat('%' , #{shipperEnterpriseName} , '%')
/*企业统一社会信用代码*/
and b.shipper_enterprise_social_credit_code like concat('%' , #{shipperEnterpriseSocialCreditCode} , '%')
/*企业营业期限*/
and DATE_FORMAT(b.shipper_enterprise_license_date_to,'%Y-%m-%d') =]]>
DATE_FORMAT(#{shipperEnterpriseLicenseDateFrom},'%Y-%m-%d')
and DATE_FORMAT(b.shipper_enterprise_license_date_to,'%Y-%m-%d')
DATE_FORMAT(#{shipperEnterpriseLicenseDateTo},'%Y-%m-%d')
/*添加人员*/
and b.create_by = #{createBy}
/* 组织ID集合 */
AND a.organization_id IN
#{organizationId}
and a.create_by = #{createBy}
AND a.organization_id in
#{id}
AND (a.organization_id in
#{id}
OR a.create_by = #{createBy})