!61 修改注册页面版本显示问题

Merge pull request !61 from 乾坤平台/jshdev
This commit is contained in:
季圣华
2019-11-08 21:55:04 +08:00
committed by Gitee
15 changed files with 1757 additions and 4258 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,672 +0,0 @@
---------------------------------------------------------------------------------------------------
****注意第一次初始化数据库不需要执行下面的内容,该文档会随着代码更新持续更新,方便大家手动升级数据库****
****注意第一次初始化数据库不需要执行下面的内容,该文档会随着代码更新持续更新,方便大家手动升级数据库****
****注意第一次初始化数据库不需要执行下面的内容,该文档会随着代码更新持续更新,方便大家手动升级数据库****
---------------------------------------------------------------------------------------------------
-- ----------------------------
-- 时间2019年1月21日
-- version1.0.0
-- 此次更新添加序列号功能
-- 特别提醒之后的sql都是在之前基础上迭代可以对已存在的系统进行数据保留更新
-- ----------------------------
-- ----------------------------
-- 添加序列号表
-- ----------------------------
DROP TABLE IF EXISTS `jsh_serial_number`;
CREATE TABLE `jsh_serial_number` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`material_Id` bigint(20) DEFAULT NULL COMMENT '产品表id',
`serial_Number` varchar(64) DEFAULT NULL COMMENT '序列号',
`is_Sell` bit(1) DEFAULT 0 COMMENT '是否卖出0未卖出1卖出',
`remark` varchar(1024) DEFAULT NULL COMMENT '备注',
`delete_Flag` bit(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='序列号表';
-- ----------------------------
-- 产品表新增字段是否启用序列号
-- ----------------------------
alter table jsh_material add enableSerialNumber bit(1) DEFAULT 0 COMMENT '是否开启序列号0否1是';
-- ----------------------------
-- 时间2019年1月24日
-- version1.0.1
-- 此次更新添加序列号菜单
-- 特别提醒之后的sql都是在之前基础上迭代可以对已存在的系统进行数据保留更新
-- ----------------------------
-- ----------------------------
-- 添加序列号菜单
-- ----------------------------
delete from `jsh_functions` where Name='序列号';
INSERT INTO `jsh_functions`(`Number`, `Name`, `PNumber`, `URL`, `State`, `Sort`, `Enabled`, `Type`, `PushBtn`) VALUES ('010104', '序列号', '0101', '../manage/serialNumber.html', b'0', '0246', b'1', '电脑版', '');
-- ----------------------------
-- 删除单据主表供应商id字段对应外键约束
-- ----------------------------
ALTER TABLE jsh_depothead DROP FOREIGN KEY jsh_depothead_ibfk_3;
-- ----------------------------
-- 序列号表添加单据主表id字段用于跟踪序列号流向
-- ----------------------------
alter table jsh_serial_number add depothead_Id bigint(20) DEFAULT null COMMENT '单据主表id用于跟踪序列号流向';
-- ----------------------------
-- 修改商品表enableSerialNumber字段类型为varchar(1)
-- ----------------------------
alter table jsh_material change enableSerialNumber enableSerialNumber varchar(1) DEFAULT '0' COMMENT '是否开启序列号0否1是';
-- ----------------------------
-- 修改序列号表is_Sell字段类型为varchar(1)
-- 修改序列号表delete_Flag字段类型为varchar(1)
-- ----------------------------
alter table jsh_serial_number change is_Sell is_Sell varchar(1) DEFAULT '0' COMMENT '是否卖出0未卖出1卖出';
alter table jsh_serial_number change delete_Flag delete_Flag varchar(1) DEFAULT '0' COMMENT '删除标记0未删除1删除';
-- ----------------------------
-- 删除单据子表单据主表id字段对应外键约束
-- ----------------------------
ALTER TABLE jsh_depotitem DROP FOREIGN KEY jsh_depotitem_ibfk_1;
-- ----------------------------
-- 时间2019年2月1日
-- version1.0.2
-- 此次更新添加sequence表用于获取一个唯一的数值
-- 特别提醒之后的sql都是在之前基础上迭代可以对已存在的系统进行数据保留更新
-- ----------------------------
-- ----------------------------
-- 添加表tbl_sequence
-- ----------------------------
DROP TABLE IF EXISTS `tbl_sequence`;
CREATE TABLE tbl_sequence (
seq_name VARCHAR(50) NOT NULL COMMENT '序列名称',
min_value bigint(20) NOT NULL COMMENT '最小值',
max_value bigint(20) NOT NULL COMMENT '最大值',
current_val bigint(20) NOT NULL COMMENT '当前值',
increment_val INT DEFAULT '1' NOT NULL COMMENT '增长步数',
remark VARCHAR(500) DEFAULT null COMMENT '备注',
PRIMARY KEY (seq_name)
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='sequence表';
-- ----------------------------
-- 添加表单据编号sequence
-- 插入数据前判断,防止数据重复插入
-- ----------------------------
insert into tbl_sequence (seq_name, min_value, max_value, current_val, increment_val,remark)
select 'depot_number_seq', 1, 999999999999999999, 1, 1,'单据编号sequence' from dual where not exists
(select * from tbl_sequence where seq_name='depot_number_seq');
-- ----------------------------
-- 创建function _nextval() 用于获取当前序列号
-- ----------------------------
DROP FUNCTION IF EXISTS `_nextval`;
DELIMITER ;;
CREATE FUNCTION `_nextval`(name varchar(50)) RETURNS mediumtext CHARSET utf8
begin
declare _cur bigint;
declare _maxvalue bigint; -- 接收最大值
declare _increment int; -- 接收增长步数
set _increment = (select increment_val from tbl_sequence where seq_name = name);
set _maxvalue = (select max_value from tbl_sequence where seq_name = name);
set _cur = (select current_val from tbl_sequence where seq_name = name for update);
update tbl_sequence -- 更新当前值
set current_val = _cur + increment_val
where seq_name = name ;
if(_cur + _increment >= _maxvalue) then -- 判断是都达到最大值
update tbl_sequence
set current_val = minvalue
where seq_name = name ;
end if;
return _cur;
end
;;
DELIMITER ;
-- ----------------------------
-- 时间2019年2月18日
-- version1.0.3
-- 此次更新修改产品类型表jsh_materialcategory添加一些字段
-- 特别提醒之后的sql都是在之前基础上迭代可以对已存在的系统进行数据保留更新
-- ----------------------------
-- ----------------------------
-- 产品类型表添加字段sort显示顺序
-- ----------------------------
alter table jsh_materialcategory add sort varchar(10) DEFAULT null COMMENT '显示顺序';
-- ----------------------------
-- 产品类型表添加字段status状态0系统默认1启用2删除
-- ----------------------------
alter table jsh_materialcategory add status varchar(1) DEFAULT '0' COMMENT '状态0系统默认1启用2删除';
-- ----------------------------
-- 产品类型表添加字段serial_no编号
-- ----------------------------
alter table jsh_materialcategory add serial_no varchar(100) DEFAULT null COMMENT '编号';
-- ----------------------------
-- 产品类型表添加字段remark备注
-- ----------------------------
alter table jsh_materialcategory add remark varchar(1024) DEFAULT null COMMENT '备注';
-- ----------------------------
-- 产品类型表添加字段create_time创建时间
-- ----------------------------
alter table jsh_materialcategory add create_time datetime DEFAULT null COMMENT '创建时间';
-- ----------------------------
-- 产品类型表添加字段creator创建人
-- ----------------------------
alter table jsh_materialcategory add creator bigint(20) DEFAULT null COMMENT '创建人';
-- ----------------------------
-- 产品类型表添加字段update_time更新时间
-- ----------------------------
alter table jsh_materialcategory add update_time datetime DEFAULT null COMMENT '更新时间';
-- ----------------------------
-- 产品类型表添加字段updater更新人
-- ----------------------------
alter table jsh_materialcategory add updater bigint(20) DEFAULT null COMMENT '更新人';
-- ----------------------------
-- 去掉jsh_materialcategory外键
-- ----------------------------
ALTER TABLE jsh_materialcategory DROP FOREIGN KEY FK3EE7F725237A77D8;
-- ----------------------------
-- 修改根目录父节点id为-1
-- 设置根目录编号为1
-- ----------------------------
update jsh_materialcategory set ParentId='-1' where id='1';
-- ----------------------------
-- 删除礼品卡管理、礼品充值、礼品销售、礼品卡统计的功能数据
-- ----------------------------
delete from jsh_functions where id in (213,214,215,216);
-- ----------------------------
-- 新增采购订单、销售订单的功能数据
-- 主键自增长,直接指定主键插入数据的方式可能会和本地数据冲突
-- 插入数据前判断,防止数据重复插入
-- ----------------------------
insert into `jsh_functions`(`Number`, `Name`, `PNumber`, `URL`, `State`, `Sort`, `Enabled`, `Type`, `PushBtn`)
select '050202', '采购订单', '0502', '../materials/purchase_orders_list.html', b'0', '0335',b'1', '电脑版', '' from dual where not exists
(select * from jsh_functions where Number='050202' and PNumber='0502');
insert into `jsh_functions`(`Number`, `Name`, `PNumber`, `URL`, `State`, `Sort`, `Enabled`, `Type`, `PushBtn`)
select '060301', '销售订单', '0603', '../materials/sale_orders_list.html', b'0', '0392', b'1', '电脑版', '' from dual where not exists
(select * from jsh_functions where Number='060301' and PNumber='0603');
-- ----------------------------
-- 改管理员的功能权限
-- ----------------------------
update jsh_userbusiness SET Type = 'RoleFunctions', KeyId = '4',
Value = '[13][12][16][14][15][234][236][22][23][220][240][25][217][218][26][194][195][31][59][207][208][209][226][227][228][229][235][237][210][211][242][33][199][243][41][200][201][202][40][232][233][197][203][204][205][206][212]'
where Id = 5;
-- ----------------------------
-- 时间2019年2月25日
-- version1.0.4
-- 此次更新仓库添加负责人信息,负责人信息从用户表获取
-- 特别提醒之后的sql都是在之前基础上迭代可以对已存在的系统进行数据保留更新
-- ----------------------------
-- ----------------------------
-- 仓库表添加字段principal负责人
-- ----------------------------
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`)
select '000108', '机构管理', '0001', '../manage/organization.html', b'1', '0139', b'1', '电脑版', '' from dual where not exists
(select * from jsh_functions where Number='000108' and PNumber='0001');
-- ----------------------------
-- 添加根机构
-- 插入时判断对应数据是否存在,防止多次执行产生重复数据
-- ----------------------------
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)
select '01', '根机构', '根机构', NULL, '2', '-1', '1', '根机构,初始化存在', NULL, NULL, NULL, NULL, NULL, NULL from dual where not exists
(select * from jsh_organization where org_no='01' and org_abr='根机构' and org_parent_no='-1' );
-- ----------------------------
-- 时间2019年3月9日
-- version1.0.6
-- 此次更新
-- 整改jsh_systemconfig表的字段
-- ----------------------------
alter table jsh_systemconfig drop type;
alter table jsh_systemconfig drop name;
alter table jsh_systemconfig drop value;
alter table jsh_systemconfig drop description;
alter table jsh_systemconfig add company_name varchar(50) DEFAULT null COMMENT '公司名称';
alter table jsh_systemconfig add company_contacts varchar(20) DEFAULT null COMMENT '公司联系人';
alter table jsh_systemconfig add company_address varchar(50) DEFAULT null COMMENT '公司地址';
alter table jsh_systemconfig add company_tel varchar(20) DEFAULT null COMMENT '公司电话';
alter table jsh_systemconfig add company_fax varchar(20) DEFAULT null COMMENT '公司传真';
alter table jsh_systemconfig add company_post_code varchar(20) DEFAULT null COMMENT '公司邮编';
delete from jsh_systemconfig;
insert into jsh_systemconfig (`company_name`, `company_contacts`, `company_address`, `company_tel`, `company_fax`, `company_post_code`) values("南通jshERP公司","张三","南通市通州区某某路","0513-10101010","0513-18181818","226300");
-- ----------------------------
-- 时间2019年3月9日
-- version1.0.7
-- 改管理员的功能权限
-- ----------------------------
update jsh_userbusiness SET
Value = '[13][12][16][243][14][15][234][236][22][23][220][240][25][217][218][26][194][195][31][59][207][208][209][226][227][228][229][235][237][210][211][241][33][199][242][41][200][201][202][40][232][233][197][203][204][205][206][212]'
where Id = 5;
-- ----------------------------
-- 给订单功能加审核和反审核的功能按钮权限
-- ----------------------------
update jsh_functions SET PushBtn = '3' where Number = '050202' and PNumber = '0502';
update jsh_functions SET PushBtn = '3' where Number = '060301' and PNumber = '0603';
-- ----------------------------
-- 改管理员的按钮权限
-- ----------------------------
update jsh_userbusiness SET
BtnStr = '[{"funId":"25","btnStr":"1"},{"funId":"217","btnStr":"1"},{"funId":"218","btnStr":"1"},{"funId":"241","btnStr":"3"},{"funId":"242","btnStr":"3"}]'
where Id = 5;
-- ----------------------------
-- 时间2019年3月10日
-- version1.0.8
-- 改状态字段的类型,增加关联单据字段
-- ----------------------------
alter table jsh_depothead change Status Status varchar(1) DEFAULT '0' COMMENT '状态0未审核、1已审核、2已转采购|销售';
alter table jsh_depothead add `LinkNumber` varchar(50) DEFAULT null COMMENT '关联订单号';
-- ----------------------------
-- 时间2019年3月12日
-- version1.0.9
-- 此次更新
-- 1、根据本地用户表中现有部门生成机构表数据同时重建机构和用户的关联关系
-- 特别提醒之后的sql都是在之前基础上迭代可以对已存在的系统进行数据保留更新
-- ----------------------------
DROP FUNCTION IF EXISTS `_buildOrgAndOrgUserRel`;
DELIMITER ;;
CREATE FUNCTION `_buildOrgAndOrgUserRel` (name varchar(50)) RETURNS mediumtext CHARSET utf8
begin
declare _org_full_name varchar(500); -- 机构全称
declare _org_abr varchar(20); -- 机构简称
declare _sort int default 0;
declare _success_msg varchar(50) default '重建机构及机构用户关系成功'; -- 机构全称
-- 遍历数据结束标志
declare done int DEFAULT 0;
-- 获取用户表中唯一的部门信息列表
declare orgCur cursor for select distinct department from jsh_user where department!='' and department is not null;
-- 将结束标志绑定到游标
declare continue handler for not found set done = 1;
-- 循环部门信息列表在机构表插入数据
-- 打开游标
open orgCur;
-- 开始循环
read_loop: loop
-- 提取游标里的数据,这里只有一个,多个的话也一样;
fetch orgCur into _org_full_name;
-- 声明结束的时候
if done=1 then
leave read_loop;
end if;
-- 这里做你想做的循环的事件
if length(_org_full_name)<=20 then
set _org_abr=_org_full_name;
else
set _org_abr=left(_org_full_name,20);
end if;
set _sort=_sort+1;
insert into jsh_organization (org_full_name, org_abr, org_stcd, org_parent_no, sort, remark)
values (_org_full_name,_org_abr, '1', '01', _sort, '机构表初始化');
begin
declare _userId bigint;
declare _orgId bigint;
-- 遍历数据结束标志
declare ogrUserRelDone int DEFAULT 0;
-- 根据用户表和机构表部门关联关系,重建用户和机构关联关系
declare ogrUserRelCur cursor for select user.id as userId,org.id as orgId from jsh_user user,jsh_organization org
where 1=1 and user.department=org.org_full_name and user.department =_org_full_name;
-- 将结束标志绑定到游标
declare continue handler for not found set ogrUserRelDone = 1;
-- 打开游标
open ogrUserRelCur;
-- 开始循环
rel_read_loop: loop
-- 提取游标里的数据,这里只有一个,多个的话也一样;
fetch ogrUserRelCur into _userId,_orgId;
-- 声明结束的时候
if ogrUserRelDone=1 then
leave rel_read_loop;
end if;
insert into `jsh_orga_user_rel`(`orga_id`, `user_id`, `delete_flag`) VALUES (_orgId,_userId,'0');
end loop rel_read_loop;
-- 关闭游标
close ogrUserRelCur;
end;
end loop read_loop;
-- 关闭游标
close orgCur;
-- 清空用户表中的部门信息
update jsh_user set department=null;
return _success_msg;
end
;;
DELIMITER ;
-- ----------------------------
-- 初始化机构数据,重建机构用户关系
-- ----------------------------
select _buildOrgAndOrgUserRel('初始化机构数据,重建机构用户关系') from dual;
-- ----------------------------
-- 删除一次性函数
-- ----------------------------
DROP FUNCTION _buildOrgAndOrgUserRel;
-- ----------------------------
-- 时间2019年3月13日
-- version1.0.10
-- 此次更新
-- 1、设置用户表的用户状态status默认值为0
-- 特别提醒之后的sql都是在之前基础上迭代可以对已存在的系统进行数据保留更新
-- ----------------------------
alter table jsh_user change Status Status tinyint(4) DEFAULT '0' COMMENT '状态0正常1删除2封禁';
update jsh_user set status='0' where status is null;
-- ----------------------------
-- 设置根目录编号为1
-- ----------------------------
update jsh_materialcategory set serial_no='1' where id='1';
-- ----------------------------
-- 时间2019年3月18日
-- version1.0.11
-- 此次更新
-- 1、批量增加大部分表的tenant_id租户字段
-- 特别提醒之后的sql都是在之前基础上迭代可以对已存在的系统进行数据保留更新
-- ----------------------------
alter table jsh_account add tenant_id bigint(20) DEFAULT null COMMENT '租户id';
alter table jsh_accounthead add tenant_id bigint(20) DEFAULT null COMMENT '租户id';
alter table jsh_accountitem add tenant_id bigint(20) DEFAULT null COMMENT '租户id';
alter table jsh_asset add tenant_id bigint(20) DEFAULT null COMMENT '租户id';
alter table jsh_assetcategory add tenant_id bigint(20) DEFAULT null COMMENT '租户id';
alter table jsh_assetname add tenant_id bigint(20) DEFAULT null COMMENT '租户id';
alter table jsh_depot add tenant_id bigint(20) DEFAULT null COMMENT '租户id';
alter table jsh_depothead add tenant_id bigint(20) DEFAULT null COMMENT '租户id';
alter table jsh_depotitem add tenant_id bigint(20) DEFAULT null COMMENT '租户id';
alter table jsh_inoutitem add tenant_id bigint(20) DEFAULT null COMMENT '租户id';
alter table jsh_log add tenant_id bigint(20) DEFAULT null COMMENT '租户id';
alter table jsh_material add tenant_id bigint(20) DEFAULT null COMMENT '租户id';
alter table jsh_materialcategory add tenant_id bigint(20) DEFAULT null COMMENT '租户id';
alter table jsh_orga_user_rel add tenant_id bigint(20) DEFAULT null COMMENT '租户id';
alter table jsh_organization add tenant_id bigint(20) DEFAULT null COMMENT '租户id';
alter table jsh_person add tenant_id bigint(20) DEFAULT null COMMENT '租户id';
alter table jsh_role add tenant_id bigint(20) DEFAULT null COMMENT '租户id';
alter table jsh_serial_number add tenant_id bigint(20) DEFAULT null COMMENT '租户id';
alter table jsh_supplier add tenant_id bigint(20) DEFAULT null COMMENT '租户id';
alter table jsh_systemconfig add tenant_id bigint(20) DEFAULT null COMMENT '租户id';
alter table jsh_unit add tenant_id bigint(20) DEFAULT null COMMENT '租户id';
alter table jsh_user add tenant_id bigint(20) DEFAULT null COMMENT '租户id';
-- ----------------------------
-- 时间2019年3月27日
-- version1.0.12
-- 此次更新
-- 添加删除标记,将物理删除修改为逻辑删除
-- 特别提醒之后的sql都是在之前基础上迭代可以对已存在的系统进行数据保留更新
-- ----------------------------
-- 角色表 jsh_role
alter table jsh_role add delete_Flag varchar(1) DEFAULT '0' COMMENT '删除标记0未删除1删除';
-- 用户 角色 模块关系表 jsh_userbusiness
alter table jsh_userbusiness add delete_Flag varchar(1) DEFAULT '0' COMMENT '删除标记0未删除1删除';
-- 功能模块表 jsh_functions
alter table jsh_functions add delete_Flag varchar(1) DEFAULT '0' COMMENT '删除标记0未删除1删除';
-- 应用表 jsh_app
alter table jsh_app add delete_Flag varchar(1) DEFAULT '0' COMMENT '删除标记0未删除1删除';
-- 产品表 jsh_material
alter table jsh_material add delete_Flag varchar(1) DEFAULT '0' COMMENT '删除标记0未删除1删除';
-- 产品扩展字段表 jsh_materialproperty
alter table jsh_materialproperty add delete_Flag varchar(1) DEFAULT '0' COMMENT '删除标记0未删除1删除';
-- 经手人表 jsh_person
alter table jsh_person add delete_Flag varchar(1) DEFAULT '0' COMMENT '删除标记0未删除1删除';
-- 供应商 客户信息表 jsh_supplier
alter table jsh_supplier add delete_Flag varchar(1) DEFAULT '0' COMMENT '删除标记0未删除1删除';
-- 系统参数表 jsh_systemconfig
alter table jsh_systemconfig add delete_Flag varchar(1) DEFAULT '0' COMMENT '删除标记0未删除1删除';
-- 多单位表 jsh_unit
alter table jsh_unit add delete_Flag varchar(1) DEFAULT '0' COMMENT '删除标记0未删除1删除';
-- 仓库表 jsh_depot
alter table jsh_depot add delete_Flag varchar(1) DEFAULT '0' COMMENT '删除标记0未删除1删除';
-- 账户信息表 jsh_account
alter table jsh_account add delete_Flag varchar(1) DEFAULT '0' COMMENT '删除标记0未删除1删除';
-- 财务主表 jsh_accounthead
alter table jsh_accounthead add delete_Flag varchar(1) DEFAULT '0' COMMENT '删除标记0未删除1删除';
-- 财务子表 jsh_accountitem
alter table jsh_accountitem add delete_Flag varchar(1) DEFAULT '0' COMMENT '删除标记0未删除1删除';
-- 资产记录表 jsh_asset
alter table jsh_asset add delete_Flag varchar(1) DEFAULT '0' COMMENT '删除标记0未删除1删除';
-- 资产类型表 jsh_assetcategory
alter table jsh_assetcategory add delete_Flag varchar(1) DEFAULT '0' COMMENT '删除标记0未删除1删除';
-- 资产信息表 jsh_assetname
alter table jsh_assetname add delete_Flag varchar(1) DEFAULT '0' COMMENT '删除标记0未删除1删除';
-- 单据主表 jsh_depothead
alter table jsh_depothead add delete_Flag varchar(1) DEFAULT '0' COMMENT '删除标记0未删除1删除';
-- 单据子表 jsh_depotitem
alter table jsh_depotitem add delete_Flag varchar(1) DEFAULT '0' COMMENT '删除标记0未删除1删除';
-- 收支项目表 jsh_inoutitem
alter table jsh_inoutitem add delete_Flag varchar(1) DEFAULT '0' COMMENT '删除标记0未删除1删除';
-- ----------------------------
-- 时间2019年4月11日
-- version1.0.13
-- 此次更新
-- 删除所有外键
-- 特别提醒之后的sql都是在之前基础上迭代可以对已存在的系统进行数据保留更新
-- ----------------------------
-- ----------------------------
-- 删除财务主表对应外键约束
-- ----------------------------
ALTER TABLE jsh_accounthead DROP FOREIGN KEY FK9F4C0D8DAAE50527;
ALTER TABLE jsh_accounthead DROP FOREIGN KEY FK9F4C0D8DB610FC06;
ALTER TABLE jsh_accounthead DROP FOREIGN KEY FK9F4C0D8DC4170B37;
-- ----------------------------
-- 删除财务子表对应外键约束
-- ----------------------------
ALTER TABLE jsh_accountitem DROP FOREIGN KEY FK9F4CBAC0AAE50527;
ALTER TABLE jsh_accountitem DROP FOREIGN KEY FK9F4CBAC0C5FE6007;
ALTER TABLE jsh_accountitem DROP FOREIGN KEY FK9F4CBAC0D203EDC5;
-- ----------------------------
-- 删除资产记录表对应外键约束
-- ----------------------------
ALTER TABLE jsh_asset DROP FOREIGN KEY FK353690ED27D23FE4;
ALTER TABLE jsh_asset DROP FOREIGN KEY FK353690ED3E226853;
ALTER TABLE jsh_asset DROP FOREIGN KEY FK353690ED61FE182C;
ALTER TABLE jsh_asset DROP FOREIGN KEY FK353690ED9B6CB285;
ALTER TABLE jsh_asset DROP FOREIGN KEY FK353690EDAD45B659;
-- ----------------------------
-- 删除资产信息表对应外键约束
-- ----------------------------
ALTER TABLE jsh_assetname DROP FOREIGN KEY FKA4ADCCF866BC8AD3;
-- ----------------------------
-- 删除单据主表对应外键约束
-- ----------------------------
ALTER TABLE jsh_depothead DROP FOREIGN KEY FK2A80F214AAE50527;
ALTER TABLE jsh_depothead DROP FOREIGN KEY jsh_depothead_ibfk_1;
ALTER TABLE jsh_depothead DROP FOREIGN KEY jsh_depothead_ibfk_4;
ALTER TABLE jsh_depothead DROP FOREIGN KEY jsh_depothead_ibfk_5;
-- ----------------------------
-- 删除单据子表对应外键约束
-- ----------------------------
ALTER TABLE jsh_depotitem DROP FOREIGN KEY FK2A819F47729F5392;
ALTER TABLE jsh_depotitem DROP FOREIGN KEY FK2A819F479485B3F5;
ALTER TABLE jsh_depotitem DROP FOREIGN KEY jsh_depotitem_ibfk_2;
-- ----------------------------
-- 删除操作日志表对应外键约束
-- ----------------------------
ALTER TABLE jsh_log DROP FOREIGN KEY FKF2696AA13E226853;
-- ----------------------------
-- 删除产品表对应外键约束
-- ----------------------------
ALTER TABLE jsh_material DROP FOREIGN KEY FK675951272AB6672C;
ALTER TABLE jsh_material DROP FOREIGN KEY jsh_material_ibfk_1;
-- ----------------------------
-- 时间2019年4月30日
-- version1.0.14
-- 此次更新
-- 增加仓库默认功能 增加库存预警功能
-- 特别提醒之后的sql都是在之前基础上迭代可以对已存在的系统进行数据保留更新
-- ----------------------------
alter table jsh_depot add is_default bit(1) DEFAULT NULL COMMENT '是否默认';
insert into `jsh_functions`(`Number`, `Name`, `PNumber`, `URL`, `State`, `Sort`, `Enabled`, `Type`, `PushBtn`)
select '030112', '库存预警', '0301', '../reports/stock_warning_report.html', b'0', '0670', b'1', '电脑版', '' from dual where not exists
(select * from jsh_functions where Number='030112' and PNumber='0301');
-- ----------------------------
-- 改管理员的功能权限
-- ----------------------------
update jsh_userbusiness SET Type = 'RoleFunctions', KeyId = '4',
Value = '[13][12][16][243][14][15][234][236][22][23][220][240][25][217][218][26][194][195][31][59][207][208][209][226][227][228][229][235][237][244][210][211][241][33][199][242][41][200][201][202][40][232][233][197][203][204][205][206][212]'
where Id = 5;
-- ----------------------------
-- 给app的功能增加代号 在功能表增加个人信息
-- ----------------------------
update jsh_app SET Number = '02' where name='个人信息';
insert into `jsh_functions`(`Number`, `Name`, `PNumber`, `URL`, `State`, `Sort`, `Enabled`, `Type`, `PushBtn`)
select '02', '个人信息', '0', '', b'1', '0005', b'1', '电脑版', '' from dual where not exists
(select * from jsh_functions where Number='02' and PNumber='0');
-- ----------------------------
-- 时间2019年6月23日
-- 增加新手引导模块
-- ----------------------------
INSERT INTO `jsh_app` VALUES ('28', '09', '新手引导', 'app', 'userHelp.png', '../user/userHelp.html', '1000', '500', '\0', '\0', '\0', 'dock', '210', '', '', '0');
INSERT INTO `jsh_functions` VALUES ('246', '09', '新手引导', '0', '', '', '0115', '', '电脑版', '', '0');
update jsh_userbusiness SET Value = '[3][6][7][22][23][24][25][26][27][28]'
where Type = 'RoleAPP' and (KeyId = '4' or KeyId = '10');
update jsh_userbusiness SET
Value = '[245][13][12][16][243][14][15][234][236][22][23][220][240][25][217][218][26][194][195][31][59][207][208][209][226][227][228][229][235][237][244][210][211][241][33][199][242][41][200][201][202][40][232][233][197][203][204][205][206][212][246]'
where Type = 'RoleFunctions' and KeyId = '4';
update jsh_userbusiness SET
Value = '[245][13][243][14][15][234][22][23][220][240][25][217][218][26][194][195][31][59][207][208][209][226][227][228][229][235][237][244][210][211][241][33][199][242][41][200][201][202][40][232][233][197][203][204][205][206][212][246]'
where Type = 'RoleFunctions' and KeyId = '10';
-- ----------------------------
-- 时间2019年6月26日
-- 删除多余的资产相关表
-- ----------------------------
drop table jsh_asset;
drop table jsh_assetcategory;
drop table jsh_assetname;
-- ----------------------------
-- 时间2019年6月27日
-- 增加租户表
-- ----------------------------
DROP TABLE IF EXISTS `jsh_tenant`;
CREATE TABLE `jsh_tenant` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`tenant_id` bigint(20) DEFAULT NULL COMMENT '用户id',
`login_name` varchar(255) DEFAULT NULL COMMENT '登录名',
`user_num_limit` int(11) DEFAULT NULL COMMENT '用户数量限制',
`bills_num_limit` int(11) DEFAULT NULL COMMENT '单据数量限制',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=81 DEFAULT CHARSET=utf8 COMMENT='租户';
-- ----------------------------
-- 时间2019年6月27日
-- 给租户表增加数据
-- ----------------------------
INSERT INTO `jsh_tenant` VALUES ('13', '63', 'jsh', '20', '2000', null);
-- ----------------------------
-- 时间2019年7月10日
-- 删除函数
-- ----------------------------
DROP FUNCTION IF EXISTS `_nextval`;
-- ----------------------------
-- 时间2019年8月1日
-- 增加仓库和客户的启用标记
-- ----------------------------
alter table jsh_systemconfig add customer_flag varchar(1) DEFAULT '0' COMMENT '客户启用标记0未启用1启用' after company_post_code;
alter table jsh_systemconfig add depot_flag varchar(1) DEFAULT '0' COMMENT '仓库启用标记0未启用1启用' after company_post_code;
-- ----------------------------
-- 时间2019年9月13日
-- 给功能表增加icon字段
-- ----------------------------
alter table jsh_functions add icon varchar(50) DEFAULT NULL COMMENT '图标' after PushBtn;
-- ----------------------------
-- 时间2019年9月13日
-- 创建消息表
-- ----------------------------
CREATE TABLE `jsh_msg` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键' ,
`msg_title` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '消息标题' ,
`msg_content` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '消息内容' ,
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间' ,
`type` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '消息类型' ,
`status` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '状态1未读 2已读' ,
`tenant_id` bigint(20) NULL DEFAULT NULL COMMENT '租户id' ,
`delete_Flag` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '删除标记0未删除1删除' ,
PRIMARY KEY (`id`)
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
COMMENT='消息表'
AUTO_INCREMENT=2
ROW_FORMAT=COMPACT
;
-- ----------------------------
-- 时间2019年9月13日
-- 删除表 jsh_app databasechangelog databasechangeloglock
-- ----------------------------
drop table databasechangelog;
drop table databasechangeloglock;
drop table jsh_app;

View File

@@ -43,7 +43,7 @@
<div class="register-logo">
<a href="/">
<b>华夏ERP</b>
<small>V1.0</small>
<small>V2.1</small>
</a>
</div>
<div class="register-box-body">

View File

@@ -1,330 +1,330 @@
package com.jsh.erp.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.Functions;
import com.jsh.erp.datasource.entities.User;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.service.functions.FunctionsService;
import com.jsh.erp.service.userBusiness.UserBusinessService;
import com.jsh.erp.utils.BaseResponseInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.dao.DataAccessException;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
* @author ji-sheng-hua 华夏ERP
*/
@RestController
@RequestMapping(value = "/functions")
public class FunctionsController {
private Logger logger = LoggerFactory.getLogger(FunctionsController.class);
@Resource
private FunctionsService functionsService;
@Resource
private UserBusinessService userBusinessService;
@PostMapping(value = "/findMenu")
public JSONArray findMenu(@RequestParam(value="pNumber") String pNumber,
@RequestParam(value="hasFunctions") String hasFunctions,
HttpServletRequest request)throws Exception {
//存放数据json数组
JSONArray dataArray = new JSONArray();
try {
String fc = hasFunctions; //当前用户所拥有的功能列表,格式如:[1][2][5]
List<Functions> dataList = functionsService.getRoleFunctions(pNumber);
if (null != dataList) {
for (Functions functions : dataList) {
JSONObject item = new JSONObject();
item.put("id", functions.getId());
List<Functions> dataList1 = functionsService.getRoleFunctions(functions.getNumber());
JSONArray dataArray1 = new JSONArray();
if (dataList1.size() != 0) {
item.put("text", functions.getName()); //是目录就没链接
item.put("icon", functions.getIcon());
for (Functions functions1 : dataList1) {
item.put("state", "open"); //如果不为空,节点展开
JSONObject item1 = new JSONObject();
List<Functions> dataList2 = functionsService.getRoleFunctions(functions1.getNumber());
if (fc.indexOf("[" + functions1.getId().toString() + "]") != -1 || dataList2.size() != 0) {
item1.put("id", functions1.getId());
JSONArray dataArray2 = new JSONArray();
if (dataList2.size() != 0) {
item1.put("text", functions1.getName());//是目录就没链接
item1.put("icon", functions1.getIcon());
for (Functions functions2 : dataList2) {
item1.put("state", "closed"); //如果不为空,节点不展开
JSONObject item2 = new JSONObject();
List<Functions> dataList3 = functionsService.getRoleFunctions(functions2.getNumber());
if (fc.indexOf("[" + functions2.getId().toString() + "]") != -1 || dataList3.size() != 0) {
item2.put("id", functions2.getId());
JSONArray dataArray3 = new JSONArray();
if (dataList3.size() != 0) {
item2.put("text", functions2.getName());//是目录就没链接
item2.put("icon", functions2.getIcon());
for (Functions functions3 : dataList3) {
item2.put("state", "closed"); //如果不为空,节点不展开
JSONObject item3 = new JSONObject();
item3.put("id", functions3.getId());
item3.put("text", functions3.getName());
item3.put("icon", functions3.getIcon());
//
dataArray3.add(item3);
item2.put("children", dataArray3);
}
} else {
//不是目录,有链接
item2.put("text", functions2.getName());
item2.put("icon", functions2.getIcon());
item2.put("url", functions2.getUrl());
dataArray2.add(item2);
item1.put("children", dataArray2);
}
} else {
//不是目录,有链接
}
}
} else {
//不是目录,有链接
item1.put("text", functions1.getName());
item1.put("icon", functions1.getIcon());
item1.put("url", functions1.getUrl());
dataArray1.add(item1);
item.put("children", dataArray1);
}
} else {
//不是目录,有链接
}
}
} else {
//不是目录,有链接
item.put("text", functions.getName());
item.put("icon", functions.getIcon());
item.put("url", functions.getUrl());
}
dataArray.add(item);
}
}
} catch (DataAccessException e) {
logger.error(">>>>>>>>>>>>>>>>>>>查找应用异常", e);
}
return dataArray;
}
/**
* 角色对应功能显示
* @param request
* @return
*/
@PostMapping(value = "/findRoleFunctions")
public JSONArray findRoleFunctions(@RequestParam("UBType") String type, @RequestParam("UBKeyId") String keyId,
HttpServletRequest request)throws Exception {
JSONArray arr = new JSONArray();
try {
List<Functions> dataListFun = functionsService.findRoleFunctions("0");
//开始拼接json数据
JSONObject outer = new JSONObject();
outer.put("id", 1);
outer.put("text", "功能列表");
outer.put("state", "open");
//存放数据json数组
JSONArray dataArray = new JSONArray();
if (null != dataListFun) {
//根据条件从列表里面移除"系统管理"
List<Functions> dataList = new ArrayList<Functions>();
for (Functions fun : dataListFun) {
//从session中获取租户id
String loginName = null;
Object userInfo = request.getSession().getAttribute("user");
if(userInfo != null) {
User user = (User) userInfo;
loginName = user.getLoginame();
}
if(("admin").equals(loginName)) {
dataList.add(fun);
} else {
if(!("系统管理").equals(fun.getName())) {
dataList.add(fun);
}
}
}
//筛选功能列表
for (Functions functions : dataList) {
JSONObject item = new JSONObject();
item.put("id", functions.getId());
item.put("text", functions.getName());
//勾选判断1
Boolean flag = false;
try {
flag = userBusinessService.checkIsUserBusinessExist(type, keyId, "[" + functions.getId().toString() + "]");
} catch (Exception e) {
logger.error(">>>>>>>>>>>>>>>>>设置角色对应的功能:类型" + type + " KeyId为 " + keyId + " 存在异常!");
}
if (flag == true) {
item.put("checked", true);
}
//结束
List<Functions> dataList1 = functionsService.findRoleFunctions(functions.getNumber());
JSONArray dataArray1 = new JSONArray();
if (null != dataList1) {
for (Functions functions1 : dataList1) {
item.put("state", "open"); //如果不为空,节点不展开
JSONObject item1 = new JSONObject();
item1.put("id", functions1.getId());
item1.put("text", functions1.getName());
//勾选判断2
//Boolean flag = false;
try {
flag = userBusinessService.checkIsUserBusinessExist(type, keyId, "[" + functions1.getId().toString() + "]");
} catch (Exception e) {
logger.error(">>>>>>>>>>>>>>>>>设置角色对应的功能:类型" + type + " KeyId为 " + keyId + " 存在异常!");
}
if (flag == true) {
item1.put("checked", true);
}
//结束
List<Functions> dataList2 = functionsService.findRoleFunctions(functions1.getNumber());
JSONArray dataArray2 = new JSONArray();
if (null != dataList2) {
for (Functions functions2 : dataList2) {
item1.put("state", "closed"); //如果不为空,节点不展开
JSONObject item2 = new JSONObject();
item2.put("id", functions2.getId());
item2.put("text", functions2.getName());
//勾选判断3
//Boolean flag = false;
try {
flag = userBusinessService.checkIsUserBusinessExist(type, keyId, "[" + functions2.getId().toString() + "]");
} catch (Exception e) {
logger.error(">>>>>>>>>>>>>>>>>设置角色对应的功能:类型" + type + " KeyId为 " + keyId + " 存在异常!");
}
if (flag == true) {
item2.put("checked", true);
}
//结束
List<Functions> dataList3 = functionsService.findRoleFunctions(functions2.getNumber());
JSONArray dataArray3 = new JSONArray();
if (null != dataList3) {
for (Functions functions3 : dataList3) {
item2.put("state", "closed"); //如果不为空,节点不展开
JSONObject item3 = new JSONObject();
item3.put("id", functions3.getId());
item3.put("text", functions3.getName());
//勾选判断4
//Boolean flag = false;
try {
flag = userBusinessService.checkIsUserBusinessExist(type, keyId, "[" + functions3.getId().toString() + "]");
} catch (Exception e) {
logger.error(">>>>>>>>>>>>>>>>>设置角色对应的功能:类型" + type + " KeyId为 " + keyId + " 存在异常!");
}
if (flag == true) {
item3.put("checked", true);
}
//结束
dataArray3.add(item3);
item2.put("children", dataArray3);
}
}
dataArray2.add(item2);
item1.put("children", dataArray2);
}
}
dataArray1.add(item1);
item.put("children", dataArray1);
}
}
dataArray.add(item);
}
outer.put("children", dataArray);
arr.add(outer);
}
} catch (Exception e) {
e.printStackTrace();
}
return arr;
}
/**
* 根据id列表查找功能信息
* @param functionsIds
* @param request
* @return
*/
@GetMapping(value = "/findByIds")
public BaseResponseInfo findByIds(@RequestParam("functionsIds") String functionsIds,
HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
try {
List<Functions> dataList = functionsService.findByIds(functionsIds);
JSONObject outer = new JSONObject();
outer.put("total", dataList.size());
//存放数据json数组
JSONArray dataArray = new JSONArray();
if (null != dataList) {
for (Functions functions : dataList) {
JSONObject item = new JSONObject();
item.put("Id", functions.getId());
item.put("Name", functions.getName());
item.put("PushBtn", functions.getPushbtn());
item.put("op", 1);
dataArray.add(item);
}
}
outer.put("rows", dataArray);
res.code = 200;
res.data = outer;
} catch (Exception e) {
e.printStackTrace();
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* create by: qiankunpingtai
* websitehttps://qiankunpingtai.cn
* description:
* 批量删除功能模块信息
* create time: 2019/3/29 11:15
* @Param: ids
* @return java.lang.Object
*/
@RequestMapping(value = "/batchDeleteFunctionsByIds")
public Object batchDeleteFunctionsByIds(@RequestParam("ids") String ids) throws Exception {
JSONObject result = ExceptionConstants.standardSuccess();
int i= functionsService.batchDeleteFunctionsByIds(ids);
if(i<1){
logger.error("异常码[{}],异常提示[{}],参数,ids[{}]",
ExceptionConstants.FUNCTIONS_DELETE_FAILED_CODE,ExceptionConstants.FUNCTIONS_DELETE_FAILED_MSG,ids);
throw new BusinessRunTimeException(ExceptionConstants.FUNCTIONS_DELETE_FAILED_CODE,
ExceptionConstants.FUNCTIONS_DELETE_FAILED_MSG);
}
return result;
}
}
package com.jsh.erp.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.Functions;
import com.jsh.erp.datasource.entities.User;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.service.functions.FunctionsService;
import com.jsh.erp.service.userBusiness.UserBusinessService;
import com.jsh.erp.utils.BaseResponseInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.dao.DataAccessException;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
* @author ji-sheng-hua 华夏ERP
*/
@RestController
@RequestMapping(value = "/functions")
public class FunctionsController {
private Logger logger = LoggerFactory.getLogger(FunctionsController.class);
@Resource
private FunctionsService functionsService;
@Resource
private UserBusinessService userBusinessService;
@PostMapping(value = "/findMenu")
public JSONArray findMenu(@RequestParam(value="pNumber") String pNumber,
@RequestParam(value="hasFunctions") String hasFunctions,
HttpServletRequest request)throws Exception {
//存放数据json数组
JSONArray dataArray = new JSONArray();
try {
String fc = hasFunctions; //当前用户所拥有的功能列表,格式如:[1][2][5]
List<Functions> dataList = functionsService.getRoleFunctions(pNumber);
if (null != dataList) {
for (Functions functions : dataList) {
JSONObject item = new JSONObject();
item.put("id", functions.getId());
List<Functions> dataList1 = functionsService.getRoleFunctions(functions.getNumber());
JSONArray dataArray1 = new JSONArray();
if (dataList1.size() != 0) {
item.put("text", functions.getName()); //是目录就没链接
item.put("icon", functions.getIcon());
for (Functions functions1 : dataList1) {
item.put("state", "open"); //如果不为空,节点展开
JSONObject item1 = new JSONObject();
List<Functions> dataList2 = functionsService.getRoleFunctions(functions1.getNumber());
if (fc.indexOf("[" + functions1.getId().toString() + "]") != -1 || dataList2.size() != 0) {
item1.put("id", functions1.getId());
JSONArray dataArray2 = new JSONArray();
if (dataList2.size() != 0) {
item1.put("text", functions1.getName());//是目录就没链接
item1.put("icon", functions1.getIcon());
for (Functions functions2 : dataList2) {
item1.put("state", "closed"); //如果不为空,节点不展开
JSONObject item2 = new JSONObject();
List<Functions> dataList3 = functionsService.getRoleFunctions(functions2.getNumber());
if (fc.indexOf("[" + functions2.getId().toString() + "]") != -1 || dataList3.size() != 0) {
item2.put("id", functions2.getId());
JSONArray dataArray3 = new JSONArray();
if (dataList3.size() != 0) {
item2.put("text", functions2.getName());//是目录就没链接
item2.put("icon", functions2.getIcon());
for (Functions functions3 : dataList3) {
item2.put("state", "closed"); //如果不为空,节点不展开
JSONObject item3 = new JSONObject();
item3.put("id", functions3.getId());
item3.put("text", functions3.getName());
item3.put("icon", functions3.getIcon());
//
dataArray3.add(item3);
item2.put("children", dataArray3);
}
} else {
//不是目录,有链接
item2.put("text", functions2.getName());
item2.put("icon", functions2.getIcon());
item2.put("url", functions2.getUrl());
dataArray2.add(item2);
item1.put("children", dataArray2);
}
} else {
//不是目录,有链接
}
}
} else {
//不是目录,有链接
item1.put("text", functions1.getName());
item1.put("icon", functions1.getIcon());
item1.put("url", functions1.getUrl());
dataArray1.add(item1);
item.put("children", dataArray1);
}
} else {
//不是目录,有链接
}
}
} else {
//不是目录,有链接
item.put("text", functions.getName());
item.put("icon", functions.getIcon());
item.put("url", functions.getUrl());
}
dataArray.add(item);
}
}
} catch (DataAccessException e) {
logger.error(">>>>>>>>>>>>>>>>>>>查找应用异常", e);
}
return dataArray;
}
/**
* 角色对应功能显示
* @param request
* @return
*/
@PostMapping(value = "/findRoleFunctions")
public JSONArray findRoleFunctions(@RequestParam("UBType") String type, @RequestParam("UBKeyId") String keyId,
HttpServletRequest request)throws Exception {
JSONArray arr = new JSONArray();
try {
List<Functions> dataListFun = functionsService.findRoleFunctions("0");
//开始拼接json数据
JSONObject outer = new JSONObject();
outer.put("id", 1);
outer.put("text", "功能列表");
outer.put("state", "open");
//存放数据json数组
JSONArray dataArray = new JSONArray();
if (null != dataListFun) {
//根据条件从列表里面移除"系统管理"
List<Functions> dataList = new ArrayList<Functions>();
for (Functions fun : dataListFun) {
//从session中获取租户id
String loginName = null;
Object userInfo = request.getSession().getAttribute("user");
if(userInfo != null) {
User user = (User) userInfo;
loginName = user.getLoginame();
}
if(("admin").equals(loginName)) {
dataList.add(fun);
} else {
if(!("系统管理").equals(fun.getName())) {
dataList.add(fun);
}
}
}
//筛选功能列表
for (Functions functions : dataList) {
JSONObject item = new JSONObject();
item.put("id", functions.getId());
item.put("text", functions.getName());
//勾选判断1
Boolean flag = false;
try {
flag = userBusinessService.checkIsUserBusinessExist(type, keyId, "[" + functions.getId().toString() + "]");
} catch (Exception e) {
logger.error(">>>>>>>>>>>>>>>>>设置角色对应的功能:类型" + type + " KeyId为 " + keyId + " 存在异常!");
}
if (flag == true) {
item.put("checked", true);
}
//结束
List<Functions> dataList1 = functionsService.findRoleFunctions(functions.getNumber());
JSONArray dataArray1 = new JSONArray();
if (null != dataList1) {
for (Functions functions1 : dataList1) {
item.put("state", "open"); //如果不为空,节点不展开
JSONObject item1 = new JSONObject();
item1.put("id", functions1.getId());
item1.put("text", functions1.getName());
//勾选判断2
//Boolean flag = false;
try {
flag = userBusinessService.checkIsUserBusinessExist(type, keyId, "[" + functions1.getId().toString() + "]");
} catch (Exception e) {
logger.error(">>>>>>>>>>>>>>>>>设置角色对应的功能:类型" + type + " KeyId为 " + keyId + " 存在异常!");
}
if (flag == true) {
item1.put("checked", true);
}
//结束
List<Functions> dataList2 = functionsService.findRoleFunctions(functions1.getNumber());
JSONArray dataArray2 = new JSONArray();
if (null != dataList2) {
for (Functions functions2 : dataList2) {
item1.put("state", "closed"); //如果不为空,节点不展开
JSONObject item2 = new JSONObject();
item2.put("id", functions2.getId());
item2.put("text", functions2.getName());
//勾选判断3
//Boolean flag = false;
try {
flag = userBusinessService.checkIsUserBusinessExist(type, keyId, "[" + functions2.getId().toString() + "]");
} catch (Exception e) {
logger.error(">>>>>>>>>>>>>>>>>设置角色对应的功能:类型" + type + " KeyId为 " + keyId + " 存在异常!");
}
if (flag == true) {
item2.put("checked", true);
}
//结束
List<Functions> dataList3 = functionsService.findRoleFunctions(functions2.getNumber());
JSONArray dataArray3 = new JSONArray();
if (null != dataList3) {
for (Functions functions3 : dataList3) {
item2.put("state", "closed"); //如果不为空,节点不展开
JSONObject item3 = new JSONObject();
item3.put("id", functions3.getId());
item3.put("text", functions3.getName());
//勾选判断4
//Boolean flag = false;
try {
flag = userBusinessService.checkIsUserBusinessExist(type, keyId, "[" + functions3.getId().toString() + "]");
} catch (Exception e) {
logger.error(">>>>>>>>>>>>>>>>>设置角色对应的功能:类型" + type + " KeyId为 " + keyId + " 存在异常!");
}
if (flag == true) {
item3.put("checked", true);
}
//结束
dataArray3.add(item3);
item2.put("children", dataArray3);
}
}
dataArray2.add(item2);
item1.put("children", dataArray2);
}
}
dataArray1.add(item1);
item.put("children", dataArray1);
}
}
dataArray.add(item);
}
outer.put("children", dataArray);
arr.add(outer);
}
} catch (Exception e) {
e.printStackTrace();
}
return arr;
}
/**
* 根据id列表查找功能信息
* @param functionsIds
* @param request
* @return
*/
@GetMapping(value = "/findByIds")
public BaseResponseInfo findByIds(@RequestParam("functionsIds") String functionsIds,
HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
try {
List<Functions> dataList = functionsService.findByIds(functionsIds);
JSONObject outer = new JSONObject();
outer.put("total", dataList.size());
//存放数据json数组
JSONArray dataArray = new JSONArray();
if (null != dataList) {
for (Functions functions : dataList) {
JSONObject item = new JSONObject();
item.put("Id", functions.getId());
item.put("Name", functions.getName());
item.put("PushBtn", functions.getPushbtn());
item.put("op", 1);
dataArray.add(item);
}
}
outer.put("rows", dataArray);
res.code = 200;
res.data = outer;
} catch (Exception e) {
e.printStackTrace();
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* create by: qiankunpingtai
* websitehttps://qiankunpingtai.cn
* description:
* 批量删除功能模块信息
* create time: 2019/3/29 11:15
* @Param: ids
* @return java.lang.Object
*/
@RequestMapping(value = "/batchDeleteFunctionsByIds")
public Object batchDeleteFunctionsByIds(@RequestParam("ids") String ids) throws Exception {
JSONObject result = ExceptionConstants.standardSuccess();
int i= functionsService.batchDeleteFunctionsByIds(ids);
if(i<1){
logger.error("异常码[{}],异常提示[{}],参数,ids[{}]",
ExceptionConstants.FUNCTIONS_DELETE_FAILED_CODE,ExceptionConstants.FUNCTIONS_DELETE_FAILED_MSG,ids);
throw new BusinessRunTimeException(ExceptionConstants.FUNCTIONS_DELETE_FAILED_CODE,
ExceptionConstants.FUNCTIONS_DELETE_FAILED_MSG);
}
return result;
}
}

View File

@@ -1,197 +1,197 @@
package com.jsh.erp.datasource.entities;
import java.util.Date;
public class Tenant {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_tenant.id
*
* @mbggenerated
*/
private Long id;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_tenant.tenant_id
*
* @mbggenerated
*/
private Long tenantId;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_tenant.login_name
*
* @mbggenerated
*/
private String loginName;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_tenant.user_num_limit
*
* @mbggenerated
*/
private Integer userNumLimit;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_tenant.bills_num_limit
*
* @mbggenerated
*/
private Integer billsNumLimit;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_tenant.create_time
*
* @mbggenerated
*/
private Date createTime;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_tenant.id
*
* @return the value of jsh_tenant.id
*
* @mbggenerated
*/
public Long getId() {
return id;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_tenant.id
*
* @param id the value for jsh_tenant.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_tenant.tenant_id
*
* @return the value of jsh_tenant.tenant_id
*
* @mbggenerated
*/
public Long getTenantId() {
return tenantId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_tenant.tenant_id
*
* @param tenantId the value for jsh_tenant.tenant_id
*
* @mbggenerated
*/
public void setTenantId(Long tenantId) {
this.tenantId = tenantId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_tenant.login_name
*
* @return the value of jsh_tenant.login_name
*
* @mbggenerated
*/
public String getLoginName() {
return loginName;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_tenant.login_name
*
* @param loginName the value for jsh_tenant.login_name
*
* @mbggenerated
*/
public void setLoginName(String loginName) {
this.loginName = loginName == null ? null : loginName.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_tenant.user_num_limit
*
* @return the value of jsh_tenant.user_num_limit
*
* @mbggenerated
*/
public Integer getUserNumLimit() {
return userNumLimit;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_tenant.user_num_limit
*
* @param userNumLimit the value for jsh_tenant.user_num_limit
*
* @mbggenerated
*/
public void setUserNumLimit(Integer userNumLimit) {
this.userNumLimit = userNumLimit;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_tenant.bills_num_limit
*
* @return the value of jsh_tenant.bills_num_limit
*
* @mbggenerated
*/
public Integer getBillsNumLimit() {
return billsNumLimit;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_tenant.bills_num_limit
*
* @param billsNumLimit the value for jsh_tenant.bills_num_limit
*
* @mbggenerated
*/
public void setBillsNumLimit(Integer billsNumLimit) {
this.billsNumLimit = billsNumLimit;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_tenant.create_time
*
* @return the value of jsh_tenant.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_tenant.create_time
*
* @param createTime the value for jsh_tenant.create_time
*
* @mbggenerated
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
package com.jsh.erp.datasource.entities;
import java.util.Date;
public class Tenant {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_tenant.id
*
* @mbggenerated
*/
private Long id;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_tenant.tenant_id
*
* @mbggenerated
*/
private Long tenantId;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_tenant.login_name
*
* @mbggenerated
*/
private String loginName;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_tenant.user_num_limit
*
* @mbggenerated
*/
private Integer userNumLimit;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_tenant.bills_num_limit
*
* @mbggenerated
*/
private Integer billsNumLimit;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_tenant.create_time
*
* @mbggenerated
*/
private Date createTime;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_tenant.id
*
* @return the value of jsh_tenant.id
*
* @mbggenerated
*/
public Long getId() {
return id;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_tenant.id
*
* @param id the value for jsh_tenant.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_tenant.tenant_id
*
* @return the value of jsh_tenant.tenant_id
*
* @mbggenerated
*/
public Long getTenantId() {
return tenantId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_tenant.tenant_id
*
* @param tenantId the value for jsh_tenant.tenant_id
*
* @mbggenerated
*/
public void setTenantId(Long tenantId) {
this.tenantId = tenantId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_tenant.login_name
*
* @return the value of jsh_tenant.login_name
*
* @mbggenerated
*/
public String getLoginName() {
return loginName;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_tenant.login_name
*
* @param loginName the value for jsh_tenant.login_name
*
* @mbggenerated
*/
public void setLoginName(String loginName) {
this.loginName = loginName == null ? null : loginName.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_tenant.user_num_limit
*
* @return the value of jsh_tenant.user_num_limit
*
* @mbggenerated
*/
public Integer getUserNumLimit() {
return userNumLimit;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_tenant.user_num_limit
*
* @param userNumLimit the value for jsh_tenant.user_num_limit
*
* @mbggenerated
*/
public void setUserNumLimit(Integer userNumLimit) {
this.userNumLimit = userNumLimit;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_tenant.bills_num_limit
*
* @return the value of jsh_tenant.bills_num_limit
*
* @mbggenerated
*/
public Integer getBillsNumLimit() {
return billsNumLimit;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_tenant.bills_num_limit
*
* @param billsNumLimit the value for jsh_tenant.bills_num_limit
*
* @mbggenerated
*/
public void setBillsNumLimit(Integer billsNumLimit) {
this.billsNumLimit = billsNumLimit;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_tenant.create_time
*
* @return the value of jsh_tenant.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_tenant.create_time
*
* @param createTime the value for jsh_tenant.create_time
*
* @mbggenerated
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}

View File

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

View File

@@ -1,17 +1,17 @@
package com.jsh.erp.datasource.mappers;
import com.jsh.erp.datasource.entities.Tenant;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface TenantMapperEx {
List<Tenant> selectByConditionTenant(
@Param("loginName") String loginName,
@Param("offset") Integer offset,
@Param("rows") Integer rows);
Long countsByTenant(
@Param("loginName") String loginName);
package com.jsh.erp.datasource.mappers;
import com.jsh.erp.datasource.entities.Tenant;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface TenantMapperEx {
List<Tenant> selectByConditionTenant(
@Param("loginName") String loginName,
@Param("offset") Integer offset,
@Param("rows") Integer rows);
Long countsByTenant(
@Param("loginName") String loginName);
}

View File

@@ -1,39 +1,39 @@
package com.jsh.erp.service;
import java.lang.annotation.*;
/**
* @author jishenghua 2018-10-7 15:25:39
* user-5
* role-10
* depot-20
* log-25
* functions-30
* inOutItem-35
* unit-40
* person-45
* userBusiness-50
* systemConfig-55
* materialProperty-60
* account-65
* supplier-70
* materialCategory-75
* material-80
* depotHead-85
* depotItem-90
* accountHead-95
* accountItem-100
* serialNumber-105
* organization-110
* orgaUserRel-115
* tenant-120
* msg-125
*/
@Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@Documented
public @interface ResourceInfo {
String value();
int type();
}
package com.jsh.erp.service;
import java.lang.annotation.*;
/**
* @author jishenghua 2018-10-7 15:25:39
* user-5
* role-10
* depot-20
* log-25
* functions-30
* inOutItem-35
* unit-40
* person-45
* userBusiness-50
* systemConfig-55
* materialProperty-60
* account-65
* supplier-70
* materialCategory-75
* material-80
* depotHead-85
* depotItem-90
* accountHead-95
* accountItem-100
* serialNumber-105
* organization-110
* orgaUserRel-115
* tenant-120
* msg-125
*/
@Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@Documented
public @interface ResourceInfo {
String value();
int type();
}

View File

@@ -1,71 +1,71 @@
package com.jsh.erp.service.tenant;
import com.jsh.erp.service.ICommonQuery;
import com.jsh.erp.service.user.UserResource;
import com.jsh.erp.service.user.UserService;
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;
@Service(value = "tenant_component")
@TenantResource
public class TenantComponent implements ICommonQuery {
@Resource
private TenantService tenantService;
@Override
public Object selectOne(Long id) throws Exception {
return tenantService.getTenant(id);
}
@Override
public List<?> select(Map<String, String> map)throws Exception {
return getTenantList(map);
}
private List<?> getTenantList(Map<String, String> map)throws Exception {
String search = map.get(Constants.SEARCH);
String loginName = StringUtil.getInfo(search, "loginName");
return tenantService.select(loginName, QueryUtils.offset(map), QueryUtils.rows(map));
}
@Override
public Long counts(Map<String, String> map)throws Exception {
String search = map.get(Constants.SEARCH);
String loginName = StringUtil.getInfo(search, "loginName");
return tenantService.countTenant(loginName);
}
@Override
public int insert(String beanJson, HttpServletRequest request)throws Exception {
return tenantService.insertTenant(beanJson, request);
}
@Override
public int update(String beanJson, Long id)throws Exception {
return tenantService.updateTenant(beanJson, id);
}
@Override
public int delete(Long id)throws Exception {
return tenantService.deleteTenant(id);
}
@Override
public int batchDelete(String ids)throws Exception {
return tenantService.batchDeleteTenant(ids);
}
@Override
public int checkIsNameExist(Long id, String name)throws Exception {
return tenantService.checkIsNameExist(id, name);
}
}
package com.jsh.erp.service.tenant;
import com.jsh.erp.service.ICommonQuery;
import com.jsh.erp.service.user.UserResource;
import com.jsh.erp.service.user.UserService;
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;
@Service(value = "tenant_component")
@TenantResource
public class TenantComponent implements ICommonQuery {
@Resource
private TenantService tenantService;
@Override
public Object selectOne(Long id) throws Exception {
return tenantService.getTenant(id);
}
@Override
public List<?> select(Map<String, String> map)throws Exception {
return getTenantList(map);
}
private List<?> getTenantList(Map<String, String> map)throws Exception {
String search = map.get(Constants.SEARCH);
String loginName = StringUtil.getInfo(search, "loginName");
return tenantService.select(loginName, QueryUtils.offset(map), QueryUtils.rows(map));
}
@Override
public Long counts(Map<String, String> map)throws Exception {
String search = map.get(Constants.SEARCH);
String loginName = StringUtil.getInfo(search, "loginName");
return tenantService.countTenant(loginName);
}
@Override
public int insert(String beanJson, HttpServletRequest request)throws Exception {
return tenantService.insertTenant(beanJson, request);
}
@Override
public int update(String beanJson, Long id)throws Exception {
return tenantService.updateTenant(beanJson, id);
}
@Override
public int delete(Long id)throws Exception {
return tenantService.deleteTenant(id);
}
@Override
public int batchDelete(String ids)throws Exception {
return tenantService.batchDeleteTenant(ids);
}
@Override
public int checkIsNameExist(Long id, String name)throws Exception {
return tenantService.checkIsNameExist(id, name);
}
}

View File

@@ -1,15 +1,15 @@
package com.jsh.erp.service.tenant;
import com.jsh.erp.service.ResourceInfo;
import java.lang.annotation.*;
/**
* @author jishenghua qq752718920 2019-6-27 22:56:56
*/
@ResourceInfo(value = "tenant", type = 120)
@Inherited
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface TenantResource {
}
package com.jsh.erp.service.tenant;
import com.jsh.erp.service.ResourceInfo;
import java.lang.annotation.*;
/**
* @author jishenghua qq752718920 2019-6-27 22:56:56
*/
@ResourceInfo(value = "tenant", type = 120)
@Inherited
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface TenantResource {
}

View File

@@ -1,34 +1,34 @@
<configuration>
<property name="LOG_FILE" value="${logs.home}/jshERP"/>
<property name="LOG_PATTERN" value="%d{yyyy/MM/dd-HH:mm:ss} %-5level [%thread] %logger - %msg%n"/>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<appender name="TIME_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_FILE}.log</file>
<encoder>
<pattern>${LOG_PATTERN}</pattern>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_FILE}.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<maxHistory>10</maxHistory>
<totalSizeCap>1GB</totalSizeCap>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
</appender>
<root level="ERROR">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="TIME_FILE"/>
</root>
<logger name="com.jsh" additivity="false" level="DEBUG">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="TIME_FILE"/>
</logger>
<configuration>
<property name="LOG_FILE" value="${logs.home}/jshERP"/>
<property name="LOG_PATTERN" value="%d{yyyy/MM/dd-HH:mm:ss} %-5level [%thread] %logger - %msg%n"/>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<appender name="TIME_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_FILE}.log</file>
<encoder>
<pattern>${LOG_PATTERN}</pattern>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_FILE}.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<maxHistory>10</maxHistory>
<totalSizeCap>1GB</totalSizeCap>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
</appender>
<root level="ERROR">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="TIME_FILE"/>
</root>
<logger name="com.jsh" additivity="false" level="DEBUG">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="TIME_FILE"/>
</logger>
</configuration>

View File

@@ -1,5 +1,5 @@
<?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">
<?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.FunctionsMapper">
<resultMap id="BaseResultMap" type="com.jsh.erp.datasource.entities.Functions">
<!--

View File

@@ -1,288 +1,288 @@
<?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.TenantMapper" >
<resultMap id="BaseResultMap" type="com.jsh.erp.datasource.entities.Tenant" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<id column="id" property="id" jdbcType="BIGINT" />
<result column="tenant_id" property="tenantId" jdbcType="BIGINT" />
<result column="login_name" property="loginName" jdbcType="VARCHAR" />
<result column="user_num_limit" property="userNumLimit" jdbcType="INTEGER" />
<result column="bills_num_limit" property="billsNumLimit" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
</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, tenant_id, login_name, user_num_limit, bills_num_limit, create_time
</sql>
<select id="selectByExample" resultMap="BaseResultMap" parameterType="com.jsh.erp.datasource.entities.TenantExample" >
<!--
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_tenant
<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_tenant
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_tenant
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.jsh.erp.datasource.entities.TenantExample" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from jsh_tenant
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.jsh.erp.datasource.entities.Tenant" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into jsh_tenant (id, tenant_id, login_name,
user_num_limit, bills_num_limit, create_time
)
values (#{id,jdbcType=BIGINT}, #{tenantId,jdbcType=BIGINT}, #{loginName,jdbcType=VARCHAR},
#{userNumLimit,jdbcType=INTEGER}, #{billsNumLimit,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.Tenant" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into jsh_tenant
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="tenantId != null" >
tenant_id,
</if>
<if test="loginName != null" >
login_name,
</if>
<if test="userNumLimit != null" >
user_num_limit,
</if>
<if test="billsNumLimit != null" >
bills_num_limit,
</if>
<if test="createTime != null" >
create_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=BIGINT},
</if>
<if test="tenantId != null" >
#{tenantId,jdbcType=BIGINT},
</if>
<if test="loginName != null" >
#{loginName,jdbcType=VARCHAR},
</if>
<if test="userNumLimit != null" >
#{userNumLimit,jdbcType=INTEGER},
</if>
<if test="billsNumLimit != null" >
#{billsNumLimit,jdbcType=INTEGER},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.jsh.erp.datasource.entities.TenantExample" resultType="java.lang.Integer" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select count(*) from jsh_tenant
<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_tenant
<set >
<if test="record.id != null" >
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.tenantId != null" >
tenant_id = #{record.tenantId,jdbcType=BIGINT},
</if>
<if test="record.loginName != null" >
login_name = #{record.loginName,jdbcType=VARCHAR},
</if>
<if test="record.userNumLimit != null" >
user_num_limit = #{record.userNumLimit,jdbcType=INTEGER},
</if>
<if test="record.billsNumLimit != null" >
bills_num_limit = #{record.billsNumLimit,jdbcType=INTEGER},
</if>
<if test="record.createTime != null" >
create_time = #{record.createTime,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_tenant
set id = #{record.id,jdbcType=BIGINT},
tenant_id = #{record.tenantId,jdbcType=BIGINT},
login_name = #{record.loginName,jdbcType=VARCHAR},
user_num_limit = #{record.userNumLimit,jdbcType=INTEGER},
bills_num_limit = #{record.billsNumLimit,jdbcType=INTEGER},
create_time = #{record.createTime,jdbcType=TIMESTAMP}
<if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.jsh.erp.datasource.entities.Tenant" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update jsh_tenant
<set >
<if test="tenantId != null" >
tenant_id = #{tenantId,jdbcType=BIGINT},
</if>
<if test="loginName != null" >
login_name = #{loginName,jdbcType=VARCHAR},
</if>
<if test="userNumLimit != null" >
user_num_limit = #{userNumLimit,jdbcType=INTEGER},
</if>
<if test="billsNumLimit != null" >
bills_num_limit = #{billsNumLimit,jdbcType=INTEGER},
</if>
<if test="createTime != null" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.jsh.erp.datasource.entities.Tenant" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update jsh_tenant
set tenant_id = #{tenantId,jdbcType=BIGINT},
login_name = #{loginName,jdbcType=VARCHAR},
user_num_limit = #{userNumLimit,jdbcType=INTEGER},
bills_num_limit = #{billsNumLimit,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
</update>
<?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.TenantMapper" >
<resultMap id="BaseResultMap" type="com.jsh.erp.datasource.entities.Tenant" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<id column="id" property="id" jdbcType="BIGINT" />
<result column="tenant_id" property="tenantId" jdbcType="BIGINT" />
<result column="login_name" property="loginName" jdbcType="VARCHAR" />
<result column="user_num_limit" property="userNumLimit" jdbcType="INTEGER" />
<result column="bills_num_limit" property="billsNumLimit" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
</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, tenant_id, login_name, user_num_limit, bills_num_limit, create_time
</sql>
<select id="selectByExample" resultMap="BaseResultMap" parameterType="com.jsh.erp.datasource.entities.TenantExample" >
<!--
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_tenant
<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_tenant
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_tenant
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.jsh.erp.datasource.entities.TenantExample" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from jsh_tenant
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.jsh.erp.datasource.entities.Tenant" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into jsh_tenant (id, tenant_id, login_name,
user_num_limit, bills_num_limit, create_time
)
values (#{id,jdbcType=BIGINT}, #{tenantId,jdbcType=BIGINT}, #{loginName,jdbcType=VARCHAR},
#{userNumLimit,jdbcType=INTEGER}, #{billsNumLimit,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.Tenant" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into jsh_tenant
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="tenantId != null" >
tenant_id,
</if>
<if test="loginName != null" >
login_name,
</if>
<if test="userNumLimit != null" >
user_num_limit,
</if>
<if test="billsNumLimit != null" >
bills_num_limit,
</if>
<if test="createTime != null" >
create_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=BIGINT},
</if>
<if test="tenantId != null" >
#{tenantId,jdbcType=BIGINT},
</if>
<if test="loginName != null" >
#{loginName,jdbcType=VARCHAR},
</if>
<if test="userNumLimit != null" >
#{userNumLimit,jdbcType=INTEGER},
</if>
<if test="billsNumLimit != null" >
#{billsNumLimit,jdbcType=INTEGER},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.jsh.erp.datasource.entities.TenantExample" resultType="java.lang.Integer" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select count(*) from jsh_tenant
<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_tenant
<set >
<if test="record.id != null" >
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.tenantId != null" >
tenant_id = #{record.tenantId,jdbcType=BIGINT},
</if>
<if test="record.loginName != null" >
login_name = #{record.loginName,jdbcType=VARCHAR},
</if>
<if test="record.userNumLimit != null" >
user_num_limit = #{record.userNumLimit,jdbcType=INTEGER},
</if>
<if test="record.billsNumLimit != null" >
bills_num_limit = #{record.billsNumLimit,jdbcType=INTEGER},
</if>
<if test="record.createTime != null" >
create_time = #{record.createTime,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_tenant
set id = #{record.id,jdbcType=BIGINT},
tenant_id = #{record.tenantId,jdbcType=BIGINT},
login_name = #{record.loginName,jdbcType=VARCHAR},
user_num_limit = #{record.userNumLimit,jdbcType=INTEGER},
bills_num_limit = #{record.billsNumLimit,jdbcType=INTEGER},
create_time = #{record.createTime,jdbcType=TIMESTAMP}
<if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.jsh.erp.datasource.entities.Tenant" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update jsh_tenant
<set >
<if test="tenantId != null" >
tenant_id = #{tenantId,jdbcType=BIGINT},
</if>
<if test="loginName != null" >
login_name = #{loginName,jdbcType=VARCHAR},
</if>
<if test="userNumLimit != null" >
user_num_limit = #{userNumLimit,jdbcType=INTEGER},
</if>
<if test="billsNumLimit != null" >
bills_num_limit = #{billsNumLimit,jdbcType=INTEGER},
</if>
<if test="createTime != null" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.jsh.erp.datasource.entities.Tenant" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update jsh_tenant
set tenant_id = #{tenantId,jdbcType=BIGINT},
login_name = #{loginName,jdbcType=VARCHAR},
user_num_limit = #{userNumLimit,jdbcType=INTEGER},
bills_num_limit = #{billsNumLimit,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>