56 lines
1.7 KiB
Java
56 lines
1.7 KiB
Java
package com.xkrs.controller;
|
|
|
|
import com.xkrs.encapsulation.PromptMessageEnum;
|
|
import com.xkrs.model.entity.SpecEntity;
|
|
import com.xkrs.model.qo.SpecQo;
|
|
import com.xkrs.service.SpecService;
|
|
import com.xkrs.util.SpecQuery;
|
|
import org.springframework.context.i18n.LocaleContextHolder;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import javax.annotation.Resource;
|
|
import java.util.List;
|
|
import java.util.Locale;
|
|
|
|
import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject;
|
|
|
|
/**
|
|
* @Author: XinYi Song
|
|
* @Date: 2022/1/20 16:01
|
|
*/
|
|
@RestController
|
|
public class SpecController {
|
|
|
|
@Resource
|
|
private SpecService specService;
|
|
|
|
@Resource
|
|
private SpecQuery specQuery;
|
|
|
|
/**
|
|
* 添加规格数据
|
|
*
|
|
* @param specQo
|
|
*/
|
|
@PostMapping("/insertSpec")
|
|
public String insertSpec(@RequestBody SpecQo specQo) {
|
|
return specService.insertSpec(specQo);
|
|
}
|
|
|
|
/**
|
|
* 查询规格信息
|
|
*/
|
|
@GetMapping("/selectSpec")
|
|
public String selectSpec(@RequestParam(required = false, value = "machineTypeNo") String machineTypeNo,
|
|
@RequestParam(required = false, value = "inspectionItemCode") String inspectionItemCode,
|
|
@RequestParam(required = false, value = "craftItemName") String craftItemName) {
|
|
Locale locale = LocaleContextHolder.getLocale();
|
|
List<SpecEntity> specEntities = specQuery.selectSpec(machineTypeNo, inspectionItemCode, craftItemName);
|
|
if (specEntities.isEmpty()) {
|
|
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该零件的规格信息!", locale);
|
|
}
|
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, specEntities, locale);
|
|
}
|
|
|
|
}
|