jfinal功能性代码
2015-11-28 15:56
218 查看
JFianl
1 得到当前的表中的最大的id值
/**
* 查询模板最大值
*/
private static long maxTpId() {
String url = “jdbc:mysql://220.178.51.188:2906/horce3”;
String username = “horce”;
String password = “horce@loday”;
DruidPlugin dbPlugin = new DruidPlugin(url, username, password);
dbPlugin.start();
//利用DbKit得到数据源的使用的权力 为使用Db准备
DbKit.setDataSource(dbPlugin.getDataSource());
//查询一个Long类型的数据
long maxId = Db.queryLong(“select max(id) from pod_circletemplates”);
dbPlugin.stop();
return maxId+1;
}
2 建立一个bean的list对象
public class TemplateDto{
;;;;;;;;;;;;;;
}
public class TemplateListDto implements Serializable {
private static final long serialVersionUID = 3191335902715268098L;
}
3 插入数据到数据库的时候 没有任何的数据库连接的参数的时候
/**
* 插入数据库
*/
private static void excuteSQL(List sqlList) {
String url = “jdbc:mysql://220.178.51.188:2906/horce3”;
String username = “horce”;
String password = “horce@loday”;
DruidPlugin dbPlugin = new DruidPlugin(url, username, password);
dbPlugin.start();
//这2行的代码就是为Db得到相应的数据源
//DbKit.setDataSource(dbPlugin.getDataSource());
//long maxId = Db.queryLong(“select max(id) from pod_circletemplates”);
4 java –> xml
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = “pic”)
@XmlType(propOrder = { “pagecontentid”, “infoid”, “contentflag”, “type”, “picid”, “x”, “y”, “angle”, “width”, “height”, “content”, “textstartnum”,
“textlenth”, “depth”, “bgcolor”, “fontDto”,”maskId”,”left”,”top”,”picWidth”,”picHeight”,”lines”})
public class UIContentDto implements Serializable {
private static final long serialVersionUID = 1L;
@XmlAccessorType(XmlAccessType.FIELD) 所有的字段都会变成xml文件的节点
@XmlAccessorType(XmlAccessType.PROPERTY)
1 得到当前的表中的最大的id值
/**
* 查询模板最大值
*/
private static long maxTpId() {
String url = “jdbc:mysql://220.178.51.188:2906/horce3”;
String username = “horce”;
String password = “horce@loday”;
DruidPlugin dbPlugin = new DruidPlugin(url, username, password);
dbPlugin.start();
//利用DbKit得到数据源的使用的权力 为使用Db准备
DbKit.setDataSource(dbPlugin.getDataSource());
//查询一个Long类型的数据
long maxId = Db.queryLong(“select max(id) from pod_circletemplates”);
dbPlugin.stop();
return maxId+1;
}
2 建立一个bean的list对象
public class TemplateDto{
;;;;;;;;;;;;;;
}
public class TemplateListDto implements Serializable {
private static final long serialVersionUID = 3191335902715268098L;
public List<TemplateDto> templateList = new ArrayList<TemplateDto>(); public List<TemplateDto> getTemplateDtoList() { return templateList; } public void setTemplateList(List<TemplateDto> templateList) { this.templateList = templateList; }
}
3 插入数据到数据库的时候 没有任何的数据库连接的参数的时候
/**
* 插入数据库
*/
private static void excuteSQL(List sqlList) {
String url = “jdbc:mysql://220.178.51.188:2906/horce3”;
String username = “horce”;
String password = “horce@loday”;
DruidPlugin dbPlugin = new DruidPlugin(url, username, password);
dbPlugin.start();
//这2行的代码就是为Db得到相应的数据源
//DbKit.setDataSource(dbPlugin.getDataSource());
//long maxId = Db.queryLong(“select max(id) from pod_circletemplates”);
//此行代码的内部得到了数据源 Db.batch(dbPlugin.getDataSource(), sqlList, 1); dbPlugin.stop(); }
4 java –> xml
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = “pic”)
@XmlType(propOrder = { “pagecontentid”, “infoid”, “contentflag”, “type”, “picid”, “x”, “y”, “angle”, “width”, “height”, “content”, “textstartnum”,
“textlenth”, “depth”, “bgcolor”, “fontDto”,”maskId”,”left”,”top”,”picWidth”,”picHeight”,”lines”})
public class UIContentDto implements Serializable {
private static final long serialVersionUID = 1L;
// @XmlAttribute(name="pagecontentid") private long pagecontentid;// 页面元素id,唯一标识 // @XmlAttribute(name="infoid") private long infoid;// 图片id或时光片id // @XmlAttribute(name="contentflag") private String contentflag;
@XmlAccessorType(XmlAccessType.FIELD) 所有的字段都会变成xml文件的节点
@XmlAccessorType(XmlAccessType.PROPERTY)
@XmlRootElement(name = "pic") pic 为xml文件的根节点 @XmlType 生成xml文件的时候的 节点的显示的顺序
相关文章推荐
- Java heap space
- java 中常见异常
- asp.net实现输出xml的方法
- java加载文件路径问题
- Spring声明式事务管理(基于注解的方式)
- CodeForces 598D Igor In the Museum 暴力
- 用java读写properties文件的代码
- Java注解知识点整理
- PHP函数操作数组(集合贴)
- PHPExcel类库使用手册
- eclipse 安装mat插件
- git和github
- C++设计模式——从多态到观察者模式到MVC架构
- C/C++之回调函数
- python高可用程序设计方法
- DragonBoard 410c的配置与系统更新
- 四则运算《《《代码封装
- spring核心组件
- python 切片
- 《Windows核心编程》の托盘程序的编写(CSystemTray类) (转)