| | |
| | | |
| | | 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; |
| | |
| | | @Api("任务执行规则") |
| | | @RestController |
| | | @RequestMapping("/smartor/taskrule") |
| | | public class ServiceTaskRuleController extends BaseController |
| | | { |
| | | public class ServiceTaskRuleController extends BaseController { |
| | | @Autowired |
| | | private IServiceTaskRuleService serviceTaskRuleService; |
| | | |
| | |
| | | //@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); |
| | | } |
| | | |
| | | /** |
| | |
| | | //@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, "任务执行规则数据"); |
| | |
| | | @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)); |
| | | } |
| | | |
| | |
| | | @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)); |
| | | } |
| | | |
| | |
| | | @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)); |
| | | } |
| | | |
| | |
| | | @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(); |
| | | } |
| | | } |