如何利用layui实现增删查改操作

发布时间:2024-04-08 点击:129
首先认识layui
layui(谐音:类ui) 是一款采用自身模块规范编写的前端 ui 框架,遵循原生 html/css/js 的书写与组织形式,门槛极低,拿来即用。其外在极简,却又不失饱满的内在,体积轻盈,组件丰盈,从核心代码到 api 的每一处细节都经过精心雕琢,非常适合界面的快速开发。
(推荐教程:layui)
下载之后导进css、js样式
简单的效果图
接下来直接上代码
dao方法
package com.chen.dao;import java.sql.sqlexception;import java.util.list;import java.util.map;import com.chen.util.jsonbasedao;import com.chen.util.jsonutils;import com.chen.util.pagebean;import com.chen.util.stringutils;public class booktypedao extends jsonbasedao{ / * 书籍类别查询 * @param pamap * @param pagebean * @return * @throws sqlexception * @throws illegalaccessexception * @throws instantiationexception */ public list<map<string, object>> list(map<string, string[]> pamap,pagebean pagebean) throws instantiationexception, illegalaccessexception, sqlexception{ string sql=" select * from t_type where true"; string tid=jsonutils.getparamval(pamap, "tid"); string tname=jsonutils.getparamval(pamap, "tname"); if(stringutils.isnotblank(tid)) { sql =" and tid =" tid " "; } if(stringutils.isnotblank(tname)) { sql =" and tname like '%" tname "%'"; } sql = " order by tid desc "; return executequery(sql, pagebean); } / * 增加 * @param pamap * @return * @throws nosuchfieldexception * @throws securityexception * @throws illegalargumentexception * @throws illegalaccessexception * @throws sqlexception */ public int addtype(map<string, string[]> pamap) throws nosuchfieldexception, securityexception, illegalargumentexception, illegalaccessexception, sqlexception { string sql="insert into t_type(tname) values(?) "; return super.executeupdate(sql, new string[] {"tname"}, pamap); } / * 修改 * @param pamap * @return * @throws nosuchfieldexception * @throws securityexception * @throws illegalargumentexception * @throws illegalaccessexception * @throws sqlexception */ public int edittype(map<string, string[]> pamap) throws nosuchfieldexception, securityexception, illegalargumentexception, illegalaccessexception, sqlexception { string sql="update t_type set tname=? where tid=?"; return super.executeupdate(sql, new string[] {"tname","tid"}, pamap); } / * 删除 * @param pamap * @return * @throws nosuchfieldexception * @throws securityexception * @throws illegalargumentexception * @throws illegalaccessexception * @throws sqlexception */ public int removetype(map<string, string[]> pamap) throws nosuchfieldexception, securityexception, illegalargumentexception, illegalaccessexception, sqlexception { string sql="delete from t_type where tid=? "; return super.executeupdate(sql, new string[] {"tid"}, pamap); } }entity一个树形的实体类
package com.chen.entity;import java.util.arraylist;import java.util.hashmap;import java.util.list;import java.util.map;public class treenode { private string id; private string name; private map<string, object> attributes = new hashmap<>(); private list<treenode> children = new arraylist<>(); public string getid() { return id; } public void setid(string id) { this.id = id; } public string getname() { return name; } public void setname(string name) { this.name = name; } public map<string, object> getattributes() { return attributes; } public void setattributes(map<string, object> attributes) { this.attributes = attributes; } public list<treenode> getchildren() { return children; } public void setchildren(list<treenode> children) { this.children = children; } public treenode(string id, string text, map<string, object> attributes, list<treenode> children) { super(); this.id = id; this.name = name; this.attributes = attributes; this.children = children; } public treenode() { super(); } @override public string tostring() { return "treenode [id=" id ", name=" name

冰河云服务器怎么样
帮忙把这服务器开一天我把数据备份一下
下面个域名之前有解析指向到西部数码的其他服务器
域名邮箱是什么?域名邮箱注册方法介绍
基于微软Azure及AI技术 诺和诺德研发糖尿病智能问答机器人
电脑中更换了tplink路由器后电脑视频无法观看如何解决
云挂机服务器设置
如果我们会做网站 有这个技能应该怎么赚钱?