41 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
		
		
			
		
	
	
			41 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| 
								 | 
							
								using APT.BaseData.Domain.Entities.PF;
							 | 
						|||
| 
								 | 
							
								using APT.BaseData.Domain.IServices.Platform;
							 | 
						|||
| 
								 | 
							
								using APT.Infrastructure.Core;
							 | 
						|||
| 
								 | 
							
								using System;
							 | 
						|||
| 
								 | 
							
								using System.Collections.Generic;
							 | 
						|||
| 
								 | 
							
								using System.Linq;
							 | 
						|||
| 
								 | 
							
								using System.Text;
							 | 
						|||
| 
								 | 
							
								using APT.Infrastructure.Api;
							 | 
						|||
| 
								 | 
							
								namespace APT.BaseData.Services.Services.Platform
							 | 
						|||
| 
								 | 
							
								{
							 | 
						|||
| 
								 | 
							
								    public partial class PFLastVersionService : CommonService,IPFLastVersionService
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								        public PFLastVersionService(IRepository repository)
							 | 
						|||
| 
								 | 
							
								            : base(repository)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 版本管理-获取上个版本号
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="filter"></param>
							 | 
						|||
| 
								 | 
							
								        /// <returns></returns>
							 | 
						|||
| 
								 | 
							
								        public string GetLastVersion(KeywordFilter filter)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            //定义一个值为空的上个版本
							 | 
						|||
| 
								 | 
							
								            var lastVersion = "";
							 | 
						|||
| 
								 | 
							
								            //取出数据库满足条件的倒序的第一条数据
							 | 
						|||
| 
								 | 
							
								            var dbVersionManage = this.GetEntity<T_PF_VERSION_MANAGE>(t => t.VERSION != null, new BaseFilter(filter.OrgId) { Sort = "VERSION", Order = DbOrder.DESC });
							 | 
						|||
| 
								 | 
							
								            //判断第一条数据不为空
							 | 
						|||
| 
								 | 
							
								            if (dbVersionManage != null)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                //改变上个版本的值为第一条数据的版本号
							 | 
						|||
| 
								 | 
							
								                lastVersion = dbVersionManage.VERSION;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            //返回上个版本号
							 | 
						|||
| 
								 | 
							
								            return lastVersion;
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								}
							 |