jfinal功能性代码

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;

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文件的时候的 节点的显示的顺序
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值