Commit 44cadacd by 陈玉兰

提交

parent ddd09a6d
......@@ -13,7 +13,7 @@
<span>同步数据库状态:</span>
</td>
<td style="width: 30%">
<span id="IS_DBSYNCH"></span>
<span id="IS_DBSYNCH" name="FIELD_IS_DBSYNCH" value="0"></span>
</td>
</tr>
<tr>
......@@ -25,6 +25,10 @@
</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>
</div>
<table id="fieldTable">
</table>
</form>
\ No newline at end of file
......@@ -9,11 +9,11 @@ var formtableModule = function(format) {
formtableModule.prototype = BusinessObject;
//插入附件数据
formtableModule.prototype.insertStudent = function(){};
formtableModule.prototype.insertFormTable = function(){};
//修改附件数据
formtableModule.prototype.updateStudent = function(){};
formtableModule.prototype.updateFormTable = function(){};
//删除附件数据
formtableModule.prototype.deleteStudent = function(){};
formtableModule.prototype.deleteFormTable = function(){};
//创建一个数据操作对象,然后再后续使用
formtableModule.act = new formtableModule("json").delegate("formtableAct");
......
......@@ -128,24 +128,13 @@ var tr=['<tr>',
//定义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 : 'TABLE_NAME',title : '表名',width : 100,align : 'center'},
{field : 'CONTENT',title : '描述',width : 80,align : 'center'},
{field : 'IS_DBSYNCH',title : '是否同步到数据库',width : 100,align : 'center'},
{field : 'CREATE_ID',title : '创建人员',width : 100,align : 'center'},
{field : 'CREATE_TIME',title : '创建时间',width : 100,align : 'center'}
{field : 'CREATE_TIME',title : '创建时间',width : 100,align : 'center'},
{field : 'UPDATE_TIME',title : '更新时间',width : 100,align : 'center'},
{field : 'UPDATE_ID',title : '更新人员',width : 100,align : 'center'}
] ];
//列表加载完成回调
function dataOnLoadSuccess(){
......@@ -240,14 +229,14 @@ function addUrlOnloadCallback(is_row){
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')+' />'
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')+' />'
});
$(tr2).appendTo(fieldTable);
}
......@@ -261,9 +250,7 @@ function addUrlOnloadCallback(is_row){
}
//保存
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);
var v_result = formtableModule.act.insertFormTable(is_entity);
$('#list').datagrid('reload');
return v_result;
}
......
package com.gaowj.business;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Service;
import com.gaowj.business.exception.BusinessException;
@Service
public interface FormfieldBusiness {
/**
* 插入
* @param entity
* @throws BusinessException
*/
void insert_form_field(Map<String,Object> entity) throws BusinessException ;
/**
* 更新
* @param entity
* @throws BusinessException
*/
void update_form_field(Map<String,Object> entity) throws BusinessException ;
/**
* 删除记录
* @param entity
* @throws BusinessException
*/
void delete_form_field(List<String> list)throws BusinessException;
List<Map<String,Object>> list_form_field(Map<String, Object> query) throws BusinessException ;
}
......@@ -15,7 +15,7 @@ public interface FormtableBusiness {
* @param entity
* @throws BusinessException
*/
void insert_form_table(Map<String,Object> entity) throws BusinessException ;
Map<String,Object> insert_form_table(Map<String,Object> entity) throws BusinessException ;
/**
* 更新
......
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;
}
<?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.formfield.formfieldDAO">
<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_FIELD(
<trim prefix="" suffixOverrides=",">
<foreach collection="infoListKey" item="key">
${key},
</foreach>
</trim>
<![CDATA[ ) values( ]]>
<trim prefix="" suffixOverrides=",">
<foreach collection="infoList" item="value">
#{value},
</foreach>
</trim>
<![CDATA[ ) ]]>
</insert>
<update id="update_form_table" parameterType="map">
<![CDATA[
update C_T_FORM_FIELD 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_FIELD 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_FIELD 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>
package com.gaowj.business.formtable;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -12,6 +13,7 @@ import org.apache.ibatis.session.RowBounds;
import com.gaowj.business.FormtableBusiness;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.Page;
import com.gaowj.business.util.SessionUtil;
public class FormtableBusinessImpl implements FormtableBusiness {
private formtableDAO formtableDAO;
......@@ -25,8 +27,41 @@ public class FormtableBusinessImpl implements FormtableBusiness {
}
@Override
public void insert_form_table(Map<String, Object> entity) throws BusinessException {
public Map<String,Object> insert_form_table(Map<String, Object> entity) throws BusinessException {
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());
}
if(entity.get("IS_DBSYNCH")==null){
entity.put("IS_DBSYNCH", "0");
}
//动态传值插入
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);
}
formtableDAO.insert_form_table(entity);
return entity;
}
@Override
......
......@@ -23,14 +23,14 @@
<insert id="insert_form_table" parameterType="map">
insert into C_T_FORM_TABLE(
<trim prefix="" suffixOverrides=",">
<foreach collection="info" item="info">
${info.key},
<foreach collection="infoListKey" item="key">
${key},
</foreach>
</trim>
<![CDATA[ ) values( ]]>
<trim prefix="" suffixOverrides=",">
<foreach collection="info" item="info">
#{info.value},
<foreach collection="infoList" item="value">
#{value},
</foreach>
</trim>
<![CDATA[ ) ]]>
......
package com.gaowj.formtable.action;
public class Property {
private Object IS_NULL;
private String NAME;
private String CONTENT;
private Integer LENGTH;
private Integer POINT;
public Object getIS_NULL() {
return IS_NULL;
}
public void setIS_NULL(Object iS_NULL) {
IS_NULL = iS_NULL;
}
public String getNAME() {
return NAME;
}
public void setNAME(String nAME) {
NAME = nAME;
}
public String getCONTENT() {
return CONTENT;
}
public void setCONTENT(String cONTENT) {
CONTENT = cONTENT;
}
public Integer getLENGTH() {
return LENGTH;
}
public void setLENGTH(Integer lENGTH) {
LENGTH = lENGTH;
}
public Integer getPOINT() {
return POINT;
}
public void setPOINT(Integer pOINT) {
POINT = pOINT;
}
}
package com.gaowj.formtable.action;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.sf.json.JSONObject;
import com.gaowj.business.StudentBusiness;
import com.gaowj.business.FormtableBusiness;
import com.gaowj.business.SystemOpeBusiness;
import com.gaowj.business.action.BasicAction;
import com.gaowj.business.comp.BusinessManager;
......@@ -32,15 +33,28 @@ public class actAction extends BasicAction {
this.jsonObject = jsonObject;
}
private List<Property> LIST;
public List<Property> getLIST() {
return LIST;
}
public void setLIST(List<Property> lIST) {
LIST = lIST;
}
/**
* 插入
* @param entity
* @throws BusinessException
*/
public String insertStudent() throws BusinessException {
public String insertFormTable() throws BusinessException {
StudentBusiness business = BusinessManager.getBusiness(StudentBusiness.class);
FormtableBusiness business = BusinessManager.getBusiness(FormtableBusiness.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);
......@@ -48,8 +62,10 @@ public class actAction extends BasicAction {
//去除不要更新的字段
entity.remove("OPETYPE");
//新增
business.insert_student(entity);
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);
......@@ -57,7 +73,7 @@ public class actAction extends BasicAction {
"增加学生测试数据", (String) entity.get("UUID"), (String) entity.get("NAME"), "studentdemo1");
//
//更新缓存
CacheKit.update("ehcache11", "com_gaowj_student_dataAction_listAll", business.list_student(null));
CacheKit.update("ehcache11", "com_gaowj_student_dataAction_listAll", business.list_form_table(null));
//
jsonObject.putAll(Status.getStatusSuccessMessage("保存成功"));
} catch (Exception e) {
......@@ -72,9 +88,9 @@ public class actAction extends BasicAction {
* @param entity
* @throws BusinessException
*/
public String updateStudent() throws BusinessException {
public String updateFormTable() throws BusinessException {
StudentBusiness business = BusinessManager.getBusiness(StudentBusiness.class);
FormtableBusiness business = BusinessManager.getBusiness(FormtableBusiness.class);
Map<String, Object> entity = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
try {
......@@ -82,7 +98,7 @@ public class actAction extends BasicAction {
entity.remove("OPETYPE");
//修改
entity = QueryParamUtil.StringToDate(entity);
business.update_student(entity);
business.update_form_table(entity);
// 操作日志
SystemOpeBusiness sysbusiness = BusinessManager.getBusiness(SystemOpeBusiness.class);
sysbusiness.insert_logBusiness("updateStudent", "" + entity,
......@@ -101,21 +117,20 @@ public class actAction extends BasicAction {
* @param entity
* @throws BusinessException
*/
public String deleteStudent() throws BusinessException {
public String deleteFormTable() throws BusinessException {
StudentBusiness business = BusinessManager.getBusiness(StudentBusiness.class);
FormtableBusiness business = BusinessManager.getBusiness(FormtableBusiness.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);
business.delete_form_table(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("删除失败"));
......
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