通用日志记录

This commit is contained in:
zhh
2018-04-18 17:25:18 +08:00
parent 8dde877a9f
commit 2d4dc7e0c1
11 changed files with 171 additions and 28 deletions

View File

@@ -25,8 +25,6 @@ public class PmsBrandController {
@Autowired
private PmsBrandService brandService;
private static final Logger LOGGER = LoggerFactory.getLogger(PmsBrandController.class);
@ApiOperation(value = "获取全部品牌列表")
@RequestMapping(value = "/listAll", method = RequestMethod.GET)
@ResponseBody
@@ -45,10 +43,8 @@ public class PmsBrandController {
int count = brandService.createBrand(pmsBrand);
if (count == 1) {
commonResult = new CommonResult().success(pmsBrand);
LOGGER.debug("createBrand success:{}", pmsBrand);
} else {
commonResult = new CommonResult().failed();
LOGGER.debug("createBrand failed:{}", pmsBrand);
}
return commonResult;
}
@@ -64,10 +60,8 @@ public class PmsBrandController {
int count = brandService.updateBrand(id, pmsBrandParam);
if (count == 1) {
commonResult = new CommonResult().success(pmsBrandParam);
LOGGER.debug("updateBrand success:{}", pmsBrandParam);
} else {
commonResult = new CommonResult().failed();
LOGGER.debug("updateBrand failed:{}", pmsBrandParam);
}
return commonResult;
}
@@ -78,10 +72,8 @@ public class PmsBrandController {
public Object deleteBrand(@PathVariable("id") Long id) {
int count = brandService.deleteBrand(id);
if (count == 1) {
LOGGER.debug("deleteBrand success:id={}", id);
return new CommonResult().success(null);
} else {
LOGGER.debug("deleteBrand failed:id={}", id);
return new CommonResult().failed();
}
}
@@ -108,10 +100,8 @@ public class PmsBrandController {
public Object deleteBrandBatch(@RequestParam("ids") List<Long> ids) {
int count = brandService.deleteBrand(ids);
if (count > 0) {
LOGGER.debug("deleteBrandBatch success:ids={}", ids);
return new CommonResult().success(count);
} else {
LOGGER.debug("deleteBrandBatch failed:ids={}", ids);
return new CommonResult().failed();
}
}
@@ -123,10 +113,8 @@ public class PmsBrandController {
@RequestParam("showStatus") Integer showStatus) {
int count = brandService.updateShowStatus(ids, showStatus);
if (count > 0) {
LOGGER.debug("updateShowStatus success:ids={}", ids);
return new CommonResult().success(count);
} else {
LOGGER.debug("updateShowStatus failed:ids={}", ids);
return new CommonResult().failed();
}
}
@@ -138,10 +126,8 @@ public class PmsBrandController {
@RequestParam("factoryStatus") Integer factoryStatus) {
int count = brandService.updateFactoryStatus(ids, factoryStatus);
if (count > 0) {
LOGGER.debug("updateFactoryStatus success:{}", ids);
return new CommonResult().success(count);
} else {
LOGGER.debug("updateFactoryStatus failed:{}", ids);
return new CommonResult().failed();
}
}

View File

@@ -18,7 +18,6 @@ import java.util.List;
@Controller
@RequestMapping("/productAttribute/category")
public class PmsProductAttributeCategoryController {
private static final Logger LOGGER = LoggerFactory.getLogger(PmsProductAttributeCategoryController.class);
@Autowired
private PmsProductAttributeCategoryService productAttributeCategoryService;
@@ -28,10 +27,8 @@ public class PmsProductAttributeCategoryController {
public Object create(@RequestParam String name) {
int count = productAttributeCategoryService.create(name);
if (count > 0) {
LOGGER.debug("create success name:{}", name);
return new CommonResult().success(count);
} else {
LOGGER.debug("create failed name:{}", name);
return new CommonResult().failed();
}
}
@@ -42,10 +39,8 @@ public class PmsProductAttributeCategoryController {
public Object update(@PathVariable Long id, @RequestParam String name) {
int count = productAttributeCategoryService.update(id, name);
if (count > 0) {
LOGGER.debug("update success id:{}", id);
return new CommonResult().success(count);
} else {
LOGGER.debug("update failed id:{}", id);
return new CommonResult().failed();
}
}
@@ -56,10 +51,8 @@ public class PmsProductAttributeCategoryController {
public Object delete(@PathVariable Long id) {
int count = productAttributeCategoryService.delete(id);
if (count > 0) {
LOGGER.debug("delete success name:{}", id);
return new CommonResult().success(count);
} else {
LOGGER.debug("delete failed name:{}", id);
return new CommonResult().failed();
}
}

View File

@@ -0,0 +1,19 @@
package com.macro.mall.controller;
import com.macro.mall.service.PmsProductAttributeService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* 商品属性管理Controller
*/
@Controller
@RequestMapping("/productAttribute")
public class PmsProductAttributeController {
private static final Logger LOGGER = LoggerFactory.getLogger(PmsProductAttributeController.class);
@Autowired
private PmsProductAttributeService productAttributeService;
}

View File

@@ -21,7 +21,6 @@ import java.util.List;
@Controller
@RequestMapping("/productCategory")
public class PmsProductCategoryController {
private static final Logger LOGGER = LoggerFactory.getLogger(PmsProductCategoryController.class);
@Autowired
private PmsProductCategoryService productCategoryService;
@@ -34,10 +33,8 @@ public class PmsProductCategoryController {
}
int count = productCategoryService.create(pmsProductCategoryParam);
if (count > 0) {
LOGGER.debug("create success {}", pmsProductCategoryParam);
return new CommonResult().success(count);
} else {
LOGGER.debug("create failed {}", pmsProductCategoryParam);
return new CommonResult().failed();
}
}
@@ -54,10 +51,8 @@ public class PmsProductCategoryController {
}
int count = productCategoryService.update(id, pmsProductCategoryParam);
if (count > 0) {
LOGGER.debug("update success {}", pmsProductCategoryParam);
return new CommonResult().success(count);
} else {
LOGGER.debug("update failed {}", pmsProductCategoryParam);
return new CommonResult().failed();
}
}
@@ -78,10 +73,8 @@ public class PmsProductCategoryController {
public Object delete(@PathVariable Long id) {
int count = productCategoryService.delete(id);
if (count > 0) {
LOGGER.debug("delete success id:{}", id);
return new CommonResult().success(count);
} else {
LOGGER.debug("delete failed id:{}", id);
return new CommonResult().failed();
}
}