订单模板的Controller接口

This commit is contained in:
HH 2023-02-23 16:18:32 +08:00
parent 29c2d6dab9
commit 62b5e00e4e
3 changed files with 30 additions and 3 deletions

View File

@ -1,19 +1,46 @@
package com.ghy.web.controller.order;
import com.ghy.common.core.controller.BaseController;
import com.ghy.order.domain.OrderTemplate;
import com.ghy.order.service.OrderTemplateService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
@Slf4j
@Controller
@RequestMapping("order/template")
public class OrderTemplateController {
public class OrderTemplateController extends BaseController {
@Resource
private OrderTemplateService orderTemplateService;
@PostMapping("insert")
public int insert(OrderTemplate orderTemplate) {
Long userId = getUserId();
Assert.notNull(userId, "UserId is null !");
orderTemplate.setUserId(userId);
return orderTemplateService.insert(orderTemplate);
}
@DeleteMapping("delete")
public int delete(Long id) {
return orderTemplateService.delete(id);
}
@PutMapping("update")
public int update(OrderTemplate orderTemplate) {
return orderTemplateService.update(orderTemplate);
}
@ResponseBody
@GetMapping("selectByUserId")
public List<OrderTemplate> selectByUserId() {
Long userId = getUserId();
return orderTemplateService.selectByUserId(userId);
}
}

View File

@ -1,7 +1,6 @@
package com.ghy.order.domain;
import com.ghy.common.core.domain.BaseEntity;
import com.ghy.goods.domain.Goods;
import lombok.Data;
import lombok.EqualsAndHashCode;

View File

@ -6,6 +6,7 @@ import com.ghy.order.mapper.OrderTemplateMapper;
import com.ghy.order.service.OrderTemplateService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;