lin
2024-04-10 79f785f405e960b6d646100d592a398abb0fa625
判空处理
1 files modified
14 ■■■■ changed files
src/main/java/org/springblade/common/interceptor/DataSyncInterceptor.java 14 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/common/interceptor/DataSyncInterceptor.java
@@ -25,6 +25,7 @@
import java.util.List;
import java.util.Map;
import java.util.Properties;
@Component
@Intercepts({
    @Signature(type = Executor.class, method = "update", args = {MappedStatement.class, Object.class})
@@ -80,6 +81,7 @@
    /**
     * 数据同步
     *
     * @param tableName
     * @param sqlType
     * @param parameter
@@ -112,7 +114,7 @@
            //update 方法需要特殊处理
            if (tableName.equals("jczz_article")) {
                Article entity = (Article) ((MapperMethod.ParamMap) parameter).get("param1");
                if (null!=entity.getId()) {
                if (entity != null && entity.getId() != null) {
                    esParam.setTableId(entity.getId().toString());
                    elasticsearchDocumentService.update(esParam, entity, EsTableConstant.articleList);
                }
@@ -122,7 +124,7 @@
                PlaceEntity placeEntity = new PlaceEntity();
                if (parameter instanceof MapperMethod.ParamMap){
                    placeEntity = (PlaceEntity) ((MapperMethod.ParamMap) parameter).get("param1");
                    if (null!=placeEntity.getId()) {
                    if (placeEntity != null && null != placeEntity.getId()) {
                        setPlaceInfo(entity, placeEntity);
                        esParam.setTableId(entity.getId().toString());
                        elasticsearchDocumentService.update(esParam, entity, EsTableConstant.placeList);
@@ -139,7 +141,7 @@
                HouseEntity entity = new HouseEntity();
                if (parameter instanceof MapperMethod.ParamMap){
                    entity = (HouseEntity) ((MapperMethod.ParamMap) parameter).get("param1");
                    if (null!=entity.getId()) {
                    if (entity != null && entity.getId() != null) {
                        setHouseInfo(houseEntity, entity);
                        esParam.setTableId(entity.getId().toString());
                        elasticsearchDocumentService.update(esParam, entity, EsTableConstant.houseList);
@@ -156,7 +158,7 @@
                HouseholdEntity entity = new HouseholdEntity();
                if (parameter instanceof MapperMethod.ParamMap){
                    entity = (HouseholdEntity) ((MapperMethod.ParamMap) parameter).get("param1");
                    if (null!=entity.getId()) {
                    if (entity != null && entity.getId() != null) {
                        setHouseholdInfo(householdEntity, entity);
                        esParam.setTableId(entity.getId().toString());
                        elasticsearchDocumentService.update(esParam, entity, EsTableConstant.householdList);
@@ -179,6 +181,7 @@
    /**
     * 场所值复制
     *
     * @param entity
     * @param placeEntity
     */
@@ -190,8 +193,10 @@
        entity.setPrincipalIdCard(placeEntity.getPrincipalIdCard());
        entity.setLocation(placeEntity.getLocation());
    }
    /**
     * 房屋值复制
     *
     * @param entity
     * @param houseEntity
     */
@@ -202,6 +207,7 @@
    /**
     * 住户值复制
     *
     * @param entity
     * @param householdEntity
     */