PositionService.cs 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using Models;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Data.SqlClient;
  5. using System.Data;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace DAL
  10. {
  11. public class PositionService
  12. {
  13. List<Position> excuteSql(string sql, params SqlParameter[] param)
  14. {
  15. return ServiceBase<Position>.excuteSql(new Position(), "Position", sql, CommandType.Text, param);
  16. }
  17. Position excuteType(string sql, params SqlParameter[] param)
  18. {
  19. //查询结果放入对象集合
  20. List<Position> hdList = excuteSql(sql, param);
  21. Position position = new Position();
  22. //判断集合是否为空
  23. if (hdList == null || hdList.Count == 0)
  24. {
  25. return position;
  26. }
  27. //返回单个对象
  28. return hdList[0];
  29. }
  30. public List<Position> GetAll()
  31. {
  32. return excuteSql("select * from Position where isdel = 0");
  33. }
  34. }
  35. }