Commit d994fb19 authored by daniel's avatar daniel

perf(cmpt): 优化公告+外链

parent 8dd08610
...@@ -35,7 +35,7 @@ public class News implements Serializable { ...@@ -35,7 +35,7 @@ public class News implements Serializable {
private String path; private String path;
private String appId; private String appId;
private String lat; private Double lat;
private String lng; private Double lng;
private int openType; private int openType;
} }
\ No newline at end of file
...@@ -37,5 +37,12 @@ public class Func { ...@@ -37,5 +37,12 @@ public class Func {
private Integer status; private Integer status;
private String style; private String style;
// 打开方式配置(0 默认 1 网页 2 小程序(appId,path) 3 短连接(#小程序://) 4 页面(小程序) 5文档word,pdf 6 图片 png)
private Integer openType;
// 图标
private String icon;
// 小程序路径,图片路径,文档路径,短连接路径,页面路径
private String path;
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dlbridge.jadp.plugins.cmpt.dao.mapper.CmptSettingMapper"> <mapper namespace="com.dlbridge.jadp.plugins.cmpt.dao.mapper.CmptSettingMapper">
<select id="getCmptSettingById" resultType="CmptSetting"> <select id="getCmptSettingById" resultType="com.dlbridge.jadp.plugins.cmpt.dao.model.CmptSetting">
SELECT SELECT
id, id,
cmptid as cmptId, cmptid as cmptId,
...@@ -15,13 +15,15 @@ ...@@ -15,13 +15,15 @@
create_date AS "createDate", create_date AS "createDate",
update_by AS "updateBy", update_by AS "updateBy",
update_date AS "updateDate", update_date AS "updateDate",
del_flag AS "delFlag" del_flag AS "delFlag",
icon,
open_type AS openType
FROM gk_cmptsetting a FROM gk_cmptsetting a
WHERE a.id = #{id} WHERE a.id = #{id}
and a.del_flag = '0' and a.del_flag = '0'
</select> </select>
<select id="queryCmptSettingsByCmptId" resultType="CmptSetting"> <select id="queryCmptSettingsByCmptId" resultType="com.dlbridge.jadp.plugins.cmpt.dao.model.CmptSetting">
SELECT SELECT
id, id,
cmptid as cmptId, cmptid as cmptId,
...@@ -34,7 +36,9 @@ ...@@ -34,7 +36,9 @@
create_date AS "createDate", create_date AS "createDate",
update_by AS "updateBy", update_by AS "updateBy",
update_date AS "updateDate", update_date AS "updateDate",
del_flag AS "delFlag" del_flag AS "delFlag",
icon,
open_type AS openType
FROM `gk_cmptsetting` FROM `gk_cmptsetting`
WHERE cmptid = #{cmptId} order by seq WHERE cmptid = #{cmptId} order by seq
</select> </select>
...@@ -42,7 +46,9 @@ ...@@ -42,7 +46,9 @@
<select id="queryHomePageSettingByCmptId" resultType="java.util.HashMap" parameterType="java.lang.String"> <select id="queryHomePageSettingByCmptId" resultType="java.util.HashMap" parameterType="java.lang.String">
SELECT SELECT
id, id,
type type,
icon,
open_type AS openType
FROM `gk_cmptsetting` FROM `gk_cmptsetting`
WHERE 1 = 1 WHERE 1 = 1
AND visibility = 1 AND visibility = 1
...@@ -63,7 +69,9 @@ ...@@ -63,7 +69,9 @@
style, style,
seq, seq,
create_date, create_date,
del_flag del_flag,
icon,
open_type
) VALUES ( ) VALUES (
#{id}, #{id},
#{cmptId}, #{cmptId},
...@@ -75,7 +83,9 @@ ...@@ -75,7 +83,9 @@
#{style}, #{style},
#{seq}, #{seq},
now(), now(),
0 0,
#{icon},
#{openType}
) )
</insert> </insert>
...@@ -98,7 +108,14 @@ ...@@ -98,7 +108,14 @@
app_id = #{func.appId}, app_id = #{func.appId},
</if> </if>
<if test="func.url != null"> <if test="func.url != null">
url = #{func.url} url = #{func.url},
</if>
<if test="func.openType != null">
open_type = #{func.openType},
</if>
<if test="func.icon != null">
icon = #{func.icon}
</if> </if>
</set> </set>
WHERE id = #{func.id} WHERE id = #{func.id}
...@@ -117,7 +134,9 @@ ...@@ -117,7 +134,9 @@
create_date, create_date,
del_flag, del_flag,
app_id, app_id,
url url,
open_type,
icon
) VALUES ( ) VALUES (
#{func.id}, #{func.id},
#{func.cmptId}, #{func.cmptId},
...@@ -131,7 +150,9 @@ ...@@ -131,7 +150,9 @@
now(), now(),
0, 0,
#{func.appId}, #{func.appId},
#{func.url} #{func.url},
#{func.openType},
#{func.icon}
) )
</insert> </insert>
...@@ -143,7 +164,12 @@ ...@@ -143,7 +164,12 @@
<if test="status != null and status >=0"> <if test="status != null and status >=0">
status = #{status}, status = #{status},
</if> </if>
<if test="icon != null">
icon = #{icon},
</if>
<if test="openType != null">
open_type = #{openType},
</if>
create_by = #{createBy}, create_by = #{createBy},
create_date = #{createDate}, create_date = #{createDate},
update_by = #{updateBy}, update_by = #{updateBy},
...@@ -160,12 +186,18 @@ ...@@ -160,12 +186,18 @@
<if test="setting.status != null and setting.status >=0"> <if test="setting.status != null and setting.status >=0">
status = #{setting.status}, status = #{setting.status},
</if> </if>
<if test="icon != null">
icon = #{icon},
</if>
<if test="openType != null">
open_type = #{openType},
</if>
update_date = now() update_date = now()
WHERE cmptId=#{setting.cmptId} and type = #{setting.type} and del_flag = 0 WHERE cmptId=#{setting.cmptId} and type = #{setting.type} and del_flag = 0
</update> </update>
<select id="queryFuncs" resultType="com.dlbridge.jadp.plugins.cmpt.bean.Func"> <select id="queryFuncs" resultType="com.dlbridge.jadp.plugins.cmpt.bean.Func">
select id,cmptid cmptId,name,type,visibility,seq,app_id appId,url,name_web nameWeb,`status` select id,cmptid cmptId,name,type,visibility,seq,app_id appId,url,name_web nameWeb,`status`,icon,open_type openType
from gk_cmptsetting from gk_cmptsetting
where cmptid = #{cmptId} and visibility=1 and del_flag=0 and status>0 where cmptid = #{cmptId} and visibility=1 and del_flag=0 and status>0
order by seq order by seq
...@@ -173,7 +205,7 @@ ...@@ -173,7 +205,7 @@
</select> </select>
<select id="queryAllFuncs" resultType="com.dlbridge.jadp.plugins.cmpt.bean.Func"> <select id="queryAllFuncs" resultType="com.dlbridge.jadp.plugins.cmpt.bean.Func">
select id,cmptid cmptId,name,type,visibility,seq,app_id appId,url,name_web nameWeb,`status` select id,cmptid cmptId,name,type,visibility,seq,app_id appId,url,name_web nameWeb,`status`,icon,open_type openType
from gk_cmptsetting from gk_cmptsetting
where cmptid = #{cmptId} and visibility=1 and del_flag=0 and status=1 where cmptid = #{cmptId} and visibility=1 and del_flag=0 and status=1
order by seq order by seq
...@@ -208,7 +240,7 @@ ...@@ -208,7 +240,7 @@
</collection> </collection>
</resultMap> </resultMap>
<select id="queryAllCmptSetting" resultMap="cmptSettingMap"> <select id="queryAllCmptSetting" resultMap="cmptSettingMap">
select cmptid,name cmpt_name,type cmpt_type select cmptid,name cmpt_name,type cmpt_type,icon,open_type openType
from gk_cmptsetting from gk_cmptsetting
</select> </select>
...@@ -220,14 +252,14 @@ ...@@ -220,14 +252,14 @@
</select> </select>
<select id="getCmptSettingsByCmptIdAndType" resultType="com.dlbridge.jadp.plugins.cmpt.bean.Func"> <select id="getCmptSettingsByCmptIdAndType" resultType="com.dlbridge.jadp.plugins.cmpt.bean.Func">
select id,cmptid cmptId,name,type,visibility,seq,app_id appId,url,name_web nameWeb select id,cmptid cmptId,name,type,visibility,seq,app_id appId,url,name_web nameWeb,icon,open_type openType
from gk_cmptsetting from gk_cmptsetting
where cmptid = #{cmptId} and type=#{type} where cmptid = #{cmptId} and type=#{type}
limit 1 limit 1
</select> </select>
<select id="queryAllThirdMicros" resultType="com.dlbridge.jadp.plugins.cmpt.bean.Func"> <select id="queryAllThirdMicros" resultType="com.dlbridge.jadp.plugins.cmpt.bean.Func">
select id,cmptid cmptId,name,type,visibility,seq,app_id appId,url,name_web nameWeb select id,cmptid cmptId,name,type,visibility,seq,app_id appId,url,name_web nameWeb,icon,open_type openType
from gk_cmptsetting from gk_cmptsetting
where cmptid = #{cmptId} and type=19 where cmptid = #{cmptId} and type=19
</select> </select>
...@@ -236,7 +268,7 @@ ...@@ -236,7 +268,7 @@
delete from gk_cmptsetting where id = #{id} delete from gk_cmptsetting where id = #{id}
</delete> </delete>
<select id="getFuncById" resultType="com.dlbridge.jadp.plugins.cmpt.bean.Func"> <select id="getFuncById" resultType="com.dlbridge.jadp.plugins.cmpt.bean.Func">
select id,cmptid cmptId,name,type,visibility,seq,app_id appId,url,name_web nameWeb select id,cmptid cmptId,name,type,visibility,seq,app_id appId,url,name_web nameWeb,icon,open_type openType
from gk_cmptsetting from gk_cmptsetting
where id=#{id} where id=#{id}
</select> </select>
......
...@@ -17,6 +17,28 @@ public class CmptSetting extends JaapRecord<CmptSetting> { ...@@ -17,6 +17,28 @@ public class CmptSetting extends JaapRecord<CmptSetting> {
private int status; private int status;
private String updateById; private String updateById;
// 打开方式配置(0 默认 1 网页 2 小程序(appId,path) 3 短连接(#小程序://) 4 页面(小程序) 5文档word,pdf 6 图片 png)
private Integer openType;
// 图标
private String icon;
public Integer getOpenType() {
return openType;
}
public void setOpenType(Integer openType) {
this.openType = openType;
}
public String getIcon() {
return icon;
}
public void setIcon(String icon) {
this.icon = icon;
}
public String getNameWeb() { public String getNameWeb() {
return nameWeb; return nameWeb;
} }
......
...@@ -10,10 +10,7 @@ import com.dlbridge.jadp.plugins.cmpt.service.FuncSettingService; ...@@ -10,10 +10,7 @@ import com.dlbridge.jadp.plugins.cmpt.service.FuncSettingService;
import com.neusoft.www.utils.web.Result; import com.neusoft.www.utils.web.Result;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -66,11 +63,11 @@ public class NewsController { ...@@ -66,11 +63,11 @@ public class NewsController {
} }
} }
@RequestMapping(value = "/save", method = RequestMethod.POST) @PostMapping(value = "/save")
@ResponseBody @ResponseBody
public Result save(News news) { public Result save(@RequestBody News news) {
log.info("保存数据 {}",news.toString());
News newDb = newsService.save(news); News newDb = newsService.save(news);
log.info("保存数据 ",newDb.toString());
return Result.success().setContent(newDb); return Result.success().setContent(newDb);
} }
......
...@@ -434,7 +434,7 @@ ...@@ -434,7 +434,7 @@
<option value="0">文本</option> <option value="0">文本</option>
<option value="1">h5</option> <option value="1">h5</option>
<option value="2">小程序</option> <option value="2">小程序</option>
<option value="3">短连接</option> <option value="3">短链接</option>
<option value="4">内部页面</option> <option value="4">内部页面</option>
<option value="5">文档</option> <option value="5">文档</option>
<option value="6">图片</option> <option value="6">图片</option>
......
...@@ -535,7 +535,7 @@ ...@@ -535,7 +535,7 @@
"id": null, "id": null,
"userId": getUId(), // 用户id "userId": getUId(), // 用户id
"cmptId": getCId(), // 赛事id "cmptId": getCId(), // 赛事id
"type": 4, // 类型配置(1 网页 2 小程序(appId,path) 3 短连接(#小程序://) 4 页面(小程序) 5文档word,pdf 6 图片 png 7 定位) "type": 4, // 类型配置(1 网页 2 小程序(appId,path) 3 短链接(#小程序://) 4 页面(小程序) 5文档word,pdf 6 图片 png 7 定位)
"moduleId": null, // "moduleId": null, //
"title": null, // 标题 "title": null, // 标题
"address": null, // 地址 "address": null, // 地址
...@@ -561,7 +561,7 @@ ...@@ -561,7 +561,7 @@
moduleOptions: {}, moduleOptions: {},
modules: [], modules: [],
// 子类目 类型配置(1 网页 2 小程序(appId,path) 3 短连接(#小程序://) 4 页面(小程序) 5文档word,pdf 6 图片 png) // 子类目 类型配置(1 网页 2 小程序(appId,path) 3 短链接(#小程序://) 4 页面(小程序) 5文档word,pdf 6 图片 png)
typeDesc: { typeDesc: {
1: { 1: {
label: '网页', label: '网页',
...@@ -572,8 +572,8 @@ ...@@ -572,8 +572,8 @@
placeholder: '请输入小程序地址', placeholder: '请输入小程序地址',
}, },
3: { 3: {
label: '短连接', label: '短链接',
placeholder: '请输入短连接地址', placeholder: '请输入短链接地址',
}, },
4: { 4: {
label: '页面', label: '页面',
...@@ -602,7 +602,7 @@ ...@@ -602,7 +602,7 @@
value: 2, value: 2,
}, },
{ {
name: '短连接', name: '短链接',
value: 3, value: 3,
}, },
{ {
......
...@@ -58,22 +58,23 @@ $(document).ready(function () { ...@@ -58,22 +58,23 @@ $(document).ready(function () {
$.ajax({ $.ajax({
url: "/gk/news/save", url: "/gk/news/save",
type: 'post', type: 'post',
data: { contentType: 'application/json',
data: JSON.stringify({
linkUrl, linkUrl,
id: $('.edit-container').attr('data-id'), id: $('.edit-container').attr('data-id'),
title: title, title: title,
appId:appId, appId:appId,
content: editor.getContent(), content: editor.getContent(),
userId: 1, userId: getUId(),
cmptId: getCId(), cmptId: getCId(),
cover: $('#file-cover').attr('data-src'), cover: $('#file-cover').attr('data-src'),
type: $('input[name="type"]:checked').val(), type: $('input[name="type"]:checked').val(),
// 新增的字段 // 新增的字段
openType: openType, openType: openType,
path: path, path: path,
lat: lat, lat: lat??0,
lng: lng lng: lng??0
}, }),
success: function (data) { success: function (data) {
layer.msg('保存成功') layer.msg('保存成功')
window.location.reload(); window.location.reload();
...@@ -273,6 +274,11 @@ function clearInput() { ...@@ -273,6 +274,11 @@ function clearInput() {
$($('input[name="type"]')[0]).attr('checked', "checked") $($('input[name="type"]')[0]).attr('checked', "checked")
$('.cover').css('background-image', '') $('.cover').css('background-image', '')
editor.setContent(''); editor.setContent('');
$('#openType').val(0);
$('#path').val("");
$('#lat').val("");
$('#lng').val("");
$('#appId').val("");
} }
function delNews(id, callback) { function delNews(id, callback) {
......
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