Commit 618a8b98 authored by Junling Bu's avatar Junling Bu
Browse files

chore[litemall-admin-api]: 简化代码

parent 78a062e2
package org.linlinjava.litemall.admin.annotation.support; package org.linlinjava.litemall.admin.annotation.support;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.subject.Subject; import org.apache.shiro.subject.Subject;
import org.linlinjava.litemall.admin.annotation.LoginAdmin; import org.linlinjava.litemall.admin.annotation.LoginAdmin;
import org.linlinjava.litemall.db.domain.LitemallAdmin; import org.linlinjava.litemall.db.domain.LitemallAdmin;
...@@ -23,6 +24,9 @@ public class LoginAdminHandlerMethodArgumentResolver implements HandlerMethodArg ...@@ -23,6 +24,9 @@ public class LoginAdminHandlerMethodArgumentResolver implements HandlerMethodArg
NativeWebRequest request, WebDataBinderFactory factory) throws Exception { NativeWebRequest request, WebDataBinderFactory factory) throws Exception {
Subject currentUser = SecurityUtils.getSubject(); Subject currentUser = SecurityUtils.getSubject();
LitemallAdmin admin = (LitemallAdmin) currentUser.getPrincipal(); LitemallAdmin admin = (LitemallAdmin) currentUser.getPrincipal();
if (admin == null) {
throw new AuthenticationException();
}
return admin.getId(); return admin.getId();
} }
......
...@@ -34,10 +34,6 @@ public class AdminAdController { ...@@ -34,10 +34,6 @@ public class AdminAdController {
@RequestParam(defaultValue = "10") Integer limit, @RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort, @Sort @RequestParam(defaultValue = "add_time") String sort,
@Order @RequestParam(defaultValue = "desc") String order) { @Order @RequestParam(defaultValue = "desc") String order) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
List<LitemallAd> adList = adService.querySelective(name, content, page, limit, sort, order); List<LitemallAd> adList = adService.querySelective(name, content, page, limit, sort, order);
int total = adService.countSelective(name, content, page, limit, sort, order); int total = adService.countSelective(name, content, page, limit, sort, order);
Map<String, Object> data = new HashMap<>(); Map<String, Object> data = new HashMap<>();
...@@ -61,9 +57,6 @@ public class AdminAdController { ...@@ -61,9 +57,6 @@ public class AdminAdController {
@PostMapping("/create") @PostMapping("/create")
public Object create(@LoginAdmin Integer adminId, @RequestBody LitemallAd ad) { public Object create(@LoginAdmin Integer adminId, @RequestBody LitemallAd ad) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
Object error = validate(ad); Object error = validate(ad);
if (error != null) { if (error != null) {
return error; return error;
...@@ -74,19 +67,12 @@ public class AdminAdController { ...@@ -74,19 +67,12 @@ public class AdminAdController {
@GetMapping("/read") @GetMapping("/read")
public Object read(@LoginAdmin Integer adminId, @NotNull Integer id) { public Object read(@LoginAdmin Integer adminId, @NotNull Integer id) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
LitemallAd brand = adService.findById(id); LitemallAd brand = adService.findById(id);
return ResponseUtil.ok(brand); return ResponseUtil.ok(brand);
} }
@PostMapping("/update") @PostMapping("/update")
public Object update(@LoginAdmin Integer adminId, @RequestBody LitemallAd ad) { public Object update(@LoginAdmin Integer adminId, @RequestBody LitemallAd ad) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
Object error = validate(ad); Object error = validate(ad);
if (error != null) { if (error != null) {
return error; return error;
...@@ -100,9 +86,6 @@ public class AdminAdController { ...@@ -100,9 +86,6 @@ public class AdminAdController {
@PostMapping("/delete") @PostMapping("/delete")
public Object delete(@LoginAdmin Integer adminId, @RequestBody LitemallAd ad) { public Object delete(@LoginAdmin Integer adminId, @RequestBody LitemallAd ad) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
Integer id = ad.getId(); Integer id = ad.getId();
if (id == null) { if (id == null) {
return ResponseUtil.badArgument(); return ResponseUtil.badArgument();
......
...@@ -59,9 +59,6 @@ public class AdminAddressController { ...@@ -59,9 +59,6 @@ public class AdminAddressController {
@RequestParam(defaultValue = "10") Integer limit, @RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort, @Sort @RequestParam(defaultValue = "add_time") String sort,
@Order @RequestParam(defaultValue = "desc") String order) { @Order @RequestParam(defaultValue = "desc") String order) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
List<LitemallAddress> addressList = addressService.querySelective(userId, name, page, limit, sort, order); List<LitemallAddress> addressList = addressService.querySelective(userId, name, page, limit, sort, order);
int total = addressService.countSelective(userId, name, page, limit, sort, order); int total = addressService.countSelective(userId, name, page, limit, sort, order);
......
...@@ -39,10 +39,6 @@ public class AdminAdminController { ...@@ -39,10 +39,6 @@ public class AdminAdminController {
@RequestParam(defaultValue = "10") Integer limit, @RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort, @Sort @RequestParam(defaultValue = "add_time") String sort,
@Order @RequestParam(defaultValue = "desc") String order) { @Order @RequestParam(defaultValue = "desc") String order) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
List<LitemallAdmin> adminList = adminService.querySelective(username, page, limit, sort, order); List<LitemallAdmin> adminList = adminService.querySelective(username, page, limit, sort, order);
int total = adminService.countSelective(username, page, limit, sort, order); int total = adminService.countSelective(username, page, limit, sort, order);
Map<String, Object> data = new HashMap<>(); Map<String, Object> data = new HashMap<>();
...@@ -69,9 +65,6 @@ public class AdminAdminController { ...@@ -69,9 +65,6 @@ public class AdminAdminController {
@PostMapping("/create") @PostMapping("/create")
public Object create(@LoginAdmin Integer adminId, @RequestBody LitemallAdmin admin) { public Object create(@LoginAdmin Integer adminId, @RequestBody LitemallAdmin admin) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
Object error = validate(admin); Object error = validate(admin);
if (error != null) { if (error != null) {
return error; return error;
...@@ -93,19 +86,12 @@ public class AdminAdminController { ...@@ -93,19 +86,12 @@ public class AdminAdminController {
@GetMapping("/read") @GetMapping("/read")
public Object read(@LoginAdmin Integer adminId, @NotNull Integer id) { public Object read(@LoginAdmin Integer adminId, @NotNull Integer id) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
LitemallAdmin admin = adminService.findById(id); LitemallAdmin admin = adminService.findById(id);
return ResponseUtil.ok(admin); return ResponseUtil.ok(admin);
} }
@PostMapping("/update") @PostMapping("/update")
public Object update(@LoginAdmin Integer adminId, @RequestBody LitemallAdmin admin) { public Object update(@LoginAdmin Integer adminId, @RequestBody LitemallAdmin admin) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
Object error = validate(admin); Object error = validate(admin);
if (error != null) { if (error != null) {
return error; return error;
...@@ -130,10 +116,6 @@ public class AdminAdminController { ...@@ -130,10 +116,6 @@ public class AdminAdminController {
@PostMapping("/delete") @PostMapping("/delete")
public Object delete(@LoginAdmin Integer adminId, @RequestBody LitemallAdmin admin) { public Object delete(@LoginAdmin Integer adminId, @RequestBody LitemallAdmin admin) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
Integer anotherAdminId = admin.getId(); Integer anotherAdminId = admin.getId();
if (anotherAdminId == null) { if (anotherAdminId == null) {
return ResponseUtil.badArgument(); return ResponseUtil.badArgument();
......
...@@ -62,10 +62,6 @@ public class AdminAuthController { ...@@ -62,10 +62,6 @@ public class AdminAuthController {
*/ */
@PostMapping("/logout") @PostMapping("/logout")
public Object login(@LoginAdmin Integer adminId) { public Object login(@LoginAdmin Integer adminId) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
Subject currentUser = SecurityUtils.getSubject(); Subject currentUser = SecurityUtils.getSubject();
currentUser.logout(); currentUser.logout();
return ResponseUtil.ok(); return ResponseUtil.ok();
......
...@@ -35,10 +35,6 @@ public class AdminBrandController { ...@@ -35,10 +35,6 @@ public class AdminBrandController {
@RequestParam(defaultValue = "10") Integer limit, @RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort, @Sort @RequestParam(defaultValue = "add_time") String sort,
@Order @RequestParam(defaultValue = "desc") String order) { @Order @RequestParam(defaultValue = "desc") String order) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
List<LitemallBrand> brandList = brandService.querySelective(id, name, page, limit, sort, order); List<LitemallBrand> brandList = brandService.querySelective(id, name, page, limit, sort, order);
int total = brandService.countSelective(id, name, page, limit, sort, order); int total = brandService.countSelective(id, name, page, limit, sort, order);
Map<String, Object> data = new HashMap<>(); Map<String, Object> data = new HashMap<>();
...@@ -68,9 +64,6 @@ public class AdminBrandController { ...@@ -68,9 +64,6 @@ public class AdminBrandController {
@PostMapping("/create") @PostMapping("/create")
public Object create(@LoginAdmin Integer adminId, @RequestBody LitemallBrand brand) { public Object create(@LoginAdmin Integer adminId, @RequestBody LitemallBrand brand) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
Object error = validate(brand); Object error = validate(brand);
if (error != null) { if (error != null) {
return error; return error;
...@@ -81,19 +74,12 @@ public class AdminBrandController { ...@@ -81,19 +74,12 @@ public class AdminBrandController {
@GetMapping("/read") @GetMapping("/read")
public Object read(@LoginAdmin Integer adminId, @NotNull Integer id) { public Object read(@LoginAdmin Integer adminId, @NotNull Integer id) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
LitemallBrand brand = brandService.findById(id); LitemallBrand brand = brandService.findById(id);
return ResponseUtil.ok(brand); return ResponseUtil.ok(brand);
} }
@PostMapping("/update") @PostMapping("/update")
public Object update(@LoginAdmin Integer adminId, @RequestBody LitemallBrand brand) { public Object update(@LoginAdmin Integer adminId, @RequestBody LitemallBrand brand) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
Object error = validate(brand); Object error = validate(brand);
if (error != null) { if (error != null) {
return error; return error;
...@@ -106,9 +92,6 @@ public class AdminBrandController { ...@@ -106,9 +92,6 @@ public class AdminBrandController {
@PostMapping("/delete") @PostMapping("/delete")
public Object delete(@LoginAdmin Integer adminId, @RequestBody LitemallBrand brand) { public Object delete(@LoginAdmin Integer adminId, @RequestBody LitemallBrand brand) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
Integer id = brand.getId(); Integer id = brand.getId();
if (id == null) { if (id == null) {
return ResponseUtil.badArgument(); return ResponseUtil.badArgument();
......
...@@ -35,10 +35,6 @@ public class AdminCategoryController { ...@@ -35,10 +35,6 @@ public class AdminCategoryController {
@RequestParam(defaultValue = "10") Integer limit, @RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort, @Sort @RequestParam(defaultValue = "add_time") String sort,
@Order @RequestParam(defaultValue = "desc") String order) { @Order @RequestParam(defaultValue = "desc") String order) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
List<LitemallCategory> collectList = categoryService.querySelective(id, name, page, limit, sort, order); List<LitemallCategory> collectList = categoryService.querySelective(id, name, page, limit, sort, order);
int total = categoryService.countSelective(id, name, page, limit, sort, order); int total = categoryService.countSelective(id, name, page, limit, sort, order);
Map<String, Object> data = new HashMap<>(); Map<String, Object> data = new HashMap<>();
...@@ -72,9 +68,6 @@ public class AdminCategoryController { ...@@ -72,9 +68,6 @@ public class AdminCategoryController {
@PostMapping("/create") @PostMapping("/create")
public Object create(@LoginAdmin Integer adminId, @RequestBody LitemallCategory category) { public Object create(@LoginAdmin Integer adminId, @RequestBody LitemallCategory category) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
Object error = validate(category); Object error = validate(category);
if (error != null) { if (error != null) {
return error; return error;
...@@ -85,19 +78,12 @@ public class AdminCategoryController { ...@@ -85,19 +78,12 @@ public class AdminCategoryController {
@GetMapping("/read") @GetMapping("/read")
public Object read(@LoginAdmin Integer adminId, @NotNull Integer id) { public Object read(@LoginAdmin Integer adminId, @NotNull Integer id) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
LitemallCategory category = categoryService.findById(id); LitemallCategory category = categoryService.findById(id);
return ResponseUtil.ok(category); return ResponseUtil.ok(category);
} }
@PostMapping("/update") @PostMapping("/update")
public Object update(@LoginAdmin Integer adminId, @RequestBody LitemallCategory category) { public Object update(@LoginAdmin Integer adminId, @RequestBody LitemallCategory category) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
Object error = validate(category); Object error = validate(category);
if (error != null) { if (error != null) {
return error; return error;
...@@ -111,9 +97,6 @@ public class AdminCategoryController { ...@@ -111,9 +97,6 @@ public class AdminCategoryController {
@PostMapping("/delete") @PostMapping("/delete")
public Object delete(@LoginAdmin Integer adminId, @RequestBody LitemallCategory category) { public Object delete(@LoginAdmin Integer adminId, @RequestBody LitemallCategory category) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
Integer id = category.getId(); Integer id = category.getId();
if (id == null) { if (id == null) {
return ResponseUtil.badArgument(); return ResponseUtil.badArgument();
...@@ -124,10 +107,6 @@ public class AdminCategoryController { ...@@ -124,10 +107,6 @@ public class AdminCategoryController {
@GetMapping("/l1") @GetMapping("/l1")
public Object catL1(@LoginAdmin Integer adminId) { public Object catL1(@LoginAdmin Integer adminId) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
// 所有一级分类目录 // 所有一级分类目录
List<LitemallCategory> l1CatList = categoryService.queryL1(); List<LitemallCategory> l1CatList = categoryService.queryL1();
List<Map<String, Object>> data = new ArrayList<>(l1CatList.size()); List<Map<String, Object>> data = new ArrayList<>(l1CatList.size());
......
...@@ -35,10 +35,6 @@ public class AdminCollectController { ...@@ -35,10 +35,6 @@ public class AdminCollectController {
@RequestParam(defaultValue = "10") Integer limit, @RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort, @Sort @RequestParam(defaultValue = "add_time") String sort,
@Order @RequestParam(defaultValue = "desc") String order) { @Order @RequestParam(defaultValue = "desc") String order) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
List<LitemallCollect> collectList = collectService.querySelective(userId, valueId, page, limit, sort, order); List<LitemallCollect> collectList = collectService.querySelective(userId, valueId, page, limit, sort, order);
int total = collectService.countSelective(userId, valueId, page, limit, sort, order); int total = collectService.countSelective(userId, valueId, page, limit, sort, order);
Map<String, Object> data = new HashMap<>(); Map<String, Object> data = new HashMap<>();
......
...@@ -32,10 +32,6 @@ public class AdminCommentController { ...@@ -32,10 +32,6 @@ public class AdminCommentController {
@RequestParam(defaultValue = "10") Integer limit, @RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort, @Sort @RequestParam(defaultValue = "add_time") String sort,
@Order @RequestParam(defaultValue = "desc") String order) { @Order @RequestParam(defaultValue = "desc") String order) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
List<LitemallComment> brandList = commentService.querySelective(userId, valueId, page, limit, sort, order); List<LitemallComment> brandList = commentService.querySelective(userId, valueId, page, limit, sort, order);
int total = commentService.countSelective(userId, valueId, page, limit, sort, order); int total = commentService.countSelective(userId, valueId, page, limit, sort, order);
Map<String, Object> data = new HashMap<>(); Map<String, Object> data = new HashMap<>();
...@@ -47,9 +43,6 @@ public class AdminCommentController { ...@@ -47,9 +43,6 @@ public class AdminCommentController {
@PostMapping("/delete") @PostMapping("/delete")
public Object delete(@LoginAdmin Integer adminId, @RequestBody LitemallComment comment) { public Object delete(@LoginAdmin Integer adminId, @RequestBody LitemallComment comment) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
Integer id = comment.getId(); Integer id = comment.getId();
if (id == null) { if (id == null) {
return ResponseUtil.badArgument(); return ResponseUtil.badArgument();
......
...@@ -41,10 +41,6 @@ public class AdminCouponController { ...@@ -41,10 +41,6 @@ public class AdminCouponController {
@RequestParam(defaultValue = "10") Integer limit, @RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort, @Sort @RequestParam(defaultValue = "add_time") String sort,
@Order @RequestParam(defaultValue = "desc") String order) { @Order @RequestParam(defaultValue = "desc") String order) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
List<LitemallCoupon> couponList = couponService.querySelective(name, type, status, page, limit, sort, order); List<LitemallCoupon> couponList = couponService.querySelective(name, type, status, page, limit, sort, order);
int total = couponService.countSelective(name, type, status, page, limit, sort, order); int total = couponService.countSelective(name, type, status, page, limit, sort, order);
Map<String, Object> data = new HashMap<>(); Map<String, Object> data = new HashMap<>();
...@@ -61,10 +57,6 @@ public class AdminCouponController { ...@@ -61,10 +57,6 @@ public class AdminCouponController {
@RequestParam(defaultValue = "10") Integer limit, @RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort, @Sort @RequestParam(defaultValue = "add_time") String sort,
@Order @RequestParam(defaultValue = "desc") String order) { @Order @RequestParam(defaultValue = "desc") String order) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
List<LitemallCouponUser> couponList = couponUserService.queryList(userId, couponId, status, page, limit, sort, order); List<LitemallCouponUser> couponList = couponUserService.queryList(userId, couponId, status, page, limit, sort, order);
int total = couponUserService.countList(userId, couponId, status, page, limit, sort, order); int total = couponUserService.countList(userId, couponId, status, page, limit, sort, order);
Map<String, Object> data = new HashMap<>(); Map<String, Object> data = new HashMap<>();
...@@ -84,9 +76,6 @@ public class AdminCouponController { ...@@ -84,9 +76,6 @@ public class AdminCouponController {
@PostMapping("/create") @PostMapping("/create")
public Object create(@LoginAdmin Integer adminId, @RequestBody LitemallCoupon coupon) { public Object create(@LoginAdmin Integer adminId, @RequestBody LitemallCoupon coupon) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
Object error = validate(coupon); Object error = validate(coupon);
if (error != null) { if (error != null) {
return error; return error;
...@@ -104,19 +93,12 @@ public class AdminCouponController { ...@@ -104,19 +93,12 @@ public class AdminCouponController {
@GetMapping("/read") @GetMapping("/read")
public Object read(@LoginAdmin Integer adminId, @NotNull Integer id) { public Object read(@LoginAdmin Integer adminId, @NotNull Integer id) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
LitemallCoupon coupon = couponService.findById(id); LitemallCoupon coupon = couponService.findById(id);
return ResponseUtil.ok(coupon); return ResponseUtil.ok(coupon);
} }
@PostMapping("/update") @PostMapping("/update")
public Object update(@LoginAdmin Integer adminId, @RequestBody LitemallCoupon coupon) { public Object update(@LoginAdmin Integer adminId, @RequestBody LitemallCoupon coupon) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
Object error = validate(coupon); Object error = validate(coupon);
if (error != null) { if (error != null) {
return error; return error;
...@@ -129,9 +111,6 @@ public class AdminCouponController { ...@@ -129,9 +111,6 @@ public class AdminCouponController {
@PostMapping("/delete") @PostMapping("/delete")
public Object delete(@LoginAdmin Integer adminId, @RequestBody LitemallCoupon coupon) { public Object delete(@LoginAdmin Integer adminId, @RequestBody LitemallCoupon coupon) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
couponService.deleteById(coupon.getId()); couponService.deleteById(coupon.getId());
return ResponseUtil.ok(); return ResponseUtil.ok();
} }
......
...@@ -34,10 +34,6 @@ public class AdminDashbordController { ...@@ -34,10 +34,6 @@ public class AdminDashbordController {
@GetMapping("") @GetMapping("")
public Object info(@LoginAdmin Integer adminId) { public Object info(@LoginAdmin Integer adminId) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
int userTotal = userService.count(); int userTotal = userService.count();
int goodsTotal = goodsService.count(); int goodsTotal = goodsService.count();
int productTotal = productService.count(); int productTotal = productService.count();
......
...@@ -39,9 +39,6 @@ public class AdminFeedbackController { ...@@ -39,9 +39,6 @@ public class AdminFeedbackController {
@RequestParam(defaultValue = "10") Integer limit, @RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort, @Sort @RequestParam(defaultValue = "add_time") String sort,
@Order @RequestParam(defaultValue = "desc") String order) { @Order @RequestParam(defaultValue = "desc") String order) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
List<LitemallFeedback> feedbackList = feedbackService.querySelective(userId, username, page, limit, sort, order); List<LitemallFeedback> feedbackList = feedbackService.querySelective(userId, username, page, limit, sort, order);
int total = feedbackService.countSelective(userId, username, page, limit, sort, order); int total = feedbackService.countSelective(userId, username, page, limit, sort, order);
Map<String, Object> data = new HashMap<>(); Map<String, Object> data = new HashMap<>();
......
...@@ -35,10 +35,6 @@ public class AdminFootprintController { ...@@ -35,10 +35,6 @@ public class AdminFootprintController {
@RequestParam(defaultValue = "10") Integer limit, @RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort, @Sort @RequestParam(defaultValue = "add_time") String sort,
@Order @RequestParam(defaultValue = "desc") String order) { @Order @RequestParam(defaultValue = "desc") String order) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
List<LitemallFootprint> footprintList = footprintService.querySelective(userId, goodsId, page, limit, sort, order); List<LitemallFootprint> footprintList = footprintService.querySelective(userId, goodsId, page, limit, sort, order);
int total = footprintService.countSelective(userId, goodsId, page, limit, sort, order); int total = footprintService.countSelective(userId, goodsId, page, limit, sort, order);
Map<String, Object> data = new HashMap<>(); Map<String, Object> data = new HashMap<>();
......
...@@ -66,10 +66,6 @@ public class AdminGoodsController { ...@@ -66,10 +66,6 @@ public class AdminGoodsController {
@RequestParam(defaultValue = "10") Integer limit, @RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort, @Sort @RequestParam(defaultValue = "add_time") String sort,
@Order @RequestParam(defaultValue = "desc") String order) { @Order @RequestParam(defaultValue = "desc") String order) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
List<LitemallGoods> goodsList = goodsService.querySelective(goodsSn, name, page, limit, sort, order); List<LitemallGoods> goodsList = goodsService.querySelective(goodsSn, name, page, limit, sort, order);
int total = goodsService.countSelective(goodsSn, name, page, limit, sort, order); int total = goodsService.countSelective(goodsSn, name, page, limit, sort, order);
Map<String, Object> data = new HashMap<>(); Map<String, Object> data = new HashMap<>();
...@@ -167,10 +163,6 @@ public class AdminGoodsController { ...@@ -167,10 +163,6 @@ public class AdminGoodsController {
*/ */
@PostMapping("/update") @PostMapping("/update")
public Object update(@LoginAdmin Integer adminId, @RequestBody GoodsAllinone goodsAllinone) { public Object update(@LoginAdmin Integer adminId, @RequestBody GoodsAllinone goodsAllinone) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
Object error = validate(goodsAllinone); Object error = validate(goodsAllinone);
if (error != null) { if (error != null) {
return error; return error;
...@@ -242,9 +234,6 @@ public class AdminGoodsController { ...@@ -242,9 +234,6 @@ public class AdminGoodsController {
@PostMapping("/delete") @PostMapping("/delete")
public Object delete(@LoginAdmin Integer adminId, @RequestBody LitemallGoods goods) { public Object delete(@LoginAdmin Integer adminId, @RequestBody LitemallGoods goods) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
Integer id = goods.getId(); Integer id = goods.getId();
if (id == null) { if (id == null) {
return ResponseUtil.badArgument(); return ResponseUtil.badArgument();
...@@ -272,10 +261,6 @@ public class AdminGoodsController { ...@@ -272,10 +261,6 @@ public class AdminGoodsController {
@PostMapping("/create") @PostMapping("/create")
public Object create(@LoginAdmin Integer adminId, @RequestBody GoodsAllinone goodsAllinone) { public Object create(@LoginAdmin Integer adminId, @RequestBody GoodsAllinone goodsAllinone) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
Object error = validate(goodsAllinone); Object error = validate(goodsAllinone);
if (error != null) { if (error != null) {
return error; return error;
...@@ -339,10 +324,6 @@ public class AdminGoodsController { ...@@ -339,10 +324,6 @@ public class AdminGoodsController {
@GetMapping("/catAndBrand") @GetMapping("/catAndBrand")
public Object list2(@LoginAdmin Integer adminId) { public Object list2(@LoginAdmin Integer adminId) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
// http://element-cn.eleme.io/#/zh-CN/component/cascader // http://element-cn.eleme.io/#/zh-CN/component/cascader
// 管理员设置“所属分类” // 管理员设置“所属分类”
List<LitemallCategory> l1CatList = categoryService.queryL1(); List<LitemallCategory> l1CatList = categoryService.queryL1();
...@@ -385,10 +366,6 @@ public class AdminGoodsController { ...@@ -385,10 +366,6 @@ public class AdminGoodsController {
@GetMapping("/detail") @GetMapping("/detail")
public Object detail(@LoginAdmin Integer adminId, @NotNull Integer id) { public Object detail(@LoginAdmin Integer adminId, @NotNull Integer id) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
LitemallGoods goods = goodsService.findById(id); LitemallGoods goods = goodsService.findById(id);
List<LitemallGoodsProduct> products = productService.queryByGid(id); List<LitemallGoodsProduct> products = productService.queryByGid(id);
List<LitemallGoodsSpecification> specifications = specificationService.queryByGid(id); List<LitemallGoodsSpecification> specifications = specificationService.queryByGid(id);
......
...@@ -43,10 +43,6 @@ public class AdminGrouponController { ...@@ -43,10 +43,6 @@ public class AdminGrouponController {
@RequestParam(defaultValue = "10") Integer limit, @RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort, @Sort @RequestParam(defaultValue = "add_time") String sort,
@Order @RequestParam(defaultValue = "desc") String order) { @Order @RequestParam(defaultValue = "desc") String order) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
List<LitemallGroupon> grouponList = grouponService.querySelective(grouponId, page, limit, sort, order); List<LitemallGroupon> grouponList = grouponService.querySelective(grouponId, page, limit, sort, order);
int total = grouponService.countSelective(grouponId, page, limit, sort, order); int total = grouponService.countSelective(grouponId, page, limit, sort, order);
...@@ -83,10 +79,6 @@ public class AdminGrouponController { ...@@ -83,10 +79,6 @@ public class AdminGrouponController {
@RequestParam(defaultValue = "10") Integer limit, @RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort, @Sort @RequestParam(defaultValue = "add_time") String sort,
@Order @RequestParam(defaultValue = "desc") String order) { @Order @RequestParam(defaultValue = "desc") String order) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
List<LitemallGrouponRules> rulesList = rulesService.querySelective(goodsId, page, limit, sort, order); List<LitemallGrouponRules> rulesList = rulesService.querySelective(goodsId, page, limit, sort, order);
int total = rulesService.countSelective(goodsId, page, limit, sort, order); int total = rulesService.countSelective(goodsId, page, limit, sort, order);
Map<String, Object> data = new HashMap<>(); Map<String, Object> data = new HashMap<>();
...@@ -119,10 +111,6 @@ public class AdminGrouponController { ...@@ -119,10 +111,6 @@ public class AdminGrouponController {
@PostMapping("/update") @PostMapping("/update")
public Object update(@LoginAdmin Integer adminId, @RequestBody LitemallGrouponRules grouponRules) { public Object update(@LoginAdmin Integer adminId, @RequestBody LitemallGrouponRules grouponRules) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
Object error = validate(grouponRules); Object error = validate(grouponRules);
if (error != null) { if (error != null) {
return error; return error;
...@@ -147,10 +135,6 @@ public class AdminGrouponController { ...@@ -147,10 +135,6 @@ public class AdminGrouponController {
@PostMapping("/create") @PostMapping("/create")
public Object create(@LoginAdmin Integer adminId, @RequestBody LitemallGrouponRules grouponRules) { public Object create(@LoginAdmin Integer adminId, @RequestBody LitemallGrouponRules grouponRules) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
Object error = validate(grouponRules); Object error = validate(grouponRules);
if (error != null) { if (error != null) {
return error; return error;
...@@ -173,10 +157,6 @@ public class AdminGrouponController { ...@@ -173,10 +157,6 @@ public class AdminGrouponController {
@PostMapping("/delete") @PostMapping("/delete")
public Object delete(@LoginAdmin Integer adminId, @RequestBody LitemallGrouponRules grouponRules) { public Object delete(@LoginAdmin Integer adminId, @RequestBody LitemallGrouponRules grouponRules) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
Integer id = grouponRules.getId(); Integer id = grouponRules.getId();
if (id == null) { if (id == null) {
return ResponseUtil.badArgument(); return ResponseUtil.badArgument();
......
...@@ -33,10 +33,6 @@ public class AdminHistoryController { ...@@ -33,10 +33,6 @@ public class AdminHistoryController {
@RequestParam(defaultValue = "10") Integer limit, @RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort, @Sort @RequestParam(defaultValue = "add_time") String sort,
@Order @RequestParam(defaultValue = "desc") String order) { @Order @RequestParam(defaultValue = "desc") String order) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
List<LitemallSearchHistory> footprintList = searchHistoryService.querySelective(userId, keyword, page, limit, sort, order); List<LitemallSearchHistory> footprintList = searchHistoryService.querySelective(userId, keyword, page, limit, sort, order);
int total = searchHistoryService.countSelective(userId, keyword, page, limit, sort, order); int total = searchHistoryService.countSelective(userId, keyword, page, limit, sort, order);
Map<String, Object> data = new HashMap<>(); Map<String, Object> data = new HashMap<>();
......
...@@ -34,10 +34,6 @@ public class AdminIssueController { ...@@ -34,10 +34,6 @@ public class AdminIssueController {
@RequestParam(defaultValue = "10") Integer limit, @RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort, @Sort @RequestParam(defaultValue = "add_time") String sort,
@Order @RequestParam(defaultValue = "desc") String order) { @Order @RequestParam(defaultValue = "desc") String order) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
List<LitemallIssue> issueList = issueService.querySelective(question, page, limit, sort, order); List<LitemallIssue> issueList = issueService.querySelective(question, page, limit, sort, order);
int total = issueService.countSelective(question, page, limit, sort, order); int total = issueService.countSelective(question, page, limit, sort, order);
Map<String, Object> data = new HashMap<>(); Map<String, Object> data = new HashMap<>();
...@@ -61,9 +57,6 @@ public class AdminIssueController { ...@@ -61,9 +57,6 @@ public class AdminIssueController {
@PostMapping("/create") @PostMapping("/create")
public Object create(@LoginAdmin Integer adminId, @RequestBody LitemallIssue issue) { public Object create(@LoginAdmin Integer adminId, @RequestBody LitemallIssue issue) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
Object error = validate(issue); Object error = validate(issue);
if (error != null) { if (error != null) {
return error; return error;
...@@ -74,19 +67,12 @@ public class AdminIssueController { ...@@ -74,19 +67,12 @@ public class AdminIssueController {
@GetMapping("/read") @GetMapping("/read")
public Object read(@LoginAdmin Integer adminId, @NotNull Integer id) { public Object read(@LoginAdmin Integer adminId, @NotNull Integer id) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
LitemallIssue issue = issueService.findById(id); LitemallIssue issue = issueService.findById(id);
return ResponseUtil.ok(issue); return ResponseUtil.ok(issue);
} }
@PostMapping("/update") @PostMapping("/update")
public Object update(@LoginAdmin Integer adminId, @RequestBody LitemallIssue issue) { public Object update(@LoginAdmin Integer adminId, @RequestBody LitemallIssue issue) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
Object error = validate(issue); Object error = validate(issue);
if (error != null) { if (error != null) {
return error; return error;
...@@ -100,9 +86,6 @@ public class AdminIssueController { ...@@ -100,9 +86,6 @@ public class AdminIssueController {
@PostMapping("/delete") @PostMapping("/delete")
public Object delete(@LoginAdmin Integer adminId, @RequestBody LitemallIssue issue) { public Object delete(@LoginAdmin Integer adminId, @RequestBody LitemallIssue issue) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
Integer id = issue.getId(); Integer id = issue.getId();
if (id == null) { if (id == null) {
return ResponseUtil.badArgument(); return ResponseUtil.badArgument();
......
...@@ -34,10 +34,6 @@ public class AdminKeywordController { ...@@ -34,10 +34,6 @@ public class AdminKeywordController {
@RequestParam(defaultValue = "10") Integer limit, @RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort, @Sort @RequestParam(defaultValue = "add_time") String sort,
@Order @RequestParam(defaultValue = "desc") String order) { @Order @RequestParam(defaultValue = "desc") String order) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
List<LitemallKeyword> brandList = keywordService.querySelective(keyword, url, page, limit, sort, order); List<LitemallKeyword> brandList = keywordService.querySelective(keyword, url, page, limit, sort, order);
int total = keywordService.countSelective(keyword, url, page, limit, sort, order); int total = keywordService.countSelective(keyword, url, page, limit, sort, order);
Map<String, Object> data = new HashMap<>(); Map<String, Object> data = new HashMap<>();
...@@ -61,9 +57,6 @@ public class AdminKeywordController { ...@@ -61,9 +57,6 @@ public class AdminKeywordController {
@PostMapping("/create") @PostMapping("/create")
public Object create(@LoginAdmin Integer adminId, @RequestBody LitemallKeyword keywords) { public Object create(@LoginAdmin Integer adminId, @RequestBody LitemallKeyword keywords) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
Object error = validate(keywords); Object error = validate(keywords);
if (error != null) { if (error != null) {
return error; return error;
...@@ -74,19 +67,12 @@ public class AdminKeywordController { ...@@ -74,19 +67,12 @@ public class AdminKeywordController {
@GetMapping("/read") @GetMapping("/read")
public Object read(@LoginAdmin Integer adminId, @NotNull Integer id) { public Object read(@LoginAdmin Integer adminId, @NotNull Integer id) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
LitemallKeyword brand = keywordService.findById(id); LitemallKeyword brand = keywordService.findById(id);
return ResponseUtil.ok(brand); return ResponseUtil.ok(brand);
} }
@PostMapping("/update") @PostMapping("/update")
public Object update(@LoginAdmin Integer adminId, @RequestBody LitemallKeyword keywords) { public Object update(@LoginAdmin Integer adminId, @RequestBody LitemallKeyword keywords) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
Object error = validate(keywords); Object error = validate(keywords);
if (error != null) { if (error != null) {
return error; return error;
...@@ -99,9 +85,6 @@ public class AdminKeywordController { ...@@ -99,9 +85,6 @@ public class AdminKeywordController {
@PostMapping("/delete") @PostMapping("/delete")
public Object delete(@LoginAdmin Integer adminId, @RequestBody LitemallKeyword keyword) { public Object delete(@LoginAdmin Integer adminId, @RequestBody LitemallKeyword keyword) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
Integer id = keyword.getId(); Integer id = keyword.getId();
if (id == null) { if (id == null) {
return ResponseUtil.badArgument(); return ResponseUtil.badArgument();
......
...@@ -68,9 +68,6 @@ public class AdminOrderController { ...@@ -68,9 +68,6 @@ public class AdminOrderController {
@RequestParam(defaultValue = "10") Integer limit, @RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort, @Sort @RequestParam(defaultValue = "add_time") String sort,
@Order @RequestParam(defaultValue = "desc") String order) { @Order @RequestParam(defaultValue = "desc") String order) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
List<LitemallOrder> orderList = orderService.querySelective(userId, orderSn, orderStatusArray, page, limit, sort, order); List<LitemallOrder> orderList = orderService.querySelective(userId, orderSn, orderStatusArray, page, limit, sort, order);
int total = orderService.countSelective(userId, orderSn, orderStatusArray, page, limit, sort, order); int total = orderService.countSelective(userId, orderSn, orderStatusArray, page, limit, sort, order);
...@@ -83,10 +80,6 @@ public class AdminOrderController { ...@@ -83,10 +80,6 @@ public class AdminOrderController {
@GetMapping("/detail") @GetMapping("/detail")
public Object detail(@LoginAdmin Integer adminId, @NotNull Integer id) { public Object detail(@LoginAdmin Integer adminId, @NotNull Integer id) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
LitemallOrder order = orderService.findById(id); LitemallOrder order = orderService.findById(id);
List<LitemallOrderGoods> orderGoods = orderGoodsService.queryByOid(id); List<LitemallOrderGoods> orderGoods = orderGoodsService.queryByOid(id);
UserVo user = userService.findUserVoById(order.getUserId()); UserVo user = userService.findUserVoById(order.getUserId());
...@@ -117,9 +110,6 @@ public class AdminOrderController { ...@@ -117,9 +110,6 @@ public class AdminOrderController {
*/ */
@PostMapping("refund") @PostMapping("refund")
public Object refund(@LoginAdmin Integer adminId, @RequestBody String body) { public Object refund(@LoginAdmin Integer adminId, @RequestBody String body) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
Integer orderId = JacksonUtil.parseInteger(body, "orderId"); Integer orderId = JacksonUtil.parseInteger(body, "orderId");
String refundMoney = JacksonUtil.parseString(body, "refundMoney"); String refundMoney = JacksonUtil.parseString(body, "refundMoney");
if (orderId == null) { if (orderId == null) {
...@@ -217,9 +207,6 @@ public class AdminOrderController { ...@@ -217,9 +207,6 @@ public class AdminOrderController {
*/ */
@PostMapping("ship") @PostMapping("ship")
public Object ship(@LoginAdmin Integer adminId, @RequestBody String body) { public Object ship(@LoginAdmin Integer adminId, @RequestBody String body) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
Integer orderId = JacksonUtil.parseInteger(body, "orderId"); Integer orderId = JacksonUtil.parseInteger(body, "orderId");
String shipSn = JacksonUtil.parseString(body, "shipSn"); String shipSn = JacksonUtil.parseString(body, "shipSn");
String shipChannel = JacksonUtil.parseString(body, "shipChannel"); String shipChannel = JacksonUtil.parseString(body, "shipChannel");
...@@ -265,10 +252,6 @@ public class AdminOrderController { ...@@ -265,10 +252,6 @@ public class AdminOrderController {
*/ */
@PostMapping("reply") @PostMapping("reply")
public Object reply(@LoginAdmin Integer adminId, @RequestBody String body) { public Object reply(@LoginAdmin Integer adminId, @RequestBody String body) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
Integer commentId = JacksonUtil.parseInteger(body, "commentId"); Integer commentId = JacksonUtil.parseInteger(body, "commentId");
if (commentId == null || commentId == 0) { if (commentId == null || commentId == 0) {
return ResponseUtil.badArgument(); return ResponseUtil.badArgument();
......
...@@ -30,10 +30,6 @@ public class AdminProfileController { ...@@ -30,10 +30,6 @@ public class AdminProfileController {
@PostMapping("/password") @PostMapping("/password")
public Object create(@LoginAdmin Integer adminId, @RequestBody String body) { public Object create(@LoginAdmin Integer adminId, @RequestBody String body) {
if (adminId == null) {
return ResponseUtil.unlogin();
}
String oldPassword = JacksonUtil.parseString(body, "oldPassword"); String oldPassword = JacksonUtil.parseString(body, "oldPassword");
String newPassword = JacksonUtil.parseString(body, "newPassword"); String newPassword = JacksonUtil.parseString(body, "newPassword");
if (StringUtils.isEmpty(oldPassword)) { if (StringUtils.isEmpty(oldPassword)) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment