Merge branch 'dev-nwcc' of http://192.168.0.56:3000/bonus/devicesmgt into dev-nwcc
This commit is contained in:
commit
dbf1fab28d
|
|
@ -14,14 +14,12 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 172.16.36.33:8848
|
||||
namespace: sgzb_cloud_dev
|
||||
username: nacos
|
||||
password: N2$NjW2&CDEOx$mD*y5h
|
||||
server-addr: 127.0.0.1:8848
|
||||
namespace: sgzb_cloud_dev_nw
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 172.16.36.33:8848
|
||||
namespace: sgzb_cloud_dev
|
||||
server-addr: 127.0.0.1:8848
|
||||
namespace: sgzb_cloud_dev_nw
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
|||
|
|
@ -27,14 +27,12 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 172.16.36.33:8848
|
||||
namespace: sgzb_cloud_dev
|
||||
username: nacos
|
||||
password: N2$NjW2&CDEOx$mD*y5h
|
||||
server-addr: 127.0.0.1:8848
|
||||
namespace: sgzb_cloud_dev_nw
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 172.16.36.33:8848
|
||||
namespace: sgzb_cloud_dev
|
||||
server-addr: 127.0.0.1:8848
|
||||
namespace: sgzb_cloud_dev_nw
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
|||
|
|
@ -21,14 +21,12 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 172.16.36.33:8848
|
||||
namespace: sgzb_cloud_dev
|
||||
username: nacos
|
||||
password: N2$NjW2&CDEOx$mD*y5h
|
||||
server-addr: 127.0.0.1:8848
|
||||
namespace: sgzb_cloud_dev_nw
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 172.16.36.33:8848
|
||||
namespace: sgzb_cloud_dev
|
||||
server-addr: 127.0.0.1:8848
|
||||
namespace: sgzb_cloud_dev_nw
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
|||
|
|
@ -36,14 +36,12 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 172.16.36.33:8848
|
||||
namespace: sgzb_cloud_dev
|
||||
username: nacos
|
||||
password: N2$NjW2&CDEOx$mD*y5h
|
||||
server-addr: 127.0.0.1:8848
|
||||
namespace: sgzb_cloud_dev_nw
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 172.16.36.33:8848
|
||||
namespace: sgzb_cloud_dev
|
||||
server-addr: 127.0.0.1:8848
|
||||
namespace: sgzb_cloud_dev_nw
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
|||
|
|
@ -14,14 +14,12 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 172.16.36.33:8848
|
||||
namespace: sgzb_cloud_dev
|
||||
username: nacos
|
||||
password: N2$NjW2&CDEOx$mD*y5h
|
||||
server-addr: 127.0.0.1:8848
|
||||
namespace: sgzb_cloud_dev_nw
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 172.16.36.33:8848
|
||||
namespace: sgzb_cloud_dev
|
||||
server-addr: 127.0.0.1:8848
|
||||
namespace: sgzb_cloud_dev_nw
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
|||
|
|
@ -14,14 +14,12 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 172.16.36.33:8848
|
||||
namespace: sgzb_cloud_dev
|
||||
username: nacos
|
||||
password: N2$NjW2&CDEOx$mD*y5h
|
||||
server-addr: 127.0.0.1:8848
|
||||
namespace: sgzb_cloud_dev_nw
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 172.16.36.33:8848
|
||||
namespace: sgzb_cloud_dev
|
||||
server-addr: 127.0.0.1:8848
|
||||
namespace: sgzb_cloud_dev_nw
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
|||
|
|
@ -21,14 +21,12 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 172.16.36.33:8848
|
||||
namespace: sgzb_cloud_dev
|
||||
username: nacos
|
||||
password: N2$NjW2&CDEOx$mD*y5h
|
||||
server-addr: 127.0.0.1:8848
|
||||
namespace: sgzb_cloud_dev_nw
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 172.16.36.33:8848
|
||||
namespace: sgzb_cloud_dev
|
||||
server-addr: 127.0.0.1:8848
|
||||
namespace: sgzb_cloud_dev_nw
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
|||
|
|
@ -14,14 +14,12 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 172.16.36.33:8848
|
||||
namespace: sgzb_cloud_dev
|
||||
username: nacos
|
||||
password: N2$NjW2&CDEOx$mD*y5h
|
||||
server-addr: 127.0.0.1:8848
|
||||
namespace: sgzb_cloud_dev_nw
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 172.16.36.33:8848
|
||||
namespace: sgzb_cloud_dev
|
||||
server-addr: 127.0.0.1:8848
|
||||
namespace: sgzb_cloud_dev_nw
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
|||
|
|
@ -78,6 +78,20 @@ public class SysDeptController extends BaseController {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增公司
|
||||
*/
|
||||
//@RequiresPermissions("system:dept:add")
|
||||
@Log(title = "公司管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping(value = "/addCompany")
|
||||
public AjaxResult addCompany(@RequestBody List<SysDept> list) {
|
||||
if (!deptService.checkCompaniesNameUnique(list)) {
|
||||
return error("新增公司失败,其中有些公司名称已存在");
|
||||
}
|
||||
return toAjax(deptService.insertCompanies(list));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增部门
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -68,6 +68,8 @@ public interface SysDeptMapper
|
|||
*/
|
||||
public int checkDeptExistUser(Long deptId);
|
||||
|
||||
public int checkCompaniesNameUnique(@Param("depts") List<SysDept> list);
|
||||
|
||||
/**
|
||||
* 校验部门名称是否唯一
|
||||
*
|
||||
|
|
@ -77,6 +79,8 @@ public interface SysDeptMapper
|
|||
*/
|
||||
public SysDept checkDeptNameUnique(@Param("deptName") String deptName, @Param("parentId") Long parentId);
|
||||
|
||||
public int insertCompanies(@Param("depts") List<SysDept> list);
|
||||
|
||||
/**
|
||||
* 新增部门信息
|
||||
*
|
||||
|
|
@ -124,4 +128,6 @@ public interface SysDeptMapper
|
|||
List<SysDept> selectDeptByAncestors(String[] deptIds);
|
||||
|
||||
String getCompanyByAncestors(String split);
|
||||
|
||||
int getMaxDeptId();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,6 +83,7 @@ public interface ISysDeptService
|
|||
*/
|
||||
public boolean checkDeptExistUser(Long deptId);
|
||||
|
||||
public boolean checkCompaniesNameUnique(List<SysDept> list);
|
||||
/**
|
||||
* 校验部门名称是否唯一
|
||||
*
|
||||
|
|
@ -98,6 +99,8 @@ public interface ISysDeptService
|
|||
*/
|
||||
public void checkDeptDataScope(Long deptId);
|
||||
|
||||
public int insertCompanies(List<SysDept> list);
|
||||
|
||||
/**
|
||||
* 新增保存部门信息
|
||||
*
|
||||
|
|
|
|||
|
|
@ -162,6 +162,12 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
|||
return result > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkCompaniesNameUnique(List<SysDept> list) {
|
||||
int count = deptMapper.checkCompaniesNameUnique(list);
|
||||
return count == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验部门名称是否唯一
|
||||
*
|
||||
|
|
@ -195,6 +201,28 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertCompanies(List<SysDept> list) {
|
||||
int num = deptMapper.getMaxDeptId() + 1;
|
||||
long nextMultiple = (int) Math.ceil((double) num / 100) * 100;
|
||||
for (SysDept dept : list) {
|
||||
dept.setCreateBy(SecurityUtils.getUsername());
|
||||
dept.setParentId(0L);
|
||||
dept.setAncestors("0");
|
||||
dept.setOrderNum(999);
|
||||
dept.setStatus("0");
|
||||
dept.setDeptId(nextMultiple);
|
||||
dept.setCompanyId(nextMultiple);
|
||||
}
|
||||
return deptMapper.insertCompanies(list);
|
||||
}
|
||||
|
||||
// public static void main(String[] args) {
|
||||
// int num = 1200;
|
||||
// long nextMultiple = (int) Math.ceil((double) num / 100) * 100;
|
||||
// System.out.print(num);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 新增保存部门信息
|
||||
*
|
||||
|
|
|
|||
|
|
@ -25,14 +25,12 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 172.16.36.33:8848
|
||||
namespace: sgzb_cloud_dev
|
||||
username: nacos
|
||||
password: N2$NjW2&CDEOx$mD*y5h
|
||||
server-addr: 127.0.0.1:8848
|
||||
namespace: sgzb_cloud_dev_nw
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 172.16.36.33:8848
|
||||
namespace: sgzb_cloud_dev
|
||||
server-addr: 127.0.0.1:8848
|
||||
namespace: sgzb_cloud_dev_nw
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
|||
|
|
@ -85,11 +85,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int">
|
||||
select count(*) from sys_dept where status = 0 and del_flag = '0' and find_in_set(#{deptId}, ancestors)
|
||||
</select>
|
||||
|
||||
<select id="checkCompaniesNameUnique" resultType="java.lang.Integer">
|
||||
select count(*)
|
||||
from sys_dept
|
||||
where dept_name in
|
||||
<foreach collection="depts" item="item" index="index" separator="," open="(" close=")">
|
||||
#{item.deptName}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="checkDeptNameUnique" resultMap="SysDeptResult">
|
||||
<include refid="selectDeptVo"/>
|
||||
where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
|
||||
</select>
|
||||
|
||||
<insert id="insertCompanies" parameterType="com.bonus.sgzb.system.api.domain.SysDept">
|
||||
insert into sys_dept(
|
||||
dept_id,parent_id,dept_name,ancestors,order_num,leader,phone,email,status,create_by,company_id,create_time)
|
||||
values
|
||||
<foreach item="item" index="index" collection="depts" separator=",">
|
||||
(
|
||||
#{item.deptId},#{item.parentId},#{item.deptName},#{item.ancestors},#{item.orderNum},#{item.leader},
|
||||
#{item.phone},#{item.email},#{item.status},#{item.createBy},#{item.companyId},sysdate()
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="insertDept" parameterType="com.bonus.sgzb.system.api.domain.SysDept">
|
||||
insert into sys_dept(
|
||||
|
|
@ -171,4 +192,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="getCompanyByAncestors" resultType="java.lang.String">
|
||||
select dept_name from sys_dept where parent_id = #{split}
|
||||
</select>
|
||||
|
||||
<select id="getMaxDeptId" resultType="java.lang.Integer">
|
||||
select max(dept_id)
|
||||
from sys_dept
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue