Commit ddd09a6d by 罗绍泽

流程引擎表单自定义初始

parent 707e69fa
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="jfV5lcyq"> <wb-module deploy-name="jfV5lcyq">
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src_test"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src_test"/>
...@@ -8,6 +7,7 @@ ...@@ -8,6 +7,7 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src_utils"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src_utils"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src_jwapp"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src_jwapp"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src_standard"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src_standard"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src_process"/>
<property name="java-output-path" value="build/classes"/> <property name="java-output-path" value="build/classes"/>
<property name="context-root" value="jfV5lcyq"/> <property name="context-root" value="jfV5lcyq"/>
</wb-module> </wb-module>
......
...@@ -205,4 +205,5 @@ ...@@ -205,4 +205,5 @@
<import resource="business-system.xml"/> <import resource="business-system.xml"/>
<import resource="business-standard.xml"/> <import resource="business-standard.xml"/>
<import resource="business-test.xml"/> <import resource="business-test.xml"/>
<import resource="business-process.xml"/>
</beans> </beans>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="sqlSessionFactory-process" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource-business" />
<property name="configLocation" value="/WEB-INF/conf/gaowj/bl/mybatis-config.xml" />
<property name="mapperLocations">
<list>
<value>classpath:com/gaowj/business/formtable/formtableDAO.xml</value>
</list>
</property>
</bean>
<bean id="FormtableBusiness" class="com.gaowj.business.formtable.FormtableBusinessImpl">
<property name="formtableDAO">
<bean class="org.mybatis.spring.mapper.MapperFactoryBean">
<property name="mapperInterface" value="com.gaowj.business.formtable.formtableDAO" />
<property name="sqlSessionFactory" ref="sqlSessionFactory-test" />
</bean>
</property>
</bean>
</beans>
...@@ -298,3 +298,6 @@ ...@@ -298,3 +298,6 @@
.icon-ext-34_40{ .icon-ext-34_40{
background:url('../../../../images/icons/(34,40).png') no-repeat left center; background:url('../../../../images/icons/(34,40).png') no-repeat left center;
} }
.icon-ext-02_25{
background:url('../../../../images/icons/(02,25).png') no-repeat left center;
}
<%@page contentType="text/html; charset=UTF-8"%>
<%@ include file="/gaowj/header-simple-1.0.jsp"%>
<div id="studentTab">
<link rel="stylesheet" type="text/css" href="${ctx}/jwapp/common/css/content_body.css" charset="utf-8"></link>
<link rel="stylesheet" type="text/css" href="${ctx}/jwapp/common/css/content_table.css" charset="utf-8"></link>
<link rel="stylesheet" type="text/css" href="${ctx}/jwapp/common/css/content_input.css" charset="utf-8"></link>
</div>
<table id="list" style="width: 100%; height: 100%;"></table>
<div id="tb">
<form id="formTableTab_searchForm" style="float:left">
是否已毕业: <input id="FIELD_STATUS" name="FIELD_STATUS" type="text" style="width: 100px" class="easyui-combobox">&nbsp;&nbsp;
姓名: <input class="easyui-textbox" id="FIELD_NAME" name="FIELD_NAME" style="width:200px"/>&nbsp;&nbsp;
</form>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true" onclick="javascript:searchRow()">查询</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-ext-advsearch',plain:true" onclick="javascript:advsearchRow()">高级查询</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload',plain:true" onclick="javascript:refreshRow()">刷新</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" onclick="javascript:addRow()">新增</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-clear',plain:true" onclick="javascript:deleteBatchRow()">删除</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-ext-file',plain:true" onclick="javascript:uploadcommonBatchRow()">附件</a>
</div>
<div id="detail" style="overflow:auto;"></div>
<script type="text/javascript" src="${ctx}/jwapp/pages/standard/js/jwStandardModule.js" charset="utf-8"></script>
<script type="text/javascript" src="${ctx}/process/pages/formtable/js/formtableModule.js" charset="utf-8"></script>
<script type="text/javascript" src="${ctx}/process/pages/formtable/js/formtableTab.js" charset="utf-8"></script>
<%@page contentType="text/html; charset=UTF-8"%>
<form id="inputForm" method="post" style="width: 100%;">
<input type="hidden" name="FIELD_OPETYPE" id="OPETYPE" value="${is_row.OPETYPE}" /> <input type="hidden" name="FIELD_UUID" id="UUID" value="${is_row.UUID}" />
<table align="center" border="0" cellpadding="0" cellspacing="0" class="tableStyle" style="margin: 10px 15px; width: 95%; line-height: 30px;">
<tr>
<td style="width: 15%;" class="tableStyleLable">
<span>表名:</span>
</td>
<td style="width: 30%">
<input class="easyui-textbox" id="TABLE_NAME" name="FIELD_TABLE_NAME" style="width:200px" />
</td>
<td style="width: 15%;" class="tableStyleLable">
<span>同步数据库状态:</span>
</td>
<td style="width: 30%">
<span id="IS_DBSYNCH"></span>
</td>
</tr>
<tr>
<td class="tableStyleLable">
<span>描述:</span>
</td>
<td colspan="3">
<input class="easyui-textbox" id="CONTENT" name="FIELD_CONTENT" style="width:570px" />
</td>
</tr>
</table>
<table id="fieldTable">
</table>
</form>
\ No newline at end of file
//此乃本模块与后台交互的方法接口部分
var formtableModule = function(format) {
this.module = "";
this.action = "";
this.format = format;
};
//定义数据交互
formtableModule.prototype = BusinessObject;
//插入附件数据
formtableModule.prototype.insertStudent = function(){};
//修改附件数据
formtableModule.prototype.updateStudent = function(){};
//删除附件数据
formtableModule.prototype.deleteStudent = function(){};
//创建一个数据操作对象,然后再后续使用
formtableModule.act = new formtableModule("json").delegate("formtableAct");
//创建一个数据获取对象,然后再后续使用
formtableModule.date = new formtableModule("json").delegate("formtableData");
//说明: 1、所有方法里统一传递josn格式的参数,用于后台交互,如data.listTables(param) ,如没有参数则传'{}',如data.listTables({})
// 2、前后台数据获取传输协议 如:json[{'0':{pageCount':'2','pageNo':'1','pageSize':'20','rowSet':'[{0},{1}....]'}}]
// 3、前后台增删改的返回状态 如:json[{'0':{'rowSet':{'NAME':'-1','VALUE':'保存失败'}}}]
...@@ -4,5 +4,19 @@ ...@@ -4,5 +4,19 @@
"http://struts.apache.org/dtds/struts-2.3.dtd"> "http://struts.apache.org/dtds/struts-2.3.dtd">
<struts> <struts>
<package name="process" extends="gaowj">
<action name="formtableView_*" class="com.gaowj.formtable.action.viewAction" method="{1}">
<result name="{1}">/process/pages/formtable/{1}.jsp</result>
</action>
<action name="formtableAct_*" class="com.gaowj.formtable.action.actAction" method="{1}">
<result name="json" type="json">
<param name="root">jsonObject</param>
</result>
</action>
<action name="formtableData_*" class="com.gaowj.formtable.action.dataAction" method="{1}">
<result name="json" type="json">
<param name="root">jsonObject</param>
</result>
</action>
</package>
</struts> </struts>
package com.gaowj.business;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Service;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.Page;
@Service
public interface FormtableBusiness {
/**
* 插入
* @param entity
* @throws BusinessException
*/
void insert_form_table(Map<String,Object> entity) throws BusinessException ;
/**
* 更新
* @param entity
* @throws BusinessException
*/
void update_form_table(Map<String,Object> entity) throws BusinessException ;
/**
* 删除记录
* @param entity
* @throws BusinessException
*/
void delete_form_table(List<String> list)throws BusinessException;
/**
* 分页获取记录
* @param entity
* @throws BusinessException
*/
Page<Map<String, Object>> list_form_table(int pageNo, int pageSize, Map<String, Object> query)throws BusinessException ;
/**
* 获取所有记录
* @param entity
* @throws BusinessException
*/
List<Map<String,Object>> list_form_table(Map<String, Object> query) throws BusinessException ;
/**
* 获取所有记录数
* @param entity
* @throws BusinessException
*/
int listCount_form_table(Map<String, Object> query) throws BusinessException ;
}
package com.gaowj.business.formtable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.apache.ibatis.session.RowBounds;
import com.gaowj.business.FormtableBusiness;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.Page;
public class FormtableBusinessImpl implements FormtableBusiness {
private formtableDAO formtableDAO;
public formtableDAO getFormtableDAO() {
return formtableDAO;
}
public void setFormtableDAO(formtableDAO formtableDAO) {
this.formtableDAO = formtableDAO;
}
@Override
public void insert_form_table(Map<String, Object> entity) throws BusinessException {
formtableDAO.insert_form_table(entity);
}
@Override
public void update_form_table(Map<String, Object> entity) throws BusinessException {
// 动态传值修改
if (entity.keySet() != null) {
convertEntity(entity);
formtableDAO.update_form_table(entity);
}
}
@Override
public void delete_form_table(List<String> list) throws BusinessException {
formtableDAO.delete_form_table(list);
}
@Override
public Page<Map<String, Object>> list_form_table(int pageNo, int pageSize, Map<String, Object> query) throws BusinessException {
// 计算起始记录
int pageStart = (pageNo - 1) * pageSize;
// 获取列表
List<Map<String, Object>> items = formtableDAO.list_form_table(new RowBounds(pageStart, pageSize), query);
// 获取列表个数
int count = listCount_form_table(query);
// 创建分页对象
Page<Map<String, Object>> page = new Page<Map<String, Object>>();
page.setStart(pageStart);
page.setLimit(pageSize);
page.setCount(count);
page.setItems(items);
return page;
}
@Override
public List<Map<String, Object>> list_form_table(Map<String, Object> query) throws BusinessException {
// TODO Auto-generated method stub
return null;
}
@Override
public int listCount_form_table(Map<String, Object> query) throws BusinessException {
// TODO Auto-generated method stub
return 0;
}
/**
* 更新或者插入时,处理map对象的形式(将字段信息存储为list,便于mybatis代码调用)
*
* @param entity
*/
private void convertEntity(Map<String, Object> entity,String... ignoreKeys) {
List<Map<String, Object>> updateList = new ArrayList<Map<String, Object>>();
Set<String> key = entity.keySet();
// 将map集合中的key和value 取出来分别放到list集合里
for (String str : key) {
Map<String, Object> updateMap = new HashMap<String, Object>();
for(String k:ignoreKeys){
if (StringUtils.equalsIgnoreCase("UUID", str))
continue;
}
updateMap.put("key", str);
updateMap.put("value", entity.get(str));
updateList.add(updateMap);
}
entity.put("info", updateList);
}
}
package com.gaowj.business.formtable;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.session.RowBounds;
import com.gaowj.business.exception.BusinessException;
public interface formtableDAO {
void insert_form_table(Map<String, Object> entity) throws BusinessException;
void update_form_table(Map<String, Object> entity) throws BusinessException;
void delete_form_table(List<String> list) throws BusinessException;
List<Map<String, Object>> list_form_table(RowBounds rowbounds, Map<String, Object> query) throws BusinessException;
List<Map<String, Object>> list_form_table(Map<String, Object> query) throws BusinessException;
int listCount_form_table(Map<String, Object> query) throws BusinessException;
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gaowj.business.formtable.formtableDAO">
<sql id="Where_Clause">
<trim prefix="WHERE" prefixOverrides="AND |OR">
<if test="UUID != null and UUID != ''">
and f.UUID = #{UUID}
</if>
<if test="TABLE_NAME != null and TABLE_NAME != ''">
and f.TABLE_NAME like #{TABLE_NAME_LIKE}
</if>
<if test="CONTENT != null and CONTENT != ''">
and f.CONTENT like #{CONTENT_LIKE}
</if>
<if test="IS_DBSYNCH != null and IS_DBSYNCH != ''">
and f.IS_DBSYNCH = #{IS_DBSYNCH}
</if>
<if test="STATUS != null and STATUS != ''">
and f.STATUS = #{STATUS}
</if>
</trim>
</sql>
<insert id="insert_form_table" parameterType="map">
insert into C_T_FORM_TABLE(
<trim prefix="" suffixOverrides=",">
<foreach collection="info" item="info">
${info.key},
</foreach>
</trim>
<![CDATA[ ) values( ]]>
<trim prefix="" suffixOverrides=",">
<foreach collection="info" item="info">
#{info.value},
</foreach>
</trim>
<![CDATA[ ) ]]>
</insert>
<update id="update_form_table" parameterType="map">
<![CDATA[
update C_T_FORM_TABLE set
]]>
<trim prefix="" suffixOverrides=",">
<foreach collection="info" item="info">
${info.key} = #{info.value} ,
</foreach>
</trim>
<where>
<if test="UUID != null and UUID != ''">
and UUID = #{UUID}
</if>
</where>
</update>
<delete id="delete_form_table" parameterType="list">
<![CDATA[
delete from C_T_FORM_TABLE where UUID IN
]]>
<foreach collection="list" item="UUID" open="(" separator=","
close=")">
#{UUID}
</foreach>
</delete>
<select id="list_form_table" parameterType="map" resultType="upperCaseKeyMap">
<![CDATA[
select f.*
from C_T_FORM_TABLE f
]]>
<include refid="Where_Clause" />
order by f.CREATE_TIME DESC
</select>
<select id="listCount_form_table" parameterType="map"
resultType="int">
<![CDATA[
select count(*) c from C_T_FORM_TABLE f
]]>
<include refid="Where_Clause" />
</select>
</mapper>
\ No newline at end of file
package com.gaowj.formtable.action;
import java.util.List;
import java.util.Map;
import net.sf.json.JSONObject;
import com.gaowj.business.StudentBusiness;
import com.gaowj.business.SystemOpeBusiness;
import com.gaowj.business.action.BasicAction;
import com.gaowj.business.comp.BusinessManager;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.QueryParamUtil;
import com.gaowj.business.util.RequestUtils;
import com.gaowj.business.util.Status;
import com.gaowj.standard.utils.CacheKit;
public class actAction extends BasicAction {
/**
*
*/
private static final long serialVersionUID = 1559759499504671708L;
private JSONObject jsonObject = new JSONObject();
public JSONObject getJsonObject() {
return jsonObject;
}
public void setJsonObject(JSONObject jsonObject) {
this.jsonObject = jsonObject;
}
/**
* 插入
* @param entity
* @throws BusinessException
*/
public String insertStudent() throws BusinessException {
StudentBusiness business = BusinessManager.getBusiness(StudentBusiness.class);
Map<String, Object> entity = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
jsonObject = new JSONObject();
try {
entity = QueryParamUtil.StringToDate(entity);
//去除不要更新的字段
entity.remove("OPETYPE");
//新增
business.insert_student(entity);
// 操作日志
//sysbusiness.insert_logBusiness(具体方法,操作内容,操作描述,操作记录ID,操作记录中文描述,分类)
SystemOpeBusiness sysbusiness = BusinessManager.getBusiness(SystemOpeBusiness.class);
sysbusiness.insert_logBusiness("insertStudent", "" + entity,
"增加学生测试数据", (String) entity.get("UUID"), (String) entity.get("NAME"), "studentdemo1");
//
//更新缓存
CacheKit.update("ehcache11", "com_gaowj_student_dataAction_listAll", business.list_student(null));
//
jsonObject.putAll(Status.getStatusSuccessMessage("保存成功"));
} catch (Exception e) {
jsonObject.putAll(Status.getStatusErrorMessage("保存失败"));
e.printStackTrace();
}
return "json";
}
/**
* 更新
* @param entity
* @throws BusinessException
*/
public String updateStudent() throws BusinessException {
StudentBusiness business = BusinessManager.getBusiness(StudentBusiness.class);
Map<String, Object> entity = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
try {
//去除不要更新的字段
entity.remove("OPETYPE");
//修改
entity = QueryParamUtil.StringToDate(entity);
business.update_student(entity);
// 操作日志
SystemOpeBusiness sysbusiness = BusinessManager.getBusiness(SystemOpeBusiness.class);
sysbusiness.insert_logBusiness("updateStudent", "" + entity,
"修改学生测试数据",(String) entity.get("UUID"), (String) entity.get("NAME"),"studentdemo1");
//
jsonObject.putAll(Status.getStatusSuccessMessage("修改成功"));
} catch (Exception e) {
jsonObject.putAll(Status.getStatusErrorMessage("修改失败"));
e.printStackTrace();
}
return "json";
}
/**
* 在软删除基础上删除记录
* @param entity
* @throws BusinessException
*/
public String deleteStudent() throws BusinessException {
StudentBusiness business = BusinessManager.getBusiness(StudentBusiness.class);
Map<String, Object> entity = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
String deletekey = (String) entity.get("CODE");
List<String> ListKey = QueryParamUtil.StringToList(deletekey);
try {
business.delete_student(ListKey);
// 操作日志
SystemOpeBusiness sysbusiness = BusinessManager.getBusiness(SystemOpeBusiness.class);
sysbusiness.insert_logBusiness("deleteStudent", "" + ListKey,
"删除学生测试数据", deletekey, "多个流水号","studentdemo1");
//
jsonObject.putAll(Status.getStatusSuccessMessage("删除成功"));
} catch (Exception e) {
jsonObject.putAll(Status.getStatusErrorMessage("删除失败"));
e.printStackTrace();
}
return "json";
}
}
package com.gaowj.formtable.action;
import java.sql.SQLException;
import java.text.ParseException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.sf.json.JSONObject;
import com.gaowj.business.FormtableBusiness;
import com.gaowj.business.StudentBusiness;
import com.gaowj.business.action.BasicAction;
import com.gaowj.business.comp.BusinessManager;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.Page;
import com.gaowj.business.util.PropUtil;
import com.gaowj.business.util.QueryParamUtil;
import com.gaowj.business.util.RequestUtils;
import com.gaowj.business.util.SessionUtil;
import com.gaowj.business.util.TestMd5;
import com.gaowj.standard.utils.CacheKit;
public class dataAction extends BasicAction{
/**
*
*/
private static final long serialVersionUID = -5059421324729466816L;
private JSONObject jsonObject = new JSONObject();
private int rows = 20;// 每页显示的记录数
private int page = 1;// 当前第几页
public JSONObject getJsonObject() {
return jsonObject;
}
public void setJsonObject(JSONObject jsonObject) {
this.jsonObject = jsonObject;
}
public int getRows() {
return rows;
}
public void setRows(int rows) {
this.rows = rows;
}
public int getPage() {
return page;
}
public void setPage(int page) {
this.page = page;
}
/**
* 分页获取记录
* @param entity
* @throws BusinessException
*/
public String list() throws BusinessException {
FormtableBusiness business = BusinessManager.getBusiness(FormtableBusiness.class);
Map<String, Object> query = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
try {
query = QueryParamUtil.StringToDate(query);
Page<Map<String, Object>> pageRows = business.list_form_table(pageNo,pageSize, query);
setPageCount((pageRows.getCount() - 1) / pageSize + 1);
Map<String, Object> data = new HashMap<String, Object>();
data.put("rowSet", QueryParamUtil.DateToString(pageRows.getItems()));
data.put("pageNo", pageNo);
data.put("pageSize", pageSize);
data.put("pageCount", pageCount);
data.put("rows", data.get("rowSet"));
data.put("total", pageRows.getCount());
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";
}
}
package com.gaowj.formtable.action;
import com.gaowj.business.action.BasicAction;
import com.gaowj.business.exception.BusinessException;
public class viewAction extends BasicAction {
/**
*
*/
private static final long serialVersionUID = -5986096180610140300L;
public String formtableTab() throws BusinessException{
return "formtableTab";
}
public String formtableTabDetail() throws BusinessException{
return "formtableTabDetail";
}
}
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