| | |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import com.alibaba.fastjson2.JSON; |
| | | import javax.sql.DataSource; |
| | | import org.springframework.jdbc.core.JdbcTemplate; |
| | | import org.springframework.jdbc.support.GeneratedKeyHolder; |
| | |
| | | throw new ServiceException("对比报表不存在"); |
| | | } |
| | | |
| | | /** 仅在业务事务和报表锁内调用;物理清理全部版本,同步保留最小操作日志。 */ |
| | | public void delete(long id, long operatorId, String operatorName) |
| | | { |
| | | String name = jdbc.queryForObject("select report_name from t_compare_report where report_id=?", String.class, id); |
| | | jdbc.update("delete from t_compare_report_version where report_id=?", id); |
| | | jdbc.update("delete from t_compare_report where report_id=?", id); |
| | | // 不走异步 @Log,日志失败必须回滚删除;只保留身份,不读取或记录测量快照。 |
| | | jdbc.update("insert into sys_oper_log(title,business_type,method,request_method,operator_type,oper_name,oper_url,oper_param,status,oper_time) values(?,3,?,'DELETE',1,?,?,?,0,?)", |
| | | "对比报表删除", "compare-report.delete", operatorName, "/system/compare-report/" + id, |
| | | JSON.toJSONString(Map.of("reportId", id, "reportName", name, "operatorId", operatorId)), new Timestamp(System.currentTimeMillis())); |
| | | } |
| | | |
| | | /** 只追加版本并更新列表名称;业务事务保证两步同时成功。 */ |
| | | public void append(long id, int versionNo, String name, String snapshot, long operatorId, String operatorName, String summary) |
| | | { |