Răsfoiți Sursa

add 新增PageData 工具类

bzd_lxf 2 luni în urmă
părinte
comite
b357c18120

+ 119 - 0
pm-common/src/main/java/com/pm/common/config/ConfigFile.java

@@ -0,0 +1,119 @@
+package com.pm.common.config;
+
+import java.io.Serializable;
+
+/**
+ * 全局统一的配置变量及标识码-客户端和服务器端
+ * @提示 code为200正常;msg的提示信息
+ * @作者 LiXiangFei
+ * @版本 v1.0
+ * @创建时间 2024年9月26日 16:11:29
+*/
+public final class ConfigFile implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	/**自定义code及msg*/
+	public final static int code198 = 198;
+	/**操作失败*/
+	public final static int code199 = 199;
+	/**操作失败*/
+	public final static String msg199 = "操作失败";
+	/**操作成功*/
+	public final static int code200 = 200;
+	/**操作成功*/
+	public final static String msg200 = "操作成功";
+	/**暂无数据*/
+	public final static int code201 = 201;
+	/**暂无数据*/
+	public final static String msg201 = "暂无数据";
+	/**请求参数不完整*/
+	public final static int code202 = 202;
+	/**请求参数不完整*/
+	public final static String msg202 = "请求参数不完整";
+	/**密钥验证失败*/
+	public final static int code203 = 203;
+	/**密钥验证失败*/
+	public final static String msg203 = "密钥验证失败";
+	/**系统异常*/
+	public final static int code204 = 204;
+	/**系统异常*/
+	public final static String msg204 = "系统异常";
+	/**未登录或登录超时*/
+	public final static int code205 = 205;
+	/**未登录或登录超时*/
+	public final static String msg205 = "未登录或登录超时";
+	/**账号或密码不正确*/
+	public final static int code206 = 206;
+	/**账号或密码不正确*/
+	public final static String msg206 = "账号或密码不正确";
+	/**非法操作!或你的账号已被删除|你的账号已被禁用,一般用于被迫强制退出登录*/
+	public final static int code207 = 207;
+	/**你的账号已被删除*/
+	public final static String msg207 = "你的账号已被删除";
+	/**非法操作!*/
+	public final static String illegality_handle = "非法操作!";
+	/**返回结果key*/
+	public final static String result = "result";
+	/**返回自定义结果key,值是-1*/
+	public final static String key = "-1";
+	/**返回失败key*/
+	public final static String key0 = "0";
+	/**返回成功的key*/
+	public final static String key1 = "1";
+	/**全局的登陆者的uid主键*/
+	public final static String KEY_UID = "userId";
+	/**分页的区间标识符*/
+	public final static String section = "section";
+	/**Oracle数据库分页的<=限制*/
+	public final static String KEYROWS = "KEYROWS";
+	/**Oracle数据库分页的>=限制*/
+	public final static String KEYRN = "KEYRN";
+	/**自定义全局变量登录人的系统id主键编号标识*/
+	public final static String LOGIN_KEY = "login_key";
+	/**自定义全局变量登录者的账号*/
+	public final static String LOGIN_USER = "login_user";
+	/**自定义全局变量最高权限及最最超级系统管理员admin*/
+	/**统一全局的total总条数|总记录数json关键字key响应给客户端*/
+	public final static String total = "total";
+	/**统一全局的totalPage总页数json关键字key响应给客户端*/
+	public final static String totalPage = "totalPage";
+	/**统一全局的code的状态码json关键字key关键字响应给客户端*/
+	public final static String code = "code";
+	/**统一全局的msg提示消息json关键字key响应给客户端*/
+	public final static String msg = "msg";
+	/**统一全局的map数据json关键字key响应给客户端*/
+	public final static String map = "map";
+	/**统一全局的obj数据json关键字key响应给客户端*/
+	public final static String obj = "obj";
+	/**统一全局的callback调用接口方法json关键字key响应给客户端*/
+	public final static String callback = "callback";
+	/**统一全局的pageSize每页大小json关键字key响应给客户端或作为Mybatis的分页参数*/
+	public final static String pageSize = "pageSize";
+	/**统一全局的current当前页json关键字key响应给客户端*/
+	public final static String current = "current";
+	/**统一全局的listData数据集合(含分页的数据)json关键字key响应给客户端*/
+	public final static String listData = "listData";
+	/**统一全局的分页技术json关键字key响应给客户端*/
+	public final static String paging_error_msg001 = "分页参数有误";
+	/**统一全局的分页技术json关键字key响应给客户端*/
+	public final static String paging_error_msg002 = "分页总条数出异常";
+	/**统一全局文件上传目录-根目录*/
+	public final static String dir_root = "filedir";
+	/**统一全局文件上传目录-图片目录*/
+	public final static String dir_image = "image";
+	/**统一全局文件上传目录-一般文件目录*/
+	public final static String dir_file = "file";
+	/**统一全局文件上传目录-一般文件目录*/
+	public final static String bar_code = "bar_code";
+	/**目标账号已被删除*/
+	public final static String user_inexistence = "目标账号已被删除";
+	/**目标账号已被禁用*/
+	public final static String user_disable = "目标账号已被禁用";
+	/**你的账号已被禁用*/
+	public final static String your_disable = "你的账号已被禁用";
+	/**是否显示操作的列,存在说明显示,否则不显示*/
+	public final static String handle_row = "handle_row";
+	/**拦截器表达式,配置不拦截的url资源,以括号(xxx)什么开头的都不拦截;即不对匹配该值的访问路径拦截(正则)*/
+	public final static String expression = ".*/((app)|(weChat)).*";
+}

+ 71 - 0
pm-common/src/main/java/com/pm/common/config/DAO.java

@@ -0,0 +1,71 @@
+package com.pm.common.config;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 全局统一的配置变量及标识码-客户端和服务器端
+ * @提示 code为200正常;msg的提示信息
+ * @作者 LiXiangFei
+ * @版本 v1.0
+ * @创建时间 2024年9月26日 15:30:47
+ */
+public interface DAO {
+
+
+	/**
+	 * 保存对象
+	 * @param str
+	 * @param obj
+	 * @return
+	 * @throws Exception
+	 */
+	public Integer save(String str, Object obj) throws Exception;
+
+	/**
+	 * 修改对象
+	 * @param str
+	 * @param obj
+	 * @return
+	 * @throws Exception
+	 */
+	public Integer update(String str, Object obj) throws Exception;
+
+	public Integer batchSave(String str, List<Map<?, ?>> objs)throws Exception;
+
+	/**
+	 * 删除对象
+	 * @param str
+	 * @param obj
+	 * @return
+	 * @throws Exception
+	 */
+	public Integer delete(String str, Object obj) throws Exception;
+
+	/**
+	 * 查找对象
+	 * @param str
+	 * @param obj
+	 * @return
+	 * @throws Exception
+	 */
+	public Object findForObject(String str, Object obj) throws Exception;
+
+	/**
+	 * 查找对象
+	 * @param str
+	 * @param obj
+	 * @return
+	 * @throws Exception
+	 */
+	public Object findForList(String str, Object obj) throws Exception;
+
+	/**
+	 * 查找对象封装成Map
+	 * @param s
+	 * @param obj
+	 * @return
+	 * @throws Exception
+	 */
+	public Object findForMap(String sql, Object obj, String key, String value) throws Exception;
+}

+ 388 - 0
pm-common/src/main/java/com/pm/common/config/DaoBase.java

@@ -0,0 +1,388 @@
+package com.pm.common.config;
+
+
+import org.apache.ibatis.session.SqlSession;
+import org.apache.ibatis.session.SqlSessionFactory;
+import org.mybatis.spring.SqlSessionTemplate;
+import org.springframework.stereotype.Repository;
+
+import javax.annotation.Resource;
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * dao底层操作处理工具类
+ * @作者 LiXiangFei
+ * @版本 v1.0
+*/
+@Repository
+public class DaoBase {
+
+
+	@Resource(name="sqlSessionTemplate")
+	private SqlSessionTemplate sqlSessionTemplate;
+
+	/**
+	 * 通用的更新;删除;插入添加
+	 * @作者 LiXiangFei
+	 * @返回值类型 int
+	*/
+	public int execute(final String sqlMapId) throws Exception {
+		return sqlSessionTemplate.update(sqlMapId);
+	}
+
+	/**
+	 * 通用的更新;删除;插入添加
+	 * @作者 LiXiangFei
+	 * @返回值类型 int
+	*/
+	public int execute(final String sqlMapId,final Object objParam) throws Exception{
+		return sqlSessionTemplate.update(sqlMapId,objParam);
+	}
+
+	/**批量插入|更新|删除*/
+	public int executeBatch(final String sqlMapId) throws Exception {
+		return sqlSessionTemplate.update(sqlMapId);
+	}
+
+	/**批量插入|更新|删除,objParam可以是List<HashMap<String, Object>>*/
+	public int executeBatch(final String sqlMapId, final Object objParam) throws Exception {
+		return sqlSessionTemplate.update(sqlMapId,objParam);
+	}
+	/**批量插入|更新|删除,objParam可以是List<HashMap<String, Object>>*/
+	public int executeBatchNew(final String sqlMapId, final Object objParam) throws Exception {
+		SqlSessionFactory sqlSessionFactory = sqlSessionTemplate.getSqlSessionFactory();
+		//批量执行器
+		SqlSession sqlSession = sqlSessionFactory.openSession(false);
+		try{
+			if(objParam!=null){
+				sqlSession.update(sqlMapId, objParam);
+				sqlSession.flushStatements();
+				sqlSession.commit();
+				sqlSession.clearCache();
+			}
+		}finally{
+			sqlSession.close();
+		}
+		return 1;
+	}
+
+	/**
+	 * 用于查询返回Integer
+	 * @作者 LiXiangFei
+	 * @返回值类型 Integer
+	*/
+	public Integer queryForInteger(final String sqlMapId) throws Exception {
+		return sqlSessionTemplate.selectOne(sqlMapId);
+	}
+
+	/**
+	 * 用于查询返回Integer
+	 * @作者 LiXiangFei
+	 * @返回值类型 Integer
+	*/
+	public Integer queryForInteger(final String sqlMapId, final Object objParam) throws Exception {
+		return sqlSessionTemplate.selectOne(sqlMapId,objParam);
+	}
+
+	/**
+	 * 用于查询返回String
+	 * @作者 LiXiangFei
+	 * @返回值类型 String
+	*/
+	public String queryForString(final String sqlMapId) throws Exception {
+		return sqlSessionTemplate.selectOne(sqlMapId);
+	}
+
+	/**
+	 * 用于查询返回String
+	 * @作者 LiXiangFei
+	 * @返回值类型 String
+	*/
+	public String queryForString(final String sqlMapId, final Object objParam) throws Exception {
+		return sqlSessionTemplate.selectOne(sqlMapId,objParam);
+	}
+
+	/**
+	 * 根据id去查询,或必须保证sql所查询的结果只有一条或限制返回一条数据
+	 * @作者 LiXiangFei
+	 * @返回值类型 Map<String,Object>
+	 * @创建时间 2024年09月24日 21:03:07
+	*/
+	public Map<String, Object> queryForMap(final String sqlMapId) throws Exception {
+		return sqlSessionTemplate.selectOne(sqlMapId);
+	}
+
+	/**
+	 * 必须保存sql所查询的结果只有一条或限制返回一条数据
+	 * @作者 LiXiangFei
+	 * @返回值类型 Map<String,Object>
+	 * @创建时间 2024年09月24日 21:03:49
+
+	*/
+	public Map<String, Object> queryForMap(final String sqlMapId, final Object objParam) throws Exception {
+		return sqlSessionTemplate.selectOne(sqlMapId,objParam);
+	}
+
+	/**
+	 * 根据id去查询,或必须保证sql所查询的结果只有一条或限制返回一条数据
+	 * @作者 LiXiangFei
+	 * @返回值类型 HashMap《String,Object》
+	 * @创建时间 2024年09月24日 21:03:07
+
+	*/
+	public HashMap<String, Object> queryForHashMap(final String sqlMapId) throws Exception {
+		return sqlSessionTemplate.selectOne(sqlMapId);
+	}
+
+	/**
+	 * 必须保存sql所查询的结果只有一条或限制返回一条数据
+	 * @作者 LiXiangFei
+	 * @返回值类型 HashMap《String,Object》
+	 * @创建时间 2024年09月24日 21:03:49
+
+	*/
+	public HashMap<String, Object> queryForHashMap(final String sqlMapId, final Object objParam) throws Exception {
+		return sqlSessionTemplate.selectOne(sqlMapId,objParam);
+	}
+
+    /**
+     * 必须保存sql所查询的结果只有一条或限制返回一条数据
+     * @作者 LiXiangFei
+     * @返回值类型 HashMap《String,Object》
+     * @创建时间 2024年09月24日 21:03:49
+     * @QQ号码 444141300
+     * @主页 http://www.hguo.org
+     */
+    public HashMap<String,String> queryForHashMapString(final String sqlMapId, final Object objParam) throws Exception {
+        return sqlSessionTemplate.selectOne(sqlMapId,objParam);
+    }
+
+	/**
+	 * 查询返回List《Map》,含分页
+	 * @作者 LiXiangFei
+	 * @返回值类型 List<Map<String,Object>>
+	 * @创建时间 2024年09月24日 21:04:14
+
+	*/
+	public List<Map<String, Object>> queryForListMap(final String sqlMapId) throws Exception {
+		return sqlSessionTemplate.selectList(sqlMapId);
+	}
+
+	/**
+	 * 查询返回List《Map》,含分页
+	 * @param sqlMapId
+	 * @param objParam
+	 * @throws Exception
+	 * @作者 LiXiangFei
+	 * @返回值类型 List<Map<String,Object>>
+	 * @创建时间 2016年12月25日 上午12:47:44
+	 * @QQ号码 444141300
+	 * @官网 http://www.hguo.org
+	*/
+	public List<Map<String, Object>> queryForListMap(final String sqlMapId, final Object objParam) throws Exception {
+		return sqlSessionTemplate.selectList(sqlMapId,objParam);
+	}
+
+	/**
+	 * 查询返回List《HashMap》,含分页
+	 * @作者 LiXiangFei
+	 * @返回值类型 List<Map<String,Object>>
+	 * @创建时间 2024年09月24日 21:04:14
+
+	*/
+	public List<HashMap<String, Object>> queryForListHashMap(final String sqlMapId) throws Exception {
+		return sqlSessionTemplate.selectList(sqlMapId);
+	}
+
+	/**
+	 * 谨慎使用,如果报错则换成返回List<HashMap<String,Object>>
+	 * @param
+	 * @作者 LiXiangFei
+	 * @QQ 444141300
+	 * @创建时间 2018年9月14日 14:01
+	*/
+    public List<HashMap<String,String>> queryForListString(final String sqlMapId) throws Exception {
+        return sqlSessionTemplate.selectList(sqlMapId);
+    }
+
+    /**
+     * 谨慎使用,如果报错则换成返回List<HashMap<String,Object>>
+     * @param
+     * @作者 LiXiangFei
+     * @QQ 444141300
+     * @创建时间 2018年9月14日 14:01
+    */
+    public List<HashMap<String,String>> queryForListString(final String sqlMapId,final Object objParam) throws Exception {
+        return sqlSessionTemplate.selectList(sqlMapId,objParam);
+    }
+
+	/**
+	 * 查询返回List《HashMap》,含分页
+	 * @param sqlMapId
+	 * @param objParam
+	 * @throws Exception
+	 * @作者 LiXiangFei
+	 * @返回值类型 List<Map<String,Object>>
+	 * @创建时间 2016年12月25日 上午12:47:44
+	 * @QQ号码 444141300
+	 * @官网 http://www.hguo.org
+	*/
+	public List<HashMap<String, Object>> queryForListHashMap(final String sqlMapId,final Object objParam) throws Exception {
+		return sqlSessionTemplate.selectList(sqlMapId,objParam);
+	}
+
+	/**
+	 * 查询Serializable序列化对象数据对象
+	 * @param sqlMapId
+	 * @throws Exception
+	 * @作者 LiXiangFei
+	 * @返回值类型 PageData
+	 * @创建时间 2024年09月24日 下午11:12:57
+	 * @QQ号码 444141300
+	 * @官网 http://www.hguo.org
+	*/
+	public Serializable queryForSerializable(final String sqlMapId) throws Exception {
+		return sqlSessionTemplate.selectOne(sqlMapId);
+	}
+
+	/**
+	 * 查询Serializable序列化对象数据对象
+	 * @param sqlMapId
+	 * @param objParam
+	 * @throws Exception
+	 * @作者 LiXiangFei
+	 * @返回值类型 PageData
+	 * @创建时间 2016年12月25日 上午12:46:20
+	 * @QQ号码 444141300
+	 * @官网 http://www.hguo.org
+	*/
+	public Serializable queryForSerializable(final String sqlMapId, final Object objParam) throws Exception {
+		return sqlSessionTemplate.selectOne(sqlMapId,objParam);
+	}
+
+	/**
+	 * 查询ListSerializable序列化对象数据对象
+	 * @param sqlMapId
+	 * @throws Exception
+	 * @作者 LiXiangFei
+	 * @返回值类型 PageData
+	 * @创建时间 2024年09月24日 下午11:12:57
+	 * @QQ号码 444141300
+	 * @官网 http://www.hguo.org
+	*/
+	public List<Serializable> queryForListSerializable(final String sqlMapId) throws Exception {
+		return sqlSessionTemplate.selectList(sqlMapId);
+	}
+
+	/**
+	 * 查询ListSerializable序列化对象数据对象
+	 * @param sqlMapId
+	 * @param objParam
+	 * @throws Exception
+	 * @作者 LiXiangFei
+	 * @返回值类型 PageData
+	 * @创建时间 2016年12月25日 上午12:46:20
+	 * @QQ号码 444141300
+	 * @官网 http://www.hguo.org
+	*/
+	public List<Serializable> queryForListSerializable(final String sqlMapId, final Object objParam) throws Exception {
+		return sqlSessionTemplate.selectList(sqlMapId,objParam);
+	}
+
+	/**
+	 * 查询PageData数据对象
+	 * @param sqlMapId
+	 * @throws Exception
+	 * @作者 LiXiangFei
+	 * @返回值类型 PageData
+	 * @创建时间 2024年09月24日 下午11:12:57
+	 * @QQ号码 444141300
+	 * @官网 http://www.hguo.org
+	*/
+	public PageData queryForPageData(final String sqlMapId) throws Exception {
+		return sqlSessionTemplate.selectOne(sqlMapId);
+	}
+
+	/**
+	 * 查询PageData数据对象
+	 * @param sqlMapId
+	 * @param objParam
+	 * @throws Exception
+	 * @作者 LiXiangFei
+	 * @返回值类型 PageData
+	 * @创建时间 2016年12月25日 上午12:46:20
+	 * @QQ号码 444141300
+	 * @官网 http://www.hguo.org
+	*/
+	public PageData queryForPageData(final String sqlMapId, final Object objParam) throws Exception {
+		return sqlSessionTemplate.selectOne(sqlMapId,objParam);
+	}
+
+	/**
+	 * 查询List《PageData》数据对象 ,含分页
+	 * @param sqlMapId
+	 * @throws Exception
+	 * @作者 LiXiangFei
+	 * @返回值类型 List<PageData>
+	 * @创建时间 2016年12月25日 上午12:46:48
+	 * @QQ号码 444141300
+	 * @官网 http://www.hguo.org
+	*/
+	public List<PageData> queryForListPageData(final String sqlMapId) throws Exception {
+		return sqlSessionTemplate.selectList(sqlMapId);
+	}
+
+	/**
+	 * 查询List《PageData》数据对象 ,含分页
+	 * @param sqlMapId
+	 * @param objParam
+	 * @throws Exception
+	 * @作者 LiXiangFei
+	 * @返回值类型 List<PageData>
+	 * @创建时间 2016年12月25日 上午12:46:53
+	 * @QQ号码 444141300
+	 * @官网 http://www.hguo.org
+	*/
+	public List<PageData> queryForListPageData(final String sqlMapId, final Object objParam) throws Exception {
+		return sqlSessionTemplate.selectList(sqlMapId,objParam);
+	}
+
+	/**
+	 * 带分页查询功能;返回key为total总条数总记录数,key为listData返回的list数据集合
+	 * @param sqlMapIdTotal 总条数总记录数的sql映射
+	 * @param sqlMapIdData 返回的list数据集合的sql映射
+	 * @作者 LiXiangFei
+	 * @返回值类型 HashMap< String,Object >,含total总条数总记录数;listData分页的数据
+	 * @创建时间 2024年1月10日 下午5:56:08
+
+	*/
+	public HashMap<String,Object> queryForPage(final HashMap<String,Object> params,final String sqlMapIdListData,final String sqlMapIdTotal)throws Exception{
+		final HashMap<String,Object> map = new HashMap<String,Object>(0);
+		final Integer total = sqlSessionTemplate.selectOne(sqlMapIdTotal,params);
+		final List<Object> list = sqlSessionTemplate.selectList(sqlMapIdListData,params);
+		map.put(ConfigFile.total,total);
+		map.put(ConfigFile.listData,list);
+		return map;
+	}
+
+	/**
+	 * 带分页查询功能;返回key为total总条数总记录数,key为listData返回的list数据集合
+	 * @param sqlMapIdTotal 总条数总记录数的sql映射
+	 * @param sqlMapIdData 返回的list数据集合的sql映射
+	 * @作者 LiXiangFei
+	 * @返回值类型 HashMap< String,Object >,含total总条数总记录数;listData分页的数据
+	 * @创建时间 2024年1月10日 下午5:56:08
+
+	*/
+	public HashMap<String,Object> queryForPageData(final PageData params,final String sqlMapIdListData,final String sqlMapIdTotal)throws Exception{
+		final HashMap<String, Object> map = new HashMap<String,Object>(0);
+		final Integer total = sqlSessionTemplate.selectOne(sqlMapIdTotal,params);
+		final List<Object> list = sqlSessionTemplate.selectList(sqlMapIdListData,params);
+		map.put(ConfigFile.total,total);
+		map.put(ConfigFile.listData,list);
+		return map;
+	}
+}

+ 148 - 0
pm-common/src/main/java/com/pm/common/config/DaoSupport.java

@@ -0,0 +1,148 @@
+package com.pm.common.config;
+
+import org.apache.ibatis.session.ExecutorType;
+import org.apache.ibatis.session.SqlSession;
+import org.apache.ibatis.session.SqlSessionFactory;
+import org.mybatis.spring.SqlSessionTemplate;
+import org.springframework.stereotype.Repository;
+
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.Map;
+
+@Repository("daoSupport")
+public class DaoSupport implements DAO {
+
+	@Resource(name = "sqlSessionTemplate")
+	private SqlSessionTemplate sqlSessionTemplate;
+
+	/**
+	 * 保存对象
+	 * @param str
+	 * @param obj
+	 * @return
+	 * @throws Exception
+	 */
+	public Integer save(String str, Object obj) throws Exception {
+		return sqlSessionTemplate.insert(str, obj);
+	}
+
+	/**
+	 * 批量更新
+	 * @param str
+	 * @param objs
+	 * @return
+	 * @throws Exception
+	 */
+	public Integer batchSave(String str, List<Map<?,?>> objs )throws Exception{
+		return sqlSessionTemplate.insert(str, objs);
+	}
+
+	/**
+	 * 修改对象
+	 * @param str
+	 * @param obj
+	 * @return
+	 * @throws Exception
+	 */
+	public Integer update(String str, Object obj) throws Exception {
+		return sqlSessionTemplate.update(str, obj);
+	}
+
+	/**
+	 * 批量更新
+	 * @param str
+	 * @param objs
+	 * @return
+	 * @throws Exception
+	 */
+	public void batchUpdate(String str, List<Map<?,?>> objs )throws Exception{
+		SqlSessionFactory sqlSessionFactory = sqlSessionTemplate.getSqlSessionFactory();
+		//批量执行器
+		SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH,false);
+		try{
+			if(objs!=null){
+				for(int i=0,size=objs.size();i<size;i++){
+					sqlSession.update(str, objs.get(i));
+				}
+				sqlSession.flushStatements();
+				sqlSession.commit();
+				sqlSession.clearCache();
+			}
+		}finally{
+			sqlSession.close();
+		}
+	}
+
+	/**
+	 * 批量更新
+	 * @param str
+	 * @param objs
+	 * @return
+	 * @throws Exception
+	 */
+	public Integer batchDelete(String str, List<Map<?,?>> objs )throws Exception{
+		return sqlSessionTemplate.delete(str, objs);
+	}
+
+	/**
+	 * 删除对象
+	 * @param str
+	 * @param obj
+	 * @return
+	 * @throws Exception
+	 */
+	public Integer delete(String str, Object obj) throws Exception {
+		return sqlSessionTemplate.delete(str, obj);
+	}
+
+	/**
+	 * 查找对象
+	 * @param str
+	 * @param obj
+	 * @return
+	 * @throws Exception
+	 */
+	public Object findForObject(String str, Object obj) throws Exception {
+		return sqlSessionTemplate.selectOne(str, obj);
+	}
+
+	/**
+	 * 查找对象
+	 * @param str
+	 * @param obj
+	 * @return
+	 * @throws Exception
+	 */
+	public Object findForList(String str, Object obj) throws Exception {
+		return sqlSessionTemplate.selectList(str, obj);
+	}
+
+	/**
+	 * 返回List集合
+	 * @作者 LiXiangFei
+	 * @返回值类型 int
+	 * @创建时间 2024年09月24日 21:00:14
+	 * @QQ号码 444141300
+	 * @主页 http://www.fwtai.com
+	 */
+	public <E> List<E> selectList(final String statement) {
+		return sqlSessionTemplate.selectList(statement);
+	}
+
+	/**
+	 * 带参数的LIST
+	 * @作者 LiXiangFei
+	 * @返回值类型 int
+	 * @创建时间 2024年09月24日 21:00:14
+	 * @QQ号码 444141300
+	 * @主页 http://www.fwtai.com
+	 */
+	public <E> List<E> selectList(final String statement, final Object parameter) {
+		return sqlSessionTemplate.selectList(statement, parameter);
+	}
+
+	public Object findForMap(String str, Object obj, String key, String value) throws Exception {
+		return sqlSessionTemplate.selectMap(str, obj, key);
+	}
+}

+ 131 - 0
pm-common/src/main/java/com/pm/common/config/PageData.java

@@ -0,0 +1,131 @@
+package com.pm.common.config;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.*;
+
+/**
+ * 页面数据处理工具类
+ * @作者 LiXiangFei
+ * @版本 v1.0
+ * @创建时间 2024年9月25日 上午16:03:55
+ */
+public class PageData extends HashMap implements Map{
+
+    private static final long serialVersionUID = 1L;
+
+    Map map = new HashMap();
+    HttpServletRequest request;
+    private long requestId;
+
+    public PageData(HttpServletRequest request){
+        this.request = request;
+        Map properties = request.getParameterMap();
+        Map returnMap = new HashMap();
+        Iterator entries = properties.entrySet().iterator();
+        Entry entry;
+        String name = "";
+        String value = "";
+        while (entries.hasNext()) {
+            entry = (Entry) entries.next();
+            name = (String) entry.getKey();
+            Object valueObj = entry.getValue();
+            if(null == valueObj){
+                value = "";
+            }else if(valueObj instanceof String[]){
+                String[] values = (String[])valueObj;
+                for(int i=0;i<values.length;i++){
+                    value = values[i] + ",";
+                }
+                value = value.substring(0, value.length()-1);
+            }else{
+                value = valueObj.toString();
+            }
+            returnMap.put(name, value);
+        }
+        map = returnMap;
+    }
+
+    public PageData() {
+        map = new HashMap();
+    }
+
+    @Override
+    public Object get(Object key) {
+        Object obj = null;
+        if(map.get(key) instanceof Object[]) {
+            Object[] arr = (Object[])map.get(key);
+            obj = request == null ? arr:(request.getParameter((String)key) == null ? arr:arr[0]);
+        } else {
+            obj = map.get(key);
+        }
+        return obj;
+    }
+
+    public final String getString(final String key){
+        return get(key) == null ? null : get(key).toString();
+    }
+
+    public final Integer getInteger(String key) throws Exception{
+        return get(key) == null ? null : Integer.parseInt(get(key).toString());
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public Object put(Object key, Object value) {
+        if(value==null)
+        {
+            value="";
+        }
+        return map.put(key, value);
+    }
+
+    @Override
+    public Object remove(Object key) {
+        return map.remove(key);
+    }
+
+    public void clear() {
+        map.clear();
+    }
+
+    public boolean containsKey(Object key) {
+        return map.containsKey(key);
+    }
+
+    public boolean containsValue(Object value) {
+        return map.containsValue(value);
+    }
+
+    public Set entrySet() {
+        return map.entrySet();
+    }
+
+    public boolean isEmpty() {
+        return map.isEmpty();
+    }
+
+    public Set keySet() {
+        return map.keySet();
+    }
+
+    @SuppressWarnings("unchecked")
+    public void putAll(Map t) {
+        map.putAll(t);
+    }
+
+    public int size() {
+        return map.size();
+    }
+
+    public Collection values() {
+        return map.values();
+    }
+
+    public long getRequestId() {
+        return requestId;
+    }
+
+    public void setRequestId(long requestId) {
+        this.requestId = requestId;
+    }
+}

+ 21 - 0
pm-common/src/main/java/com/pm/common/core/controller/BaseController.java

@@ -3,6 +3,8 @@ package com.pm.common.core.controller;
 import java.beans.PropertyEditorSupport;
 import java.util.Date;
 import java.util.List;
+
+import com.pm.common.config.PageData;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.web.bind.WebDataBinder;
@@ -20,6 +22,10 @@ import com.pm.common.utils.PageUtils;
 import com.pm.common.utils.SecurityUtils;
 import com.pm.common.utils.StringUtils;
 import com.pm.common.utils.sql.SqlUtil;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+import javax.servlet.http.HttpServletRequest;
 
 /**
  * web层通用数据处理
@@ -31,6 +37,21 @@ public class BaseController
     protected final Logger logger = LoggerFactory.getLogger(this.getClass());
 
     /**
+     * 得到PageData
+     */
+    public PageData getPageData() {
+        return new PageData(this.getRequests());
+    }
+
+    /**
+     * 得到request对象
+     */
+    public HttpServletRequest getRequests() {
+        HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
+        return request;
+    }
+
+    /**
      * 将前台传递过来的日期格式的字符串,自动转化为Date类型
      */
     @InitBinder