|
|
/*
|
|
|
*所有关于OP_YARD_ZHENHUA_WORKINFO类的业务代码应在此处编写
|
|
|
*可使用repository.调用常用方法,获取EF/Dapper等信息
|
|
|
*如果需要事务请使用repository.DbContextBeginTransaction
|
|
|
*也可使用DBServerProvider.手动获取数据库相关信息
|
|
|
*用户信息、权限、角色等使用UserContext.Current操作
|
|
|
*OP_YARD_ZHENHUA_WORKINFOService对增、删、改查、导入、导出、审核业务代码扩展参照ServiceFunFilter
|
|
|
*/
|
|
|
using VOL.Core.BaseProvider;
|
|
|
using VOL.Core.Extensions.AutofacManager;
|
|
|
using VOL.Entity.DomainModels;
|
|
|
using System.Linq;
|
|
|
using VOL.Core.Utilities;
|
|
|
using System.Linq.Expressions;
|
|
|
using VOL.Core.Extensions;
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
using VOL.YARD.IRepositories;
|
|
|
using System.Collections.Generic;
|
|
|
using ConvertHelper;
|
|
|
using VOL.Core.Enums;
|
|
|
using System;
|
|
|
using static VOL.YARD.Services.OP_YARD_ZHENHUA_HEADService;
|
|
|
|
|
|
namespace VOL.YARD.Services
|
|
|
{
|
|
|
public partial class OP_YARD_ZHENHUA_WORKINFOService
|
|
|
{
|
|
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
|
|
private readonly IOP_YARD_ZHENHUA_WORKINFORepository _repository;//访问数据库
|
|
|
|
|
|
[ActivatorUtilitiesConstructor]
|
|
|
public OP_YARD_ZHENHUA_WORKINFOService(
|
|
|
IOP_YARD_ZHENHUA_WORKINFORepository dbRepository,
|
|
|
IHttpContextAccessor httpContextAccessor
|
|
|
)
|
|
|
: base(dbRepository)
|
|
|
{
|
|
|
_httpContextAccessor = httpContextAccessor;
|
|
|
_repository = dbRepository;
|
|
|
//多租户会用到这init代码,其他情况可以不用
|
|
|
//base.Init(dbRepository);
|
|
|
}
|
|
|
|
|
|
public override PageGridData<OP_YARD_ZHENHUA_WORKINFO> GetPageData(PageDataOptions options)
|
|
|
{
|
|
|
List<SearchParameters> searchParametersList = new List<SearchParameters>();
|
|
|
if (!string.IsNullOrEmpty(options.Wheres))
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
searchParametersList = options.Wheres.DeserializeObject<List<SearchParameters>>();
|
|
|
}
|
|
|
catch { }
|
|
|
}
|
|
|
|
|
|
OrderByExpression = x => new Dictionary<object, QueryOrderBy>() {
|
|
|
{ x.CNTRNO,QueryOrderBy.Asc },
|
|
|
{ x.OPTIME,QueryOrderBy.Asc }
|
|
|
};
|
|
|
|
|
|
return base.GetPageData(options);
|
|
|
}
|
|
|
|
|
|
|
|
|
public override WebResponseContent DelDetail(SaveModel saveDataModel) {
|
|
|
|
|
|
var pid = new Guid();
|
|
|
|
|
|
var returnHead = new OP_YARD_ZHENHUA_HEAD();
|
|
|
|
|
|
DelOnExecuting = (keys) => {
|
|
|
|
|
|
var keylist = new List<Guid>();
|
|
|
|
|
|
foreach (var key in keys) {
|
|
|
keylist.Add(new Guid(key.ToString()));
|
|
|
}
|
|
|
|
|
|
var deldetailList = repository.FindAsIQueryable(x => keylist.Contains(x.GID)).ToList();
|
|
|
|
|
|
pid = (Guid)deldetailList[0].PID;
|
|
|
|
|
|
return WebResponseContent.Instance.OK();
|
|
|
|
|
|
};
|
|
|
|
|
|
DelOnExecuted = (keys) =>
|
|
|
{
|
|
|
//实现委托
|
|
|
//string joinKeys = $"'{string.Join("','", keys)}'";
|
|
|
//string sql = $"DELETE FROM {typeof(WRITER_POEM).GetEntityTableName() } where writer_id in ({joinKeys});" +
|
|
|
//$"DELETE FROM {typeof(WRITER_NOVEL).GetEntityTableName() } where writer_id in ({joinKeys});";
|
|
|
//repository.ExecuteSqlCommand(sql);
|
|
|
|
|
|
var zhenhuawork = new ZHENHUAWORK(pid);
|
|
|
|
|
|
var _r = zhenhuawork.AfterDelWorkDetail();
|
|
|
|
|
|
returnHead = (OP_YARD_ZHENHUA_HEAD)_r.Data;
|
|
|
|
|
|
return _r;
|
|
|
};
|
|
|
|
|
|
var _r = base.DelDetail(saveDataModel);
|
|
|
|
|
|
_r.Data = returnHead;
|
|
|
|
|
|
return _r;
|
|
|
}
|
|
|
}
|
|
|
}
|