You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
987 B
38 lines
987 B
using System;
|
|
using PetaPoco;
|
|
using Pingchuan.BeijingSafeguard.Model;
|
|
|
|
namespace Pingchuan.BeijingSafeguard.DAL
|
|
{
|
|
public class OrgDAL : BaseDAL
|
|
{
|
|
public static int Add(Org org)
|
|
{
|
|
object id = db.Insert(org);
|
|
return int.Parse(id.ToString());
|
|
}
|
|
|
|
public static int Update(Org org)
|
|
{
|
|
return db.Update(org);
|
|
}
|
|
|
|
public static int Delete(int id)
|
|
{
|
|
return db.Delete<Org>(id);
|
|
}
|
|
|
|
public static int Enable(int id, int enable)
|
|
{
|
|
string sql = $@"update orgs set enable = {enable} where id = {id}";
|
|
return db.Execute(sql);
|
|
}
|
|
|
|
public static Pagination<Org> Query(int pageIndex, int pageSize)
|
|
{
|
|
string sql = $@"select * from orgs order by create_time desc";
|
|
Page<Org> orgs = db.Page<Org>(pageIndex, pageSize, sql);
|
|
return Pagination<Org>.FromPage(orgs);
|
|
}
|
|
}
|
|
}
|
|
|