招聘后台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

53 lines
1.8 KiB

using Dapper;
using System;
using System.Data;
using Znyc.Recruitment.Admin.Commons.IDbContext;
using Znyc.Recruitment.Admin.Commons.Repositories;
using Znyc.Recruitment.Admin.Security.Entitys;
using Znyc.Recruitment.Admin.Security.IRepositories;
namespace Znyc.Recruitment.Admin.Security.Repositories
{
public class UploadFileRepository : BaseRepository<UploadFileEntity, long>, IUploadFileRepository
{
public UploadFileRepository()
{
}
public UploadFileRepository(IDbContextCore dbContext) : base(dbContext)
{
}
/// <summary>
/// 根据应用Id和应用标识批量更新数据
/// </summary>
/// <param name="beLongAppId">更新后的应用Id</param>
/// <param name="oldBeLongAppId">更新前旧的应用Id</param>
/// <param name="belongApp">应用标识</param>
/// <param name="trans"></param>
/// <returns></returns>
public bool UpdateByBeLongAppId(string beLongAppId, string oldBeLongAppId, string belongApp = null,
IDbTransaction trans = null)
{
try
{
trans = DapperConn.BeginTransaction();
string sqlStr = string.Format("update {0} set beLongAppId='{1}' where beLongAppId='{2}'", tableName,
beLongAppId, oldBeLongAppId);
if (!string.IsNullOrEmpty(belongApp))
{
sqlStr = string.Format(" and BelongApp='{0}'", belongApp);
}
long num = DapperConn.Execute(sqlStr, null, trans);
trans.Commit();
return num >= 0;
}
catch (Exception)
{
trans.Rollback();
throw;
}
}
}
}