|
@@ -1,9 +1,20 @@
|
|
|
package com.usky.dxtop.controller.web;
|
|
|
|
|
|
|
|
|
+import com.usky.dxtop.common.constant.UserConstants;
|
|
|
+import com.usky.dxtop.common.core.domain.AjaxResult;
|
|
|
+import com.usky.dxtop.common.core.page.TableDataInfo;
|
|
|
+import com.usky.dxtop.common.utils.SecurityUtils;
|
|
|
+import com.usky.dxtop.controller.BaseController;
|
|
|
+import com.usky.dxtop.model.TopChannel;
|
|
|
+import com.usky.dxtop.model.TopRadio;
|
|
|
+import com.usky.dxtop.service.TopChannelService;
|
|
|
+import com.usky.dxtop.service.TopRadioService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -15,7 +26,48 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
*/
|
|
|
@RestController
|
|
|
@RequestMapping("/dxtop/topChannel")
|
|
|
-public class TopChannelController {
|
|
|
+public class TopChannelController extends BaseController {
|
|
|
+
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TopChannelService topChannelService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增
|
|
|
+ * @param topChannel
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping
|
|
|
+ public AjaxResult add(@RequestBody TopChannel topChannel){
|
|
|
+ if (UserConstants.NOT_UNIQUE.equals(topChannelService.checkNameUnique(topChannel)))
|
|
|
+ {
|
|
|
+ return AjaxResult.error("新增渠道信息'" + topChannel.getName() + "'失败,渠道信息已存在");
|
|
|
+ }
|
|
|
+ topChannel.setCreateBy(SecurityUtils.getUsername());
|
|
|
+ return toAjax(topChannelService.save(topChannel));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改
|
|
|
+ */
|
|
|
+ @PutMapping
|
|
|
+ public AjaxResult edit(@RequestBody TopChannel topChannel)
|
|
|
+ {
|
|
|
+ if (UserConstants.NOT_UNIQUE.equals(topChannelService.checkNameUnique(topChannel)))
|
|
|
+ {
|
|
|
+ return AjaxResult.error("修改渠道信息'" + topChannel.getName() + "'失败,渠道信息已存在");
|
|
|
+ }
|
|
|
+ topChannel.setUpdateBy(SecurityUtils.getUsername());
|
|
|
+ return toAjax(topChannelService.updateById(topChannel));
|
|
|
+ }
|
|
|
|
|
|
+ @GetMapping("/list")
|
|
|
+ public TableDataInfo list(TopChannel topChannel)
|
|
|
+ {
|
|
|
+ startPage();
|
|
|
+ List<TopChannel> list = topChannelService.list(topChannel);
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
}
|
|
|
|