tecdoc:requetesql

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision
Révision précédente
tecdoc:requetesql [2024/08/28 08:21]
mamadou.gueye_sensoft.sn
tecdoc:requetesql [2025/02/10 14:34] (Version actuelle)
mamadou.gueye_sensoft.sn
Ligne 3: Ligne 3:
 Le but de cette documentation est de lister puis de commenter les différentes requêtes SQL qui sont les plus utilisés au sein sur CYNOD.\\ Le but de cette documentation est de lister puis de commenter les différentes requêtes SQL qui sont les plus utilisés au sein sur CYNOD.\\
  
-* **Récupérer le code Pin d'un client Wallet**+<code sql> 
 +-- Récupérer le code Pin d'un client Wallet**
  
-<color #00a2e8>select pin \\ +select pin 
-from wallet ​\\ +from wallet 
-where wallet_id=22791746657;</color>\\+where wallet_id=22791746657 
 +</code>
  
-* **Augmenter la durée de validité des cartes sur X années**+<code sql> 
 +-- Augmenter la durée de validité des cartes sur X années**
  
-<color #​00a2e8> ​update carte c set \\ +update carte c set 
-user_update = "​sensoft_arame", ​\\ +user_update = "​sensoft_arame",​ 
-last_updated = Now(), ​\\ +last_updated = Now(), 
-version = version + 1, \\ +version = version + 1, 
-fin_validite = date_add(c.fin_validite , INTERVAL 2 YEAR) \\ +fin_validite = date_add(c.fin_validite , INTERVAL 2 YEAR) 
-where \\ +where 
-c.statut = "​VA" ​\\ +c.statut = "​VA"​ 
-and c.is_genere = false \\ +and c.is_genere = false 
-and ind_corporate = false; ​\\ +and ind_corporate = false; 
-</color>\\+</code>
  
-* **Remettre le statut de bon de commande ticket a généré pour impression de la maquette PDF **\\+<code sql> 
 +-- Remettre le statut de bon de commande ticket a généré pour impression de la maquette PDF
  
-<color #00a2e8>update bon_commande ​ b\\ +update bon_commande ​ b 
-set b.statut = "​G",​\\ +set b.statut = "​G",​ 
-b.version ​ = b.version + 1,\\ +b.version ​ = b.version + 1, 
-b.user_update = "​sensoft_mamadou",​\\ +b.user_update = "​sensoft_mamadou",​ 
-b.last_updated =now()\\ +b.last_updated =now() 
-where \\ +where  
-b.reference like "​%2104112023070223%";</​color>\\+b.reference like "​%2104112023070223%";​ 
 +</code>
  
-* ** Listes des notifications non délivrées par SMSGW **\\+<code sql> 
 +-- Listes des notifications non délivrées par SMSGW
  
-<color #00a2e8>select ​\\ +select 
-c.version, c.code_etatsms,​c.cout_service_sms,​ c.com_message_indiv_source_id,​c.date_envoi_sms,​ date_message,​c.cout_service_sms,​\\ c.date_created,​last_updated ,​c.libelle_service,​c.numero_destinataire,​c.sender_etablissement_code,​c.source,​c.type_service,​\\ c.max_sms_resend_retry,​country_code ,​c.flag_envoi_sms +"​0",​c.flag_traitement_sms +"​0",​ c.ind_service_sms_facture +"​0",​c.ind_service_sms_paye +"​0",​\\ c.sms_resend_retry +"​0"​\\ +c.version, c.code_etatsms,​c.cout_service_sms,​ c.com_message_indiv_source_id,​c.date_envoi_sms,​ date_message,​c.cout_service_sms,​ c.date_created,​last_updated ,​c.libelle_service,​c.numero_destinataire,​c.sender_etablissement_code,​c.source,​c.type_service,​ c.max_sms_resend_retry,​country_code ,​c.flag_envoi_sms +"​0",​c.flag_traitement_sms +"​0",​ c.ind_service_sms_facture +"​0",​c.ind_service_sms_paye +"​0",​ c.sms_resend_retry +"​0"​ 
-from\\ +from 
-com_message_indiv_web_service c \\+com_message_indiv_web_service c
 where  where 
-date_created >​="​2022-11-18 18:​00:​00" ​\\ +date_created >​="​2022-11-18 18:​00:​00"​ 
-and flag_envoi_sms = 0; </color>\\+and flag_envoi_sms = 0; 
 +</code>
  
-* ** Lever l'​opposition ticket carburant expiré ​**\\+<code sql> 
 +-- Lever l'​opposition ticket carburant expiré
  
-<color #​00a2e8>​ +update 
-update ​\\ +ticket_carburant 
-ticket_carburant ​\\ +set 
-set \\ +last_updated = now(), 
-last_updated = now(),\\ +comptabilise = 0, 
-comptabilise = 0,\\ +fin_validation = "​2023-02-15 23:​59:​59",​ 
-fin_validation = "​2023-02-15 23:​59:​59",​\\ +user_update = "​m.wade",​ 
-user_update = "​m.wade",​\\ +version = version + 1 
-version = version + 1 \\ +where 
-where \\ +numero between "​2000640000000001"​ and "​2000640000001846"​ 
-numero between "​2000640000000001"​ and "​2000640000001846" ​\\ +and statut = "​V";​ 
-and statut = "​V";</​color>\\+</code>
  
-* ** Lever l'​opposition des tickets carburant valides et archivés ​**\\+<code sql> 
 +-- Lever l'​opposition des tickets carburant valides et archivés
  
-Etape 1- Transférer les tickets archivés depuis la table historique vers la table principale ticket carburant ​\\+Etape 1- Transférer les tickets archivés depuis la table historique vers la table principale ticket carburant
  
-<color #​00a2e8>​ +INSERT INTO ticket_carburant 
-INSERT INTO ticket_carburant ​\\ +(id, 
-(id,\\ +version, 
-version,\\ +comptabilise,​ 
-comptabilise,​\\ +date_created,​ 
-date_created,​\\ +date_validation,​ 
-date_validation,​\\ +deleted, 
-deleted,\\ +etablissement_id,​ 
-etablissement_id,​\\ +fin_validation,​ 
-fin_validation,​\\ +last_updated,​ 
-last_updated,​\\ +lot_ticket_detail_id,​ 
-lot_ticket_detail_id,​\\ +montant, 
-montant,\\ +numero, 
-numero,\\ +qr_code, 
-qr_code,\\ +service_point_consommation,​ 
-service_point_consommation,​\\ +statut, 
-statut,\\ +user_consommation,​ 
-user_consommation,​\\ +user_create,​ 
-user_create,​\\ +user_update,​ 
-user_update,​\\ +user_validation,​ 
-user_validation,​\\ +volume, 
-volume,\\ +code_secret,​ 
-code_secret,​\\ +opposition_ticket_id) 
-opposition_ticket_id)\\ +(select 
-(select ​\\ +id, 
-id,\\ +version, 
-version,\\ +comptabilise,​ 
-comptabilise,​\\ +date_created,​ 
-date_created,​\\ +date_validation,​ 
-date_validation,​\\ +deleted, 
-deleted,\\ +etablissement_id,​ 
-etablissement_id,​\\ +fin_validation,​ 
-fin_validation,​\\ +last_updated,​ 
-last_updated,​\\ +lot_ticket_detail_id,​ 
-lot_ticket_detail_id,​\\ +montant, 
-montant,\\ +numero, 
-numero,\\ +qr_code, 
-qr_code,\\ +service_point_consommation,​ 
-service_point_consommation,​\\ +statut, 
-statut,\\ +user_consommation,​ 
-user_consommation,​\\ +user_create,​ 
-user_create,​\\ +user_update,​ 
-user_update,​\\ +user_validation,​ 
-user_validation,​\\ +volume, 
-volume,\\ +code_secret,​ 
-code_secret,​\\ +opposition_ticket_id 
-opposition_ticket_id\\ +from historique_ticket_carburant 
-from historique_ticket_carburant ​\\ +where numero between "​822001960000048586"​ 
-where numero between "​822001960000048586" ​\\ +and "​822001960000048785";​
-and "​822001960000048785";​</​color>​\\+
  
-Etape 2- Suppression des tickets carburant sur la table historique ​\\+Etape 2- Suppression des tickets carburant sur la table historique
  
-<color #00a2e8>delete from \\ +delete from  
-historique_ticket_carburant ​\\ +historique_ticket_carburant 
-where \\ +where 
-numero between "​822001960000048586" ​\\ +numero between "​822001960000048586"​ 
-and "​822001960000048785";​</​color>​\\+and "​822001960000048785";​
  
-Etape 3- Lever l'opposition des tickets carburant\\+Etape 3- Lever opposition des tickets carburant
  
-<color #00a2e8>update ticket_carburant set \\ +update ticket_carburant set 
-statut = "​V",​\\ +statut = "​V",​ 
-last_updated = now(),\\ +last_updated = now(), 
-comptabilise = 0,\\ +comptabilise = 0, 
-user_update = "​mindinga",​\\ +user_update = "​mindinga",​ 
-fin_validation = "​2023-02-15 23:​59:​59",​\\ +fin_validation = "​2023-02-15 23:​59:​59",​ 
-version = version + 1\\ +version = version + 1 
-where\\ +where 
-numero between "​822001960000048586"​ and "​822001960000048785" ​\\ +numero between "​822001960000048586"​ and "​822001960000048785"​ 
-and statut = "​X" ​\\ +and statut = "​X"​ 
-and opposition_ticket_id is not NULL;</color>\\+and opposition_ticket_id is not NULL; 
 +</code>
  
-* ** Mettre à jour la matrice de version ​**\\+<code sql> 
 +-- Mettre à jour la matrice de version
  
-<color #00a2e8>INSERT INTO matrice_version ​\\ +INSERT INTO matrice_version 
-(version, ​\\ +(version, 
-action, ​\\ +action, 
-date_created, ​\\ +date_created,​ 
-date_version_mobile, ​\\ +date_version_mobile,​ 
-date_version_serveur, ​\\ +date_version_serveur,​ 
-deleted, ​\\ +deleted, 
-etablissement_id, ​\\ +etablissement_id,​ 
-last_updated, ​\\ +last_updated,​ 
-user_create, ​\\ +user_create,​ 
-user_update, ​\\ +user_update,​ 
-version_mobile, ​\\ +version_mobile,​ 
-version_serveur)\\ +version_serveur) 
-VALUES\\ +VALUES 
-(1,\\ +(1, 
-"​OK",​\\ +"​OK",​ 
-now(),\\ +now(), 
-now(),\\ +now(), 
-now(), ​\\ +now(), 
-False,\\ +False, 
-1,\\ +1, 
-now(),\\ +now(),
-"​amadou.diop",​\\+
 "​amadou.diop",​ "​amadou.diop",​
-"​3.1.16",​\\ +"​amadou.diop",​ 
-"​3.6.2_4"​);</​color>\\+"​3.1.16",​ 
 +"​3.6.2_4"​);​ 
 +</code>
  
-* ** Afficher la liste des notifications PIN générés côté BO sur une période ​**\\+<code sql> 
 +-- Afficher la liste des notifications PIN générés côté BO sur une période
  
-<color #00a2e8>select ​\\ +select 
-c.date_depot,​ c.date_traitement,​ c.ind_msg_email+"​0",​ c.ind_msg_releve+"​0",​ c.ind_msg_valide+"​0",​\\ c.ind_traitement+"​0",​cm.is_email_sent+"​0",​cm.date_envoi,​cm.is_sms_sent+"​0",​cm.date_created,​cm.date_envoi_sms,​cm.flag_envoi_sms+"​0",​\\ flag_envoi_email+"​0",​cm.ws_error_code,​cm.ws_error_code_sms,​cm.ws_error_code_mail,​\\ +c.date_depot,​ c.date_traitement,​ c.ind_msg_email+"​0",​ c.ind_msg_releve+"​0",​ c.ind_msg_valide+"​0",​ c.ind_traitement+"​0",​cm.is_email_sent+"​0",​cm.date_envoi,​cm.is_sms_sent+"​0",​cm.date_created,​cm.date_envoi_sms,​cm.flag_envoi_sms+"​0",​ flag_envoi_email+"​0",​cm.ws_error_code,​cm.ws_error_code_sms,​cm.ws_error_code_mail,​ 
-cm.code_etatsms,​c.objet,​ u.email, u.tel_mobile ​\\  +cm.code_etatsms,​c.objet,​ u.email, u.tel_mobile 
-from \\ +from 
-com_message c, com_message_indiv cm, user u \\ +com_message c, com_message_indiv cm, user u 
-where \\ +where 
-c.date_created BETWEEN '​2022-10-24'​ and '​2022-10-29' ​\\ +c.date_created BETWEEN '​2022-10-24'​ and '​2022-10-29'​ 
-and cm.com_message_id = c.id \\ +and cm.com_message_id = c.id 
-and cm.destinataire_individuel_id = u.id\\  +and cm.destinataire_individuel_id = u.id 
-and c.objet like "​%pin%";</​color>\\+and c.objet like "​%pin%";​ 
 +</code>
  
-* ** Prolonger la date de fin de validité d'une carte **\\+<code sql> 
 +-- Prolonger la date de fin de validité d'une carte
  
-Etape 1- Lister des cartes expirant sur une période ​\\ +Etape 1- Lister des cartes expirant sur une période ​
  
-<color #00a2e8>select c.intitule, c.num_carte,​ c.solde_online,​ c.debut_validite,​ c.fin_validite ​\\ +select c.intitule, c.num_carte,​ c.solde_online,​ c.debut_validite,​ c.fin_validite 
-from carte c \\ +from carte c 
-where  \\ +where  
-c.fin_validite >= STR_TO_DATE('​01/​01/​2021 00:​00',​ '​%d/​%m/​%Y %H:​%i'​) AND c.fin_validite <= STR_TO_DATE('​31/​12/​2021 23:​59',​ '​%d/​%m/​%Y %H:​%i'​) ​\\ +c.fin_validite >= STR_TO_DATE('​01/​01/​2021 00:​00',​ '​%d/​%m/​%Y %H:​%i'​) AND c.fin_validite <= STR_TO_DATE('​31/​12/​2021 23:​59',​ '​%d/​%m/​%Y %H:​%i'​) 
- and c.ind_annulation = false \\ + and c.ind_annulation = false 
- and c.statut = "​VA" ​\\ + and c.statut = "​VA"​ 
- and c.is_genere = false \\ + and c.is_genere = false 
- and c.ind_corporate = false order by c.fin_validite,​c.intitule desc;</​color>​\\+ and c.ind_corporate = false order by c.fin_validite,​c.intitule desc;
  
-Etape 2- Mettre à jour les cartes expirant sur une période ​\\+Etape 2- Mettre à jour les cartes expirant sur une période
  
-<color #00a2e8>update carte c set user_update = "​sensoft_mamadou", ​\\ +update carte c set user_update = "​sensoft_mamadou",​ 
-last_updated = Now(),\\ +last_updated = Now(), 
-version = version + 1,\\ +version = version + 1, 
-fin_validite = '​2022-12-31 23:​59:​59', ​\\ +fin_validite = '​2022-12-31 23:​59:​59',​ 
-ind_annulation = false\\ +ind_annulation = false 
-where fin_validite >= STR_TO_DATE('​01/​01/​2022 00:​00',​ '​%d/​%m/​%Y %H:​%i'​) AND fin_validite <= STR_TO_DATE('​30/​06/​2022 23:​59',​ '​%d/​%m/​%Y %H:​%i'​)\\ +where fin_validite >= STR_TO_DATE('​01/​01/​2022 00:​00',​ '​%d/​%m/​%Y %H:​%i'​) AND fin_validite <= STR_TO_DATE('​30/​06/​2022 23:​59',​ '​%d/​%m/​%Y %H:​%i'​) 
-and c.statut = "​VA"​\\ +and c.statut = "​VA"​ 
-and c.is_genere = false\\ +and c.is_genere = false 
-and ind_corporate = false;</color>\\+and ind_corporate = false; 
 +</code>
  
-* **Lever opposition des cartes mises en opposition automatiquement et prolonger la date de fin de validité ​**\\+<code sql> 
 +-- Lever opposition des cartes mises en opposition automatiquement et prolonger la date de fin de validité
  
-Etape 1- Lister des cartes expirées sur la période ​\\+Etape 1- Lister des cartes expirées sur la période
  
-<color #00a2e8>Create table tmp_carte_levee_opposition as \\ +Create table tmp_carte_levee_opposition as 
-Select *\\ +Select * 
-From carte c\\ +From carte c 
-where fin_validite >= "​2021-01-01 00:​00:​00"​ and fin_validite <= "​2021-12-31 23:​59:​59"​ and is_point_service = FALSE\\ +where fin_validite >= "​2021-01-01 00:​00:​00"​ and fin_validite <= "​2021-12-31 23:​59:​59"​ and is_point_service = FALSE 
-and c.deleted = false\\ +and c.deleted = false 
-and c.is_genere = false\\ +and c.is_genere = false 
-and c.ind_annulation = True\\ +and c.ind_annulation = True 
-and c.ind_corporate = false;</​color>​\\+and c.ind_corporate = false;
  
-Etape 2- Mettre à jour les cartes expirées\\+Etape 2- Mettre à jour les cartes expirées
  
-<color #00a2e8>update tmp_carte_levee_opposition tmp, carte c \\ +update tmp_carte_levee_opposition tmp, carte c 
-set c.user_update = "​sensoft_mamadou",​\\ +set c.user_update = "​sensoft_mamadou",​ 
-c.last_updated = Now(),\\ +c.last_updated = Now(), 
-c.version = c.version +1,\\ +c.version = c.version +1, 
-c.fin_validite = '​2024-12-31 23:​59:​59',​\\ +c.fin_validite = '​2024-12-31 23:​59:​59',​ 
-c.statut="​VA",​\\ +c.statut="​VA",​ 
-c.ind_annulation = false\\ +c.ind_annulation = false 
-Where c.id = tmp.id;</​color>​\\+Where c.id = tmp.id;
  
-Etape 3- Transférer les cartes depuis la table historique vers la table carte\\+Etape 3- Transférer les cartes depuis la table historique vers la table carte
  
-<color #00a2e8>INSERT INTO opposition_carte\\ +INSERT INTO opposition_carte 
-(`version`,\\ +(`version`,​ 
-`carte_id`,\\ +`carte_id`,​ 
-`date_created`,​\\ +`date_created`,​ 
-`date_opposition`,​\\ +`date_opposition`,​ 
-`deleted`,\\ +`deleted`,​ 
-`etablissement_id`,​\\ +`etablissement_id`,​ 
-`ind_opposition`,​\\ +`ind_opposition`,​ 
-`last_updated`,​\\ +`last_updated`,​ 
-`motif`,\\ +`motif`, 
-`opposition`,​\\ +`opposition`,​ 
-`user_create`,​\\ +`user_create`,​ 
-`utilisateur_saisi`,​\\ +`utilisateur_saisi`,​ 
-`from_portal`)\\+`from_portal`)
  
-select ​\\ +select  
-op.`version`,​\\ +op.`version`,​ 
-op.`carte_id`,​\\ +op.`carte_id`,​ 
-NOW(),\\ +NOW(), 
-NOW(),\\ +NOW(), 
-op.`deleted`,​\\ +op.`deleted`,​ 
-op.`etablissement_id`,​\\ +op.`etablissement_id`,​ 
-0,\\ +0, 
-NOW(),\\ +NOW(), 
-op.`motif`,\\ +op.`motif`,​ 
-op.`opposition`,​\\ +op.`opposition`,​ 
-"​sensoft_mamadou",​\\ +"​sensoft_mamadou",​ 
-"​sensoft_mamadou",​\\ +"​sensoft_mamadou",​ 
-op.`from_portal`\\ +op.`from_portal` 
-From \\ +From 
- opposition_carte op,\\ + opposition_carte op, 
- tmp_carte_levee_opposition tmp\\ + tmp_carte_levee_opposition tmp 
-Where op.carte_id = tmp.id;</​color>​\\+Where op.carte_id = tmp.id;
  
-Etape 4- Mettre à jour la colonne opposition_carte_id de la table carte\\+Etape 4- Mettre à jour la colonne opposition_carte_id de la table carte
  
-<color #​00a2e8>​ +SET SQL_SAFE_UPDATES = 0; 
-SET SQL_SAFE_UPDATES = 0;\\ +update carte c 
-update carte c\\ +set c.opposition_carte_id = (select o.id from opposition_carte o where o.carte_id = c.id order by o.date_created DESC limit 1) 
-set c.opposition_carte_id = (select o.id from opposition_carte o where o.carte_id = c.id order by o.date_created DESC limit 1) \\ +where c.deleted = FALSE;
-where c.deleted = FALSE;</​color>​\\+
  
-Etape 5- Supprimer la table temporaire\\+Etape 5- Supprimer la table temporaire
  
-<color #00a2e8>drop table tmp_carte_levee_opposition;​\\ +drop table tmp_carte_levee_opposition;​ 
-</color>+</code>
  
-* ** Rendre une carte mise en opposition automatiquement visible sur la fonctionnalité levée opposition ​**\\+<code sql> 
 +-- Rendre une carte mise en opposition automatiquement visible sur la fonctionnalité levée opposition
  
-<color #00a2e8>update carte\\ +update carte 
-set\\ +set 
-version = version + 1,\\ +version = version + 1, 
-last_updated = NOW(),\\ +last_updated = NOW(), 
-user_update = "​sensoft_mamadou",​\\ +user_update = "​sensoft_mamadou",​ 
-ind_annulation = false,\\ +ind_annulation = false, 
-fin_validite = "​2025-01-13"​\\ +fin_validite = "​2025-01-13"​ 
-where num_carte in ("​5812340100034468","​5812340100034088"​);</​color>\\+where num_carte in ("​5812340100034468","​5812340100034088"​);​ 
 +</code>
  
-* **Lever opposition d'une carte mise en opposition automatiquement et prolonger la date de fin de validité ​**\\+<code sql> 
 +-- Lever opposition d'une carte mise en opposition automatiquement et prolonger la date de fin de validité
  
-Etape 1- Mettre à jour les cartes expirant sur une période ​\\+Etape 1- Mettre à jour les cartes expirant sur une période
  
-<color #00a2e8>update carte c \\ +update carte c 
-set c.user_update = "​GUELADIO BA",\\ +set c.user_update = "​GUELADIO BA", 
-c.last_updated = Now(),\\ +c.last_updated = Now(), 
-c.version = c.version + 1,\\ +c.version = c.version + 1, 
-c.fin_validite = '​2029-12-31 23:​59:​59',​\\ +c.fin_validite = '​2029-12-31 23:​59:​59',​ 
-c.statut="​VA",​\\ +c.statut="​VA",​ 
-c.ind_annulation = false\\ +c.ind_annulation = false 
-Where \\ +Where 
-c.num_carte ="​5812340100041448";​\\</​color>​+c.num_carte ="​5812340100041448";​
  
-Etape 2- Transférer la carte depuis la table historique vers la table carte\\+Etape 2- Transférer la carte depuis la table historique vers la table carte 
 + 
 +INSERT INTO opposition_carte( 
 +version, 
 +carte_id, 
 +date_created,​ 
 +date_opposition,​ 
 +deleted, 
 +etablissement_id,​ 
 +ind_opposition,​ 
 +last_updated,​ 
 +motif, 
 +opposition,​ 
 +user_create,​ 
 +utilisateur_saisi,​ 
 +from_portal) 
 + 
 +select 
 +op.version,​ 
 +op.carte_id,​ 
 +NOW(), 
 +NOW(), 
 +op.deleted,​ 
 +op.etablissement_id,​ 
 +0, 
 +NOW(), 
 +op.motif, 
 +op.opposition,​ 
 +"​GUELADIO BA", 
 +"​GUELADIO BA", 
 +op.from_portal  
 +From 
 +    opposition_carte op, 
 +    carte c 
 +Where op.carte_id = c.id  
 +and c.num_carte ="​5812340100041448";​ 
 + 
 +Etape 3- Mettre à jour la colonne opposition_carte_id de la table carte 
 + 
 +update carte c 
 +set c.opposition_carte_id = (select o.id from opposition_carte o where o.carte_id = c.id order by o.date_created DESC limit 1) 
 +where  
 +c.num_carte ="​5812340100041448";​ 
 +</​code>​
  
-<color #00a2e8>INSERT INTO opposition_carte(\\ +<code sql
-version,​\\ +-- Lister les opérations sans écriture
-carte_id,​\\ +
-date_created,​\\ +
-date_opposition,​\\ +
-deleted,​\\ +
-etablissement_id,​\\ +
-ind_opposition,​\\ +
-last_updated,​\\ +
-motif,\\ +
-opposition,​\\ +
-user_create,​\\ +
-utilisateur_saisi,​\\ +
-from_portal)\\+
  
-select \\ +SELECT 
-op.version,\\ +o.numero_operation
-op.carte_id,\\ +o.date_transaction
-NOW(),\\ +o.date_created
-NOW(),\\ +o.code_evenement
-op.deleted,\\ +o.montantttc
-op.etablissement_id,\\ +o.solde_avant_emission
-0,\\ +o.solde_apres_emmission
-NOW(),\\ +o.solde_avant_reception
-op.motif,\\ +o.solde_apres_reception
-op.opposition,\\ +o.motif
-"GUELADIO BA",\\ +o.ind_annulation+"0", 
-"GUELADIO BA",\\ +o.is_online + "0", 
-op.from_portal \\ +c.num_carte, 
-From\\ +c.intitule
-    opposition_carte op,\\ +c.fin_validite as "fin valite carte"​ 
-    carte c\\ +FROM operation o, carte c 
-Where op.carte_id ​= c.id \\ +WHERE o.numero_operation 
-and c.num_carte ​="​5812340100041448"​;\\</color>+AND o.statut = '​VA'​ 
 +AND o.deleted = false 
 +AND o.carte_emettrice_id ​= c.id 
 +AND c.statut ​'​VA'​ 
 +AND o.id NOT IN (SELECT ecriture.operation_id FROM ecriture) 
 +ORDER BY o.date_created DESC, c.intitule; 
 +</code>
  
-Etape 3Mettre à jour la colonne opposition_carte_id de la table carte\\+<code sql> 
 +-- Virtualiser une carte
  
-<color #00a2e8>update carte c\\ +  * update carte  set statut ​'​VA' ​where num_carte ​‘5812340101000260’;​ 
-set c.opposition_carte_id ​(select o.id from opposition_carte o where o.carte_id ​c.id order by o.date_created DESC limit 1)\\ +  * update lot_carte set statut = '​LV' ​where numero_lot ​=’3510’; 
-where \\ +</code>
-c.num_carte ​="​5812340100041448"​;\\</color>+
  
-* ** Lister les opérations n'​ayant pas générées ​d'écriture **\\+<code sql> 
 +-- Connaître le numéro de lot d'une carte
  
-<color #​00a2e8>​SELECT \\ +select l.numero_lot 
-o.numero_operation,​\\ +from lot_carte lcarte c 
-o.date_transaction,\\ +where c.num_carte ​="5812340100006805" ​and c.lot_carte_id=l.id; 
-o.date_created,​\\ +</code>
-o.code_evenement,​\\ +
-o.montantttc,​\\ +
-o.solde_avant_emission,​\\ +
-o.solde_apres_emmission,​\\ +
-o.solde_avant_reception,​\\ +
-o.solde_apres_reception,​\\ +
-o.motif,​\\ +
-o.ind_annulation+"​0",​\\ +
-o.is_online + "​0",​\\ +
-c.num_carte,\\ +
-c.intitule,​\\ +
-c.fin_validite as "fin valite carte" ​\\ +
-FROM operation o, carte c\\ +
-WHERE o.numero_operation\\ +
-AND o.statut ​'​VA'​\\ +
-AND o.deleted = false\\ +
-AND o.carte_emettrice_id = c.id\\ +
-AND c.statut = '​VA'​\\ +
-AND o.id NOT IN (SELECT ecriture.operation_id FROM ecriture)\\ +
-ORDER BY o.date_created DESC, c.intitule;</color>\\+
  
-* ** Virtualiser ​une carte ** \\+<code sql> 
 +-- Permettre d'​encoder à nouveau ​une carte
  
-  * <color #00a2e8>update carte  set statut = 'VA' where num_carte = ‘5812340101000260’;</​color>​\\ +  * update carte  set statut = 'IM' where num_carte="​5812340100049854"​
-  * <color #00a2e8>update lot_carte set statut = 'LV' where numero_lot =’3510’;</color>\\+  * update lot_carte set statut = 'IM' where numero_lot = "​1810"​; 
 +</code>
  
-* ** Connaître le numéro de lot d'une carte **\\ +<code sql> 
-<color #​00a2e8>​select l.numero_lot \\ +-- Permettre ​d'imprimer à nouveau ​une carte
-from lot_carte l, carte c \\ +
-where c.num_carte ="​5812340100006805"​ and c.lot_carte_id=l.id;</​color>​ \\+
  
-** Permettre d'​encoder à nouveau une carte **\\+  ​update ​carte  set statut = '​SA'​ where num_carte="​5812340100049854";​ 
 +  ​update lot_carte set statut = '​VA'​ where numero_lot = "​1810";​ 
 +</​code>​
  
-  * <color #00a2e8>update ​carte  set statut = '​IM'​ where num_carte="​5812340100049854";</​color>​\\ +<code sql> 
-  * <color #​00a2e8>​update lot_carte set statut = '​IM'​ where numero_lot = "​1810";</​color>​\\+-- Affecter une carte prépayée à un autre point de service
  
-* ** Permettre d'​imprimer à nouveau une carte **\\+update 
 +    miseadisposition_carte_carte mcc, 
 +    miseadisposition_carte mc, 
 +    ​carte 
 +    set    mc.point_service_id=34 
 +WHERE 
 +    mcc.miseadisposition_carte_cartes_id = mc.id 
 +        AND mcc.carte_id = c.id 
 +        and c.id in (SELECT 
 +            id 
 +        FROM 
 +            carte 
 +        WHERE 
 +            num_carte = "​3538000000000000"​);​ 
 +</​code>​
  
-  * <color #00a2e8>update carte  set statut = '​SA'​ where num_carte="​5812340100049854";</​color>​\\ +<code sql            
-  * <color #​00a2e8>​update lot_carte set statut = '​VA'​ where numero_lot = "​1810";</​color>​\\+-- Supprimer tous les rapports jasper de CYNOD pour faire une nouvelle MAJ
  
-* ** Affecter une carte prépayée à un autre point de service ​**\\+  ​set foreign_key_checks=0;​ 
 +  ​truncate jasper_report_unit_resource;​ 
 +  ​truncate jasper_report_unit_resource_role;​ 
 +  ​set foreign_key_checks=1;​ 
 +</​code>​
  
-<color #00a2e8>update\\ +<code sql
-    ​miseadisposition_carte_carte mcc,\\ +-- Supprimer ​l'​enrôlement Wallet d'un client sur Cynod
-    miseadisposition_carte mc,\\ +
-    carte c\\ +
-    set    mc.point_service_id=34\\ +
-WHERE\\ +
-    mcc.miseadisposition_carte_cartes_id = mc.id\\ +
-        AND mcc.carte_id = c.id\\ +
-        and c.id in (SELECT\\ +
-            id\\ +
-        FROM\\ +
-            carte\\ +
-        WHERE\\ +
-            num_carte = "​3538000000000000"​);</​color>​\\ +
-             +
-* ** Supprimer ​tous les rapports jasper de CYNOD pour faire une nouvelle MAJ **\\+
  
-  * <color #​00a2e8>​set foreign_key_checks=0;</​color>​\\ +Etape 1- Récupération de ID du compte Wallet avant suppression
-  * <color #​00a2e8>​truncate jasper_report_unit_resource;</​color>​\\ +
-  * <color #​00a2e8>​truncate jasper_report_unit_resource_role;</​color>​\\ +
-  * <color #​00a2e8>​set foreign_key_checks=1;</​color>​\\+
  
-* **Supprimer l'​enrolement Wallet d'un client sur Cynod **+select id from wallet w where wallet_id = "​221775784470";​
  
-Etape 1- Récupération ​de l'ID du compte Wallet avant suppression\\+NB : Il est important ​de bien noté cet id qui va servir à étape 7
  
-<color #​00a2e8>​select id from wallet w where wallet_id ​"​221775784470"​;</​color>​\\+Etape 2- Désactivation contrainte 
 +SET FOREIGN_KEY_CHECKS=0;
  
-**__NB__ : Il est important de bien noté cet id qui va servir à l'​étape 7**\\+Etape 3- Suppression du wallet_terminal 
 +DELETE wallet_terminal 
 +FROM wallet_terminal 
 +INNER JOIN wallet ON wallet.id = wallet_terminal.wallet_id 
 +WHERE wallet.id in (select id from wallet where wallet_id ="​22792544040"​);​
  
-Etape 2Désactivation contrainte \\ +Etape 4Suppression du wallet_carte 
-<color #​00a2e8>​SET FOREIGN_KEY_CHECKS=0;</​color>​\\+DELETE wallet_carte 
 +FROM wallet_carte 
 +INNER JOIN wallet ON wallet.id = wallet_carte.wallet_id 
 +WHERE wallet.wallet_id in (select id from wallet where wallet_id ​="​22792544040"​);
  
-Etape 3- Suppression du wallet_terminal \\ +Etape 5- Suppression du compte ​wallet 
-<color #​00a2e8>​DELETE wallet_terminal\\ +delete ​from wallet where wallet_id="​22792544040";​
-FROM wallet_terminal\\ +
-INNER JOIN wallet ​ON wallet.id = wallet_terminal.wallet_id\\ +
-WHERE wallet.id in (select id from wallet where wallet_id ="​22792544040"​);</​color>​\\+
  
-Etape 4Suppression du wallet_carte \\ +Etape 6Activation contrainte 
-<color #​00a2e8>​DELETE wallet_carte\\ +SET FOREIGN_KEY_CHECKS=1;
-FROM wallet_carte\\ +
-INNER JOIN wallet ON wallet.id = wallet_carte.wallet_id\\ +
-WHERE wallet.wallet_id in (select id from wallet where wallet_id ​="​22792544040"​);</​color>​\\+
  
-Etape 5Suppression ​du compte wallet \\ +Etape 7Mise à jour des opérations wallet suite à la nouvelle activation ​du client
-<color #​00a2e8>​delete from wallet where wallet_id="​22792544040";</​color>​\\+
  
-Etape 6- Activation contrainte \\ +# 1 
-<​color ​#00a2e8>​SET FOREIGN_KEY_CHECKS=1;</​color>​\\+update historique_operation set 
 +wallet_id = (select id from wallet w where wallet_id = "​221775784470"​) 
 +where wallet_id = 4 or wallet_receiver_id = 4;
  
-Etape 7- Mise à jour des opérations ​wallet ​suite à la nouvelle activation du client \\+#2 
 +update operation set 
 +wallet_id = (select id from wallet ​w where wallet_id = "​221775784470"​) 
 +where wallet_id = 4 or wallet_receiver_id = 4;
  
-1\\ +NB: Merci de remplacer les valeurs du wallet_id et du wallet_receiver_id par ID récupéré à l'​étape ​
-<color #​00a2e8>​update historique_operation set\\ +</code>
-wallet_id = (select id from wallet w where wallet_id = "​221775784470"​)\\ +
-where wallet_id = 4 or wallet_receiver_id = 4;</color>\\+
  
-#2\\ +<code sql
-<color #00a2e8>update operation set\\ +-- Rechercher l'​existence d'une transaction sur Cynod
-wallet_id = (select id from wallet w where wallet_id = "​221775784470"​)\\ +
-where wallet_id = 4 or wallet_receiver_id = 4;</​color>​\\+
  
-**__NB__ : Merci de remplacer les valeurs du wallet_id et du wallet_receiver_id par l'id récupéré à l'étape 1**\\+select numero_operation_offline as "​numero",​ "​Request Synchro Trx Offline"​ from request_synchro_trx_offline where numero_operation_offline in ('6201-0006-220807230912', '​6201-0006-220807230720'​) 
 +union 
 +select numero_operation_offline as "​numero",​ "​Operation_Offline_Synchronised"​ as tablename from operation_offline_synchronized where numero_operation_offline in ('​6201-0006-220807230912',​ '​6201-0006-220807230720'​) 
 +union 
 +select numero_operation_offline as "​numero",​ "​Numero_Operation_Offline"​ as "​tablename"​ from operation_offline_synchronized_history where numero_operation_offline in ('​6201-0006-220807230912',​ '​6201-0006-220807230720'​) 
 +UNION 
 +select numero_operation_offline as "​numero",​ "​Operation Offline Failed Synchronized"​ as "​tablename"​ from operation_offline_failed_synchronized where numero_operation_offline in ('​6201-0006-220807230912',​ '​6201-0006-220807230720'​) 
 +UNION 
 +select numero_operation ​ as "​numero",​ "​Anomalie Carte" as "​tablename"​ from anomalies_carte where numero_operation in ('​6201-0006-220807230912',​ '​6201-0006-220807230720'​) 
 +UNION 
 +select numero_operation as "​numero",​ "​Historique Oepration"​ as "​tablename"​ from historique_operation where numero_operation in ('​6201-0006-220807230912',​ '​6201-0006-220807230720'​) 
 +UNION 
 +select numero_operation as "​numero",​ "​Operation"​ as "​tablename"​ from operation where numero_operation in ('​6201-0006-220807230912',​ '​6201-0006-220807230720'​);​ 
 +</​code>​
  
-* **Rechercher l'​existence d'une transaction sur Cynod **\\ +<code sql
-<color #00a2e8select numero_operation_offline as "​numero",​ "​Request Synchro Trx Offline"​ from request_synchro_trx_offline where numero_operation_offline in ('​6201-0006-220807230912',​ '​6201-0006-220807230720'​)\\ +-- Désactiver restriction Mot de passe expiré
-union\\ +
-select numero_operation_offline as "​numero",​ "​Operation_Offline_Synchronised"​ as tablename from operation_offline_synchronized where numero_operation_offline in ('6201-0006-220807230912',​ '​6201-0006-220807230720'​)\\ +
-union\\ +
-select numero_operation_offline as "​numero",​ "​Numero_Operation_Offline"​ as "​tablename"​ from operation_offline_synchronized_history where numero_operation_offline in ('​6201-0006-220807230912',​ '​6201-0006-220807230720'​)\\ +
-UNION\\ +
-select numero_operation_offline as "​numero",​ "​Operation Offline Failed Synchronized"​ as "​tablename"​ from operation_offline_failed_synchronized where numero_operation_offline in ('​6201-0006-220807230912',​ '​6201-0006-220807230720'​)\\ +
-UNION\\ +
-select numero_operation ​ as "​numero",​ "​Anomalie Carte" as "​tablename"​ from anomalies_carte where numero_operation in ('​6201-0006-220807230912',​ '​6201-0006-220807230720'​)\\ +
-UNION\\ +
-select numero_operation as "​numero",​ "​Historique Oepration"​ as "​tablename"​ from historique_operation where numero_operation in ('​6201-0006-220807230912',​ '​6201-0006-220807230720'​)\\ +
-UNION\\ +
-select numero_operation as "​numero",​ "​Operation"​ as "​tablename"​ from operation where numero_operation in ('​6201-0006-220807230912',​ '​6201-0006-220807230720'​);</​color>​\\+
  
-* **Désactiver restriction Mot de passe expiré**\\ +update user u set 
-<color #00a2e8>update user u set\\ +password_expired = false, 
-password_expired = false,\\ +u.user_update = "​sensoft_arame",​ 
-u.user_update = "​sensoft_arame",​\\ +u.last_updated = now(), 
-u.last_updated = now(),\\ +u.version = u.version + 1 
-u.version = u.version + 1\\ +where 
-where\\  +u.username = "​sensoft_ibrahima";​ 
-u.username = "​sensoft_ibrahima";</​color>+</code>
  
-* **Mise à jour date erronée des transactions**\\+<code sql> 
 +-- Mise à jour date erronée des transactions
  
-### Transactions archivées ​\\ +### Transactions archivées 
-<color #00a2e8>update historique_ecriture e, historique_operation o\\ +update historique_ecriture e, historique_operation o 
-set e.date_ecriture = "​2024-02-08 22:​40:​00",​\\ +set e.date_ecriture = "​2024-02-08 22:​40:​00",​ 
-e.last_updated = NOW(),\\ +e.last_updated = NOW(), 
-e.user_update = "​djibril.traore",​\\ +e.user_update = "​djibril.traore",​ 
-e.version = e.version +1\\ +e.version = e.version +1 
-where e.numero_operation=o.numero_operation\\ +where e.numero_operation=o.numero_operation 
-and o.numero_operation in\\ +and o.numero_operation in 
-('​5806-0043-700102202211','​5806-0043-700102202530'​);​\\</​color>​+('​5806-0043-700102202211','​5806-0043-700102202530'​);​
  
-<color #00a2e8>update historique_operation o, historique_ecriture e\\ +update historique_operation o, historique_ecriture e 
-set o.date_transaction = e.date_ecriture,​\\ +set o.date_transaction = e.date_ecriture,​ 
-o.last_updated = NOW(),\\ +o.last_updated = NOW(), 
-o.user_update = "​djibril.traore",​\\ +o.user_update = "​djibril.traore",​ 
-o.version = o.version +1\\ +o.version = o.version +1 
-where o.numero_operation = e.numero_operation\\ +where o.numero_operation = e.numero_operation 
-and o.numero_operation in\\ +and o.numero_operation in 
-('​5806-0043-700102202211','​5806-0043-700102202530'​);​\\</​color>​+('​5806-0043-700102202211','​5806-0043-700102202530'​);​
  
-### Transactions non archivées ​\\ +### Transactions non archivées 
-<color #00a2e8>update ecriture e, operation o\\ +update ecriture e, operation o 
-set e.date_ecriture = "​2024-02-08 22:​40:​00",​\\ +set e.date_ecriture = "​2024-02-08 22:​40:​00",​ 
-e.last_updated = NOW(),\\ +e.last_updated = NOW(), 
-e.user_update = "​djibril.traore",​\\ +e.user_update = "​djibril.traore",​ 
-e.version = e.version +1\\ +e.version = e.version +1 
-where e.operation_id =o.id\\ +where e.operation_id =o.id 
-and o.numero_operation in\\ +and o.numero_operation in 
-('​5806-0043-700102202211','​5806-0043-700102202530'​);​</​color>​\\+('​5806-0043-700102202211','​5806-0043-700102202530'​);​
  
-<color #00a2e8>update operation o, ecriture e\\ +update operation o, ecriture e 
-set o.date_transaction = e.date_ecriture,​\\ +set o.date_transaction = e.date_ecriture,​ 
-o.last_updated = NOW(),\\ +o.last_updated = NOW(), 
-o.user_update = "​djibril.traore",​\\ +o.user_update = "​djibril.traore",​ 
-o.version = o.version +1\\ +o.version = o.version +1 
-where o.id = e.operation_id\\ +where o.id = e.operation_id 
-and o.numero_operation in\\ +and o.numero_operation in 
-('​5806-0043-700102202211','​5806-0043-700102202530'​);</​color>\\+('​5806-0043-700102202211','​5806-0043-700102202530'​);​ 
 +</code>
  • tecdoc/requetesql.1724833285.txt.gz
  • Dernière modification: 2024/08/28 08:21
  • par mamadou.gueye_sensoft.sn