using Dapper;
using Learun.DataBase.Repository;
using Learun.Util;
using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
namespace Learun.Application.TwoDevelopment.PersonnelManagement
{
///
/// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
/// Copyright (c) 2013-2018 北京泉江科技有限公司
/// 创 建:超级管理员
/// 日 期:2019-03-25 11:16
/// 描 述:工资条
///
public class SalarySheetService : RepositoryFactory
{
#region 获取数据
///
/// 获取页面显示列表数据
///
/// 查询参数
///
public IEnumerable GetPageList(Pagination pagination, string queryJson)
{
try
{
var strSql = new StringBuilder();
strSql.Append("SELECT ");
strSql.Append(@"
t.SalarySheetId,
t.FK_Departmentid,
t.Name,
t.SalaryDate,
t.BaseSalary,
t.JobSubsidies,
t.PerformanceBonus,
t.MobilePhoneFee,
t.TransportationFee,
t.AttendanceBonus,
t.SSalary,
t.PensionInsurance,
t.PersonalLeave,
t.Late,
t.Sick,
t.PersonalIncomeTax,
t.Fsalary
");
strSql.Append(" FROM SalarySheet t ");
strSql.Append(" WHERE 1=1 ");
var queryParam = queryJson.ToJObject();
// 虚拟参数
var dp = new DynamicParameters(new { });
if (!queryParam["FK_Departmentid"].IsEmpty())
{
dp.Add("FK_Departmentid", queryParam["FK_Departmentid"].ToString(), DbType.String);
strSql.Append(" AND t.FK_Departmentid = @FK_Departmentid ");
}
if (!queryParam["Name"].IsEmpty())
{
dp.Add("Name", "%" + queryParam["Name"].ToString() + "%", DbType.String);
strSql.Append(" AND t.Name Like @Name ");
}
return this.BaseRepository().FindList(strSql.ToString(), dp, pagination);
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}
internal object GetList()
{
try
{
var userInfo = LoginUserInfo.Get();
var result = this.BaseRepository().FindList(a => a.FK_Departmentid == userInfo.departmentId && userInfo.realName == a.Name);
List