首页 > 数据库 >导出guide_data.sh数据库脚本内的内容整理

导出guide_data.sh数据库脚本内的内容整理

时间:2023-09-15 15:59:20浏览次数:52  
标签:status data userId oa id sh ou open guide

/home/weihu1/guide_data.sh脚本内容如下:
###############################################################################

请选择以下项目:
1.导物流信息

mysql -h172.18.136.74 -ubss_reader -pzF4GfdKV9FfsQ7Jv -P3306 -Ne "use bss; select o.system_num as systemNum, o.status_code as statusCode,o.status,d.delivery_express as deliveryExpress,d.delivery_no as deliveryNo
from
order_base_info o, delivery_info_dt d
where o.id = d.order_base_id and o.create_time >= '2023-01-01' and o.create_time < '2023-02-01'
and d.delivery_no != '' and d.delivery_no is not null; " > /home/weihu/haoka_tuisongnew.txttest
;;
2.导管理员信息

mysql -A -h172.18.136.74 -ujiangsu -pHj+2vbgOEw0= -P3306 -Ne "use open_jiangsu;select loginId,loginName,mobilePhone,email,domain,createTime,groupName from open_admininfo" >/home/weihu1/data_export/guanliperson.txt
;;
3.导部分充值金额

mysql -h172.18.136.74 -ubss_reader -pzF4GfdKV9FfsQ7Jv -P3306 -Ne "use bss; select i.offer_name,i.status,i.create_time,i.offer_id,i.site_name,i.user_id,b.city,b.acc_nbr,i.history_balance/100,i.delivery_type from order_base_info i left join (select d.acc_nbr,d.cust_name,d.active_time,p.city,d.order_base_id from biz_info_dt d left join open_phone_region p on left(d.acc_nbr,7) = p.numberPrefix) b on i.id = b.order_base_id where i.create_time between '2023-01-01 00:00:00' and '2023-01-31 23:59:59' and i.delivery_type='SFPS' and i.status = '交易成功' group by i.system_num;" > /home/weihu1/haoka_202301new.txttest
;;
4.输出号卡订单的商品编码、用户ID、收获省份、对应号码详情

mysql -A -h172.18.136.74 -ubss_reader -pzF4GfdKV9FfsQ7Jv -P3306 -Ne "use bss;select b.acc_nbr,o.activate_time,o.good_code,o.user_id,d.delivery_provice from order_base_info o ,biz_info_dt b ,delivery_info_dt d where o.id = b.order_base_id and o.id = d.order_base_id and o.status_code = 5 and o.activate_time > '2023-01-01 00:00:00' and o.activate_time <= '2023-12-31 23:59:59' and b.acc_nbr in
('18351140207',
'15850746816') order by b.acc_nbr;" >/home/weihu1/qudao.txt

;;
5.输出用户ID和渠道名称的对应信息表

mysql -h172.18.136.74 -ujiangsu -P3306 -pHj+2vbgOEw0= -Ne "use open_jiangsu;select a.userId , a.userName , b.companyName,a.channelId from open_user a , open_verification b where a.userId = b.userId ;" >/home/weihu1/company.name

;;
6.导出pany信息

mysql -h172.18.136.74 -ujiangsu -P3306 -pHj+2vbgOEw0= -Ne "use open_jiangsu;select a.userId,a.userName,b.companyName,a.createTime,d.eaName
from open_user a, open_verification b,open_eaapply c ,open_eainfo d
where a.userId = b.userId and b.devType = 2 and a.userId=c.userId and c.eaId=d.eaId and a.status= 1;" >/home/weihu1/data_export/pany.txt
;;


7.导出pany2信息

mysql -h172.18.136.74 -ujiangsu -P3306 -pHj+2vbgOEw0= -Ne "use open_jiangsu;select u.userName,a.id as appId,a.appName,d.eaName from open_appinfo a,open_app_billstrategy b ,open_user u,open_eainfo d where a.userId = u.userId and b.eaId in (52,56,60) and a.id = b.appId and b.eaId = d.eaId and a.isDelete = 0 ORDER BY a.id;" >/home/weihu1/data_export/pany2.txt
;;
8.导出南通地市充值信息

mysql -h172.18.136.74 -uhmm -P3306 -pzF4GfdKV9FfsQ7Jv -Ne "use hmm;select acc_nbr, system_num, card_system_num, promote_contact from hmm_operator_order where create_time >= '2023-08-01' and create_time < '2023-08-24' and city_id = 20 and order_type = 2 and status_code not in ('9') and delete_flag = 1;" >/home/weihu1/nantong.txt
;;
9.导出代理商管理表信息

echo "得到MySQL终端里面去导出,使用limit固定行语句"
mysql -h172.18.136.74 -ujiangsu -P3306 -pHj+2vbgOEw0= -Ne "use open_jiangsu;select a.userId,a.channelId,a.userName,b.companyName,cast(AES_DECRYPT(from_base64(realName),'cmccheli') as char) as realName,a.createTime,a.status from open_user a, open_verification b where a.userId = b.userId and b.devType = 2 ;" > /home/weihu1/kaifashang.txt
;;

12.把应用管理拉个清单出来  ,包括ip地址和绑定能力,开发者的门户ip地址也导出

mysql -h172.18.136.74 -ujiangsu -P3306 -pHj+2vbgOEw0= -Ne "use open_jiangsu;select oa.appName as '应用名称' ,oi.ipAddress as '绑定IP地址',oe.eaName as '绑定能力' ,ou.userId as '开发者账号id',ou.userName as '开发者账号',
(case when oa.status = 2 then '审核通过'
when oa.status = 3 then '审核不通过'
when oa.status = 4 then '待审核'
when oa.status = 5 then '冻结'
when oa.status = 6 then '待审核' end) as '应用状态',
ov.realName as '联系人',l.devportal_ip as '门户IP地址'
from open_appinfo oa ,open_ipstrategy oi ,open_app_billstrategy oab ,open_user ou,open_user_ip_white_list l,open_eainfo oe,open_verification ov
where oa.id = oi.appId and oa.id = oab.appId and oab.eaId =oe.eaId and oa.userId = ou.userId and ou.userId =l.user_id and ou.userId =ov.userId ;" >/home/weihu1/data_export/app.txt

第二种写法:::

select oa.appName as '应用名称' ,oi.ipAddress as '绑定IP地址',oe.eaName as '绑定能力' ,ou.userId as '开发者账号id',ou.userName as '开发者账号',
(case when oa.status = 2 then '审核通过'
when oa.status = 3 then '审核不通过'
when oa.status = 4 then '待审核'
when oa.status = 5 then '冻结'
when oa.status = 6 then '待审核' end) as '应用状态',

################对联系人姓名进行解密##############################
cast(AES_DECRYPT(from_base64(ov.realName),'cmccheli') as char) as '联系人',l.devportal_ip as '门户IP地址'
from open_appinfo oa ,open_ipstrategy oi ,open_app_billstrategy oab ,open_user ou,open_user_ip_white_list l,open_eainfo oe,open_verification ov
where oa.id = oi.appId and oa.id = oab.appId and oab.eaId =oe.eaId and oa.userId = ou.userId and ou.userId =l.user_id and ou.userId =ov.userId ;


EOF


10)
mysql -h172.18.136.74 -ubss_reader -pzF4GfdKV9FfsQ7Jv -P3306 -Ne "use bss;select b.acc_nbr,d.delivery_provice,d.delivery_city,d.delivery_country,AES_DECRYPT(from_base64(d.delivery_addr),'cmccheli') from order_base_info o ,biz_info_dt b ,delivery_info_dt d where o.id = b.order_base_id and o.id = d.order_base_id and o.status_code = 5 and o.activate_time >'2023-03'and b.acc_nbr in ('13914655184',
'15295171945',
'18360462235',
'18261832286',
'19816019165');" >/home/weihu1/new.txt
;;
11)
mysql -h172.18.136.74 -ujiangsu -P3306 -pHj+2vbgOEw0= -Ne "use open_jiangsu; select ou.userId,oa.appName ,oi.ipAddress from open_user ou ,open_appinfo oa ,open_ipstrategy oi where oa.id = oi.appId and ou.userId =oa.userId and oi.ipAddress is not null and ou.userId in (70, 276, 496, 531, 661, 781, 1246, 1366, 1426, 1541, 1566, 1621, 1626, 1636, 1646, 1676, 1711, 1681, 1776, 1771, 1871, 1881, 1886, 1891, 1906, 1931, 1951, 1941, 2041, 2046, 2101, 2096, 2091, 2157, 2197, 2266, 2271, 2276, 2301, 2311, 2326, 2341, 2351, 2366, 2371, 2376, 2401, 2391, 2421, 2446, 2461, 2486, 2476, 2491, 2511, 2501, 2521, 2546, 2561, 2566, 2571, 2611, 2626, 2631, 2636, 2666, 2676, 2701, 2736, 2741, 2746, 2751, 2761, 2766, 2791, 2796, 2826, 2831, 511);" >/home/weihu1/data_export/kafadata.txt
;;

###############################################################################

 

标签:status,data,userId,oa,id,sh,ou,open,guide
From: https://www.cnblogs.com/cherishthepresent/p/17705160.html

相关文章

  • shell脚本中使用ssh链接服务器
    1.建立从服务器A-》B的ssh免密登录2.在shell脚本中使用ssh3.遇到的问题:3.1 不会分配伪终端,因为stdin不是终端   Pseudo-terminalwillnotbeallocatedbecausestdinisnotaterminal.  Activatethewebconsolewith:systemctlenable--nowcockpit.socket......
  • Azure Data Factory(八)数据集验证之服务主体(Service Principal)
    一,引言如下图所示,今天我们接着上一篇内容,继续讲解AzureDataFactory中的数据集连接服务的认证方式:ServicePrincipal关于ServicePrincipal的创建可以参考:AzureAD(四)知识补充-服务主体至于需要给ServicePrincipal分配什么样的角色和权限,大家可以自行参考实际项目......
  • 关于配置MCU从FLASH某一位置开始运行——以CH32V203为例
    正常MCU运行时,都是从FLASH0起始地址开始运行,有时因为某些需要,需要配置从非0地址开始运行。以CH32V203为例(适用于其他CH32V系列),主要修改配置如下:主要集中在ld文件的修改:1、修改FLASH的分配,将FLASH分配成2块区域,如下图/*CH32V20x_D6-CH32V203K8-CH32V203C8-CH32V203G8-CH32V......
  • scp、ssh访问远程机器不用输入密码
    在linux操作系统中,可以使用scp命令进行服务器之间的文件复制,但是复制时需要输入远程服务器的密码,这在经常需要进行远程复制操作或者使用脚本复制时会略显麻烦,如果远程复制是在定时任务中执行,更会导致脚本不能自动执行,这时就需要实现无需输入密码进行scp复制。无需输入密码进行scp......
  • BOSHIDA DC电源模块单路、双路输出的不同应用场景
    三河博电科技BOSHIDADC电源模块单路、双路输出的不同应用场景DC电源模块是一种常见的供电设备,通常用于将市电转换为稳定的直流电源,以供电给各种电子设备。DC电源模块的输出方式分为单路和双路两种,下面将分别介绍它们的不同应用场景。 一、单路输出单路输出的DC电源模块通......
  • MySQL索引详解(Hash、AVL、红黑树、B、B+)
    MySQL索引详解|JavaGuide(Java面试+学习指南)索引介绍索引是一种用于快速查询和检索数据的数据结构,其本质可以看成是一种排序好的数据结构。索引的作用就相当于书的目录。打个比方:我们在查字典的时候,如果没有目录,那我们就只能一页一页的去找我们需要查的那个字,速度很慢。......
  • Shell 输入/输出重定向
    大多数UNIX系统命令从你的终端接受输入并将所产生的输出发送回到您的终端。一个命令通常从一个叫标准输入的地方读取输入,默认情况下,这恰好是你的终端。同样,一个命令通常将其输出写入到标准输出,默认情况下,这也是你的终端。重定向命令列表如下:命令说明command>file将输出......
  • Shell 函数
    linuxshell可以用户定义函数,然后在shell脚本中可以随便调用。shell中函数的定义格式如下:[ function ] funname [()]{    action;    [return int;]}说明:1、可以带functionfun() 定义,也可以直接fun()定义,不带任何参数。2、参数返回,可以显示加......
  • ssh用户限制(ubuntu)
    1.限制用户SSH登录只允许指定用户进行登录(白名单):在/etc/ssh/sshd_config配置文件中设置AllowUsers选项,(配置完成需要重启SSHD服务)格式如下:[email protected].*[email protected]#允许user1、192.168.5网段的user2和192.168.122.1的user3连接只拒绝......
  • DHCP抓包-Wireshark分析
    1、DHCP协议DHCP(动态主机配置协议)是一个局域网的网络协议。指的是由服务器控制一段IP地址范围,客户机登录服务器时就可以自动获得服务器分配的IP地址和子网掩码。DHCP采用UDP的68(客户端)和67(服务器)端口进行通信。2、Wireshark抓包分析工具Wireshark(前称Ethereal)是一个网络封包分析软......