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

修改

上级 947b1e59
package com.skyeye.authority.dao;
import java.util.List;
import java.util.Map;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
public interface SysTAreaDao {
public List<Map<String, Object>> querySysTAreaList(Map<String, Object> map, PageBounds pageBounds) throws Exception;
public List<Map<String, Object>> querySysTAreaSecondList(Map<String, Object> bean) throws Exception;
}
package com.skyeye.authority.service;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
public interface SysTAreaService {
public void querySysTAreaList(InputObject inputObject, OutputObject outputObject) throws Exception;
}
package com.skyeye.authority.service.impl;
import java.util.ArrayList;
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.SysTAreaDao;
import com.skyeye.authority.service.SysTAreaService;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
@Service
public class SysTAreaServiceImpl implements SysTAreaService{
@Autowired
private SysTAreaDao sysTAreaDao;
/**
*
* @Title: querySysTAreaList
* @Description: 获取行政区划信息
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public void querySysTAreaList(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
List<Map<String, Object>> beans = sysTAreaDao.querySysTAreaList(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();
List<Map<String, Object>> arrs = new ArrayList<>();
for(Map<String, Object> bean : beans){
List<Map<String, Object>> items = sysTAreaDao.querySysTAreaSecondList(bean);
arrs.addAll(items);
}
beans.addAll(arrs);
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.SysTAreaService;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
@Controller
public class SysTAreaController {
@Autowired
private SysTAreaService sysTAreaService;
/**
*
* @Title: querySysTAreaList
* @Description: 获取行政区划信息
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/SysTAreaController/querySysTAreaList")
@ResponseBody
public void querySysTAreaList(InputObject inputObject, OutputObject outputObject) throws Exception{
sysTAreaService.querySysTAreaList(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.SysTAreaDao">
<select id="querySysTAreaList" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
a.code_id id,
IFNULL(a.parent_code_id, '0') pId,
a.`name`
FROM
t_area a
WHERE a.level = '0'
</select>
<select id="querySysTAreaSecondList" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
a.code_id id,
a.parent_code_id pId,
a.`name`
FROM
t_area a
WHERE a.level = '1'
AND a.parent_code_id = #{id}
</select>
</mapper>
\ No newline at end of file
......@@ -501,6 +501,10 @@
<property id="propertyId" name="propertyId" ref="required" var="所属属性标签"/>
</url>
<url id="systarea001" path="/post/SysTAreaController/querySysTAreaList" val="获取行政区划信息" allUse="1">
<property id="limit" name="limit" ref="required,num" var="分页参数,每页多少条数据" />
<property id="page" name="page" ref="required,num" var="分页参数,第几页"/>
</url>
<!-- 小程序系列结束 -->
<!-- 代码生成器系列开始 -->
......
......@@ -756,11 +756,11 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
}, options.request)
//响应数据的自定义格式
options.response = $.extend({
statusName: 'code'
,statusCode: 0
,msgName: 'msg'
,dataName: 'data'
,countName: 'count'
statusName: 'returnCode'
,statusCode: 0
,msgName: 'returnMessage'
,dataName: 'rows'
,countName: 'total'
}, options.response);
//如果 page 传入 laypage 对象
if(typeof options.page === 'object'){
......@@ -1184,6 +1184,8 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
var params = {};
params[request.pageName] = curr;
params[request.limitName] = options.limit;
options.where.userToken = getCookie('userToken');
options.where.loginPCIp = returnCitySN["cip"];
//行内过滤条件
var list=that.layFilter.find("[name^='filter_']");
layui.each(list,function (i, o) {
......
......@@ -20,6 +20,24 @@ layui.config({
return false;
});
treeGrid.render({
id: 'messageTable',
elem: '#messageTable',
method: 'get',
idField: 'id',
url: reqBasePath + 'systarea001',
cellMinWidth: 100,
treeId: 'id',//树形id字段名称
treeUpId: 'pId',//树形父id字段名称
treeShowName: 'name',//以树形式显示的字段
cols: [[
{field:'name', width:300, title: '区域名称'},
{field:'id', width:100, title: 'id'},
{field:'pId', title: 'pId'},
]],
page:false
});
function loadTable(){
}
......
......@@ -12,9 +12,9 @@
<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>
<label class="layui-form-label">省级名称</label>
<div class="layui-input-inline">
<input type="text" id="roleName" name="roleName" placeholder="请输入角色名称" class="layui-input" />
<input type="text" id="provName" name="provName" placeholder="请输入省级名称" class="layui-input" />
</div>
</div>
</div>
......@@ -25,10 +25,9 @@
</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>
</div>
<div style="margin:auto 10px;">
<table id="messageTable" lay-filter="messageTable"></table>
</div>
<script src="../../assets/lib/layui/layui.js"></script>
<script src="../../assets/lib/layui/custom.js"></script>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册