Commit f9cbbe82 by 陈玉兰

提交表单

parent b299d9ca
......@@ -9,6 +9,7 @@
<value>classpath:com/gaowj/business/formtable/formtableDAO.xml</value>
<value>classpath:com/gaowj/business/procdefinition/procdefinitionDAO.xml</value>
<value>classpath:com/gaowj/business/procdefinitionmodels/procdefinitionmodelsDAO.xml</value>
<value>classpath:com/gaowj/business/formfield/formfieldDAO.xml</value>
</list>
</property>
</bean>
......@@ -21,7 +22,6 @@
</bean>
</property>
</bean>
<bean id="procdefinitionBusiness" class="com.gaowj.business.procdefinition.ProcdefinitionBusinessImpl">
<property name="procdefinitionDAO">
<bean class="org.mybatis.spring.mapper.MapperFactoryBean">
......@@ -52,4 +52,13 @@
<property name="managementService" ref="managementService"></property>
</bean>
<bean id="FormfieldBusiness" class="com.gaowj.business.formfield.FormfieldBusinessImpl">
<property name="formfieldDAO">
<bean class="org.mybatis.spring.mapper.MapperFactoryBean">
<property name="mapperInterface" value="com.gaowj.business.formfield.formfieldDAO" />
<property name="sqlSessionFactory" ref="sqlSessionFactory-test" />
</bean>
</property>
</bean>
</beans>
......@@ -1300,7 +1300,7 @@ function strToDateObj(str){
else if($(this).is(":checkbox")){
var field_id = $(this).attr("name");
var str="";
$("[name="+field_id+"]:checked").each(function(){
$("[name='"+field_id+"']:checked").each(function(){
if($(this).attr("checked")){
str += $(this).val()+",";
}
......
<%@page contentType="text/html; charset=UTF-8"%>
<%@ include file="/gaowj/header-simple-1.0.jsp"%>
<div id="studentTab">
<div id="formTableTab">
<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>
......@@ -8,15 +8,12 @@
<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;
姓名: <input class="easyui-textbox" id="FIELD_NAME" name="FIELD_TABLE_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>
......
......@@ -7,7 +7,7 @@
<span>表名:</span>
</td>
<td style="width: 30%">
<input class="easyui-textbox" id="TABLE_NAME" name="FIELD_TABLE_NAME" style="width:200px" />
<input class="easyui-textbox" id="TABLE_NAME" name="FIELD_TABLE_NAME" value="${is_row.TABLE_NAME}" style="width:200px" />
</td>
<td style="width: 15%;" class="tableStyleLable">
<span>同步数据库状态:</span>
......@@ -21,13 +21,13 @@
<span>描述:</span>
</td>
<td colspan="3">
<input class="easyui-textbox" id="CONTENT" name="FIELD_CONTENT" style="width:570px" />
<input class="easyui-textbox" id="CONTENT" name="FIELD_CONTENT" value="${is_row.CONTENT}" style="width:570px" />
</td>
</tr>
</table>
<div>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" onclick="javascript:addLine()">新增</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-clear',plain:true" onclick="javascript:deleteLine()">删除</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" onclick="javascript:addLine()">插入一行</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-clear',plain:true" onclick="javascript:deleteLine()">删除</a>
</div>
<table id="fieldTable">
</table>
......
......@@ -45,7 +45,6 @@ var type_data=[{CODE_ID:'varchar',CODE_NAME:'varchar'},{CODE_ID:'int',CODE_NAME:
var list_default_field=[{
FIELD_NAME:'uuid',
TYPE:'varchar',
LENGTH:50,
POINT:0,
FIELD_MUST_INPUT:true,
......@@ -56,7 +55,6 @@ var list_default_field=[{
IS_NULL:false
},{
FIELD_NAME:'create_id',
TYPE:'varchar',
LENGTH:50,
POINT:0,
FIELD_MUST_INPUT:true,
......@@ -67,7 +65,6 @@ var list_default_field=[{
IS_NULL:true
},{
FIELD_NAME:'create_time',
TYPE:'varchar',
LENGTH:0,
POINT:0,
FIELD_MUST_INPUT:true,
......@@ -78,7 +75,6 @@ var list_default_field=[{
IS_NULL:true
},{
FIELD_NAME:'update_id',
TYPE:'varchar',
LENGTH:50,
POINT:0,
FIELD_MUST_INPUT:true,
......@@ -89,7 +85,6 @@ var list_default_field=[{
IS_NULL:true
},{
FIELD_NAME:'update_time',
TYPE:'varchar',
LENGTH:0,
POINT:0,
FIELD_MUST_INPUT:true,
......@@ -111,6 +106,7 @@ var tr=['<tr>',
' <td>@{type}</td>',
' <td>@{is_key}</td>',
' <td>@{is_null}</td>',
' <td>@{order_num}</td>',
'</tr>'].join("");
/****/
......@@ -207,6 +203,11 @@ function addRow(){
}
//加载增加子页面成功后的回调
function addUrlOnloadCallback(is_row){
initTableInsert();
}
function initTableInsert(){
var fieldTable=$("#fieldTable");
$(replaceByJson(tr,{
index:'序号',
......@@ -218,7 +219,8 @@ function addUrlOnloadCallback(is_row){
field_default:'默认值',
type:'数据类型',
is_key:'主键',
is_null:'允许空值'
is_null:'允许空值',
order_num:'',
})).appendTo(fieldTable);
$('#IS_DBSYNCH').html('未同步');
......@@ -228,24 +230,28 @@ function addUrlOnloadCallback(is_row){
var field=list_default_field[i];
tr2=replaceByJson(tr2,{
index:i+1,
opt:'<input type="checkbox" />',
opt:'<input type="checkbox" name="checkbox"/>',
field_name:'<input type="text" name="LIST['+i+'].NAME" value="'+field.FIELD_NAME+'" />',
content:'<input type="text" name="LIST['+i+'].CONTENT" value="'+field.CONTENT+'" />',
length:'<input type="text" name="LIST['+i+'].LENGTH" value="'+field.LENGTH+'" />',
point:'<input type="text" name="LIST['+i+'].POINT" value="'+field.POINT+'" />',
field_default:'<input type="text" name="LIST['+i+'].DEFAULT" value="'+field.FIELD_DEFAULT+'" />',
type:'<input type="text" name="LIST['+i+'].TYPE" value="'+field.TYPE+'" />',
is_key:'<input type="checkbox" name="LIST['+i+'].IS_KEY" '+(field.IS_KEY==true?'checked':'')+' />',
is_null:'<input type="checkbox" value="1" name="LIST['+i+'].IS_NULL" '+(field.IS_NULL==false?'':'checked')+' />'
field_default:'<input type="text" name="LIST['+i+'].FIELD_DEFAULT" value="'+field.FIELD_DEFAULT+'" />',
type:'<input type="combobox" name="LIST['+i+'].TYPE" value="'+field.TYPE+'" />',
is_key:'<input type="checkbox" value="'+field.IS_KEY+'" name="LIST['+i+'].IS_KEY" '+(field.IS_KEY==true?'checked':'')+' />',
is_null:'<input type="checkbox" value="'+field.IS_NULL+'" name="LIST['+i+'].IS_NULL" '+(field.IS_NULL==false?'':'checked')+' />',
order_num:'<input class="field_order_number" type="hidden" name="LIST['+i+'].ORDER_NUM" />'
});
$(tr2).appendTo(fieldTable);
$('input[name="LIST['+i+'].TYPE"]').combobox({
data : type_data,
valueField : 'CODE_ID',
textField : 'CODE_NAME',
editable:false,
panelHeight:'auto'
});
}
$('input[name=TYPE]').combobox({
data : type_data,
valueField : 'CODE_ID',
textField : 'CODE_NAME',
editable:false,
panelHeight:'auto'
$('#fieldTable tr').eq(0).nextAll().each(function(index,element){
$(element).find('.field_order_number').val(index+1);
});
}
//保存
......@@ -262,21 +268,77 @@ function editRow(index) {
$('#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('已同步');
}
initTableUpdate(is_row);
}
function initTableUpdate(is_row){
$.ajax({
url:'formtableAct_listTableFile',
type:'post',
data:{
UUID:is_row.UUID
},
success: function(data){
var fieldTable=$("#fieldTable");
$(replaceByJson(tr,{
index:'序号',
opt:'操作',
field_name:'字段名称',
content:'备注',
length:'长度',
point:'小数点',
field_default:'默认值',
type:'数据类型',
is_key:'主键',
is_null:'允许空值',
order_num:''
})).appendTo(fieldTable);
if(is_row.IS_DBSYNCH==0){
$('#IS_DBSYNCH').html('未同步');
}else{
$('#IS_DBSYNCH').html('已同步');
}
for(var i=0;i<data.listfield.length;i++){
var tr2=tr;
var field=data.listfield[i];
tr2=replaceByJson(tr2,{
index:i+1,
opt:'<input type="checkbox" />',
field_name:'<input type="text" name="LIST['+i+'].NAME" value="'+field.FIELD_NAME+'" />',
content:'<input type="text" name="LIST['+i+'].CONTENT" value="'+field.CONTENT+'" />',
length:'<input type="text" name="LIST['+i+'].LENGTH" value="'+field.LENGTH+'" />',
point:'<input type="text" name="LIST['+i+'].POINT" value="'+field.POINT+'" />',
field_default:'<input type="text" name="LIST['+i+'].FIELD_DEFAULT" value="'+field.FIELD_DEFAULT+'" />',
type:'<input type="combobox" name="LIST['+i+'].TYPE" value="'+field.TYPE+'" />',
is_key:'<input type="checkbox" value="'+field.IS_KEY+'" name="LIST['+i+'].IS_KEY" '+(field.IS_KEY==true?'checked':'')+' />',
is_null:'<input type="checkbox" value="'+field.IS_NULL+'" name="LIST['+i+'].IS_NULL" '+(field.IS_NULL==false?'':'checked')+' />',
order_num:'<input class="field_order_number" type="hidden" value="'+field.ORDER_NUM+'" name="LIST['+i+'].ORDER_NUM" /><input type="hidden" value="'+field.UUID+'" name="LIST['+i+'].UUID" />'
});
$(tr2).appendTo(fieldTable);
$('input[name="LIST['+i+'].TYPE"]').combobox({
data : type_data,
valueField : 'CODE_ID',
textField : 'CODE_NAME',
editable:false,
panelHeight:'auto'
});
}
}
})
}
//保存
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);
v_result = formtableModule.act.updateFormTable(is_entity);
$('#list').datagrid('reload');
return v_result;
}
......@@ -295,16 +357,14 @@ function updateData(is_entity){
**/
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);
var v_result = formtableModule.act.deleteFormTable(v_query);
$.messager.alert('提示',v_result.VALUE);
$('#list').datagrid('reload');
}
......@@ -339,7 +399,7 @@ function deleteBatchRow(){
if (r) {
var v_query = {};
v_query.FIELD_CODE = code;
var v_result = studentModule.studentActAction.deleteStudent(v_query);
var v_result = formtableModule.act.deleteFormTable(v_query);
$.messager.alert('提示',v_result.VALUE);
$('#list').datagrid('reload');
}
......@@ -359,7 +419,7 @@ function deleteBatchRow(){
**/
function refreshRow(){
$('#list').datagrid('load',{});
$("#studentTab_searchForm")[0].reset();
$("#formTableTab_searchForm")[0].reset();
}
/****/
......@@ -374,116 +434,55 @@ function refreshRow(){
* 备注:需更改
**/
function searchRow(){
var v_query = $("#studentTab_searchForm").getFormVal();
var v_query = $("#formTableTab_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 replaceByJson(text,json){
for(key in json){
text = text.replace('@{'+key+'}',json[key]);
}
return text;
}
}
//加载高级查询子页面成功后的回调
function addAdvsearchCallback(is_row){
$('#adv_STATUS').combobox({
data : v_statusquery_data,
var j =list_default_field.length+1;
function addLine(){
var aa={
index:j,
opt:'<input type="checkbox" name="checkbox"/>',
field_name:'<input type="text" name="LIST['+j+'].NAME" />',
content:'<input type="text" name="LIST['+j+'].CONTENT" />',
length:'<input type="text" name="LIST['+j+'].LENGTH" value="0"/>',
point:'<input type="text" name="LIST['+j+'].POINT" value="0"/>',
field_default:'<input type="text" name="LIST['+j+'].FIELD_DEFAULT" />',
type:'<input type="combobox" name="LIST['+j+'].TYPE" />',
is_key:'<input type="checkbox" name="LIST['+j+'].IS_KEY" />',
is_null:'<input type="checkbox" name="LIST['+j+'].IS_NULL" checked/>',
order_num:'<input class="field_order_number" type="hidden" name="LIST['+j+'].ORDER_NUM" />'
};
var fieldTable=$("#fieldTable");
$(replaceByJson(tr,aa)).appendTo(fieldTable);
$('input[name="LIST['+j+'].TYPE"]').combobox({
data : type_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'
$('#fieldTable tr').eq(0).nextAll().each(function(index,element){
$(element).find('.field_order_number').val(index+1);
});
$('#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');
j++;
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');
function deleteLine(){
if($(":checkbox[name='checkbox']:checked").length == 0 ){
$.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
$(":checkbox[name='checkbox']:checked").each(function(){
$(this).parent().parent().remove();
});
}
\ No newline at end of file
......@@ -31,5 +31,20 @@ public interface FormfieldBusiness {
*/
void delete_form_field(List<String> list)throws BusinessException;
List<Map<String,Object>> list_form_field(Map<String, Object> query) throws BusinessException ;
/**
* 根据tableid做删除
* @param list
* @throws BusinessException
*/
void delete_form_field_byTableid(List<String> list)throws BusinessException;
List<Map<String,Object>> list_form_field(Map<String, Object> query) throws BusinessException;
/**
* 根据tableid做查询
* @param tableid
* @return
* @throws BusinessException
*/
List<Map<String, Object>> list_form_field_byTableid(String tableid) throws BusinessException;
}
package com.gaowj.business.formfield;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.lang.StringUtils;
import com.gaowj.business.FormfieldBusiness;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.SessionUtil;
import com.gaowj.formtable.action.Property;
public class FormfieldBusinessImpl implements FormfieldBusiness{
private formfieldDAO formfieldDAO;
public formfieldDAO getFormfieldDAO() {
return formfieldDAO;
}
public void setFormfieldDAO(formfieldDAO formfieldDAO) {
this.formfieldDAO = formfieldDAO;
}
@Override
public void insert_form_field(Map<String, Object> entity)
throws BusinessException {
// TODO Auto-generated method stub
//动态传值插入
if (entity.get("UUID") == null) {
entity.put("UUID", java.util.UUID.randomUUID().toString());
}
if (entity.get("CREATE_TIME") == null) {
entity.put("CREATE_TIME", new Date());
}
if (entity.get("CREATE_ID") == null) {
entity.put("CREATE_ID", SessionUtil.getCode());
}
if (entity.get("UPDATE_ID") == null) {
entity.put("UPDATE_ID", SessionUtil.getCode());
}
if (entity.get("UPDATE_TIME") == null) {
entity.put("UPDATE_TIME", new Date());
}
// 动态传值插入
List<String> infoListKey = new ArrayList<String>();
List<Object> infoList = new ArrayList<Object>();
if (entity.keySet() != null) {
Set<String> key = entity.keySet();
// 将map集合中的key和value 取出来分别放到list集合里
for (String str : key) {
infoList.add(entity.get(str));
infoListKey.add(str);
}
entity.put("infoListKey", infoListKey);
entity.put("infoList", infoList);
}
formfieldDAO.insert_form_field(entity);
entity.clear();
}
@Override
public void update_form_field(Map<String, Object> entity)
throws BusinessException {
// TODO Auto-generated method stub
List<Map<String, Object>> updateList = new ArrayList<Map<String, Object>>();
if(entity.keySet()!=null){
Set<String> key = entity.keySet();
Map<String, Object> param=new HashMap<String, Object>();
// 将map集合中的key和value 取出来分别放到list集合里
for (String str : key) {
Map<String, Object> updateMap = new HashMap<String, Object>();
if (StringUtils.equalsIgnoreCase("UUID",str)) continue;
updateMap.put("key", str);
updateMap.put("value", entity.get(str));
updateList.add(updateMap);
}
param.put("UUID", entity.get("UUID"));
param.put("info", updateList);
formfieldDAO.update_form_field(param);
}
}
@Override
public void delete_form_field(List<String> list) throws BusinessException {
// TODO Auto-generated method stub
formfieldDAO.delete_form_field(list);
}
@Override
public List<Map<String, Object>> list_form_field(Map<String, Object> query)
throws BusinessException {
// TODO Auto-generated method stub
return null;
}
@Override
public void delete_form_field_byTableid(List<String> list)
throws BusinessException {
// TODO Auto-generated method stub
formfieldDAO.delete_form_field_byTableid(list);
}
@Override
public List<Map<String, Object>> list_form_field_byTableid(String tableid)
throws BusinessException {
// TODO Auto-generated method stub
return formfieldDAO.list_form_field_byTableid(tableid);
}
}
package com.gaowj.business.formfield;
import java.util.List;
import java.util.Map;
import com.gaowj.business.exception.BusinessException;
public interface formfieldDAO {
void insert_form_field(Map<String, Object> entity) throws BusinessException;
void update_form_field(Map<String, Object> entity) throws BusinessException;
void delete_form_field(List<String> list) throws BusinessException;
void delete_form_field_byTableid(List<String> list) throws BusinessException;
List<Map<String, Object>> list_form_field(Map<String, Object> query) throws BusinessException;
List<Map<String, Object>> list_form_field_byTableid(String tableid) throws BusinessException;
}
......@@ -6,22 +6,13 @@
<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 test="TABLE_ID != null and TABLE_ID != ''">
and f.TABLE_ID = #{TABLE_ID}
</if>
</trim>
</sql>
<insert id="insert_form_table" parameterType="map">
insert into C_T_FORM_FIELD(
<insert id="insert_form_field" parameterType="map">
insert into C_T_FORM_FIELD(
<trim prefix="" suffixOverrides=",">
<foreach collection="infoListKey" item="key">
${key},
......@@ -36,7 +27,7 @@
<![CDATA[ ) ]]>
</insert>
<update id="update_form_table" parameterType="map">
<update id="update_form_field" parameterType="map">
<![CDATA[
update C_T_FORM_FIELD set
]]>
......@@ -52,7 +43,7 @@
</where>
</update>
<delete id="delete_form_table" parameterType="list">
<delete id="delete_form_field" parameterType="list">
<![CDATA[
delete from C_T_FORM_FIELD where UUID IN
]]>
......@@ -62,7 +53,16 @@
</foreach>
</delete>
<select id="list_form_table" parameterType="map" resultType="upperCaseKeyMap">
<delete id="delete_form_field_byTableid" parameterType="list">
<![CDATA[
delete from C_T_FORM_FIELD where TABLE_ID IN
]]>
<foreach collection="list" item="UUID" open="(" separator=","
close=")">
#{UUID}
</foreach>
</delete>
<select id="list_form_field" parameterType="map" resultType="upperCaseKeyMap">
<![CDATA[
select f.*
from C_T_FORM_FIELD f
......@@ -70,11 +70,19 @@
<include refid="Where_Clause" />
order by f.CREATE_TIME DESC
</select>
<select id="listCount_form_table" parameterType="map"
<select id="list_form_field_byTableid" parameterType="string" resultType="upperCaseKeyMap">
<![CDATA[
select f.*
from C_T_FORM_FIELD f where f.TABLE_ID =#{TABLE_ID}
]]>
order by f.ORDER_NUM ASC
</select>
<select id="listCount_form_field" parameterType="map"
resultType="int">
<![CDATA[
select count(*) c from C_T_FORM_TABLE f
select count(*) c from C_T_FORM_FIELD f
]]>
<include refid="Where_Clause" />
</select>
......
package com.gaowj.business.formfiled;
import java.util.List;
import java.util.Map;
import com.gaowj.business.FormfieldBusiness;
import com.gaowj.business.exception.BusinessException;
public class FormfieldBusinessImpl implements FormfieldBusiness{
@Override
public void insert_form_field(Map<String, Object> entity)
throws BusinessException {
// TODO Auto-generated method stub
}
@Override
public void update_form_field(Map<String, Object> entity)
throws BusinessException {
// TODO Auto-generated method stub
}
@Override
public void delete_form_field(List<String> list) throws BusinessException {
// TODO Auto-generated method stub
}
@Override
public List<Map<String, Object>> list_form_field(Map<String, Object> query)
throws BusinessException {
// TODO Auto-generated method stub
return null;
}
}
package com.gaowj.business.formfiled;
import java.util.List;
import java.util.Map;
import com.gaowj.business.exception.BusinessException;
public interface formfieldDAO {
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(Map<String, Object> query) throws BusinessException;
}
......@@ -7,6 +7,8 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.xml.crypto.Data;
import org.activiti.engine.RepositoryService;
import org.apache.commons.lang.StringUtils;
import org.apache.ibatis.session.RowBounds;
......@@ -69,6 +71,8 @@ public class FormtableBusinessImpl implements FormtableBusiness {
public void update_form_table(Map<String, Object> entity) throws BusinessException {
// 动态传值修改
if (entity.keySet() != null) {
entity.put("UPDATE_TIME", new Date());
entity.put("UPDATE_ID", SessionUtil.getCode());
convertEntity(entity);
formtableDAO.update_form_table(entity);
}
......@@ -83,7 +87,9 @@ public class FormtableBusinessImpl implements FormtableBusiness {
public Page<Map<String, Object>> list_form_table(int pageNo, int pageSize, Map<String, Object> query) throws BusinessException {
// 计算起始记录
int pageStart = (pageNo - 1) * pageSize;
if(query.get("TABLE_NAME")!=null&&""!=query.get("TABLE_NAME")){
query.put("TABLE_NAME", "%"+query.get("TABLE_NAME")+"%");
}
// 获取列表
List<Map<String, Object>> items = formtableDAO.list_form_table(new RowBounds(pageStart, pageSize), query);
// 获取列表个数
......
......@@ -7,10 +7,10 @@
and f.UUID = #{UUID}
</if>
<if test="TABLE_NAME != null and TABLE_NAME != ''">
and f.TABLE_NAME like #{TABLE_NAME_LIKE}
and f.TABLE_NAME like #{TABLE_NAME}
</if>
<if test="CONTENT != null and CONTENT != ''">
and f.CONTENT like #{CONTENT_LIKE}
and f.CONTENT like #{CONTENT}
</if>
<if test="IS_DBSYNCH != null and IS_DBSYNCH != ''">
and f.IS_DBSYNCH = #{IS_DBSYNCH}
......
......@@ -2,17 +2,46 @@ package com.gaowj.formtable.action;
public class Property {
private Object IS_NULL;
private String IS_NULL;
private String NAME;
private String CONTENT;
private Integer LENGTH;
private Integer POINT;
private String IS_KEY;
private String FIELD_DEFAULT;
private String TYPE;
private Integer ORDER_NUM;
private String UUID;
public Object getIS_NULL() {
public String getIS_KEY() {
return IS_KEY;
}
public void setIS_KEY(String iS_KEY) {
IS_KEY = iS_KEY;
}
public String getFIELD_DEFAULT() {
return FIELD_DEFAULT;
}
public void setFIELD_DEFAULT(String fIELD_DEFAULT) {
FIELD_DEFAULT = fIELD_DEFAULT;
}
public String getTYPE() {
return TYPE;
}
public void setTYPE(String tYPE) {
TYPE = tYPE;
}
public String getIS_NULL() {
return IS_NULL;
}
public void setIS_NULL(Object iS_NULL) {
public void setIS_NULL(String iS_NULL) {
IS_NULL = iS_NULL;
}
......@@ -47,6 +76,23 @@ public class Property {
public void setPOINT(Integer pOINT) {
POINT = pOINT;
}
public Integer getORDER_NUM() {
return ORDER_NUM;
}
public void setORDER_NUM(Integer oRDER_NUM) {
ORDER_NUM = oRDER_NUM;
}
public String getUUID() {
return UUID;
}
public void setUUID(String uUID) {
UUID = uUID;
}
}
......@@ -4,8 +4,11 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import com.alibaba.fastjson.JSON;
import com.gaowj.business.FormfieldBusiness;
import com.gaowj.business.FormtableBusiness;
import com.gaowj.business.SystemOpeBusiness;
import com.gaowj.business.action.BasicAction;
......@@ -52,29 +55,46 @@ public class actAction extends BasicAction {
public String insertFormTable() throws BusinessException {
FormtableBusiness business = BusinessManager.getBusiness(FormtableBusiness.class);
FormfieldBusiness fieldBusiness=BusinessManager.getBusiness(FormfieldBusiness.class);
Map<String, Object> entity = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
Map<String, Object> RE=RequestUtils.getUpdateFieldMap(request, "Form_");
jsonObject = new JSONObject();
try {
entity = QueryParamUtil.StringToDate(entity);
//去除不要更新的字段
entity.remove("OPETYPE");
//新增
Map<String,Object> formTable=business.insert_form_table(entity);
//做子表的插入
Map<String, Object> param=new HashMap<String, Object>();
param.put("list", LIST);
param.put("table_id", formTable.get("UUID"));
// 操作日志
//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_form_table(null));
//
for(Property property:LIST){
if(property==null){
continue;
}
if(property.getCONTENT()!=null&&""!=property.getCONTENT()){
param.put("CONTENT", property.getCONTENT());
}
param.put("FIELD_NAME", property.getNAME());
param.put("LENGTH",property.getLENGTH() );
param.put("POINT", property.getPOINT());
param.put("TABLE_ID", formTable.get("UUID"));
param.put("TYPE", property.getTYPE());
param.put("ORDER_NUM", property.getORDER_NUM());
if(property.getIS_NULL().equals("")){
param.put("IS_NULL",0);
}else{
param.put("IS_NULL",1);
}
if(property.getIS_KEY().equals("")){
param.put("IS_KEY", 0);
}else{
param.put("IS_KEY", 1);
}
if(property.getFIELD_DEFAULT()!=null&&""!=property.getFIELD_DEFAULT()){
param.put("FIELD_DEFAULT", property.getFIELD_DEFAULT());
}
fieldBusiness.insert_form_field(param);
}
jsonObject.putAll(Status.getStatusSuccessMessage("保存成功"));
} catch (Exception e) {
jsonObject.putAll(Status.getStatusErrorMessage("保存失败"));
......@@ -91,6 +111,7 @@ public class actAction extends BasicAction {
public String updateFormTable() throws BusinessException {
FormtableBusiness business = BusinessManager.getBusiness(FormtableBusiness.class);
FormfieldBusiness fieldBusiness=BusinessManager.getBusiness(FormfieldBusiness.class);
Map<String, Object> entity = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
try {
......@@ -99,11 +120,37 @@ public class actAction extends BasicAction {
//修改
entity = QueryParamUtil.StringToDate(entity);
business.update_form_table(entity);
// 操作日志
SystemOpeBusiness sysbusiness = BusinessManager.getBusiness(SystemOpeBusiness.class);
sysbusiness.insert_logBusiness("updateStudent", "" + entity,
"修改学生测试数据",(String) entity.get("UUID"), (String) entity.get("NAME"),"studentdemo1");
//
//做子表的插入
Map<String, Object> param=new HashMap<String, Object>();
for(Property property:LIST){
if(property==null){
continue;
}
if(property.getCONTENT()!=null&&""!=property.getCONTENT()){
param.put("CONTENT", property.getCONTENT());
}
param.put("UUID", property.getUUID());
param.put("FIELD_NAME", property.getNAME());
param.put("LENGTH",property.getLENGTH() );
param.put("POINT", property.getPOINT());
param.put("TABLE_ID", entity.get("UUID"));
param.put("TYPE", property.getTYPE());
param.put("ORDER_NUM", property.getORDER_NUM());
if(property.getIS_NULL().equals("")){
param.put("IS_NULL",0);
}else{
param.put("IS_NULL",1);
}
if(property.getIS_KEY().equals("")){
param.put("IS_KEY", 0);
}else{
param.put("IS_KEY", 1);
}
if(property.getFIELD_DEFAULT()!=null&&""!=property.getFIELD_DEFAULT()){
param.put("FIELD_DEFAULT", property.getFIELD_DEFAULT());
}
fieldBusiness.update_form_field(param);
}
jsonObject.putAll(Status.getStatusSuccessMessage("修改成功"));
} catch (Exception e) {
jsonObject.putAll(Status.getStatusErrorMessage("修改失败"));
......@@ -120,17 +167,14 @@ public class actAction extends BasicAction {
public String deleteFormTable() throws BusinessException {
FormtableBusiness business = BusinessManager.getBusiness(FormtableBusiness.class);
FormfieldBusiness fieldBusiness=BusinessManager.getBusiness(FormfieldBusiness.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_form_table(ListKey);
// 操作日志
SystemOpeBusiness sysbusiness = BusinessManager.getBusiness(SystemOpeBusiness.class);
sysbusiness.insert_logBusiness("deleteStudent", "" + ListKey,
"删除学生测试数据", deletekey, "多个流水号","studentdemo1");
//
fieldBusiness.delete_form_field_byTableid(ListKey);
jsonObject.putAll(Status.getStatusSuccessMessage("删除成功"));
} catch (Exception e) {
jsonObject.putAll(Status.getStatusErrorMessage("删除失败"));
......@@ -138,5 +182,16 @@ public class actAction extends BasicAction {
}
return "json";
}
public String listTableFile()throws BusinessException{
FormfieldBusiness fieldBusiness=BusinessManager.getBusiness(FormfieldBusiness.class);
String tableId = RequestUtils.getString(request, "UUID");
List<Map<String, Object>> list=fieldBusiness.list_form_field_byTableid(tableId);
String result=JSON.toJSONString(list);
jsonObject.put("listfield", result);
return "json";
}
}
package com.gaowj.formtable.action;
import java.util.List;
import java.util.Map;
import com.gaowj.business.FormfieldBusiness;
import com.gaowj.business.action.BasicAction;
import com.gaowj.business.comp.BusinessManager;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.RequestUtils;
public class viewAction extends BasicAction {
......@@ -15,6 +21,8 @@ public class viewAction extends BasicAction {
}
public String formtableTabDetail() throws BusinessException{
Map<String,Object> query = RequestUtils.getUpdateFieldMapUtf8(request, RequestUtils.UPDATEDATAFIELDPREFIX);
request.setAttribute("is_row", query);
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