|
@@ -5,6 +5,8 @@ import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
import com.ruoyi.common.annotation.Anonymous;
|
|
import com.ruoyi.common.annotation.Anonymous;
|
|
import com.ruoyi.system.entity.DragTableBtn;
|
|
import com.ruoyi.system.entity.DragTableBtn;
|
|
|
|
+import com.ruoyi.system.entity.DragTableBtnRelevance;
|
|
|
|
+import com.ruoyi.system.service.IDragTableBtnRelevanceService;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
@@ -25,24 +27,25 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 格绑定的自定义按钮Controller
|
|
* 格绑定的自定义按钮Controller
|
|
- *
|
|
|
|
|
|
+ *
|
|
* @author ruoyi
|
|
* @author ruoyi
|
|
* @date 2023-11-07
|
|
* @date 2023-11-07
|
|
*/
|
|
*/
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping("/system/btn")
|
|
@RequestMapping("/system/btn")
|
|
-public class DragTableBtnController extends BaseController
|
|
|
|
-{
|
|
|
|
- @Autowired
|
|
|
|
|
|
+public class DragTableBtnController extends BaseController {
|
|
|
|
+ @Autowired // 按钮组
|
|
private IDragTableBtnService dragTableBtnService;
|
|
private IDragTableBtnService dragTableBtnService;
|
|
|
|
|
|
|
|
+ @Autowired // 按钮表单关联
|
|
|
|
+ private IDragTableBtnRelevanceService dragTableBtnRelevanceService;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 查询格绑定的自定义按钮列表
|
|
* 查询格绑定的自定义按钮列表
|
|
*/
|
|
*/
|
|
@PreAuthorize("@ss.hasPermi('system:btn:list')")
|
|
@PreAuthorize("@ss.hasPermi('system:btn:list')")
|
|
@GetMapping("/list")
|
|
@GetMapping("/list")
|
|
- public TableDataInfo list(DragTableBtn dragTableBtn)
|
|
|
|
- {
|
|
|
|
|
|
+ public TableDataInfo list(DragTableBtn dragTableBtn) {
|
|
startPage();
|
|
startPage();
|
|
List<DragTableBtn> list = dragTableBtnService.selectDragTableBtnList(dragTableBtn);
|
|
List<DragTableBtn> list = dragTableBtnService.selectDragTableBtnList(dragTableBtn);
|
|
return getDataTable(list);
|
|
return getDataTable(list);
|
|
@@ -54,8 +57,7 @@ public class DragTableBtnController extends BaseController
|
|
@PreAuthorize("@ss.hasPermi('system:btn:export')")
|
|
@PreAuthorize("@ss.hasPermi('system:btn:export')")
|
|
@Log(title = "格绑定的自定义按钮", businessType = BusinessType.EXPORT)
|
|
@Log(title = "格绑定的自定义按钮", businessType = BusinessType.EXPORT)
|
|
@PostMapping("/export")
|
|
@PostMapping("/export")
|
|
- public void export(HttpServletResponse response, DragTableBtn dragTableBtn)
|
|
|
|
- {
|
|
|
|
|
|
+ public void export(HttpServletResponse response, DragTableBtn dragTableBtn) {
|
|
List<DragTableBtn> list = dragTableBtnService.selectDragTableBtnList(dragTableBtn);
|
|
List<DragTableBtn> list = dragTableBtnService.selectDragTableBtnList(dragTableBtn);
|
|
ExcelUtil<DragTableBtn> util = new ExcelUtil<DragTableBtn>(DragTableBtn.class);
|
|
ExcelUtil<DragTableBtn> util = new ExcelUtil<DragTableBtn>(DragTableBtn.class);
|
|
util.exportExcel(response, list, "格绑定的自定义按钮数据");
|
|
util.exportExcel(response, list, "格绑定的自定义按钮数据");
|
|
@@ -66,8 +68,7 @@ public class DragTableBtnController extends BaseController
|
|
*/
|
|
*/
|
|
@PreAuthorize("@ss.hasPermi('system:btn:query')")
|
|
@PreAuthorize("@ss.hasPermi('system:btn:query')")
|
|
@GetMapping(value = "/{id}")
|
|
@GetMapping(value = "/{id}")
|
|
- public AjaxResult getInfo(@PathVariable("id") Long id)
|
|
|
|
- {
|
|
|
|
|
|
+ public AjaxResult getInfo(@PathVariable("id") Long id) {
|
|
return success(dragTableBtnService.selectDragTableBtnById(id));
|
|
return success(dragTableBtnService.selectDragTableBtnById(id));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -77,8 +78,7 @@ public class DragTableBtnController extends BaseController
|
|
@PreAuthorize("@ss.hasPermi('system:btn:add')")
|
|
@PreAuthorize("@ss.hasPermi('system:btn:add')")
|
|
@Log(title = "格绑定的自定义按钮", businessType = BusinessType.INSERT)
|
|
@Log(title = "格绑定的自定义按钮", businessType = BusinessType.INSERT)
|
|
@PostMapping
|
|
@PostMapping
|
|
- public AjaxResult add(@RequestBody DragTableBtn dragTableBtn)
|
|
|
|
- {
|
|
|
|
|
|
+ public AjaxResult add(@RequestBody DragTableBtn dragTableBtn) {
|
|
dragTableBtnService.insertDragTableBtn(dragTableBtn);
|
|
dragTableBtnService.insertDragTableBtn(dragTableBtn);
|
|
return AjaxResult.success();
|
|
return AjaxResult.success();
|
|
}
|
|
}
|
|
@@ -89,8 +89,7 @@ public class DragTableBtnController extends BaseController
|
|
@PreAuthorize("@ss.hasPermi('system:btn:edit')")
|
|
@PreAuthorize("@ss.hasPermi('system:btn:edit')")
|
|
@Log(title = "格绑定的自定义按钮", businessType = BusinessType.UPDATE)
|
|
@Log(title = "格绑定的自定义按钮", businessType = BusinessType.UPDATE)
|
|
@PutMapping
|
|
@PutMapping
|
|
- public AjaxResult edit(@RequestBody DragTableBtn dragTableBtn)
|
|
|
|
- {
|
|
|
|
|
|
+ public AjaxResult edit(@RequestBody DragTableBtn dragTableBtn) {
|
|
return toAjax(dragTableBtnService.updateDragTableBtn(dragTableBtn));
|
|
return toAjax(dragTableBtnService.updateDragTableBtn(dragTableBtn));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -99,12 +98,22 @@ public class DragTableBtnController extends BaseController
|
|
*/
|
|
*/
|
|
@PreAuthorize("@ss.hasPermi('system:btn:remove')")
|
|
@PreAuthorize("@ss.hasPermi('system:btn:remove')")
|
|
@Log(title = "格绑定的自定义按钮", businessType = BusinessType.DELETE)
|
|
@Log(title = "格绑定的自定义按钮", businessType = BusinessType.DELETE)
|
|
- @DeleteMapping("/{id}")
|
|
|
|
- public AjaxResult remove(@PathVariable Long id)
|
|
|
|
- {
|
|
|
|
|
|
+ @DeleteMapping("/{id}")
|
|
|
|
+ public AjaxResult remove(@PathVariable Long id) {
|
|
if (dragTableBtnService.hasChildByBtnId(id)) {
|
|
if (dragTableBtnService.hasChildByBtnId(id)) {
|
|
return warn("存在子按钮,不允许删除");
|
|
return warn("存在子按钮,不允许删除");
|
|
}
|
|
}
|
|
return toAjax(dragTableBtnService.deleteDragTableBtnById(id));
|
|
return toAjax(dragTableBtnService.deleteDragTableBtnById(id));
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 根据当前按钮组的btnkey得到绑定的表格
|
|
|
|
+ *
|
|
|
|
+ * @param btnKey 按钮唯一标识
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @GetMapping("/checkBtn")
|
|
|
|
+ public TableDataInfo checkBtn(String btnKey) {
|
|
|
|
+ return getDataTable(dragTableBtnRelevanceService.selectDragTableBtnRelevanceList(new DragTableBtnRelevance(btnKey)));
|
|
|
|
+ }
|
|
}
|
|
}
|