Browse Source

bug修复:#13620 角色管理-勾选行导出时,不是只导出勾选行,而是默认导出全部角色列表问题

ZL 2 days ago
parent
commit
2733c38ced

+ 5 - 0
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysRoleController.java

@@ -478,6 +478,11 @@ public class SysRoleController {
 		// Step.1 组装查询条件
 //		QueryWrapper<SysRole> queryWrapper = QueryGenerator.initQueryWrapper(sysRole, request.getParameterMap());
 		String ids = request.getParameter("ids");
+		if (ids.length() > 2) {
+			ids = ids.substring(1, ids.length() - 1);
+		} else {
+			ids = null;
+		}
 		//Step.2 AutoPoi 导出Excel
 		ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
 		List<SysRole> pageList = sysRoleService.listExport(sysRole,ids);

+ 1 - 1
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/SysRoleMapper.xml

@@ -58,7 +58,7 @@
         app_base_info sa ON r.app_id = sa.id
         WHERE 1=1
           <if test="ids!=null">
-            AND r.id in (#{ids})
+            AND r.id in (${ids})
         </if>
         <if test="role.appId!=null">
             AND r.app_id = #{role.appId}

+ 1 - 1
jeecgboot-vue3/src/views/system/role/index.vue

@@ -114,7 +114,7 @@ const { prefixCls, tableContext, onImportXls, onExportXls } = useListPage({
   exportConfig: {
     name: '角色列表',
     url: ()=>{
-      const ids = encodeURIComponent(JSON.stringify(selectedRowKeys))
+      const ids = encodeURIComponent(JSON.stringify(selectedRowKeys.value))
       return `${getExportUrl}?ids=${ids}`;
     },
   },