提交 27099a8d 编写于 作者: doc_wei's avatar doc_wei

添加动态表单数据展示模板规范说明

上级 fcee746c
......@@ -90,6 +90,7 @@ public class Constants {
public static final String REDIS_CODEMODEL_EXPLAIN_EXEXPLAINTOCODEMODEL = "exexplaintocodemodel";//代码生成器模板规范说明key
public static final String REDIS_CODEMODEL_EXPLAIN_EXEXPLAINTODSFORMCONTENT = "exexplaintodsformcontent";//动态表单内容项模板规范说明key
public static final String REDIS_CODEMODEL_EXPLAIN_EXEXPLAINTORMPROPERTY = "exexplaintormproperty";//小程序标签属性模板规范说明key
public static final String REDIS_CODEMODEL_EXPLAIN_EXEXPLAINTODSFORMDISPLAYTEMPLATE = "exexplaintodsformdisplaytemplate";//动态表单数据展示模板规范说明key
/**
* 微信小程序页面id的序列号
......
package com.skyeye.exexplain.dao;
import java.util.Map;
public interface ExExplainToDsFormDisplayTemplateDao {
public int insertExExplainToDsFormDisplayTemplateMation(Map<String, Object> map) throws Exception;
public Map<String, Object> queryExExplainToDsFormDisplayTemplateMation(Map<String, Object> map) throws Exception;
public int editExExplainToDsFormDisplayTemplateMationById(Map<String, Object> map) throws Exception;
}
package com.skyeye.exexplain.service;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
public interface ExExplainToDsFormDisplayTemplateService {
public void insertExExplainToDsFormDisplayTemplateMation(InputObject inputObject, OutputObject outputObject) throws Exception;
public void queryExExplainToDsFormDisplayTemplateMation(InputObject inputObject, OutputObject outputObject) throws Exception;
public void editExExplainToDsFormDisplayTemplateMationById(InputObject inputObject, OutputObject outputObject) throws Exception;
public void queryExExplainToDsFormDisplayTemplateMationToShow(InputObject inputObject, OutputObject outputObject) throws Exception;
}
package com.skyeye.exexplain.service.impl;
import java.util.HashMap;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.skyeye.exexplain.dao.ExExplainToDsFormDisplayTemplateDao;
import com.skyeye.exexplain.service.ExExplainToDsFormDisplayTemplateService;
import com.skyeye.jedis.JedisClient;
import net.sf.json.JSONObject;
import com.alibaba.fastjson.JSON;
import com.skyeye.common.constans.Constants;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
import com.skyeye.common.util.ToolUtil;
@Service
public class ExExplainToDsFormDisplayTemplateServiceImpl implements ExExplainToDsFormDisplayTemplateService{
@Autowired
private ExExplainToDsFormDisplayTemplateDao exExplainToDsFormDisplayTemplateDao;
@Autowired
public JedisClient jedisClient;
/**
*
* @Title: insertExExplainToDsFormDisplayTemplateMation
* @Description: 添加动态表单数据展示模板说明信息
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public void insertExExplainToDsFormDisplayTemplateMation(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
Map<String, Object> bean = exExplainToDsFormDisplayTemplateDao.queryExExplainToDsFormDisplayTemplateMation(map);
if(bean == null){
Map<String, Object> user = inputObject.getLogParams();
String id = ToolUtil.getSurFaceId();
map.put("id", id);
map.put("createId", user.get("id"));
map.put("createTime", ToolUtil.getTimeAndToString());
exExplainToDsFormDisplayTemplateDao.insertExExplainToDsFormDisplayTemplateMation(map);
jedisClient.del(Constants.REDIS_CODEMODEL_EXPLAIN_EXEXPLAINTODSFORMDISPLAYTEMPLATE);
bean = new HashMap<>();
bean.put("id", id);
outputObject.setBean(bean);
}else{
outputObject.setreturnMessage("该动态表单数据展示模板说明已存在,不可进行二次保存");
}
}
/**
*
* @Title: queryExExplainToDsFormDisplayTemplateMation
* @Description: 编辑动态表单数据展示模板说明信息时进行回显
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public void queryExExplainToDsFormDisplayTemplateMation(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
Map<String, Object> bean = exExplainToDsFormDisplayTemplateDao.queryExExplainToDsFormDisplayTemplateMation(map);
outputObject.setBean(bean);
outputObject.settotal(1);
}
/**
*
* @Title: editExExplainToDsFormDisplayTemplateMationById
* @Description: 编辑动态表单数据展示模板说明信息
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public void editExExplainToDsFormDisplayTemplateMationById(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
Map<String, Object> bean = exExplainToDsFormDisplayTemplateDao.queryExExplainToDsFormDisplayTemplateMation(map);
if(bean == null){
outputObject.setreturnMessage("该动态表单数据展示模板说明不存在,不可进行编辑");
}else{
jedisClient.del(Constants.REDIS_CODEMODEL_EXPLAIN_EXEXPLAINTODSFORMDISPLAYTEMPLATE);
exExplainToDsFormDisplayTemplateDao.editExExplainToDsFormDisplayTemplateMationById(map);
}
}
/**
*
* @Title: queryExExplainToDsFormDisplayTemplateMationToShow
* @Description: 获取动态表单数据展示模板说明信息供展示
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@SuppressWarnings("unchecked")
@Override
public void queryExExplainToDsFormDisplayTemplateMationToShow(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
if(jedisClient.exists(Constants.REDIS_CODEMODEL_EXPLAIN_EXEXPLAINTODSFORMDISPLAYTEMPLATE)){
map = JSONObject.fromObject(jedisClient.get(Constants.REDIS_CODEMODEL_EXPLAIN_EXEXPLAINTODSFORMDISPLAYTEMPLATE));
}else{
Map<String, Object> bean = exExplainToDsFormDisplayTemplateDao.queryExExplainToDsFormDisplayTemplateMation(map);
if(bean == null){
map.put("title", "标题");
map.put("DisplayTemplate", "等待发布说明。");
}else{
jedisClient.set(Constants.REDIS_CODEMODEL_EXPLAIN_EXEXPLAINTODSFORMDISPLAYTEMPLATE, JSON.toJSONString(bean));
map = bean;
}
}
outputObject.setBean(map);
}
}
package com.skyeye.exexplain.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.skyeye.exexplain.service.ExExplainToDsFormDisplayTemplateService;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
@Controller
public class ExExplainToDsFormDisplayTemplateController {
@Autowired
private ExExplainToDsFormDisplayTemplateService exExplainToDsFormDisplayTemplateService;
/**
*
* @Title: insertExExplainToDsFormDisplayTemplateMation
* @Description: 添加动态表单数据展示模板说明信息
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/ExExplainToDsFormDisplayTemplateController/insertExExplainToDsFormDisplayTemplateMation")
@ResponseBody
public void insertExExplainToDsFormDisplayTemplateMation(InputObject inputObject, OutputObject outputObject) throws Exception{
exExplainToDsFormDisplayTemplateService.insertExExplainToDsFormDisplayTemplateMation(inputObject, outputObject);
}
/**
*
* @Title: queryExExplainToDsFormDisplayTemplateMation
* @Description: 编辑动态表单数据展示模板说明信息时进行回显
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/ExExplainToDsFormDisplayTemplateController/queryExExplainToDsFormDisplayTemplateMation")
@ResponseBody
public void queryExExplainToDsFormDisplayTemplateMation(InputObject inputObject, OutputObject outputObject) throws Exception{
exExplainToDsFormDisplayTemplateService.queryExExplainToDsFormDisplayTemplateMation(inputObject, outputObject);
}
/**
*
* @Title: editExExplainToDsFormDisplayTemplateMationById
* @Description: 编辑动态表单数据展示模板说明信息
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/ExExplainToDsFormDisplayTemplateController/editExExplainToDsFormDisplayTemplateMationById")
@ResponseBody
public void editExExplainToDsFormDisplayTemplateMationById(InputObject inputObject, OutputObject outputObject) throws Exception{
exExplainToDsFormDisplayTemplateService.editExExplainToDsFormDisplayTemplateMationById(inputObject, outputObject);
}
/**
*
* @Title: queryExExplainToDsFormDisplayTemplateMationToShow
* @Description: 获取动态表单数据展示模板说明信息供展示
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/ExExplainToDsFormDisplayTemplateController/queryExExplainToDsFormDisplayTemplateMationToShow")
@ResponseBody
public void queryExExplainToDsFormDisplayTemplateMationToShow(InputObject inputObject, OutputObject outputObject) throws Exception{
exExplainToDsFormDisplayTemplateService.queryExExplainToDsFormDisplayTemplateMationToShow(inputObject, outputObject);
}
}
<?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.skyeye.exexplain.dao.ExExplainToDsFormDisplayTemplateDao">
<select id="queryExExplainToDsFormDisplayTemplateMation" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
a.id,
a.title,
a.content
FROM
ex_explain_to_ds_form_display_template a
LIMIT 1
</select>
<insert id="insertExExplainToDsFormDisplayTemplateMation" parameterType="java.util.Map">
INSERT into ex_explain_to_ds_form_display_template
(id, title, content, create_id, create_time)
VALUES
(#{id}, #{title}, #{content}, #{createId}, #{createTime})
</insert>
<update id="editExExplainToDsFormDisplayTemplateMationById" parameterType="java.util.Map">
UPDATE ex_explain_to_ds_form_display_template
<set>
<if test="title != '' and title != null">
title = #{title},
</if>
<if test="content != '' and content != null">
content = #{content},
</if>
</set>
WHERE id = #{id}
</update>
</mapper>
\ No newline at end of file
......@@ -573,6 +573,19 @@
</url>
<url id="exexplaintormproperty004" path="/post/ExExplainToRmPropertyController/queryExExplainToRmPropertyMationToShow" val="获取标签属性说明信息供展示" allUse="1">
</url>
<url id="exexplaintodsformdisplaytemplate001" path="/post/ExExplainToDsFormDisplayTemplateController/insertExExplainToDsFormDisplayTemplateMation" val="添加动态表单数据展示模板说明信息" allUse="1">
<property id="title" name="title" ref="required" var="动态表单数据展示模板说明标题"/>
<property id="content" name="content" ref="required" var="动态表单数据展示模板说明内容"/>
</url>
<url id="exexplaintodsformdisplaytemplate002" path="/post/ExExplainToDsFormDisplayTemplateController/queryExExplainToDsFormDisplayTemplateMation" val="编辑动态表单数据展示模板说明信息时进行回显" allUse="1">
</url>
<url id="exexplaintodsformdisplaytemplate003" path="/post/ExExplainToDsFormDisplayTemplateController/editExExplainToDsFormDisplayTemplateMationById" val="编辑动态表单数据展示模板说明信息" allUse="1">
<property id="title" name="title" ref="required" var="动态表单数据展示模板说明标题"/>
<property id="content" name="content" ref="required" var="动态表单数据展示模板说明内容"/>
<property id="rowId" name="id" ref="required" var="动态表单数据展示模板说明id"/>
</url>
<url id="exexplaintodsformdisplaytemplate004" path="/post/ExExplainToDsFormDisplayTemplateController/queryExExplainToDsFormDisplayTemplateMationToShow" val="获取动态表单数据展示模板说明信息供展示" allUse="1">
</url>
<!-- 系统各部分说明结束 -->
</controller>
\ No newline at end of file
var rowId = "";
layui.config({
base: basePath,
version: skyeyeVersion
}).define(['table', 'jquery', 'winui'], function (exports) {
winui.renderColor();
layui.use(['form', 'layedit'], function (form) {
var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
var $ = layui.$,
form = layui.form,
layedit = layui.layedit;
var layContent;
AjaxPostUtil.request({url:reqBasePath + "exexplaintodsformdisplaytemplate002", params:{}, type:'json', callback:function(json){
if(json.returnCode == 0){
if(!isNull(json.bean)){
rowId = json.bean.id;
$("#title").val(json.bean.title);
$("#content").val(json.bean.content);
}
layContent = layedit.build('content', {
tool: [
'strong' //加粗
,'italic' //斜体
,'underline' //下划线
,'del' //删除线
,'|' //分割线
,'left' //左对齐
,'center' //居中对齐
,'right' //右对齐
,'link' //超链接
,'unlink' //清除链接
,'face' //表情
]
});
}else{
top.winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
form.render();
form.on('submit(formAddBean)', function (data) {
//表单验证
if (winui.verifyForm(data.elem)) {
if(isNull(layedit.getContent(layContent))){
top.winui.window.msg('请输入内容。', {icon: 2,time: 2000});
}else{
var params = {
title: $("#title").val(),
content: encodeURI(layedit.getContent(layContent)),
};
if(isNull(rowId)){
AjaxPostUtil.request({url:reqBasePath + "exexplaintodsformdisplaytemplate001", params:params, type:'json', callback:function(json){
if(json.returnCode == 0){
rowId = json.bean.id;
top.winui.window.msg('保存成功', {icon: 1,time: 2000});
}else{
top.winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
}else{
params.rowId = rowId;
AjaxPostUtil.request({url:reqBasePath + "exexplaintodsformdisplaytemplate003", params:params, type:'json', callback:function(json){
if(json.returnCode == 0){
top.winui.window.msg('保存成功', {icon: 1,time: 2000});
}else{
top.winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
}
}
}
return false;
});
});
});
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<link href="../../assets/lib/layui/css/layui.css" rel="stylesheet" />
<link href="../../assets/lib/font-awesome-4.7.0/css/font-awesome.css" rel="stylesheet" />
<link href="../../assets/lib/winui/css/winui.css" rel="stylesheet" />
</head>
<body>
<div style="width:600px;margin:0 auto;padding-top:20px;">
<form class="layui-form" action="" id="showForm" autocomplete="off">
<div class="layui-form-item">
<label class="layui-form-label">标题<i class="red">*</i></label>
<div class="layui-input-block">
<input type="text" id="title" name="title" win-verify="required" placeholder="请输入标题" class="layui-input" maxlength="50"/>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">内容</label>
<div class="layui-input-block">
<textarea id="content" name="content" style="display: none;"></textarea>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="winui-btn" lay-submit lay-filter="formAddBean">保存</button>
</div>
</div>
</form>
</div>
<script src="../../assets/lib/layui/layui.js"></script>
<script src="../../assets/lib/layui/custom.js"></script>
<script type="text/javascript">
layui.config({base: '../../js/exexplain/'}).use('exexplaintodsformdisplaytemplate');
</script>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册