123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- package com.zjt.web;
- import com.zjt.entity.ProductionVariety;
- import com.zjt.service.IProductionVarietyDetailService;
- import com.zjt.service.IProductionVarietyService;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Controller;
- import org.springframework.web.bind.annotation.RequestMapping;
- import javax.annotation.Resource;
- /**
- * <p>
- * 前端控制器
- * </p>
- *
- * @author xxu
- * @since 2025-09-25
- */
- @Controller
- @RequestMapping("/entity/productionheader")
- public class ProductionheaderController {
- private static final String VIEW_VARIETY_LIST = "mypackage/varietyList";
- @Autowired
- private IProductionVarietyService productionVarietyService;
- @Autowired
- private IProductionVarietyDetailService productionVarietyDetailService;
- @RequestMapping("list")
- public String selectVarietyAll() {
- productionVarietyService.varietyList();
- productionVarietyDetailService.selectvarietyList();
- productionVarietyDetailService.selectvarietyDetails(1l);
- return VIEW_VARIETY_LIST;
- }
- @RequestMapping("add")
- public String varietyAdd(String materialTypeCode) {
- if (materialTypeCode == null || materialTypeCode.isEmpty()) {
- // 可以抛异常或返回错误页面,这里简化处理
- return VIEW_VARIETY_LIST;
- }
- ProductionVariety productionVariety = createProductionVariety(materialTypeCode);
- productionVarietyService.save(productionVariety);
- return VIEW_VARIETY_LIST;
- }
- @RequestMapping("update")
- public String varietyUpdate(String materialTypeCode) {
- if (materialTypeCode == null || materialTypeCode.isEmpty()) {
- return VIEW_VARIETY_LIST;
- }
- ProductionVariety productionVariety = createProductionVariety(materialTypeCode);
- productionVarietyService.saveOrUpdate(productionVariety);
- return VIEW_VARIETY_LIST;
- }
- private ProductionVariety createProductionVariety(String materialTypeCode) {
- ProductionVariety productionVariety = new ProductionVariety();
- productionVariety.setVariety(materialTypeCode);
- return productionVariety;
- }
- }
|