Commit ea7f26b5 by 赵剑炜

增加业务

parent b3c81e9e
...@@ -11,11 +11,14 @@ ...@@ -11,11 +11,14 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Autofac" Version="7.1.0" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="11.0.0" /> <PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="11.0.0" />
<PackageReference Include="FluentValidation.AspNetCore" Version="10.4.0" /> <PackageReference Include="FluentValidation.AspNetCore" Version="10.4.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.4" /> <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.3" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.3" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.2" /> <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.2" />
<PackageReference Include="NLog.Web.AspNetCore" Version="5.3.4" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
</ItemGroup> </ItemGroup>
......
using Newtonsoft.Json.Serialization;
using Newtonsoft.Json;
using System.Text;
namespace APIs.Common
{
public partial class JsonManager
{
/// <summary>
/// 返回成功的结果
/// </summary>
/// <param name="body"></param>
/// <returns></returns>
public static HttpResponseMessage ReturnSuccessResponse<T>(T data, bool isNull = false)
{
//JObject result = new JObject();
//result.Add(new JObject(new JProperty("code", ResultCode.OPERATE_SUCCESS.Code), new JProperty("msg", ResultCode.OPERATE_SUCCESS.Message), new JProperty("body", body)));
var src = new
{
code = ResultCode.OPERATE_SUCCESS.Code,
msg = ResultCode.OPERATE_SUCCESS.Msg,
data
};
JsonSerializerSettings setting = new JsonSerializerSettings();
setting.DateFormatHandling = DateFormatHandling.MicrosoftDateFormat;
setting.DateFormatString = "yyyy-MM-dd HH:mm:ss";
setting.ContractResolver = new CamelCasePropertyNamesContractResolver();
setting.MaxDepth = 10; //设置序列化的最大层数
setting.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
if (isNull)
{
//空值处理
setting.NullValueHandling = NullValueHandling.Ignore;
}
return new HttpResponseMessage { Content = new StringContent(JsonConvert.SerializeObject(src, Formatting.Indented, setting), Encoding.GetEncoding("UTF-8"), "application/json") };
}
/// <summary>
/// 返回执行状态
/// </summary>
/// <param name="resultinfo">结果信息</param>
/// <returns></returns>
public static HttpResponseMessage SimpleStatusResponse(ResultInfo resultinfo)
{
//JObject result = new JObject();
//result.Add(new JObject(new JProperty("code", resultinfo.Code), new JProperty("msg", resultinfo.Message)));
var src = new
{
code = resultinfo.Code,
msg = resultinfo.Msg,
timestamp = GetCurrTimeStamp()
};
return new HttpResponseMessage { Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(src), Encoding.GetEncoding("UTF-8"), "application/json") };
}
/// <summary>
/// 获取当前时间戳
/// </summary>
/// <returns></returns>
public static long GetCurrTimeStamp()
{
TimeSpan ts = DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0);
return Convert.ToInt64(ts.TotalSeconds);
}
}
}
namespace APIs.Common
{
/// <summary>
/// 结果代码
/// </summary>
public class ResultCode
{
static volatile public Dictionary<string, string> devDic = new Dictionary<string, string>();
public static ResultInfo OPERATE_FAILED = new ResultInfo { Code = "19999", Msg = "操作失败" };
public static ResultInfo OPERATE_SUCCESS = new ResultInfo { Code = "10000", Msg = "操作成功" };
public static ResultInfo HAS_NO_LIMITS = new ResultInfo { Code = "10001", Msg = "没有操作权限" };
public static ResultInfo ACCOUNT_NO_EXIST = new ResultInfo { Code = "10002", Msg = "没有该账户信息" };
public static ResultInfo SIGN_ERROR = new ResultInfo { Code = "10003", Msg = "签名错误" };
public static ResultInfo ACCOUNT_CANNOT_AUDIT = new ResultInfo { Code = "10004", Msg = "该用户无法被审核" };
public static ResultInfo ACCOUNT_IS_AUDITED = new ResultInfo { Code = "10005", Msg = "用户已通过审核" };
public static ResultInfo ORDER_NOT_EXIST = new ResultInfo { Code = "10006", Msg = "订单不存在" };
public static ResultInfo ACCESSTOKEN_ERROR = new ResultInfo { Code = "10008", Msg = "请求密钥错误或过期" };
public static ResultInfo REQUEST_DATA_ERROR = new ResultInfo { Code = "10009", Msg = "请求数据不合法" };
public static ResultInfo ADMIN_DELETE_ERROR = new ResultInfo { Code = "100010", Msg = "不能删除超级管理员" };
public static ResultInfo ACCOUNT_IS_EXIST = new ResultInfo { Code = "10012", Msg = "该账户已存在" };
public static ResultInfo ACCOUNT_ISNOT_CORRECT = new ResultInfo { Code = "10013", Msg = "帐号密码不正确" };
public static ResultInfo COMPANY_IS_EXIST = new ResultInfo { Code = "10014", Msg = "该企业已经注册" };
public static ResultInfo AUDIT_IS_PASS = new ResultInfo { Code = "10015", Msg = "审核未通过" };
public static ResultInfo AMONT_IS_NOT_ENOUGH = new ResultInfo { Code = "10016", Msg = "允许打印的标签数量不足" };
public static ResultInfo CHANNEL_CODE_EXIST = new ResultInfo { Code = "10017", Msg = "通道编号已存在" };
public static ResultInfo CABINET_ERROR = new ResultInfo { Code = "10018", Msg = "用户不存在或单警柜不存在" };
public static ResultInfo CABINET_SET_ERROR = new ResultInfo { Code = "10018", Msg = "单警柜已被绑定" };
public static ResultInfo NUMBER255_ERROR = new ResultInfo { Code = "10019", Msg = "号型最多添加255个" };
public static ResultInfo APPROVE_ERROR = new ResultInfo { Code = "10020", Msg = "用户已撤回或已被审核,无法审核" };
public static ResultInfo CHANGE_ERROR = new ResultInfo { Code = "10021", Msg = "无法修改已开始任务的领用单" };
public static ResultInfo DELETE_ERROR = new ResultInfo { Code = "10022", Msg = "该订单不是领用单或该单据已开始" };
public static ResultInfo SUPPLIER_ERROR = new ResultInfo { Code = "10023", Msg = "供应商码已存在" };
public static ResultInfo UPDATE_ERROR = new ResultInfo { Code = "10024", Msg = "错误的异常修改业务" };
public static ResultInfo POLICE_ERROR = new ResultInfo { Code = "10025", Msg = "警员不存在" };
public static ResultInfo POLICE_C_ERROR = new ResultInfo { Code = "10125", Msg = "警号已存在" };
public static ResultInfo EPC_ERROR = new ResultInfo { Code = "10026", Msg = "EPC或物资不存在" };
public static ResultInfo ORDER_IS_EXIST = new ResultInfo { Code = "10027", Msg = "订单已存在" };
public static ResultInfo ORDER_ERROR = new ResultInfo { Code = "10028", Msg = "订单号格式不正确" };
public static ResultInfo ORGANIZATION_ERROR = new ResultInfo { Code = "10029", Msg = "组织机构不正确" };
public static ResultInfo TIME_ERROR = new ResultInfo { Code = "10030", Msg = "时间戳失效,请求过期" };
public static ResultInfo APPKEY_ERROR = new ResultInfo { Code = "10031", Msg = "AppKey错误" };
public static ResultInfo API_ERROR = new ResultInfo { Code = "10032", Msg = "没有权限调用该接口" };
public static ResultInfo MESSAGE_ERROR = new ResultInfo { Code = "10033", Msg = "认证服务网关超时" };
public static ResultInfo EQUIPMENT_ERROR = new ResultInfo { Code = "10034", Msg = "物资不存在" };
public static ResultInfo DELETE_USER_ERROR = new ResultInfo { Code = "10035", Msg = "请先将单警柜内与人员绑定的物资解绑" };
public static ResultInfo WAREHOUSE_LOCK = new ResultInfo { Code = "10036", Msg = "仓库已锁定,正在盘点中" };
public static ResultInfo WAREHOUSE_INV_EXIST = new ResultInfo { Code = "10037", Msg = "有未操作的盘点单据,请先进行处理" };
public static ResultInfo ORDER_EXIST = new ResultInfo { Code = "10038", Msg = "已有单据在审核,请先处理待审核单据" };
public static ResultInfo CABINET_INVENTORY_EXIST = new ResultInfo { Code = "10039", Msg = "单警柜存在物资" };
public static ResultInfo ORDER_OPERATE_FAILED = new ResultInfo { Code = "10040", Msg = "单据操作失败" };
public static ResultInfo ORDER_OPERATE_ERROR = new ResultInfo { Code = "10041", Msg = "单据已完成或单据不存在" };
public static ResultInfo EPC_GEN_FAILED = new ResultInfo { Code = "10020", Msg = "EPC生成失败" };
public static ResultInfo BASE_EXIST = new ResultInfo { Code = "10034", Msg = "基础信息已存在" };
public static ResultInfo BOX_MARK_INVALID = new ResultInfo { Code = "10042", Msg = "无效箱标EPC" };
public static ResultInfo NO_PROCESS = new ResultInfo { Code = "10043", Msg = "无流程信息" };
public static ResultInfo BAG_EXIST = new ResultInfo { Code = "10044", Msg = "已有物资进行绑定,无法进行修改或删除" };
public static ResultInfo COUNT_ERROR = new ResultInfo { Code = "10045", Msg = "实际物资数量超过预设装备包数量" };
public static ResultInfo NAME_ERROR = new ResultInfo { Code = "10046", Msg = "名称重复" };
public static ResultInfo MISSION_ERROR = new ResultInfo { Code = "10047", Msg = "该单据正在任务中或已有物资出入库" };
public static ResultInfo MISSION_EXIST = new ResultInfo { Code = "10048", Msg = "存在进行中的任务" };
public static ResultInfo ORDER_START = new ResultInfo { Code = "10049", Msg = "物资与单据状态不匹配" };
}
/// <summary>
/// 结果信息 -- 结构体
/// </summary>
public struct ResultInfo
{
public string Code { get; set; }
public string Msg { get; set; }
}
}
using APIs.Dto; using APIs.Common;
using APIs.Dto;
using AutoMapper; using AutoMapper;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
...@@ -22,25 +23,25 @@ namespace APIs.Controllers ...@@ -22,25 +23,25 @@ namespace APIs.Controllers
} }
[HttpGet] [HttpGet]
public virtual async Task<ApiResult> GetAllPersonnel() public virtual async Task<HttpResponseMessage> GetAllPersonnel()
{ {
ApiResult result = new ApiResult();
try try
{ {
var userDto = new UserDto(); //var userDto = new UserDto();
var police = await _policeService.Query(); var police = await _policeService.Query();
//var userInfo = await _userInfo.QueryOne(x => x.UserName == model.UserName && x.PassWord == model.PassWord); return JsonManager.ReturnSuccessResponse(police);
result.data = police;
result.code = 1;
return result;
} }
catch (Exception ex) catch (Exception ex)
{ {
result.code = 0; ResultInfo info = new ResultInfo()
result.msg = "失败"; {
return result; Msg = ex.Message,
Code = "19999"
};
return JsonManager.SimpleStatusResponse(info);
} }
} }
......
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc;
using Models.ToolsModel;
namespace APIs.Filter
{
public class GlobalExceptionsFilter : IExceptionFilter
{
private ILogger<GlobalExceptionsFilter> _logger;
private readonly IWebHostEnvironment _env;
public GlobalExceptionsFilter(ILogger<GlobalExceptionsFilter> logger,
IWebHostEnvironment env)
{
_logger = logger;
_env = env;
}
public void OnException(ExceptionContext context)
{
string message;
if (_env.IsDevelopment())
{
message = context.Exception.InnerException.ToString();
}
else
{
message = context.Exception.Message;
}
context.Result = new InternalServerErrorObjectResult(message);
_logger.LogError(message + WriteLog(message, context.Exception));
}
public string WriteLog(string throwMsg, Exception ex)
{
return string.Format("\r\n【自定义错误】:{0} \r\n【异常类型】:{1} \r\n【异常信息】:{2} \r\n【堆栈调用】:{3}", new object[] { throwMsg,
ex.GetType().Name, ex.Message, ex.StackTrace });
}
}
public class InternalServerErrorObjectResult : ObjectResult
{
public InternalServerErrorObjectResult(object value) : base(value)
{
StatusCode = StatusCodes.Status500InternalServerError;
}
}
}
using System.Configuration; using System.Configuration;
using System.Reflection; using System.Reflection;
using System.Reflection.Metadata;
using System.Text; using System.Text;
using System.Xml.Linq; using System.Xml.Linq;
using APIs;
using APIs.Extensions; using APIs.Extensions;
using APIs.Profiles; using APIs.Profiles;
using Autofac.Extensions.DependencyInjection;
using Common; using Common;
using FluentValidation.AspNetCore; using FluentValidation.AspNetCore;
using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.IdentityModel.Tokens; using Microsoft.IdentityModel.Tokens;
using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models;
using NLog.Web;
using Repositories; using Repositories;
using Repositories.IRepository.IBussiness; using Repositories.IRepository.IBussiness;
using Repositories.IRepository.IUnitOfWork; using Repositories.IRepository.IUnitOfWork;
...@@ -18,84 +22,41 @@ using Repositories.Repository.UnitOfWork; ...@@ -18,84 +22,41 @@ using Repositories.Repository.UnitOfWork;
using Services; using Services;
using Services.Interface; using Services.Interface;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddSqlsugarSetup(builder.Configuration);
builder.Services.AddMemoryCache(); public class Program
builder.Services.AddControllers()
.AddNewtonsoftJson(options =>
{
options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
options.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm:ss";
});
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddAutoMapper(typeof(MapperProfile));
builder.Services.AddSwaggerGen(options =>
{
//options.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme()
//{
// Description = "在下框中输入请求头中需要添加Jwt授权Token:Bearer Token",
// Name = "Authorization",
// In = ParameterLocation.Header,
// Type = SecuritySchemeType.ApiKey,
// BearerFormat = "Jwt",
// Scheme = "Bearer"
//});
//options.AddSecurityRequirement(new OpenApiSecurityRequirement
//{
// {
// new OpenApiSecurityScheme
// {
// Reference = new OpenApiReference
// {
// Type = ReferenceType.SecurityScheme,
// Id = "Bearer"
// }
// },
// new string[] {}
// }
////});
});
builder.Services.AddScoped<ISugarUnitOfWork, SugarUnitOfWork>();
builder.Services.AddScoped<IPoliceService, PoliceService>();
builder.Services.AddScoped<IPoliceRepository, PoliceRepository>();
builder.Services.AddFluentValidation(options =>
{ {
options.RegisterValidatorsFromAssembly(Assembly.GetExecutingAssembly()); public static void Main(string[] args)
});
builder.Services.AddCors(options =>
{
options.AddPolicy("Cors", policy =>
{ {
policy var logger = NLogBuilder.ConfigureNLog("nlog.config").GetCurrentClassLogger();
.AllowAnyOrigin() try
.AllowAnyHeader() {
.AllowAnyMethod(); logger.Debug("--------------init main--------------");
}); CreateHostBuilder(args).Build().Run();
}); }
catch (Exception exception)
{
var app = builder.Build(); logger.Error(exception, "--------------Stopped program because of exception--------------");
throw;
if (app.Environment.IsDevelopment()) }
{ finally
app.UseSwagger(); {
app.UseSwaggerUI(); NLog.LogManager.Shutdown();
} }
}
app.UseCors("Cors");
public static IHostBuilder CreateHostBuilder(string[] args) =>
app.UseHttpsRedirection(); Host.CreateDefaultBuilder(args)
.UseServiceProviderFactory(new AutofacServiceProviderFactory())
app.UseAuthentication(); .ConfigureWebHostDefaults(webBuilder =>
app.UseAuthorization(); {
webBuilder.UseStartup<Startup>();
app.MapControllers(); })
.ConfigureLogging(logging =>
app.Run(); {
\ No newline at end of file logging.ClearProviders();
logging.SetMinimumLevel(LogLevel.Trace);
})
.UseNLog();
}
\ No newline at end of file
using APIs.Profiles;
using Autofac;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.IdentityModel.Tokens;
using Microsoft.OpenApi.Models;
using Repositories.IRepository.IBussiness;
using Repositories.Repository.Bussiness;
using Services.Interface;
using Services;
using System.Configuration;
using System.Reflection;
using System.Text;
using APIs.Extensions;
using FluentValidation.AspNetCore;
using Repositories.IRepository.IUnitOfWork;
using Repositories.Repository.UnitOfWork;
namespace APIs
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
public void ConfigureServices(IServiceCollection services)
{
services.AddSqlsugarSetup(Configuration);
services.AddMemoryCache();
services.AddControllers()
.AddNewtonsoftJson(options =>
{
options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
options.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm:ss";
});
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
services.AddEndpointsApiExplorer();
services.AddAutoMapper(typeof(MapperProfile));
services.AddSwaggerGen(options =>
{
});
services.AddScoped<ISugarUnitOfWork, SugarUnitOfWork>();
services.AddScoped<IPoliceService, PoliceService>();
services.AddScoped<ICarService, CarService>();
services.AddScoped<IEquipmentSizeService, EquipmentSizeService>();
//services.AddScoped<IEquipmentTypeService, EquipmentTypeService>();
services.AddScoped<IPoliceRepository, PoliceRepository>();
services.AddScoped<ICarRepository, CarRepository>();
services.AddScoped<IEquipmentSizeRepository, EquipmentSizeRepository>();
services.AddScoped<IEquipmentTypeRepository, EquipmentTypeRepository>();
services.AddFluentValidation(options =>
{
options.RegisterValidatorsFromAssembly(Assembly.GetExecutingAssembly());
});
services.AddCors(options =>
{
options.AddPolicy("Cors", policy =>
{
policy
.AllowAnyOrigin()
.AllowAnyHeader()
.AllowAnyMethod();
});
});
}
public void ConfigureContainer(ContainerBuilder builder)
{
var basePath = AppContext.BaseDirectory;
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseSwagger();
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "api.core");
});
app.UseCors("Cors");
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
//先开启认证
app.UseAuthentication();
//然后是授权中间件
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" autoReload="true" internalLogLevel="Info">
<!-- 启用.net core的核心布局渲染器 -->
<extensions>
<add assembly="NLog.Web.AspNetCore" />
</extensions>
<!-- 写入日志的目标配置 archiveAboveSize="102400" maxArchiveDays="60" -->
<targets>
<!-- 调试 -->
<target xsi:type="File" name="debug" fileName="logs\debug-${shortdate}.log" layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action}" />
<!-- 警告 -->
<target xsi:type="File" name="warn" fileName="logs\warn-${shortdate}.log" layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action}" />
<!-- 错误 -->
<target xsi:type="File" name="error" fileName="logs\error-${shortdate}.log" layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action}" />
</targets>
<!-- 映射规则 -->
<rules>
<!-- 调试 -->
<logger name="*" minlevel="Trace" maxlevel="Debug" writeTo="debug" />
<!-- 警告 -->
<logger name="*" minlevel="Info" maxlevel="Warn" writeTo="warn" />
<!-- 错误 -->
<logger name="*" minlevel="Error" maxlevel="Fatal" writeTo="error" />
<!--跳过不重要的微软日志-->
<logger name="Microsoft.*" maxlevel="Info" final="true" />
</rules>
</nlog>
\ No newline at end of file
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Principal;
using System.Text;
using System.Threading.Tasks;
namespace Models.SqlModel
{
[SugarTable("base_car")]
public class Car
{
[SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
public int id { get; set; }
public String name { get; set; }
public String no { get; set; }
public String? state { get; set; }
[SugarColumn(ColumnName = "update_time")]
public DateTime? updateTime { get; set; }
[SugarColumn(ColumnName = "create_time")]
public DateTime? createTime { get; set; }
}
}
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Principal;
using System.Text;
using System.Threading.Tasks;
namespace Models.SqlModel
{
[SugarTable("base_equipment_size")]
public class EquipmentSize
{
[SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
public String id { get; set; }
public String code { get; set; }
public String unit { get; set; }
[SugarColumn(ColumnName = "type_id")]
public String? typeId { get; set; }
public String? name { get; set; }
public String? note { get; set; }
public String? price { get; set; }
public String? state { get; set; }
[SugarColumn(ColumnName = "update_time")]
public DateTime? updateTime { get; set; }
[SugarColumn(ColumnName = "create_time")]
public DateTime? createTime { get; set; }
}
}
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Principal;
using System.Text;
using System.Threading.Tasks;
namespace Models.SqlModel
{
[SugarTable("base_equipment_type")]
public class EquipmentType
{
[SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
public String id { get; set; }
public String name { get; set; }
public String unit { get; set; }
[SugarColumn(ColumnName = "unit_type")]
public String? unitType { get; set; }
public String? code { get; set; }
[SugarColumn(ColumnName = "parent_id")]
public String? parentId { get; set; }
public String? state { get; set; }
public String? note { get; set; }
public String? type { get; set; }
[SugarColumn(ColumnName = "update_time")]
public DateTime? updateTime { get; set; }
[SugarColumn(ColumnName = "create_time")]
public DateTime? createTime { get; set; }
}
}
...@@ -11,12 +11,12 @@ namespace Models.ToolsModel ...@@ -11,12 +11,12 @@ namespace Models.ToolsModel
public ApiResult() public ApiResult()
{ {
IsSuccess = true; IsSuccess = true;
code = 200; code = "200";
msg = ""; msg = "";
data = ""; data = "";
} }
public bool IsSuccess { get; set; } public bool IsSuccess { get; set; }
public int code { get; set; } public string code { get; set; }
//public int statusCode { get; set; } //public int statusCode { get; set; }
public object data { get; set; } public object data { get; set; }
public string msg { get; set; } public string msg { get; set; }
......
using Models.SqlModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Repositories.IRepository.IBussiness
{
public interface ICarRepository : IBaseRepository<Car>
{
}
}
using Models.SqlModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Repositories.IRepository.IBussiness
{
public interface IEquipmentSizeRepository : IBaseRepository<EquipmentSize>
{
}
}
using Models.SqlModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Repositories.IRepository.IBussiness
{
public interface IEquipmentTypeRepository : IBaseRepository<EquipmentType>
{
}
}
using Models.SqlModel;
using Repositories.IRepository.IBussiness;
using Repositories.IRepository.IUnitOfWork;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Repositories.Repository.Bussiness
{
public class CarRepository : BaseRepository<Car>, ICarRepository
{
public CarRepository(ISugarUnitOfWork sugarUnitOfWork) : base(sugarUnitOfWork)
{
}
}
}
using Models.SqlModel;
using Repositories.IRepository.IBussiness;
using Repositories.IRepository.IUnitOfWork;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Repositories.Repository.Bussiness
{
public class EquipmentSizeRepository : BaseRepository<EquipmentSize>, IEquipmentSizeRepository
{
public EquipmentSizeRepository(ISugarUnitOfWork sugarUnitOfWork) : base(sugarUnitOfWork)
{
}
}
}
using Models.SqlModel;
using Repositories.IRepository.IBussiness;
using Repositories.IRepository.IUnitOfWork;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Repositories.Repository.Bussiness
{
public class EquipmentTypeRepository : BaseRepository<EquipmentType>, IEquipmentTypeRepository
{
public EquipmentTypeRepository(ISugarUnitOfWork sugarUnitOfWork) : base(sugarUnitOfWork)
{
}
}
}
...@@ -16,5 +16,5 @@ public class PoliceRepository : BaseRepository<Police>, IPoliceRepository ...@@ -16,5 +16,5 @@ public class PoliceRepository : BaseRepository<Police>, IPoliceRepository
{ {
} }
} }
} }
using Models.SqlModel;
using Repositories.IRepository.IBussiness;
using Services.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Services
{
public class CarService : BaseService<Car>, ICarService
{
private readonly ICarRepository _carRepository;
public CarService(ICarRepository carRepository)
{
base.BaseDal = carRepository;
_carRepository = carRepository;
}
}
}
using Models.SqlModel;
using Repositories.IRepository.IBussiness;
using Services.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Services
{
public class EquipmentSizeService : BaseService<EquipmentSize>, IEquipmentSizeService
{
private readonly IEquipmentSizeRepository _equipmentSizeRepository;
public EquipmentSizeService(IEquipmentSizeRepository equipmentSizeRepository)
{
base.BaseDal = equipmentSizeRepository;
_equipmentSizeRepository = equipmentSizeRepository;
}
}
}
using Models.SqlModel;
using Repositories.IRepository.IBussiness;
using Services.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Services
{
public class EquipmentTypeService : BaseService<EquipmentType>, IEquipmentTypeService
{
private readonly IEquipmentTypeRepository _equipmentTypeRepository;
public EquipmentTypeService(IEquipmentTypeRepository equipmentTypeRepository)
{
base.BaseDal = equipmentTypeRepository;
_equipmentTypeRepository = equipmentTypeRepository;
}
}
}
using Models.SqlModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Services.Interface
{
public interface ICarService : IBaseServices<Car>
{
}
}
using Models.SqlModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Services.Interface
{
public interface IEquipmentSizeService : IBaseServices<EquipmentSize>
{
}
}
using Models.SqlModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Services.Interface
{
public interface IEquipmentTypeService : IBaseServices<EquipmentType>
{
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论