新增公司
This commit is contained in:
parent
3e5b0245af
commit
4dfc5570cb
|
|
@ -96,8 +96,6 @@ public class SysPostController extends BaseController {
|
||||||
@SysLog(title = "岗位管理", businessType = OperaType.INSERT, logType = 0, module = "系统管理->岗位管理", details = "新增岗位")
|
@SysLog(title = "岗位管理", businessType = OperaType.INSERT, logType = 0, module = "系统管理->岗位管理", details = "新增岗位")
|
||||||
public AjaxResult add(@Validated @RequestBody SysPost post) {
|
public AjaxResult add(@Validated @RequestBody SysPost post) {
|
||||||
try {
|
try {
|
||||||
Long companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId();
|
|
||||||
post.setCompanyId(companyId);
|
|
||||||
if (!postService.checkPostNameUnique(post)) {
|
if (!postService.checkPostNameUnique(post)) {
|
||||||
return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||||
} else if (!postService.checkPostCodeUnique(post)) {
|
} else if (!postService.checkPostCodeUnique(post)) {
|
||||||
|
|
|
||||||
|
|
@ -85,16 +85,16 @@ public interface SysPostMapper
|
||||||
/**
|
/**
|
||||||
* 校验岗位名称
|
* 校验岗位名称
|
||||||
*
|
*
|
||||||
* @param postName 岗位名称
|
* @param post
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public SysPost checkPostNameUnique(String postName);
|
public SysPost checkPostNameUnique(SysPost post);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验岗位编码
|
* 校验岗位编码
|
||||||
*
|
*
|
||||||
* @param postCode 岗位编码
|
* @param post
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public SysPost checkPostCodeUnique(String postCode);
|
public SysPost checkPostCodeUnique(SysPost post);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,18 +60,18 @@ public interface SysRoleMapper
|
||||||
/**
|
/**
|
||||||
* 校验角色名称是否唯一
|
* 校验角色名称是否唯一
|
||||||
*
|
*
|
||||||
* @param roleName 角色名称
|
* @param role 角色名称
|
||||||
* @return 角色信息
|
* @return 角色信息
|
||||||
*/
|
*/
|
||||||
public SysRole checkRoleNameUnique(String roleName);
|
public SysRole checkRoleNameUnique(SysRole role);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验角色权限是否唯一
|
* 校验角色权限是否唯一
|
||||||
*
|
*
|
||||||
* @param roleKey 角色权限
|
* @param role 角色权限
|
||||||
* @return 角色信息
|
* @return 角色信息
|
||||||
*/
|
*/
|
||||||
public SysRole checkRoleKeyUnique(String roleKey);
|
public SysRole checkRoleKeyUnique(SysRole role);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改角色信息
|
* 修改角色信息
|
||||||
|
|
|
||||||
|
|
@ -460,8 +460,9 @@ public class SysDeptServiceImpl implements ISysDeptService
|
||||||
private void createCompanyAdminRole(SysDept sysDept, SysUser user) {
|
private void createCompanyAdminRole(SysDept sysDept, SysUser user) {
|
||||||
log.info("部门信息{},公司管理员用户{}",sysDept,user);
|
log.info("部门信息{},公司管理员用户{}",sysDept,user);
|
||||||
SysRole role = new SysRole();
|
SysRole role = new SysRole();
|
||||||
role.setRoleKey("company_"+sysDept.getDeptId()+"_admin");
|
role.setRoleKey("company_admin");
|
||||||
role.setRoleName("company_"+sysDept.getDeptId()+"_管理员");
|
role.setRoleName("公司管理员");
|
||||||
|
role.setRemark("公司管理员");
|
||||||
role.setCompanyId(sysDept.getDeptId());
|
role.setCompanyId(sysDept.getDeptId());
|
||||||
role.setRoleSort(0);
|
role.setRoleSort(0);
|
||||||
role.setStatus("0");
|
role.setStatus("0");
|
||||||
|
|
|
||||||
|
|
@ -94,8 +94,10 @@ public class SysPostServiceImpl implements ISysPostService
|
||||||
@Override
|
@Override
|
||||||
public boolean checkPostNameUnique(SysPost post)
|
public boolean checkPostNameUnique(SysPost post)
|
||||||
{
|
{
|
||||||
|
Long companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId();
|
||||||
|
post.setCompanyId(companyId);
|
||||||
Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId();
|
Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId();
|
||||||
SysPost info = postMapper.checkPostNameUnique(post.getPostName());
|
SysPost info = postMapper.checkPostNameUnique(post);
|
||||||
if (StringUtils.isNotNull(info) && info.getPostId().longValue() != postId.longValue())
|
if (StringUtils.isNotNull(info) && info.getPostId().longValue() != postId.longValue())
|
||||||
{
|
{
|
||||||
return UserConstants.NOT_UNIQUE;
|
return UserConstants.NOT_UNIQUE;
|
||||||
|
|
@ -112,8 +114,10 @@ public class SysPostServiceImpl implements ISysPostService
|
||||||
@Override
|
@Override
|
||||||
public boolean checkPostCodeUnique(SysPost post)
|
public boolean checkPostCodeUnique(SysPost post)
|
||||||
{
|
{
|
||||||
|
Long companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId();
|
||||||
|
post.setCompanyId(companyId);
|
||||||
Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId();
|
Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId();
|
||||||
SysPost info = postMapper.checkPostCodeUnique(post.getPostCode());
|
SysPost info = postMapper.checkPostCodeUnique(post);
|
||||||
if (StringUtils.isNotNull(info) && info.getPostId().longValue() != postId.longValue())
|
if (StringUtils.isNotNull(info) && info.getPostId().longValue() != postId.longValue())
|
||||||
{
|
{
|
||||||
return UserConstants.NOT_UNIQUE;
|
return UserConstants.NOT_UNIQUE;
|
||||||
|
|
|
||||||
|
|
@ -167,8 +167,10 @@ public class SysRoleServiceImpl implements ISysRoleService
|
||||||
@Override
|
@Override
|
||||||
public boolean checkRoleNameUnique(SysRole role)
|
public boolean checkRoleNameUnique(SysRole role)
|
||||||
{
|
{
|
||||||
|
Long companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId();
|
||||||
|
role.setCompanyId(companyId);
|
||||||
Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId();
|
Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId();
|
||||||
SysRole info = roleMapper.checkRoleNameUnique(role.getRoleName());
|
SysRole info = roleMapper.checkRoleNameUnique(role);
|
||||||
if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue())
|
if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue())
|
||||||
{
|
{
|
||||||
return UserConstants.NOT_UNIQUE;
|
return UserConstants.NOT_UNIQUE;
|
||||||
|
|
@ -185,8 +187,10 @@ public class SysRoleServiceImpl implements ISysRoleService
|
||||||
@Override
|
@Override
|
||||||
public boolean checkRoleKeyUnique(SysRole role)
|
public boolean checkRoleKeyUnique(SysRole role)
|
||||||
{
|
{
|
||||||
|
Long companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId();
|
||||||
|
role.setCompanyId(companyId);
|
||||||
Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId();
|
Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId();
|
||||||
SysRole info = roleMapper.checkRoleKeyUnique(role.getRoleKey());
|
SysRole info = roleMapper.checkRoleKeyUnique(role);
|
||||||
if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue())
|
if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue())
|
||||||
{
|
{
|
||||||
return UserConstants.NOT_UNIQUE;
|
return UserConstants.NOT_UNIQUE;
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
where u.user_name = #{userName}
|
where u.user_name = #{userName}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="checkPostNameUnique" parameterType="String" resultMap="SysPostResult">
|
<select id="checkPostNameUnique" parameterType="com.bonus.system.api.domain.SysPost" resultMap="SysPostResult">
|
||||||
<include refid="selectPostVo"/>
|
<include refid="selectPostVo"/>
|
||||||
where post_name=#{postName}
|
where post_name=#{postName}
|
||||||
<if test="companyId != null and companyId != 0">
|
<if test="companyId != null and companyId != 0">
|
||||||
|
|
@ -80,7 +80,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
limit 1
|
limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="checkPostCodeUnique" parameterType="String" resultMap="SysPostResult">
|
<select id="checkPostCodeUnique" parameterType="com.bonus.system.api.domain.SysPost" resultMap="SysPostResult">
|
||||||
<include refid="selectPostVo"/>
|
<include refid="selectPostVo"/>
|
||||||
where post_code=#{postCode}
|
where post_code=#{postCode}
|
||||||
<if test="companyId != null and companyId != 0">
|
<if test="companyId != null and companyId != 0">
|
||||||
|
|
|
||||||
|
|
@ -88,14 +88,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
WHERE r.del_flag = '0' and u.user_name = #{userName}
|
WHERE r.del_flag = '0' and u.user_name = #{userName}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="checkRoleNameUnique" parameterType="String" resultMap="SysRoleResult">
|
<select id="checkRoleNameUnique" parameterType="com.bonus.system.api.domain.SysRole" resultMap="SysRoleResult">
|
||||||
<include refid="selectRoleVo"/>
|
<include refid="selectRoleVo"/>
|
||||||
where r.role_name=#{roleName} and r.del_flag = '0' limit 1
|
where r.role_name=#{roleName} and r.del_flag = '0'
|
||||||
|
<if test="companyId != null and companyId != 0">
|
||||||
|
AND company_id = #{companyId}
|
||||||
|
</if>
|
||||||
|
limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="checkRoleKeyUnique" parameterType="String" resultMap="SysRoleResult">
|
<select id="checkRoleKeyUnique" parameterType="com.bonus.system.api.domain.SysRole" resultMap="SysRoleResult">
|
||||||
<include refid="selectRoleVo"/>
|
<include refid="selectRoleVo"/>
|
||||||
where r.role_key=#{roleKey} and r.del_flag = '0' limit 1
|
where r.role_key=#{roleKey} and r.del_flag = '0'
|
||||||
|
<if test="companyId != null and companyId != 0">
|
||||||
|
AND company_id = #{companyId}
|
||||||
|
</if>
|
||||||
|
limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertRole" parameterType="com.bonus.system.api.domain.SysRole" useGeneratedKeys="true" keyProperty="roleId">
|
<insert id="insertRole" parameterType="com.bonus.system.api.domain.SysRole" useGeneratedKeys="true" keyProperty="roleId">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue