net.guerlab.smart.banner.web.controller.user.BannerController Maven / Gradle / Ivy
package net.guerlab.smart.banner.web.controller.user;
import io.swagger.annotations.Api;
import net.guerlab.commons.exception.ApplicationException;
import net.guerlab.smart.banner.core.domain.BannerDTO;
import net.guerlab.smart.banner.core.exception.BannerInvalidException;
import net.guerlab.smart.banner.core.searchparams.BannerSearchParams;
import net.guerlab.smart.banner.service.entity.Banner;
import net.guerlab.smart.banner.service.service.BannerService;
import net.guerlab.smart.platform.server.controller.BaseController;
import net.guerlab.smart.platform.user.api.OperationLogApi;
import net.guerlab.smart.platform.user.auth.UserContextHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* banner
*
* @author guer
*/
@Api(tags = "banner")
@RestController("/user/banner")
@RequestMapping("/user/banner")
public class BannerController extends BaseController {
private OperationLogApi operationLogApi;
@Override
public void copyProperties(BannerDTO dto, Banner entity, Long id) {
super.copyProperties(dto, entity, id);
entity.setBannerId(id);
}
@Override
protected ApplicationException nullPointException() {
return new BannerInvalidException();
}
@Override
public void afterSave(Banner entity, BannerDTO dto) {
operationLogApi.add("添加banner", UserContextHandler.getUserId(), entity);
}
@Override
public void afterUpdate(Banner entity, BannerDTO dto) {
operationLogApi.add("编辑banner", UserContextHandler.getUserId(), entity);
}
@Override
public void afterDelete(Banner entity) {
operationLogApi.add("删除banner", UserContextHandler.getUserId(), entity.getBannerId());
}
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
@Autowired
public void setOperationLogApi(OperationLogApi operationLogApi) {
this.operationLogApi = operationLogApi;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy