1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using Models;
- using System.Data;
- using System.Data.SqlClient;
- namespace DAL
- {
- public class MonthKpiItemMarkService
- {
- /// <summary>
- /// 查询所有
- /// </summary>
- /// <param name="sql">sql语句</param>
- /// <param name="param">可变参数数组</param>
- /// <returns>返回集合</returns>
- List<MonthKpiItemMark> excuteSql(string sql, params SqlParameter[] param)
- {
- return ServiceBase<MonthKpiItemMark>.excuteSql(new MonthKpiItemMark(), "MonthKpiItemMark", sql, CommandType.Text, param);
- }
- /// <summary>
- /// 获取单个对象
- /// </summary>
- /// <param name="sql">sql语句</param>
- /// <param name="param">可变参数数组</param>
- /// <returns>返回空或者单个对象</returns>
- MonthKpiItemMark excuteType(string sql, params SqlParameter[] param)
- {
- //查询结果放入对象集合
- List<MonthKpiItemMark> hdList = excuteSql(sql, param);
- //判断集合是否为空
- if (hdList == null || hdList.Count == 0)
- //返回null
- return null;
- //返回单个对象
- return hdList[0];
- }
- /// <summary>
- /// 根据Id查询对象信息
- /// </summary>
- /// <param name="id">对象编号</param>
- /// <returns>返回空或者单个对象信息</returns>
- public MonthKpiItemMark GetItemScoreByID(int id)
- {
- //调用获取单个对象的方法
- return excuteType("select * from MonthKpiItemMark where Id = @id and IsDel = 0", new SqlParameter("@id", id));
- }
- /// <summary>
- /// 根据KpiItemId查询信息
- /// </summary>
- /// <returns>返回空或者对象集合</returns>
- public List<MonthKpiItemMark> GetItemScoreByItemId(int ItemId)
- {
- return excuteSql("select * from MonthKpiItemMark where IsDel=0 and KpiItemId="+ItemId);
- }
- /// <summary>
- /// 查询所有
- /// </summary>
- /// <returns></returns>
- public List<MonthKpiItemMark> GetAll()
- {
- return excuteSql("select * from MonthKpiItemMark where IsDel=0", null);
- }
- }
- }
|