net.guerlab.smart.banner.web.controller.user.BannerGroupController 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.BannerGroupDTO;
import net.guerlab.smart.banner.core.exception.BannerGroupInvalidException;
import net.guerlab.smart.banner.core.searchparams.BannerGroupSearchParams;
import net.guerlab.smart.banner.service.entity.BannerGroup;
import net.guerlab.smart.banner.service.service.BannerGroupService;
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/bannerGroup")
@RequestMapping("/user/bannerGroup")
public class BannerGroupController
extends BaseController {
private OperationLogApi operationLogApi;
@Override
public void copyProperties(BannerGroupDTO dto, BannerGroup entity, String id) {
super.copyProperties(dto, entity, id);
if (id != null) {
entity.setBannerGroupKey(id);
}
}
@Override
protected ApplicationException nullPointException() {
return new BannerGroupInvalidException();
}
@Override
public void afterSave(BannerGroup entity, BannerGroupDTO dto) {
operationLogApi.add("添加banner分组", UserContextHandler.getUserId(), entity);
}
@Override
public void afterUpdate(BannerGroup entity, BannerGroupDTO dto) {
operationLogApi.add("编辑banner分组", UserContextHandler.getUserId(), entity);
}
@Override
public void afterDelete(BannerGroup entity) {
operationLogApi.add("删除banner分组", UserContextHandler.getUserId(), entity.getBannerGroupKey());
}
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
@Autowired
public void setOperationLogApi(OperationLogApi operationLogApi) {
this.operationLogApi = operationLogApi;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy