From 23e5ef15a2d6ff732cc7fe0bf0fff4ef96b51ed8 Mon Sep 17 00:00:00 2001 From: tamguo Date: Sun, 22 Jul 2018 00:06:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/sys/dao/SysCompanyMapper.java | 8 ++ .../modules/sys/model/SysCompanyEntity.java | 97 +++++++++++++++++++ .../sys/service/ISysCompanyService.java | 12 +++ .../service/impl/SysCompanyServiceImpl.java | 28 ++++++ .../modules/sys/web/CompanyController.java | 25 +++++ .../resources/mappers/SysCompanyMapper.xml | 5 + .../templates/modules/sys/user/index.html | 6 +- 7 files changed, 178 insertions(+), 3 deletions(-) create mode 100644 tamguo-oms/src/main/java/com/tamguo/modules/sys/dao/SysCompanyMapper.java create mode 100644 tamguo-oms/src/main/java/com/tamguo/modules/sys/model/SysCompanyEntity.java create mode 100644 tamguo-oms/src/main/java/com/tamguo/modules/sys/service/ISysCompanyService.java create mode 100644 tamguo-oms/src/main/java/com/tamguo/modules/sys/service/impl/SysCompanyServiceImpl.java create mode 100644 tamguo-oms/src/main/java/com/tamguo/modules/sys/web/CompanyController.java create mode 100644 tamguo-oms/src/main/resources/mappers/SysCompanyMapper.xml diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/dao/SysCompanyMapper.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/dao/SysCompanyMapper.java new file mode 100644 index 0000000..f5a9aa5 --- /dev/null +++ b/tamguo-oms/src/main/java/com/tamguo/modules/sys/dao/SysCompanyMapper.java @@ -0,0 +1,8 @@ +package com.tamguo.modules.sys.dao; + +import com.tamguo.config.dao.SuperMapper; +import com.tamguo.modules.sys.model.SysCompanyEntity; + +public interface SysCompanyMapper extends SuperMapper{ + +} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/SysCompanyEntity.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/SysCompanyEntity.java new file mode 100644 index 0000000..9ee19be --- /dev/null +++ b/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/SysCompanyEntity.java @@ -0,0 +1,97 @@ +package com.tamguo.modules.sys.model; + +import java.io.Serializable; +import com.baomidou.mybatisplus.annotations.TableName; +import com.tamguo.config.dao.SuperEntity; + +/** + * The persistent class for the sys_company database table. + * + */ +@TableName(value="sys_company") +public class SysCompanyEntity extends SuperEntity implements Serializable { + private static final long serialVersionUID = 1L; + + private String name; + private String fullName; + private String type; + private String dutyMan; + private String tel; + private String address; + private String zipCode; + private String email; + private String comments; + private String parentId; + private String treeId; + + 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 getType() { + return type; + } + public void setType(String type) { + this.type = type; + } + public String getDutyMan() { + return dutyMan; + } + public void setDutyMan(String dutyMan) { + this.dutyMan = dutyMan; + } + 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 getComments() { + return comments; + } + public void setComments(String comments) { + this.comments = comments; + } + public static long getSerialversionuid() { + return serialVersionUID; + } + public String getParentId() { + return parentId; + } + public void setParentId(String parentId) { + this.parentId = parentId; + } + public String getTreeId() { + return treeId; + } + public void setTreeId(String treeId) { + this.treeId = treeId; + } + +} \ No newline at end of file diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/ISysCompanyService.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/ISysCompanyService.java new file mode 100644 index 0000000..dbf4e4d --- /dev/null +++ b/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/ISysCompanyService.java @@ -0,0 +1,12 @@ +package com.tamguo.modules.sys.service; + +import java.util.List; + +import com.tamguo.modules.sys.model.SysCompanyEntity; + +public interface ISysCompanyService { + + /** 公司属性结构*/ + List treeData(); + +} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/impl/SysCompanyServiceImpl.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/impl/SysCompanyServiceImpl.java new file mode 100644 index 0000000..a328479 --- /dev/null +++ b/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/impl/SysCompanyServiceImpl.java @@ -0,0 +1,28 @@ +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.baomidou.mybatisplus.mapper.Condition; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.tamguo.modules.sys.dao.SysCompanyMapper; +import com.tamguo.modules.sys.model.SysCompanyEntity; +import com.tamguo.modules.sys.service.ISysCompanyService; + +@Service +public class SysCompanyServiceImpl extends ServiceImpl implements ISysCompanyService { + + @Autowired + private SysCompanyMapper sysCompanyMapper; + + @SuppressWarnings("unchecked") + @Override + public List treeData() { + + List companyList = sysCompanyMapper.selectList(Condition.EMPTY); + return companyList; + } + +} diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/CompanyController.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/CompanyController.java new file mode 100644 index 0000000..0ebf00e --- /dev/null +++ b/tamguo-oms/src/main/java/com/tamguo/modules/sys/web/CompanyController.java @@ -0,0 +1,25 @@ +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 com.tamguo.modules.sys.model.SysCompanyEntity; +import com.tamguo.modules.sys.service.ISysCompanyService; + +@Controller +@RequestMapping(path="sys/company") +public class CompanyController { + + @Autowired + ISysCompanyService iSysCompanyService; + + @RequestMapping(path="treeData") + @ResponseBody + public List treeData() { + return iSysCompanyService.treeData(); + } +} diff --git a/tamguo-oms/src/main/resources/mappers/SysCompanyMapper.xml b/tamguo-oms/src/main/resources/mappers/SysCompanyMapper.xml new file mode 100644 index 0000000..62c9e1b --- /dev/null +++ b/tamguo-oms/src/main/resources/mappers/SysCompanyMapper.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/tamguo-oms/src/main/resources/templates/modules/sys/user/index.html b/tamguo-oms/src/main/resources/templates/modules/sys/user/index.html index a7b2810..f982796 100644 --- a/tamguo-oms/src/main/resources/templates/modules/sys/user/index.html +++ b/tamguo-oms/src/main/resources/templates/modules/sys/user/index.html @@ -27,7 +27,7 @@ content="width=device-width, initial-scale=1, user-scalable=1" name="viewport"/> 组织机构
- + @@ -65,7 +65,7 @@ $('body').layout({ // 主页框架 var win = $("#mainFrame")[0].contentWindow; // 树结构初始化加载 -var setting = {view:{selectedMulti:false},data:{key:{title:"title"},simpleData:{enable:true}}, +var setting = {view:{selectedMulti:false},data:{key:{title:"title"},simpleData: {enable: true,idKey: "uid",pIdKey: "parentId",rootPId: "",enable:true},key: {url:"nourl"}}, callback:{onClick:function(event, treeId, treeNode){ tree.expandNode(treeNode); win.$('input[type=reset]').click(); @@ -74,7 +74,7 @@ var setting = {view:{selectedMulti:false},data:{key:{title:"title"},simpleData:{ win.page(); }} }, tree, loadTree = function(){ - js.ajaxSubmit("/js/a/sys/office/treeData?___t=" + new Date().getTime(), {ctrlPermi:'2'/*1拥有的权限 2管理的权限*/}, function(data){ + js.ajaxSubmit("http://localhost/sys/company/treeData?___t=" + new Date().getTime(), {ctrlPermi:'2'/*1拥有的权限 2管理的权限*/}, function(data){ tree = $.fn.zTree.init($("#tree"), setting, data);//.expandAll(true); // 展开第一级节点 var nodes = tree.getNodesByParam("level", 0);