Compare commits
4 Commits
09c28eb1fb
...
1910013cbb
Author | SHA1 | Date |
---|---|---|
|
1910013cbb | |
|
b8e3b4dcd1 | |
|
2b392ec1d1 | |
|
24c219c145 |
|
@ -15,11 +15,9 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -58,7 +58,6 @@ public class BaseEntity implements Serializable {
|
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
|
|
|
@ -49,7 +49,7 @@ public class SecurityUtils {
|
|||
* 获取登录企业ID
|
||||
*/
|
||||
public static Long getEnterpriseId(){
|
||||
Long enterpriseId = getLoginUser().getEnterpriseId();
|
||||
Long enterpriseId = getLoginUser().getDeptId();
|
||||
Assert.notNull(enterpriseId, "该用户未绑定负责企业");
|
||||
return enterpriseId;
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ public class LoginUser implements Serializable {
|
|||
/**
|
||||
* 企业ID
|
||||
*/
|
||||
private Long enterpriseId;
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 用户信息
|
||||
|
|
|
@ -2,16 +2,16 @@ package com.couplet.common.system.remote;
|
|||
|
||||
import com.couplet.common.core.constant.ServiceNameConstants;
|
||||
import com.couplet.common.core.domain.Result;
|
||||
import com.couplet.common.core.web.page.TableDataInfo;
|
||||
import com.couplet.common.system.domain.SysDept;
|
||||
import com.couplet.common.system.domain.SysUser;
|
||||
import com.couplet.common.system.remote.factory.RemoteDeptFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@FeignClient(contextId = "remoteFileService" ,
|
||||
@FeignClient(contextId = "remoteDeptService" ,
|
||||
value = ServiceNameConstants.SYSTEM_SERVICE,
|
||||
fallbackFactory = RemoteDeptFallbackFactory.class,
|
||||
path = "/dept"
|
||||
|
@ -28,9 +28,70 @@ public interface RemoteDeptService {
|
|||
|
||||
/**
|
||||
* 根据企业ID获取企业下部门
|
||||
* @param enterpriseId 企业ID
|
||||
*
|
||||
* @param deptId 企业ID
|
||||
* @return 企业信息,内含有部门
|
||||
*/
|
||||
@GetMapping("/getSysDeptByEnterpriseId/{enterpriseId}")
|
||||
public Result<SysDept> getSysDeptByEnterpriseId(@PathVariable(value = "enterpriseId") Long enterpriseId);
|
||||
@GetMapping("/getSysDeptByDeptId/{deptId}")
|
||||
public Result<List<SysDept>> getSysDeptByDeptId(@PathVariable(value = "deptId") Long deptId);
|
||||
|
||||
|
||||
/*
|
||||
* @param dept:
|
||||
* @return Result
|
||||
* @author 付凡芮
|
||||
* @description 企业部门添加
|
||||
* @date
|
||||
*/
|
||||
@PostMapping
|
||||
public Result add (@Validated @RequestBody SysDept dept);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* @param dept:
|
||||
* @return null
|
||||
* @author 付凡芮
|
||||
* @description 企业部门修改
|
||||
* @date
|
||||
*/
|
||||
|
||||
@PutMapping
|
||||
public Result edit (@Validated @RequestBody SysDept dept);
|
||||
|
||||
|
||||
/*
|
||||
* @param null:
|
||||
* @return null
|
||||
* @author 付凡芮
|
||||
* @description 删除企业部门
|
||||
* @date
|
||||
*/
|
||||
@DeleteMapping("/{deptId}")
|
||||
public Result remove (@PathVariable(value = "deptId") Long deptId);
|
||||
|
||||
|
||||
/*
|
||||
* @param deptId:
|
||||
* @return Result
|
||||
* @author 付凡芮
|
||||
* @description 根据deptId获取部门详情
|
||||
* @date
|
||||
*/
|
||||
@GetMapping(value = "/{deptId}")
|
||||
public Result getInfo (@PathVariable(value = "deptId") Long deptId);
|
||||
|
||||
|
||||
/*
|
||||
* @param deptId:
|
||||
* @return Result
|
||||
* @author 付凡芮
|
||||
* @description 查询部门列表
|
||||
* @date
|
||||
*/
|
||||
|
||||
@GetMapping("/list/exclude/{deptId}")
|
||||
public Result excludeChild (@PathVariable(value = "deptId") Long deptId);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ public interface RemoteUserService {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
|
||||
@GetMapping("/user/info/{username}")
|
||||
public Result<LoginUser> getUserInfo (@PathVariable("username") String username, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package com.couplet.common.system.remote.factory;
|
||||
|
||||
import com.couplet.common.core.domain.Result;
|
||||
import com.couplet.common.core.web.page.TableDataInfo;
|
||||
import com.couplet.common.system.domain.SysDept;
|
||||
import com.couplet.common.system.domain.SysUser;
|
||||
import com.couplet.common.system.remote.RemoteDeptService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author fufanrui
|
||||
* @version 1.0
|
||||
|
@ -20,24 +20,88 @@ public class RemoteDeptFallbackFactory implements FallbackFactory<RemoteDeptServ
|
|||
@Override
|
||||
public RemoteDeptService create(Throwable cause) {
|
||||
log.error("sys服务调用失败:{}", cause.getMessage());
|
||||
|
||||
return new RemoteDeptService() {
|
||||
|
||||
@Override
|
||||
public Result list(SysDept dept) {
|
||||
return Result.error("调用失败..."+cause.getMessage());
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据企业ID获取企业下部门
|
||||
*
|
||||
* @param enterpriseId 企业ID
|
||||
*
|
||||
* @param deptId 企业ID
|
||||
* @return 企业信息,内含有部门
|
||||
*/
|
||||
@Override
|
||||
public Result<SysDept> getSysDeptByEnterpriseId (Long enterpriseId) {
|
||||
public Result<List<SysDept>> getSysDeptByDeptId(Long deptId) {
|
||||
return Result.error("调用失败...."+cause.getMessage());
|
||||
}
|
||||
/*
|
||||
* @param cause:
|
||||
* @return RemoteDeptService
|
||||
* @author 付凡芮
|
||||
* @description 添加企业部门
|
||||
* @date
|
||||
*/
|
||||
|
||||
@Override
|
||||
public Result add(SysDept dept) {
|
||||
return Result.error("调用失败...."+cause.getMessage());
|
||||
}
|
||||
|
||||
/*
|
||||
* @param dept:
|
||||
* @return Result
|
||||
* @author 付凡芮
|
||||
* @description 修改企业部门
|
||||
* @date
|
||||
*/
|
||||
@Override
|
||||
public Result edit(SysDept dept) {
|
||||
return Result.error("调用失败..."+cause.getMessage());
|
||||
}
|
||||
|
||||
/*
|
||||
* @param deptId:
|
||||
* @return Result
|
||||
* @author 付凡芮
|
||||
* @description 删除企业部门
|
||||
* @date
|
||||
*/
|
||||
@Override
|
||||
public Result remove(Long deptId) {
|
||||
return Result.error("调用失败...."+cause.getMessage());
|
||||
}
|
||||
|
||||
/*
|
||||
* @param deptId:
|
||||
* @return Result
|
||||
* @author 付凡芮
|
||||
* @description 根据deptId获取部门详情
|
||||
* @date
|
||||
*/
|
||||
@Override
|
||||
public Result getInfo(Long deptId) {
|
||||
return Result.error("调用失败....."+cause.getMessage());
|
||||
}
|
||||
/*
|
||||
* @param deptId:
|
||||
* @return Result
|
||||
* @author 付凡芮
|
||||
* @description 查询部门列表
|
||||
* @date
|
||||
*/
|
||||
@Override
|
||||
public Result excludeChild(Long deptId) {
|
||||
return Result.error("调用失败...."+cause.getMessage());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,11 +15,9 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -20,7 +20,8 @@ public class FenceConfig {
|
|||
/**
|
||||
* 围栏状态
|
||||
*/
|
||||
|
||||
private Integer fenceState;
|
||||
private Integer pageNum=1;
|
||||
private Integer pageSize=3;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.couplet.map.common.domain.request;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
@ -47,11 +48,13 @@ public class FenceUpdateRequest {
|
|||
* 更新时间
|
||||
*/
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date updateTime;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
|
@ -67,4 +70,11 @@ public class FenceUpdateRequest {
|
|||
*/
|
||||
private Integer alarmStatus;
|
||||
|
||||
public Integer getIsDelete() {
|
||||
return isDelete;
|
||||
}
|
||||
|
||||
public void setIsDelete(Integer isDelete) {
|
||||
this.isDelete = isDelete;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,12 +80,12 @@ public class FenceController extends BaseController {
|
|||
* @param fenceId
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping("/{fenceDelete}")
|
||||
@DeleteMapping("/{fenceId}")
|
||||
@RequiresPermissions("couplet:fence:fenceDelete")
|
||||
@Log(title = "电子围栏删除",businessType = BusinessType.DELETE)
|
||||
public Result<?> fenceDelete(@PathVariable Long fenceId){
|
||||
boolean b = fenceService.removeById(fenceId);
|
||||
fenceService.removeByFenceId(fenceId);
|
||||
// fenceService.removeByFenceId(fenceId);
|
||||
return toAjax(b);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,10 +2,13 @@ package com.couplet.map.server.mapper;
|
|||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.couplet.map.common.domain.Fence;
|
||||
import com.couplet.map.common.domain.request.FenceConfig;
|
||||
import com.couplet.map.common.domain.request.FenceRequest;
|
||||
import com.couplet.map.common.domain.request.FenceUpdateRequest;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: LiJiaYao
|
||||
* @Date: 2024/3/28
|
||||
|
@ -22,4 +25,11 @@ public interface FenceMapper extends BaseMapper<Fence> {
|
|||
|
||||
void removeByFenceId(Long fenceId);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param fenceConfig
|
||||
* @return
|
||||
*/
|
||||
List<Fence> pageQuery(FenceConfig fenceConfig);
|
||||
|
||||
}
|
||||
|
|
|
@ -43,22 +43,8 @@ public class FenceServiceImpl extends ServiceImpl<FenceMapper, Fence> implements
|
|||
|
||||
@Override
|
||||
public List<Fence> pageQuery(FenceConfig fenceConfig) {
|
||||
LambdaQueryWrapper<Fence> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
/**
|
||||
* 模糊查询电子围栏名称
|
||||
*/
|
||||
if (StringUtils.isNotEmpty(fenceConfig.getFenceName())){
|
||||
|
||||
queryWrapper.like(Fence::getFenceName,fenceConfig.getFenceName());
|
||||
}
|
||||
/**
|
||||
* 查询标识类型
|
||||
*/
|
||||
if (fenceConfig.getFenceState()!=null){
|
||||
queryWrapper.like(Fence::getFenceState,fenceConfig.getFenceState());
|
||||
}
|
||||
return this.list(queryWrapper);
|
||||
List<Fence> list= fenceMapper.pageQuery(fenceConfig);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -19,14 +19,32 @@
|
|||
<id property="logoId" column="logo_id"/>
|
||||
<result property="logoName" column="logo_name" />
|
||||
</resultMap>
|
||||
<sql id="selectFence">
|
||||
SELECT
|
||||
fence_id,
|
||||
fence_name,
|
||||
fence_longitude_latitude,
|
||||
fence_description,
|
||||
is_delete,
|
||||
fence_state,
|
||||
create_time,
|
||||
update_time,
|
||||
create_name,
|
||||
maintainer_name,
|
||||
alarm_status,
|
||||
l.logo_id,
|
||||
logo_name
|
||||
FROM couplet_fence_info f INNER JOIN couplet_fences_and_logo m on
|
||||
f.fence_id=m.fences_id INNER JOIN couplet_logo_info l on l.logo_id=m.logo_id GROUP BY fence_id
|
||||
</sql>
|
||||
<insert id="insertFence" parameterType="com.couplet.map.common.domain.request.FenceRequest" keyProperty="fenceId"
|
||||
useGeneratedKeys="true">
|
||||
|
||||
INSERT INTO `couplet-cloud`.`couplet_fence_info`
|
||||
(`fence_name`, `fence_longitude_latitude`, `fence_description`, `is_delete`, `fence_state`, `create_time`,
|
||||
(`fence_name`, `fence_description`, `is_delete`, `fence_state`, `create_time`,
|
||||
`create_name`, `maintainer_name`, `alarm_status`)
|
||||
VALUES
|
||||
(#{fenceName}, #{fenceLongitudeLatitude}, #{fenceDescription}, 0, 0, now(), #{createTime},
|
||||
(#{fenceName}, #{fenceDescription}, 0, 0, now(), #{createTime},
|
||||
#{createName}, 0);
|
||||
|
||||
|
||||
|
@ -38,7 +56,7 @@
|
|||
SET `fence_name` = #{fenceName},
|
||||
`fence_longitude_latitude` = #{fenceLongitudeLatitude},
|
||||
`fence_description` = #{fenceDescription},
|
||||
`is_delete` = #{isdelete},
|
||||
`is_delete` = #{isDelete},
|
||||
`fence_state` = #{fenceState},
|
||||
`update_time` = now(),
|
||||
`maintainer_name` = 'admin',
|
||||
|
@ -47,6 +65,18 @@
|
|||
|
||||
</update>
|
||||
<delete id="removeByFenceId" parameterType="java.lang.Long">
|
||||
delete from t_fence where fence_id = #{fenceId}
|
||||
delete from couplet_fence_info where fence_id = #{fenceId}
|
||||
</delete>
|
||||
<select id="pageQuery" resultMap="map"
|
||||
parameterType="com.couplet.map.common.domain.request.FenceConfig">
|
||||
<include refid="selectFence"></include>
|
||||
<where>
|
||||
<if test="fenceName!=null and fenceName!='' ">
|
||||
and fence_name like concat('%',#{fenceName},'%')
|
||||
</if>
|
||||
<if test="fenceState!=null">
|
||||
and fence_state = #{fenceState}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
@ -1,23 +1,92 @@
|
|||
package com.couplet.server.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.couplet.common.core.domain.Result;
|
||||
import com.couplet.common.log.annotation.Log;
|
||||
import com.couplet.common.log.enums.BusinessType;
|
||||
import com.couplet.common.security.annotation.RequiresPermissions;
|
||||
import com.couplet.common.system.domain.SysDept;
|
||||
import com.couplet.server.service.ManageServer;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author fufanrui
|
||||
* @version 1.0
|
||||
* @description: TODO
|
||||
* @date 2024/3/27 15:33
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/manage")
|
||||
public class ManageController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private ManageServer manageServer;
|
||||
|
||||
|
||||
/*
|
||||
* @param sysDept:
|
||||
* @return Result
|
||||
* @author 付凡芮
|
||||
* @description 登入后获取到企业下的所有部门
|
||||
* @date
|
||||
*/
|
||||
@GetMapping("manageList")
|
||||
@RequiresPermissions("system:dept:list")
|
||||
public Result<List<SysDept>> manageList() {
|
||||
List<SysDept> sysDepts = manageServer.selectDeptList();
|
||||
return Result.success(sysDepts);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @param sysDept:
|
||||
* @return Result
|
||||
* @author 付凡芮
|
||||
* @description 添加企业中的部门
|
||||
* @date
|
||||
*/
|
||||
@RequiresPermissions("system:dept:add")
|
||||
@Log(title = "部门管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result manageInsert(@RequestBody SysDept sysDept) {
|
||||
return manageServer.insertDept(sysDept);
|
||||
}
|
||||
|
||||
|
||||
@RequiresPermissions("system:dept:edit")
|
||||
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public Result manageEdit(@RequestBody SysDept sysDept) {
|
||||
return manageServer.manageEdit(sysDept);
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:dept:remove")
|
||||
@Log(title = "部门管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{deptId}")
|
||||
public Result manageRemove(@PathVariable Long deptId){
|
||||
return manageServer.manageRemove(deptId);
|
||||
}
|
||||
|
||||
|
||||
// @GetMapping("/getSysDeptByDeptId/{deptId}")
|
||||
// public Result<List<SysDept>> getSysDeptByDeptId(@PathVariable(value = "deptId") Long deptId) {
|
||||
// return manageServer.getSysDeptByDeptId(deptId);
|
||||
// }
|
||||
|
||||
@RequiresPermissions("system:dept:query")
|
||||
@GetMapping(value = "/{deptId}")
|
||||
public Result getInfo(@PathVariable Long deptId) {
|
||||
return manageServer.getInfo(deptId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RequiresPermissions("system:dept:list")
|
||||
@GetMapping("/list/exclude/{deptId}")
|
||||
public Result excludeChild(@PathVariable(value = "deptId") Long deptId) {
|
||||
return manageServer.excludeChild(deptId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,23 @@
|
|||
package com.couplet.server.service;
|
||||
|
||||
import com.couplet.common.core.domain.Result;
|
||||
import com.couplet.common.system.domain.SysDept;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ManageServer {
|
||||
|
||||
|
||||
List<SysDept> selectDeptList();
|
||||
|
||||
Result insertDept(SysDept sysDept);
|
||||
|
||||
Result manageEdit(SysDept sysDept);
|
||||
|
||||
Result manageRemove(Long deptId);
|
||||
|
||||
Result getInfo(Long deptId);
|
||||
|
||||
Result excludeChild(Long deptId);
|
||||
}
|
||||
|
|
|
@ -1,32 +1,72 @@
|
|||
package com.couplet.server.service.impl;
|
||||
|
||||
import com.couplet.common.core.constant.SecurityConstants;
|
||||
import com.couplet.common.core.domain.Result;
|
||||
import com.couplet.common.core.utils.StringUtils;
|
||||
import com.couplet.common.security.utils.SecurityUtils;
|
||||
import com.couplet.common.system.domain.LoginUser;
|
||||
import com.couplet.common.system.domain.SysDept;
|
||||
import com.couplet.common.system.remote.RemoteDeptService;
|
||||
import com.couplet.common.system.remote.RemoteUserService;
|
||||
import com.couplet.server.service.ManageServer;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author fufanrui
|
||||
* @version 1.0
|
||||
* @description: TODO
|
||||
* @description: 管理企业业务层
|
||||
* @date 2024/3/27 15:34
|
||||
*/
|
||||
@Service
|
||||
public class ManageServiceImpl implements ManageServer {
|
||||
public class ManageServiceImpl implements ManageServer{
|
||||
|
||||
// @Autowired
|
||||
// private RemoteDeptService remoteDeptService;
|
||||
// {
|
||||
// Long enterpriseId = SecurityUtils.getEnterpriseId();
|
||||
// Result<SysDept> sysDeptByEnterpriseId = remoteDeptService.getSysDeptByEnterpriseId(enterpriseId);
|
||||
// if (sysDeptByEnterpriseId.getCode() == 200){
|
||||
// SysDept sysDept = sysDeptByEnterpriseId.getData();
|
||||
// }
|
||||
// }
|
||||
@Autowired
|
||||
private RemoteDeptService remoteDeptService;
|
||||
@Autowired
|
||||
private RemoteUserService remoteUserService;
|
||||
|
||||
@Override
|
||||
public List<SysDept> selectDeptList() {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
String username = loginUser.getUsername();
|
||||
Result<LoginUser> userInfo = remoteUserService.getUserInfo(username, SecurityConstants.FROM_SOURCE);
|
||||
LoginUser user = userInfo.getData();
|
||||
Long deptId = user.getDeptId();
|
||||
Result<List<SysDept>> sysDeptByDeptId = remoteDeptService.getSysDeptByDeptId(deptId);
|
||||
List<SysDept> dept = sysDeptByDeptId.getData();
|
||||
return dept;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result insertDept(SysDept sysDept) {
|
||||
|
||||
return remoteDeptService.add(sysDept);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result manageEdit(SysDept sysDept) {
|
||||
return remoteDeptService.edit(sysDept);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result manageRemove(Long deptId) {
|
||||
return remoteDeptService.remove(deptId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Result getInfo(Long deptId) {
|
||||
return remoteDeptService.getInfo(deptId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result excludeChild(Long deptId) {
|
||||
return remoteDeptService.excludeChild(deptId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import com.couplet.common.security.utils.SecurityUtils;
|
|||
import com.couplet.common.system.domain.SysDept;
|
||||
import com.couplet.system.service.SysDeptService;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.math3.analysis.solvers.BrentSolver;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
@ -110,12 +111,13 @@ public class SysDeptController extends BaseController {
|
|||
|
||||
/**
|
||||
* 根据企业ID获取企业下部门
|
||||
* @param enterpriseId 企业ID
|
||||
* @param deptId 企业ID
|
||||
* @return 企业信息,内含有部门
|
||||
*/
|
||||
@GetMapping("/getSysDeptByEnterpriseId/{enterpriseId}")
|
||||
public Result<SysDept> getSysDeptByEnterpriseId(@PathVariable(value = "enterpriseId") Long enterpriseId){
|
||||
SysDept sysDept = deptService.getSysDeptByEnterpriseId(enterpriseId);
|
||||
return Result.success(sysDept);
|
||||
@GetMapping("/getSysDeptByDeptId/{deptId}")
|
||||
public Result<List<SysDept>> getSysDeptByDeptId(@PathVariable(value = "deptId") Long deptId){
|
||||
List<SysDept> sysDept = deptService.getSysDeptByDeptId(deptId);
|
||||
Result<List<SysDept>> success = Result.success(sysDept);
|
||||
return success;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,7 +96,6 @@ public class SysUserController extends BaseController {
|
|||
/**
|
||||
* 获取当前用户信息
|
||||
*/
|
||||
@InnerAuth
|
||||
@GetMapping("/info/{username}")
|
||||
public Result<LoginUser> info (@PathVariable("username") String username) {
|
||||
SysUser sysUser = userService.selectUserByUserName(username);
|
||||
|
@ -113,10 +112,9 @@ public class SysUserController extends BaseController {
|
|||
sysUserVo.setSysUser(sysUser);
|
||||
sysUserVo.setRoles(roles);
|
||||
sysUserVo.setPermissions(permissions);
|
||||
sysUserVo.setEnterpriseId(deptId);
|
||||
sysUserVo.setDeptId(deptId);
|
||||
return Result.success(sysUserVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册用户信息
|
||||
*/
|
||||
|
|
|
@ -128,4 +128,9 @@ public interface SysDeptMapper extends BaseMapper<SysDept> {
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteDeptById (Long deptId);
|
||||
|
||||
SysDept selectDeptIdByLeader(String userName);
|
||||
|
||||
List<SysDept> getSysDeptByDeptId(Long deptId);
|
||||
|
||||
}
|
||||
|
|
|
@ -138,15 +138,15 @@ public interface SysDeptService extends IService<SysDept> {
|
|||
|
||||
/**
|
||||
* 通过负责人查询企业ID
|
||||
* @param leader 负责人
|
||||
* @param userName 负责人
|
||||
* @return 企业ID
|
||||
*/
|
||||
Long selectDeptIdByLeader (String leader);
|
||||
Long selectDeptIdByLeader (String userName);
|
||||
|
||||
/**
|
||||
* 根据企业ID获取企业下部门
|
||||
* @param enterpriseId 企业ID
|
||||
* @param deptId 企业ID
|
||||
* @return 企业信息,内含有部门
|
||||
*/
|
||||
SysDept getSysDeptByEnterpriseId (Long enterpriseId);
|
||||
List<SysDept> getSysDeptByDeptId(Long deptId);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.couplet.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.couplet.common.core.constant.UserConstants;
|
||||
import com.couplet.common.core.exception.ServiceException;
|
||||
|
@ -63,7 +63,6 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
|||
List<SysDept> depts = SpringUtils.getAopProxy(this).selectDeptList(dept);
|
||||
return buildDeptTreeSelect(depts);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建前端所需要树结构
|
||||
*
|
||||
|
@ -285,31 +284,33 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
|||
/**
|
||||
* 通过负责人查询企业ID
|
||||
*
|
||||
* @param leader 负责人
|
||||
* @param userName 负责人
|
||||
*
|
||||
* @return 企业ID
|
||||
*/
|
||||
@Override
|
||||
public Long selectDeptIdByLeader (String leader) {
|
||||
SysDept sysDept = getOne(new LambdaQueryWrapper<>() {{
|
||||
eq(SysDept::getLeader, leader);
|
||||
}});
|
||||
public Long selectDeptIdByLeader (String userName) {
|
||||
|
||||
SysDept sysDept = deptMapper.selectDeptIdByLeader(userName);
|
||||
|
||||
return sysDept == null ? null : sysDept.getDeptId();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据企业ID获取企业下部门
|
||||
*
|
||||
* @param enterpriseId 企业ID
|
||||
* @param deptId 企业ID
|
||||
*
|
||||
* @return 企业信息,内含有部门
|
||||
*/
|
||||
@Override
|
||||
public SysDept getSysDeptByEnterpriseId (Long enterpriseId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysDept> getSysDeptByDeptId(Long deptId) {
|
||||
|
||||
return deptMapper.getSysDeptByDeptId(deptId);
|
||||
}
|
||||
/**
|
||||
* 递归列表
|
||||
*/
|
||||
|
|
|
@ -15,11 +15,9 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -108,6 +108,12 @@
|
|||
<include refid="selectDeptVo"/>
|
||||
where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
|
||||
</select>
|
||||
<select id="selectDeptIdByLeader" resultType="com.couplet.common.system.domain.SysDept">
|
||||
SELECT * FROM sys_dept d LEFT JOIN sys_user u on d.dept_id = u.dept_id WHERE u.user_name = #{userName}
|
||||
</select>
|
||||
<select id="getSysDeptByDeptId" resultType="com.couplet.common.system.domain.SysDept">
|
||||
SELECT * FROM sys_dept WHERE parent_id = #{deptId}
|
||||
</select>
|
||||
|
||||
<insert id="insertDept" parameterType="com.couplet.common.system.domain.SysDept">
|
||||
insert into sys_dept(
|
||||
|
|
Loading…
Reference in New Issue