/// <summary> /// 根据PID获取单位科室 /// </summary> /// <param name="Pid"></param> /// <returns></returns> public DepartmentMaintenance GetDepartmentMaintenancePid(int Pid) { using (MySqlConnection conn = DapperHelper.GetConnString()) { conn.Open(); string sql = @"SELECT Id,EmployingUnit,UnitDepartment,IsStart,CreationTime,ModificationTime,Pid FROM departmentmaintenance WHERE Pid=@Pid"; DepartmentMaintenance result = conn.Query <DepartmentMaintenance>(sql, new { Pid }).FirstOrDefault(); return(result); } }
/// <summary> /// 添加单位科室 /// </summary> /// <param name="departmentMaintenance"></param> /// <returns></returns> public int AddDepartmentMaintenance(DepartmentMaintenance departmentMaintenance) { using (MySqlConnection conn = DapperHelper.GetConnString()) { conn.Open(); departmentMaintenance.ModificationTime = System.DateTime.Now; departmentMaintenance.EmployingUnit = departmentMaintenance.Pid.ToString(); string sql = @"INSERT INTO departmentmaintenance(EmployingUnit,UnitDepartment,IsStart,CreationTime,ModificationTime,Pid) VALUES(@EmployingUnit,@UnitDepartment,@IsStart,@CreationTime,@ModificationTime,@Pid)"; var result = conn.Execute(sql, departmentMaintenance); return(result); } }
/// <summary> /// 修改单位科室 /// </summary> /// <param name="departmentMaintenance"></param> /// <returns></returns> public int UpdateDepartmentMaintenance(DepartmentMaintenance departmentMaintenance) { using (MySqlConnection conn = DapperHelper.GetConnString()) { conn.Open(); departmentMaintenance.ModificationTime = System.DateTime.Now; departmentMaintenance.EmployingUnit = departmentMaintenance.Pid.ToString(); string sql = @"UPDATE departmentmaintenance SET EmployingUnit=@EmployingUnit,UnitDepartment=@UnitDepartment,IsStart=@IsStart,CreationTime=@CreationTime,ModificationTime=@ModificationTime,Pid=@Pid WHERE Id=@Id"; var result = conn.Execute(sql, departmentMaintenance); return(result); } }
public int AddDepartmentMaintenance(DepartmentMaintenance departmentMaintenance) { int i = IdepartmentMaintenanceServices.AddDepartmentMaintenance(departmentMaintenance); return(i); }
public int UpdateDepartmentMaintenance(DepartmentMaintenance departmentMaintenance) { return(IdepartmentMaintenanceServices.UpdateDepartmentMaintenance(departmentMaintenance)); }