Commit 0a833b4b by 罗绍泽

添加了一个porltelApi页面

访问路径:http://localhost:8080/jfV5portal/jwAppsPortletView_portletApi
parent f070064d
......@@ -10,6 +10,12 @@ jwAppPortletModel.prototype = BusinessObject;
//获取当前登陆人的资源列表
jwAppPortletModel.prototype.listAllPTemplateByUser = function(){};
//获取所有的门户栏目
jwAppPortletModel.prototype.listAllPortletColumns = function(){};
//获取所有的资源列表
jwAppPortletModel.prototype.listAllPTemplate = function(){};
//创建一个数据操作对象,然后再后续使用
jwAppPortletModel.jwAppsPortletActAction = new jwAppPortletModel("json").delegate("jwAppsPortletAct");
//创建一个数据获取对象,然后再后续使用
......
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>PortletApi</title>
<script type="text/javascript" src="${ctx}/lib/js/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="${ctx}/jwapp/common/js/lang_json.js"></script>
<script type="text/javascript" src="${ctx}/jwapp/pages/portlet/js/jwAppPortletModule.js"></script>
<style>
pre {
outline: 1px solid #ccc;
padding: 5px;
margin: 5px;
}
.string {
color: green;
}
.number {
color: darkorange;
}
.boolean {
color: blue;
}
.null {
color: magenta;
}
.key {
color: red;
}
table {
width: 100%;
}
table tr td pre {
width: 100%;
height: 200px;
overflow: auto;
}
.look {
cursor: pointer;
color: blue;
}
</style>
</head>
<body>
<input type="button" value="清空" onclick="clearPre();" />
<table id="tbl_001">
<tr>
<td>编号</td>
<td>001</td>
</tr>
<tr>
<td>描述</td>
<td>获取当前登陆人的资源列表</td>
</tr>
<tr>
<td>调用</td>
<td>jwAppPortletModel.jwAppsPortletDataAction.listAllPTemplateByUser({<br />
&nbsp;&nbsp;&nbsp;&nbsp; FIELD_COLUMN_ID:'d6926714-c220-4a7e-9ec0-3a23caebb179' <br />
})</td>
</tr>
<tr>
<td>参数备注</td>
<td>FIELD_COLUMN_ID:栏目id</td>
</tr>
<tr>
<td><span class="look">结果查看</span></td>
<td><pre></pre></td>
</tr>
</table>
<table id="tbl_002">
<tr>
<td>编号</td>
<td>002</td>
</tr>
<tr>
<td>描述</td>
<td>获取所有的门户栏目</td>
</tr>
<tr>
<td>调用</td>
<td>jwAppPortletModel.jwAppsPortletDataAction.listAllPortletColumns()</td>
</tr>
<tr>
<td>参数备注</td>
<td></td>
</tr>
<tr>
<td><span class="look">结果查看</span></td>
<td><pre></pre></td>
</tr>
</table>
<table id="tbl_003">
<tr>
<td>编号</td>
<td>003</td>
</tr>
<tr>
<td>描述</td>
<td>获取所有的资源列表</td>
</tr>
<tr>
<td>调用</td>
<td>jwAppPortletModel.jwAppsPortletDataAction.listAllPTemplate()</td>
</tr>
<tr>
<td>参数备注</td>
<td></td>
</tr>
<tr>
<td><span class="look">结果查看</span></td>
<td><pre></pre></td>
</tr>
</table>
</body>
<script type="text/javascript">
$(function() {
$("table").each(function() {
var $table = $(this);
var tr4 = $(this).find('tr').eq(4);
tr4.find('td').eq(0).find('span').click(function() {
var click = $table.find('tr').eq(2).find('td').eq(1).text();
eval('var result=' + click);
tr4.find('td').eq(1).find('pre').html(syntaxHighlight(result));
});
});
});
function clearPre() {
$("pre").html('');
}
function syntaxHighlight(json) {
if (typeof json != 'string') {
json = JSON.stringify(json, undefined, 2);
}
json = json.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
return json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, function(match) {
var cls = 'number';
if (/^"/.test(match)) {
if (/:$/.test(match)) {
cls = 'key';
} else {
cls = 'string';
}
} else if (/true|false/.test(match)) {
cls = 'boolean';
} else if (/null/.test(match)) {
cls = 'null';
}
return '<span class="' + cls + '">' + match + '</span>';
});
}
</script>
</html>
......@@ -17,5 +17,9 @@
<param name="root">jsonObject</param>
</result>
</action>
<action name="jwAppsPortletView_*" class="com.jw.app.portlet.action.viewAction"
method="{1}">
<result name="{1}">/jwapp/pages/portlet/{1}.jsp</result>
</action>
</package>
</struts>
......@@ -11,4 +11,8 @@ import com.gaowj.business.exception.BusinessException;
public interface PortletBusiness {
List<Map<String,Object>> list_portlet_template_by_user(Map<String, Object> query) throws BusinessException ;
List<Map<String,Object>> list_portlet_template(Map<String, Object> query) throws BusinessException ;
List<Map<String,Object>> list_portlet_columns(Map<String, Object> query) throws BusinessException ;
}
......@@ -44,4 +44,34 @@ public class PortletBusinessImpl implements PortletBusiness {
return listData;
}
@Override
public List<Map<String, Object>> list_portlet_columns(Map<String, Object> query) throws BusinessException {
List<Map<String, Object>> listData=null;
try {
listData = QueryParamUtil.ClobToString(portletDAO.list_portlet_columns(query));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return listData;
}
@Override
public List<Map<String, Object>> list_portlet_template(Map<String, Object> query) throws BusinessException {
List<Map<String, Object>> listData=null;
try {
listData = QueryParamUtil.ClobToString(portletDAO.list_portlet_template(query));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return listData;
}
}
......@@ -9,4 +9,8 @@ import com.gaowj.business.exception.BusinessException;
public interface PortletDAO {
List<Map<String,Object>> list_portlet_template_user(Map<String,Object> query) throws BusinessException ;
List<Map<String,Object>> list_portlet_template(Map<String,Object> query) throws BusinessException ;
List<Map<String,Object>> list_portlet_columns(Map<String,Object> query) throws BusinessException ;
}
......@@ -49,4 +49,61 @@
</trim>
ORDER BY ptu.ORDER_NUM ASC
</select>
<select id="list_portlet_template" parameterType="map"
resultType="upperCaseKeyMap">
<![CDATA[
select * from portlet_template pt
]]>
<trim prefix="WHERE" prefixOverrides="AND |OR">
<if test="PORTLET_ID != null and PORTLET_ID != ''">
and pt.PORTLET_ID = #{PORTLET_ID}
</if>
<if test="NAME != null and NAME != ''">
and pt.NAME like '%${NAME}%'
</if>
<if test="TITLE != null and TITLE != ''">
and pt.TITLE like '%${TITLE}%'
</if>
<if test="P_TYPE != null and P_TYPE != ''">
and pt.P_TYPE = #{P_TYPE}
</if>
<if test="CREATOR_ID != null and CREATOR_ID != ''">
and pt.CREATOR_ID = #{CREATOR_ID}
</if>
<if test="START_TIME != null and START_TIME != ''">
and pt.CREATE_TIME &gt;= #{START_TIME}
</if>
<if test="END_TIME != null and END_TIME != ''">
and pt.CREATE_TIME &lt;= #{END_TIME}
</if>
<if test="TASKTIMER != null and TASKTIMER != ''">
and pt.TASKTIMER = #{TASKTIMER}
</if>
<if test="list != null and list != ''">
and pt.PORTLET_ID in ( ${list} )
</if>
<if test="G_ID != null and G_ID != ''">
and pt.G_ID like '%${G_ID}%'
</if>
<if test="COLUMN_ID != null and COLUMN_ID != ''">
and pt.COLUMN_ID = #{COLUMN_ID}
</if>
</trim>
ORDER BY pt.create_time DESC
</select>
<select id="list_portlet_columns" parameterType="map"
resultType="upperCaseKeyMap">
<![CDATA[
select * from portlet_columns pc
]]>
<!-- <trim prefix="WHERE" prefixOverrides="AND |OR">
<if test="NAME != null and NAME != ''">
<bind name="NAME_LIKE" value="'%' + NAME + '%'" />
and pc.NAME like #{NAME_LIKE}
</if>
</trim> -->
ORDER BY pc.order_id ASC
</select>
</mapper>
\ No newline at end of file
......@@ -56,6 +56,82 @@ public class dataAction extends BasicAction {
}
/**
* 获取所有的门户栏目
* @return
* @throws BusinessException
*/
public String listAllPortletColumns() throws BusinessException {
PortletBusiness business = BusinessManager
.getBusiness(PortletBusiness.class);
Map<String, Object> query = RequestUtils.getUpdateFieldMap(request,
RequestUtils.UPDATEDATAFIELDPREFIX);
try {
query = QueryParamUtil.StringToDate(query);
List<Map<String, Object>> listData = business
.list_portlet_columns(query);
Map<String, Object> data = new HashMap<String, Object>();
QueryParamUtil.DateToString(listData);
data.put("rowSet", listData);
data.put("pageNo", 1);
data.put("pageSize", listData.size());
data.put("pageCount", listData.size());
data.put("rows", data.get("rowSet"));
data.put("total", listData.size());
jsonObject = new JSONObject();
jsonObject.putAll(data);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "json";
}
/**
* 获取用户的资源列表
* @return
* @throws BusinessException
*/
public String listAllPTemplate() throws BusinessException {
PortletBusiness business = BusinessManager
.getBusiness(PortletBusiness.class);
Map<String, Object> query = RequestUtils.getUpdateFieldMap(request,
RequestUtils.UPDATEDATAFIELDPREFIX);
try {
query = QueryParamUtil.StringToDate(query);
//设置当前登陆人
List<Map<String, Object>> listData = business
.list_portlet_template(query);
for (Map<String, Object> rm : listData) {
if(rm.get("P_TYPE")==null||!rm.get("P_TYPE").equals("3"))
{
rm.remove("RSS_CONTENT");
rm.remove("TAKE_CONTENT");
}
}
Map<String, Object> data = new HashMap<String, Object>();
data.put("rowSet", QueryParamUtil.DateToString(listData));
data.put("pageNo", 1);
data.put("pageSize", listData.size());
data.put("pageCount", listData.size());
data.put("rows", data.get("rowSet"));
data.put("total", listData.size());
jsonObject = new JSONObject();
jsonObject.putAll(data);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "json";
}
/**
* 获取用户的资源列表
* @return
* @throws BusinessException
......@@ -66,7 +142,6 @@ public class dataAction extends BasicAction {
Map<String, Object> query = RequestUtils.getUpdateFieldMap(request,
RequestUtils.UPDATEDATAFIELDPREFIX);
try {
System.out.println();
query = QueryParamUtil.StringToDate(query);
//设置当前登陆人
query.put("USER_ID", SessionUtil.getEmid());
......
package com.jw.app.portlet.action;
import com.gaowj.business.action.BasicAction;
import com.gaowj.business.exception.BusinessException;
public class viewAction extends BasicAction {
/**
*
*/
private static final long serialVersionUID = -9417888985460968L;
public String portletApi() throws BusinessException {
return "portletApi";
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment