69 lines
1.7 KiB
C#
69 lines
1.7 KiB
C#
|
|
using WcsMain.Common;
|
|||
|
|
using WcsMain.DataBase.TableEntity;
|
|||
|
|
using WcsMain.WcsAttribute.AutoFacAttribute;
|
|||
|
|
|
|||
|
|
namespace WcsMain.DataBase.Dao;
|
|||
|
|
|
|||
|
|
[Component]
|
|||
|
|
public class AppUserGroupDao
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
public List<AppUserGroup>? Query() => Query(new AppUserGroup());
|
|||
|
|
|
|||
|
|
|
|||
|
|
public List<AppUserGroup>? Query(AppUserGroup queryEntity)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
var sqlFuc = CommonTool.DbServe.Queryable<AppUserGroup>()
|
|||
|
|
.WhereIF(queryEntity.GroupId != default, w => w.GroupId == queryEntity.GroupId)
|
|||
|
|
.WhereIF(queryEntity.GroupName != default, w => w.GroupName == queryEntity.GroupName)
|
|||
|
|
.WhereIF(queryEntity.GroupStatus != default, w => w.GroupStatus == queryEntity.GroupStatus)
|
|||
|
|
.OrderBy(o => o.GroupId);
|
|||
|
|
return sqlFuc.ToList();
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
_ = ex;
|
|||
|
|
return default;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 添加用户组
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="userGroups"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
public int Insert(params AppUserGroup[] userGroups)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
var result = CommonTool.DbServe.Insertable(userGroups).ExecuteCommand();
|
|||
|
|
return result;
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
_ = ex;
|
|||
|
|
return 0;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 删除用户组,根据主键
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="userGroup"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
public int Delete(AppUserGroup userGroup)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
var result = CommonTool.DbServe.Deleteable(userGroup).ExecuteCommand();
|
|||
|
|
return result;
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
_ = ex;
|
|||
|
|
return 0;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|