/// <summary> /// 保存机构信息 /// </summary> /// <param name="dto"></param> /// <returns></returns> public ReturnMsg SaveMdmBuInfo(MdmBuMstrDto dto) { var rm = new ReturnMsg(); var entity = new MdmBuMstr(); var isOk = CheckMdmBuInfo(dto, rm); if (!isOk.IsSuccess) { return(rm); } if (string.IsNullOrEmpty(dto.BU_NO)) { dto.BG_NO = dto.BU_TYPE == 1 ? dto.Id : dto.BG_NO; _initHelper.InitAdd(dto, AbpSession.USR_ID, AbpSession.ORG_NO, AbpSession.BG_NO); entity = dto.ToEntity(); _mdmBuMstrRepository.Insert(entity); } else { _initHelper.InitUpdate(dto, AbpSession.USR_ID); entity = dto.ToEntity(); _mdmBuMstrRepository.Update(entity); } rm.IsSuccess = true; return(rm); }
/// <summary> /// 转换为数据传输对象 /// </summary> /// <param name="entity">实体</param> public static MdmBuMstrDto ToDto(this MdmBuMstr entity) { if (entity == null) { return(new MdmBuMstrDto()); } return(new MdmBuMstrDto { Id = entity.Id, BU_NAME = entity.BU_NAME, BU_SHORT_NAME = entity.BU_SHORT_NAME, BU_REGISTERED_NAME = entity.BU_REGISTERED_NAME, BG_NO = entity.BG_NO, BU_PHONE = entity.BU_PHONE, BU_TYPE = entity.BU_TYPE, BU_AREA = entity.BU_AREA, STATION_COUNT = entity.STATION_COUNT, BU_BRAND = entity.BU_BRAND, OPEN_DATE = entity.OPEN_DATE, OPEN_TYPE = entity.OPEN_TYPE, BU_LEVEL = entity.BU_LEVEL, BU_ADDR_PROVINCE = entity.BU_ADDR_PROVINCE, BU_ADDR_CITY = entity.BU_ADDR_CITY, BU_ADDR_DISTRICT = entity.BU_ADDR_DISTRICT, BU_ADDR = entity.BU_ADDR, MNEMONIC_CODE = entity.MNEMONIC_CODE, BU_STATUS = entity.BU_STATUS, CREATE_PSN = entity.CREATE_PSN, CREATE_DATE = entity.CREATE_DATE, UPDATE_PSN = entity.UPDATE_PSN, UPDATE_DATE = entity.UPDATE_DATE, CREATE_ORG_NO = entity.CREATE_ORG_NO, UDF10 = entity.UDF10, UDF1 = entity.UDF1, UDF2 = entity.UDF2, UDF3 = entity.UDF3, UDF4 = entity.UDF4, UDF5 = entity.UDF5, UDF6 = entity.UDF6, UDF7 = entity.UDF7, UDF8 = entity.UDF8, UDF9 = entity.UDF9, DEL_FLAG = entity.DEL_FLAG, ERP_API_URL = entity.ERP_API_URL, ERP_ORG_NO = entity.ERP_ORG_NO, APP_API_URL = entity.APP_API_URL, BRAND_NO = entity.BRAND_NO, BRAND_NAME = entity.BRAND_NAME, BU_KEY = entity.BU_KEY, BU_BRANCH_NOS = entity.BU_BRANCH_NOS, PARENT_BU_NO = entity.PARENT_BU_NO, PARENT_BU_NAME = entity.PARENT_BU_NAME, USR_QRCODE_PATH = entity.USR_QRCODE_PATH, CARBRAND_IDS = entity.CARBRAND_IDS, CARCLASS_IDS = entity.CARCLASS_IDS, CARCLASS_NO = entity.CARCLASS_NO, CARCLASS_NAME = entity.CARCLASS_NAME }); }