整理格式

This commit is contained in:
刘名喜 2024-10-30 10:48:26 +08:00
parent bd9bf804df
commit 4d3ab0b844

View File

@ -44,11 +44,12 @@ public class MdItemController extends BaseController {
/**
* 列表查询
*
* @param mdItem
* @return
*/
@GetMapping("/list")
public TableDataInfo list(MdItem mdItem){
public TableDataInfo list(MdItem mdItem) {
startPage();
List<MdItem> list = mdItemService.selectMdItemList(mdItem);
return getDataTable(list);
@ -60,8 +61,7 @@ public class MdItemController extends BaseController {
@PreAuthorize("@ss.hasPermi('mes:md:mditem:export')")
@Log(title = "物料管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, MdItem mdItem)
{
public void export(HttpServletResponse response, MdItem mdItem) {
List<MdItem> list = mdItemService.getExeportList(mdItem);
ExcelUtil<MdItem> util = new ExcelUtil<MdItem>(MdItem.class);
util.exportExcel(response, list, "物料产品数据");
@ -69,11 +69,11 @@ public class MdItemController extends BaseController {
/**
* 下载导入模板
*
* @param response
*/
@PostMapping("/importTemplate")
public void importTemplate(HttpServletResponse response)
{
public void importTemplate(HttpServletResponse response) {
ExcelUtil<MdItem> util = new ExcelUtil<MdItem>(MdItem.class);
util.importTemplateExcel(response, "物料产品数据");
}
@ -81,6 +81,7 @@ public class MdItemController extends BaseController {
/**
* 从模板导入供应商数据
*
* @param file
* @param updateSupport
* @return
@ -89,8 +90,7 @@ public class MdItemController extends BaseController {
@Log(title = "物料管理", businessType = BusinessType.IMPORT)
@PreAuthorize("@ss.hasPermi('mes:md:mditem:import')")
@PostMapping("/importData")
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
{
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
ExcelUtil<MdItem> util = new ExcelUtil<MdItem>(MdItem.class);
List<MdItem> mdItemList = util.importExcel(file.getInputStream());
String operName = getUsername();
@ -99,80 +99,81 @@ public class MdItemController extends BaseController {
}
/**
* 主键查询
*
* @param itemId
* @return
*/
@PreAuthorize("@ss.hasPermi('mes:md:mditem:query')")
@GetMapping(value = "/{itemId}")
public AjaxResult getInfo(@PathVariable Long itemId){
public AjaxResult getInfo(@PathVariable Long itemId) {
return AjaxResult.success(mdItemService.selectMdItemById(itemId));
}
/**
* 新增
*
* @param mdItem
* @return
*/
@PreAuthorize("@ss.hasPermi('mes:md:mditem:add')")
@Log(title = "物料管理",businessType = BusinessType.INSERT)
@Log(title = "物料管理", businessType = BusinessType.INSERT)
@BarcodeGen(barcodeType = UserConstants.BARCODE_TYPE_ITEM)
@PostMapping
public AjaxResult add(@Validated @RequestBody MdItem mdItem){
if(UserConstants.NOT_UNIQUE.equals(mdItemService.checkItemCodeUnique(mdItem))){
return AjaxResult.error("新增物料"+mdItem.getItemCode()+"失败,物料编码已存在");
public AjaxResult add(@Validated @RequestBody MdItem mdItem) {
if (UserConstants.NOT_UNIQUE.equals(mdItemService.checkItemCodeUnique(mdItem))) {
return AjaxResult.error("新增物料" + mdItem.getItemCode() + "失败,物料编码已存在");
}
if(UserConstants.NOT_UNIQUE.equals(mdItemService.checkItemNameUnique(mdItem))){
return AjaxResult.error("新增物料"+mdItem.getItemCode()+"失败,物料名称已存在");
if (UserConstants.NOT_UNIQUE.equals(mdItemService.checkItemNameUnique(mdItem))) {
return AjaxResult.error("新增物料" + mdItem.getItemCode() + "失败,物料名称已存在");
}
ItemType type =iItemTypeService.selectItemTypeById(mdItem.getItemTypeId());
if(StringUtils.isNotNull(type)){
ItemType type = iItemTypeService.selectItemTypeById(mdItem.getItemTypeId());
if (StringUtils.isNotNull(type)) {
mdItem.setItemTypeCode(type.getItemTypeCode());
mdItem.setItemTypeName(type.getItemTypeName());
mdItem.setItemOrProduct(type.getItemOrProduct());
}
MdUnitMeasure measure = mdUnitMeasureService.selectMdUnitByCode(mdItem.getUnitOfMeasure());
if(StringUtils.isNotNull(measure)){
if (StringUtils.isNotNull(measure)) {
mdItem.setUnitName(measure.getMeasureName());
}
mdItem.setCreateBy(getUsername());
mdItemService.insertMdItem(mdItem);
barcodeUtil.generateBarCode(UserConstants.BARCODE_TYPE_ITEM,mdItem.getItemId(),mdItem.getItemCode(), mdItem.getItemName());
barcodeUtil.generateBarCode(UserConstants.BARCODE_TYPE_ITEM, mdItem.getItemId(), mdItem.getItemCode(), mdItem.getItemName());
return AjaxResult.success(mdItem.getItemId());
}
/**
* 更新
*
* @param mdItem
* @return
*/
@PreAuthorize("@ss.hasPermi('mes:md:mditem:edit')")
@Log(title = "物料管理",businessType = BusinessType.UPDATE)
@Log(title = "物料管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody MdItem mdItem){
if(UserConstants.NOT_UNIQUE.equals(mdItemService.checkItemCodeUnique(mdItem))){
return AjaxResult.error("新增物料"+mdItem.getItemCode()+"失败,物料编码已存在");
public AjaxResult edit(@Validated @RequestBody MdItem mdItem) {
if (UserConstants.NOT_UNIQUE.equals(mdItemService.checkItemCodeUnique(mdItem))) {
return AjaxResult.error("新增物料" + mdItem.getItemCode() + "失败,物料编码已存在");
}
if(UserConstants.NOT_UNIQUE.equals(mdItemService.checkItemNameUnique(mdItem))){
return AjaxResult.error("新增物料"+mdItem.getItemCode()+"失败,物料名称已存在");
if (UserConstants.NOT_UNIQUE.equals(mdItemService.checkItemNameUnique(mdItem))) {
return AjaxResult.error("新增物料" + mdItem.getItemCode() + "失败,物料名称已存在");
}
ItemType type =iItemTypeService.selectItemTypeById(mdItem.getItemTypeId());
if(StringUtils.isNotNull(type)){
ItemType type = iItemTypeService.selectItemTypeById(mdItem.getItemTypeId());
if (StringUtils.isNotNull(type)) {
mdItem.setItemTypeCode(type.getItemTypeCode());
mdItem.setItemTypeName(type.getItemTypeName());
mdItem.setItemOrProduct(type.getItemOrProduct());
}
if(StringUtils.isNotNull(mdItem.getSafeStockFlag())&& "N".equals(mdItem.getSafeStockFlag())){
if (StringUtils.isNotNull(mdItem.getSafeStockFlag()) && "N".equals(mdItem.getSafeStockFlag())) {
mdItem.setMinStock(0D);
mdItem.setMaxStock(0D);
}
MdUnitMeasure measure = mdUnitMeasureService.selectMdUnitByCode(mdItem.getUnitOfMeasure());
if(StringUtils.isNotNull(measure)){
if (StringUtils.isNotNull(measure)) {
mdItem.setUnitName(measure.getMeasureName());
}
@ -181,9 +182,9 @@ public class MdItemController extends BaseController {
}
@PreAuthorize("@ss.hasPermi('mes:md:mditem:remove')")
@Log(title = "物料管理",businessType = BusinessType.DELETE)
@Log(title = "物料管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{itemIds}")
public AjaxResult remove(@PathVariable Long[] itemIds){
public AjaxResult remove(@PathVariable Long[] itemIds) {
return toAjax(mdItemService.deleteByItemIds(itemIds));
}
}