feat: 老法规数据修复接口新增代替被代替表自动去重功能

This commit is contained in:
2024-01-02 15:30:19 +08:00
parent 20850e4a21
commit e88e634467
5 changed files with 26 additions and 0 deletions
@@ -236,6 +236,8 @@ public class OldSystemServiceImpl implements OldSystemService {
this.oldSysFBDataFix(allDatalist, errImportList);
}
// 统一清理代替被代替重复数据
lawsReplacedStandardService.clearRepeatData();
if (!errImportList.isEmpty()) {
this.exportWithExcel(response, errImportList, "OldSystemStandardErrorData.xls");
}
@@ -11,4 +11,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface LawsReplacedStandardMapper extends BaseMapper<LawsReplacedStandard> {
void clearRepeatData();
}
@@ -7,4 +7,13 @@
<result column="replaced_by" property="replacedBy" />
<result column="type" property="type" />
</resultMap>
<delete id="clearRepeatData">
DELETE t1 FROM laws_replaced_standard t1
INNER JOIN laws_replaced_standard t2
WHERE
t1.id > t2.id AND
t1.replaced = t2.replaced AND
t1.replaced_by = t2.replaced_by;
</delete>
</mapper>
@@ -46,4 +46,9 @@ public interface ILawsReplacedStandardService extends IService<LawsReplacedStand
**/
String getReplacedBy(String standardNumber, Integer type);
/**
* 清理重复数据
*/
void clearRepeatData();
}
@@ -13,6 +13,7 @@ import org.springframework.transaction.annotation.Transactional;
import com.jero.common.exception.JeroBootException;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -32,6 +33,9 @@ public class LawsReplacedStandardServiceImpl extends ServiceImpl<LawsReplacedSta
@Autowired
private ILawsCommonService lawsCommonService;
@Resource
private LawsReplacedStandardMapper replacedStandardMapper;
/**
* @Author: liao
* @Date: 2023/9/19 11:06
@@ -130,4 +134,9 @@ public class LawsReplacedStandardServiceImpl extends ServiceImpl<LawsReplacedSta
.map(LawsReplacedStandard::getReplacedBy).collect(Collectors.toList());
return StringUtils.join(replacedByList, ",");
}
@Override
public void clearRepeatData() {
replacedStandardMapper.clearRepeatData();
}
}