feat: 废箔搬运业务2
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
package org.nl.wms.md.wastefoilrecord.controller;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.md.wastefoilrecord.service.IWastefoilrecordService;
|
||||
import org.nl.wms.md.wastefoilrecord.service.dao.Wastefoilrecord;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
/**
|
||||
* @author lyd
|
||||
* @date 2024-08-15
|
||||
**/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/wastefoilrecord")
|
||||
public class WastefoilrecordController {
|
||||
|
||||
@Autowired
|
||||
private IWastefoilrecordService wastefoilrecordService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询废箔记录")
|
||||
//@SaCheckPermission("wastefoilrecord:list")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page){
|
||||
return new ResponseEntity<>(TableDataInfo.build(wastefoilrecordService.queryAll(whereJson,page)),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增废箔记录")
|
||||
//@SaCheckPermission("wastefoilrecord:add")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody Wastefoilrecord entity){
|
||||
wastefoilrecordService.create(entity);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改废箔记录")
|
||||
//@SaCheckPermission("wastefoilrecord:edit")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody Wastefoilrecord entity){
|
||||
wastefoilrecordService.update(entity);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除废箔记录")
|
||||
//@SaCheckPermission("wastefoilrecord:del")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
|
||||
wastefoilrecordService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package org.nl.wms.md.wastefoilrecord.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.wms.md.wastefoilrecord.service.dao.Wastefoilrecord;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @description 服务接口
|
||||
* @author lyd
|
||||
* @date 2024-08-15
|
||||
**/
|
||||
public interface IWastefoilrecordService extends IService<Wastefoilrecord> {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param pageable 分页参数
|
||||
* @return IPage<Wastefoilrecord>
|
||||
*/
|
||||
IPage<Wastefoilrecord> queryAll(Map whereJson, PageQuery pageable);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param entity /
|
||||
*/
|
||||
void create(Wastefoilrecord entity);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param entity /
|
||||
*/
|
||||
void update(Wastefoilrecord entity);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Set<String> ids);
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package org.nl.wms.md.wastefoilrecord.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @description /
|
||||
* @author lyd
|
||||
* @date 2024-08-15
|
||||
**/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("md_me_wastefoilrecord")
|
||||
public class Wastefoilrecord implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "record_id", type = IdType.NONE)
|
||||
/** 记录id */
|
||||
private String record_id;
|
||||
|
||||
/** 站点号 */
|
||||
private String point_code;
|
||||
|
||||
/** 名称 */
|
||||
private String point_name;
|
||||
|
||||
/** 重量 */
|
||||
private String weight;
|
||||
|
||||
/** 记录时间 */
|
||||
private String create_id;
|
||||
private String create_name;
|
||||
private String create_time;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package org.nl.wms.md.wastefoilrecord.service.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.wms.md.wastefoilrecord.service.dao.Wastefoilrecord;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @date 2024-08-15
|
||||
**/
|
||||
public interface WastefoilrecordMapper extends BaseMapper<Wastefoilrecord> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.wms.md.wastefoilrecord.service.dao.mapper.WastefoilrecordMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,30 @@
|
||||
package org.nl.wms.md.wastefoilrecord.service.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @description /
|
||||
* @author lyd
|
||||
* @date 2024-08-15
|
||||
**/
|
||||
@Data
|
||||
public class WastefoilrecordDto implements Serializable {
|
||||
|
||||
/** 记录id */
|
||||
private String record_id;
|
||||
|
||||
/** 站点号 */
|
||||
private String point_code;
|
||||
|
||||
/** 名称 */
|
||||
private String point_name;
|
||||
|
||||
/** 重量 */
|
||||
private String weight;
|
||||
|
||||
/** 记录时间 */
|
||||
private String record_time;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package org.nl.wms.md.wastefoilrecord.service.dto;
|
||||
|
||||
import org.nl.common.domain.query.BaseQuery;
|
||||
import org.nl.wms.md.wastefoilrecord.service.dao.Wastefoilrecord;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @date 2024-08-15
|
||||
**/
|
||||
public class WastefoilrecordQuery extends BaseQuery<Wastefoilrecord> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package org.nl.wms.md.wastefoilrecord.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.config.language.LangProcess;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.md.wastefoilrecord.service.IWastefoilrecordService;
|
||||
import org.nl.wms.md.wastefoilrecord.service.dao.mapper.WastefoilrecordMapper;
|
||||
import org.nl.wms.md.wastefoilrecord.service.dao.Wastefoilrecord;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @description 服务实现
|
||||
* @author lyd
|
||||
* @date 2024-08-15
|
||||
**/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class WastefoilrecordServiceImpl extends ServiceImpl<WastefoilrecordMapper, Wastefoilrecord> implements IWastefoilrecordService {
|
||||
|
||||
@Autowired
|
||||
private WastefoilrecordMapper wastefoilrecordMapper;
|
||||
|
||||
@Override
|
||||
public IPage<Wastefoilrecord> queryAll(Map whereJson, PageQuery page){
|
||||
LambdaQueryWrapper<Wastefoilrecord> lam = new LambdaQueryWrapper<>();
|
||||
IPage<Wastefoilrecord> pages = new Page<>(page.getPage() + 1, page.getSize());
|
||||
wastefoilrecordMapper.selectPage(pages, lam);
|
||||
return pages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(Wastefoilrecord entity) {
|
||||
entity.setRecord_id(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
wastefoilrecordMapper.insert(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Wastefoilrecord entity) {
|
||||
Wastefoilrecord dto = wastefoilrecordMapper.selectById(entity.getRecord_id());
|
||||
if (dto == null) {
|
||||
throw new BadRequestException(LangProcess.msg("error_SystemAuthError"));
|
||||
}
|
||||
wastefoilrecordMapper.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(Set<String> ids) {
|
||||
// 真删除
|
||||
wastefoilrecordMapper.deleteBatchIds(ids);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user