提交 8021a2a9 编写于 作者: doc_wei's avatar doc_wei

小程序页面上下移

上级 35b073aa
......@@ -15,4 +15,12 @@ public interface SmProjectPageDao {
public int insertProPageMationByProId(Map<String, Object> map) throws Exception;
public Map<String, Object> querySmProjectPageISTopByThisId(Map<String, Object> map) throws Exception;
public void editSmProjectPageSortTopById(Map<String, Object> map) throws Exception;
public Map<String, Object> querySmProjectPageISLowerByThisId(Map<String, Object> map) throws Exception;
public void editSmProjectPageSortLowerById(Map<String, Object> topBean) throws Exception;
}
......@@ -9,4 +9,8 @@ public interface SmProjectPageService {
public void insertProPageMationByProId(InputObject inputObject, OutputObject outputObject) throws Exception;
public void editSmProjectPageSortTopById(InputObject inputObject, OutputObject outputObject) throws Exception;
public void editSmProjectPageSortLowerById(InputObject inputObject, OutputObject outputObject) throws Exception;
}
......@@ -104,6 +104,54 @@ public class SmProjectPageServiceImpl implements SmProjectPageService{
smProjectPageDao.insertProPageMationByProId(map);
}
/**
*
* @Title: editSmProjectPageSortTopById
* @Description: 小程序页面展示顺序上移
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public void editSmProjectPageSortTopById(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
Map<String, Object> topBean = smProjectPageDao.querySmProjectPageISTopByThisId(map);//根据排序获取这条数据的上一条数据
if(topBean == null){
outputObject.setreturnMessage("已经是最靠前页面,无法移动。");
}else{
map.put("sort", topBean.get("sort"));
topBean.put("sort", topBean.get("thisSort"));
smProjectPageDao.editSmProjectPageSortTopById(map);
smProjectPageDao.editSmProjectPageSortTopById(topBean);
}
}
/**
*
* @Title: editSmProjectPageSortLowerById
* @Description: 小程序页面展示顺序下移
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public void editSmProjectPageSortLowerById(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
Map<String, Object> topBean = smProjectPageDao.querySmProjectPageISLowerByThisId(map);//根据排序获取这条数据的上一条数据
if(topBean == null){
outputObject.setreturnMessage("已经是最靠后页面,无法移动。");
}else{
map.put("sort", topBean.get("sort"));
topBean.put("sort", topBean.get("thisSort"));
smProjectPageDao.editSmProjectPageSortLowerById(map);
smProjectPageDao.editSmProjectPageSortLowerById(topBean);
}
}
}
......@@ -47,5 +47,37 @@ public class SmProjectPageController {
smProjectPageService.insertProPageMationByProId(inputObject, outputObject);
}
/**
*
* @Title: editSmProjectPageSortTopById
* @Description: 小程序页面展示顺序上移
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/SmProjectPageController/editSmProjectPageSortTopById")
@ResponseBody
public void editSmProjectPageSortTopById(InputObject inputObject, OutputObject outputObject) throws Exception{
smProjectPageService.editSmProjectPageSortTopById(inputObject, outputObject);
}
/**
*
* @Title: editSmProjectPageSortLowerById
* @Description: 小程序页面展示顺序下移
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/SmProjectPageController/editSmProjectPageSortLowerById")
@ResponseBody
public void editSmProjectPageSortLowerById(InputObject inputObject, OutputObject outputObject) throws Exception{
smProjectPageService.editSmProjectPageSortLowerById(inputObject, outputObject);
}
}
......@@ -54,4 +54,55 @@
(#{id}, #{name}, #{filePath}, #{fileName}, #{defaultFilePath}, #{defaultFileName}, #{defaultFilePathNum}, #{defaultFileNameNum}, #{proId}, #{sort}, #{createId}, #{createTime})
</insert>
<select id="querySmProjectPageISTopByThisId" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
a.id,
a.sort sort,
b.sort thisSort
FROM
sm_project_page a,
sm_project_page b
WHERE
b.sm_project_id = #{proId}
AND b.id = #{id}
AND a.sort > b.sort
ORDER BY
a.sort ASC
LIMIT 1
</select>
<update id="editSmProjectPageSortTopById" parameterType="java.util.Map">
UPDATE sm_project_page
<set>
sort = #{sort},
</set>
WHERE id = #{id}
</update>
<select id="querySmProjectPageISLowerByThisId" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
a.id,
a.sort sort,
b.sort thisSort
FROM
sm_project_page a,
sm_project_page b
WHERE
b.sm_project_id = #{proId}
AND b.id = #{id}
AND b.sort > a.sort
ORDER BY
a.sort DESC
LIMIT 1
</select>
<update id="editSmProjectPageSortLowerById" parameterType="java.util.Map">
UPDATE sm_project_page
<set>
sort = #{sort},
</set>
WHERE id = #{id}
</update>
</mapper>
\ No newline at end of file
......@@ -299,6 +299,14 @@
<property id="filePath" name="filePath" ref="" var="文件将来的导出路径"/>
<property id="fileName" name="fileName" ref="" var="文件将来的导出名"/>
</url>
<url id="rmxcx031" path="/post/SmProjectPageController/editSmProjectPageSortTopById" val="小程序页面展示顺序上移" allUse="1">
<property id="proId" name="proId" ref="required" var="小程序项目id"/>
<property id="rowId" name="id" ref="required" var="页面id"/>
</url>
<url id="rmxcx032" path="/post/SmProjectPageController/editSmProjectPageSortLowerById" val="小程序页面展示顺序下移" allUse="1">
<property id="proId" name="proId" ref="required" var="小程序项目id"/>
<property id="rowId" name="id" ref="required" var="页面id"/>
</url>
<!-- 小程序系列结束 -->
......
......@@ -196,10 +196,10 @@ dataGrid.prototype = {
}
layui.$("#" + this._id + "").empty().html(myTemplate(json));
this.registermousehover();
this.customClickPage(json);
if(typeof(_op.settings.ajaxSendAfter) == "function") {
_op.settings.ajaxSendAfter(json);
}
this.customClickPage(json);
},
//循环添加行
createBody: function(pn) {
......@@ -233,10 +233,10 @@ dataGrid.prototype = {
}
layui.$("#" + _op.settings.id + "showBody").empty().html(myTemplate(json));
this.registermousehover();
this.customClickPage(json);
if(typeof(_op.settings.ajaxSendAfter) == "function") {
_op.settings.ajaxSendAfter(json);
}
this.customClickPage(json);
},
//初始化分页
createFoot: function() {
......
......@@ -29,10 +29,30 @@ layui.config({
},
'click .toUp':function(index, row){//上移
var params = {
proId: proId,
rowId: row.id,
};
AjaxPostUtil.request({url:reqBasePath + "rmxcx031", params:params, type:'json', callback:function(json){
if(json.returnCode == 0){
refreshGrid("pageList", {params:{rowId: parent.rowId}});
}else{
top.winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
},
'click .toDown':function(index, row){//下移
var params = {
proId: proId,
rowId: row.id,
};
AjaxPostUtil.request({url:reqBasePath + "rmxcx032", params:params, type:'json', callback:function(json){
if(json.returnCode == 0){
refreshGrid("pageList", {params:{rowId: parent.rowId}});
}else{
top.winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
},
'click .copyPage':function(index, row){//复制
......
{{#each rows}}
<li class="page-li">
<div class="weui-flex js_category layui-col-xs6">
<div class="weui-flex layui-col-xs6">
<span class="weui-flex__item">{{name}}</span>
</div>
<div class="weui-flex js_category layui-col-xs6 right">
<div class="weui-flex layui-col-xs6 right">
<button class="layui-btn layui-btn-xs tab-btn-mar-left-3 reName" title="重命名页面"><i class="fa fa-pencil-square-o"></i></button>
<button class="layui-btn layui-btn-xs tab-btn-mar-left-3 toUp" title="上移页面"><i class="fa fa-arrow-up"></i></button>
<button class="layui-btn layui-btn-xs tab-btn-mar-left-3 toDown" title="下移页面"><i class="fa fa-arrow-down"></i></button>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册