Browse Source

行政检查预约联动效果漏提交部分

v2
蟑螂恶霸 3 years ago
parent
commit
c04461f8bf
  1. 125
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/code/linkage/add.html
  2. 128
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/code/linkage/edit.html
  3. 49
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/code/linkage/tree.html
  4. 149
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/code/linkage/userCheckOpt.html
  5. 114
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/code/linkage/view.html
  6. 151
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/controller/LinkageDictController.java
  7. 129
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/domain/LinkageDict.java
  8. 74
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/mapper/LinkageDictMapper.java
  9. 81
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/ILinkageDictService.java
  10. 196
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/LinkageDictServiceImpl.java
  11. 117
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/LinkageDictMapper.xml

125
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/code/linkage/add.html

@ -0,0 +1,125 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="zdxtInclude :: header('新增关联')" />
<th:block th:include="zdxtInclude :: select2-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-linkage-add">
<!--<input id="treeId" name="parentId" type="hidden"/>-->
<input id="treeId" name="parentId" type="hidden" th:value="${linkage.id}" />
<div class="form-group">
<label class="col-sm-3 control-label">上级节点:</label>
<div class="col-sm-8">
<div class="input-group">
<!--<input class="form-control" type="text" onclick="selectDeptTree()" id="treeName" readonly="true">-->
<input class="form-control" type="text" onclick="selectItemTree()" id="treeName" readonly="true" th:value="${linkage.title}">
<span class="input-group-addon"><i class="fa fa-search"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">名称:</label>
<div class="col-sm-6">
<input class="form-control" type="text" placeholder="请输入名称" name="title" id="title" required>
</div>
<div class="col-sm-2">
<input class="form-control" type="text" name="srot" placeholder="请输入排序" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">值:</label>
<div class="col-sm-8">
<input class="form-control" type="text" placeholder="请输入值" name="value" id="value" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">状态:</label>
<div class="col-sm-8">
<div class="radio-box" th:each="dict : ${@dict.getType('sys_normal_disable')}">
<input type="radio" th:id="${dict.dictCode}" name="status" th:value="${dict.dictValue}" th:checked="${dict.default}">
<label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
</div>
</form>
</div>
<th:block th:include="zdxtInclude :: footer" />
<th:block th:include="zdxtInclude :: select2-js" />
<script type="text/javascript">
var prefix = ctx + "code/linkage";
$("#form-linkage-add").validate({
onkeyup: false,
rules:{
deptName:{
remote: {
url: prefix + "/checkItemNameUnique",
type: "post",
dataType: "json",
data: {
"parentId": function() {
return $("input[name='parentId']").val();
},
"title" : function() {
return $.common.trim($("#title").val());
}
},
dataFilter: function(data, type) {
return $.validate.unique(data);
}
}
},
orderNum:{
digits:true
},
email:{
email:true,
},
phone:{
isPhone:true,
},
},
messages: {
"deptName": {
remote: "节点已经存在"
}
},
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-linkage-add').serialize());
}
}
/*部门管理-新增-选择父部门树*/
function selectItemTree() {
var options = {
title: '部门选择',
width: "380",
url: prefix + "/selectItemTree/" + $("#treeId").val(),
// url: prefix + "/selectDeptTree/123",
callBack: doSubmit
};
$.modal.openOptions(options);
}
function doSubmit(index, layero){
var body = layer.getChildFrame('body', index);
$("#treeId").val(body.find('#treeId').val());
$("#treeName").val(body.find('#treeName').val());
layer.close(index);
}
$(function() {
$('#deptType').select2({
placeholder: "请选择类型",
allowClear: true
});
})
</script>
</body>
</html>

128
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/code/linkage/edit.html

@ -0,0 +1,128 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改节点')" />
<th:block th:include="include :: select2-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-dept-edit" th:object="${linkage}">
<input name="id" type="hidden" th:field="*{id}" />
<input id="treeId" name="parentId" type="hidden" th:field="*{parentId}" />
<div class="form-group">
<label class="col-sm-3 control-label">上级部门:</label>
<div class="col-sm-8">
<div class="input-group">
<input class="form-control" type="text" id="treeName" onclick="selectItemTree()" readonly="true" th:field="*{parentName}">
<span class="input-group-addon"><i class="fa fa-search"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">节点名称:</label>
<div class="col-sm-6">
<input class="form-control" type="text" name="deptName" th:field="*{title}" id="title" required>
</div>
<div class="col-sm-2">
<input class="form-control" type="text" name="orderNum" th:field="*{orderNum}" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">值:</label>
<div class="col-sm-8">
<input class="form-control" type="text" placeholder="请输入值" name="value" id="value" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">部门状态:</label>
<div class="col-sm-8">
<div class="radio-box" th:each="dict : ${@dict.getType('sys_normal_disable')}">
<input type="radio" th:id="${dict.dictCode}" name="status" th:value="${dict.dictValue}" th:field="*{status}">
<label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: select2-js" />
<script type="text/javascript">
var prefix = ctx + "system/dept";
$("#form-dept-edit").validate({
onkeyup: false,
rules:{
deptName:{
remote: {
url: prefix + "/checkItemNameUnique",
type: "post",
dataType: "json",
data: {
"deptId": function() {
return $("#id").val();
},
"parentId": function() {
return $("input[name='parentId']").val();
},
"deptName": function() {
return $.common.trim($("#title").val());
}
},
dataFilter: function(data, type) {
return $.validate.unique(data);
}
}
},
orderNum:{
digits:true
},
},
messages: {
"deptName": {
remote: "部门已经存在"
}
},
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-dept-edit').serialize());
}
}
/*部门管理-修改-选择部门树*/
function selectItemTree() {
var deptId = $("#treeId").val();
if(deptId > 0) {
var options = {
title: '节点选择',
width: "380",
url: prefix + "/selectItemTree/" + $("#treeId").val(),
callBack: doSubmit
};
$.modal.openOptions(options);
} else {
$.modal.alertError("父节点不能选择");
}
}
function doSubmit(index, layero){
var tree = layero.find("iframe")[0].contentWindow.$._tree;
if ($.tree.notAllowLastLevel(tree)) {
var body = layer.getChildFrame('body', index);
$("#treeId").val(body.find('#treeId').val());
$("#treeName").val(body.find('#treeName').val());
layer.close(index);
}
}
$(function() {
$('#deptType').select2({
placeholder: "请选择类型",
allowClear: true
});
})
</script>
</body>
</html>

49
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/code/linkage/tree.html

@ -0,0 +1,49 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('节点树选择')" />
<th:block th:include="include :: ztree-css" />
</head>
<style>
body{height:auto;font-family: "Microsoft YaHei";}
button{font-family: "SimSun","Helvetica Neue",Helvetica,Arial;}
</style>
<body class="hold-transition box box-main">
<input id="treeId" name="treeId" type="hidden"/>
<input id="treeName" name="treeName" type="hidden"/>
<div class="wrapper"><div class="treeShowHideButton" onclick="$.tree.toggleSearch();">
<label id="btnShow" title="显示搜索" style="display:none;">︾</label>
<label id="btnHide" title="隐藏搜索">︽</label>
</div>
<div class="treeSearchInput" id="search">
<label for="keyword">关键字:</label><input type="text" class="empty" id="keyword" maxlength="50">
<button class="btn" id="btn" onclick="$.tree.searchNode()"> 搜索 </button>
</div>
<div class="treeExpandCollapse">
<a href="#" onclick="$.tree.expand()">展开</a> /
<a href="#" onclick="$.tree.collapse()">折叠</a>
</div>
<div id="tree" class="ztree treeselect"></div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: ztree-js" />
<script th:inline="javascript">
$(function() {
var url = ctx + "code/linkage/treeData";
var options = {
url: url,
expandLevel: 2,
onClick : zOnClick
};
$.tree.init(options);
});
function zOnClick(event, treeId, treeNode) {
var treeId = treeNode.id;
var treeName = treeNode.name;
$("#treeId").val(treeId);
$("#treeName").val(treeName);
}
</script>
</body>
</html>

149
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/code/linkage/userCheckOpt.html

@ -0,0 +1,149 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('用户列表')" />
<th:block th:include="include :: layout-latest-css" />
<th:block th:include="include :: ztree-css" />
</head>
<body class="gray-bg">
<div class="ui-layout-west">
<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">
<button type="button" class="btn btn-box-tool" id="btnExpand" title="展开" style="display:none;"><i class="fa fa-chevron-up"></i></button>
<button type="button" class="btn btn-box-tool" id="btnCollapse" title="折叠"><i class="fa fa-chevron-down"></i></button>
<button type="button" class="btn btn-box-tool" id="btnRefresh" title="刷新部门"><i class="fa fa-refresh"></i></button>
</div>
</div>
<div class="ui-layout-content">
<div id="tree" class="ztree"></div>
</div>
</div>
</div>
<div class="ui-layout-center">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="user-form">
<input type="hidden" id="deptId" name="deptId">
<input type="hidden" id="parentId" name="parentId">
<div class="select-list">
<ul>
<li>用户名称:<input type="text" name="userName"/></li>
<li>登录名称:<input type="text" name="loginName"/></li>
<li>手机号码:<input type="text" name="phonenumber"/></li>
<li>
<a class="btn btn-success btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-reset btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="col-sm-12 select-table table-bordered">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: layout-latest-js" />
<th:block th:include="include :: ztree-js" />
<script th:inline="javascript">
var prefix = ctx + "system/dept";
$(function() {
var panehHidden = false;
if ($(this).width() < 769) {
panehHidden = true;
}
$('body').layout({ initClosed: panehHidden, west__size: 185 });
queryUserList();
queryDeptTree();
});
function queryUserList() {
var options = {
url: prefix + "/queryUserInfoByDept",
sortName: "createTime",
sortOrder: "desc",
modalName: "用户",
columns: [{
field: 'selectItem',
checkbox: true
},
{
field: 'userId',
title: '用户ID'
},
{
field: 'userName',
title: '用户名称'
},
{
field: 'loginName',
title: '登录名称',
sortable: true
},
{
field: 'dept.deptName',
title: '部门'
},
{
field: 'email',
title: '邮箱',
visible: false
},
{
field: 'phonenumber',
title: '手机'
}]
};
$.table.init(options);
}
function queryDeptTree() {
var url = prefix + "/treeDataByNoPermission";
var options = {
url: url,
expandLevel: 2,
onClick : zOnClick
};
$.tree.init(options);
function zOnClick(event, treeId, treeNode) {
$("#deptId").val(treeNode.id);
$("#parentId").val(treeNode.pId);
$.table.search();
// $.bttTable.bootstrapTable('refresh', {objectType:treeNode.id});
}
}
$('#btnExpand').click(function() {
$._tree.expandAll(true);
$(this).hide();
$('#btnCollapse').show();
});
$('#btnCollapse').click(function() {
$._tree.expandAll(false);
$(this).hide();
$('#btnExpand').show();
});
$('#btnRefresh').click(function() {
queryDeptTree();
});
function getSelect() {
return $("#bootstrap-table").bootstrapTable('getSelections');
// return $("#bootstrap-tree-table").bootstrapTreeTable('getSelections');
}
</script>
</body>
</html>

114
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/code/linkage/view.html

@ -0,0 +1,114 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('联动字典')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="dept-form">
<div class="select-list">
<ul>
<li>
名称:<input type="text" name="deptName" placeholder="请输入部门名称"/>
</li>
<li>
状态:<select name="status" th:with="type=${@dict.getType('sys_normal_disable')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<a class="btn btn-success btn-sm" onclick="$.treeTable.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-reset btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add(100,820,508)" shiro:hasPermission="system:dept:add">
<i class="fa fa-plus"></i> 新增
</a>
<a class="btn btn-primary" onclick="$.operate.edit(null,820,508)" shiro:hasPermission="system:dept:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-info" id="expandAllBtn">
<i class="fa fa-exchange"></i> 展开/折叠
</a>
</div>
<div class="col-sm-12 select-table ">
<table id="bootstrap-tree-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var addFlag = [[${@permission.hasPermi('code:linkage:add')}]];
var editFlag = [[${@permission.hasPermi('code:linkage:edit')}]];
var removeFlag = [[${@permission.hasPermi('code:linkage:remove')}]];
var datas = [[${@dict.getType('sys_normal_disable')}]];
var prefix = ctx + "code/linkage"
$(function() {
var options = {
code: "id",
parentCode: "parentId",
uniqueId: "id",
url: prefix + "/list",
createUrl: prefix + "/add/{id}",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove/{id}",
bordered: true,
modalName: "部门",
height:$(window).height()-$(".search-collapse").height()-$("#toolbar").height()-65,
columns: [{
field: 'selectItem',
radio: true
},
{
field: 'title',
title: '名称',
align: "left"
},
{
field: 'orderNum',
title: '排序',
align: "left"
},
{
field: 'status',
title: '状态',
align: "left",
formatter: function(value, item, index) {
return $.table.selectDictLabel(datas, item.status);
}
},
{
field: 'createTime',
title: '创建时间',
align: "left"
},
{
title: '操作',
align: 'left',
formatter: function(value, row, index) {
// if (row.parentId != 0) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.deptId + '\',820,508)"><i class="fa fa-edit"></i> 编辑</a> ');
actions.push('<a class="btn btn-info btn-xs ' + addFlag + '" href="javascript:void(0)" onclick="$.operate.add(\'' + row.deptId + '\',820,508)"><i class="fa fa-plus"></i> 新增</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.deptId + '\')"><i class="fa fa-trash"></i> 删除</a>');
return actions.join('');
// } else {
// return "";
// }
}
}]
};
$.treeTable.init(options);
});
</script>
</body>
</html>

151
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/controller/LinkageDictController.java

@ -0,0 +1,151 @@
package com.zdxt.code.controller;
import java.util.List;
import com.zdxt.code.domain.LinkageDict;
import com.zdxt.code.service.ILinkageDictService;
import com.zdxt.common.ZDResponse;
import com.zdxt.common.Ztree;
import com.zdxt.common.controller.BaseController;
import com.zdxt.common.util.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
/**
* 联动字典Controller
*
* @author ruoyi
* @date 2024-04-12
*/
@Controller
@RequestMapping("/code/linkage")
public class LinkageDictController extends BaseController
{
private String prefix = "project/code/linkage";
@Autowired
private ILinkageDictService linkageDictService;
@RequiresPermissions("code:linkage:view")
@GetMapping()
public String view()
{
return prefix + "/view";
}
/**
* 查询联动字典列表
*/
@RequiresPermissions("code:linkage:view")
@PostMapping("/list")
@ResponseBody
public List<LinkageDict> list(@RequestBody LinkageDict linkageDict)
{
List<LinkageDict> list = linkageDictService.selectLinkageDictList(linkageDict);
return list;
}
/**
* 查询联动字典列表
*/
@RequiresPermissions("code:linkage:view")
@PostMapping("/selectLinkageDictByValueAndParentId")
@ResponseBody
public LinkageDict selectLinkageDictByValueAndParentId(@RequestBody LinkageDict linkageDict)
{
LinkageDict obj = linkageDictService.selectLinkageDictByValueAndParentId(linkageDict.getValue(), linkageDict.getParentId());
return obj;
}
/**
* 新增联动字典
*/
@GetMapping("/add/{parentId}")
public String add(@PathVariable("parentId") String parentId, ModelMap mmap)
{
mmap.put("linkage", linkageDictService.selectLinkageDictById(parentId));
return prefix + "/add";
}
/**
* 新增保存联动字典
*/
@RequiresPermissions("code:linkage:add")
@PostMapping("/add")
@ResponseBody
public ZDResponse addSave(LinkageDict linkageDict)
{
return linkageDictService.insertLinkageDict(linkageDict) > 0 ? ZDResponse.success("操作成功") : ZDResponse.error("操作失败");
}
/**
* 修改联动字典
*/
@GetMapping("/edit/{id}")
public String edit(@PathVariable("id") String id, ModelMap mmap)
{
LinkageDict linkageDict = linkageDictService.selectLinkageDictById(id);
if (StringUtils.isNotNull(linkageDict) && "100".equals(id))
{
linkageDict.setParentName("无");
}
mmap.put("linkage", linkageDict);
return prefix + "/edit";
}
/**
* 修改保存联动字典
*/
@RequiresPermissions("code:linkage:edit")
@PostMapping("/edit")
@ResponseBody
public ZDResponse editSave(LinkageDict linkageDict)
{
return linkageDictService.updateLinkageDict(linkageDict) > 0 ? ZDResponse.success("操作成功") : ZDResponse.error("操作失败");
}
/**
* 删除联动字典
*/
@RequiresPermissions("code:linkage:remove")
@PostMapping( "/remove")
@ResponseBody
public ZDResponse remove(String ids)
{
return linkageDictService.deleteLinkageDictByIds(ids) > 0 ? ZDResponse.success("操作成功") : ZDResponse.error("操作失败");
}
/**
* 校验节点名称
*/
@PostMapping("/checkItemNameUnique")
@ResponseBody
public String checkItemNameUnique(LinkageDict dict)
{
return linkageDictService.checkItemNameUnique(dict);
}
/**
* 选择节点树
*/
@GetMapping("/selectItemTree/{id}")
public String selectDeptTree(@PathVariable("id") String id, ModelMap mmap)
{
mmap.put("linkage", linkageDictService.selectLinkageDictById(id));
return prefix + "/tree";
}
/**
* 加载节点列表树
*/
@GetMapping("/treeData")
@ResponseBody
public List<Ztree> treeData()
{
List<Ztree> ztrees = linkageDictService.selectItemTree(new LinkageDict());
return ztrees;
}
}

129
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/domain/LinkageDict.java

@ -0,0 +1,129 @@
package com.zdxt.code.domain;
import com.zdxt.common.BaseDomain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 联动字典对象 linkage_dict
*
* @author ruoyi
* @date 2024-04-12
*/
public class LinkageDict extends BaseDomain
{
private static final long serialVersionUID = 1L;
/** 主键 */
private String id;
/** 标题 */
private String title;
/** 值 */
private String value;
/** 父节点 */
private String parentId;
/** 父部门名称 */
private String parentName;
/** 描述 */
private String desc;
/** 排序 */
private Long srot;
/** 状态(0:正常,1:停用) */
private Integer status;
public void setId(String id)
{
this.id = id;
}
public String getId()
{
return id;
}
public void setTitle(String title)
{
this.title = title;
}
public String getTitle()
{
return title;
}
public void setValue(String value)
{
this.value = value;
}
public String getValue()
{
return value;
}
public void setParentId(String parentId)
{
this.parentId = parentId;
}
public String getParentId()
{
return parentId;
}
public void setDesc(String desc)
{
this.desc = desc;
}
public String getParentName() {
return parentName;
}
public void setParentName(String parentName) {
this.parentName = parentName;
}
public String getDesc()
{
return desc;
}
public void setSrot(Long srot)
{
this.srot = srot;
}
public Long getSrot()
{
return srot;
}
public void setStatus(Integer status)
{
this.status = status;
}
public Integer getStatus()
{
return status;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("title", getTitle())
.append("value", getValue())
.append("parentId", getParentId())
.append("desc", getDesc())
.append("srot", getSrot())
.append("status", getStatus())
.append("creator", getCreator())
.append("createTime", getCreateTime())
.append("updator", getUpdator())
.append("updateTime", getUpdateTime())
.toString();
}
}

74
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/mapper/LinkageDictMapper.java

@ -0,0 +1,74 @@
package com.zdxt.code.mapper;
import com.zdxt.code.domain.LinkageDict;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 联动字典Mapper接口
*
* @author ruoyi
* @date 2024-04-12
*/
public interface LinkageDictMapper
{
/**
* 查询联动字典
*
* @param id 联动字典ID
* @return 联动字典
*/
public LinkageDict selectLinkageDictById(String id);
public LinkageDict selectLinkageDictByValueAndParentId(@Param("value") String value, @Param("parentId") String parentId);
/**
* 查询联动字典列表
*
* @param linkageDict 联动字典
* @return 联动字典集合
*/
public List<LinkageDict> selectLinkageDictList(LinkageDict linkageDict);
/**
* 新增联动字典
*
* @param linkageDict 联动字典
* @return 结果
*/
public int insertLinkageDict(LinkageDict linkageDict);
/**
* 修改联动字典
*
* @param linkageDict 联动字典
* @return 结果
*/
public int updateLinkageDict(LinkageDict linkageDict);
/**
* 删除联动字典
*
* @param id 联动字典ID
* @return 结果
*/
public int deleteLinkageDictById(String id);
/**
* 批量删除联动字典
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteLinkageDictByIds(String[] ids);
/**
* 校验节点名称是否唯一
*
* @param title 节点名称
* @param parentId 父节点ID
* @return 结果
*/
public LinkageDict checkItemNameUnique(@Param("title") String title, @Param("parentId") String parentId);
public LinkageDict checkItemValueUnique(@Param("value") String value, @Param("parentId") String parentId);
}

81
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/ILinkageDictService.java

@ -0,0 +1,81 @@
package com.zdxt.code.service;
import com.zdxt.code.domain.LinkageDict;
import com.zdxt.common.Ztree;
import java.util.List;
/**
* 联动字典Service接口
*
* @author ruoyi
* @date 2024-04-12
*/
public interface ILinkageDictService
{
/**
* 查询联动字典
*
* @param id 联动字典ID
* @return 联动字典
*/
public LinkageDict selectLinkageDictById(String id);
public LinkageDict selectLinkageDictByValueAndParentId(String value, String parentId);
/**
* 查询联动字典列表
*
* @param linkageDict 联动字典
* @return 联动字典集合
*/
public List<LinkageDict> selectLinkageDictList(LinkageDict linkageDict);
/**
* 新增联动字典
*
* @param linkageDict 联动字典
* @return 结果
*/
public int insertLinkageDict(LinkageDict linkageDict);
/**
* 修改联动字典
*
* @param linkageDict 联动字典
* @return 结果
*/
public int updateLinkageDict(LinkageDict linkageDict);
/**
* 批量删除联动字典
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteLinkageDictByIds(String ids);
/**
* 删除联动字典信息
*
* @param id 联动字典ID
* @return 结果
*/
public int deleteLinkageDictById(String id);
/**
* 校验节点名称是否唯一
*
* @param dict 部门信息
* @return 结果
*/
public String checkItemNameUnique(LinkageDict dict);
public String checkItemValueUnique(LinkageDict dict);
/**
* 查询节点管理树
*
* @param dict 节点信息
* @return 所有节点信息
*/
public List<Ztree> selectItemTree(LinkageDict dict);
}

196
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/LinkageDictServiceImpl.java

@ -0,0 +1,196 @@
package com.zdxt.code.service.impl;
import java.util.ArrayList;
import java.util.List;
import cn.hutool.core.util.IdUtil;
import com.zdxt.auth.dto.UserBean;
import com.zdxt.auth.feign.UserApi;
import com.zdxt.code.domain.LinkageDict;
import com.zdxt.code.mapper.LinkageDictMapper;
import com.zdxt.code.service.ILinkageDictService;
import com.zdxt.common.Ztree;
import com.zdxt.common.annotation.DataScope;
import com.zdxt.common.util.Convert;
import com.zdxt.common.util.DateUtils;
import com.zdxt.common.util.StringUtils;
import com.zdxt.common.util.UserConstants;
import com.zdxt.domain.auth.Dept;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* 联动字典Service业务层处理
*
* @author ruoyi
* @date 2024-04-12
*/
@Service
public class LinkageDictServiceImpl implements ILinkageDictService
{
@Autowired
private LinkageDictMapper linkageDictMapper;
@Autowired
private UserApi userApi;
/**
* 查询联动字典
*
* @param id 联动字典ID
* @return 联动字典
*/
@Override
public LinkageDict selectLinkageDictById(String id)
{
return linkageDictMapper.selectLinkageDictById(id);
}
@Override
public LinkageDict selectLinkageDictByValueAndParentId(String value, String parentId)
{
return linkageDictMapper.selectLinkageDictByValueAndParentId(value, parentId);
}
/**
* 查询联动字典列表
*
* @param linkageDict 联动字典
* @return 联动字典
*/
@Override
public List<LinkageDict> selectLinkageDictList(LinkageDict linkageDict)
{
return linkageDictMapper.selectLinkageDictList(linkageDict);
}
/**
* 新增联动字典
*
* @param linkageDict 联动字典
* @return 结果
*/
@Override
public int insertLinkageDict(LinkageDict linkageDict)
{
UserBean user = userApi.getCurrentUser();
linkageDict.setId(IdUtil.simpleUUID());
linkageDict.setCreateBy(user.getUserName());
linkageDict.setCreateTime(DateUtils.getNowDate());
return linkageDictMapper.insertLinkageDict(linkageDict);
}
/**
* 修改联动字典
*
* @param linkageDict 联动字典
* @return 结果
*/
@Override
public int updateLinkageDict(LinkageDict linkageDict)
{
linkageDict.setUpdateTime(DateUtils.getNowDate());
return linkageDictMapper.updateLinkageDict(linkageDict);
}
/**
* 删除联动字典对象
*
* @param ids 需要删除的数据ID
* @return 结果
*/
@Override
public int deleteLinkageDictByIds(String ids)
{
return linkageDictMapper.deleteLinkageDictByIds(Convert.toStrArray(ids));
}
/**
* 删除联动字典信息
*
* @param id 联动字典ID
* @return 结果
*/
@Override
public int deleteLinkageDictById(String id)
{
return linkageDictMapper.deleteLinkageDictById(id);
}
/**
* 校验节点名称是否唯一
*
* @param dict 部门信息
* @return 结果
*/
@Override
public String checkItemNameUnique(LinkageDict dict)
{
String dictId = StringUtils.isNull(dict.getId()) ? "100" : dict.getId();
LinkageDict info = linkageDictMapper.checkItemNameUnique(dict.getTitle(), dict.getParentId());
if (StringUtils.isNotNull(info) && !info.getId().equals(dictId))
{
return UserConstants.DEPT_NAME_NOT_UNIQUE;
}
return UserConstants.DEPT_NAME_UNIQUE;
}
@Override
public String checkItemValueUnique(LinkageDict dict)
{
String dictId = StringUtils.isNull(dict.getId()) ? "100" : dict.getId();
LinkageDict info = linkageDictMapper.checkItemValueUnique(dict.getValue(), dict.getParentId());
if (StringUtils.isNotNull(info) && !info.getId().equals(dictId))
{
return UserConstants.DEPT_NAME_NOT_UNIQUE;
}
return UserConstants.DEPT_NAME_UNIQUE;
}
/**
* 查询节点管理树
*
* @param dict 节点信息
* @return 所有节点信息
*/
@Override
@DataScope(deptAlias = "d")
public List<Ztree> selectItemTree(LinkageDict dict)
{
List<LinkageDict> dictList = linkageDictMapper.selectLinkageDictList(dict);
List<Ztree> ztrees = initZtree(dictList);
return ztrees;
}
private List<Ztree> initZtree(List<LinkageDict> dictList) {
return initZtree(dictList, null);
}
/**
* 对象转部门树
*
* @param dictList 节点列表
* @param roleDictList 角色已存在菜单列表
* @return 树结构列表
*/
private List<Ztree> initZtree(List<LinkageDict> dictList, List<String> roleDictList)
{
List<Ztree> ztrees = new ArrayList<Ztree>();
boolean isCheck = StringUtils.isNotNull(roleDictList);
for (LinkageDict dict : dictList)
{
if (UserConstants.DEPT_NORMAL.equals(dict.getStatus().toString()))
{
Ztree ztree = new Ztree();
ztree.setId(dict.getId());
ztree.setpId(dict.getParentId());
ztree.setName(dict.getTitle());
ztree.setTitle(dict.getTitle());
if (isCheck)
{
ztree.setChecked(roleDictList.contains(dict.getId() + dict.getTitle()));
}
ztrees.add(ztree);
}
}
return ztrees;
}
}

117
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/LinkageDictMapper.xml

@ -0,0 +1,117 @@
<?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.zdxt.code.mapper.LinkageDictMapper">
<resultMap type="com.zdxt.code.domain.LinkageDict" id="LinkageDictResult">
<result property="id" column="id" />
<result property="title" column="title" />
<result property="value" column="value" />
<result property="parentId" column="parent_id" />
<result property="desc" column="desc" />
<result property="srot" column="srot" />
<result property="status" column="status" />
<result property="creator" column="creator" />
<result property="createTime" column="create_time" />
<result property="updator" column="updator" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectLinkageDictVo">
select id, title, `value`, parent_id, `desc`, srot, `status`, creator, create_time, updator, update_time from linkage_dict
</sql>
<select id="selectLinkageDictList" parameterType="LinkageDict" resultMap="LinkageDictResult">
<include refid="selectLinkageDictVo"/>
<where>
<if test="title != null and title != ''"> and title = #{title}</if>
<if test="value != null and value != ''"> and `value` = #{value}</if>
<if test="parentId != null and parentId != ''"> and parent_id = #{parentId}</if>
<if test="desc != null and desc != ''"> and desc = #{desc}</if>
<if test="srot != null "> and srot = #{srot}</if>
<if test="status != null "> and status = #{status}</if>
<if test="creator != null and creator != ''"> and creator = #{creator}</if>
<if test="updator != null and updator != ''"> and updator = #{updator}</if>
</where>
</select>
<select id="selectLinkageDictById" parameterType="String" resultMap="LinkageDictResult">
<include refid="selectLinkageDictVo"/>
where id = #{id}
</select>
<select id="selectLinkageDictByValueAndParentId" parameterType="String" resultMap="LinkageDictResult">
<include refid="selectLinkageDictVo"/>
where `value` = #{value} and parent_id = #{parentId}
</select>
<insert id="insertLinkageDict" parameterType="LinkageDict">
insert into linkage_dict
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null and id != ''">id,</if>
<if test="title != null and title != ''">title,</if>
<if test="value != null and value != ''">`value`,</if>
<if test="parentId != null and parentId != ''">parent_id,</if>
<if test="desc != null and desc != ''">`desc`,</if>
<if test="srot != null ">srot,</if>
<if test="status != null ">`status`,</if>
<if test="creator != null and creator != ''">creator,</if>
<if test="createTime != null ">create_time,</if>
<if test="updator != null and updator != ''">updator,</if>
<if test="updateTime != null ">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null and id != ''">#{id},</if>
<if test="title != null and title != ''">#{title},</if>
<if test="value != null and value != ''">#{value},</if>
<if test="parentId != null and parentId != ''">#{parentId},</if>
<if test="desc != null and desc != ''">#{desc},</if>
<if test="srot != null ">#{srot},</if>
<if test="status != null ">#{status},</if>
<if test="creator != null and creator != ''">#{creator},</if>
<if test="createTime != null ">#{createTime},</if>
<if test="updator != null and updator != ''">#{updator},</if>
<if test="updateTime != null ">#{updateTime},</if>
</trim>
</insert>
<update id="updateLinkageDict" parameterType="LinkageDict">
update linkage_dict
<trim prefix="SET" suffixOverrides=",">
<if test="title != null and title != ''">title = #{title},</if>
<if test="value != null and value != ''">`value` = #{value},</if>
<if test="parentId != null and parentId != ''">parent_id = #{parentId},</if>
<if test="desc != null and desc != ''">`desc` = #{desc},</if>
<if test="srot != null ">srot = #{srot},</if>
<if test="status != null ">`status` = #{status},</if>
<if test="creator != null and creator != ''">creator = #{creator},</if>
<if test="createTime != null ">create_time = #{createTime},</if>
<if test="updator != null and updator != ''">updator = #{updator},</if>
<if test="updateTime != null ">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteLinkageDictById" parameterType="String">
delete from linkage_dict where id = #{id}
</delete>
<delete id="deleteLinkageDictByIds" parameterType="String">
delete from linkage_dict where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="checkItemNameUnique" resultMap="LinkageDictResult">
<include refid="selectLinkageDictVo"/>
where title=#{title} and parent_id = #{parentId}
</select>
<select id="checkItemValueUnique" resultMap="LinkageDictResult">
<include refid="selectLinkageDictVo"/>
where value=#{value} and parent_id = #{parentId}
</select>
</mapper>
Loading…
Cancel
Save