123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- using System;
- using SqlSugar;
- using Infrastructure.Attribute;
- using ZR.Model;
- using ZR.Repository;
- using System.Linq;
- using System.Collections.Generic;
- using ZR.Model.System;
- using ZR.Service.Business.IBusinessService.BaseSet;
- using ZR.Model.Dto.BaseSet;
- using ZR.Model.Models.BaseSet;
- namespace ZR.Service.Business
- {
- /// <summary>
- /// 基础资料/库区信息表Service业务层处理
- ///
- /// @author admin
- /// @date 2023-04-10
- /// </summary>
- [AppService(ServiceType = typeof(IBasRegionService), ServiceLifetime = LifeTime.Transient)]
- public class BasRegionService : BaseService<BasRegion>, IBasRegionService
- {
- #region 业务逻辑代码
- /// <summary>
- /// 查询基础资料/库区信息表列表
- /// </summary>
- /// <param name="parm"></param>
- /// <returns></returns>
- public PagedInfo<BasRegionDto> GetList(BasRegionQueryDto parm)
- {
- //开始拼装查询条件
- var predicate = Expressionable.Create<BasRegion>();
- predicate.AndIF(!string.IsNullOrEmpty(parm.RegionCode), it => it.RegionCode.Contains(parm.RegionCode));
- predicate.AndIF(!string.IsNullOrEmpty(parm.RegionName), it => it.RegionName.Contains(parm.RegionName));
- predicate.AndIF(!string.IsNullOrEmpty(parm.Visible), it => it.Visible == parm.Visible);
- predicate.AndIF(!string.IsNullOrEmpty(parm.Status), it => it.Status.Equals(parm.Status));
- //搜索条件查询语法参考Sqlsugar
- var response = Queryable()
- .Where(predicate.ToExpression())
- .ToPage<BasRegion, BasRegionDto>(parm);
- return response;
- }
- /// <summary>
- /// 添加基础资料/库区信息表
- /// </summary>
- /// <param name="model"></param>
- /// <returns></returns>
- public int AddBasRegion(BasRegion model)
- {
- return Add(model, true);
- //return Insertable(model).ExecuteReturnBigIdentity();
- }
- /// <summary>
- /// 修改基础资料/库区信息表
- /// </summary>
- /// <param name="model"></param>
- /// <returns></returns>
- public int UpdateBasRegion(BasRegion model)
- {
- //var response = Update(w => w.RegionId == model.RegionId, it => new BasRegion()
- //{
- // RegionCode = model.RegionCode,
- // RegionName = model.RegionName,
- // Describe = model.Describe,
- // Visible = model.Visible,
- // Status = model.Status,
- // UpdateBy = model.UpdateBy,
- // UpdateTime = model.UpdateTime,
- // Remark = model.Remark,
- //});
- //return response;
- return Update(model, true);
- }
- /// <summary>
- /// 清空基础资料/库区信息表
- /// </summary>
- /// <returns></returns>
- public void TruncateBasRegion()
- {
- Truncate();
- }
- public List<BasRegion> GetAll()
- {
- return Queryable().ToList();
- }
- #endregion
- }
- }
|