This commit is contained in:
马三炮 2025-04-28 17:51:59 +08:00
parent 82c39071f5
commit d52e8a9edd
7 changed files with 55 additions and 2 deletions

View File

@ -39,7 +39,7 @@ public class TbProjectController {
@DecryptAndVerify(decryptedClass = TbProjectVo.class)//加解密统一管理 @DecryptAndVerify(decryptedClass = TbProjectVo.class)//加解密统一管理
@LogAnnotation(operModul = "基础管理-线路工程管理", operation = "查询列表", operDesc = "系统级事件",operType="查询") @LogAnnotation(operModul = "基础管理-线路工程管理", operation = "查询列表", operDesc = "系统级事件",operType="查询")
public ServerResponse getTbProjectList(EncryptedReq<TbProjectVo> dto) { public ServerResponse getTbProjectList(EncryptedReq<TbProjectVo> dto) {
PageHelper.startPage(dto.getData().getPageNum(), dto.getData().getPageSize());
return tbProjectService.getTbProjectList(dto.getData()); return tbProjectService.getTbProjectList(dto.getData());
} }

View File

@ -16,4 +16,6 @@ public interface TbProjectMapper {
TbProjectVo getTbProjectByProName(TbProjectVo data); TbProjectVo getTbProjectByProName(TbProjectVo data);
void delTbProject(TbProjectVo data); void delTbProject(TbProjectVo data);
List<Long> getDataAuthByDeptId(Long deptId);
} }

View File

@ -13,11 +13,13 @@ import com.bonus.digitalSignage.system.vo.LoginUser;
import com.bonus.digitalSignage.utils.ServerResponse; import com.bonus.digitalSignage.utils.ServerResponse;
import com.bonus.digitalSignage.utils.UserUtil; import com.bonus.digitalSignage.utils.UserUtil;
import com.bonus.digitalSignage.webResult.StringUtils; import com.bonus.digitalSignage.webResult.StringUtils;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
@ -50,7 +52,11 @@ public class TbProjectServiceImpl implements TbProjectService {
@Override @Override
public ServerResponse getTbProjectList(TbProjectVo data) { public ServerResponse getTbProjectList(TbProjectVo data) {
try { try {
LoginUser oginUser = UserUtil.getLoginUser(); Long deptId = UserUtil.getLoginUser().getDept();
List<Long> deptIds = tbProjectMapper.getDataAuthByDeptId(deptId);
data.setDeptIds(deptIds);
PageHelper.startPage(data.getPageNum(), data.getPageSize());
//获取工程列表 //获取工程列表
List<TbProjectVo> tbProjectVoList = tbProjectMapper.getTbProjectList(data); List<TbProjectVo> tbProjectVoList = tbProjectMapper.getTbProjectList(data);
TbTowerVo tbTowerVo = new TbTowerVo(); TbTowerVo tbTowerVo = new TbTowerVo();

View File

@ -82,6 +82,11 @@ public class TbCablewaTransVo {
*/ */
private Long updateUserId; private Long updateUserId;
/**
* 搜索
*/
private String keyWord;
private int pageNum = 1; private int pageNum = 1;
private int pageSize = 10; private int pageSize = 10;
} }

View File

@ -117,6 +117,11 @@ public class TbProjectVo {
*/ */
private Long updateUserId; private Long updateUserId;
/**
* 权限列表
*/
private List<Long> deptIds;
/** /**
* 杆塔数量 * 杆塔数量
*/ */

View File

@ -51,6 +51,9 @@
from tb_cablewa_trans tct from tb_cablewa_trans tct
left join tb_tower tt on tct.tower_id = tt.id left join tb_tower tt on tct.tower_id = tt.id
where tct.pro_id = #{proId} and tct.is_active = '1' where tct.pro_id = #{proId} and tct.is_active = '1'
<if test="keyWord != '' and keyWord != null">
and tt.tower_name like concat('%',#{keyWord},'%')
</if>
</select> </select>
<select id="getTbCablewaTransById" resultType="com.bonus.digitalSignage.basic.vo.TbCablewaTransVo"> <select id="getTbCablewaTransById" resultType="com.bonus.digitalSignage.basic.vo.TbCablewaTransVo">
select tct.id as id,tct.pro_id as proId,tct.tower_id as towerId,tct.cableway_length as cablewayLength, select tct.id as id,tct.pro_id as proId,tct.tower_id as towerId,tct.cableway_length as cablewayLength,

View File

@ -80,6 +80,13 @@
<if test="departName != '' and departName != null">and td.depart_name like concat('%', #{departName}, '%')</if> <if test="departName != '' and departName != null">and td.depart_name like concat('%', #{departName}, '%')</if>
<if test="proName != '' and proName != null"> and tp.pro_name like concat('%', #{proName}, '%')</if> <if test="proName != '' and proName != null"> and tp.pro_name like concat('%', #{proName}, '%')</if>
<if test="proStatus != '' and proStatus != null"> and tp.pro_status = #{proStatus}</if> <if test="proStatus != '' and proStatus != null"> and tp.pro_status = #{proStatus}</if>
<if test="deptIds != '' and deptIds != null">
and tp.depart_id IN
<foreach item="item" index="index" collection="deptIds"
open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select> </select>
<select id="getTbProjectById" resultType="com.bonus.digitalSignage.basic.vo.TbProjectVo"> <select id="getTbProjectById" resultType="com.bonus.digitalSignage.basic.vo.TbProjectVo">
select tp.id as id,depart_id as departId,tp.pro_name as proName,tp.voltage_level as voltageLevel,tp.line_length as lineLength, select tp.id as id,depart_id as departId,tp.pro_name as proName,tp.voltage_level as voltageLevel,tp.line_length as lineLength,
@ -93,4 +100,29 @@
tp.address as address,tp.pro_status as pro_status tp.address as address,tp.pro_status as pro_status
from tb_project tp where pro_name = #{proName} and is_active ='1' from tb_project tp where pro_name = #{proName} and is_active ='1'
</select> </select>
<select id="getDataAuthByDeptId" resultType="java.lang.Long">
SELECT all_children.id
FROM (
SELECT t3.id
FROM (
SELECT
t1.id,
t1.parent_id,
IF(
FIND_IN_SET(t1.parent_id, @pids) > 0,
@pids := CONCAT(@pids, ',', t1.id),
-1
) AS ischild
FROM
(SELECT id, parent_id FROM tb_depart WHERE is_active = '1') t1,
(SELECT @pids :=#{dept}) t2
ORDER BY t1.parent_id, t1.id -- 确保父节点先处理
) t3
WHERE t3.ischild != -1
) all_children
LEFT JOIN tb_depart d
ON all_children.id = d.parent_id
AND d.is_active = '1'
WHERE d.parent_id IS NULL;
</select>
</mapper> </mapper>