!32 添加机构信息管理功能

Merge pull request !32 from 乾坤平台/master
This commit is contained in:
乾坤平台
2019-03-09 11:52:47 +08:00
committed by 季圣华
22 changed files with 4896 additions and 5 deletions

View File

@@ -0,0 +1,310 @@
<!DOCTYPE html>
<html>
<head>
<title>机构管理</title>
<meta charset="utf-8">
<!-- 指定以IE8的方式来渲染 -->
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"/>
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Expires" content="-1">
<link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon"/>
<script type="text/javascript" src="/js/jquery-1.8.0.min.js"></script>
<link rel="stylesheet" type="text/css" href="/js/easyui-1.3.5/themes/default/easyui.css"/>
<link rel="stylesheet" type="text/css" href="/js/easyui-1.3.5/themes/icon.css"/>
<link type="text/css" rel="stylesheet" href="/css/common.css"/>
<script type="text/javascript" src="/js/easyui-1.3.5/jquery.easyui.min.js"></script>
<script type="text/javascript" src="/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="/js/common/common.js"></script>
<script src="/js/My97DatePicker/WdatePicker.js"></script>
</head>
<body>
<!-- 数据显示table -->
<div id="tablePanel" class="easyui-panel" style="padding:1px;top:300px;" title="机构列表" iconCls="icon-list"
collapsible="true" closable="false">
<table id="tableData" style="top:300px;border-bottom-color:#FFFFFF">
</table>
</div>
<div id="organizationDlg" class="easyui-dialog" style="width:380px;padding:10px 20px"
closed="true" buttons="#dlg-buttons" modal="true" cache="false" collapsible="false" closable="true">
<form id="organizationFM" method="post" novalidate>
<table>
<tr>
<td>上级机构</td>
<td style="padding:5px">
<input name="orgParentName" id="orgParentName" style="width: 200px;height: 20px" readonly="readonly"/>
<a href="javascript:void(0)" class="l-btn l-btn-plain" group="" id="lookForSelectOrganization">
<span class="l-btn-left"><span class="l-btn-text icon-search l-btn-icon-left"></span></span></a>
<input name="orgParentNo" id="orgParentNo" type="hidden"/>
</td>
</tr>
<tr>
<td>全称</td>
<td style="padding:5px">
<input name="orgFullName" id="orgFullName" class="easyui-validatebox"
data-options="required:true,validType:'length[2,30]'" style="width: 200px;height: 20px"/>
<input name="id" id="id" type="hidden"/>
</td>
</tr>
<tr>
<td>简称</td>
<td style="padding:5px">
<input name="orgAbr" id="orgAbr" class="easyui-validatebox"
data-options="required:true,validType:'length[2,30]'" style="width: 200px;height: 20px"/>
</td>
</tr>
<!--<tr>
<td>类型</td>
<td style="padding:5px">
<input name="orgTpcd" id="orgTpcd" class="easyui-validatebox"
data-options="required:true,validType:'length[2,30]'" style="width: 200px;height: 20px"/>
</td>
</tr>-->
<tr>
<td>状态</td>
<td style="padding:5px">
<input name="orgStcd" id="orgStcd" class="easyui-validatebox"
data-options="required:true,validType:'length[2,30]'" style="width: 200px;height: 20px"/>
</td>
</tr>
<tr>
<td>编号</td>
<td style="padding:5px">
<input name="orgNo" id="orgNo" style="width: 200px;height: 20px"/>
</td>
</tr>
<tr>
<td>序号</td>
<td style="padding:5px">
<input name="sort" id="sort" style="width: 200px;height: 20px"/>
</td>
</tr>
<tr>
<td>开创时间</td>
<td style="padding:5px">
<input type="text" name="orgCreateTime" id="orgCreateTime"
onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="txt Wdate" style="width:200px;"/>
</td>
</tr>
<tr>
<td>停业时间</td>
<td style="padding:5px">
<input type="text" name="orgStopTime" id="orgStopTime"
onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="txt Wdate" style="width:200px;"/>
</td>
</tr>
<tr>
<td>备注</td>
<td style="padding:5px">
<textarea name="remark" id="remark" placeholder="暂无备注信息"
style="width: 200px; height:40px;"></textarea>
</td>
</tr>
</table>
</form>
</div>
<div id="dlg-buttons">
<a href="javascript:void(0)" id="saveOrganization" class="easyui-linkbutton" iconCls="icon-ok">保存</a>
<a href="javascript:void(0)" id="cancelOrganization" class="easyui-linkbutton" iconCls="icon-cancel"
onclick="javascript:$('#organizationDlg').dialog('close')">取消</a>
</div>
<div id="forSelectOrganizationDlg" class="easyui-dialog" style="width:380px;padding:10px 20px"
closed="true" modal="true" cache="false" collapsible="false" closable="true">
</div>
<script type="text/javascript">
var url;
//初始化界面
$(function () {
var treeHeight=webH-35;
//初始化系统基础信息
$('#tableData').datagrid({
height: treeHeight,
toolbar: [
{
id: 'addOrganization',
text: '增加',
iconCls: 'icon-add',
handler: function () {
addOrganization();
}
},
'-',
{
id: 'deleteOrganization',
text: '删除',
iconCls: 'icon-remove',
handler: function () {
batDeleteOrganization();
}
}
],
});
$('#tableData').prev('.datagrid-view2').find(".datagrid-body").append("<ul id='tt'><ul>");
$('#tt').tree({
url: '/organization/getOrganizationTree',
animate: true,
checkbox: true,
onDblClick: function(node){
//双击修改
editOrganization(node);
}
});
});
function addOrganization() {
$('#OrganizationFM').form('clear');
$('#organizationDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/edit_add.png"/>&nbsp;增加机构信息');
$(".window-mask").css({width: webW, height: webH});
$("#orgAbr").val("").focus();
$("#orgParentName").val("");
$("#orgParentNo").val("");
$("#orgFullName").val("");
$("#orgTpcd").val("");
$("#orgStcd").val("");
$("#orgNo").val("");
$("#sort").val("");
$("#orgCreateTime").val("");
$("#orgStopTime").val("");
$("#remark").val("");
$("#id").val("");
url = '/organization/addOrganization';
}
function editOrganization(node) {
var id=node.id;
$.ajax({
type: "post",
url: '/organization/findById',
dataType: "json",
data: ({
id: id
}),
success: function(res) {
if(res) {
if(res.code!=200){
$.messager.alert('提示', res.msg, 'error');
return;
}
$('#organizationFM').form('clear');
$('#organizationDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/edit_add.png"/>&nbsp;修改机构信息');
$(".window-mask").css({width: webW, height: webH});
$("#orgAbr").val(res.data.orgAbr).focus();
$("#orgParentName").val(res.data.orgParentName);
$("#orgParentNo").val(res.data.orgParentNo);
$("#orgFullName").val(res.data.orgFullName);
$("#orgTpcd").val(res.data.orgTpcd);
$("#orgStcd").val(res.data.orgStcd);
$("#orgNo").val(res.data.orgNo);
$("#orgFullName").val(res.data.orgFullName);
$("#sort").val(res.data.sort);
$("#orgCreateTime").val(res.data.orgCreateTime);
$("#orgStopTime").val(res.data.orgStopTime);
$("#remark").val(res.data.remark);
$("#id").val(res.data.id);
url = '/organization/editOrganization';
}
},
//此处添加错误处理
error: function () {
$.messager.alert('提示', '修改机构信息异常,请稍后再试!', 'error');
return;
}
});
}
//批量删除机构信息
function batDeleteOrganization() {
var nodes = $('#tt').tree('getChecked');
if (nodes.length == 0) {
$.messager.alert('删除提示', '没有记录被选中!', 'info');
return;
}
if (nodes.length > 0) {
$.messager.confirm('删除确认', '确定要删除选中的' + nodes.length + '条机构信息吗?', function (r) {
if (r) {
var ids = "";
for (var i = 0; i < nodes.length; i++) {
if (i == nodes.length - 1) {
ids += nodes[i].id;
break;
}
//alert(row[i].id);
ids += nodes[i].id + ",";
}
$.ajax({
type: "post",
url: "/organization/batchDeleteOrganization",
dataType: "json",
async: false,
data: ({
ids: ids
}),
success: function (res) {
if(res.code!=200){
$.messager.alert('提示', res.msg, 'error');
return;
}
$('#tt').tree('reload');
},
//此处添加错误处理
error: function () {
$.messager.alert('删除提示', '删除机构信息异常,请稍后再试!', 'error');
return;
}
});
}
});
}
}
//保存信息
$("#saveOrganization").off("click").on("click", function () {
if (!$("#orgAbr").val()) {
$.messager.alert('提示', '机构名称不能为空!', 'warning');
return;
}
var objInfo = $("#organizationFM").serializeObject();
$.ajax({
type: "post",
url: url,
dataType: "json",
data: ({
info: JSON.stringify(objInfo)
}),
success: function(res) {
if(res) {
if(res.code!=200){
$.messager.alert('提示', res.msg, 'error');
return;
}
$('#organizationDlg').dialog('close');
//加载完以后重新初始化
$('#tt').tree('reload');
}
},
//此处添加错误处理
error: function () {
$.messager.alert('提示', '保存机构信息异常,请稍后再试!', 'error');
return;
}
});
});
//查询父级机构信息
$("#lookForSelectOrganization").on("click", function () {
$('#forSelectOrganizationDlg').dialog({
title: '机构选择',
width: webW/2,
height: webH/2,
closed: false,
cache: false,
href: '/pages/manage/organization_forselect.html',
modal: true,
resizable:true
});
});
</script>
</body>
</html>

View File

@@ -0,0 +1,45 @@
<!DOCTYPE html>
<html>
<head>
<title>机构选择</title>
<meta charset="utf-8">
<!-- 指定以IE8的方式来渲染 -->
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"/>
<link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon"/>
<script type="text/javascript" src="/js/jquery-1.8.0.min.js"></script>
<link rel="stylesheet" type="text/css" href="/js/easyui-1.3.5/themes/default/easyui.css"/>
<link rel="stylesheet" type="text/css" href="/js/easyui-1.3.5/themes/icon.css"/>
<link type="text/css" rel="stylesheet" href="/css/common.css"/>
<script type="text/javascript" src="/js/easyui-1.3.5/jquery.easyui.min.js"></script>
<script type="text/javascript" src="/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="/js/common/common.js"></script>
</head>
<body>
<!-- 数据显示table -->
<div>
<ul id="ttForSelect"></ul>
</div>
<script type="text/javascript">
$(function () {
$('#ttForSelect').tree({
url: '/organization/getOrganizationTree',
animate: true,
onDblClick: function (node) {
//双击修改
forSelectOrganization(node);
}
});
function forSelectOrganization(node) {
console.log(node);
$("#orgParentName").val(node.text);
$("#orgParentNo").val(node.attributes);
$('#forSelectOrganizationDlg').dialog('close');
}
});
</script>
</body>
</html>

View File

@@ -1253,3 +1253,59 @@ where Id = 5;
-- ----------------------------
alter table jsh_depot add principal bigint(20) DEFAULT null COMMENT '负责人';
-- ----------------------------
-- 时间2019年3月6日
-- version1.0.5
-- 此次更新
-- 1、添加机构表
-- 2、添加机构用户关系表
-- 特别提醒之后的sql都是在之前基础上迭代可以对已存在的系统进行数据保留更新
-- ----------------------------
-- ----------------------------
-- 添加机构表
-- ----------------------------
DROP TABLE IF EXISTS `jsh_organization`;
CREATE TABLE `jsh_organization` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`org_no` varchar(20) DEFAULT NULL COMMENT '机构编号',
`org_full_name` varchar(500) DEFAULT NULL COMMENT '机构全称',
`org_abr` varchar(20) DEFAULT NULL COMMENT '机构简称',
`org_tpcd` varchar(9) DEFAULT NULL COMMENT '机构类型',
`org_stcd` char(1) DEFAULT NULL COMMENT '机构状态,1未营业、2正常营业、3暂停营业、4终止营业、5已除名',
`org_parent_no` varchar(20) DEFAULT NULL COMMENT '机构父节点编号',
`sort` varchar(20) DEFAULT NULL COMMENT '机构显示顺序',
remark VARCHAR(500) DEFAULT null COMMENT '备注',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`creator` bigint(20) DEFAULT NULL COMMENT '创建人',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`updater` bigint(20) DEFAULT NULL COMMENT '更新人',
`org_create_time` datetime DEFAULT NULL COMMENT '机构创建时间',
`org_stop_time` datetime DEFAULT NULL COMMENT '机构停运时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='机构表';
-- ----------------------------
-- 添加机构用户关系表
-- ----------------------------
DROP TABLE IF EXISTS `jsh_orga_user_rel`;
CREATE TABLE `jsh_orga_user_rel` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`orga_id` bigint(20) NOT NULL COMMENT '机构id',
`user_id` bigint(20) NOT NULL COMMENT '用户id',
`user_blng_orga_dspl_seq` varchar(20) DEFAULT NULL COMMENT '用户在所属机构中显示顺序',
`delete_flag` char(1) DEFAULT 0 COMMENT '删除标记0未删除1删除',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`creator` bigint(20) DEFAULT NULL COMMENT '创建人',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`updater` bigint(20) DEFAULT NULL COMMENT '更新人',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='机构用户关系表';
-- ----------------------------
-- 添加机构管理菜单
-- ----------------------------
INSERT INTO `jsh_functions`(`Number`, `Name`, `PNumber`, `URL`, `State`, `Sort`, `Enabled`, `Type`, `PushBtn`) VALUES ('000108', '机构管理', '0001', '../manage/organization.html', b'1', '0139', b'1', '电脑版', '');
-- ----------------------------
-- 添加根机构
-- ----------------------------
INSERT INTO `jsh_organization`(`org_no`, `org_full_name`, `org_abr`, `org_tpcd`, `org_stcd`, `org_parent_no`, `sort`, `remark`, `create_time`, `creator`, `update_time`, `updater`, `org_create_time`, `org_stop_time`) VALUES ('01', '根机构', '根机构', NULL, '2', '-1', '1', '根机构,初始化存在', NULL, NULL, NULL, NULL, NULL, NULL);

View File

@@ -3,8 +3,8 @@ package com.jsh.erp.constants;
/**
* @ClassName:BusinessConstants
* @Description 业务字典类
* @Author linshengming
* @Date 2018-9-15 17:58
* @Author qiankunpingtai
* @Date 2019-3-6 17:58
* @Version 1.0
**/
public class BusinessConstants {
@@ -85,6 +85,21 @@ public class BusinessConstants {
public static final String MATERIAL_CATEGORY_STATUS_DEFAULT = "0";
public static final String MATERIAL_CATEGORY_STATUS_ENABLE = "1";
public static final String MATERIAL_CATEGORY_STATUS_DELETE = "2";
/**
* 机构状态
* 1未营业、2正常营业、3暂停营业、4终止营业,5已除名
* */
public static final String ORGANIZATION_STCD_NOT_OPEN = "1";
public static final String ORGANIZATION_STCD_OPEN = "2";
public static final String ORGANIZATION_STCD_BUSINESS_SUSPENDED = "3";
public static final String ORGANIZATION_STCD_BUSINESS_TERMINATED = "4";
public static final String ORGANIZATION_STCD_REMOVED = "5";
/**
* 根机构编号
* 根机构编号默认为01
* */
public static final String ORGANIZATION_ROOT_NO = "01";

View File

@@ -75,6 +75,28 @@ public class ExceptionConstants {
//商品类别编号已存在
public static final int MATERIAL_CATEGORY_SERIAL_ALREADY_EXISTS_CODE = 7500003;
public static final String MATERIAL_CATEGORY_SERIAL_ALREADY_EXISTS_MSG = "商品类别编号已存在";
/**
* 机构
* type = 110
* */
//添加机构信息失败
public static final int ORGANIZATION_ADD_FAILED_CODE = 11000000;
public static final String ORGANIZATION_ADD_FAILED_MSG = "添加机构信息失败";
//删除机构信息失败
public static final int ORGANIZATION_DELETE_FAILED_CODE = 11000001;
public static final String ORGANIZATION_DELETE_FAILED_MSG = "删除机构信息失败";
//修改机构信息失败
public static final int ORGANIZATION_EDIT_FAILED_CODE = 11000002;
public static final String ORGANIZATION_EDIT_FAILED_MSG = "修改机构信息失败";
//机构编号已存在
public static final int ORGANIZATION_NO_ALREADY_EXISTS_CODE = 11000003;
public static final String ORGANIZATION_NO_ALREADY_EXISTS_MSG = "机构编号已存在";
//根机构不允许删除
public static final int ORGANIZATION_ROOT_NOT_ALLOWED_DELETE_CODE = 11000004;
public static final String ORGANIZATION_ROOT_NOT_ALLOWED_DELETE_MSG = "根机构不允许删除";
//根机构不允许修改
public static final int ORGANIZATION_ROOT_NOT_ALLOWED_EDIT_CODE = 11000005;
public static final String ORGANIZATION_ROOT_NOT_ALLOWED_EDIT_MSG = "根机构不允许修改";
/**
* 标准正常返回/操作成功返回

View File

@@ -137,8 +137,8 @@ public class MaterialCategoryController {
MaterialCategory mc= JSON.parseObject(beanJson, MaterialCategory.class);
int i= materialCategoryService.editMaterialCategory(mc);
if(i<1){
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_CATEGORY_ADD_FAILED_CODE,
ExceptionConstants.MATERIAL_CATEGORY_ADD_FAILED_MSG);
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_CATEGORY_EDIT_FAILED_CODE,
ExceptionConstants.MATERIAL_CATEGORY_EDIT_FAILED_MSG);
}
return result;
}

View File

@@ -0,0 +1,166 @@
package com.jsh.erp.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.MaterialCategory;
import com.jsh.erp.datasource.entities.Organization;
import com.jsh.erp.datasource.vo.TreeNode;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.service.materialCategory.MaterialCategoryService;
import com.jsh.erp.service.organization.OrganizationService;
import com.jsh.erp.utils.BaseResponseInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat;
import java.util.List;
/**
* create by: cjl
* description:
*
* create time: 2019/3/6 10:54
*/
@RestController
@RequestMapping(value = "/organization")
public class OrganizationController {
private Logger logger = LoggerFactory.getLogger(OrganizationController.class);
@Resource
private OrganizationService organizationService;
/**
* 根据id来查询机构信息
* @param id
* @param request
* @return
*/
@RequestMapping(value = "/findById")
public BaseResponseInfo findById(@RequestParam("id") Long id, HttpServletRequest request) throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
List<Organization> dataList = organizationService.findById(id);
JSONObject outer = new JSONObject();
if (null != dataList) {
for (Organization org : dataList) {
outer.put("id", org.getId());
outer.put("orgFullName", org.getOrgFullName());
outer.put("orgAbr", org.getOrgAbr());
outer.put("orgParentNo", org.getOrgParentNo());
List<Organization> dataParentList = organizationService.findByOrgNo(org.getOrgParentNo());
if(dataParentList!=null&&dataParentList.size()>0){
//父级机构名称显示简称
outer.put("orgParentName", dataParentList.get(0).getOrgAbr());
}
outer.put("orgTpcd", org.getOrgTpcd());
outer.put("orgStcd", org.getOrgStcd());
outer.put("orgNo", org.getOrgNo());
outer.put("sort", org.getSort());
/**
* 判断时间不为空再做转化
* */
if(org.getOrgCreateTime()!=null){
outer.put("orgCreateTime", sdf.format(org.getOrgCreateTime()));
}
if(org.getOrgStopTime()!=null){
outer.put("orgStopTime", sdf.format(org.getOrgStopTime()));
}
outer.put("remark", org.getRemark());
}
}
res.code = 200;
res.data = outer;
} catch(Exception e){
e.printStackTrace();
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* create by: cjl
* description:
* 获取机构树数据
* create time: 2019/2/19 11:49
* @Param:
* @return com.alibaba.fastjson.JSONArray
*/
@RequestMapping(value = "/getOrganizationTree")
public JSONArray getOrganizationTree() throws Exception{
JSONArray arr=new JSONArray();
List<TreeNode> organizationTree= organizationService.getOrganizationTree();
if(organizationTree!=null&&organizationTree.size()>0){
for(TreeNode node:organizationTree){
String str=JSON.toJSONString(node);
JSONObject obj=JSON.parseObject(str);
arr.add(obj) ;
}
}
return arr;
}
/**
* create by: cjl
* description:
* 新增机构信息
* create time: 2019/2/19 17:17
* @Param: beanJson
* @return java.lang.Object
*/
@RequestMapping(value = "/addOrganization")
public Object addOrganization(@RequestParam("info") String beanJson) throws Exception {
JSONObject result = ExceptionConstants.standardSuccess();
Organization org= JSON.parseObject(beanJson, Organization.class);
int i= organizationService.addOrganization(org);
if(i<1){
throw new BusinessRunTimeException(ExceptionConstants.ORGANIZATION_ADD_FAILED_CODE,
ExceptionConstants.ORGANIZATION_ADD_FAILED_MSG);
}
return result;
}
/**
* create by: cjl
* description:
* 修改机构信息
* create time: 2019/2/20 9:30
* @Param: beanJson
* @return java.lang.Object
*/
@RequestMapping(value = "/editOrganization")
public Object editOrganization(@RequestParam("info") String beanJson) throws Exception {
JSONObject result = ExceptionConstants.standardSuccess();
Organization org= JSON.parseObject(beanJson, Organization.class);
int i= organizationService.editOrganization(org);
if(i<1){
throw new BusinessRunTimeException(ExceptionConstants.ORGANIZATION_EDIT_FAILED_CODE,
ExceptionConstants.ORGANIZATION_EDIT_FAILED_MSG);
}
return result;
}
/**
* create by: cjl
* description:
* 批量删除机构信息
* create time: 2019/2/19 17:26
* @Param: ids
* @return java.lang.Object
*/
@RequestMapping(value = "/batchDeleteOrganization")
public Object batchDeleteOrganization(@RequestParam("ids") String ids) throws Exception {
JSONObject result = ExceptionConstants.standardSuccess();
int i= organizationService.batchDeleteOrganizationByIds(ids);
if(i<1){
throw new BusinessRunTimeException(ExceptionConstants.ORGANIZATION_DELETE_FAILED_CODE,
ExceptionConstants.ORGANIZATION_DELETE_FAILED_MSG);
}
return result;
}
}

View File

@@ -0,0 +1,293 @@
package com.jsh.erp.datasource.entities;
import java.util.Date;
public class OrgaUserRel {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_orga_user_rel.id
*
* @mbggenerated
*/
private Long id;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_orga_user_rel.orga_id
*
* @mbggenerated
*/
private Long orgaId;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_orga_user_rel.user_id
*
* @mbggenerated
*/
private Long userId;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_orga_user_rel.user_blng_orga_dspl_seq
*
* @mbggenerated
*/
private String userBlngOrgaDsplSeq;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_orga_user_rel.delete_flag
*
* @mbggenerated
*/
private String deleteFlag;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_orga_user_rel.create_time
*
* @mbggenerated
*/
private Date createTime;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_orga_user_rel.creator
*
* @mbggenerated
*/
private Long creator;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_orga_user_rel.update_time
*
* @mbggenerated
*/
private Date updateTime;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_orga_user_rel.updater
*
* @mbggenerated
*/
private Long updater;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_orga_user_rel.id
*
* @return the value of jsh_orga_user_rel.id
*
* @mbggenerated
*/
public Long getId() {
return id;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_orga_user_rel.id
*
* @param id the value for jsh_orga_user_rel.id
*
* @mbggenerated
*/
public void setId(Long id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_orga_user_rel.orga_id
*
* @return the value of jsh_orga_user_rel.orga_id
*
* @mbggenerated
*/
public Long getOrgaId() {
return orgaId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_orga_user_rel.orga_id
*
* @param orgaId the value for jsh_orga_user_rel.orga_id
*
* @mbggenerated
*/
public void setOrgaId(Long orgaId) {
this.orgaId = orgaId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_orga_user_rel.user_id
*
* @return the value of jsh_orga_user_rel.user_id
*
* @mbggenerated
*/
public Long getUserId() {
return userId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_orga_user_rel.user_id
*
* @param userId the value for jsh_orga_user_rel.user_id
*
* @mbggenerated
*/
public void setUserId(Long userId) {
this.userId = userId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_orga_user_rel.user_blng_orga_dspl_seq
*
* @return the value of jsh_orga_user_rel.user_blng_orga_dspl_seq
*
* @mbggenerated
*/
public String getUserBlngOrgaDsplSeq() {
return userBlngOrgaDsplSeq;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_orga_user_rel.user_blng_orga_dspl_seq
*
* @param userBlngOrgaDsplSeq the value for jsh_orga_user_rel.user_blng_orga_dspl_seq
*
* @mbggenerated
*/
public void setUserBlngOrgaDsplSeq(String userBlngOrgaDsplSeq) {
this.userBlngOrgaDsplSeq = userBlngOrgaDsplSeq == null ? null : userBlngOrgaDsplSeq.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_orga_user_rel.delete_flag
*
* @return the value of jsh_orga_user_rel.delete_flag
*
* @mbggenerated
*/
public String getDeleteFlag() {
return deleteFlag;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_orga_user_rel.delete_flag
*
* @param deleteFlag the value for jsh_orga_user_rel.delete_flag
*
* @mbggenerated
*/
public void setDeleteFlag(String deleteFlag) {
this.deleteFlag = deleteFlag == null ? null : deleteFlag.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_orga_user_rel.create_time
*
* @return the value of jsh_orga_user_rel.create_time
*
* @mbggenerated
*/
public Date getCreateTime() {
return createTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_orga_user_rel.create_time
*
* @param createTime the value for jsh_orga_user_rel.create_time
*
* @mbggenerated
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_orga_user_rel.creator
*
* @return the value of jsh_orga_user_rel.creator
*
* @mbggenerated
*/
public Long getCreator() {
return creator;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_orga_user_rel.creator
*
* @param creator the value for jsh_orga_user_rel.creator
*
* @mbggenerated
*/
public void setCreator(Long creator) {
this.creator = creator;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_orga_user_rel.update_time
*
* @return the value of jsh_orga_user_rel.update_time
*
* @mbggenerated
*/
public Date getUpdateTime() {
return updateTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_orga_user_rel.update_time
*
* @param updateTime the value for jsh_orga_user_rel.update_time
*
* @mbggenerated
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_orga_user_rel.updater
*
* @return the value of jsh_orga_user_rel.updater
*
* @mbggenerated
*/
public Long getUpdater() {
return updater;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_orga_user_rel.updater
*
* @param updater the value for jsh_orga_user_rel.updater
*
* @mbggenerated
*/
public void setUpdater(Long updater) {
this.updater = updater;
}
}

View File

@@ -0,0 +1,863 @@
package com.jsh.erp.datasource.entities;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class OrgaUserRelExample {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table jsh_orga_user_rel
*
* @mbggenerated
*/
protected String orderByClause;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table jsh_orga_user_rel
*
* @mbggenerated
*/
protected boolean distinct;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table jsh_orga_user_rel
*
* @mbggenerated
*/
protected List<Criteria> oredCriteria;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_orga_user_rel
*
* @mbggenerated
*/
public OrgaUserRelExample() {
oredCriteria = new ArrayList<Criteria>();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_orga_user_rel
*
* @mbggenerated
*/
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_orga_user_rel
*
* @mbggenerated
*/
public String getOrderByClause() {
return orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_orga_user_rel
*
* @mbggenerated
*/
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_orga_user_rel
*
* @mbggenerated
*/
public boolean isDistinct() {
return distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_orga_user_rel
*
* @mbggenerated
*/
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_orga_user_rel
*
* @mbggenerated
*/
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_orga_user_rel
*
* @mbggenerated
*/
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_orga_user_rel
*
* @mbggenerated
*/
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_orga_user_rel
*
* @mbggenerated
*/
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_orga_user_rel
*
* @mbggenerated
*/
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table jsh_orga_user_rel
*
* @mbggenerated
*/
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andOrgaIdIsNull() {
addCriterion("orga_id is null");
return (Criteria) this;
}
public Criteria andOrgaIdIsNotNull() {
addCriterion("orga_id is not null");
return (Criteria) this;
}
public Criteria andOrgaIdEqualTo(Long value) {
addCriterion("orga_id =", value, "orgaId");
return (Criteria) this;
}
public Criteria andOrgaIdNotEqualTo(Long value) {
addCriterion("orga_id <>", value, "orgaId");
return (Criteria) this;
}
public Criteria andOrgaIdGreaterThan(Long value) {
addCriterion("orga_id >", value, "orgaId");
return (Criteria) this;
}
public Criteria andOrgaIdGreaterThanOrEqualTo(Long value) {
addCriterion("orga_id >=", value, "orgaId");
return (Criteria) this;
}
public Criteria andOrgaIdLessThan(Long value) {
addCriterion("orga_id <", value, "orgaId");
return (Criteria) this;
}
public Criteria andOrgaIdLessThanOrEqualTo(Long value) {
addCriterion("orga_id <=", value, "orgaId");
return (Criteria) this;
}
public Criteria andOrgaIdIn(List<Long> values) {
addCriterion("orga_id in", values, "orgaId");
return (Criteria) this;
}
public Criteria andOrgaIdNotIn(List<Long> values) {
addCriterion("orga_id not in", values, "orgaId");
return (Criteria) this;
}
public Criteria andOrgaIdBetween(Long value1, Long value2) {
addCriterion("orga_id between", value1, value2, "orgaId");
return (Criteria) this;
}
public Criteria andOrgaIdNotBetween(Long value1, Long value2) {
addCriterion("orga_id not between", value1, value2, "orgaId");
return (Criteria) this;
}
public Criteria andUserIdIsNull() {
addCriterion("user_id is null");
return (Criteria) this;
}
public Criteria andUserIdIsNotNull() {
addCriterion("user_id is not null");
return (Criteria) this;
}
public Criteria andUserIdEqualTo(Long value) {
addCriterion("user_id =", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotEqualTo(Long value) {
addCriterion("user_id <>", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThan(Long value) {
addCriterion("user_id >", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThanOrEqualTo(Long value) {
addCriterion("user_id >=", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLessThan(Long value) {
addCriterion("user_id <", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLessThanOrEqualTo(Long value) {
addCriterion("user_id <=", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdIn(List<Long> values) {
addCriterion("user_id in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotIn(List<Long> values) {
addCriterion("user_id not in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdBetween(Long value1, Long value2) {
addCriterion("user_id between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotBetween(Long value1, Long value2) {
addCriterion("user_id not between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andUserBlngOrgaDsplSeqIsNull() {
addCriterion("user_blng_orga_dspl_seq is null");
return (Criteria) this;
}
public Criteria andUserBlngOrgaDsplSeqIsNotNull() {
addCriterion("user_blng_orga_dspl_seq is not null");
return (Criteria) this;
}
public Criteria andUserBlngOrgaDsplSeqEqualTo(String value) {
addCriterion("user_blng_orga_dspl_seq =", value, "userBlngOrgaDsplSeq");
return (Criteria) this;
}
public Criteria andUserBlngOrgaDsplSeqNotEqualTo(String value) {
addCriterion("user_blng_orga_dspl_seq <>", value, "userBlngOrgaDsplSeq");
return (Criteria) this;
}
public Criteria andUserBlngOrgaDsplSeqGreaterThan(String value) {
addCriterion("user_blng_orga_dspl_seq >", value, "userBlngOrgaDsplSeq");
return (Criteria) this;
}
public Criteria andUserBlngOrgaDsplSeqGreaterThanOrEqualTo(String value) {
addCriterion("user_blng_orga_dspl_seq >=", value, "userBlngOrgaDsplSeq");
return (Criteria) this;
}
public Criteria andUserBlngOrgaDsplSeqLessThan(String value) {
addCriterion("user_blng_orga_dspl_seq <", value, "userBlngOrgaDsplSeq");
return (Criteria) this;
}
public Criteria andUserBlngOrgaDsplSeqLessThanOrEqualTo(String value) {
addCriterion("user_blng_orga_dspl_seq <=", value, "userBlngOrgaDsplSeq");
return (Criteria) this;
}
public Criteria andUserBlngOrgaDsplSeqLike(String value) {
addCriterion("user_blng_orga_dspl_seq like", value, "userBlngOrgaDsplSeq");
return (Criteria) this;
}
public Criteria andUserBlngOrgaDsplSeqNotLike(String value) {
addCriterion("user_blng_orga_dspl_seq not like", value, "userBlngOrgaDsplSeq");
return (Criteria) this;
}
public Criteria andUserBlngOrgaDsplSeqIn(List<String> values) {
addCriterion("user_blng_orga_dspl_seq in", values, "userBlngOrgaDsplSeq");
return (Criteria) this;
}
public Criteria andUserBlngOrgaDsplSeqNotIn(List<String> values) {
addCriterion("user_blng_orga_dspl_seq not in", values, "userBlngOrgaDsplSeq");
return (Criteria) this;
}
public Criteria andUserBlngOrgaDsplSeqBetween(String value1, String value2) {
addCriterion("user_blng_orga_dspl_seq between", value1, value2, "userBlngOrgaDsplSeq");
return (Criteria) this;
}
public Criteria andUserBlngOrgaDsplSeqNotBetween(String value1, String value2) {
addCriterion("user_blng_orga_dspl_seq not between", value1, value2, "userBlngOrgaDsplSeq");
return (Criteria) this;
}
public Criteria andDeleteFlagIsNull() {
addCriterion("delete_flag is null");
return (Criteria) this;
}
public Criteria andDeleteFlagIsNotNull() {
addCriterion("delete_flag is not null");
return (Criteria) this;
}
public Criteria andDeleteFlagEqualTo(String value) {
addCriterion("delete_flag =", value, "deleteFlag");
return (Criteria) this;
}
public Criteria andDeleteFlagNotEqualTo(String value) {
addCriterion("delete_flag <>", value, "deleteFlag");
return (Criteria) this;
}
public Criteria andDeleteFlagGreaterThan(String value) {
addCriterion("delete_flag >", value, "deleteFlag");
return (Criteria) this;
}
public Criteria andDeleteFlagGreaterThanOrEqualTo(String value) {
addCriterion("delete_flag >=", value, "deleteFlag");
return (Criteria) this;
}
public Criteria andDeleteFlagLessThan(String value) {
addCriterion("delete_flag <", value, "deleteFlag");
return (Criteria) this;
}
public Criteria andDeleteFlagLessThanOrEqualTo(String value) {
addCriterion("delete_flag <=", value, "deleteFlag");
return (Criteria) this;
}
public Criteria andDeleteFlagLike(String value) {
addCriterion("delete_flag like", value, "deleteFlag");
return (Criteria) this;
}
public Criteria andDeleteFlagNotLike(String value) {
addCriterion("delete_flag not like", value, "deleteFlag");
return (Criteria) this;
}
public Criteria andDeleteFlagIn(List<String> values) {
addCriterion("delete_flag in", values, "deleteFlag");
return (Criteria) this;
}
public Criteria andDeleteFlagNotIn(List<String> values) {
addCriterion("delete_flag not in", values, "deleteFlag");
return (Criteria) this;
}
public Criteria andDeleteFlagBetween(String value1, String value2) {
addCriterion("delete_flag between", value1, value2, "deleteFlag");
return (Criteria) this;
}
public Criteria andDeleteFlagNotBetween(String value1, String value2) {
addCriterion("delete_flag not between", value1, value2, "deleteFlag");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Date value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreatorIsNull() {
addCriterion("creator is null");
return (Criteria) this;
}
public Criteria andCreatorIsNotNull() {
addCriterion("creator is not null");
return (Criteria) this;
}
public Criteria andCreatorEqualTo(Long value) {
addCriterion("creator =", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorNotEqualTo(Long value) {
addCriterion("creator <>", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorGreaterThan(Long value) {
addCriterion("creator >", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorGreaterThanOrEqualTo(Long value) {
addCriterion("creator >=", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorLessThan(Long value) {
addCriterion("creator <", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorLessThanOrEqualTo(Long value) {
addCriterion("creator <=", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorIn(List<Long> values) {
addCriterion("creator in", values, "creator");
return (Criteria) this;
}
public Criteria andCreatorNotIn(List<Long> values) {
addCriterion("creator not in", values, "creator");
return (Criteria) this;
}
public Criteria andCreatorBetween(Long value1, Long value2) {
addCriterion("creator between", value1, value2, "creator");
return (Criteria) this;
}
public Criteria andCreatorNotBetween(Long value1, Long value2) {
addCriterion("creator not between", value1, value2, "creator");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNull() {
addCriterion("update_time is null");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNotNull() {
addCriterion("update_time is not null");
return (Criteria) this;
}
public Criteria andUpdateTimeEqualTo(Date value) {
addCriterion("update_time =", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotEqualTo(Date value) {
addCriterion("update_time <>", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThan(Date value) {
addCriterion("update_time >", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("update_time >=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThan(Date value) {
addCriterion("update_time <", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThanOrEqualTo(Date value) {
addCriterion("update_time <=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIn(List<Date> values) {
addCriterion("update_time in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotIn(List<Date> values) {
addCriterion("update_time not in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeBetween(Date value1, Date value2) {
addCriterion("update_time between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotBetween(Date value1, Date value2) {
addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andUpdaterIsNull() {
addCriterion("updater is null");
return (Criteria) this;
}
public Criteria andUpdaterIsNotNull() {
addCriterion("updater is not null");
return (Criteria) this;
}
public Criteria andUpdaterEqualTo(Long value) {
addCriterion("updater =", value, "updater");
return (Criteria) this;
}
public Criteria andUpdaterNotEqualTo(Long value) {
addCriterion("updater <>", value, "updater");
return (Criteria) this;
}
public Criteria andUpdaterGreaterThan(Long value) {
addCriterion("updater >", value, "updater");
return (Criteria) this;
}
public Criteria andUpdaterGreaterThanOrEqualTo(Long value) {
addCriterion("updater >=", value, "updater");
return (Criteria) this;
}
public Criteria andUpdaterLessThan(Long value) {
addCriterion("updater <", value, "updater");
return (Criteria) this;
}
public Criteria andUpdaterLessThanOrEqualTo(Long value) {
addCriterion("updater <=", value, "updater");
return (Criteria) this;
}
public Criteria andUpdaterIn(List<Long> values) {
addCriterion("updater in", values, "updater");
return (Criteria) this;
}
public Criteria andUpdaterNotIn(List<Long> values) {
addCriterion("updater not in", values, "updater");
return (Criteria) this;
}
public Criteria andUpdaterBetween(Long value1, Long value2) {
addCriterion("updater between", value1, value2, "updater");
return (Criteria) this;
}
public Criteria andUpdaterNotBetween(Long value1, Long value2) {
addCriterion("updater not between", value1, value2, "updater");
return (Criteria) this;
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table jsh_orga_user_rel
*
* @mbggenerated do_not_delete_during_merge
*/
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table jsh_orga_user_rel
*
* @mbggenerated
*/
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@@ -0,0 +1,485 @@
package com.jsh.erp.datasource.entities;
import java.util.Date;
public class Organization {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_organization.id
*
* @mbggenerated
*/
private Long id;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_organization.org_no
*
* @mbggenerated
*/
private String orgNo;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_organization.org_full_name
*
* @mbggenerated
*/
private String orgFullName;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_organization.org_abr
*
* @mbggenerated
*/
private String orgAbr;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_organization.org_tpcd
*
* @mbggenerated
*/
private String orgTpcd;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_organization.org_stcd
*
* @mbggenerated
*/
private String orgStcd;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_organization.org_parent_no
*
* @mbggenerated
*/
private String orgParentNo;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_organization.sort
*
* @mbggenerated
*/
private String sort;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_organization.remark
*
* @mbggenerated
*/
private String remark;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_organization.create_time
*
* @mbggenerated
*/
private Date createTime;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_organization.creator
*
* @mbggenerated
*/
private Long creator;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_organization.update_time
*
* @mbggenerated
*/
private Date updateTime;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_organization.updater
*
* @mbggenerated
*/
private Long updater;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_organization.org_create_time
*
* @mbggenerated
*/
private Date orgCreateTime;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_organization.org_stop_time
*
* @mbggenerated
*/
private Date orgStopTime;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_organization.id
*
* @return the value of jsh_organization.id
*
* @mbggenerated
*/
public Long getId() {
return id;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_organization.id
*
* @param id the value for jsh_organization.id
*
* @mbggenerated
*/
public void setId(Long id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_organization.org_no
*
* @return the value of jsh_organization.org_no
*
* @mbggenerated
*/
public String getOrgNo() {
return orgNo;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_organization.org_no
*
* @param orgNo the value for jsh_organization.org_no
*
* @mbggenerated
*/
public void setOrgNo(String orgNo) {
this.orgNo = orgNo == null ? null : orgNo.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_organization.org_full_name
*
* @return the value of jsh_organization.org_full_name
*
* @mbggenerated
*/
public String getOrgFullName() {
return orgFullName;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_organization.org_full_name
*
* @param orgFullName the value for jsh_organization.org_full_name
*
* @mbggenerated
*/
public void setOrgFullName(String orgFullName) {
this.orgFullName = orgFullName == null ? null : orgFullName.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_organization.org_abr
*
* @return the value of jsh_organization.org_abr
*
* @mbggenerated
*/
public String getOrgAbr() {
return orgAbr;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_organization.org_abr
*
* @param orgAbr the value for jsh_organization.org_abr
*
* @mbggenerated
*/
public void setOrgAbr(String orgAbr) {
this.orgAbr = orgAbr == null ? null : orgAbr.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_organization.org_tpcd
*
* @return the value of jsh_organization.org_tpcd
*
* @mbggenerated
*/
public String getOrgTpcd() {
return orgTpcd;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_organization.org_tpcd
*
* @param orgTpcd the value for jsh_organization.org_tpcd
*
* @mbggenerated
*/
public void setOrgTpcd(String orgTpcd) {
this.orgTpcd = orgTpcd == null ? null : orgTpcd.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_organization.org_stcd
*
* @return the value of jsh_organization.org_stcd
*
* @mbggenerated
*/
public String getOrgStcd() {
return orgStcd;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_organization.org_stcd
*
* @param orgStcd the value for jsh_organization.org_stcd
*
* @mbggenerated
*/
public void setOrgStcd(String orgStcd) {
this.orgStcd = orgStcd == null ? null : orgStcd.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_organization.org_parent_no
*
* @return the value of jsh_organization.org_parent_no
*
* @mbggenerated
*/
public String getOrgParentNo() {
return orgParentNo;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_organization.org_parent_no
*
* @param orgParentNo the value for jsh_organization.org_parent_no
*
* @mbggenerated
*/
public void setOrgParentNo(String orgParentNo) {
this.orgParentNo = orgParentNo == null ? null : orgParentNo.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_organization.sort
*
* @return the value of jsh_organization.sort
*
* @mbggenerated
*/
public String getSort() {
return sort;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_organization.sort
*
* @param sort the value for jsh_organization.sort
*
* @mbggenerated
*/
public void setSort(String sort) {
this.sort = sort == null ? null : sort.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_organization.remark
*
* @return the value of jsh_organization.remark
*
* @mbggenerated
*/
public String getRemark() {
return remark;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_organization.remark
*
* @param remark the value for jsh_organization.remark
*
* @mbggenerated
*/
public void setRemark(String remark) {
this.remark = remark == null ? null : remark.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_organization.create_time
*
* @return the value of jsh_organization.create_time
*
* @mbggenerated
*/
public Date getCreateTime() {
return createTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_organization.create_time
*
* @param createTime the value for jsh_organization.create_time
*
* @mbggenerated
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_organization.creator
*
* @return the value of jsh_organization.creator
*
* @mbggenerated
*/
public Long getCreator() {
return creator;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_organization.creator
*
* @param creator the value for jsh_organization.creator
*
* @mbggenerated
*/
public void setCreator(Long creator) {
this.creator = creator;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_organization.update_time
*
* @return the value of jsh_organization.update_time
*
* @mbggenerated
*/
public Date getUpdateTime() {
return updateTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_organization.update_time
*
* @param updateTime the value for jsh_organization.update_time
*
* @mbggenerated
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_organization.updater
*
* @return the value of jsh_organization.updater
*
* @mbggenerated
*/
public Long getUpdater() {
return updater;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_organization.updater
*
* @param updater the value for jsh_organization.updater
*
* @mbggenerated
*/
public void setUpdater(Long updater) {
this.updater = updater;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_organization.org_create_time
*
* @return the value of jsh_organization.org_create_time
*
* @mbggenerated
*/
public Date getOrgCreateTime() {
return orgCreateTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_organization.org_create_time
*
* @param orgCreateTime the value for jsh_organization.org_create_time
*
* @mbggenerated
*/
public void setOrgCreateTime(Date orgCreateTime) {
this.orgCreateTime = orgCreateTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_organization.org_stop_time
*
* @return the value of jsh_organization.org_stop_time
*
* @mbggenerated
*/
public Date getOrgStopTime() {
return orgStopTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_organization.org_stop_time
*
* @param orgStopTime the value for jsh_organization.org_stop_time
*
* @mbggenerated
*/
public void setOrgStopTime(Date orgStopTime) {
this.orgStopTime = orgStopTime;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,96 @@
package com.jsh.erp.datasource.mappers;
import com.jsh.erp.datasource.entities.OrgaUserRel;
import com.jsh.erp.datasource.entities.OrgaUserRelExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface OrgaUserRelMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_orga_user_rel
*
* @mbggenerated
*/
int countByExample(OrgaUserRelExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_orga_user_rel
*
* @mbggenerated
*/
int deleteByExample(OrgaUserRelExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_orga_user_rel
*
* @mbggenerated
*/
int deleteByPrimaryKey(Long id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_orga_user_rel
*
* @mbggenerated
*/
int insert(OrgaUserRel record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_orga_user_rel
*
* @mbggenerated
*/
int insertSelective(OrgaUserRel record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_orga_user_rel
*
* @mbggenerated
*/
List<OrgaUserRel> selectByExample(OrgaUserRelExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_orga_user_rel
*
* @mbggenerated
*/
OrgaUserRel selectByPrimaryKey(Long id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_orga_user_rel
*
* @mbggenerated
*/
int updateByExampleSelective(@Param("record") OrgaUserRel record, @Param("example") OrgaUserRelExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_orga_user_rel
*
* @mbggenerated
*/
int updateByExample(@Param("record") OrgaUserRel record, @Param("example") OrgaUserRelExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_orga_user_rel
*
* @mbggenerated
*/
int updateByPrimaryKeySelective(OrgaUserRel record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_orga_user_rel
*
* @mbggenerated
*/
int updateByPrimaryKey(OrgaUserRel record);
}

View File

@@ -0,0 +1,96 @@
package com.jsh.erp.datasource.mappers;
import com.jsh.erp.datasource.entities.Organization;
import com.jsh.erp.datasource.entities.OrganizationExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface OrganizationMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_organization
*
* @mbggenerated
*/
int countByExample(OrganizationExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_organization
*
* @mbggenerated
*/
int deleteByExample(OrganizationExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_organization
*
* @mbggenerated
*/
int deleteByPrimaryKey(Long id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_organization
*
* @mbggenerated
*/
int insert(Organization record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_organization
*
* @mbggenerated
*/
int insertSelective(Organization record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_organization
*
* @mbggenerated
*/
List<Organization> selectByExample(OrganizationExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_organization
*
* @mbggenerated
*/
Organization selectByPrimaryKey(Long id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_organization
*
* @mbggenerated
*/
int updateByExampleSelective(@Param("record") Organization record, @Param("example") OrganizationExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_organization
*
* @mbggenerated
*/
int updateByExample(@Param("record") Organization record, @Param("example") OrganizationExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_organization
*
* @mbggenerated
*/
int updateByPrimaryKeySelective(Organization record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_organization
*
* @mbggenerated
*/
int updateByPrimaryKey(Organization record);
}

View File

@@ -0,0 +1,29 @@
package com.jsh.erp.datasource.mappers;
import com.jsh.erp.datasource.entities.MaterialCategory;
import com.jsh.erp.datasource.entities.Organization;
import com.jsh.erp.datasource.vo.TreeNode;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
/**
* Description
*
* @Author: cjl
* @Date: 2019/3/6 15:51
*/
public interface OrganizationMapperEx {
List<TreeNode> getNodeTree();
List<TreeNode> getNextNodeTree(@Param("id") Long id);
int addOrganization(Organization org);
int batchDeleteOrganizationByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String ids[]);
int editOrganization(Organization org);
List <Organization> getOrganizationRootByIds(@Param("ids") String ids[]);
}

View File

@@ -0,0 +1,66 @@
package com.jsh.erp.service.organization;
import com.jsh.erp.service.ICommonQuery;
import com.jsh.erp.utils.Constants;
import com.jsh.erp.utils.QueryUtils;
import com.jsh.erp.utils.StringUtil;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
/**
* Description
*
* @Author: cjl
* @Date: 2019/3/6 15:09
*/
@Service(value = "organization_component")
@OrganizationResource
public class OrganizationComponent implements ICommonQuery {
@Resource
private OrganizationService organizationService;
@Override
public Object selectOne(String condition) {
return null;
}
@Override
public List<?> select(Map<String, String> parameterMap) {
return getOrganizationList(parameterMap);
}
private List<?> getOrganizationList(Map<String, String> map) {
return null;
}
@Override
public Long counts(Map<String, String> parameterMap) {
return null;
}
@Override
public int insert(String beanJson, HttpServletRequest request) {
return organizationService.insertOrganization(beanJson,request);
}
@Override
public int update(String beanJson, Long id) {
return organizationService.updateOrganization(beanJson,id);
}
@Override
public int delete(Long id) {
return organizationService.deleteOrganization(id);
}
@Override
public int batchDelete(String ids) {
return organizationService.batchDeleteOrganization(ids);
}
@Override
public int checkIsNameExist(Long id, String name) {
return 0;
}
}

View File

@@ -0,0 +1,18 @@
package com.jsh.erp.service.organization;
import com.jsh.erp.service.ResourceInfo;
import java.lang.annotation.*;
/**
* Description
* 机构
* @Author: cjl
* @Date: 2019/3/6 15:10
*/
@ResourceInfo(value = "organization", type = 110)
@Inherited
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface OrganizationResource {
}

View File

@@ -0,0 +1,188 @@
package com.jsh.erp.service.organization;
import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.Organization;
import com.jsh.erp.datasource.entities.OrganizationExample;
import com.jsh.erp.datasource.entities.User;
import com.jsh.erp.datasource.mappers.OrganizationMapper;
import com.jsh.erp.datasource.mappers.OrganizationMapperEx;
import com.jsh.erp.datasource.vo.TreeNode;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.StringUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.List;
/**
* Description
*
* @Author: cjl
* @Date: 2019/3/6 15:10
*/
@Service
public class OrganizationService {
private Logger logger = LoggerFactory.getLogger(OrganizationService.class);
@Resource
private OrganizationMapper organizationMapper;
@Resource
private OrganizationMapperEx organizationMapperEx;
@Resource
private UserService userService;
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int insertOrganization(String beanJson, HttpServletRequest request) {
Organization organization = JSONObject.parseObject(beanJson, Organization.class);
return organizationMapper.insertSelective(organization);
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateOrganization(String beanJson, Long id) {
Organization organization = JSONObject.parseObject(beanJson, Organization.class);
organization.setId(id);
return organizationMapper.updateByPrimaryKeySelective(organization);
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int deleteOrganization(Long id) {
return organizationMapper.deleteByPrimaryKey(id);
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteOrganization(String ids) {
List<Long> idList = StringUtil.strToLongList(ids);
OrganizationExample example = new OrganizationExample();
example.createCriteria().andIdIn(idList);
return organizationMapper.deleteByExample(example);
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int addOrganization(Organization org) throws Exception{
//新增时间
Date date=new Date();
User userInfo=userService.getCurrentUser();
org.setCreateTime(date);
//新增人
org.setCreator(userInfo==null?null:userInfo.getId());
//修改时间
org.setUpdateTime(date);
//修改人
org.setUpdater(userInfo==null?null:userInfo.getId());
/**
*添加的时候检测机构编号是否已存在
* */
if(StringUtil.isNotEmpty(org.getOrgNo())){
checkOrgNoIsExists(org.getOrgNo(),null);
}
/**
* 未指定父级机构的时候默认放在根机构下
* */
if(StringUtil.isEmpty(org.getOrgParentNo())){
org.setOrgParentNo(BusinessConstants.ORGANIZATION_ROOT_NO);
}
return organizationMapperEx.addOrganization(org);
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int editOrganization(Organization org)throws Exception {
//修改时间
org.setUpdateTime(new Date());
User userInfo=userService.getCurrentUser();
//修改人
org.setUpdater(userInfo==null?null:userInfo.getId());
/**
* 修改的时候检测机构编号是否已存在
* */
if(StringUtil.isNotEmpty(org.getOrgNo())){
checkOrgNoIsExists(org.getOrgNo(),org.getId());
}
/**
* 未指定父级机构的时候默认放在根机构下
* */
if(StringUtil.isEmpty(org.getOrgParentNo())){
org.setOrgParentNo(BusinessConstants.ORGANIZATION_ROOT_NO);
}
/**
* 添加一个限制,根机构不允许修改
* */
if(BusinessConstants.ORGANIZATION_ROOT_NO.equals(org.getOrgNo())){
logger.error("异常码[{}],异常提示[{}],参数,orgNo[{}]",
ExceptionConstants.ORGANIZATION_ROOT_NOT_ALLOWED_EDIT_CODE,ExceptionConstants.ORGANIZATION_ROOT_NOT_ALLOWED_EDIT_MSG,org.getOrgNo());
throw new BusinessRunTimeException(ExceptionConstants.ORGANIZATION_ROOT_NOT_ALLOWED_EDIT_CODE,
ExceptionConstants.ORGANIZATION_ROOT_NOT_ALLOWED_EDIT_MSG);
}
return organizationMapperEx.editOrganization(org);
}
public List<TreeNode> getOrganizationTree()throws Exception {
return organizationMapperEx.getNodeTree();
}
public List<Organization> findById(Long id) throws Exception{
OrganizationExample example = new OrganizationExample();
example.createCriteria().andIdEqualTo(id);
return organizationMapper.selectByExample(example);
}
public List<Organization> findByOrgNo(String orgNo)throws Exception {
OrganizationExample example = new OrganizationExample();
example.createCriteria().andOrgNoEqualTo(orgNo).andOrgStcdNotEqualTo(BusinessConstants.ORGANIZATION_STCD_REMOVED);
return organizationMapper.selectByExample(example);
}
/**
* create by: cjl
* description:
* 检查机构编号是否已经存在
* create time: 2019/3/7 10:01
* @Param: orgNo
* @return void
*/
public void checkOrgNoIsExists(String orgNo,Long id)throws Exception {
List<Organization> orgList=findByOrgNo(orgNo);
if(orgList!=null&&orgList.size()>0){
if(orgList.size()>1){
logger.error("异常码[{}],异常提示[{}],参数,orgNo[{}]",
ExceptionConstants.ORGANIZATION_NO_ALREADY_EXISTS_CODE,ExceptionConstants.ORGANIZATION_NO_ALREADY_EXISTS_MSG,orgNo);
//获取的数据条数大于1机构编号已存在
throw new BusinessRunTimeException(ExceptionConstants.ORGANIZATION_NO_ALREADY_EXISTS_CODE,
ExceptionConstants.ORGANIZATION_NO_ALREADY_EXISTS_MSG);
}
if(id!=null){
if(!orgList.get(0).getId().equals(id)){
//数据条数等于1但是和编辑的数据的id不相同
logger.error("异常码[{}],异常提示[{}],参数,orgNo[{}],id[{}]",
ExceptionConstants.ORGANIZATION_NO_ALREADY_EXISTS_CODE,ExceptionConstants.ORGANIZATION_NO_ALREADY_EXISTS_MSG,orgNo,id);
throw new BusinessRunTimeException(ExceptionConstants.ORGANIZATION_NO_ALREADY_EXISTS_CODE,
ExceptionConstants.ORGANIZATION_NO_ALREADY_EXISTS_MSG);
}
}else{
logger.error("异常码[{}],异常提示[{}],参数,orgNo[{}]",
ExceptionConstants.ORGANIZATION_NO_ALREADY_EXISTS_CODE,ExceptionConstants.ORGANIZATION_NO_ALREADY_EXISTS_MSG,orgNo);
//数据条数等于1但此时是新增
throw new BusinessRunTimeException(ExceptionConstants.ORGANIZATION_NO_ALREADY_EXISTS_CODE,
ExceptionConstants.ORGANIZATION_NO_ALREADY_EXISTS_MSG);
}
}
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteOrganizationByIds(String ids) throws Exception{
User userInfo=userService.getCurrentUser();
String [] idArray=ids.split(",");
/**
* 添加一个限制,根机构不允许删除
* */
List<Organization> orgRootList=organizationMapperEx.getOrganizationRootByIds(idArray);
if(orgRootList!=null&&orgRootList.size()>0){
logger.error("异常码[{}],异常提示[{}],参数,ids[{}]",
ExceptionConstants.ORGANIZATION_ROOT_NOT_ALLOWED_DELETE_CODE,ExceptionConstants.ORGANIZATION_ROOT_NOT_ALLOWED_DELETE_MSG,ids);
throw new BusinessRunTimeException(ExceptionConstants.ORGANIZATION_ROOT_NOT_ALLOWED_DELETE_CODE,
ExceptionConstants.ORGANIZATION_ROOT_NOT_ALLOWED_DELETE_MSG);
}
return organizationMapperEx.batchDeleteOrganizationByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
}
}

View File

@@ -0,0 +1,336 @@
<?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.jsh.erp.datasource.mappers.OrgaUserRelMapper" >
<resultMap id="BaseResultMap" type="com.jsh.erp.datasource.entities.OrgaUserRel" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<id column="id" property="id" jdbcType="BIGINT" />
<result column="orga_id" property="orgaId" jdbcType="BIGINT" />
<result column="user_id" property="userId" jdbcType="BIGINT" />
<result column="user_blng_orga_dspl_seq" property="userBlngOrgaDsplSeq" jdbcType="VARCHAR" />
<result column="delete_flag" property="deleteFlag" jdbcType="CHAR" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="creator" property="creator" jdbcType="BIGINT" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
<result column="updater" property="updater" jdbcType="BIGINT" />
</resultMap>
<sql id="Example_Where_Clause" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<where >
<foreach collection="oredCriteria" item="criteria" separator="or" >
<if test="criteria.valid" >
<trim prefix="(" suffix=")" prefixOverrides="and" >
<foreach collection="criteria.criteria" item="criterion" >
<choose >
<when test="criterion.noValue" >
and ${criterion.condition}
</when>
<when test="criterion.singleValue" >
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue" >
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue" >
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<where >
<foreach collection="example.oredCriteria" item="criteria" separator="or" >
<if test="criteria.valid" >
<trim prefix="(" suffix=")" prefixOverrides="and" >
<foreach collection="criteria.criteria" item="criterion" >
<choose >
<when test="criterion.noValue" >
and ${criterion.condition}
</when>
<when test="criterion.singleValue" >
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue" >
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue" >
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
id, orga_id, user_id, user_blng_orga_dspl_seq, delete_flag, create_time, creator,
update_time, updater
</sql>
<select id="selectByExample" resultMap="BaseResultMap" parameterType="com.jsh.erp.datasource.entities.OrgaUserRelExample" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<if test="distinct" >
distinct
</if>
<include refid="Base_Column_List" />
from jsh_orga_user_rel
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null" >
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<include refid="Base_Column_List" />
from jsh_orga_user_rel
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from jsh_orga_user_rel
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.jsh.erp.datasource.entities.OrgaUserRelExample" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from jsh_orga_user_rel
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.jsh.erp.datasource.entities.OrgaUserRel" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into jsh_orga_user_rel (id, orga_id, user_id,
user_blng_orga_dspl_seq, delete_flag, create_time,
creator, update_time, updater
)
values (#{id,jdbcType=BIGINT}, #{orgaId,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT},
#{userBlngOrgaDsplSeq,jdbcType=VARCHAR}, #{deleteFlag,jdbcType=CHAR}, #{createTime,jdbcType=TIMESTAMP},
#{creator,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP}, #{updater,jdbcType=BIGINT}
)
</insert>
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.OrgaUserRel" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into jsh_orga_user_rel
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="orgaId != null" >
orga_id,
</if>
<if test="userId != null" >
user_id,
</if>
<if test="userBlngOrgaDsplSeq != null" >
user_blng_orga_dspl_seq,
</if>
<if test="deleteFlag != null" >
delete_flag,
</if>
<if test="createTime != null" >
create_time,
</if>
<if test="creator != null" >
creator,
</if>
<if test="updateTime != null" >
update_time,
</if>
<if test="updater != null" >
updater,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=BIGINT},
</if>
<if test="orgaId != null" >
#{orgaId,jdbcType=BIGINT},
</if>
<if test="userId != null" >
#{userId,jdbcType=BIGINT},
</if>
<if test="userBlngOrgaDsplSeq != null" >
#{userBlngOrgaDsplSeq,jdbcType=VARCHAR},
</if>
<if test="deleteFlag != null" >
#{deleteFlag,jdbcType=CHAR},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="creator != null" >
#{creator,jdbcType=BIGINT},
</if>
<if test="updateTime != null" >
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="updater != null" >
#{updater,jdbcType=BIGINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.jsh.erp.datasource.entities.OrgaUserRelExample" resultType="java.lang.Integer" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select count(*) from jsh_orga_user_rel
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update jsh_orga_user_rel
<set >
<if test="record.id != null" >
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.orgaId != null" >
orga_id = #{record.orgaId,jdbcType=BIGINT},
</if>
<if test="record.userId != null" >
user_id = #{record.userId,jdbcType=BIGINT},
</if>
<if test="record.userBlngOrgaDsplSeq != null" >
user_blng_orga_dspl_seq = #{record.userBlngOrgaDsplSeq,jdbcType=VARCHAR},
</if>
<if test="record.deleteFlag != null" >
delete_flag = #{record.deleteFlag,jdbcType=CHAR},
</if>
<if test="record.createTime != null" >
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.creator != null" >
creator = #{record.creator,jdbcType=BIGINT},
</if>
<if test="record.updateTime != null" >
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
</if>
<if test="record.updater != null" >
updater = #{record.updater,jdbcType=BIGINT},
</if>
</set>
<if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update jsh_orga_user_rel
set id = #{record.id,jdbcType=BIGINT},
orga_id = #{record.orgaId,jdbcType=BIGINT},
user_id = #{record.userId,jdbcType=BIGINT},
user_blng_orga_dspl_seq = #{record.userBlngOrgaDsplSeq,jdbcType=VARCHAR},
delete_flag = #{record.deleteFlag,jdbcType=CHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
creator = #{record.creator,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
updater = #{record.updater,jdbcType=BIGINT}
<if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.jsh.erp.datasource.entities.OrgaUserRel" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update jsh_orga_user_rel
<set >
<if test="orgaId != null" >
orga_id = #{orgaId,jdbcType=BIGINT},
</if>
<if test="userId != null" >
user_id = #{userId,jdbcType=BIGINT},
</if>
<if test="userBlngOrgaDsplSeq != null" >
user_blng_orga_dspl_seq = #{userBlngOrgaDsplSeq,jdbcType=VARCHAR},
</if>
<if test="deleteFlag != null" >
delete_flag = #{deleteFlag,jdbcType=CHAR},
</if>
<if test="createTime != null" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="creator != null" >
creator = #{creator,jdbcType=BIGINT},
</if>
<if test="updateTime != null" >
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="updater != null" >
updater = #{updater,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.jsh.erp.datasource.entities.OrgaUserRel" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update jsh_orga_user_rel
set orga_id = #{orgaId,jdbcType=BIGINT},
user_id = #{userId,jdbcType=BIGINT},
user_blng_orga_dspl_seq = #{userBlngOrgaDsplSeq,jdbcType=VARCHAR},
delete_flag = #{deleteFlag,jdbcType=CHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
creator = #{creator,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=TIMESTAMP},
updater = #{updater,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@@ -0,0 +1,430 @@
<?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.jsh.erp.datasource.mappers.OrganizationMapper">
<resultMap id="BaseResultMap" type="com.jsh.erp.datasource.entities.Organization">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="org_no" jdbcType="VARCHAR" property="orgNo" />
<result column="org_full_name" jdbcType="VARCHAR" property="orgFullName" />
<result column="org_abr" jdbcType="VARCHAR" property="orgAbr" />
<result column="org_tpcd" jdbcType="VARCHAR" property="orgTpcd" />
<result column="org_stcd" jdbcType="CHAR" property="orgStcd" />
<result column="org_parent_no" jdbcType="VARCHAR" property="orgParentNo" />
<result column="sort" jdbcType="VARCHAR" property="sort" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="creator" jdbcType="BIGINT" property="creator" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="updater" jdbcType="BIGINT" property="updater" />
<result column="org_create_time" jdbcType="TIMESTAMP" property="orgCreateTime" />
<result column="org_stop_time" jdbcType="TIMESTAMP" property="orgStopTime" />
</resultMap>
<sql id="Example_Where_Clause">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
id, org_no, org_full_name, org_abr, org_tpcd, org_stcd, org_parent_no, sort, remark,
create_time, creator, update_time, updater, org_create_time, org_stop_time
</sql>
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.OrganizationExample" resultMap="BaseResultMap">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from jsh_organization
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<include refid="Base_Column_List" />
from jsh_organization
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from jsh_organization
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.jsh.erp.datasource.entities.OrganizationExample">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from jsh_organization
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.jsh.erp.datasource.entities.Organization">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into jsh_organization (id, org_no, org_full_name,
org_abr, org_tpcd, org_stcd,
org_parent_no, sort, remark,
create_time, creator, update_time,
updater, org_create_time, org_stop_time
)
values (#{id,jdbcType=BIGINT}, #{orgNo,jdbcType=VARCHAR}, #{orgFullName,jdbcType=VARCHAR},
#{orgAbr,jdbcType=VARCHAR}, #{orgTpcd,jdbcType=VARCHAR}, #{orgStcd,jdbcType=CHAR},
#{orgParentNo,jdbcType=VARCHAR}, #{sort,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{creator,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP},
#{updater,jdbcType=BIGINT}, #{orgCreateTime,jdbcType=TIMESTAMP}, #{orgStopTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.Organization">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into jsh_organization
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="orgNo != null">
org_no,
</if>
<if test="orgFullName != null">
org_full_name,
</if>
<if test="orgAbr != null">
org_abr,
</if>
<if test="orgTpcd != null">
org_tpcd,
</if>
<if test="orgStcd != null">
org_stcd,
</if>
<if test="orgParentNo != null">
org_parent_no,
</if>
<if test="sort != null">
sort,
</if>
<if test="remark != null">
remark,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="creator != null">
creator,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="updater != null">
updater,
</if>
<if test="orgCreateTime != null">
org_create_time,
</if>
<if test="orgStopTime != null">
org_stop_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="orgNo != null">
#{orgNo,jdbcType=VARCHAR},
</if>
<if test="orgFullName != null">
#{orgFullName,jdbcType=VARCHAR},
</if>
<if test="orgAbr != null">
#{orgAbr,jdbcType=VARCHAR},
</if>
<if test="orgTpcd != null">
#{orgTpcd,jdbcType=VARCHAR},
</if>
<if test="orgStcd != null">
#{orgStcd,jdbcType=CHAR},
</if>
<if test="orgParentNo != null">
#{orgParentNo,jdbcType=VARCHAR},
</if>
<if test="sort != null">
#{sort,jdbcType=VARCHAR},
</if>
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="creator != null">
#{creator,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="updater != null">
#{updater,jdbcType=BIGINT},
</if>
<if test="orgCreateTime != null">
#{orgCreateTime,jdbcType=TIMESTAMP},
</if>
<if test="orgStopTime != null">
#{orgStopTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.jsh.erp.datasource.entities.OrganizationExample" resultType="java.lang.Integer">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select count(*) from jsh_organization
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update jsh_organization
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.orgNo != null">
org_no = #{record.orgNo,jdbcType=VARCHAR},
</if>
<if test="record.orgFullName != null">
org_full_name = #{record.orgFullName,jdbcType=VARCHAR},
</if>
<if test="record.orgAbr != null">
org_abr = #{record.orgAbr,jdbcType=VARCHAR},
</if>
<if test="record.orgTpcd != null">
org_tpcd = #{record.orgTpcd,jdbcType=VARCHAR},
</if>
<if test="record.orgStcd != null">
org_stcd = #{record.orgStcd,jdbcType=CHAR},
</if>
<if test="record.orgParentNo != null">
org_parent_no = #{record.orgParentNo,jdbcType=VARCHAR},
</if>
<if test="record.sort != null">
sort = #{record.sort,jdbcType=VARCHAR},
</if>
<if test="record.remark != null">
remark = #{record.remark,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.creator != null">
creator = #{record.creator,jdbcType=BIGINT},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
</if>
<if test="record.updater != null">
updater = #{record.updater,jdbcType=BIGINT},
</if>
<if test="record.orgCreateTime != null">
org_create_time = #{record.orgCreateTime,jdbcType=TIMESTAMP},
</if>
<if test="record.orgStopTime != null">
org_stop_time = #{record.orgStopTime,jdbcType=TIMESTAMP},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update jsh_organization
set id = #{record.id,jdbcType=BIGINT},
org_no = #{record.orgNo,jdbcType=VARCHAR},
org_full_name = #{record.orgFullName,jdbcType=VARCHAR},
org_abr = #{record.orgAbr,jdbcType=VARCHAR},
org_tpcd = #{record.orgTpcd,jdbcType=VARCHAR},
org_stcd = #{record.orgStcd,jdbcType=CHAR},
org_parent_no = #{record.orgParentNo,jdbcType=VARCHAR},
sort = #{record.sort,jdbcType=VARCHAR},
remark = #{record.remark,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
creator = #{record.creator,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
updater = #{record.updater,jdbcType=BIGINT},
org_create_time = #{record.orgCreateTime,jdbcType=TIMESTAMP},
org_stop_time = #{record.orgStopTime,jdbcType=TIMESTAMP}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.jsh.erp.datasource.entities.Organization">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update jsh_organization
<set>
<if test="orgNo != null">
org_no = #{orgNo,jdbcType=VARCHAR},
</if>
<if test="orgFullName != null">
org_full_name = #{orgFullName,jdbcType=VARCHAR},
</if>
<if test="orgAbr != null">
org_abr = #{orgAbr,jdbcType=VARCHAR},
</if>
<if test="orgTpcd != null">
org_tpcd = #{orgTpcd,jdbcType=VARCHAR},
</if>
<if test="orgStcd != null">
org_stcd = #{orgStcd,jdbcType=CHAR},
</if>
<if test="orgParentNo != null">
org_parent_no = #{orgParentNo,jdbcType=VARCHAR},
</if>
<if test="sort != null">
sort = #{sort,jdbcType=VARCHAR},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="creator != null">
creator = #{creator,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="updater != null">
updater = #{updater,jdbcType=BIGINT},
</if>
<if test="orgCreateTime != null">
org_create_time = #{orgCreateTime,jdbcType=TIMESTAMP},
</if>
<if test="orgStopTime != null">
org_stop_time = #{orgStopTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.jsh.erp.datasource.entities.Organization">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update jsh_organization
set org_no = #{orgNo,jdbcType=VARCHAR},
org_full_name = #{orgFullName,jdbcType=VARCHAR},
org_abr = #{orgAbr,jdbcType=VARCHAR},
org_tpcd = #{orgTpcd,jdbcType=VARCHAR},
org_stcd = #{orgStcd,jdbcType=CHAR},
org_parent_no = #{orgParentNo,jdbcType=VARCHAR},
sort = #{sort,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
creator = #{creator,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=TIMESTAMP},
updater = #{updater,jdbcType=BIGINT},
org_create_time = #{orgCreateTime,jdbcType=TIMESTAMP},
org_stop_time = #{orgStopTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@@ -0,0 +1,92 @@
<?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.jsh.erp.datasource.mappers.OrganizationMapperEx">
<resultMap id="BaseTreeResultMap" type="com.jsh.erp.datasource.vo.TreeNode">
<result column="id" property="id"/>
<result column="org_abr" property="text"/>
<result column="org_no" property="attributes"/>
<collection column="org_no" property="children" javaType="java.util.ArrayList"
ofType="com.jsh.erp.datasource.vo.TreeNode" select="getNextNodeTree"/>
</resultMap>
<resultMap id="NextTreeResultMap" type="com.jsh.erp.datasource.vo.TreeNode">
<result column="id" property="id"/>
<result column="org_abr" property="text"/>
<result column="org_no" property="attributes"/>
<collection column="org_no" property="children" javaType="java.util.ArrayList"
ofType="com.jsh.erp.datasource.vo.TreeNode" select="getNextNodeTree"/>
</resultMap>
<sql id="Base_Column_List">
id, org_abr,org_no
</sql>
<select id="getNextNodeTree" resultMap="NextTreeResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM jsh_organization
WHERE org_parent_no = #{org_no}
and org_stcd !='5'
order by sort asc
</select>
<select id="getNodeTree" resultMap="BaseTreeResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM jsh_organization
WHERE org_parent_no = -1
and org_stcd !='5'
order by sort asc
</select>
<insert id="addOrganization" parameterType="com.jsh.erp.datasource.entities.Organization"
useGeneratedKeys="true" keyProperty="id" keyColumn="id">
insert into jsh_organization
(org_no, org_full_name,
org_abr, org_tpcd, org_stcd,
org_parent_no, sort, remark,
create_time, creator, update_time,
updater, org_create_time, org_stop_time)
values
(#{orgNo,jdbcType=VARCHAR}, #{orgFullName,jdbcType=VARCHAR},
#{orgAbr,jdbcType=VARCHAR}, #{orgTpcd,jdbcType=VARCHAR}, #{orgStcd,jdbcType=CHAR},
#{orgParentNo,jdbcType=VARCHAR}, #{sort,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{creator,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP},
#{updater,jdbcType=BIGINT}, #{orgCreateTime,jdbcType=TIMESTAMP}, #{orgStopTime,jdbcType=TIMESTAMP}
)
</insert>
<update id="batchDeleteOrganizationByIds">
update jsh_organization
set update_Time=#{updateTime},updater=#{updater},org_stcd='5'
where id in (
<foreach collection="ids" item="id" separator=",">
#{id}
</foreach>
)
</update>
<update id="editOrganization">
update jsh_organization
set update_time=#{updateTime},updater=#{updater},
org_no = #{orgNo},org_full_name = #{orgFullName},
org_abr = #{orgAbr},org_tpcd = #{orgTpcd},
org_stcd = #{orgStcd},org_parent_no = #{orgParentNo},
sort = #{sort},remark = #{remark},
org_create_time = #{orgCreateTime},org_stop_time = #{orgStopTime}
where id =#{id}
</update>
<select id="getOrganizationRootByIds" resultMap="com.jsh.erp.datasource.mappers.OrganizationMapper.BaseResultMap">
select * from jsh_organization
where
1=1
and org_stcd!='5'
and org_parent_no='-1'
and org_abr='根机构'
and id in (
<foreach collection="ids" item="id" separator=",">
#{id}
</foreach>
)
</select>
</mapper>

View File

@@ -48,7 +48,7 @@
<table tableName="jsh_asset" domainObjectName="Asset"></table>
<table tableName="jsh_assetcategory" domainObjectName="AssetCategory"></table>
<table tableName="jsh_assetname" domainObjectName="AssetName"></table>-->
<table tableName="jsh_depot" domainObjectName="Depot"></table>
<!--<table tableName="jsh_depot" domainObjectName="Depot"></table>-->
<!--<table tableName="jsh_depothead" domainObjectName="DepotHead"></table>
<table tableName="jsh_depotitem" domainObjectName="DepotItem"></table>
<table tableName="jsh_functions" domainObjectName="Functions"></table>
@@ -65,5 +65,7 @@
<table tableName="jsh_user" domainObjectName="User"></table>
<table tableName="jsh_userbusiness" domainObjectName="UserBusiness"></table>-->
<!--<table tableName="jsh_serial_number" domainObjectName="SerialNumber"></table>-->
<table tableName="jsh_organization" domainObjectName="Organization"></table>
<!--<table tableName="jsh_orga_user_rel" domainObjectName="OrgaUserRel"></table>-->
</context>
</generatorConfiguration>