万佳安设备数据
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

32 lignes
1.3KB

  1. using Dapper;
  2. using MySql.Data.MySqlClient;
  3. using System.Data;
  4. using TelpoPush.WanJiaAn.Worker.Models.CacheTemplates;
  5. namespace TelpoPush.WanJiaAn.Worker.Service.Cache
  6. {
  7. public class SqlMapper
  8. {
  9. private readonly IConfiguration _config;
  10. private static string gps_conn = "";
  11. private static string telcommon_conn = "";
  12. private static string healthy_conn = "";
  13. public SqlMapper(IConfiguration config)
  14. {
  15. _config = config;
  16. gps_conn = _config["ConnectionStrings:DB_Connection_String"].ToString();
  17. telcommon_conn = _config["ConnectionStrings:Telpo_common_ConnString"].ToString();
  18. healthy_conn = _config["ConnectionStrings:Telpo_Healthy_ConnString"].ToString();
  19. }
  20. public DeviceInfoModel DeviceInfo(string imei)
  21. {
  22. using (IDbConnection connection = new MySqlConnection(gps_conn))
  23. {
  24. var sql = @"SELECT d.device_id deviceId, p.nick_name deviceName,p.api_uid apiUid,d.serialno imei, d.org_uid orgId, d.active_status activeStatus,active_time activeTime FROM gps_device as d LEFT JOIN `gps_person` as p on p.device_id=d.device_id WHERE d.serialno=@imei";
  25. return connection.QueryFirstOrDefault<DeviceInfoModel>(sql, new { imei });
  26. }
  27. }
  28. }
  29. }