liusheng
13 小时以前 4d09f74ed6873cd8603997be2925af2b8226a476
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceTaskRuleController.java
@@ -2,10 +2,15 @@
import java.util.List;
import com.github.pagehelper.ISelect;
import com.ruoyi.common.annotation.AddOrgId;
import com.ruoyi.common.utils.PageUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@@ -34,8 +39,7 @@
@Api("任务执行规则")
@RestController
@RequestMapping("/smartor/taskrule")
public class ServiceTaskRuleController extends BaseController
{
public class ServiceTaskRuleController extends BaseController {
    @Autowired
    private IServiceTaskRuleService serviceTaskRuleService;
@@ -46,11 +50,24 @@
    //@PreAuthorize("@ss.hasPermi('smartor:rule:list')")
    @AddOrgId(field = "orgid", paramIndex = 0, campusField = "campusid")
    @PostMapping("/list")
    public TableDataInfo list(@RequestBody ServiceTaskRule serviceTaskRule)
    {
        startPage();
    public TableDataInfo list(@RequestBody ServiceTaskRule serviceTaskRule) {
        PageUtils.startPageByPost(serviceTaskRule.getPageNum(), serviceTaskRule.getPageSize());
        List<ServiceTaskRule> list = serviceTaskRuleService.selectServiceTaskRuleList(serviceTaskRule);
        return getDataTable(list);
        if (CollectionUtils.isNotEmpty(list)) {
            //获取total
            long total = PageUtils.count(new ISelect() {
                @Override
                public void doSelect() {
                    serviceTaskRule.setPageNum(null);
                    serviceTaskRule.setPageSize(null);
                    serviceTaskRuleService.selectServiceTaskRuleList(serviceTaskRule);
                }
            });
            return getDataTable2(total, list);
        }
        return getDataTable2(0, list);
    }
    /**
@@ -60,8 +77,7 @@
    //@PreAuthorize("@ss.hasPermi('smartor:rule:export')")
    @Log(title = "任务执行规则", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ServiceTaskRule serviceTaskRule)
    {
    public void export(HttpServletResponse response, ServiceTaskRule serviceTaskRule) {
        List<ServiceTaskRule> list = serviceTaskRuleService.selectServiceTaskRuleList(serviceTaskRule);
        ExcelUtil<ServiceTaskRule> util = new ExcelUtil<ServiceTaskRule>(ServiceTaskRule.class);
        util.exportExcel(response, list, "任务执行规则数据");
@@ -73,8 +89,7 @@
    @ApiOperation("获取任务执行规则详细信息")
    //@PreAuthorize("@ss.hasPermi('smartor:rule:query')")
    @GetMapping(value = "/getInfo/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return success(serviceTaskRuleService.selectServiceTaskRuleById(id));
    }
@@ -86,8 +101,7 @@
    @Log(title = "任务执行规则", businessType = BusinessType.INSERT)
    @AddOrgId(field = "orgid", paramIndex = 0, campusField = "campusid")
    @PostMapping("/add")
    public AjaxResult add(@RequestBody ServiceTaskRule serviceTaskRule)
    {
    public AjaxResult add(@RequestBody ServiceTaskRule serviceTaskRule) {
        return toAjax(serviceTaskRuleService.insertServiceTaskRule(serviceTaskRule));
    }
@@ -99,8 +113,7 @@
    @Log(title = "任务执行规则", businessType = BusinessType.UPDATE)
    @AddOrgId(field = "orgid", paramIndex = 0, campusField = "campusid")
    @PostMapping("/edit")
    public AjaxResult edit(@RequestBody ServiceTaskRule serviceTaskRule)
    {
    public AjaxResult edit(@RequestBody ServiceTaskRule serviceTaskRule) {
        return toAjax(serviceTaskRuleService.updateServiceTaskRule(serviceTaskRule));
    }
@@ -110,9 +123,12 @@
    @ApiOperation("删除任务执行规则")
    //@PreAuthorize("@ss.hasPermi('smartor:rule:remove')")
    @Log(title = "任务执行规则", businessType = BusinessType.DELETE)
   @GetMapping("/remove/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(serviceTaskRuleService.deleteServiceTaskRuleByIds(ids));
    @GetMapping("/remove/{id}")
    public AjaxResult remove(@PathVariable Long id) {
        if (id != null) {
            Long[] ids = new Long[]{id};
            return toAjax(serviceTaskRuleService.deleteServiceTaskRuleByIds(ids));
        }
        return error();
    }
}