EasyUi应用(增删改查)

本文介绍如何使用EasyUi实现数据的增删查改功能。通过form和dialog布局,配合datagrid获取选中数据,实现前后端分离。详细步骤包括:编写UserDao、创建UserAction子控制器、设计前端展示页面并传值至userManager.js,以及在userManager.js中处理布局和交互效果。
摘要由CSDN通过智能技术生成

接下来使用easyui实现数据的增删查改

利用form和dialog进行布局,然后利用datagrid(‘getSelected’)进行数据回显以及传递数据操作所需的值前后端分离
1.编写UserDao方法

package com.ningjie.dao;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.ningjie.util.JsonBaseDao;
import com.ningjieutil.JsonUtils;
import com.ningjie.util.PageBean;
import com.ningjieutil.StringUtils
public class UserDao extends JsonBaseDao {

/**
	 * 查询方法
	 * @param paMap
	 * @return
	 * @throws Exception
	 * @throws SecurityException
	 * @throws IllegalArgumentException
	 * @throws IllegalAccessException
	 * @throws SQLException
	 */
	 
	public List<Map<String, Object>> look( Map<String,String[]> paMap,PageBean pageBean) throws Exception, SecurityException, IllegalArgumentException, IllegalAccessException, SQLException {
		String sql =" select * from t_easyui_user_version2  where  true  ";
		//获取你要查询的值str
		String uname =JsonUtils.getParamVal(paMap, "uname");
		//确定要传的str值,在sql的基础上加模糊查询语句 
		if(StringUtils.isNotBlank(uname)) {
			sql =sql +"and uname like  '%" +uname.trim() +"%'"; 
		}
		//返回一个执行查询的方法
		return super.executeQuery(sql, pageBean);
	}
	
	/**
	 * 修改方法
	 * @param paMap
	 * @return
	 * @throws Exception
	 * @throws SecurityException
	 * @throws IllegalArgumentException
	 * @throws IllegalAccessException
	 * @throws SQLException
	 */
	
	public int edit(Map<String, String[]> paMap) throws Exception, SecurityException, IllegalArgumentException, IllegalAccessException, SQLException {
		String sql ="update t_easyui_user_version2 set uid=?,uname=?,upwd=? where serialno=?";
		return super.executeUpdate(sql, new String[] {"uid","uname","upwd","SerialNo"}, paMap);
	}
	
	/**
	 * 增加方法
	 * @param paMap
	 * @return
	 * @throws Exception
	 * @throws SecurityException
	 * @throws IllegalArgumentException
	 * @throws IllegalAccessException
	 * @throws SQLException
	 */
	public int add(Map<String, String[]> paMap) throws Exception, SecurityException, IllegalArgumentException, IllegalAccessException, SQLException {
		String sql ="insert  into  t_easyui_user_version2  (uid,uname,upwd)  values (?,?,?)";
		return super.executeUpdate(sql, new String[] {"uid","uname","upwd"} , paMap);
	}
	
	/**
	 * 删除方法
	 * @param paMap
	 * @return
	 * @throws Exception
	 * @throws SecurityException
	 * @throws IllegalArgumentException
	 * @throws IllegalAccessException
	 * @throws SQLException
	 */
	public int del(Map<Str
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值