/// <summary> /// 更新一条数据 /// </summary> public void Update(Wuyiju.Model.AuthItem model) { StringBuilder sql = new StringBuilder(); sql.Append("update AuthItem set "); sql.Append(" auth_code = @auth_code , "); sql.Append(" auth_title = @auth_title , "); sql.Append(" auth_day = @auth_day , "); sql.Append(" auth_small_ico = @auth_small_ico , "); sql.Append(" auth_small_n_ico = @auth_small_n_ico , "); sql.Append(" auth_big_ico = @auth_big_ico , "); sql.Append(" auth_desc = @auth_desc , "); sql.Append(" auth_cash = @auth_cash , "); sql.Append(" auth_expir = @auth_expir , "); sql.Append(" auth_open = @auth_open , "); sql.Append(" auth_show = @auth_show , "); sql.Append(" muti_auth = @muti_auth , "); sql.Append(" update_time = @update_time , "); sql.Append(" auth_dir = @auth_dir , "); sql.Append(" listorder = @listorder , "); sql.Append(" config = @config "); sql.Append(" where auth_code=@auth_code "); DynamicParameters param = new DynamicParameters(); if (model != null) { param.AddDynamicParams(model); } var rows = db.Execute(sql, param); if (rows < 1) { throw new ApplicationException("更新数据无效"); } }
/// <summary> /// 增加一条数据 /// </summary> public void Insert(Wuyiju.Model.AuthItem model) { StringBuilder sql = new StringBuilder(); sql.Append("insert into ec_auth_item("); sql.Append("auth_code,auth_title,auth_day,auth_small_ico,auth_small_n_ico,auth_big_ico,auth_desc,auth_cash,auth_expir,auth_open,auth_show,muti_auth,update_time,auth_dir,listorder,config"); sql.Append(") values ("); sql.Append("@auth_code,@auth_title,@auth_day,@auth_small_ico,@auth_small_n_ico,@auth_big_ico,@auth_desc,@auth_cash,@auth_expir,@auth_open,@auth_show,@muti_auth,@update_time,@auth_dir,@listorder,@config"); sql.Append(") "); DynamicParameters param = new DynamicParameters(); if (model != null) { param.AddDynamicParams(model); } var rows = db.Execute(sql, param); if (rows < 1) { throw new ApplicationException("插入数据无效"); } }