增加machineCode机具编码
This commit is contained in:
parent
0508383e8d
commit
7b0b4c4420
|
|
@ -1,20 +1,20 @@
|
||||||
package com.bonus.sgzb.system.api.domain;
|
package com.bonus.sgzb.system.api.domain;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import com.bonus.sgzb.common.core.web.domain.BaseEntity;
|
||||||
import java.util.List;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
import javax.validation.constraints.Email;
|
import javax.validation.constraints.Email;
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
|
import java.util.ArrayList;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import java.util.List;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
|
||||||
import com.bonus.sgzb.common.core.web.domain.BaseEntity;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门表 sys_dept
|
* 部门表 sys_dept
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class SysDept extends BaseEntity
|
public class SysDept extends BaseEntity
|
||||||
|
|
@ -64,7 +64,7 @@ public class SysDept extends BaseEntity
|
||||||
/** 父部门名称 */
|
/** 父部门名称 */
|
||||||
@ApiModelProperty(value = "父部门名称")
|
@ApiModelProperty(value = "父部门名称")
|
||||||
private String parentName;
|
private String parentName;
|
||||||
|
|
||||||
/** 子部门 */
|
/** 子部门 */
|
||||||
@ApiModelProperty(value = "子部门")
|
@ApiModelProperty(value = "子部门")
|
||||||
private List<SysDept> children = new ArrayList<>();
|
private List<SysDept> children = new ArrayList<>();
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,5 @@
|
||||||
package com.bonus.sgzb.system.controller;
|
package com.bonus.sgzb.system.controller;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import com.bonus.sgzb.common.core.constant.UserConstants;
|
import com.bonus.sgzb.common.core.constant.UserConstants;
|
||||||
import com.bonus.sgzb.common.core.utils.StringUtils;
|
import com.bonus.sgzb.common.core.utils.StringUtils;
|
||||||
import com.bonus.sgzb.common.core.web.controller.BaseController;
|
import com.bonus.sgzb.common.core.web.controller.BaseController;
|
||||||
|
|
@ -23,6 +10,12 @@ import com.bonus.sgzb.common.security.annotation.RequiresPermissions;
|
||||||
import com.bonus.sgzb.common.security.utils.SecurityUtils;
|
import com.bonus.sgzb.common.security.utils.SecurityUtils;
|
||||||
import com.bonus.sgzb.system.api.domain.SysDept;
|
import com.bonus.sgzb.system.api.domain.SysDept;
|
||||||
import com.bonus.sgzb.system.service.ISysDeptService;
|
import com.bonus.sgzb.system.service.ISysDeptService;
|
||||||
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门信息
|
* 部门信息
|
||||||
|
|
@ -91,7 +84,16 @@ public class SysDeptController extends BaseController {
|
||||||
return toAjax(deptService.insertCompanies(list));
|
return toAjax(deptService.insertCompanies(list));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @RequiresPermissions("system:dept:add")
|
||||||
|
@Log(title = "公司管理", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping(value = "/addFirm")
|
||||||
|
public AjaxResult addFirm(@RequestBody SysDept sysDept) {
|
||||||
|
logger.info("新增公司");
|
||||||
|
if (!deptService.checkCompanyNameUnique(sysDept)) {
|
||||||
|
return error("新增公司失败,公司名称已存在");
|
||||||
|
}
|
||||||
|
return toAjax(deptService.insertCompany(sysDept));
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 新增部门
|
* 新增部门
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,20 @@
|
||||||
package com.bonus.sgzb.system.mapper;
|
package com.bonus.sgzb.system.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import com.bonus.sgzb.system.api.domain.SysDept;
|
import com.bonus.sgzb.system.api.domain.SysDept;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门管理 数据层
|
* 部门管理 数据层
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public interface SysDeptMapper
|
public interface SysDeptMapper
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 查询部门管理数据
|
* 查询部门管理数据
|
||||||
*
|
*
|
||||||
* @param dept 部门信息
|
* @param dept 部门信息
|
||||||
* @return 部门信息集合
|
* @return 部门信息集合
|
||||||
*/
|
*/
|
||||||
|
|
@ -21,7 +22,7 @@ public interface SysDeptMapper
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据角色ID查询部门树信息
|
* 根据角色ID查询部门树信息
|
||||||
*
|
*
|
||||||
* @param roleId 角色ID
|
* @param roleId 角色ID
|
||||||
* @param deptCheckStrictly 部门树选择项是否关联显示
|
* @param deptCheckStrictly 部门树选择项是否关联显示
|
||||||
* @return 选中部门列表
|
* @return 选中部门列表
|
||||||
|
|
@ -30,7 +31,7 @@ public interface SysDeptMapper
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据部门ID查询信息
|
* 根据部门ID查询信息
|
||||||
*
|
*
|
||||||
* @param deptId 部门ID
|
* @param deptId 部门ID
|
||||||
* @return 部门信息
|
* @return 部门信息
|
||||||
*/
|
*/
|
||||||
|
|
@ -38,7 +39,7 @@ public interface SysDeptMapper
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据ID查询所有子部门
|
* 根据ID查询所有子部门
|
||||||
*
|
*
|
||||||
* @param deptId 部门ID
|
* @param deptId 部门ID
|
||||||
* @return 部门列表
|
* @return 部门列表
|
||||||
*/
|
*/
|
||||||
|
|
@ -46,7 +47,7 @@ public interface SysDeptMapper
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据ID查询所有子部门(正常状态)
|
* 根据ID查询所有子部门(正常状态)
|
||||||
*
|
*
|
||||||
* @param deptId 部门ID
|
* @param deptId 部门ID
|
||||||
* @return 子部门数
|
* @return 子部门数
|
||||||
*/
|
*/
|
||||||
|
|
@ -54,7 +55,7 @@ public interface SysDeptMapper
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否存在子节点
|
* 是否存在子节点
|
||||||
*
|
*
|
||||||
* @param deptId 部门ID
|
* @param deptId 部门ID
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
|
|
@ -62,7 +63,7 @@ public interface SysDeptMapper
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询部门是否存在用户
|
* 查询部门是否存在用户
|
||||||
*
|
*
|
||||||
* @param deptId 部门ID
|
* @param deptId 部门ID
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
|
|
@ -72,7 +73,7 @@ public interface SysDeptMapper
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验部门名称是否唯一
|
* 校验部门名称是否唯一
|
||||||
*
|
*
|
||||||
* @param deptName 部门名称
|
* @param deptName 部门名称
|
||||||
* @param parentId 父部门ID
|
* @param parentId 父部门ID
|
||||||
* @return 结果
|
* @return 结果
|
||||||
|
|
@ -83,7 +84,7 @@ public interface SysDeptMapper
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增部门信息
|
* 新增部门信息
|
||||||
*
|
*
|
||||||
* @param dept 部门信息
|
* @param dept 部门信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
|
|
@ -91,7 +92,7 @@ public interface SysDeptMapper
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改部门信息
|
* 修改部门信息
|
||||||
*
|
*
|
||||||
* @param dept 部门信息
|
* @param dept 部门信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
|
|
@ -99,14 +100,14 @@ public interface SysDeptMapper
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改所在部门正常状态
|
* 修改所在部门正常状态
|
||||||
*
|
*
|
||||||
* @param deptIds 部门ID组
|
* @param deptIds 部门ID组
|
||||||
*/
|
*/
|
||||||
public void updateDeptStatusNormal(Long[] deptIds);
|
public void updateDeptStatusNormal(Long[] deptIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改子元素关系
|
* 修改子元素关系
|
||||||
*
|
*
|
||||||
* @param depts 子元素
|
* @param depts 子元素
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
|
|
@ -114,7 +115,7 @@ public interface SysDeptMapper
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除部门管理信息
|
* 删除部门管理信息
|
||||||
*
|
*
|
||||||
* @param deptId 部门ID
|
* @param deptId 部门ID
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
|
|
@ -130,4 +131,8 @@ public interface SysDeptMapper
|
||||||
String getCompanyByAncestors(String split);
|
String getCompanyByAncestors(String split);
|
||||||
|
|
||||||
int getMaxDeptId();
|
int getMaxDeptId();
|
||||||
|
|
||||||
|
int checkCompanyNameUnique(SysDept list);
|
||||||
|
|
||||||
|
int insertCompany(SysDept list);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,20 @@
|
||||||
package com.bonus.sgzb.system.service;
|
package com.bonus.sgzb.system.service;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.bonus.sgzb.system.api.domain.SysDept;
|
import com.bonus.sgzb.system.api.domain.SysDept;
|
||||||
import com.bonus.sgzb.system.domain.vo.TreeSelect;
|
import com.bonus.sgzb.system.domain.vo.TreeSelect;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门管理 服务层
|
* 部门管理 服务层
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public interface ISysDeptService
|
public interface ISysDeptService
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 查询部门管理数据
|
* 查询部门管理数据
|
||||||
*
|
*
|
||||||
* @param dept 部门信息
|
* @param dept 部门信息
|
||||||
* @return 部门信息集合
|
* @return 部门信息集合
|
||||||
*/
|
*/
|
||||||
|
|
@ -21,7 +22,7 @@ public interface ISysDeptService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询部门树结构信息
|
* 查询部门树结构信息
|
||||||
*
|
*
|
||||||
* @param dept 部门信息
|
* @param dept 部门信息
|
||||||
* @return 部门树信息集合
|
* @return 部门树信息集合
|
||||||
*/
|
*/
|
||||||
|
|
@ -29,7 +30,7 @@ public interface ISysDeptService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构建前端所需要树结构
|
* 构建前端所需要树结构
|
||||||
*
|
*
|
||||||
* @param depts 部门列表
|
* @param depts 部门列表
|
||||||
* @return 树结构列表
|
* @return 树结构列表
|
||||||
*/
|
*/
|
||||||
|
|
@ -37,7 +38,7 @@ public interface ISysDeptService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构建前端所需要下拉树结构
|
* 构建前端所需要下拉树结构
|
||||||
*
|
*
|
||||||
* @param depts 部门列表
|
* @param depts 部门列表
|
||||||
* @return 下拉树结构列表
|
* @return 下拉树结构列表
|
||||||
*/
|
*/
|
||||||
|
|
@ -45,7 +46,7 @@ public interface ISysDeptService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据角色ID查询部门树信息
|
* 根据角色ID查询部门树信息
|
||||||
*
|
*
|
||||||
* @param roleId 角色ID
|
* @param roleId 角色ID
|
||||||
* @return 选中部门列表
|
* @return 选中部门列表
|
||||||
*/
|
*/
|
||||||
|
|
@ -53,7 +54,7 @@ public interface ISysDeptService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据部门ID查询信息
|
* 根据部门ID查询信息
|
||||||
*
|
*
|
||||||
* @param deptId 部门ID
|
* @param deptId 部门ID
|
||||||
* @return 部门信息
|
* @return 部门信息
|
||||||
*/
|
*/
|
||||||
|
|
@ -61,7 +62,7 @@ public interface ISysDeptService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据ID查询所有子部门(正常状态)
|
* 根据ID查询所有子部门(正常状态)
|
||||||
*
|
*
|
||||||
* @param deptId 部门ID
|
* @param deptId 部门ID
|
||||||
* @return 子部门数
|
* @return 子部门数
|
||||||
*/
|
*/
|
||||||
|
|
@ -69,7 +70,7 @@ public interface ISysDeptService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否存在部门子节点
|
* 是否存在部门子节点
|
||||||
*
|
*
|
||||||
* @param deptId 部门ID
|
* @param deptId 部门ID
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
|
|
@ -77,7 +78,7 @@ public interface ISysDeptService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询部门是否存在用户
|
* 查询部门是否存在用户
|
||||||
*
|
*
|
||||||
* @param deptId 部门ID
|
* @param deptId 部门ID
|
||||||
* @return 结果 true 存在 false 不存在
|
* @return 结果 true 存在 false 不存在
|
||||||
*/
|
*/
|
||||||
|
|
@ -86,7 +87,7 @@ public interface ISysDeptService
|
||||||
public boolean checkCompaniesNameUnique(List<SysDept> list);
|
public boolean checkCompaniesNameUnique(List<SysDept> list);
|
||||||
/**
|
/**
|
||||||
* 校验部门名称是否唯一
|
* 校验部门名称是否唯一
|
||||||
*
|
*
|
||||||
* @param dept 部门信息
|
* @param dept 部门信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
|
|
@ -94,7 +95,7 @@ public interface ISysDeptService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验部门是否有数据权限
|
* 校验部门是否有数据权限
|
||||||
*
|
*
|
||||||
* @param deptId 部门id
|
* @param deptId 部门id
|
||||||
*/
|
*/
|
||||||
public void checkDeptDataScope(Long deptId);
|
public void checkDeptDataScope(Long deptId);
|
||||||
|
|
@ -103,7 +104,7 @@ public interface ISysDeptService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增保存部门信息
|
* 新增保存部门信息
|
||||||
*
|
*
|
||||||
* @param dept 部门信息
|
* @param dept 部门信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
|
|
@ -111,7 +112,7 @@ public interface ISysDeptService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改保存部门信息
|
* 修改保存部门信息
|
||||||
*
|
*
|
||||||
* @param dept 部门信息
|
* @param dept 部门信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
|
|
@ -119,11 +120,18 @@ public interface ISysDeptService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除部门管理信息
|
* 删除部门管理信息
|
||||||
*
|
*
|
||||||
* @param deptId 部门ID
|
* @param deptId 部门ID
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteDeptById(Long deptId);
|
public int deleteDeptById(Long deptId);
|
||||||
|
|
||||||
String getCompanyByAncestors(String ancestors);
|
String getCompanyByAncestors(String ancestors);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 新增公司
|
||||||
|
* */
|
||||||
|
public boolean checkCompanyNameUnique(SysDept list);
|
||||||
|
|
||||||
|
int insertCompany(SysDept list);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@ import com.bonus.sgzb.system.mapper.SysDeptMapper;
|
||||||
import com.bonus.sgzb.system.mapper.SysRoleMapper;
|
import com.bonus.sgzb.system.mapper.SysRoleMapper;
|
||||||
import com.bonus.sgzb.system.mapper.SysUserMapper;
|
import com.bonus.sgzb.system.mapper.SysUserMapper;
|
||||||
import com.bonus.sgzb.system.service.ISysDeptService;
|
import com.bonus.sgzb.system.service.ISysDeptService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
@ -316,6 +315,32 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checkCompanyNameUnique(SysDept list) {
|
||||||
|
int count = deptMapper.checkCompanyNameUnique(list);
|
||||||
|
return count == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int insertCompany(SysDept list) {
|
||||||
|
// long num = deptMapper.getMaxDeptId()+1;
|
||||||
|
SysDept dept = new SysDept();
|
||||||
|
String deptName = list.getDeptName();
|
||||||
|
dept.setDeptName(deptName);
|
||||||
|
dept.setSocialCreditCode(list.getSocialCreditCode());
|
||||||
|
dept.setEnterpriseOwnershipCode(list.getEnterpriseOwnershipCode());
|
||||||
|
dept.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
dept.setParentId(0L);
|
||||||
|
dept.setAncestors("0");
|
||||||
|
dept.setOrderNum(999);
|
||||||
|
dept.setStatus("0");
|
||||||
|
// long nextMultiple = (int) Math.ceil((double) num / 100) * 100;
|
||||||
|
// num = nextMultiple + 1;
|
||||||
|
// dept.setDeptId(nextMultiple);
|
||||||
|
// dept.setCompanyId(nextMultiple);
|
||||||
|
return deptMapper.insertCompany(dept);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 递归列表
|
* 递归列表
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -25,13 +25,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<result property="socialCreditCode" column="social_credit_code" />
|
<result property="socialCreditCode" column="social_credit_code" />
|
||||||
<result property="enterpriseOwnershipCode" column="enterprise_ownership_code" />
|
<result property="enterpriseOwnershipCode" column="enterprise_ownership_code" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectDeptVo">
|
<sql id="selectDeptVo">
|
||||||
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time,
|
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time,
|
||||||
d.remark,d.company_id,d.social_credit_code,d.enterprise_ownership_code
|
d.remark,d.company_id,d.social_credit_code,d.enterprise_ownership_code
|
||||||
from sys_dept d
|
from sys_dept d
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectDeptList" parameterType="com.bonus.sgzb.system.api.domain.SysDept" resultMap="SysDeptResult">
|
<select id="selectDeptList" parameterType="com.bonus.sgzb.system.api.domain.SysDept" resultMap="SysDeptResult">
|
||||||
<include refid="selectDeptVo"/>
|
<include refid="selectDeptVo"/>
|
||||||
where d.del_flag = '0'
|
where d.del_flag = '0'
|
||||||
|
|
@ -54,7 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
${params.dataScope}
|
${params.dataScope}
|
||||||
order by d.parent_id, d.order_num
|
order by d.parent_id, d.order_num
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectDeptListByRoleId" resultType="Long">
|
<select id="selectDeptListByRoleId" resultType="Long">
|
||||||
select d.dept_id
|
select d.dept_id
|
||||||
from sys_dept d
|
from sys_dept d
|
||||||
|
|
@ -65,25 +65,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</if>
|
</if>
|
||||||
order by d.parent_id, d.order_num
|
order by d.parent_id, d.order_num
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">
|
<select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">
|
||||||
<include refid="selectDeptVo"/>
|
<include refid="selectDeptVo"/>
|
||||||
where dept_id = #{deptId}
|
where dept_id = #{deptId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="checkDeptExistUser" parameterType="Long" resultType="int">
|
<select id="checkDeptExistUser" parameterType="Long" resultType="int">
|
||||||
select count(1) from sys_user where dept_id = #{deptId} and del_flag = '0'
|
select count(1) from sys_user where dept_id = #{deptId} and del_flag = '0'
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="hasChildByDeptId" parameterType="Long" resultType="int">
|
<select id="hasChildByDeptId" parameterType="Long" resultType="int">
|
||||||
select count(1) from sys_dept
|
select count(1) from sys_dept
|
||||||
where del_flag = '0' and parent_id = #{deptId} limit 1
|
where del_flag = '0' and parent_id = #{deptId} limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectChildrenDeptById" parameterType="Long" resultMap="SysDeptResult">
|
<select id="selectChildrenDeptById" parameterType="Long" resultMap="SysDeptResult">
|
||||||
select * from sys_dept where find_in_set(#{deptId}, ancestors)
|
select * from sys_dept where find_in_set(#{deptId}, ancestors)
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int">
|
<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 count(*) from sys_dept where status = 0 and del_flag = '0' and find_in_set(#{deptId}, ancestors)
|
||||||
</select>
|
</select>
|
||||||
|
|
@ -96,7 +96,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
#{item.deptName}
|
#{item.deptName}
|
||||||
</foreach>
|
</foreach>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="checkDeptNameUnique" resultMap="SysDeptResult">
|
<select id="checkDeptNameUnique" resultMap="SysDeptResult">
|
||||||
<include refid="selectDeptVo"/>
|
<include refid="selectDeptVo"/>
|
||||||
where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
|
where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
|
||||||
|
|
@ -113,7 +113,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
)
|
)
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<insert id="insertDept" parameterType="com.bonus.sgzb.system.api.domain.SysDept">
|
<insert id="insertDept" parameterType="com.bonus.sgzb.system.api.domain.SysDept">
|
||||||
insert into sys_dept(
|
insert into sys_dept(
|
||||||
<if test="deptId != null and deptId != 0">dept_id,</if>
|
<if test="deptId != null and deptId != 0">dept_id,</if>
|
||||||
|
|
@ -143,7 +143,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
sysdate()
|
sysdate()
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
|
<insert id="insertCompany" 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,social_credit_code,enterprise_ownership_code)
|
||||||
|
values(
|
||||||
|
#{deptId},#{parentId},#{deptName},#{ancestors},#{orderNum},#{leader},
|
||||||
|
#{phone},#{email},#{status},#{createBy},#{companyId},
|
||||||
|
sysdate(),#{socialCreditCode},#{enterpriseOwnershipCode}
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
<update id="updateDept" parameterType="com.bonus.sgzb.system.api.domain.SysDept">
|
<update id="updateDept" parameterType="com.bonus.sgzb.system.api.domain.SysDept">
|
||||||
update sys_dept
|
update sys_dept
|
||||||
<set>
|
<set>
|
||||||
|
|
@ -156,11 +165,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="email != null">email = #{email},</if>
|
<if test="email != null">email = #{email},</if>
|
||||||
<if test="status != null and status != ''">status = #{status},</if>
|
<if test="status != null and status != ''">status = #{status},</if>
|
||||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||||
|
<if test="socialCreditCode != null and socialCreditCode != ''">social_credit_code = #{socialCreditCode},</if>
|
||||||
|
<if test="enterpriseOwnershipCode != null and enterpriseOwnershipCode != ''">enterprise_ownership_code = #{enterpriseOwnershipCode},</if>
|
||||||
update_time = sysdate()
|
update_time = sysdate()
|
||||||
</set>
|
</set>
|
||||||
where dept_id = #{deptId}
|
where dept_id = #{deptId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="updateDeptChildren" parameterType="java.util.List">
|
<update id="updateDeptChildren" parameterType="java.util.List">
|
||||||
update sys_dept set ancestors =
|
update sys_dept set ancestors =
|
||||||
<foreach collection="depts" item="item" index="index"
|
<foreach collection="depts" item="item" index="index"
|
||||||
|
|
@ -173,14 +184,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
#{item.deptId}
|
#{item.deptId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="updateDeptStatusNormal" parameterType="Long">
|
<update id="updateDeptStatusNormal" parameterType="Long">
|
||||||
update sys_dept set status = '0' where dept_id in
|
update sys_dept set status = '0' where dept_id in
|
||||||
<foreach collection="array" item="deptId" open="(" separator="," close=")">
|
<foreach collection="array" item="deptId" open="(" separator="," close=")">
|
||||||
#{deptId}
|
#{deptId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<delete id="deleteDeptById" parameterType="Long">
|
<delete id="deleteDeptById" parameterType="Long">
|
||||||
update sys_dept set del_flag = '2' where dept_id = #{deptId}
|
update sys_dept set del_flag = '2' where dept_id = #{deptId}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
@ -199,4 +210,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
select max(dept_id)
|
select max(dept_id)
|
||||||
from sys_dept
|
from sys_dept
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
<select id="checkCompanyNameUnique" resultType="java.lang.Integer">
|
||||||
|
select count(*)
|
||||||
|
from sys_dept
|
||||||
|
where dept_name = #{deptName}
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue