1.更新员工主播和大哥时同时更新员工名下所有同 ID数据

2.增加排序规则,防止出现时间排序错误
This commit is contained in:
2025-07-09 14:22:25 +08:00
parent 443c19375c
commit bdf8b36ac2
8 changed files with 30 additions and 9 deletions

View File

@@ -80,4 +80,6 @@ public class EmployeeBigBrotherDO extends BaseDO {
*/
private Integer operationStatus;
private Long tenantId;
}

View File

@@ -80,4 +80,6 @@ public class EmployeeHostsDO extends BaseDO {
private String remake;
private String uid;
private Long tenantId;
}

View File

@@ -8,8 +8,10 @@ import cn.iocoder.yudao.module.tkdata.controller.admin.employeebigbrother.vo.Emp
import cn.iocoder.yudao.module.tkdata.controller.admin.employeebigbrother.vo.EmployeeBigBrotherSaveReqVO;
import cn.iocoder.yudao.module.tkdata.dal.dataobject.bigbrother.BigBrotherDO;
import cn.iocoder.yudao.module.tkdata.dal.dataobject.employeebigbrother.EmployeeBigBrotherDO;
import cn.iocoder.yudao.module.tkdata.dal.dataobject.employeehosts.EmployeeHostsDO;
import cn.iocoder.yudao.module.tkdata.dal.mysql.bigbrother.BigBrotherMapper;
import cn.iocoder.yudao.module.tkdata.dal.mysql.employeebigbrother.EmployeeBigBrotherMapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.generator.IFill;
@@ -59,8 +61,14 @@ public class EmployeeBigBrotherServiceImpl implements EmployeeBigBrotherService
// 校验存在
validateEmployeeBigBrotherExists(updateReqVO.getId());
// 更新
Long tenantId = TenantContextHolder.getTenantId();
EmployeeBigBrotherDO updateObj = BeanUtils.toBean(updateReqVO, EmployeeBigBrotherDO.class);
employeeBigBrotherMapper.updateById(updateObj);
LambdaUpdateWrapper<EmployeeBigBrotherDO> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.set(EmployeeBigBrotherDO::getOperationStatus, updateReqVO.getOperationStatus());
updateWrapper.eq(EmployeeBigBrotherDO::getUserId, updateReqVO.getUserId());
updateWrapper.eq(EmployeeBigBrotherDO::getDisplayId,updateObj.getDisplayId());
updateWrapper.eq(EmployeeBigBrotherDO::getTenantId, tenantId);
employeeBigBrotherMapper.update(updateObj,updateWrapper);
}
@Override

View File

@@ -6,6 +6,8 @@ import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
import cn.iocoder.yudao.module.tkdata.dal.dataobject.newhosts.NewHostsDO;
import cn.iocoder.yudao.module.tkdata.dal.mysql.newhosts.NewHostsMapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.stereotype.Service;
@@ -57,8 +59,16 @@ public class EmployeeHostsServiceImpl implements EmployeeHostsService {
// 校验存在
validateEmployeeHostsExists(updateReqVO.getId());
// 更新
Long tenantId = TenantContextHolder.getTenantId();
EmployeeHostsDO updateObj = BeanUtils.toBean(updateReqVO, EmployeeHostsDO.class);
employeeHostsMapper.updateById(updateObj);
LambdaUpdateWrapper<EmployeeHostsDO> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.set(EmployeeHostsDO::getOperationStatus, updateReqVO.getOperationStatus());
updateWrapper.eq(EmployeeHostsDO::getUserId, updateReqVO.getUserId());
updateWrapper.eq(EmployeeHostsDO::getHostsId,updateObj.getHostsId());
updateWrapper.eq(EmployeeHostsDO::getTenantId, tenantId);
employeeHostsMapper.update(updateObj, updateWrapper);
// employeeHostsMapper.updateById(updateObj);
}
@Override

View File

@@ -96,7 +96,7 @@
<choose>
<!-- 传空和默认的情况下按照时间降序排序 -->
<when test="dto.sortName == '' or dto.sortName == null">
sbr.create_time desc,sbr.id
sbr.create_time desc,sbr.id desc
</when>
<!-- sortNmae 有值的情况下排序 -->
<when test="dto.sortName != null and dto.sort != null ">
@@ -117,6 +117,5 @@
</if>
</when>
</choose>
</select>
</mapper>

View File

@@ -97,7 +97,7 @@
<choose>
<!-- 传空和默认的情况下按照时间降序排序 -->
<when test="dto.sortName == '' or dto.sortName == null">
sbr.create_time desc,sbr.id
sbr.create_time desc,sbr.id desc
</when>
<!-- sortNmae 有值的情况下排序 -->
<when test="dto.sortName != null and dto.sort != null ">
@@ -185,7 +185,7 @@
<choose>
<!-- 传空和默认的情况下按照时间降序排序 -->
<when test="dto.sortName == '' or dto.sortName == null">
sbr.create_time desc,sbr.id
sbr.create_time desc,sbr.id desc
</when>
<!-- sortNmae 有值的情况下排序 -->
<when test="dto.sortName != null and dto.sort != null ">

View File

@@ -146,7 +146,7 @@
<choose>
<!-- 传空和默认的情况下按照时间降序排序 -->
<when test="req.sortName == '' or req.sortName == null">
ns.create_time desc,ns.id
ns.create_time desc,ns.id desc
</when>
<!-- sortNmae 有值的情况下排序 -->
<when test="req.sortName != null and req.sort != null ">
@@ -269,7 +269,7 @@
<choose>
<!-- 传空和默认的情况下按照时间降序排序 -->
<when test="req.sortName == '' or req.sortName == null">
ns.create_time desc,ns.id
ns.create_time desc,ns.id desc
</when>
<!-- sortNmae 有值的情况下排序 -->
<when test="req.sortName != null and req.sort != null ">

View File

@@ -100,7 +100,7 @@
<choose>
<!-- 传空和默认的情况下按照时间降序排序 -->
<when test="req.sortName == null or req.sortName == ''">
ns.create_time desc,ns.id
ns.create_time desc,ns.id desc
</when>
<!-- sortName 有值的情况下排序 -->
<when test="req.sortName != null and req.sort != null">