按客户要求导出目录

master
hansha 1 year ago
parent 485c8428bf
commit 078e4ddb21

@ -26,27 +26,27 @@ public class DaCatalog extends BaseEntity
private String muName; private String muName;
/** 父目录ID */ /** 父目录ID */
@Excel(name = "父目录ID") //@Excel(name = "父目录ID")
private Long pid; private Long pid;
/** 祖级列表 */ /** 祖级列表 */
@Excel(name = "祖级列表") //@Excel(name = "祖级列表")
private String ancestors; private String ancestors;
/** 显示顺序 */ /** 显示顺序 */
@Excel(name = "显示顺序") //@Excel(name = "显示顺序")
private Long orderNum; private Long orderNum;
/** 业务类型(字典) */ /** 业务类型(字典) */
@Excel(name = "业务类型(字典)") @Excel(name = "业务类型",dictType = "yw_type")
private String ywType; private String ywType;
/** 业务类型(字典) */ /** 业务类型(字典) */
@Excel(name = "图片模板") // @Excel(name = "图片模板")
private String picPath; private String picPath;
/** 菜单状态0正常 1停用 */ /** 菜单状态0正常 1停用 */
@Excel(name = "菜单状态", readConverterExp = "0=正常,1=停用") // @Excel(name = "菜单状态", readConverterExp = "0=正常,1=停用")
private String status; private String status;
/** 子目录 */ /** 子目录 */

@ -92,7 +92,7 @@ public class DaCatalogController extends BaseController
/** /**
* *
*/ */
@PreAuthorize("@ss.hasPermi('dangan:catalog:export')") /*@PreAuthorize("@ss.hasPermi('dangan:catalog:export')")
@Log(title = "档案目录", businessType = BusinessType.EXPORT) @Log(title = "档案目录", businessType = BusinessType.EXPORT)
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, DaCatalog daCatalog) public void export(HttpServletResponse response, DaCatalog daCatalog)
@ -100,6 +100,19 @@ public class DaCatalogController extends BaseController
List<DaCatalog> list = daCatalogService.selectDaCatalogList(daCatalog, getLoginUser()); List<DaCatalog> list = daCatalogService.selectDaCatalogList(daCatalog, getLoginUser());
ExcelUtil<DaCatalog> util = new ExcelUtil<DaCatalog>(DaCatalog.class); ExcelUtil<DaCatalog> util = new ExcelUtil<DaCatalog>(DaCatalog.class);
util.exportExcel(response, list, "档案目录数据"); util.exportExcel(response, list, "档案目录数据");
}*/
/**
* id()
*/
@PreAuthorize("@ss.hasPermi('dangan:catalog:export')")
@Log(title = "档案目录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DaCatalog daCatalog)
{
List<DaCatalog> list = daCatalogService.exportDaCatalogList(daCatalog, getLoginUser());
ExcelUtil<DaCatalog> util = new ExcelUtil<DaCatalog>(DaCatalog.class);
util.exportExcel(response, list, "档案目录数据");
} }
/** /**

@ -70,4 +70,8 @@ public interface DaCatalogMapper
List<Long> selectContainIdsById(String id); List<Long> selectContainIdsById(String id);
Integer selectNumByPid(Long id); Integer selectNumByPid(Long id);
List<DaCatalog> exportDaCatalogList(DaCatalog daCatalog);
List<DaCatalog> exportDaCatalogListByUserId(DaCatalog daCatalog);
} }

@ -88,4 +88,6 @@ public interface IDaCatalogService
public List<DaCatalog> selectDaCatalogListAndcount(DaCatalog daCatalog, LoginUser user); public List<DaCatalog> selectDaCatalogListAndcount(DaCatalog daCatalog, LoginUser user);
Integer selectNumByPid(Long id); Integer selectNumByPid(Long id);
List<DaCatalog> exportDaCatalogList( DaCatalog daCatalog, LoginUser loginUser);
} }

@ -254,6 +254,21 @@ public class DaCatalogServiceImpl implements IDaCatalogService {
return daCatalogMapper.selectNumByPid(id); return daCatalogMapper.selectNumByPid(id);
} }
@Override
public List<DaCatalog> exportDaCatalogList( DaCatalog daCatalog, LoginUser loginUser) {
// 超管及角色为管理员显示所有目录信息
List<DaCatalog> catalogList;
if (SysUser.isAdmin(loginUser.getUserId()) ||
loginUser.getUser().getRoles().stream().anyMatch(sysRole -> sysRole.getRoleKey().equals("sysAdmin"))) {
catalogList = daCatalogMapper.exportDaCatalogList(daCatalog);
} else { //根据用户权限显示目录信息
daCatalog.getParams().put("userId", loginUser.getUserId());
catalogList = daCatalogMapper.exportDaCatalogListByUserId(daCatalog);
}
return catalogList;
}
/** /**
* *
* *

@ -126,6 +126,26 @@
) )
</select> </select>
<!--根据父id导出目录-->
<select id="exportDaCatalogList" resultMap="DaCatalogResult">
<include refid="selectDaCatalogVo"/>
<where>
<if test="id != null ">and pid = #{id}</if>
</where>
order by pid asc, order_num desc
</select>
<!--根据父id、userId导出目录-->
<select id="exportDaCatalogListByUserId" resultMap="DaCatalogResult">
select distinct c.* from da_catalog c
left join da_user_catalog uc on c.id = uc.mu_id
<where>
uc.user_id = #{params.userId}
<if test="id != null ">and pid = #{id}</if>
</where>
order by pid asc, order_num desc
</select>
<insert id="insertDaCatalog" parameterType="DaCatalog" useGeneratedKeys="true" keyProperty="id"> <insert id="insertDaCatalog" parameterType="DaCatalog" useGeneratedKeys="true" keyProperty="id">
insert into da_catalog insert into da_catalog
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">

Loading…
Cancel
Save