2025-09-28 09:54:42 +08:00
|
|
|
package com.klp.ems.controller;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
import javax.validation.constraints.*;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
import com.klp.common.annotation.RepeatSubmit;
|
|
|
|
|
import com.klp.common.annotation.Log;
|
|
|
|
|
import com.klp.common.core.controller.BaseController;
|
|
|
|
|
import com.klp.common.core.domain.PageQuery;
|
|
|
|
|
import com.klp.common.core.domain.R;
|
|
|
|
|
import com.klp.common.core.validate.AddGroup;
|
|
|
|
|
import com.klp.common.core.validate.EditGroup;
|
|
|
|
|
import com.klp.common.enums.BusinessType;
|
|
|
|
|
import com.klp.common.utils.poi.ExcelUtil;
|
|
|
|
|
import com.klp.ems.domain.vo.EmsLocationVo;
|
|
|
|
|
import com.klp.ems.domain.bo.EmsLocationBo;
|
|
|
|
|
import com.klp.ems.service.IEmsLocationService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 位置
|
|
|
|
|
*
|
|
|
|
|
* @author Joshi
|
|
|
|
|
* @date 2025-09-28
|
|
|
|
|
*/
|
|
|
|
|
@Validated
|
|
|
|
|
@RequiredArgsConstructor
|
|
|
|
|
@RestController
|
2025-09-28 14:38:41 +08:00
|
|
|
@RequestMapping("/ems/location")
|
2025-09-28 09:54:42 +08:00
|
|
|
public class EmsLocationController extends BaseController {
|
|
|
|
|
|
|
|
|
|
private final IEmsLocationService iEmsLocationService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询位置列表
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("/list")
|
2025-09-28 14:38:41 +08:00
|
|
|
public R<List<EmsLocationVo>> list(EmsLocationBo bo) {
|
|
|
|
|
List<EmsLocationVo> list = iEmsLocationService.queryList(bo);
|
|
|
|
|
return R.ok(list);
|
2025-09-28 09:54:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 导出位置列表
|
|
|
|
|
*/
|
|
|
|
|
@Log(title = "位置", businessType = BusinessType.EXPORT)
|
|
|
|
|
@PostMapping("/export")
|
|
|
|
|
public void export(EmsLocationBo bo, HttpServletResponse response) {
|
|
|
|
|
List<EmsLocationVo> list = iEmsLocationService.queryList(bo);
|
|
|
|
|
ExcelUtil.exportExcel(list, "位置", EmsLocationVo.class, response);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取位置详细信息
|
|
|
|
|
*
|
|
|
|
|
* @param locationId 主键
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("/{locationId}")
|
|
|
|
|
public R<EmsLocationVo> getInfo(@NotNull(message = "主键不能为空")
|
|
|
|
|
@PathVariable Long locationId) {
|
|
|
|
|
return R.ok(iEmsLocationService.queryById(locationId));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 新增位置
|
|
|
|
|
*/
|
|
|
|
|
@Log(title = "位置", businessType = BusinessType.INSERT)
|
|
|
|
|
@RepeatSubmit()
|
|
|
|
|
@PostMapping()
|
|
|
|
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody EmsLocationBo bo) {
|
|
|
|
|
return toAjax(iEmsLocationService.insertByBo(bo));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 修改位置
|
|
|
|
|
*/
|
|
|
|
|
@Log(title = "位置", businessType = BusinessType.UPDATE)
|
|
|
|
|
@RepeatSubmit()
|
|
|
|
|
@PutMapping()
|
|
|
|
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody EmsLocationBo bo) {
|
|
|
|
|
return toAjax(iEmsLocationService.updateByBo(bo));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 删除位置
|
|
|
|
|
*
|
|
|
|
|
* @param locationIds 主键串
|
|
|
|
|
*/
|
|
|
|
|
@Log(title = "位置", businessType = BusinessType.DELETE)
|
|
|
|
|
@DeleteMapping("/{locationIds}")
|
|
|
|
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
|
|
|
|
@PathVariable Long[] locationIds) {
|
|
|
|
|
return toAjax(iEmsLocationService.deleteWithValidByIds(Arrays.asList(locationIds), true));
|
|
|
|
|
}
|
|
|
|
|
}
|