chore[litemall-admin-api]: 微调代码
This commit is contained in:
@@ -66,8 +66,8 @@ public class AdminAdController {
|
||||
@RequiresPermissionsDesc(menu={"推广管理" , "广告管理"}, button="详情")
|
||||
@GetMapping("/read")
|
||||
public Object read(@NotNull Integer id) {
|
||||
LitemallAd brand = adService.findById(id);
|
||||
return ResponseUtil.ok(brand);
|
||||
LitemallAd ad = adService.findById(id);
|
||||
return ResponseUtil.ok(ad);
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:ad:update")
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package org.linlinjava.litemall.admin.web;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
@@ -47,9 +46,8 @@ public class AdminGrouponController {
|
||||
@Sort @RequestParam(defaultValue = "add_time") String sort,
|
||||
@Order @RequestParam(defaultValue = "desc") String order) {
|
||||
List<LitemallGroupon> grouponList = grouponService.querySelective(grouponId, page, limit, sort, order);
|
||||
long total = PageInfo.of(grouponList).getTotal();
|
||||
|
||||
List<Map<String, Object>> records = new ArrayList<>();
|
||||
List<Map<String, Object>> groupons = new ArrayList<>();
|
||||
for (LitemallGroupon groupon : grouponList) {
|
||||
try {
|
||||
Map<String, Object> RecordData = new HashMap<>();
|
||||
@@ -62,17 +60,13 @@ public class AdminGrouponController {
|
||||
RecordData.put("rules", rules);
|
||||
RecordData.put("goods", goods);
|
||||
|
||||
records.add(RecordData);
|
||||
groupons.add(RecordData);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("total", total);
|
||||
data.put("list", records);
|
||||
|
||||
return ResponseUtil.ok(data);
|
||||
return ResponseUtil.okList(groupons, grouponList);
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:groupon:list")
|
||||
|
||||
@@ -49,13 +49,13 @@ public class AdminKeywordController {
|
||||
@RequiresPermissions("admin:keyword:create")
|
||||
@RequiresPermissionsDesc(menu={"商场管理" , "关键词"}, button="添加")
|
||||
@PostMapping("/create")
|
||||
public Object create(@RequestBody LitemallKeyword keywords) {
|
||||
Object error = validate(keywords);
|
||||
public Object create(@RequestBody LitemallKeyword keyword) {
|
||||
Object error = validate(keyword);
|
||||
if (error != null) {
|
||||
return error;
|
||||
}
|
||||
keywordService.add(keywords);
|
||||
return ResponseUtil.ok(keywords);
|
||||
keywordService.add(keyword);
|
||||
return ResponseUtil.ok(keyword);
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:keyword:read")
|
||||
@@ -69,15 +69,15 @@ public class AdminKeywordController {
|
||||
@RequiresPermissions("admin:keyword:update")
|
||||
@RequiresPermissionsDesc(menu={"商场管理" , "关键词"}, button="编辑")
|
||||
@PostMapping("/update")
|
||||
public Object update(@RequestBody LitemallKeyword keywords) {
|
||||
Object error = validate(keywords);
|
||||
public Object update(@RequestBody LitemallKeyword keyword) {
|
||||
Object error = validate(keyword);
|
||||
if (error != null) {
|
||||
return error;
|
||||
}
|
||||
if (keywordService.updateById(keywords) == 0) {
|
||||
if (keywordService.updateById(keyword) == 0) {
|
||||
return ResponseUtil.updatedDataFailed();
|
||||
}
|
||||
return ResponseUtil.ok(keywords);
|
||||
return ResponseUtil.ok(keyword);
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:keyword:delete")
|
||||
|
||||
Reference in New Issue
Block a user