package xu.qi.jin.impl;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import xu.qi.jin.dao.TreeNodeDAO;
import xu.qi.jin.vo.NodeVo;
public class TreeNodeDAOImpl implements TreeNodeDAO {
private Connection conn = null;
private PreparedStatement pst = null;
public TreeNodeDAOImpl(Connection conn) {
this.conn = conn;
}
public boolean addNode(NodeVo vo) throws Exception {
boolean flag = false;
String sql = "insert into tree_node values(?,?,?,?,?,?)";
this.pst = this.conn.prepareStatement(sql);
this.pst.setInt(1, vo.getTreeid());
this.pst.setString(2, vo.getUid());
this.pst.setString(3, vo.getHtmlnode());
this.pst.setInt(4, vo.getPid());
this.pst.setString(5, vo.getTitle());
this.pst.setString(6, vo.getXingzhi());
if (this.pst.executeUpdate() > 0) {
flag = true;
}
this.pst.close();
return flag;
}
public boolean deleteNode(int id,String p) throws Exception {
boolean flag = false;
String sql = "delete from tree_node where tree_id=? and u_id=?";
this.pst = this.conn.prepareStatement(sql);
this.pst.setInt(1, id);
this.pst.setString(2,p);
if (this.pst.executeUpdate() >= 1) {
flag = true;
}
this.pst.close();
return flag;
}
public boolean deleteNode2(int id,String pid)throws Exception{
boolean flag = false;
String sql = "delete from tree_node where p_id=? and u_id=?";
this.pst = this.conn.prepareStatement(sql);
this.pst.setInt(1, id);
this.pst.setString(2,pid);
if (this.pst.executeUpdate() >= 1) {
flag = true;
}
this.pst.close();
return flag;
}
public String searchNode(int id,String p) throws Exception {
String s = null;
String sql = "SELECT * FROM tree_node WHERE tree_id=? and u_id=?";
this.pst = this.conn.prepareStatement(sql);
this.pst.setInt(1, id);
this.pst.setString(2,p);
ResultSet rs = this.pst.executeQuery();
while (rs.next()) {
s = rs.getString(3);
}
this.pst.close();
rs.close();
return s;
}
public boolean updateNode(int id, String nodeHtml,String uid) throws Exception {
boolean flag = false;
String sql = "update tree_node set htmlnode=? where tree_id=? and u_id=?";
this.pst = this.conn.prepareStatement(sql);
pst.setString(1, nodeHtml);
pst.setInt(2, id);
pst.setString(3,uid);
if (this.pst.executeUpdate()>= 1) {
flag = true;
}
this.pst.close();
return flag;
}
public boolean updateTitle(int id, String t,String p) throws Exception {
boolean flag = false;
String sql = "update tree_node set title=? where tree_id=? and u_id=?";
this.pst = this.conn.prepareStatement(sql);
pst.setString(1, t);
pst.setInt(2, id);
pst.setString(3, p);
if (this.pst.executeUpdate() >= 1) {
flag = true;
}
this.pst.close();
return flag;
}
public boolean updateXingzhi(String ss,int id,String uid)throws Exception{
boolean flag = false;
String sql = "update tree_node set xingzhi=CONCAT(xingzhi,?) where tree_id=? and u_id=?";
this.pst = this.conn.prepareStatement(sql);
pst.setString(1,ss);
pst.setInt(2, id);
pst.setString(3,uid);
if (this.pst.executeUpdate()>= 1) {
flag = true;
}
this.pst.close();
return flag;
}
public String getXingzhi(int id,String uid)throws Exception{
String ss="";
String sql = "SELECT xingzhi FROM tree_node WHERE tree_id=? and u_id=?"; //将用户u_id的全部节点全部提取
this.pst = this.conn.prepareStatement(sql);
this.pst.setInt(1,id);
this.pst.setString(2,uid);
ResultSet rs = this.pst.executeQuery();
while (rs.next()) {
ss=rs.getString(1);
}
this.pst.close();
rs.close();
return ss;
}
public boolean initNodes(int i1,String s,int i2)throws Exception{
boolean flag = false;
String sql = "insert into tree_node values(?,?,?,?,?,?)";
this.pst = this.conn.prepareStatement(sql);
this.pst.setInt(1, i1);
this.pst.setString(2, s);
this.pst.setString(3, "haha");
this.pst.setInt(4, i2);
this.pst.setString(5, "undefirtyned");
this.pst.setString(6, "rtyty");
if (this.pst.executeUpdate() > 0) {
flag = true;
}
this.pst.close();
return flag;
}
public String loadNode(String s)throws Exception{
String ss="";
String sql = "SELECT * FROM tree_node WHERE u_id=?"; //将用户u_id的全部节点全部提取
this.pst = this.conn.prepareStatement(sql);
this.pst.setString(1,s);
ResultSet rs = this.pst.executeQuery();
while (rs.next()) {
ss+="{"+"\""+"id"+"\""+":"+rs.getInt(1)+","+"\""+"parentId"+"\""+":"+rs.getInt(4)+","+"\""+"name"+"\""+":"+"\""+rs.getString(5)+"\""+"}"+",";
}
this.pst.close();
rs.close();
ss=ss.substring(0,ss.length()-1);
ss="["+ss+"]";
return ss;
}
public boolean setJsNull(int id,String uid)throws Exception{
boolean flag = false;
String sql ="update tree_node set xingzhi=\" \" where tree_id=? and u_id=?";
this.pst = this.conn.prepareStatement(sql);
this.pst.setInt(1, id);
this.pst.setString(2, uid);
if (this.pst.executeUpdate() > 0) {
flag = true;
}
this.pst.close();
return flag;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
基于web的在线界面设计系统 (1361个子文件)
TreeNodeDAOImpl.class 6KB
TreeNodeDAOImpl.class 6KB
TreeNodeDAOProxy.class 4KB
TreeNodeDAOProxy.class 4KB
UsersDAOImpl.class 3KB
UsersDAOImpl.class 3KB
nodeTitle.class 2KB
nodeTitle.class 2KB
treeNode.class 2KB
treeNode.class 2KB
DeleteNode2.class 2KB
DeleteNode2.class 2KB
updateNodeHtml.class 2KB
updateNodeHtml.class 2KB
InitNode.class 2KB
InitNode.class 2KB
LoginServlet.class 2KB
LoginServlet.class 2KB
DeleteNode.class 2KB
DeleteNode.class 2KB
UsersDAOProxy.class 2KB
UsersDAOProxy.class 2KB
SetJs.class 2KB
SetJs.class 2KB
GetJs.class 2KB
GetJs.class 2KB
TreeHtml.class 2KB
TreeHtml.class 2KB
DeleteNode1.class 2KB
DeleteNode1.class 2KB
GetNodeHtml.class 2KB
GetNodeHtml.class 2KB
SetJsNull.class 2KB
SetJsNull.class 2KB
TreeNodeLoad.class 2KB
TreeNodeLoad.class 2KB
RigestCustom.class 2KB
RigestCustom.class 2KB
LoginFilter.class 2KB
LoginFilter.class 2KB
NodeVo.class 1KB
NodeVo.class 1KB
DataBaseConnection.class 1KB
DataBaseConnection.class 1KB
UserVo.class 1KB
UserVo.class 1KB
BianMa.class 1KB
BianMa.class 1KB
Test.class 1019B
Test.class 1019B
TreeNodeDAO.class 741B
TreeNodeDAO.class 741B
DAOFactory.class 634B
DAOFactory.class 634B
UsersDAO.class 403B
UsersDAO.class 403B
.classpath 529B
eyui.css 34KB
eyui.css 34KB
easyui.css 33KB
easyui.css 33KB
easyui.css 32KB
easyui.css 32KB
easyui.css 29KB
easyui.css 29KB
datagrid.css 4KB
datagrid.css 4KB
datagrid.css 4KB
datagrid.css 4KB
datagrid.css 4KB
datagrid.css 4KB
tabs.css 4KB
tabs.css 4KB
tabs.css 4KB
tabs.css 4KB
tree.css 3KB
tree.css 3KB
tree.css 3KB
tree.css 3KB
tree.css 3KB
tree.css 3KB
tabs.css 3KB
tabs.css 3KB
calendar.css 3KB
calendar.css 3KB
calendar.css 3KB
calendar.css 3KB
calendar.css 3KB
calendar.css 3KB
panel.css 2KB
panel.css 2KB
panel.css 2KB
panel.css 2KB
panel.css 2KB
panel.css 2KB
layout.css 2KB
layout.css 2KB
layout.css 2KB
layout.css 2KB
layout.css 2KB
共 1361 条
- 1
- 2
- 3
- 4
- 5
- 6
- 14
光西
- 粉丝: 2
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页