Merge branch 'MCUT' of https://gitea.mjm-staging.developers-homelab.net/BIMS/BIMS into MCUT
This commit is contained in:
		
						commit
						655ad8e589
					
				@ -14,6 +14,7 @@ using System.Linq;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using Ionic.Zip;
 | 
			
		||||
using System.Collections.Immutable;
 | 
			
		||||
using System.Text;
 | 
			
		||||
 | 
			
		||||
namespace FrontendWebApi.ApiControllers
 | 
			
		||||
{
 | 
			
		||||
@ -82,10 +83,18 @@ namespace FrontendWebApi.ApiControllers
 | 
			
		||||
                string buildingSql = "";
 | 
			
		||||
                string tag_quantity = await backendRepository.GetOneAsync<string>("select system_value from variable where system_type = 'obixConfig' and system_key = 'tag_quantity' and deleted = 0");
 | 
			
		||||
 | 
			
		||||
                string[] parts_buildingTag = input.building_tag.Split(',');
 | 
			
		||||
                StringBuilder fix_buildingTag = new StringBuilder();
 | 
			
		||||
                foreach (string part in parts_buildingTag)
 | 
			
		||||
                {
 | 
			
		||||
                    fix_buildingTag.Append("'").Append(part.Trim()).Append("', ");
 | 
			
		||||
                }
 | 
			
		||||
                input.building_tag = fix_buildingTag.ToString().TrimEnd(',', ' ');
 | 
			
		||||
 | 
			
		||||
                if (tag_quantity == "5")
 | 
			
		||||
                    buildingSql = " and SUBSTRING_INDEX(device_number, '_', 1) in (@building_tag) ";
 | 
			
		||||
                    buildingSql = @$" and SUBSTRING_INDEX(device_number, '_', 1) in ({input.building_tag}) ";
 | 
			
		||||
                else
 | 
			
		||||
                    buildingSql = " and SUBSTRING_INDEX(SUBSTRING_INDEX(device_number, '_', 2), '_', -1) in (@building_tag) ";
 | 
			
		||||
                    buildingSql = @$" and SUBSTRING_INDEX(SUBSTRING_INDEX(device_number, '_', 2), '_', -1) in ({input.building_tag}) ";
 | 
			
		||||
 | 
			
		||||
                //if (input.floor_tag.Count > 0)
 | 
			
		||||
                //{
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user