jFinal的model增删该查
来源:互联网 发布:得力dl33113的dat数据 编辑:程序博客网 时间:2024/04/30 23:14
package com.bytech.model;import java.util.List;import com.jfinal.plugin.activerecord.Db;import com.jfinal.plugin.activerecord.Model;public class Customer extends Model<Customer> {public static final Customer dao=new Customer();public Customer() {// TODO Auto-generated constructor stub}public List<Customer> queryCustomerList(){try {String sql="select * from customer ";return dao.find(sql);} catch (Exception e) {e.printStackTrace();return null;}}//根据客户id查出一条数据public Customer queryCustomerById(String CustomerId){try {String sql="select * from customer where CustomerId=?";return dao.findFirst(sql, CustomerId);} catch (Exception e) {e.printStackTrace();return null;}}//public Customer addCustomer(String CustomerName,String Address,String Contact,String Annotate){try{boolean bret = dao.clear(). set("CustomerName",CustomerName). set("Address",Address). set("Contact",Contact). set("Annotate",Annotate).save();//这些数据直接加入数据中//id则自动递增if(bret){int id = dao.getInt("CustomerId");return dao.findById(id);}else{return null;}}catch(Exception ex){ex.printStackTrace();return null;}}//修改public Customer editCustomer(String CustomerId,String CustomerName,String Address,String Contact,String Annotate){try {String update="UPDATE customer set CustomerName=?,"+ "Address=?,Contact=?,Annotate=? where CustomerId=?";int iRet=Db.update(update,CustomerName,Address,Contact,Annotate,CustomerId);if(iRet > 0){return dao.findById(CustomerId);}else{return null;}}catch(Exception ex){ex.printStackTrace();return null;}}//删除public boolean delectCustomer(String CustomerId){try {String delsql="DELETE FROM customer WHERE CustomerId=?";int iRet=Db.update(delsql, CustomerId);if(iRet > 0){return true;}else{return false;}} catch (Exception e) {e.printStackTrace();return false;}}}
0 0
- jFinal的model增删该查
- Jfinal(三)--------Model的增删改查
- ssh的增删该查
- jfinal结合easyui完成基本的增删改查操作
- 增删该查 联系人的 service
- php原生的增删该查
- mybatis简化的增删该查
- 对于数据库的增删该查处理
- laravel 5.2 简单的增删该查
- yii框架的增删该查
- redis 基本的增删该查分页
- easyui简单的增删该查
- discuz 增删该查
- discuz 增删该查
- 增删该查
- java增删该查的源头 ArrayList增删该查的底层实现
- TP增删该查改进
- SQLite数据增删该查
- springmvc+hibernate融合开发
- struts2中的modelDriven机制及运用
- bzoj 2799 [Poi2012]Salaries 贪心
- 大型网站技术架构
- UI/UX设计师,你的薪资跟上了吗?
- jFinal的model增删该查
- 少走冤枉路!带你走过SNMP的那些坑
- 条件筛选
- ListView点击事件冲突
- eclipse上传代码到github,漏掉的代码怎么上传解决方法
- APP接口 具体操作
- ping命令在windows下的使用
- vim编辑器的配置
- Android7.0 Messaging源码分析(1) - 基础知识篇