修复代码生成器模板引入错误的问题
This commit is contained in:
@ -0,0 +1,86 @@
|
||||
/**
|
||||
* Copyright (C) 2018-2020
|
||||
* All rights reserved, Designed By www.yixiang.co
|
||||
* 注意:
|
||||
* 本软件为www.yixiang.co开发研制,未经购买不得使用
|
||||
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
|
||||
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
||||
*/
|
||||
package co.yixiang.modules.product.rest;
|
||||
import java.util.Arrays;
|
||||
import co.yixiang.dozer.service.IGenerator;
|
||||
import co.yixiang.modules.product.domain.YxStoreProductRule;
|
||||
import co.yixiang.modules.product.service.YxStoreProductRuleService;
|
||||
import co.yixiang.modules.product.service.dto.YxStoreProductRuleDto;
|
||||
import co.yixiang.modules.product.service.dto.YxStoreProductRuleQueryCriteria;
|
||||
import lombok.AllArgsConstructor;
|
||||
import co.yixiang.logging.aop.log.Log;
|
||||
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2020-06-28
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Api(tags = "sku规则管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/yxStoreProductRule")
|
||||
public class StoreProductRuleController {
|
||||
|
||||
private final YxStoreProductRuleService yxStoreProductRuleService;
|
||||
private final IGenerator generator;
|
||||
|
||||
|
||||
@Log("导出数据")
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('admin','yxStoreProductRule:list')")
|
||||
public void download(HttpServletResponse response, YxStoreProductRuleQueryCriteria criteria) throws IOException {
|
||||
yxStoreProductRuleService.download(generator.convert(yxStoreProductRuleService.queryAll(criteria), YxStoreProductRuleDto.class), response);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@Log("查询sku规则")
|
||||
@ApiOperation("查询sku规则")
|
||||
@PreAuthorize("@el.check('admin','yxStoreProductRule:list')")
|
||||
public ResponseEntity<Object> getYxStoreProductRules(YxStoreProductRuleQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(yxStoreProductRuleService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增sku规则")
|
||||
@ApiOperation("新增sku规则")
|
||||
@PreAuthorize("@el.check('admin','yxStoreProductRule:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody YxStoreProductRule resources){
|
||||
return new ResponseEntity<>(yxStoreProductRuleService.save(resources),HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改sku规则")
|
||||
@ApiOperation("修改sku规则")
|
||||
@PreAuthorize("@el.check('admin','yxStoreProductRule:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody YxStoreProductRule resources){
|
||||
yxStoreProductRuleService.updateById(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除sku规则")
|
||||
@ApiOperation("删除sku规则")
|
||||
@PreAuthorize("@el.check('admin','yxStoreProductRule:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> deleteAll(@RequestBody Integer[] ids) {
|
||||
Arrays.asList(ids).forEach(id->{
|
||||
yxStoreProductRuleService.removeById(id);
|
||||
});
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user