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

小程序分类查询

上级 02423abb
package com.skyeye.authority.dao;
import java.util.List;
import java.util.Map;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
public interface RmTypeDao {
public List<Map<String, Object>> queryRmTypeList(Map<String, Object> map, PageBounds pageBounds) throws Exception;
}
package com.skyeye.authority.service;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
public interface RmTypeService {
public void queryRmTypeList(InputObject inputObject, OutputObject outputObject) throws Exception;
}
package com.skyeye.authority.service.impl;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import com.skyeye.authority.dao.RmTypeDao;
import com.skyeye.authority.service.RmTypeService;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
@Service
public class RmTypeServiceImpl implements RmTypeService{
@Autowired
private RmTypeDao rmTypeDao;
/**
*
* @Title: querySysMenuList
* @Description: 获取小程序分类列表
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public void queryRmTypeList(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
List<Map<String, Object>> beans = rmTypeDao.queryRmTypeList(map,
new PageBounds(Integer.parseInt(map.get("page").toString()), Integer.parseInt(map.get("limit").toString())));
PageList<Map<String, Object>> beansPageList = (PageList<Map<String, Object>>)beans;
int total = beansPageList.getPaginator().getTotalCount();
outputObject.setBeans(beans);
outputObject.settotal(total);
}
}
package com.skyeye.authority.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.authority.service.RmTypeService;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
@Controller
public class RmTypeController {
@Autowired
private RmTypeService rmTypeService;
/**
*
* @Title: querySysMenuList
* @Description: 获取小程序分类列表
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/RmTypeController/queryRmTypeList")
@ResponseBody
public void queryRmTypeList(InputObject inputObject, OutputObject outputObject) throws Exception{
rmTypeService.queryRmTypeList(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.authority.dao.RmTypeDao">
<select id="queryRmTypeList" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
a.id,
a.name rmTypeName,
(SELECT COUNT(*) FROM rm_group b WHERE b.rm_type_id = a.id) groupNum,
CONVERT(a.create_time, char) createTime
FROM
rm_type a
WHERE 1 = 1
<if test="rmTypeName != '' and rmTypeName != null">
AND a.name LIKE '%${rmTypeName}%'
</if>
ORDER BY a.sort DESC, a.create_time DESC
</select>
</mapper>
\ No newline at end of file
...@@ -142,6 +142,13 @@ ...@@ -142,6 +142,13 @@
<url id="database003" path="/post/SysDataBaseController/querySysDataBaseDescSelectList" val="获取数据库表备注信息" allUse="1"> <url id="database003" path="/post/SysDataBaseController/querySysDataBaseDescSelectList" val="获取数据库表备注信息" allUse="1">
</url> </url>
<!-- 小程序系列开始 -->
<url id="rmxcx001" path="/post/RmTypeController/queryRmTypeList" val="获取小程序分类列表" allUse="1">
<property id="limit" name="limit" ref="required" var="分页参数,每页多少条数据" />
<property id="page" name="page" ref="required" var="分页参数,第几页"/>
<property id="rmTypeName" name="rmTypeName" ref="" var="小程序分类名称"/>
</url>
<!-- 小程序系列结束 -->
</controller> </controller>
\ No newline at end of file
var rowId = "";
layui.config({
base: basePath,
version: skyeyeVersion
}).define(['table', 'jquery', 'winui', 'form'], function (exports) {
winui.renderColor();
var $ = layui.$,
form = layui.form,
table = layui.table;
//表格渲染
table.render({
id: 'messageTable',
elem: '#messageTable',
method: 'post',
url: reqBasePath + 'rmxcx001',
where:{rmTypeName:$("#rmTypeName").val()},
even:true, //隔行变色
page: true,
limits: [8, 16, 24, 32, 40, 48, 56],
limit: 8,
cols: [[
{ title: '序号', type: 'numbers'},
{ field: 'rmTypeName', title: '分类名称', width: 120 },
{ field: 'groupNum', title: '组件数量', width: 520 },
{ field: 'createTime', title: '创建时间', width: 180 },
{ title: '操作', fixed: 'right', align: 'center', width: 120, toolbar: '#tableBar'}
]]
});
table.on('tool(messageTable)', function (obj) { //注:tool是工具条事件名,test是table原始容器的属性 lay-filter="对应的值"
var data = obj.data; //获得当前行数据
var layEvent = obj.event; //获得 lay-event 对应的值
if (layEvent === 'del') { //删除
del(data, obj);
}else if (layEvent === 'edit') { //编辑
edit(data);
}
});
//搜索表单
form.render();
form.on('submit(formSearch)', function (data) {
//表单验证
if (winui.verifyForm(data.elem)) {
loadTable();
}
return false;
});
//删除
function del(data, obj){
var msg = obj ? '确认删除分类【' + obj.data.rmTypeName + '】吗?' : '确认删除选中数据吗?';
layer.confirm(msg, { icon: 3, title: '删除分类' }, function (index) {
layer.close(index);
//向服务端发送删除指令
AjaxPostUtil.request({url:reqBasePath + "sys018", params:{rowId: data.id}, type:'json', callback:function(json){
if(json.returnCode == 0){
top.winui.window.msg("删除成功", {icon: 1,time: 2000});
loadTable();
}else{
top.winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
});
}
//编辑分类
function edit(data){
rowId = data.id;
_openNewWindows({
url: "../../tpl/syseverole/syseveroleedit.html",
title: "编辑分类",
pageId: "syseveroleedit",
callBack: function(refreshCode){
if (refreshCode == '0') {
top.winui.window.msg("操作成功", {icon: 1,time: 2000});
loadTable();
} else if (refreshCode == '-9999') {
top.winui.window.msg("操作失败", {icon: 2,time: 2000});
}
}});
}
//刷新数据
$("body").on("click", "#reloadTable", function(){
loadTable();
});
//新增分类
$("body").on("click", "#addBean", function(){
_openNewWindows({
url: "../../tpl/syseverole/syseveroleadd.html",
title: "新增分类",
pageId: "syseveroleadd",
callBack: function(refreshCode){
if (refreshCode == '0') {
top.winui.window.msg("操作成功", {icon: 1,time: 2000});
loadTable();
} else if (refreshCode == '-9999') {
top.winui.window.msg("操作失败", {icon: 2,time: 2000});
}
}});
});
function loadTable(){
table.reload("messageTable", {where:{rmTypeName:$("#rmTypeName").val()}});
}
exports('syseverolelist', {});
});
<!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 class="txtcenter" style="width:700px;margin:0 auto;padding-top:20px;">
<form class="layui-form layui-form-pane" action="" autocomplete="off">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">分类名称</label>
<div class="layui-input-inline">
<input type="text" id="rmTypeName" name="rmTypeName" placeholder="请输入分类名称" class="layui-input" />
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block" style="margin:0;">
<button class="layui-btn" lay-submit lay-filter="formSearch">搜索</button>
</div>
</div>
</form>
</div>
<div class="winui-toolbar">
<div class="winui-tool">
<button id="reloadTable" class="winui-toolbtn"><i class="fa fa-refresh" aria-hidden="true"></i>刷新数据</button>
<button id="addBean" class="winui-toolbtn"><i class="fa fa-plus" aria-hidden="true"></i>新增分类</button>
</div>
</div>
<div style="margin:auto 10px;">
<table id="messageTable" lay-filter="messageTable"></table>
<script type="text/html" id="tableBar">
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
{{# if(d.groupNum == 0){ }}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
{{# } }}
</script>
</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/rmtype/'}).use('rmtypelist');
</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.
先完成此消息的编辑!
想要评论请 注册