parent
da0a1ffd82
commit
9cee1e6d8d
@ -0,0 +1,13 @@
|
||||
package com.tamguo.modules.sys.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.tamguo.config.dao.SuperMapper;
|
||||
import com.tamguo.modules.sys.model.SysOfficeEntity;
|
||||
import com.tamguo.modules.sys.model.condition.SysOfficeCondition;
|
||||
|
||||
public interface SysOfficeMapper extends SuperMapper<SysOfficeEntity>{
|
||||
|
||||
List<SysOfficeEntity> listData(SysOfficeCondition condition);
|
||||
|
||||
}
|
@ -0,0 +1,111 @@
|
||||
package com.tamguo.modules.sys.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.baomidou.mybatisplus.annotations.TableName;
|
||||
import com.tamguo.config.dao.SuperEntity;
|
||||
import com.tamguo.modules.sys.model.enums.SysOfficeStatusEnum;
|
||||
import com.tamguo.modules.sys.model.enums.SysOfficeTypeEnum;
|
||||
|
||||
@TableName(value="sys_office")
|
||||
public class SysOfficeEntity extends SuperEntity<SysOfficeEntity> implements Serializable{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String parentId;
|
||||
private String name;
|
||||
private String fullName;
|
||||
private String officeCode;
|
||||
private Integer sorts;
|
||||
private SysOfficeTypeEnum sysOfficeTypeEnum;
|
||||
private String leader;
|
||||
private String tel;
|
||||
private String address;
|
||||
private String zipCode;
|
||||
private String email;
|
||||
private String remarks;
|
||||
private SysOfficeStatusEnum sysOfficeStatusEnum;
|
||||
|
||||
public String getParentId() {
|
||||
return parentId;
|
||||
}
|
||||
public void setParentId(String parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public String getFullName() {
|
||||
return fullName;
|
||||
}
|
||||
public void setFullName(String fullName) {
|
||||
this.fullName = fullName;
|
||||
}
|
||||
public String getOfficeCode() {
|
||||
return officeCode;
|
||||
}
|
||||
public void setOfficeCode(String officeCode) {
|
||||
this.officeCode = officeCode;
|
||||
}
|
||||
public Integer getSorts() {
|
||||
return sorts;
|
||||
}
|
||||
public void setSorts(Integer sorts) {
|
||||
this.sorts = sorts;
|
||||
}
|
||||
public SysOfficeTypeEnum getSysOfficeTypeEnum() {
|
||||
return sysOfficeTypeEnum;
|
||||
}
|
||||
public void setSysOfficeTypeEnum(SysOfficeTypeEnum sysOfficeTypeEnum) {
|
||||
this.sysOfficeTypeEnum = sysOfficeTypeEnum;
|
||||
}
|
||||
public String getLeader() {
|
||||
return leader;
|
||||
}
|
||||
public void setLeader(String leader) {
|
||||
this.leader = leader;
|
||||
}
|
||||
public String getTel() {
|
||||
return tel;
|
||||
}
|
||||
public void setTel(String tel) {
|
||||
this.tel = tel;
|
||||
}
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
public String getZipCode() {
|
||||
return zipCode;
|
||||
}
|
||||
public void setZipCode(String zipCode) {
|
||||
this.zipCode = zipCode;
|
||||
}
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
public String getRemarks() {
|
||||
return remarks;
|
||||
}
|
||||
public void setRemarks(String remarks) {
|
||||
this.remarks = remarks;
|
||||
}
|
||||
public SysOfficeStatusEnum getSysOfficeStatusEnum() {
|
||||
return sysOfficeStatusEnum;
|
||||
}
|
||||
public void setSysOfficeStatusEnum(SysOfficeStatusEnum sysOfficeStatusEnum) {
|
||||
this.sysOfficeStatusEnum = sysOfficeStatusEnum;
|
||||
}
|
||||
public static long getSerialversionuid() {
|
||||
return serialVersionUID;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.tamguo.modules.sys.model.condition;
|
||||
|
||||
public class SysOfficeCondition {
|
||||
|
||||
private String parentCode;
|
||||
|
||||
public String getParentCode() {
|
||||
return parentCode;
|
||||
}
|
||||
|
||||
public void setParentCode(String parentCode) {
|
||||
this.parentCode = parentCode;
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package com.tamguo.modules.sys.model.enums;
|
||||
|
||||
import java.io.Serializable;
|
||||
import com.baomidou.mybatisplus.enums.IEnum;
|
||||
|
||||
/**
|
||||
* 用户状态
|
||||
*/
|
||||
public enum SysCompanyStatusEnum implements IEnum {
|
||||
NORMAL("normal", "正常"),
|
||||
DELETE("delete", "删除"),
|
||||
DISABLED("disabled" , "停用");
|
||||
|
||||
private String value;
|
||||
private String desc;
|
||||
|
||||
SysCompanyStatusEnum(final String value, final String desc) {
|
||||
this.value = value;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public Serializable getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public String getDesc(){
|
||||
return this.desc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.value;
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package com.tamguo.modules.sys.model.enums;
|
||||
|
||||
import java.io.Serializable;
|
||||
import com.baomidou.mybatisplus.enums.IEnum;
|
||||
|
||||
/**
|
||||
* 用户状态
|
||||
*/
|
||||
public enum SysOfficeStatusEnum implements IEnum {
|
||||
NORMAL("normal", "正常"),
|
||||
DELETE("delete", "删除"),
|
||||
DISABLED("disabled" , "停用");
|
||||
|
||||
private String value;
|
||||
private String desc;
|
||||
|
||||
SysOfficeStatusEnum(final String value, final String desc) {
|
||||
this.value = value;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public Serializable getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public String getDesc(){
|
||||
return this.desc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.value;
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package com.tamguo.modules.sys.model.enums;
|
||||
|
||||
import java.io.Serializable;
|
||||
import com.baomidou.mybatisplus.enums.IEnum;
|
||||
|
||||
/**
|
||||
* 用户状态
|
||||
*/
|
||||
public enum SysOfficeTypeEnum implements IEnum {
|
||||
PROVINCE("province", "省级公司"),
|
||||
CITY("city", "市级公司"),
|
||||
DEPARTMENT("department" , "部门");
|
||||
|
||||
private String value;
|
||||
private String desc;
|
||||
|
||||
SysOfficeTypeEnum(final String value, final String desc) {
|
||||
this.value = value;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public Serializable getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public String getDesc(){
|
||||
return this.desc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.value;
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package com.tamguo.modules.sys.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.tamguo.modules.sys.model.SysOfficeEntity;
|
||||
import com.tamguo.modules.sys.model.condition.SysOfficeCondition;
|
||||
|
||||
public interface ISysOfficeService {
|
||||
|
||||
List<SysOfficeEntity> listData(SysOfficeCondition condition);
|
||||
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.tamguo.modules.sys.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.tamguo.modules.sys.dao.SysOfficeMapper;
|
||||
import com.tamguo.modules.sys.model.SysOfficeEntity;
|
||||
import com.tamguo.modules.sys.model.condition.SysOfficeCondition;
|
||||
import com.tamguo.modules.sys.service.ISysOfficeService;
|
||||
|
||||
@Service
|
||||
public class SysOfficeServiceImpl implements ISysOfficeService {
|
||||
|
||||
@Autowired
|
||||
private SysOfficeMapper sysOfficeMapper;
|
||||
|
||||
@Override
|
||||
public List<SysOfficeEntity> listData(SysOfficeCondition condition) {
|
||||
return sysOfficeMapper.listData(condition);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package com.tamguo.modules.sys.web;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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 org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.tamguo.modules.sys.model.SysOfficeEntity;
|
||||
import com.tamguo.modules.sys.model.condition.SysOfficeCondition;
|
||||
import com.tamguo.modules.sys.service.ISysOfficeService;
|
||||
|
||||
/**
|
||||
* Controller - 组织
|
||||
*
|
||||
* @author tamguo
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(path="sys/office")
|
||||
public class OfficeController {
|
||||
|
||||
private final String OFFICE_INDEX_PAGE = "modules/sys/office/index";
|
||||
|
||||
@Autowired
|
||||
private ISysOfficeService iSysOfficeService;
|
||||
|
||||
@RequestMapping(path="index")
|
||||
public String index(ModelAndView model) {
|
||||
return OFFICE_INDEX_PAGE;
|
||||
}
|
||||
|
||||
@RequestMapping(path="listData")
|
||||
@ResponseBody
|
||||
public List<SysOfficeEntity> listData(SysOfficeCondition condition) {
|
||||
return iSysOfficeService.listData(condition);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
<?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.tamguo.modules.sys.dao.SysOfficeMapper">
|
||||
|
||||
<select id="listData" resultType="SysCompanyEntity">
|
||||
SELECT
|
||||
o.id,
|
||||
o.parent_id,
|
||||
o.name,
|
||||
o.full_name,
|
||||
o.office_code,
|
||||
o.sorts,
|
||||
o.office_type,
|
||||
o.leader,
|
||||
o.tel,
|
||||
o.address,
|
||||
o.zip_code,
|
||||
o.email,
|
||||
o.remarks,
|
||||
o.`status`,
|
||||
o.is_leaf,
|
||||
o.tree_level
|
||||
FROM
|
||||
sys_office o
|
||||
<where>
|
||||
1 = 1
|
||||
<choose>
|
||||
<when test="parentCode != null and parentCode != ''">
|
||||
and o.parent_id = #{parentCode}
|
||||
</when>
|
||||
<otherwise>
|
||||
and o.tree_level = 0
|
||||
</otherwise>
|
||||
</choose>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,130 @@
|
||||
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<meta charset="utf-8"><meta content="webkit" name="renderer"/>
|
||||
<meta http-equiv="X-UA-Compatible"
|
||||
content="IE=edge"><meta name="keywords" content="PoweredByJeeSiteV4.0"/><meta http-equiv="Cache-Control"
|
||||
content="no-cache, no-store, must-revalidate"/><meta name="description" content="PoweredByJeeSiteV4.0"/><meta
|
||||
content="no-cache" http-equiv="Pragma"/><meta http-equiv="Expires" content="0"/><meta
|
||||
content="width=device-width, initial-scale=1, user-scalable=1" name="viewport"/>
|
||||
<title>机构管理 - JeeSite Demo</title>
|
||||
<script th:src="${setting.domain + 'global.min.js?ctx=/js/a'}"></script>
|
||||
<script th:src="${setting.domain + 'jquery/jquery-1.12.4.min.js'}"></script>
|
||||
<script th:src="${setting.domain + 'jquery/jquery-migrate-1.4.1.min.js'}"></script>
|
||||
<!--[if lt IE 9]><script src="/js/static/common/h5fix.min.js"></script><![endif]-->
|
||||
<link rel="stylesheet" th:href="${setting.domain + 'fonts/font-icons.min.css'}">
|
||||
<link rel="stylesheet" th:href="${setting.domain + 'bootstrap/css/bootstrap.min.css'}">
|
||||
<link rel="stylesheet" th:href="${setting.domain + 'select2/4.0/select2.css'}">
|
||||
<link rel="stylesheet" th:href="${setting.domain + 'icheck/1.0/minimal/grey.css'}">
|
||||
<link rel="stylesheet" th:href="${setting.domain + 'jqGrid/4.7/css/ui.jqgrid.css'}">
|
||||
<link rel="stylesheet" th:href="${setting.domain + 'adminlte/css/AdminLTE.min.css'}">
|
||||
<link rel="stylesheet" th:href="${setting.domain + 'common/jeesite.css'}">
|
||||
<link rel="stylesheet" th:href="${setting.domain + 'common/common.css'}">
|
||||
</head><body class="hold-transition ">
|
||||
<div class="wrapper"><div class="main-content">
|
||||
<div class="box box-main">
|
||||
<div class="box-header">
|
||||
<div class="box-title">
|
||||
<i class="fa icon-grid"></i> 机构管理
|
||||
</div>
|
||||
<div class="box-tools pull-right">
|
||||
<a href="#" class="btn btn-default" id="btnSearch" title="查询"><i class="fa fa-filter"></i> 查询</a>
|
||||
<a href="#" class="btn btn-default" id="btnRefreshTree" title="刷新"><i class="fa fa-refresh"></i> 刷新</a>
|
||||
<a href="#" class="btn btn-default" id="btnExpandTreeNode" title="展开一级"><i class="fa fa-angle-double-down"></i> 展开</a>
|
||||
<a href="#" class="btn btn-default" id="btnCollapseTreeNode" title="折叠全部"><i class="fa fa-angle-double-up"></i> 折叠</a>
|
||||
<a href="/js/a/sys/office/form" class="btn btn-default btnTool" title="新增机构"><i class="fa fa-plus"></i> 新增</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<form id="searchForm" th:action="${setting.domain + 'sys/office/listData'}" method="post" class="form-inline hide" data-page-no="" data-page-size="" data-order-by="">
|
||||
<div class="form-group">
|
||||
<label class="control-label">机构代码:</label>
|
||||
<div class="control-inline">
|
||||
<input type="text" id="viewCode" name="viewCode" value="" maxlength="100" class="form-control width-120"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">机构名称:</label>
|
||||
<div class="control-inline">
|
||||
<input type="text" id="officeName" name="officeName" value="" maxlength="100" class="form-control width-120"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">机构全称:</label>
|
||||
<div class="control-inline">
|
||||
<input type="text" id="fullName" name="fullName" value="" maxlength="200" class="form-control width-120"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">机构类型:</label>
|
||||
<div class="control-inline width-90">
|
||||
|
||||
<select id="officeType" name="officeType" class="form-control">
|
||||
<option value=""> </option><option value="1">省级公司</option><option value="2">市级公司</option><option value="3">部门</option></select> </div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">状态:</label>
|
||||
<div class="control-inline width-60">
|
||||
|
||||
<select id="status" name="status" class="form-control">
|
||||
<option value=""> </option><option value="0">正常</option><option value="2">停用</option></select> </div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary btn-sm">查询</button>
|
||||
<button type="reset" class="btn btn-default btn-sm">重置</button>
|
||||
</div>
|
||||
</form>
|
||||
<table id="dataGrid"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a id="scroll-up" href="#" class="btn btn-sm"><i class="fa fa-angle-double-up"></i></a>
|
||||
<script th:src="${setting.domain + 'bootstrap/js/bootstrap.min.js'}"></script>
|
||||
<script th:src="${setting.domain + 'select2/4.0/select2.js'}"></script>
|
||||
<script th:src="${setting.domain + 'select2/4.0/i18n/zh_CN.js'}"></script>
|
||||
<script th:src="${setting.domain + 'layer/3.1/layer.js'}"></script>
|
||||
<script th:src="${setting.domain + 'my97/WdatePicker.js'}"></script>
|
||||
<script th:src="${setting.domain + 'jqGrid/4.7/js/jquery.jqGrid.js'}"></script>
|
||||
<script th:src="${setting.domain + 'jqGrid/4.7/js/jquery.jqGrid.extend.js'}"></script>
|
||||
<script th:src="${setting.domain + 'jqGrid/4.7/js/i18n/zh_CN.js'}"></script>
|
||||
<script th:src="${setting.domain + 'common/jeesite.js'}"></script>
|
||||
<script th:src="${setting.domain + 'common/i18n/jeesite_zh_CN.js'}"></script>
|
||||
<script th:src="${setting.domain + 'common/common.js'}"></script>
|
||||
<script>
|
||||
// 初始化DataGrid对象
|
||||
$('#dataGrid').dataGrid({
|
||||
searchForm: $("#searchForm"),
|
||||
columnModel: [
|
||||
{header:'机构名称', name:'name', index:'a.office_name', width:250, align:"left", frozen:true, formatter: function(val, obj, row, act){
|
||||
return '( '+row.id+' ) '+'<a href="/js/a/sys/office/form?officeCode='+row.id+'" class="btnList" data-title="编辑机构">'+(val||row.id)+'</a>';
|
||||
}},
|
||||
{header:'机构全称', name:'fullName', index:'a.full_name', width:200, align:"left"},
|
||||
{header:'机构类型', name:'type', index:'a.office_type', width:100, align:"center", formatter: function(val, obj, row, act){
|
||||
return "股份公司";
|
||||
}},
|
||||
{header:'更新时间', name:'updateDate', index:'a.update_date', width:150, align:"center"},
|
||||
{header:'备注信息', name:'remarks', index:'a.remarks', width:200, align:"left"},
|
||||
{header:'操作', name:'actions', width:150, sortable:false, title:false, formatter: function(val, obj, row, act){
|
||||
var actions = [];
|
||||
actions.push('<a href="/js/a/sys/office/form?officeCode='+row.officeCode+'" class="btnList" title="编辑机构"><i class="fa fa-pencil"></i></a> ');
|
||||
if (row.status == Global.STATUS_NORMAL){
|
||||
actions.push('<a href="/js/a/sys/office/disable?officeCode='+row.officeCode+'" class="btnList" title="停用机构" data-confirm="确认要停用该机构吗?"><i class="glyphicon glyphicon-ban-circle"></i></a> ');
|
||||
}
|
||||
if (row.status == Global.STATUS_DISABLE){
|
||||
actions.push('<a href="/js/a/sys/office/enable?officeCode='+row.officeCode+'" class="btnList" title="启用机构" data-confirm="确认要启用该机构吗?"><i class="glyphicon glyphicon-ok-circle"></i></a> ');
|
||||
}
|
||||
actions.push('<a href="/js/a/sys/office/delete?officeCode='+row.officeCode+'" class="btnList" title="删除机构" data-confirm="确认要删除该机构及所有子机构吗?" data-deltreenode="'+row.id+'"><i class="fa fa-trash-o"></i></a> ');
|
||||
actions.push('<a href="/js/a/sys/office/form?parentCode='+row.id+'" class="btnList" title="新增下级机构"><i class="fa fa-plus-square"></i></a> ');
|
||||
return actions.join('');
|
||||
}}
|
||||
],
|
||||
treeGrid: true, // 启用树结构表格
|
||||
defaultExpandLevel: 0, // 默认展开的层次
|
||||
expandNodeClearPostData: 'viewCode,officeName,fullName,officeType,', // 展开节点清理请求参数数据(一般设置查询条件的字段属性,否则在查询后,不能展开子节点数据) // 加载成功后执行事件
|
||||
ajaxSuccess: function(data){
|
||||
|
||||
}
|
||||
});
|
||||
</script>
|
Loading…
Reference in new issue