简介
我们要用前端easyui来实现美化,用datagrid布局,dialog布局还有from布局来把原来的html转成jsp
前后端分离
前后端分离的好处
1、美工、java工程师都是独立工作的,彼此之间在开发过程中是没有任何交际,在开发前约定数据交互的格式,项目可以同步进行,缩短了项目周期
2、解耦了前端与后端的工作内容
代码
1.UserDao
public class UserDao extends JsonBaseDao {
/**
* 用户登录或者查询用户分页信息的公共方法
* @param paMap
* @param pageBean
* @return
* @throws InstantiationException
* @throws IllegalAccessException
* @throws SQLException
*/
public List<Map<String, Object>> list(Map<String, String[]> paMap,PageBean pageBean)throws InstantiationException, IllegalAccessException, SQLException{
String sql = "select * from t_easyui_user_version2 where true ";
String uid = JsonUtils.getParamVal(paMap, "uid");
String upwd = JsonUtils.getParamVal(paMap, "upwd");
if(StringUtils.isNotBlank(uid)) {
sql += " and uid = "+uid;
}
if(StringUtils.isNotBlank(upwd)) {
sql += " and upwd = "+upwd;
}
return super.executeQuery(sql, pageBean);
}
/**
* 添加
* @param paMap
* @return
* @throws NoSuchFieldException
* @throws SecurityException
* @throws IllegalArgumentException
* @throws IllegalAccessException
* @throws SQLException
*/
public int add(Map<String, String[]> paMap) throws NoSuchFieldException, 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 NoSuchFieldException
* @throws SecurityException
* @throws IllegalArgumentException
* @throws IllegalAccessException
* @throws SQLException
*/
public int del(Map<String, String[]> paMap) throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException, SQLException {
String sql = "delete from t_easyui_user_version2 where SerialNo=?";
return super.executeUpdate(sql, new String[] {"SerialNo"}, paMap);
}
/**
* 修改
* @param paMap
* @return
* @throws NoSuchFieldException
* @throws SecurityException
* @throws IllegalArgumentException