日志模板 创建、删除 同时关联规则表和使用者表 同步更新
This commit is contained in:
parent
f8dc5895f2
commit
718ee116f6
@ -16,6 +16,9 @@ public class LogRuleRespVO {
|
|||||||
@ExcelProperty("编号")
|
@ExcelProperty("编号")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "日志模板编号", example = "2")
|
||||||
|
private Long formId;
|
||||||
|
|
||||||
@Schema(description = "日志类型 字典值 详情参考work_log_type", example = "2")
|
@Schema(description = "日志类型 字典值 详情参考work_log_type", example = "2")
|
||||||
@ExcelProperty("日志类型")
|
@ExcelProperty("日志类型")
|
||||||
private Integer type;
|
private Integer type;
|
||||||
|
@ -68,6 +68,12 @@ public class LogFormServiceImpl implements LogFormService {
|
|||||||
this.validateFormExists(id);
|
this.validateFormExists(id);
|
||||||
// 删除
|
// 删除
|
||||||
formMapper.deleteById(id);
|
formMapper.deleteById(id);
|
||||||
|
|
||||||
|
//同步删除规则
|
||||||
|
logRuleService.deleteLogRuleByFormId(id);
|
||||||
|
|
||||||
|
//同步删除模板使用者
|
||||||
|
logUseService.deletByFormId(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateFormExists(Long id) {
|
private void validateFormExists(Long id) {
|
||||||
|
@ -37,6 +37,13 @@ public interface LogRuleService {
|
|||||||
*/
|
*/
|
||||||
void deleteLogRule(Long id);
|
void deleteLogRule(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除日志规则
|
||||||
|
*
|
||||||
|
* @param formId 模板编号
|
||||||
|
*/
|
||||||
|
void deleteLogRuleByFormId(Long formId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得日志规则
|
* 获得日志规则
|
||||||
*
|
*
|
||||||
|
@ -58,8 +58,8 @@ public class LogRuleServiceImpl implements LogRuleService {
|
|||||||
|
|
||||||
//把规则编号更新至日志模板表中
|
//把规则编号更新至日志模板表中
|
||||||
LogFormDO updateObj = new LogFormDO();
|
LogFormDO updateObj = new LogFormDO();
|
||||||
updateObj.setId(createReqVO.getFormId());
|
updateObj.setId(logRule.getFormId());
|
||||||
updateObj.setRuleId(createReqVO.getId());
|
updateObj.setRuleId(logRule.getId());
|
||||||
logFormMapper.updateById(updateObj);
|
logFormMapper.updateById(updateObj);
|
||||||
|
|
||||||
// 返回
|
// 返回
|
||||||
@ -96,6 +96,16 @@ public class LogRuleServiceImpl implements LogRuleService {
|
|||||||
logRuleMapper.deleteById(id);
|
logRuleMapper.deleteById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteLogRuleByFormId(Long formId) {
|
||||||
|
|
||||||
|
if (logRuleMapper.selectCount(LogRuleDO::getFormId, formId) > 0L) {
|
||||||
|
|
||||||
|
//删除规则
|
||||||
|
logRuleMapper.delete(LogRuleDO::getFormId, formId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void validateLogRuleExists(Long id) {
|
private void validateLogRuleExists(Long id) {
|
||||||
if (logRuleMapper.selectById(id) == null) {
|
if (logRuleMapper.selectById(id) == null) {
|
||||||
throw exception(LOG_RULE_NOT_EXISTS);
|
throw exception(LOG_RULE_NOT_EXISTS);
|
||||||
|
@ -56,4 +56,10 @@ public interface LogUseService {
|
|||||||
* @return 日志模板编号组
|
* @return 日志模板编号组
|
||||||
*/
|
*/
|
||||||
List<Long> getFormIdByUserId(Long userId);
|
List<Long> getFormIdByUserId(Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除使用者
|
||||||
|
* @param formId 模板编号
|
||||||
|
*/
|
||||||
|
void deletByFormId(Long formId);
|
||||||
}
|
}
|
@ -87,4 +87,10 @@ public class LogUseServiceImpl implements LogUseService {
|
|||||||
List<LogUseDO> logUseDOS = logUseMapper.selectList(LogUseDO::getUseUserId, userId);
|
List<LogUseDO> logUseDOS = logUseMapper.selectList(LogUseDO::getUseUserId, userId);
|
||||||
return convertList(logUseDOS, LogUseDO::getFormId);
|
return convertList(logUseDOS, LogUseDO::getFormId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deletByFormId(Long formId) {
|
||||||
|
|
||||||
|
logUseMapper.delete(LogUseDO::getFormId, formId);
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user