4e0f9ae911742c41ef2b87647afdfd7df54d3e18..135090721ee50abef2577e61617d3f2b2e15bb4a
2025-05-09 mitao
Merge remote-tracking branch '喜望/dev-2.0.1' into dev-2.0.1
135090 对比 | 目录
2025-05-09 mitao
编辑删除办理进度接口
d151d7 对比 | 目录
2025-05-09 liujie
分析统计修改
e94744 对比 | 目录
2025-05-09 liujie
用户管理
362736 对比 | 目录
2025-05-08 liujie
用户管理
11dabe 对比 | 目录
12个文件已修改
2个文件已添加
230 ■■■■ 已修改文件
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/DepartmentController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/SystemUserController.java 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/controller/ComplaintProgressController.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/controller/StaticsController.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/dto/ComplaintProcessDTO.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/entity/SystemUser.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/IComplaintProgressService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintProgressServiceImpl.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/StaticsService.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/SystemUserServiceImpl.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/warpper/SystemUserList.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/resources/mapper/ComplaintRejectMapper.xml 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/resources/mapper/SystemUserMapper.xml 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/DepartmentController.java
@@ -45,8 +45,8 @@
    
    
    @GetMapping("/list")
    @ApiOperation(value = "获取单位列表1", tags = {"三个身边后台-用户管理"})
    @OperLog(operModul = "三个身边后台",operType = 0, businessType = "获取单位列表1")
    @ApiOperation(value = "获取单位列表2.0.1", tags = {"三个身边后台-用户管理"})
    @OperLog(operModul = "三个身边后台",operType = 0, businessType = "获取单位列表2.0.1")
    public R<List<RegionVO>> list(String name){
        // 社区
        List<ComAct> list2 = comActService.list(new LambdaQueryWrapper<ComAct>().eq(ComAct::getCityCode,510400).like(StringUtils.isNotEmpty(name), ComAct::getName, name));
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/SystemUserController.java
@@ -1,6 +1,7 @@
package com.panzhihua.sangeshenbian.api;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.panzhihua.common.controller.BaseController;
import com.panzhihua.common.interfaces.OperLog;
@@ -67,6 +68,9 @@
    @Resource
    private ISystemLogService systemLogService;
    @Resource
    private ISystemUserLevelService systemUserLevelService;
@@ -209,6 +213,16 @@
    public R add(@RequestBody SystemUser systemUser){
        Integer id = this.getLoginUserInfoSanGeShenBian().getId();
        SystemUser user = systemUserService.getById(id);
        List<SystemUserLevel> systemUserLevels = systemUser.getSystemUserLevels();
        if(systemUserLevels==null || systemUserLevels.isEmpty()){
            return R.fail("请选择账号层级");
        }
        // 获取最高层级的用于原来的判断
        systemUserLevels.sort(Comparator.comparing(SystemUserLevel::getLevel));
        Integer level = systemUserLevels.get(0).getLevel();
        user.setAccountLevel(level);
        if(2 == user.getAccountLevel() && 1 == systemUser.getAccountLevel()){
            return R.fail("不能添加市级账号");
        }
@@ -245,6 +259,13 @@
        // 2.0.1 默认管理员
        systemUser.setIsAdmin(1);
        systemUserService.save(systemUser);
        // 2.0.1添加账号层级
        systemUserLevels.forEach(e->{
            e.setSystemUserId(systemUser.getId());
            e.setStatus(1);
        });
        systemUserLevelService.saveBatch(systemUserLevels);
        return R.ok();
    }
@@ -253,6 +274,10 @@
    @ApiOperation(value = "编辑人员", tags = {"三个身边后台-人员管理"})
    @SysLog(operatorCategory = "编辑账号",operId = 4)
    public R edit(@RequestBody SystemUser systemUser){
        List<SystemUserLevel> systemUserLevels = systemUser.getSystemUserLevels();
        if(systemUserLevels==null || systemUserLevels.isEmpty()){
            return R.fail("请选择账号层级");
        }
        long count = systemUserService.count(new LambdaQueryWrapper<SystemUser>().eq(SystemUser::getPhone, systemUser.getPhone())
                .ne(SystemUser::getStatus, 3).ne(SystemUser::getId, systemUser.getId()));
        if(0 < count){
@@ -280,6 +305,15 @@
        systemUser.setStatus(1);
        systemUser.setCreateTime(LocalDateTime.now());
        systemUserService.updateById(systemUser);
        // 移除原来层级 在添加新层级
        systemUserLevelService.remove(new LambdaQueryWrapper<SystemUserLevel>().eq(SystemUserLevel::getSystemUserId, systemUser.getId()));
        systemUserLevels.forEach(e->{
            e.setSystemUserId(systemUser.getId());
            e.setStatus(1);
        });
        systemUserLevelService.saveBatch(systemUserLevels);
        return R.ok();
    }
@@ -291,6 +325,7 @@
        SystemUser systemUser = systemUserService.getById(id);
        systemUser.setStatus(3);
        systemUserService.updateById(systemUser);
        systemUserLevelService.update(new LambdaUpdateWrapper<SystemUserLevel>().eq(SystemUserLevel::getSystemUserId, id).set(SystemUserLevel::getStatus,3));
        return R.ok(systemUser.getName());
    }
@@ -300,6 +335,9 @@
    @OperLog(operModul = "三个身边后台",operType = 0,businessType = "查询人员详情")
    public R<SystemUser> getSystemUserInfo(@PathVariable("id") Integer id){
        SystemUser systemUser = systemUserService.getById(id);
        List<SystemUserLevel> listBySystemUserId = systemUserLevelService.getListBySystemUserId(id);
        listBySystemUserId.sort(Comparator.comparing(SystemUserLevel::getLevel));
        systemUser.setSystemUserLevels(listBySystemUserId);
        return R.ok(systemUser);
    }
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/controller/ComplaintProgressController.java
@@ -1,6 +1,18 @@
package com.panzhihua.sangeshenbian.controller;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.sangeshenbian.model.dto.ComplaintProcessDTO;
import com.panzhihua.sangeshenbian.service.IComplaintProgressService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@@ -13,8 +25,23 @@
 * @author 
 * @since 2025-02-22
 */
@Api(tags = {"【2.0.1】诉求办理进度相关接口"})
@RestController
@RequestMapping("/complaint-progress")
@RequestMapping("/applet/complaint-progress")
@RequiredArgsConstructor(onConstructor_ = {@Lazy})
public class ComplaintProgressController {
    private final IComplaintProgressService complaintProgressService;
    @DeleteMapping("/{id}")
    @ApiOperation("【2.0.1】删除办理进度")
    public R<?> delete(@ApiParam(name = "id", value = "进度id", required = true) @PathVariable("id") Long id) {
        complaintProgressService.removeById(id);
        return R.ok();
    }
    @PutMapping("/edit")
    @ApiOperation("【2.0.1】编辑办理进度")
    public R<?> edit(@RequestBody ComplaintProcessDTO dto) {
        complaintProgressService.edit(dto);
        return R.ok();
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/controller/StaticsController.java
New file
@@ -0,0 +1,21 @@
package com.panzhihua.sangeshenbian.controller;
import com.panzhihua.sangeshenbian.service.impl.StaticsService;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * @author mitao
 * @date 2025/5/9
 */
@Api(tags = {"【2.0.1】统计分析相关接口"})
@RestController
@RequestMapping("/applet/statics")
@RequiredArgsConstructor(onConstructor_ = {@Lazy})
public class StaticsController {
    private final StaticsService staticsService;
}
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/dto/ComplaintProcessDTO.java
@@ -18,6 +18,9 @@
@ApiModel
public class ComplaintProcessDTO {
    @ApiModelProperty(value = "主键")
    private Long id;
    @ApiModelProperty(value = "诉求id")
    @NotNull(message = "诉求id不能为空")
    private Long complaintId;
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/entity/SystemUser.java
@@ -11,6 +11,7 @@
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
/**
 * 系统用户
@@ -141,6 +142,10 @@
    @TableField("create_time")
    private LocalDateTime createTime;
    @TableField(exist = false)
    @ApiModelProperty(value = "账号层级 2.0.1新增")
    private List<SystemUserLevel> systemUserLevels;
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/IComplaintProgressService.java
@@ -1,5 +1,6 @@
package com.panzhihua.sangeshenbian.service;
import com.panzhihua.sangeshenbian.model.dto.ComplaintProcessDTO;
import com.panzhihua.sangeshenbian.model.entity.ComplaintProgress;
import com.baomidou.mybatisplus.extension.service.IService;
@@ -13,4 +14,5 @@
 */
public interface IComplaintProgressService extends IService<ComplaintProgress> {
    void edit(ComplaintProcessDTO dto);
}
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintProgressServiceImpl.java
@@ -1,10 +1,16 @@
package com.panzhihua.sangeshenbian.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.panzhihua.common.exceptions.ServiceException;
import com.panzhihua.sangeshenbian.model.dto.ComplaintProcessDTO;
import com.panzhihua.sangeshenbian.model.entity.ComplaintProgress;
import com.panzhihua.sangeshenbian.dao.ComplaintProgressMapper;
import com.panzhihua.sangeshenbian.service.IComplaintProgressService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.Objects;
/**
 * <p>
@@ -16,5 +22,12 @@
 */
@Service
public class ComplaintProgressServiceImpl extends ServiceImpl<ComplaintProgressMapper, ComplaintProgress> implements IComplaintProgressService {
    @Override
    public void edit(ComplaintProcessDTO dto) {
        if (Objects.nonNull(dto.getId())) {
            throw new ServiceException("办理进度id不能为空");
        }
        ComplaintProgress complaintProgress = BeanUtil.copyProperties(dto, ComplaintProgress.class);
        this.updateById(complaintProgress);
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java
@@ -1562,6 +1562,9 @@
                Date parse1 = simpleDateFormat.parse(split[1] + " 23:59:59");
                complaints = complaints.stream().filter(e -> e.getCreateTime().getTime() <= parse1.getTime() && e.getCreateTime().getTime() >= parse.getTime()).collect(Collectors.toList());
                int day = DateUtils.getDay(parse, parse1);
                if(day>30){
                    throw new ServiceException("时间范围不能超过30天");
                }
                for (int i = 0; i <= day; i++) {
                    AnalyticStatisticsTwoVo analyticStatisticsTwoVo = new AnalyticStatisticsTwoVo();
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/StaticsService.java
New file
@@ -0,0 +1,25 @@
package com.panzhihua.sangeshenbian.service.impl;
import com.panzhihua.sangeshenbian.service.IBcRegionService;
import com.panzhihua.sangeshenbian.service.IComActService;
import com.panzhihua.sangeshenbian.service.IComStreetService;
import com.panzhihua.sangeshenbian.service.IComplaintService;
import com.panzhihua.sangeshenbian.service.IdentityInformationService;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
/**
 * @author mitao
 * @date 2025/5/9
 */
@RequiredArgsConstructor(onConstructor_ = {@Lazy})
@Service
public class StaticsService {
    private final IdentityInformationService identityInformationService;
    private final IComplaintService complaintService;
    private final IBcRegionService bcRegionService;
    private final IComStreetService comStreetService;
    private final IComActService comActService;
}
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/SystemUserServiceImpl.java
@@ -5,20 +5,16 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.beust.jcommander.internal.Lists;
import com.panzhihua.common.model.vos.LoginUserInfoVO;
import com.panzhihua.common.model.vos.sangeshenbian.SystemUserVo;
import com.panzhihua.common.utlis.StringUtils;
import com.panzhihua.sangeshenbian.dao.SystemUserLevelMapper;
import com.panzhihua.sangeshenbian.dao.SystemUserMapper;
import com.panzhihua.sangeshenbian.model.entity.ComAct;
import com.panzhihua.sangeshenbian.model.entity.PartyMember;
import com.panzhihua.sangeshenbian.model.entity.SystemUser;
import com.panzhihua.sangeshenbian.model.entity.SystemUserLevel;
import com.panzhihua.sangeshenbian.model.vo.RegionVO;
import com.panzhihua.sangeshenbian.service.IBcRegionService;
import com.panzhihua.sangeshenbian.service.IComActService;
import com.panzhihua.sangeshenbian.service.IComStreetService;
import com.panzhihua.sangeshenbian.service.ISystemUserService;
import com.panzhihua.sangeshenbian.warpper.IdentityInformationVO;
import com.panzhihua.sangeshenbian.warpper.PermissionsVO;
import com.panzhihua.sangeshenbian.warpper.SystemUserList;
import com.panzhihua.sangeshenbian.warpper.SystemUserListVo;
import lombok.RequiredArgsConstructor;
@@ -26,9 +22,9 @@
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
/**
 * @author zhibing.pu
@@ -38,6 +34,7 @@
@RequiredArgsConstructor(onConstructor_ = {@Lazy})
public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemUser> implements ISystemUserService {
    private final IComActService comActService;
    private final SystemUserLevelMapper systemUserLevelMapper;
    /**
     * 获取列表数据
     * @param query
@@ -49,6 +46,11 @@
        page.setCurrent(query.getPageNum());
        page.setSize(query.getPageSize());
        IPage<SystemUserListVo> list = this.baseMapper.list(page, user, query);
        list.getRecords().forEach(item -> {
            List<SystemUserLevel> systemUserLevels = systemUserLevelMapper.selectList(new LambdaQueryWrapper<SystemUserLevel>().eq(SystemUserLevel::getStatus,1).eq(SystemUserLevel::getSystemUserId, item.getId()));
            systemUserLevels.sort(Comparator.comparing(SystemUserLevel::getLevel));
            item.setList(systemUserLevels);
        });
        return list;
    }
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/warpper/SystemUserList.java
@@ -19,7 +19,7 @@
    private Integer departmentId;
    @ApiModelProperty(value = "所属角色")
    private Integer systemRoleId;
    @ApiModelProperty(value = "账号层级(1=市级账号,2=区县账号,3=街道账号,4=社区账号)")
    @ApiModelProperty(value = "账号层级(1=市级账号,2=区县账号,3=街道账号,4=社区账号) 优先账号所属层级-》选择的组织结构tier ")
    private Integer accountLevel;
    @ApiModelProperty(value = "页码", required = true)
    private Integer pageNum;
@@ -27,4 +27,6 @@
    private Integer pageSize;
    @ApiModelProperty(value = "1当前组织架构 2当前及下级", required = true)
    private Integer type;
    @ApiModelProperty(value = "组织架构编码 2传当前指定的区县regionCode  3传街道streetId  4传communityId")
    private String code;
}
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/resources/mapper/ComplaintRejectMapper.xml
@@ -10,11 +10,10 @@
    <select id="getComplaintRejectList" resultType="com.panzhihua.sangeshenbian.model.vo.ComplaintRejectVo">
        select t1.remark,t1.create_time examineTime,t2.id complaintId,t2.serial_number serialNumber,t2.report_user_name reportUserName,t2.status,
        select t3.reject_reason remark,t3.audit_time examineTime,t2.id complaintId,t2.serial_number serialNumber,t2.report_user_name reportUserName,t2.status,
               t2.report_user_phone reportUserPhone,t3.auditor_name examineUserName,t3.create_time applyTime,t3.apply_name applyUserName
        from sgsb_complaint_reject t1
        left join sgsb_complaint t2 on t1.complaint_id = t2.id
        left join sgsb_complaint_audit_record t3 on t1.complaint_audit_id = t3.id
        from sgsb_complaint_audit_record t3
        left join sgsb_complaint t2 on t3.complaint_id = t2.id
        <where>
            <if test="query.serialNumber != null and query.serialNumber != ''">
                and t2.serial_number = #{query.serialNumber}
@@ -35,10 +34,10 @@
                and t3.create_time between #{applyStartTime} and #{applyEndTime}
            </if>
            <if test="examineStartTime !=null">
                and t1.create_time between #{applyStartTime} and #{applyEndTime}
                and t3.audit_time between #{examineStartTime} and #{examineEndTime}
            </if>
        </where>
        order by t1.create_time desc
        order by t3.create_time desc
    </select>
</mapper>
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/resources/mapper/SystemUserMapper.xml
@@ -6,22 +6,17 @@
    
    <select id="list" resultType="com.panzhihua.sangeshenbian.warpper.SystemUserListVo">
        select
        select distinct
            a.id,
            a.name,
            a.phone,
            IF(a.four_department_id is not null, e.`name`, IF(a.three_department_id is not null, d.`name`, IF(a.two_department_id is not null, c.`name`, b.`name`))) as departmentName,
            f.`name` as systemPostName,
            g.`name` as systemRoleName,
            a.account_level as accountLevel,
            a.`status`
        from sgsb_system_user a
        left join sgsb_department b on (a.one_department_id = b.id)
        left join sgsb_department c on (a.two_department_id = c.id)
        left join sgsb_department d on (a.three_department_id = d.id)
        left join sgsb_department e on (a.four_department_id = e.id)
        left join sgsb_system_post f on (a.system_post_id = f.id)
        left join sgsb_system_role g on (a.system_role_id = g.id)
        left join sgsb_system_user_level h on (a.id = h.system_user_id)
        where a.`status` != 3
        <if test="null != query.name and '' != query.name">
            and a.name like CONCAT('%', #{query.name}, '%')
@@ -29,26 +24,47 @@
        <if test="null != query.phone and '' != query.phone">
            and a.phone like CONCAT('%', #{query.phone}, '%')
        </if>
        <if test="null != query.departmentId">
            and (a.one_department_id = #{query.departmentId} or a.two_department_id = #{query.departmentId} or a.three_department_id = #{query.departmentId} or a.four_department_id = #{query.departmentId})
        </if>
        <if test="null != query.systemRoleId">
            and a.system_role_id = #{query.systemRoleId}
        </if>
        <if test="null != user.accountLevel and 2 == user.accountLevel">
            and a.account_level >= #{user.accountLevel} and a.districts_code = #{user.districtsCode}
        <if test="null != query.accountLevel and 2 == query.accountLevel and query.type==2 and query.code != null and query.code !=''  ">
            and h.level >= #{query.accountLevel} and h.districts_code = #{query.code}
        </if>
        <if test="null != user.accountLevel and 3 == user.accountLevel">
            and a.account_level >= #{user.accountLevel} and a.street_id = #{user.streetId}
        <if test="null != query.accountLevel and 2 == query.accountLevel and query.type==2 and query.code == null">
            and h.level >= #{query.accountLevel}
        </if>
        <if test="null != user.accountLevel and 4 == user.accountLevel">
            and a.account_level >= #{user.accountLevel} and a.community_id = #{user.communityId}
        <if test="null != query.accountLevel and 2 == query.accountLevel and query.type==1 and query.code != null and query.code !=''">
            and h.level = #{query.accountLevel} and h.districts_code = #{query.code}
        </if>
        <if test="null != query.accountLevel and 2 == query.accountLevel and query.type==1 and query.code == null ">
            and h.level = #{query.accountLevel}
        </if>
        <if test="null != query.accountLevel and 3 == query.accountLevel and query.type==2 and query.code != null and query.code !=''">
            and h.level >= #{query.accountLevel} and h.street_id = #{query.code}
        </if>
        <if test="null != query.accountLevel and 3 == query.accountLevel and query.type==2 and query.code == null">
            and h.level >= #{query.accountLevel}
        </if>
        <if test="null != query.accountLevel and 3 == query.accountLevel and query.type==1 and query.code != null and query.code !=''">
            and h.level = #{query.accountLevel} and h.street_id = #{query.code}
        </if>
        <if test="null != query.accountLevel and 3 == query.accountLevel and query.type==1 and query.code == null">
            and h.level = #{query.accountLevel}
        </if>
        <if test="null != query.accountLevel and 4 == query.accountLevel and query.type==2 and query.code != null and query.code !=''">
            and h.level >= #{query.accountLevel} and h.community_id = #{query.code}
        </if>
        <if test="null != query.accountLevel and 4 == query.accountLevel and query.type==2 and query.code == null">
            and h.level >= #{query.accountLevel}
        </if>
        <if test="null != query.accountLevel and 4 == query.accountLevel and query.type==1 and query.code != null and query.code !=''">
            and h.level = #{query.accountLevel} and h.community_id = #{query.code}
        </if>
        <if test="null != query.accountLevel and 4 == query.accountLevel and query.type==1 and query.code == null">
            and h.level = #{query.accountLevel}
        </if>
        <if test="null != user.accountLevel and 5 == user.accountLevel">
            and a.id = 0
        </if>
        <if test="null != query.accountLevel">
            and a.account_level = #{query.accountLevel}
        </if>
        order by a.create_time desc
    </select>