Commit d994fb19 authored by daniel's avatar daniel

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

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