删除数据范围

This commit is contained in:
钱涛 2024-08-19 15:29:45 +08:00
parent 9b390faf50
commit 7c46da5fce
6 changed files with 40 additions and 0 deletions

View File

@ -69,4 +69,11 @@ public interface AuthDataMapper {
* @param ids 主键id集合
*/
void deleteByIds(@Param("ids") Collection<Long> ids);
/**
* 根据角色id删除
* @param roleId roleId
*/
void deleteByRoleId(Long roleId);
}

View File

@ -265,5 +265,12 @@
</foreach>
</delete>
<delete id="deleteByRoleId">
UPDATE hrsa_auth_data
SET delete_type = 1
WHERE delete_type = 0
AND role_id=#{roleId}
</delete>
</mapper>

View File

@ -30,9 +30,16 @@ public interface AuthDataService {
*/
void save(List<AuthDataSaveParam> params);
/**
* 删除
* @param ids
*/
void delete(List<Long> ids);
/**
* 同步
* @param param
*/
void sync(AuthSyncParam param);
}

View File

@ -1,5 +1,6 @@
package com.engine.salary.service.auth;
import cn.hutool.core.collection.CollectionUtil;
import com.engine.core.impl.Service;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.entity.auth.param.AuthDataSaveParam;
@ -82,6 +83,13 @@ public class AuthDataServiceImpl extends Service implements AuthDataService {
});
}
@Override
public void delete(List<Long> ids) {
if(CollectionUtil.isNotEmpty(ids)){
getAuthDataMapper().deleteByIds(ids);
}
}
@Override
public void sync(AuthSyncParam param) {
Long roleId = param.getRoleId();

View File

@ -116,6 +116,14 @@ public class AuthController {
return new ResponseResult<List<AuthDataSaveParam>, Long>(user).run(getAuthWrapper(user)::saveData, params);
}
@POST
@Path("/data/delete")
@Produces(MediaType.APPLICATION_JSON)
public String deleteData(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody List<Long> ids) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult< List<Long> , Long>(user).run(getAuthWrapper(user)::deleteData, ids);
}
@POST
@Path("/data/sync")
@Produces(MediaType.APPLICATION_JSON)

View File

@ -115,6 +115,9 @@ public class AuthWrapper extends Service {
getAuthDataService(user).save(params);
}
public void deleteData(List<Long> ids) {
getAuthDataService(user).delete(ids);
}
public void syncData(AuthSyncParam param) {
getAuthDataService(user).sync(param);