Пример #1
0
        /// <summary>
        /// 新增电厂
        /// </summary>
        //[AbpAuthorize(PermissionNames.InfStation_CreateInfStation)]
        public async Task <int> CreateInfStation(InfStationEditDto input)
        {
            //TODO:新增前的逻辑判断,是否允许新增
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into inf_station(");
            strSql.Append("Id,ZoneId,TypeId,StationName,ProductionTime,OwnershipRatio,MachineNumber,MachineModel,MachineCapacity,CreationTime,CreatorUserId,IsDeleted)");
            strSql.Append(" values (");
            strSql.Append("@Id,@ZoneId,@TypeId,@StationName,@ProductionTime,@OwnershipRatio,@MachineNumber,@MachineModel,@MachineCapacity,@CreationTime,@CreatorUserId,@IsDeleted)");

            using (var conn = DBUtility.GetMySqlConnection())
            {
                input.Id            = Guid.NewGuid();
                input.CreatorUserId = AbpSession.UserId;
                return(await conn.ExecuteAsync(strSql.ToString(), input));
            }
        }
Пример #2
0
        /// <summary>
        /// 更新电厂
        /// </summary>
        //[AbpAuthorize(PermissionNames.InfStation_UpdateInfStation)]
        public async Task <int> UpdateInfStation(InfStationEditDto input)
        {
            //TODO:更新前的逻辑判断,是否允许更新
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update inf_station set ");
            strSql.Append("ZoneId=@ZoneId,");
            strSql.Append("TypeId=@TypeId,");
            strSql.Append("StationName=@StationName,");
            strSql.Append("ProductionTime=@ProductionTime,");
            strSql.Append("OwnershipRatio=@OwnershipRatio,");
            strSql.Append("MachineNumber=@MachineNumber,");
            strSql.Append("MachineModel=@MachineModel,");
            strSql.Append("MachineCapacity=@MachineCapacity,");
            strSql.Append("LastModificationTime=@LastModificationTime,");
            strSql.Append("LastModifierUserId=@LastModifierUserId");
            strSql.Append(" where Id=@Id ");

            using (var conn = DBUtility.GetMySqlConnection())
            {
                input.LastModifierUserId = AbpSession.UserId;
                return(await conn.ExecuteAsync(strSql.ToString(), input));
            }
        }