提交 1dcf6532 编写于 作者: doc_wei's avatar doc_wei

代码生成器说明信息完成

上级 bd99079b
...@@ -84,5 +84,10 @@ public class Constants { ...@@ -84,5 +84,10 @@ public class Constants {
*/ */
public static final String PROJECT_WEB = "\\skyeye\\skyeye-web"; public static final String PROJECT_WEB = "\\skyeye\\skyeye-web";
/**
* 保存模板说明的redis的key
*/
public static final String REDIS_CODEMODEL_EXPLAIN_EXEXPLAINTOCODEMODEL = "exexplaintocodemodel";
} }
package com.skyeye.exexplain.dao;
import java.util.Map;
public interface ExExplainToCodeModelDao {
public int insertExExplainToCodeModelMation(Map<String, Object> map) throws Exception;
public Map<String, Object> queryExExplainToCodeModelMation(Map<String, Object> map) throws Exception;
public int editExExplainToCodeModelMationById(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 ExExplainToCodeModelService {
public void insertExExplainToCodeModelMation(InputObject inputObject, OutputObject outputObject) throws Exception;
public void queryExExplainToCodeModelMation(InputObject inputObject, OutputObject outputObject) throws Exception;
public void editExExplainToCodeModelMationById(InputObject inputObject, OutputObject outputObject) throws Exception;
public void queryExExplainToCodeModelMationToShow(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.ExExplainToCodeModelDao;
import com.skyeye.exexplain.service.ExExplainToCodeModelService;
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 ExExplainToCodeModelServiceImpl implements ExExplainToCodeModelService{
@Autowired
private ExExplainToCodeModelDao exExplainToCodeModelDao;
@Autowired
public JedisClient jedisClient;
/**
*
* @Title: insertExExplainToCodeModelMation
* @Description: 添加代码生成器说明信息
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public void insertExExplainToCodeModelMation(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
Map<String, Object> bean = exExplainToCodeModelDao.queryExExplainToCodeModelMation(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());
exExplainToCodeModelDao.insertExExplainToCodeModelMation(map);
jedisClient.del(Constants.REDIS_CODEMODEL_EXPLAIN_EXEXPLAINTOCODEMODEL);
bean = new HashMap<>();
bean.put("id", id);
outputObject.setBean(bean);
}else{
outputObject.setreturnMessage("该代码生成器说明已存在,不可进行二次保存");
}
}
/**
*
* @Title: queryExExplainToCodeModelMation
* @Description: 编辑代码生成器说明信息时进行回显
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public void queryExExplainToCodeModelMation(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
Map<String, Object> bean = exExplainToCodeModelDao.queryExExplainToCodeModelMation(map);
outputObject.setBean(bean);
outputObject.settotal(1);
}
/**
*
* @Title: editExExplainToCodeModelMationById
* @Description: 编辑代码生成器说明信息
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public void editExExplainToCodeModelMationById(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
Map<String, Object> bean = exExplainToCodeModelDao.queryExExplainToCodeModelMation(map);
if(bean == null){
outputObject.setreturnMessage("该代码生成器说明不存在,不可进行编辑");
}else{
jedisClient.del(Constants.REDIS_CODEMODEL_EXPLAIN_EXEXPLAINTOCODEMODEL);
exExplainToCodeModelDao.editExExplainToCodeModelMationById(map);
}
}
/**
*
* @Title: queryExExplainToCodeModelMationToShow
* @Description: 获取代码生成器说明信息供展示
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@SuppressWarnings("unchecked")
@Override
public void queryExExplainToCodeModelMationToShow(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
if(jedisClient.exists(Constants.REDIS_CODEMODEL_EXPLAIN_EXEXPLAINTOCODEMODEL)){
map = JSONObject.fromObject(jedisClient.get(Constants.REDIS_CODEMODEL_EXPLAIN_EXEXPLAINTOCODEMODEL));
}else{
Map<String, Object> bean = exExplainToCodeModelDao.queryExExplainToCodeModelMation(map);
if(bean == null){
map.put("title", "标题");
map.put("content", "等待发布说明。");
}else{
jedisClient.set(Constants.REDIS_CODEMODEL_EXPLAIN_EXEXPLAINTOCODEMODEL, 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.ExExplainToCodeModelService;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
@Controller
public class ExExplainToCodeModelController {
@Autowired
private ExExplainToCodeModelService exExplainToCodeModelService;
/**
*
* @Title: insertExExplainToCodeModelMation
* @Description: 添加代码生成器说明信息
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/ExExplainToCodeModelController/insertExExplainToCodeModelMation")
@ResponseBody
public void insertExExplainToCodeModelMation(InputObject inputObject, OutputObject outputObject) throws Exception{
exExplainToCodeModelService.insertExExplainToCodeModelMation(inputObject, outputObject);
}
/**
*
* @Title: queryExExplainToCodeModelMation
* @Description: 编辑代码生成器说明信息时进行回显
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/ExExplainToCodeModelController/queryExExplainToCodeModelMation")
@ResponseBody
public void queryExExplainToCodeModelMation(InputObject inputObject, OutputObject outputObject) throws Exception{
exExplainToCodeModelService.queryExExplainToCodeModelMation(inputObject, outputObject);
}
/**
*
* @Title: editExExplainToCodeModelMationById
* @Description: 编辑代码生成器说明信息
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/ExExplainToCodeModelController/editExExplainToCodeModelMationById")
@ResponseBody
public void editExExplainToCodeModelMationById(InputObject inputObject, OutputObject outputObject) throws Exception{
exExplainToCodeModelService.editExExplainToCodeModelMationById(inputObject, outputObject);
}
/**
*
* @Title: queryExExplainToCodeModelMationToShow
* @Description: 获取代码生成器说明信息供展示
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/ExExplainToCodeModelController/queryExExplainToCodeModelMationToShow")
@ResponseBody
public void queryExExplainToCodeModelMationToShow(InputObject inputObject, OutputObject outputObject) throws Exception{
exExplainToCodeModelService.queryExExplainToCodeModelMationToShow(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.ExExplainToCodeModelDao">
<select id="queryExExplainToCodeModelMation" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
a.id,
a.title,
a.content
FROM
ex_explain_to_code_model a
LIMIT 1
</select>
<insert id="insertExExplainToCodeModelMation" parameterType="java.util.Map">
INSERT into ex_explain_to_code_model
(id, title, content, create_id, create_time)
VALUES
(#{id}, #{title}, #{content}, #{createId}, #{createTime})
</insert>
<update id="editExExplainToCodeModelMationById" parameterType="java.util.Map">
UPDATE ex_explain_to_code_model
<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
...@@ -383,4 +383,20 @@ ...@@ -383,4 +383,20 @@
</url> </url>
<!-- 动态表单系列结束 --> <!-- 动态表单系列结束 -->
<!-- 系统各部分说明开始 -->
<url id="exexplaintocodemodel001" path="/post/ExExplainToCodeModelController/insertExExplainToCodeModelMation" val="添加代码生成器说明信息" allUse="1">
<property id="title" name="title" ref="required" var="代码生成器说明标题"/>
<property id="content" name="content" ref="required" var="代码生成器说明内容"/>
</url>
<url id="exexplaintocodemodel002" path="/post/ExExplainToCodeModelController/queryExExplainToCodeModelMation" val="编辑代码生成器说明信息时进行回显" allUse="1">
</url>
<url id="exexplaintocodemodel003" path="/post/ExExplainToCodeModelController/editExExplainToCodeModelMationById" val="编辑代码生成器说明信息" allUse="1">
<property id="rowId" name="id" ref="required" var="代码生成器说明id"/>
<property id="title" name="title" ref="required" var="代码生成器说明标题"/>
<property id="content" name="content" ref="required" var="代码生成器说明内容"/>
</url>
<url id="exexplaintocodemodel004" path="/post/ExExplainToCodeModelController/queryExExplainToCodeModelMationToShow" val="获取代码生成器说明信息供展示" allUse="1">
</url>
<!-- 系统各部分说明结束 -->
</controller> </controller>
\ No newline at end of file
...@@ -9,17 +9,23 @@ layui.config({ ...@@ -9,17 +9,23 @@ layui.config({
var index = parent.layer.getFrameIndex(window.name); //获取窗口索引 var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
var $ = layui.$, var $ = layui.$,
form = layui.form; form = layui.form;
layer.open({ AjaxPostUtil.request({url:reqBasePath + "exexplaintocodemodel002", params:{}, type:'json', callback:function(json){
type: 1, if(json.returnCode == 0){
closeBtn: 0,//关闭按钮 layer.open({
resize: false,//是否允许拉伸 type: 1,
offset: 'l', // 具体配置参考:offset参数项 closeBtn: 0,//关闭按钮
content: $("#modelContentDiv").html(), resize: false,//是否允许拉伸
area: ['200px', '400px'], offset: 'l', // 具体配置参考:offset参数项
shade: 0, //不显示遮罩 content: json.bean.content,
title: '注意事项' area: ['200px', '400px'],
}); shade: 0, //不显示遮罩
title: json.bean.title
});
}else{
top.winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
var editor = CodeMirror.fromTextArea(document.getElementById("modelContent"), { var editor = CodeMirror.fromTextArea(document.getElementById("modelContent"), {
mode : "text/x-java", // 模式 mode : "text/x-java", // 模式
......
...@@ -11,16 +11,22 @@ layui.config({ ...@@ -11,16 +11,22 @@ layui.config({
form = layui.form; form = layui.form;
var editor; var editor;
layer.open({ AjaxPostUtil.request({url:reqBasePath + "exexplaintocodemodel002", params:{}, type:'json', callback:function(json){
type: 1, if(json.returnCode == 0){
closeBtn: 0,//关闭按钮 layer.open({
resize: false,//是否允许拉伸 type: 1,
offset: 'l', // 具体配置参考:offset参数项 closeBtn: 0,//关闭按钮
content: $("#modelContentDiv").html(), resize: false,//是否允许拉伸
area: ['200px', '400px'], offset: 'l', // 具体配置参考:offset参数项
shade: 0, //不显示遮罩 content: json.bean.content,
title: '注意事项' area: ['200px', '400px'],
}); shade: 0, //不显示遮罩
title: json.bean.title
});
}else{
top.winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
showGrid({ showGrid({
id: "showForm", id: "showForm",
......
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 + "exexplaintocodemodel002", 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 + "exexplaintocodemodel001", 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 + "exexplaintocodemodel003", 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
...@@ -76,18 +76,6 @@ ...@@ -76,18 +76,6 @@
</form> </form>
</div> </div>
<div id="modelContentDiv" style="height:auto; position: fixed; left: 10000px;">
模板使用替换事项:<br>
1.${{controllerPackage}}为Controller包名替换<br>
2.${{servicePackage}}为Service包名替换<br>
3.${{serviceImplPackage}}为ServiceImpl包名替换<br>
4.${{daoPackage}}为Dao包名替换<br>
5.${{tableName}}为Controller、Service等层的类名,类方法。<br>
6.${{objectName}}为对象名<br>
7.${{notesName}}为注释对象名<br>
8.${{urlName}}为请求链接对象名<br>
</div>
<script src="../../assets/lib/layui/layui.js"></script> <script src="../../assets/lib/layui/layui.js"></script>
<script src="../../assets/lib/layui/custom.js"></script> <script src="../../assets/lib/layui/custom.js"></script>
<script type="text/javascript"> <script type="text/javascript">
......
...@@ -17,17 +17,6 @@ ...@@ -17,17 +17,6 @@
</form> </form>
</div> </div>
<div id="modelContentDiv" style="height:auto; position: fixed; left: 10000px;">
模板使用替换事项:<br>
1.${{controllerPackage}}为Controller包名替换<br>
2.${{servicePackage}}为Service包名替换<br>
3.${{serviceImplPackage}}为ServiceImpl包名替换<br>
4.${{daoPackage}}为Dao包名替换<br>
5.${{tableName}}为Controller、Service等层的类名,类方法。<br>
6.${{objectName}}为对象名<br>
7.${{notesName}}为注释对象名<br>
8.${{urlName}}为请求链接对象名<br>
</div>
<script src="../../assets/lib/layui/layui.js"></script> <script src="../../assets/lib/layui/layui.js"></script>
<script src="../../assets/lib/layui/custom.js"></script> <script src="../../assets/lib/layui/custom.js"></script>
<script type="text/javascript"> <script type="text/javascript">
......
<!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" />
<link href="../../assets/lib/layui/lay/modules/ztree/css/zTreeStyle/zTreeStyle.css" rel="stylesheet" />
<link href="../../assets/lib/layui/lay/modules/contextMenu/jquery.contextMenu.min.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('exexplaintocodemodel');
</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.
先完成此消息的编辑!
想要评论请 注册