fengjin
2022-09-29 dca1619b4c1ee2d545ea37693678ad841211cd4b
1.修改token验证时间方便测试2.修改Bug
5个文件已修改
52 ■■■■■ 已修改文件
flower_city/src/main/java/com/dg/core/Constant.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
flower_city/src/main/java/com/dg/core/db/gen/mapper/SysUserMapper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
flower_city/src/main/java/com/dg/core/service/impl/AreaCodeServiceImpl.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
flower_city/src/main/java/com/dg/core/service/impl/SysUserServiceImpl.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
flower_city/src/main/resources/mapper/SysUserMapper.xml 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
flower_city/src/main/java/com/dg/core/Constant.java
@@ -31,7 +31,7 @@
    /**
     * token有效期(小时)
     */
    public static final int TOKEN_EXPIRES_HOUR = 1;
    public static final int TOKEN_EXPIRES_HOUR = 10;
    /**
     * redis存储手机验证码过期时间(10分钟)
flower_city/src/main/java/com/dg/core/db/gen/mapper/SysUserMapper.java
@@ -65,5 +65,5 @@
     *
     * @return 结果
     */
    List<SysUser> selectListByDepartmentId(@Param("departmentId") String departmentId,@Param("classifyId") String classifyId);
    List<SysUser> selectListByDepartmentId(@Param("list") List<String> list,@Param("classifyIdFront") String classifyIdFront,@Param("classifyIdAfter") String classifyIdAfter);
}
flower_city/src/main/java/com/dg/core/service/impl/AreaCodeServiceImpl.java
@@ -40,7 +40,10 @@
             areaCodes.add(organizationChartEntity.getVillage());
           getAreaCodeIds(areaCodes,organizationChartEntity);
        }
        return baseMapper.selectByIdSet(areaCodes);
        if (areaCodes.size()==0)
            return null;
        else
           return baseMapper.selectByIdSet(areaCodes);
    }
    public  List<String> getAreaCodeIds(List<String> areaCodes, OrganizationChartEntity organizationChartEntity){
flower_city/src/main/java/com/dg/core/service/impl/SysUserServiceImpl.java
@@ -4,7 +4,9 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dg.core.ResultData;
import com.dg.core.db.gen.entity.OrganizationChartEntity;
import com.dg.core.db.gen.entity.SysUser;
import com.dg.core.db.gen.mapper.OrganizationChartMapper;
import com.dg.core.db.gen.mapper.SysUserMapper;
import com.dg.core.manager.TokenManager;
import com.dg.core.service.ISysUserService;
@@ -18,6 +20,7 @@
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -34,6 +37,9 @@
    @Autowired
    TokenManager tokenManager;
    @Resource
    private OrganizationChartMapper organizationChartMapper;
    @Override
    public SysUser getUserById(Long id) {
@@ -104,7 +110,32 @@
    @Override
    public List<SysUser> selectListByDepartmentId(String departmentId, String classifyId) {
        return baseMapper.selectListByDepartmentId(departmentId,classifyId);
        List<String> departmentIds=new ArrayList<>();
        departmentIds.add(departmentId);
        List<OrganizationChartEntity> organizationChartEntities = organizationChartMapper.selectList(new QueryWrapper<OrganizationChartEntity>().lambda()
                .eq(OrganizationChartEntity::getParentId, departmentId));
        if (organizationChartEntities!=null){
            for (OrganizationChartEntity organizationChart:organizationChartEntities) {
                departmentIds.add(organizationChart.getId().toString());
                List<OrganizationChartEntity> organizationChartEntitiesUser = organizationChartMapper.selectList(new QueryWrapper<OrganizationChartEntity>().lambda()
                        .eq(OrganizationChartEntity::getParentId, organizationChart.getId().toString()));
                if (organizationChartEntitiesUser!=null)
                    departmentIds=this.getDepartmentIds(organizationChartEntitiesUser,departmentIds);
            }
        }
        return baseMapper.selectListByDepartmentId(departmentIds,","+classifyId,classifyId+",");
    }
    public  List<String> getDepartmentIds(  List<OrganizationChartEntity> organizationChartEntities,List<String> departmentIds){
        for (OrganizationChartEntity organizationChart:organizationChartEntities) {
            departmentIds.add(organizationChart.getId().toString());
            List<OrganizationChartEntity> organizationChartEntitiesUser = organizationChartMapper.selectList(new QueryWrapper<OrganizationChartEntity>().lambda()
                    .eq(OrganizationChartEntity::getParentId, organizationChart.getId().toString()));
            if (organizationChartEntitiesUser!=null)
                departmentIds=this.getDepartmentIds(organizationChartEntitiesUser,departmentIds);
        }
        return  departmentIds;
    }
    @Override
flower_city/src/main/resources/mapper/SysUserMapper.xml
@@ -99,7 +99,15 @@
    <select id="selectListByDepartmentId"  resultMap="SysUserResult">
        <include refid="selectSysUserVo"/>
         where department_id=#{departmentId} and master_ids like concat('%',#{classifyId}, '%')
         <where>
        <if test="list!=null">
           department_id in
        <foreach collection="list" item="id" index="index" open="(" close=")" separator=",">
            #{id}
        </foreach>
         </if>
         and (master_ids like concat('%',#{classifyIdFront}, '%') or master_ids like concat('%',#{classifyIdAfter}, '%'))
         </where>
    </select>