| | |
| | | |
| | | 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; |
| | |
| | | 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 { |
| | |
| | | } |
| | | } |
| | | 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); |
| | |
| | | @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; |
| | | } |
| | | |
| | |
| | | + " 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 " |
| | |
| | | + "(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 " |
| | |
| | | + " (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, " |
| | |
| | | |
| | | @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); |
| | | |
| | |
| | | "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} " + |
| | |
| | | + " 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); |
| | | |
| | |
| | | |
| | | @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}") |
| | |
| | | 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 |
| | |
| | | </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"> |
| | |
| | | <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},'%') |
| | |
| | | where |
| | | status = 2 and adver_position_top = 1 |
| | | <if test="communityId !=null"> |
| | | and community_id =#{communityId} |
| | | and community_id = #{communityId} |
| | | </if> |
| | | |
| | | </select> |
| | |
| | | <where> |
| | | status = 2 and adver_position_application = 1 |
| | | <if test="communityId !=null"> |
| | | and community_id =#{communityId} |
| | | and community_id = #{communityId} |
| | | </if> |
| | | </where> |
| | | </select> |
| | |
| | | </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> |
| | |
| | | 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},'%') |
| | |
| | | |
| | | <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"> |
| | |
| | | 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},'%') |
| | |
| | | </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"> |
| | |
| | | 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} |
| | |
| | | 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 { |
| | |
| | | } |
| | | } |
| | | 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); |
| | |
| | | @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; |
| | | } |
| | | |
| | |
| | | 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 { |
| | |
| | | } |
| | | } |
| | | 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); |
| | |
| | | @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; |
| | | } |
| | | |
| | |
| | | <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} |
| | |
| | | </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> |
| | |
| | | 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},'%') |
| | |
| | | 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 |
| | |
| | | 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} |
| | |
| | | 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"> |