订单模板的Controller接口
This commit is contained in:
parent
29c2d6dab9
commit
62b5e00e4e
|
|
@ -1,19 +1,46 @@
|
||||||
package com.ghy.web.controller.order;
|
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 com.ghy.order.service.OrderTemplateService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Controller;
|
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 javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("order/template")
|
@RequestMapping("order/template")
|
||||||
public class OrderTemplateController {
|
public class OrderTemplateController extends BaseController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private OrderTemplateService orderTemplateService;
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package com.ghy.order.domain;
|
package com.ghy.order.domain;
|
||||||
|
|
||||||
import com.ghy.common.core.domain.BaseEntity;
|
import com.ghy.common.core.domain.BaseEntity;
|
||||||
import com.ghy.goods.domain.Goods;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import com.ghy.order.mapper.OrderTemplateMapper;
|
||||||
import com.ghy.order.service.OrderTemplateService;
|
import com.ghy.order.service.OrderTemplateService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue