rev:木箱类型
This commit is contained in:
@@ -8,13 +8,13 @@ import org.nl.common.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -40,9 +40,23 @@ public class MdpbBoxtypeController {
|
||||
|
||||
@PostMapping
|
||||
@Log("新增木箱类型")
|
||||
public ResponseEntity<Object> query(@Validated @RequestBody MdpbBoxtype dao) {
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody MdpbBoxtype dao) {
|
||||
iMdpbBoxtypeService.create(dao);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改木箱类型")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody MdpbBoxtype dao) {
|
||||
iMdpbBoxtypeService.update(dao);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Log("删除木箱类型")
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
|
||||
iMdpbBoxtypeService.delete(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import org.nl.b_lms.storage_manage.database.service.dao.MdpbBoxtype;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -30,4 +31,16 @@ public interface IMdpbBoxtypeService extends IService<MdpbBoxtype> {
|
||||
* @param dao : {实体对象}
|
||||
*/
|
||||
void create(MdpbBoxtype dao);
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param dao: {实体对象}
|
||||
*/
|
||||
void update(MdpbBoxtype dao);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param ids : {集合}
|
||||
*/
|
||||
void delete(Set<String> ids);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ import java.io.Serializable;
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("mdpb_boxtype")
|
||||
@Builder
|
||||
public class MdpbBoxtype implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package org.nl.b_lms.storage_manage.database.service.impl;
|
||||
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -10,11 +12,11 @@ import org.nl.b_lms.storage_manage.database.service.dao.MdpbBoxtype;
|
||||
import org.nl.b_lms.storage_manage.database.service.dao.mapper.MdpbBoxtypeMapper;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -29,8 +31,21 @@ public class MdpbBoxtypeServiceImpl extends ServiceImpl<MdpbBoxtypeMapper, MdpbB
|
||||
|
||||
@Override
|
||||
public IPage<MdpbBoxtype> queryAll(Map whereJson, PageQuery page) {
|
||||
return this.baseMapper.selectPage(new Page<>(page.getPage() + 1, page.getSize()), new QueryWrapper<MdpbBoxtype>()
|
||||
.lambda());
|
||||
// 查询条件
|
||||
LambdaQueryWrapper<MdpbBoxtype> queryWrapper = new QueryWrapper<MdpbBoxtype>().lambda();
|
||||
String box_type = MapUtil.getStr(whereJson, "box_type");
|
||||
String box_name = MapUtil.getStr(whereJson, "box_name");
|
||||
|
||||
if (ObjectUtil.isNotEmpty(box_type)) {
|
||||
queryWrapper.likeRight(MdpbBoxtype::getBox_type, box_type);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(box_name)) {
|
||||
queryWrapper.likeRight(MdpbBoxtype::getBox_name, box_name);
|
||||
}
|
||||
|
||||
return this.baseMapper.selectPage(new Page<>(page.getPage() + 1, page.getSize()),
|
||||
queryWrapper
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -43,4 +58,15 @@ public class MdpbBoxtypeServiceImpl extends ServiceImpl<MdpbBoxtypeMapper, MdpbB
|
||||
}
|
||||
this.baseMapper.insert(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(MdpbBoxtype dao) {
|
||||
this.baseMapper.updateById(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(Set<String> ids) {
|
||||
this.baseMapper.deleteBatchIds(ids);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user