From 018af6bed3da8be2e7b846aa3e654f16f8f71654 Mon Sep 17 00:00:00 2001 From: 101captain <237651143@qq.com> Date: 星期三, 29 十二月 2021 16:29:30 +0800 Subject: [PATCH] 12/29 河门口大屏特殊修改 --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActSocialOrgMapper.xml | 2 springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/config/MybatisHmkInterceptor.java | 78 ++++++++---- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/config/MybatisPlusConfig.java | 2 springcloud_k8s_panzhihuazhihuishequ/service_property/src/main/resources/mapper/ComPropertyEquipmentMapper.xml | 2 springcloud_k8s_panzhihuazhihuishequ/service_property/src/main/resources/mapper/ComPropertyAlarmMapper.xml | 2 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActWarehouseOperationMapper.xml | 2 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActWarehouseApplyMapper.xml | 10 springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/resources/mapper/UserDao.xml | 2 springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/config/MybatisPlusConfig.java | 2 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActReserveMapper.xml | 4 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngStructAreaDAO.java | 2 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActFourMemberMapper.xml | 2 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActActivityDAO.java | 4 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComPropertyMapper.xml | 2 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComPbMemberMapper.xml | 6 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActMicroWishDAO.java | 2 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/config/MybatisHmkInterceptor.java | 74 ++++++++--- springcloud_k8s_panzhihuazhihuishequ/service_property/src/main/resources/mapper/ComPropertyRepairMapper.xml | 2 springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/config/MybatisPlusConfig.java | 2 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActReserveRecordMapper.xml | 22 +- springcloud_k8s_panzhihuazhihuishequ/service_property/src/main/resources/mapper/ComPropertyHelpMapper.xml | 2 springcloud_k8s_panzhihuazhihuishequ/service_property/src/main/resources/mapper/ComPropertyAlarmSettingMapper.xml | 2 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActEasyPhotoDOMapper.xml | 14 +- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActNeighborCircleDAO.java | 2 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActCommitteeMapper.xml | 2 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/BigScreenDAO.java | 10 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActEasyPhotoDAO.java | 2 springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/config/MybatisHmkInterceptor.java | 78 ++++++++---- 28 files changed, 206 insertions(+), 130 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/config/MybatisHmkInterceptor.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/config/MybatisHmkInterceptor.java index 63bd4a3..a359f5e 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/config/MybatisHmkInterceptor.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/config/MybatisHmkInterceptor.java @@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.core.toolkit.PluginUtils; import com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.apache.ibatis.executor.Executor; import org.apache.ibatis.executor.statement.StatementHandler; import org.apache.ibatis.mapping.BoundSql; @@ -23,9 +24,6 @@ import java.util.List; import java.util.Map; -@Intercepts({ - @Signature(type = StatementHandler.class, method = "query", args = {Statement.class, ResultHandler.class}) -}) public class MybatisHmkInterceptor implements InnerInterceptor { @Override public void beforeQuery(Executor executor, MappedStatement ms, Object parameter, RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql) throws SQLException { @@ -39,27 +37,57 @@ } } if(parameter instanceof Map){ - List<ParameterMapping> parameterMappingList=new ArrayList<>(); - if(sql.contains("community_id = ?")&&((Map<?, ?>) parameter).containsValue(10086L)){ - List<ParameterMapping> parameterMappings=boundSql.getParameterMappings(); - parameterMappings.forEach(parameterMapping -> { - if (parameterMapping.getProperty().equals("communityId")){ - ParameterMapping parameterMapping1=new ParameterMapping.Builder(ms.getConfiguration(),"communityId",Object.class).build(); - parameterMappingList.add(parameterMapping1); + if(sql.contains("community_id = ?")){ + List<ParameterMapping> parameterMappingList=new ArrayList<>(); + if(((Map<?, ?>) parameter).containsValue(10086L)){ + List<ParameterMapping> parameterMappings=boundSql.getParameterMappings(); + parameterMappings.forEach(parameterMapping -> { + if (parameterMapping.getProperty().equals("communityId")){ + ParameterMapping parameterMapping1=new ParameterMapping.Builder(ms.getConfiguration(),parameterMapping.getProperty(),Object.class).build(); + parameterMappingList.add(parameterMapping1); + } + else { + parameterMappingList.add(parameterMapping); + } + }); + sql=sql.replace("community_id = ?","community_id in (?)"); + ((Map<?,?>) parameter).replaceAll((k,v)->{ + if(v.toString().contains("10086")){ + boundSql.setAdditionalParameter(k.toString(),"30,31"); + } + return v; + }); + PluginUtils.mpBoundSql(boundSql).parameterMappings(parameterMappingList); + PluginUtils.mpBoundSql(boundSql).sql(sql); + } + else{ + if(((Map<?, ?>) parameter).containsKey("arg0")){ + Map<?, ?> param= (Map<?, ?>) boundSql.getAdditionalParameter("_parameter"); + String finalSql = sql; + param.forEach((k, v)->{ + try { + Field field= v.getClass().getDeclaredField("communityId"); + if(field!=null){ + field.setAccessible(true); + if((long)field.get(v)==10086L){ + String sql1= finalSql.replace("community_id = ?","community_id in (30,31)"); + boundSql.getParameterMappings().forEach(parameterMapping -> { + if(!parameterMapping.getProperty().contains("communityId")){ + parameterMappingList.add(parameterMapping); + } + }); + PluginUtils.mpBoundSql(boundSql).parameterMappings(parameterMappingList); + PluginUtils.mpBoundSql(boundSql).sql(sql1); + } + } + } catch (IllegalAccessException e) { + e.printStackTrace(); + } catch (NoSuchFieldException e) { + + } + }); } - else { - parameterMappingList.add(parameterMapping); - } - }); - sql=sql.replace("community_id = ?","community_id in (?)"); - ((Map<?,?>) parameter).replaceAll((k,v)->{ - if(v.toString().equals("10086")){ - boundSql.setAdditionalParameter(k.toString(),"30,31"); - } - return v; - }); - PluginUtils.mpBoundSql(boundSql).parameterMappings(parameterMappingList); - PluginUtils.mpBoundSql(boundSql).sql(sql); + } } } InnerInterceptor.super.beforeQuery(executor, ms, parameter, rowBounds, resultHandler, boundSql); diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/config/MybatisPlusConfig.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/config/MybatisPlusConfig.java index cf3d09c..21b1627 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/config/MybatisPlusConfig.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/config/MybatisPlusConfig.java @@ -24,8 +24,8 @@ @Bean public MybatisPlusInterceptor mybatisPlusInterceptor() { MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); - interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.H2)); interceptor.addInnerInterceptor(new MybatisHmkInterceptor()); + interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.H2)); return interceptor; } diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/BigScreenDAO.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/BigScreenDAO.java index aa84906..b636561 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/BigScreenDAO.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/BigScreenDAO.java @@ -62,15 +62,15 @@ + " SUM(CASE TYPE WHEN 3 THEN total ELSE 0 END) as 'activityCount', " + " SUM(CASE TYPE WHEN 4 THEN total ELSE 0 END) as 'dynCount',SUM(CASE TYPE WHEN 5 THEN total ELSE 0 END) as 'committeeCount' " + " FROM ( " + " SELECT 1 AS TYPE , COUNT(id) total " + " FROM com_pb_org org " - + " WHERE org.community_id = #{communityId} AND STATUS=1 " + " UNION ALL " + + " WHERE org.community_id = #{communityId} AND STATUS=1 " + " UNION ALL " + " SELECT 2 AS TYPE , COUNT(id) total " + " FROM com_pb_member " - + " WHERE community_id = #{communityId} AND audit_result = 1 " + " UNION ALL " + + " WHERE community_id = #{communityId} AND audit_result = 1 " + " UNION ALL " + " SELECT 3 AS TYPE , COUNT(id) total " + " FROM com_pb_activity " - + " WHERE community_id = #{communityId} AND STATUS IN (2,3,4,5) " + " UNION ALL " + + " WHERE community_id = #{communityId} AND STATUS IN (2,3,4,5) " + " UNION ALL " + " SELECT 4 AS TYPE , COUNT(id) total " + " FROM com_pb_dyn " - + " WHERE community_id = #{communityId} AND TYPE = 1 UNION ALL " + + + " WHERE community_id = #{communityId} AND TYPE = 1 UNION ALL " + "select 5 AS TYPE,count(id) total from com_pb_member_role " + - "where community_id =#{communityId}" + ") t" + "</script>") + "where community_id = #{communityId}" + ") t" + "</script>") BigScreenStatisticPartyBuild partybuild(@Param("communityId") Long communityId); @Select("<script> " + " SELECT pm.id, pm.member_id, pm.user_id, pm.name, " + " case " diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActActivityDAO.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActActivityDAO.java index a1b4608..905579a 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActActivityDAO.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActActivityDAO.java @@ -156,7 +156,7 @@ + "(select COUNT(d.id) from com_act_discuss d where d.community_id = #{communityId})x1, " + "(select COUNT(w.id) from com_act_micro_wish w where w.community_id = #{communityId})x2, " + "(select COUNT(p.id) from com_act_easy_photo p where p.community_id = #{communityId})x3, " - + " COUNT( a.id ) x4 " + "FROM " + " com_pb_activity a " + "WHERE " + " a.community_id =#{communityId})t") + + " COUNT( a.id ) x4 " + "FROM " + " com_pb_activity a " + "WHERE " + " a.community_id = #{communityId})t") String selectCommunityGovernanceTrendsVO(Long communityId); @Select(" " + " SELECT " @@ -166,7 +166,7 @@ + " (select COUNT(pa.id) from com_pb_activity pa where DATE_FORMAT(pa.create_at,'%Y-%m-%d')=DATE_FORMAT(#{date},'%Y-%m-%d') and pa.community_id = #{communityId})pbActivity, " + " COUNT( a.id ) actActivity " + " FROM " + " com_pb_activity a " + " WHERE " + " DATE_FORMAT( a.create_at, '%Y-%m-%d' )=DATE_FORMAT(#{date},'%Y-%m-%d') " - + " AND a.community_id =#{communityId}") + + " AND a.community_id = #{communityId}") CommunityActivitiesVO selectCommunityActivitiesVO(@Param("communityId") Long communityId, @Param("date") Date date); @Select("SELECT " + " count( caa.id ) as totalNum, " diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActEasyPhotoDAO.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActEasyPhotoDAO.java index d78c597..2b7f2aa 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActEasyPhotoDAO.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActEasyPhotoDAO.java @@ -332,7 +332,7 @@ @Select("SELECT COUNT(id) AS total, " + "(SELECT COUNT(id) FROM com_act_easy_photo WHERE community_id = #{communityId} AND #{start} < create_at and create_at < #{end} ) AS adds, " + - "(SELECT COUNT(id) FROM com_act_easy_photo WHERE community_id =#{communityId} AND handle_status = 2 AND #{start} < create_at and create_at < #{end}) AS deal " + + "(SELECT COUNT(id) FROM com_act_easy_photo WHERE community_id = #{communityId} AND handle_status = 2 AND #{start} < create_at and create_at < #{end}) AS deal " + "FROM com_act_easy_photo WHERE community_id = #{communityId} AND #{start} < create_at and create_at < #{end} ") EastPhotoVO countByTime(@Param("start")String start, @Param("end")String end, @Param("nowDate")String nowDate, @Param("communityId")Long communityId); diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActMicroWishDAO.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActMicroWishDAO.java index 53577f2..1436eaf 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActMicroWishDAO.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActMicroWishDAO.java @@ -227,7 +227,7 @@ "AND camw.`status` =#{microListDTO.status} " + " </if> " + "<if test='microListDTO.communityId != null'>" + - "AND camw.community_id =#{microListDTO.communityId} " + + "AND camw.community_id = #{microListDTO.communityId} " + " </if> " + "<if test='microListDTO.startTime!=null and microListDTO.startTime != ""'>" + " AND DATE_FORMAT(camw.create_at,'%Y-%m-%d %H:%i:%s') <![CDATA[ >= ]]> #{microListDTO.startTime} " + diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActNeighborCircleDAO.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActNeighborCircleDAO.java index bfea28b..d140607 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActNeighborCircleDAO.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActNeighborCircleDAO.java @@ -68,7 +68,7 @@ + " where reply.comment_id = #{commentId} and reply.status = 1") IPage<ComActNeighborCommentReplyAppVO> neighborCommentReplyByApp(Page page, @Param("commentId") Long commentId); - @Select("SELECT id,release_content as content FROM com_act_neighbor_circle WHERE community_id =#{communityId} and status = 2 ORDER BY create_at DESC limit #{pageSize}") + @Select("SELECT id,release_content as content FROM com_act_neighbor_circle WHERE community_id = #{communityId} and status = 2 ORDER BY create_at DESC limit #{pageSize}") List<CarouselInfoVO> screenNeighborCircle(@Param("communityId") Long communityId, @Param("pageSize") Integer pageSize); diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngStructAreaDAO.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngStructAreaDAO.java index 7bc95dc..144fa81 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngStructAreaDAO.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngStructAreaDAO.java @@ -39,7 +39,7 @@ @Select("SELECT\n" + "\ta.id,\n" + "\ta.role_floor,\n" + "\ta.area_name,\n" + "\ta.role_connector,\n" + "\ta.role_door \n" + "FROM\n" + "\tcom_mng_struct_area a \n" + "WHERE\n" - + "\ta.area_name LIKE CONCAT( '%', #{areaName}, '%' ) \n" + "\tAND a.community_id =#{communityId}") + + "\ta.area_name LIKE CONCAT( '%', #{areaName}, '%' ) \n" + "\tAND a.community_id = #{communityId}") List<ComMngStructAreaVO> listAreas(@Param("areaName") String areaName, @Param("communityId") Long communityId); @Select("select count(id) from com_mng_struct_house where parent_code=#{areaCode}") diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActCommitteeMapper.xml b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActCommitteeMapper.xml index 12e5f1a..70e429f 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActCommitteeMapper.xml +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActCommitteeMapper.xml @@ -33,7 +33,7 @@ and t.contact_name like concat(#{commonPage.username},'%') </if> <if test="commonPage.paramId!=null"> - and t.community_id =#{commonPage.paramId} + and t.community_id = #{commonPage.paramId} </if> </where> order by t.create_time desc diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActEasyPhotoDOMapper.xml b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActEasyPhotoDOMapper.xml index 9829c85..895ec26 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActEasyPhotoDOMapper.xml +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActEasyPhotoDOMapper.xml @@ -263,19 +263,19 @@ </select> <select id="banner" resultType="com.panzhihua.common.model.vos.community.easyPhoto.BannerVO"> - select id,cover,publish_at as show_time,1 as type,jump_url,jump_type from com_act_dyn where status =1 and cover is not null and community_id =#{communityId} + select id,cover,publish_at as show_time,1 as type,jump_url,jump_type from com_act_dyn where status =1 and cover is not null and community_id = #{communityId} UNION ALL - select id,cover,publish_at as show_time,2 as type,"" as jump_url,"" as jump_type from com_act_activity where status =3 and cover is not null and community_id =#{communityId} + select id,cover,publish_at as show_time,2 as type,"" as jump_url,"" as jump_type from com_act_activity where status =3 and cover is not null and community_id = #{communityId} UNION ALL - select id,cover,release_time as show_time,3 as type,"" as jump_url,"" as jump_type from com_pb_activity where status =3 and cover is not null and community_id =#{communityId} + select id,cover,release_time as show_time,3 as type,"" as jump_url,"" as jump_type from com_pb_activity where status =3 and cover is not null and community_id = #{communityId} UNION ALL - select id,"" as cover,publish_time as show_time,4 as type,"" as jump_url,"" as jump_type from com_act_questnaire where state =2 and community_id =#{communityId} + select id,"" as cover,publish_time as show_time,4 as type,"" as jump_url,"" as jump_type from com_act_questnaire where state =2 and community_id = #{communityId} UNION ALL - select id,cover,publish_at as show_time,5 as type,jump_url,jump_type from com_pb_dyn where status =2 and cover is not null and community_id =#{communityId} + select id,cover,publish_at as show_time,5 as type,jump_url,jump_type from com_pb_dyn where status =2 and cover is not null and community_id = #{communityId} UNION ALL - select id,img_url as cover,publish_time as show_time,6 as type,"" as jump_url,"" as jump_type from com_act_reserve where status =2 and community_id =#{communityId} + select id,img_url as cover,publish_time as show_time,6 as type,"" as jump_url,"" as jump_type from com_act_reserve where status =2 and community_id = #{communityId} UNION ALL - select id,logo as cover,release_at as show_time,7 as type,"" as jump_url,"" as jump_type from com_act_easy_photo_activity where status =2 and community_id =#{communityId} + select id,logo as cover,release_at as show_time,7 as type,"" as jump_url,"" as jump_type from com_act_easy_photo_activity where status =2 and community_id = #{communityId} order by show_time desc limit 30 </select> <select id="selectStatisticsList" resultType="com.panzhihua.common.model.vos.community.ComActEasyPhotoVO"> diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActFourMemberMapper.xml b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActFourMemberMapper.xml index 56fed0f..d0a66fd 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActFourMemberMapper.xml +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActFourMemberMapper.xml @@ -26,7 +26,7 @@ <where> 1=1 <if test="commonPage.paramId !=null"> - and t.community_id =#{commonPage.paramId} + and t.community_id = #{commonPage.paramId} </if> <if test="commonPage.position !=null and commonPage.position !=''"> and t.position like concat('%',#{commonPage.position},'%') diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActReserveMapper.xml b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActReserveMapper.xml index f661bbd..7dc7f7b 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActReserveMapper.xml +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActReserveMapper.xml @@ -38,7 +38,7 @@ where status = 2 and adver_position_top = 1 <if test="communityId !=null"> - and community_id =#{communityId} + and community_id = #{communityId} </if> </select> @@ -48,7 +48,7 @@ <where> status = 2 and adver_position_application = 1 <if test="communityId !=null"> - and community_id =#{communityId} + and community_id = #{communityId} </if> </where> </select> diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActReserveRecordMapper.xml b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActReserveRecordMapper.xml index 05390a0..5e1c7b3 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActReserveRecordMapper.xml +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActReserveRecordMapper.xml @@ -320,19 +320,19 @@ </select> <select id="biggestScreen" resultType="com.panzhihua.common.model.vos.community.bigscreen.BigScreenStaticsReserve"> - select (select count(*) from com_act_reserve_record t LEFT JOIN com_act_reserve t1 on t.reserve_id = t1.id where (t1.title like '%居家%' or t1.title like '%返攀%' or t1.title like '%来攀%' or t1.title like '%燃气%' or t1.title like '%防火%') and t1.community_id =#{communityId}) count, - (select count(*) from com_act_reserve_record t LEFT JOIN com_act_reserve t1 on t.reserve_id = t1.id where (t1.title like '%居家%' or t1.title like '%返攀%' or t1.title like '%来攀%' ) and t1.community_id =#{communityId}) epidemicCount, - (select count(*) from com_act_reserve_record t LEFT JOIN com_act_reserve t1 on t.reserve_id = t1.id where (t1.title like '%燃气%' ) and t1.community_id =#{communityId}) gasCount, - (select count(*) from com_act_reserve_record t LEFT JOIN com_act_reserve t1 on t.reserve_id = t1.id where (t1.title like '%防火%' ) and t1.community_id =#{communityId}) fireCount, - (select count(*) from com_act_reserve_record t LEFT JOIN com_act_reserve t1 on t.reserve_id = t1.id where (t1.title like '%居家%' ) and t1.community_id =#{communityId}) homeCount, - (select count(*) from com_act_reserve_record t LEFT JOIN com_act_reserve t1 on t.reserve_id = t1.id where (t1.title like '%返攀%' or t1.title like '%来攀%' ) and t1.community_id =#{communityId}) reserveCount + select (select count(*) from com_act_reserve_record t LEFT JOIN com_act_reserve t1 on t.reserve_id = t1.id where (t1.title like '%居家%' or t1.title like '%返攀%' or t1.title like '%来攀%' or t1.title like '%燃气%' or t1.title like '%防火%') and t1.community_id = #{communityId}) count, + (select count(*) from com_act_reserve_record t LEFT JOIN com_act_reserve t1 on t.reserve_id = t1.id where (t1.title like '%居家%' or t1.title like '%返攀%' or t1.title like '%来攀%' ) and t1.community_id = #{communityId}) epidemicCount, + (select count(*) from com_act_reserve_record t LEFT JOIN com_act_reserve t1 on t.reserve_id = t1.id where (t1.title like '%燃气%' ) and t1.community_id = #{communityId}) gasCount, + (select count(*) from com_act_reserve_record t LEFT JOIN com_act_reserve t1 on t.reserve_id = t1.id where (t1.title like '%防火%' ) and t1.community_id = #{communityId}) fireCount, + (select count(*) from com_act_reserve_record t LEFT JOIN com_act_reserve t1 on t.reserve_id = t1.id where (t1.title like '%居家%' ) and t1.community_id = #{communityId}) homeCount, + (select count(*) from com_act_reserve_record t LEFT JOIN com_act_reserve t1 on t.reserve_id = t1.id where (t1.title like '%返攀%' or t1.title like '%来攀%' ) and t1.community_id = #{communityId}) reserveCount </select> <select id="biggestScreenMonth" resultType="com.panzhihua.common.model.vos.community.bigscreen.BigScreenStaticsReserveMonth"> - select (select count(*) from com_act_reserve_record t LEFT JOIN com_act_reserve t1 on t.reserve_id = t1.id where (t1.title like '%居家%' or t1.title like '%返攀%' or t1.title like '%来攀%' or t1.title like '%燃气%' or t1.title like '%防火%') and t1.community_id =#{communityId} and t.create_at >= DATE_FORMAT( CONCAT(year(now()),'-',#{date},'-00'), '%Y-%m-00 00:00:00') and DATE_FORMAT( LAST_DAY(CONCAT(year(now()),'-',#{date},'-00')), '%Y-%m-%d 23:59:59') >=t.create_at ) count, - (select count(*) from com_act_reserve_record t LEFT JOIN com_act_reserve t1 on t.reserve_id = t1.id where (t1.title like '%燃气%' ) and t1.community_id =#{communityId} and t.create_at >= DATE_FORMAT( CONCAT(year(now()),'-',#{date},'-00'), '%Y-%m-00 00:00:00') and DATE_FORMAT( LAST_DAY(CONCAT(year(now()),'-',#{date},'-00')), '%Y-%m-%d 23:59:59') >=t.create_at) gasCount, - (select count(*) from com_act_reserve_record t LEFT JOIN com_act_reserve t1 on t.reserve_id = t1.id where (t1.title like '%防火%' ) and t1.community_id =#{communityId} and t.create_at >= DATE_FORMAT( CONCAT(year(now()),'-',#{date},'-00'), '%Y-%m-00 00:00:00') and DATE_FORMAT( LAST_DAY(CONCAT(year(now()),'-',#{date},'-00')), '%Y-%m-%d 23:59:59') >=t.create_at) fireCount, - (select count(*) from com_act_reserve_record t LEFT JOIN com_act_reserve t1 on t.reserve_id = t1.id where (t1.title like '%居家%' ) and t1.community_id =#{communityId} and t.create_at >= DATE_FORMAT( CONCAT(year(now()),'-',#{date},'-00'), '%Y-%m-00 00:00:00') and DATE_FORMAT( LAST_DAY(CONCAT(year(now()),'-',#{date},'-00')), '%Y-%m-%d 23:59:59') >=t.create_at) homeCount, - (select count(*) from com_act_reserve_record t LEFT JOIN com_act_reserve t1 on t.reserve_id = t1.id where (t1.title like '%返攀%' or t1.title like '%来攀%' ) and t1.community_id =#{communityId} and t.create_at >= DATE_FORMAT( CONCAT(year(now()),'-',#{date},'-00'), '%Y-%m-00 00:00:00') and DATE_FORMAT( LAST_DAY(CONCAT(year(now()),'-',#{date},'-00')), '%Y-%m-%d 23:59:59') >=t.create_at) reserveCount + select (select count(*) from com_act_reserve_record t LEFT JOIN com_act_reserve t1 on t.reserve_id = t1.id where (t1.title like '%居家%' or t1.title like '%返攀%' or t1.title like '%来攀%' or t1.title like '%燃气%' or t1.title like '%防火%') and t1.community_id = #{communityId} and t.create_at >= DATE_FORMAT( CONCAT(year(now()),'-',#{date},'-00'), '%Y-%m-00 00:00:00') and DATE_FORMAT( LAST_DAY(CONCAT(year(now()),'-',#{date},'-00')), '%Y-%m-%d 23:59:59') >=t.create_at ) count, + (select count(*) from com_act_reserve_record t LEFT JOIN com_act_reserve t1 on t.reserve_id = t1.id where (t1.title like '%燃气%' ) and t1.community_id = #{communityId} and t.create_at >= DATE_FORMAT( CONCAT(year(now()),'-',#{date},'-00'), '%Y-%m-00 00:00:00') and DATE_FORMAT( LAST_DAY(CONCAT(year(now()),'-',#{date},'-00')), '%Y-%m-%d 23:59:59') >=t.create_at) gasCount, + (select count(*) from com_act_reserve_record t LEFT JOIN com_act_reserve t1 on t.reserve_id = t1.id where (t1.title like '%防火%' ) and t1.community_id = #{communityId} and t.create_at >= DATE_FORMAT( CONCAT(year(now()),'-',#{date},'-00'), '%Y-%m-00 00:00:00') and DATE_FORMAT( LAST_DAY(CONCAT(year(now()),'-',#{date},'-00')), '%Y-%m-%d 23:59:59') >=t.create_at) fireCount, + (select count(*) from com_act_reserve_record t LEFT JOIN com_act_reserve t1 on t.reserve_id = t1.id where (t1.title like '%居家%' ) and t1.community_id = #{communityId} and t.create_at >= DATE_FORMAT( CONCAT(year(now()),'-',#{date},'-00'), '%Y-%m-00 00:00:00') and DATE_FORMAT( LAST_DAY(CONCAT(year(now()),'-',#{date},'-00')), '%Y-%m-%d 23:59:59') >=t.create_at) homeCount, + (select count(*) from com_act_reserve_record t LEFT JOIN com_act_reserve t1 on t.reserve_id = t1.id where (t1.title like '%返攀%' or t1.title like '%来攀%' ) and t1.community_id = #{communityId} and t.create_at >= DATE_FORMAT( CONCAT(year(now()),'-',#{date},'-00'), '%Y-%m-00 00:00:00') and DATE_FORMAT( LAST_DAY(CONCAT(year(now()),'-',#{date},'-00')), '%Y-%m-%d 23:59:59') >=t.create_at) reserveCount </select> </mapper> \ No newline at end of file diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActSocialOrgMapper.xml b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActSocialOrgMapper.xml index 290a3cc..c95783f 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActSocialOrgMapper.xml +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActSocialOrgMapper.xml @@ -64,7 +64,7 @@ and t.contact_name like concat(#{commonPage.systemName},'%') </if> <if test="commonPage.paramId!=null"> - and t.community_id =#{commonPage.paramId} + and t.community_id = #{commonPage.paramId} </if> <if test="commonPage.phone!=null and commonPage.phone!=''"> and t.contact_phone like concat(#{commonPage.phone},'%') diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActWarehouseApplyMapper.xml b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActWarehouseApplyMapper.xml index 90e51d8..62e1350 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActWarehouseApplyMapper.xml +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActWarehouseApplyMapper.xml @@ -56,11 +56,11 @@ <select id="selectStatics" resultType="com.panzhihua.common.model.vos.community.warehouse.ApplyStatistics"> select - (select count(*) from com_act_warehouse_apply where status = 0 and community_id =#{communityId}) as pending, - (select count(*) from com_act_warehouse_apply where status = 1 and community_id =#{communityId}) as unclaimed, - (select count(*) from com_act_warehouse_apply where status = 2 and community_id =#{communityId}) as rejected, - (select count(*) from com_act_warehouse_apply where status = 3 and community_id =#{communityId}) as received, - (select count(*) from com_act_warehouse_apply where status = -1 and community_id =#{communityId}) as cancelled + (select count(*) from com_act_warehouse_apply where status = 0 and community_id = #{communityId}) as pending, + (select count(*) from com_act_warehouse_apply where status = 1 and community_id = #{communityId}) as unclaimed, + (select count(*) from com_act_warehouse_apply where status = 2 and community_id = #{communityId}) as rejected, + (select count(*) from com_act_warehouse_apply where status = 3 and community_id = #{communityId}) as received, + (select count(*) from com_act_warehouse_apply where status = -1 and community_id = #{communityId}) as cancelled </select> <select id="selectById" resultType="com.panzhihua.common.model.vos.community.warehouse.ComActWarehouseApplyVO"> diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActWarehouseOperationMapper.xml b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActWarehouseOperationMapper.xml index c105825..4a9fc62 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActWarehouseOperationMapper.xml +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActWarehouseOperationMapper.xml @@ -26,7 +26,7 @@ and t.goods_id=#{commonPage.paramId} </if> <if test="commonPage.communityId !=null"> - and t1.community_id =#{commonPage.communityId} + and t1.community_id = #{commonPage.communityId} </if> <if test="commonPage.keyword !=null and commonPage.keyword !=''"> and t1.item like concat('%',#{commonPage.keyword},'%') diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComPbMemberMapper.xml b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComPbMemberMapper.xml index f01d9f3..785defc 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComPbMemberMapper.xml +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComPbMemberMapper.xml @@ -7,12 +7,12 @@ </select> <select id="selectActivityCountMonth" resultType="com.panzhihua.common.model.vos.community.bigscreen.BigScreenActivityLine"> - select ( select count(id) from com_pb_activity where status!=6 and community_id =#{communityId} and release_time >= DATE_FORMAT( CONCAT(year(now()),'-',#{date},'-00'), '%Y-%m-00 00:00:00') and DATE_FORMAT( LAST_DAY(CONCAT(year(now()),'-',#{date},'-00')), '%Y-%m-%d 23:59:59') >=release_time) y, - (select count(id) from com_pb_activity where status!=6 and community_id =#{communityId} and DATE_FORMAT( LAST_DAY(CONCAT(year(now()),'-',#{date},'-00')), '%Y-%m-%d 23:59:59') >=release_time) countY + select ( select count(id) from com_pb_activity where status!=6 and community_id = #{communityId} and release_time >= DATE_FORMAT( CONCAT(year(now()),'-',#{date},'-00'), '%Y-%m-00 00:00:00') and DATE_FORMAT( LAST_DAY(CONCAT(year(now()),'-',#{date},'-00')), '%Y-%m-%d 23:59:59') >=release_time) y, + (select count(id) from com_pb_activity where status!=6 and community_id = #{communityId} and DATE_FORMAT( LAST_DAY(CONCAT(year(now()),'-',#{date},'-00')), '%Y-%m-%d 23:59:59') >=release_time) countY </select> <select id="selectActivityTop" resultType="com.panzhihua.common.model.vos.community.bigscreen.BigScreenActivityTop"> - select t.name,t.photo_path as url,t1.name as orgName,t2.integral_available_party as score from com_pb_member t LEFT JOIN com_pb_org t1 on t.org_id= t1.id LEFT JOIN com_act_integral_user t2 on t.user_id = t2.user_id where t.community_id =#{communityId} and t2.status = 1 order by integral_available_party desc + select t.name,t.photo_path as url,t1.name as orgName,t2.integral_available_party as score from com_pb_member t LEFT JOIN com_pb_org t1 on t.org_id= t1.id LEFT JOIN com_act_integral_user t2 on t.user_id = t2.user_id where t.community_id = #{communityId} and t2.status = 1 order by integral_available_party desc </select> <select id="bigScreenServiceData" resultType="com.panzhihua.common.model.vos.community.bigscreen.BigScreenServiceData"> diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComPropertyMapper.xml b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComPropertyMapper.xml index d2e0092..260c8ba 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComPropertyMapper.xml +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComPropertyMapper.xml @@ -32,7 +32,7 @@ and t.phone like concat(#{commonPage.phone},'%') </if> <if test="commonPage.paramId !=null"> - and t.community_id =#{commonPage.paramId} + and t.community_id = #{commonPage.paramId} </if> <if test="commonPage.areaId !=null"> and t.area_id =#{commonPage.areaId} diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/config/MybatisHmkInterceptor.java b/springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/config/MybatisHmkInterceptor.java index 391f298..afcc6e8 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/config/MybatisHmkInterceptor.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/config/MybatisHmkInterceptor.java @@ -3,24 +3,18 @@ import com.baomidou.mybatisplus.core.toolkit.PluginUtils; import com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor; import org.apache.ibatis.executor.Executor; -import org.apache.ibatis.executor.statement.StatementHandler; import org.apache.ibatis.mapping.BoundSql; import org.apache.ibatis.mapping.MappedStatement; import org.apache.ibatis.mapping.ParameterMapping; -import org.apache.ibatis.plugin.Intercepts; -import org.apache.ibatis.plugin.Signature; import org.apache.ibatis.session.ResultHandler; import org.apache.ibatis.session.RowBounds; +import java.lang.reflect.Field; import java.sql.SQLException; -import java.sql.Statement; import java.util.ArrayList; import java.util.List; import java.util.Map; -@Intercepts({ - @Signature(type = StatementHandler.class, method = "query", args = {Statement.class, ResultHandler.class}) -}) public class MybatisHmkInterceptor implements InnerInterceptor { @Override public void beforeQuery(Executor executor, MappedStatement ms, Object parameter, RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql) throws SQLException { @@ -34,27 +28,57 @@ } } if(parameter instanceof Map){ - List<ParameterMapping> parameterMappingList=new ArrayList<>(); - if(sql.contains("community_id = ?")&&((Map<?, ?>) parameter).containsValue(10086L)){ - List<ParameterMapping> parameterMappings=boundSql.getParameterMappings(); - parameterMappings.forEach(parameterMapping -> { - if (parameterMapping.getProperty().equals("communityId")){ - ParameterMapping parameterMapping1=new ParameterMapping.Builder(ms.getConfiguration(),"communityId",Object.class).build(); - parameterMappingList.add(parameterMapping1); + if(sql.contains("community_id = ?")){ + List<ParameterMapping> parameterMappingList=new ArrayList<>(); + if(((Map<?, ?>) parameter).containsValue(10086L)){ + List<ParameterMapping> parameterMappings=boundSql.getParameterMappings(); + parameterMappings.forEach(parameterMapping -> { + if (parameterMapping.getProperty().equals("communityId")){ + ParameterMapping parameterMapping1=new ParameterMapping.Builder(ms.getConfiguration(),parameterMapping.getProperty(),Object.class).build(); + parameterMappingList.add(parameterMapping1); + } + else { + parameterMappingList.add(parameterMapping); + } + }); + sql=sql.replace("community_id = ?","community_id in (?)"); + ((Map<?,?>) parameter).replaceAll((k,v)->{ + if(v.toString().contains("10086")){ + boundSql.setAdditionalParameter(k.toString(),"30,31"); + } + return v; + }); + PluginUtils.mpBoundSql(boundSql).parameterMappings(parameterMappingList); + PluginUtils.mpBoundSql(boundSql).sql(sql); + } + else{ + if(((Map<?, ?>) parameter).containsKey("arg0")){ + Map<?, ?> param= (Map<?, ?>) boundSql.getAdditionalParameter("_parameter"); + String finalSql = sql; + param.forEach((k, v)->{ + try { + Field field= v.getClass().getDeclaredField("communityId"); + if(field!=null){ + field.setAccessible(true); + if((long)field.get(v)==10086L){ + String sql1= finalSql.replace("community_id = ?","community_id in (30,31)"); + boundSql.getParameterMappings().forEach(parameterMapping -> { + if(!parameterMapping.getProperty().contains("communityId")){ + parameterMappingList.add(parameterMapping); + } + }); + PluginUtils.mpBoundSql(boundSql).parameterMappings(parameterMappingList); + PluginUtils.mpBoundSql(boundSql).sql(sql1); + } + } + } catch (IllegalAccessException e) { + e.printStackTrace(); + } catch (NoSuchFieldException e) { + + } + }); } - else { - parameterMappingList.add(parameterMapping); - } - }); - sql=sql.replace("community_id = ?","community_id in (?)"); - ((Map<?,?>) parameter).replaceAll((k,v)->{ - if(v.toString().equals("10086")){ - boundSql.setAdditionalParameter(k.toString(),"30,31"); - } - return v; - }); - PluginUtils.mpBoundSql(boundSql).parameterMappings(parameterMappingList); - PluginUtils.mpBoundSql(boundSql).sql(sql); + } } } InnerInterceptor.super.beforeQuery(executor, ms, parameter, rowBounds, resultHandler, boundSql); diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/config/MybatisPlusConfig.java b/springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/config/MybatisPlusConfig.java index 0676273..cd440f6 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/config/MybatisPlusConfig.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/config/MybatisPlusConfig.java @@ -25,8 +25,8 @@ @Bean public MybatisPlusInterceptor mybatisPlusInterceptor() { MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); - interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.H2)); interceptor.addInnerInterceptor(new MybatisHmkInterceptor()); + interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.H2)); return interceptor; } diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/config/MybatisHmkInterceptor.java b/springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/config/MybatisHmkInterceptor.java index 5b02fd8..973eedc 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/config/MybatisHmkInterceptor.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/config/MybatisHmkInterceptor.java @@ -3,24 +3,18 @@ import com.baomidou.mybatisplus.core.toolkit.PluginUtils; import com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor; import org.apache.ibatis.executor.Executor; -import org.apache.ibatis.executor.statement.StatementHandler; import org.apache.ibatis.mapping.BoundSql; import org.apache.ibatis.mapping.MappedStatement; import org.apache.ibatis.mapping.ParameterMapping; -import org.apache.ibatis.plugin.Intercepts; -import org.apache.ibatis.plugin.Signature; import org.apache.ibatis.session.ResultHandler; import org.apache.ibatis.session.RowBounds; +import java.lang.reflect.Field; import java.sql.SQLException; -import java.sql.Statement; import java.util.ArrayList; import java.util.List; import java.util.Map; -@Intercepts({ - @Signature(type = StatementHandler.class, method = "query", args = {Statement.class, ResultHandler.class}) -}) public class MybatisHmkInterceptor implements InnerInterceptor { @Override public void beforeQuery(Executor executor, MappedStatement ms, Object parameter, RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql) throws SQLException { @@ -34,27 +28,57 @@ } } if(parameter instanceof Map){ - List<ParameterMapping> parameterMappingList=new ArrayList<>(); - if(sql.contains("community_id = ?")&&((Map<?, ?>) parameter).containsValue(10086L)){ - List<ParameterMapping> parameterMappings=boundSql.getParameterMappings(); - parameterMappings.forEach(parameterMapping -> { - if (parameterMapping.getProperty().equals("communityId")){ - ParameterMapping parameterMapping1=new ParameterMapping.Builder(ms.getConfiguration(),"communityId",Object.class).build(); - parameterMappingList.add(parameterMapping1); + if(sql.contains("community_id = ?")){ + List<ParameterMapping> parameterMappingList=new ArrayList<>(); + if(((Map<?, ?>) parameter).containsValue(10086L)){ + List<ParameterMapping> parameterMappings=boundSql.getParameterMappings(); + parameterMappings.forEach(parameterMapping -> { + if (parameterMapping.getProperty().equals("communityId")){ + ParameterMapping parameterMapping1=new ParameterMapping.Builder(ms.getConfiguration(),parameterMapping.getProperty(),Object.class).build(); + parameterMappingList.add(parameterMapping1); + } + else { + parameterMappingList.add(parameterMapping); + } + }); + sql=sql.replace("community_id = ?","community_id in (?)"); + ((Map<?,?>) parameter).replaceAll((k,v)->{ + if(v.toString().contains("10086")){ + boundSql.setAdditionalParameter(k.toString(),"30,31"); + } + return v; + }); + PluginUtils.mpBoundSql(boundSql).parameterMappings(parameterMappingList); + PluginUtils.mpBoundSql(boundSql).sql(sql); + } + else{ + if(((Map<?, ?>) parameter).containsKey("arg0")){ + Map<?, ?> param= (Map<?, ?>) boundSql.getAdditionalParameter("_parameter"); + String finalSql = sql; + param.forEach((k, v)->{ + try { + Field field= v.getClass().getDeclaredField("communityId"); + if(field!=null){ + field.setAccessible(true); + if((long)field.get(v)==10086L){ + String sql1= finalSql.replace("community_id = ?","community_id in (30,31)"); + boundSql.getParameterMappings().forEach(parameterMapping -> { + if(!parameterMapping.getProperty().contains("communityId")){ + parameterMappingList.add(parameterMapping); + } + }); + PluginUtils.mpBoundSql(boundSql).parameterMappings(parameterMappingList); + PluginUtils.mpBoundSql(boundSql).sql(sql1); + } + } + } catch (IllegalAccessException e) { + e.printStackTrace(); + } catch (NoSuchFieldException e) { + + } + }); } - else { - parameterMappingList.add(parameterMapping); - } - }); - sql=sql.replace("community_id = ?","community_id in (?)"); - ((Map<?,?>) parameter).replaceAll((k,v)->{ - if(v.toString().equals("10086")){ - boundSql.setAdditionalParameter(k.toString(),"30,31"); - } - return v; - }); - PluginUtils.mpBoundSql(boundSql).parameterMappings(parameterMappingList); - PluginUtils.mpBoundSql(boundSql).sql(sql); + } } } InnerInterceptor.super.beforeQuery(executor, ms, parameter, rowBounds, resultHandler, boundSql); diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/config/MybatisPlusConfig.java b/springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/config/MybatisPlusConfig.java index a3dbcf9..871ad4b 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/config/MybatisPlusConfig.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/config/MybatisPlusConfig.java @@ -23,8 +23,8 @@ @Bean public MybatisPlusInterceptor mybatisPlusInterceptor() { MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); - interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.H2)); interceptor.addInnerInterceptor(new MybatisHmkInterceptor()); + interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.H2)); return interceptor; } diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_property/src/main/resources/mapper/ComPropertyAlarmMapper.xml b/springcloud_k8s_panzhihuazhihuishequ/service_property/src/main/resources/mapper/ComPropertyAlarmMapper.xml index f12231c..ceb09ac 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_property/src/main/resources/mapper/ComPropertyAlarmMapper.xml +++ b/springcloud_k8s_panzhihuazhihuishequ/service_property/src/main/resources/mapper/ComPropertyAlarmMapper.xml @@ -26,7 +26,7 @@ <where> 1=1 <if test="commonPage.paramId !=null"> - and t1.community_id =#{commonPage.paramId} + and t1.community_id = #{commonPage.paramId} </if> <if test="commonPage.type !=null"> and t.type =#{commonPage.type} diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_property/src/main/resources/mapper/ComPropertyAlarmSettingMapper.xml b/springcloud_k8s_panzhihuazhihuishequ/service_property/src/main/resources/mapper/ComPropertyAlarmSettingMapper.xml index 2b4cf44..25b3a3c 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_property/src/main/resources/mapper/ComPropertyAlarmSettingMapper.xml +++ b/springcloud_k8s_panzhihuazhihuishequ/service_property/src/main/resources/mapper/ComPropertyAlarmSettingMapper.xml @@ -11,7 +11,7 @@ </resultMap> <select id="getByCommunityId" resultMap="ComPropertyAlarmSettingBaseResultMap"> - select * from com_property_alarm_setting where community_id =#{community_id} order by create_time desc limit 1 + select * from com_property_alarm_setting where community_id = #{community_id} order by create_time desc limit 1 </select> </mapper> diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_property/src/main/resources/mapper/ComPropertyEquipmentMapper.xml b/springcloud_k8s_panzhihuazhihuishequ/service_property/src/main/resources/mapper/ComPropertyEquipmentMapper.xml index c9a0b90..ada4809 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_property/src/main/resources/mapper/ComPropertyEquipmentMapper.xml +++ b/springcloud_k8s_panzhihuazhihuishequ/service_property/src/main/resources/mapper/ComPropertyEquipmentMapper.xml @@ -25,7 +25,7 @@ and type =#{commonPage.type} </if> <if test="commonPage.paramId !=null"> - and community_id =#{commonPage.paramId} + and community_id = #{commonPage.paramId} </if> <if test="commonPage.name!=null and commonPage.name!=''"> and name like concat(#{commonPage.name},'%') diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_property/src/main/resources/mapper/ComPropertyHelpMapper.xml b/springcloud_k8s_panzhihuazhihuishequ/service_property/src/main/resources/mapper/ComPropertyHelpMapper.xml index 1c116ee..b399024 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_property/src/main/resources/mapper/ComPropertyHelpMapper.xml +++ b/springcloud_k8s_panzhihuazhihuishequ/service_property/src/main/resources/mapper/ComPropertyHelpMapper.xml @@ -21,7 +21,7 @@ and status =#{commonPage.status} </if> <if test="commonPage.paramId !=null"> - and community_id =#{commonPage.paramId} + and community_id = #{commonPage.paramId} </if> </where> order by create_time desc diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_property/src/main/resources/mapper/ComPropertyRepairMapper.xml b/springcloud_k8s_panzhihuazhihuishequ/service_property/src/main/resources/mapper/ComPropertyRepairMapper.xml index cedc7dc..21312f4 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_property/src/main/resources/mapper/ComPropertyRepairMapper.xml +++ b/springcloud_k8s_panzhihuazhihuishequ/service_property/src/main/resources/mapper/ComPropertyRepairMapper.xml @@ -49,7 +49,7 @@ and t1.name like concat(#{commonPage.systemName},'%') </if> <if test="commonPage.paramId !=null and commonPage.paramId !=0"> - and t2.community_id =#{commonPage.paramId} + and t2.community_id = #{commonPage.paramId} </if> <if test="commonPage.areaId !=null and commonPage.areaId !=0"> and t2.area_id =#{commonPage.areaId} diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/resources/mapper/UserDao.xml b/springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/resources/mapper/UserDao.xml index c84e88f..40b7af2 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/resources/mapper/UserDao.xml +++ b/springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/resources/mapper/UserDao.xml @@ -55,7 +55,7 @@ sys_user u JOIN com_act c ON u.community_id = c.community_id LEFT JOIN com_mng_struct_house_user h on u.user_id=h.user_id - WHERE u.community_id =#{communityId} and u.type=1 + WHERE u.community_id = #{communityId} and u.type=1 </select> <update id="timedTaskContinuousLandingDays"> -- Gitblit v1.7.1