Commit ddd09a6d by 罗绍泽

流程引擎表单自定义初始

parent 707e69fa
<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.5.0">
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<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_test"/>
......@@ -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_jwapp"/>
<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="context-root" value="jfV5lcyq"/>
</wb-module>
......
......@@ -205,4 +205,5 @@
<import resource="business-system.xml"/>
<import resource="business-standard.xml"/>
<import resource="business-test.xml"/>
<import resource="business-process.xml"/>
</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 @@
.icon-ext-34_40{
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':'保存失败'}}}]
/**
* 序号:1
* 功能:定义分页(EasyUI)
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:无需更改
**/
var ls_width = $(window).width();
var ls_height = $(window).height();
var local_page=1;
var rows=20;
var listPageSize = [10,20,50,100,500,1000];
var queryData = eval("({'page':'"+local_page+"','rows':'"+rows+"'})");
var tab_n = 0;
//重置分页参数
function resetQueryData(){
queryData = "";
queryData = eval("({'page':'"+local_page+"','rows':'"+rows+"'})");
}
//定义附件关联模块ID(1:一般业务,2:测试信息,3:审批业务,999:其它数据 )
var ls_module_id='2';
//定义当前模块业务类型(YBYW:一般业务,SPGL:审批业务)
var ls_ywlx = 'YBYW';
/****/
/**
* 序号:2
* 功能:构建下拉框内容
* 参数:
* 说明:方便新增、修改页面里的下拉选项加载数据
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
var is_dbsynch_data=[{CODE_ID:'0',CODE_NAME:'未同步'},{CODE_ID:'1',CODE_NAME:'已同步'}];
var type_data=[{CODE_ID:'varchar',CODE_NAME:'varchar'},{CODE_ID:'int',CODE_NAME:'int'},{CODE_ID:'date',CODE_NAME:'date'}];
var list_default_field=[{
FIELD_NAME:'uuid',
TYPE:'varchar',
LENGTH:50,
POINT:0,
FIELD_MUST_INPUT:true,
IS_KEY:true,
CONTENT:'主键UUID',
FIELD_DEFAULT:'',
TYPE:'varchar',
IS_NULL:false
},{
FIELD_NAME:'create_id',
TYPE:'varchar',
LENGTH:50,
POINT:0,
FIELD_MUST_INPUT:true,
IS_KEY:false,
CONTENT:'新建人',
FIELD_DEFAULT:'',
TYPE:'varchar',
IS_NULL:true
},{
FIELD_NAME:'create_time',
TYPE:'varchar',
LENGTH:0,
POINT:0,
FIELD_MUST_INPUT:true,
IS_KEY:false,
CONTENT:'新建时间',
FIELD_DEFAULT:'',
TYPE:'date',
IS_NULL:true
},{
FIELD_NAME:'update_id',
TYPE:'varchar',
LENGTH:50,
POINT:0,
FIELD_MUST_INPUT:true,
IS_KEY:false,
CONTENT:'更新人',
FIELD_DEFAULT:'',
TYPE:'varchar',
IS_NULL:true
},{
FIELD_NAME:'update_time',
TYPE:'varchar',
LENGTH:0,
POINT:0,
FIELD_MUST_INPUT:true,
IS_KEY:false,
CONTENT:'更新时间',
FIELD_DEFAULT:'',
TYPE:'date',
IS_NULL:true
}];
var tr=['<tr>',
' <td>@{index}</td>',
' <td>@{opt}</td>',
' <td>@{field_name}</td>',
' <td>@{content}</td>',
' <td>@{length}</td>',
' <td>@{point}</td>',
' <td>@{field_default}</td>',
' <td>@{type}</td>',
' <td>@{is_key}</td>',
' <td>@{is_null}</td>',
'</tr>'].join("");
/****/
/**
* 序号:3
* 功能:构建主页面列表
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
//定义grid列表
var ls_title="表单管理&nbsp;&nbsp;<font color='#993300'>(1、绿色表示未同步数据库&nbsp;&nbsp;2、蓝色表示已同步数据库。)</font>";
var is_column = [ [
{field : 'NAME',title : '姓名',width : 100,align : 'center'},
{field : 'SEX',title : '性别',width : 80,align : 'center',
formatter : function(value) {
return getCodeName(v_sexquery_data.rowSet, value);
}
},
{field : 'NATION',title : '民族',width : 300,align : 'center',
formatter : function(value) {
return getCodeName(v_nationquery_data.rowSet, value);
}
},
{field : 'STATUS',title : '是否毕业',width : 100,align : 'center',
formatter : function(value) {
return getCodeName(v_statusquery_data, value);
}
},
{field : 'CREATE_ID',title : '创建人员',width : 100,align : 'center'},
{field : 'CREATE_TIME',title : '创建时间',width : 100,align : 'center'}
] ];
//列表加载完成回调
function dataOnLoadSuccess(){
}
//设置颜色和每行高度
function rowstyler(index,row){
if(row.STATUS == '1'){
return 'color:green;height:30px;';
}
else{
return 'color:blue;height:30px;';
}
}
//展示列表
datagrid("list", ls_title, gaowj.WEB_APP_NAME + "/formtableData_list", queryData, is_column, 60, 80);
/****/
/**
* 序号:4
* 功能:设置主页面操作列菜单
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
//操用列显示更多(一般情况下无需更改)
function formatMenu(value, data,index) {
var returnData="";
return returnData
+ "<span class=\"icon-ext-moremenu\" style=\"padding-left:20px;*width:20px;\"></span>"
+ "<span data-p1="+index+" class=\"easyui-tooltip\" style=\"color:blue;cursor:pointer;\">更多</span>";
}
//上浮横向菜单集里的具体菜单项(需更改)
function getOptionMenu(data,index){
var returnData= "<span class=\"icon-edit\" style=\"padding-left:20px;*width:20px;\"></span><a href=\"javascript:void(0);\" onclick=\"editRow('"
+ index + "')\">编辑</a> | <span class=\"icon-clear\" style=\"padding-left:20px;*width:20px;\"></span><a href=\"javascript:void(0);\" onclick=\"deleteRow('"
+ index + "')\">删除</a> | <span class=\"icon-ext-file\" style=\"padding-left:20px;*width:20px;\"></span><a href=\"javascript:void(0);\" onclick=\"uploadcommonRow('"
+ index + "')\">附件</a>";
return returnData;
}
//返回菜单集的菜单个数(需更改)
function getOptionMenuCount(){
var is_menu_count = 3;
return is_menu_count;
}
/****/
/**
* 序号:5
* 功能:新增修改弹出
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
//加载增加子页面
function addRow(){
var is_row={OPETYPE:'insert'};
openEditRow("formtableView_formtableTabDetail",is_row,"新增",true,0.95,0.95,0,0);
}
//加载增加子页面成功后的回调
function addUrlOnloadCallback(is_row){
var fieldTable=$("#fieldTable");
$(replaceByJson(tr,{
index:'序号',
opt:'操作',
field_name:'字段名称',
content:'备注',
length:'长度',
point:'小数点',
field_default:'默认值',
type:'数据类型',
is_key:'主键',
is_null:'允许空值'
})).appendTo(fieldTable);
$('#IS_DBSYNCH').html('未同步');
for(var i=0;i<list_default_field.length;i++){
var tr2=tr;
var field=list_default_field[i];
tr2=replaceByJson(tr2,{
index:i+1,
opt:'<input type="checkbox" />',
field_name:'<input type="text" name="FIELD_NAME" value="'+field.FIELD_NAME+'" />',
content:'<input type="text" name="CONTENT" value="'+field.CONTENT+'" />',
length:'<input type="text" name="LENGTH" value="'+field.LENGTH+'" />',
point:'<input type="text" name="POINT" value="'+field.POINT+'" />',
field_default:'<input type="text" name="FIELD_DEFAULT" value="'+field.FIELD_DEFAULT+'" />',
type:'<input type="text" name="TYPE" value="'+field.TYPE+'" />',
is_key:'<input type="checkbox" name="IS_KEY" '+(field.IS_KEY==true?'checked':'')+' />',
is_null:'<input type="checkbox" name="IS_NULL" '+(field.IS_NULL==false?'':'checked')+' />'
});
$(tr2).appendTo(fieldTable);
}
$('input[name=TYPE]').combobox({
data : type_data,
valueField : 'CODE_ID',
textField : 'CODE_NAME',
editable:false,
panelHeight:'auto'
});
}
//保存
function insertData(is_entity){
is_entity.FIELD_CREATE_TIME = strToDateObj(is_entity.FIELD_CREATE_TIME);
// is_entity.FIELD_RECEIVE_DATE = strToDateObj(is_entity.FIELD_RECEIVE_DATE);
var v_result = studentModule.studentActAction.insertStudent(is_entity);
$('#list').datagrid('reload');
return v_result;
}
//加载修改子页面
function editRow(index) {
$('#list').datagrid('selectRow',index);
var is_row = $('#list').datagrid('getSelections');
$('#list').datagrid('clearSelections');
is_row[0].OPETYPE = 'update';
openEditRow("formtableView_formtableTabDetail",is_row[0],"编辑",true,0.65,0.95,0,0);
}
//加载修改子页面成功后的回调
function updateUrlOnloadCallback(is_row){
if(is_row.IS_DBSYNCH==0){
$('#IS_DBSYNCH').html('未同步');
}else{
$('#IS_DBSYNCH').html('已同步');
}
}
//保存
function updateData(is_entity){
is_entity.FIELD_CREATE_TIME = strToDateObj(is_entity.FIELD_CREATE_TIME);
// is_entity.FIELD_RECEIVE_DATE = strToDateObj(is_entity.FIELD_RECEIVE_DATE);
v_result = studentModule.studentActAction.updateStudent(is_entity);
$('#list').datagrid('reload');
return v_result;
}
/****/
/**
* 序号:6
* 功能:单个删除
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
function deleteRow(index){
$('#list').datagrid('selectRow',index);
var is_row = $('#list').datagrid('getSelections');
$('#list').datagrid('clearSelections');
var code = is_row[0].UUID;
$.messager.confirm('提示', '确定删除?', function(r) {
if (r) {
var v_query = {};
v_query.FIELD_CODE = code;
var v_result = studentModule.studentActAction.deleteStudent(v_query);
$.messager.alert('提示',v_result.VALUE);
$('#list').datagrid('reload');
}
});
}
/****/
/**
* 序号:7
* 功能:批量删除
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
function deleteBatchRow(){
var code="";
var rows = $('#list').datagrid('getSelections');
for(var i=0; i<rows.length; i++){
code = code + rows[i].UUID+",";
}
if(rows == null || rows == ""){
$.messager.alert('提示',"请选择需删除的记录!",'info');
return;
}
if(code.length>0){
code = code.substring(0,code.length - 1);
}
$.messager.confirm('提示', '确定删除?', function(r) {
if (r) {
var v_query = {};
v_query.FIELD_CODE = code;
var v_result = studentModule.studentActAction.deleteStudent(v_query);
$.messager.alert('提示',v_result.VALUE);
$('#list').datagrid('reload');
}
});
}
/****/
/**
* 序号:8
* 功能:刷新
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
function refreshRow(){
$('#list').datagrid('load',{});
$("#studentTab_searchForm")[0].reset();
}
/****/
/**
* 序号:9
* 功能:查询
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
function searchRow(){
var v_query = $("#studentTab_searchForm").getFormVal();
$('#list').datagrid('load',v_query);
}
/****/
/**
* 序号:10
* 功能:高级查询弹出
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
//加载高级查询子页面
function advsearchRow(){
var is_row={OPETYPE:'ww'};
openAdvsearchRow("studentView_studentAdvsearch",is_row,"高级查询",true,0.65,0.95,0,0);
}
//加载高级查询子页面成功后的回调
function addAdvsearchCallback(is_row){
$('#adv_STATUS').combobox({
data : v_statusquery_data,
valueField : 'CODE_ID',
textField : 'CODE_NAME',
editable:false,
panelHeight:'auto'
});
$('#adv_SEX').combobox({
data : v_sexquery_data.rowSet,
valueField : 'CODE_ID',
textField : 'CODE_NAME',
editable:false,
panelHeight:'auto'
});
$('#adv_NATION').combobox({
data : v_nationquery_data.rowSet,
valueField : 'CODE_ID',
textField : 'CODE_NAME',
editable:false,
panelHeight:'200'
});
}
//高级查询
function advsearchData(is_entity){
is_entity.FIELD_START_TIME = strToDateObj(is_entity.FIELD_START_TIME);
is_entity.FIELD_END_TIME = strToDateObj(is_entity.FIELD_END_TIME);
$('#list').datagrid('load',is_entity);
}
/****/
/**
* 序号:11
* 功能:处理接口附件
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
function uploadcommonRow(index){
$('#list').datagrid('selectRow',index);
var is_row = $('#list').datagrid('getSelections');
$('#list').datagrid('clearSelections');
var code = is_row[0].UUID;
var is_row={MAINDATA_ID:code,MODULE_ID:ls_module_id};
var editUrl = "uploadFileCommonView_uploadfileCommonTab?FIELD_MODULE_ID="+ls_module_id+"&FIELD_MAINDATA_ID="+code;
openViewIframRow("uploadcommon",editUrl,is_row,"毕业证附件",true,0.65,0.95,0,0);
}
/****/
/**
* 序号:12
* 功能:批量处理接口附件
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
function uploadcommonBatchRow(){
var code="";
var rows = $('#list').datagrid('getSelections');
for(var i=0; i<rows.length; i++){
code = code + rows[i].UUID+",";
}
if(rows == null || rows == ""){
$.messager.alert('提示',"请选择记录!",'info');
return;
}
if(code.length>0){
code = code.substring(0,code.length - 1);
}
var is_row={MAINDATA_ID:code,MODULE_ID:ls_module_id};
var editUrl = "uploadFileCommonView_uploadfileCommonTab?FIELD_MODULE_ID="+ls_module_id+"&FIELD_MAINDATA_ID="+code;
openViewIframRow("uploadcommon",editUrl,is_row,"批量毕业证附件",true,0.65,0.95,0,0);
}
/****/
function replaceByJson(text,json){
for(key in json){
text = text.replace('@{'+key+'}',json[key]);
}
return text;
}
\ No newline at end of file
......@@ -4,5 +4,19 @@
"http://struts.apache.org/dtds/struts-2.3.dtd">
<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>
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