From 83c128b2f928b7289b5c4c4a16298f69f9941190 Mon Sep 17 00:00:00 2001 From: zxy Date: Fri, 10 Apr 2026 16:12:02 +0800 Subject: [PATCH] =?UTF-8?q?feat(example):=20=E6=B7=BB=E5=8A=A0=E5=BA=93?= =?UTF-8?q?=E5=8C=BA=E5=92=8C=E4=BB=93=E5=82=A8=E7=AE=A1=E7=90=86=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/jnpf/mapper/StoreAreaMapper.java | 11 ++ .../java/jnpf/mapper/StoreHouseMapper.java | 12 ++ .../java/jnpf/service/StoreAreaService.java | 28 +++ .../java/jnpf/service/StoreHouseService.java | 30 ++++ .../service/impl/InspPlanServiceImpl.java | 16 +- .../jnpf/service/impl/MachineServiceImpl.java | 24 +-- .../service/impl/MaterialServiceImpl.java | 16 +- .../jnpf/service/impl/ProLineServiceImpl.java | 20 +-- .../jnpf/service/impl/ProcServiceImpl.java | 20 +-- .../service/impl/StoreAreaServiceImpl.java | 142 +++++++++++++++ .../service/impl/StoreHouseServiceImpl.java | 135 ++++++++++++++ .../jnpf/controller/StoreAreaController.java | 117 ++++++++++++ .../jnpf/controller/StoreHouseController.java | 128 ++++++++++++++ .../jnpf/model/machine/MachineEntity.java | 4 +- .../jnpf/model/material/MaterialEntity.java | 2 +- .../jnpf/model/store/StoreAreaEntity.java | 63 +++++++ .../java/jnpf/model/store/StoreAreaForm.java | 39 ++++ .../jnpf/model/store/StoreAreaPagination.java | 42 +++++ .../jnpf/model/store/StoreHouseEntity.java | 43 +++++ .../java/jnpf/model/store/StoreHouseForm.java | 33 ++++ .../model/store/StoreHousePagination.java | 34 ++++ .../src/views/example/storearea/form.vue | 167 ++++++++++++++++++ .../src/views/example/storearea/index.vue | 159 +++++++++++++++++ .../src/views/example/storehouse/form.vue | 149 ++++++++++++++++ .../src/views/example/storehouse/index.vue | 157 ++++++++++++++++ 25 files changed, 1526 insertions(+), 65 deletions(-) create mode 100644 jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/mapper/StoreAreaMapper.java create mode 100644 jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/mapper/StoreHouseMapper.java create mode 100644 jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/StoreAreaService.java create mode 100644 jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/StoreHouseService.java create mode 100644 jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/StoreAreaServiceImpl.java create mode 100644 jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/StoreHouseServiceImpl.java create mode 100644 jnpf-java-boot/jnpf-example/jnpf-example-controller/src/main/java/jnpf/controller/StoreAreaController.java create mode 100644 jnpf-java-boot/jnpf-example/jnpf-example-controller/src/main/java/jnpf/controller/StoreHouseController.java create mode 100644 jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/model/store/StoreAreaEntity.java create mode 100644 jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/model/store/StoreAreaForm.java create mode 100644 jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/model/store/StoreAreaPagination.java create mode 100644 jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/model/store/StoreHouseEntity.java create mode 100644 jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/model/store/StoreHouseForm.java create mode 100644 jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/model/store/StoreHousePagination.java create mode 100644 jnpf-java-boot/jnpf-web/src/views/example/storearea/form.vue create mode 100644 jnpf-java-boot/jnpf-web/src/views/example/storearea/index.vue create mode 100644 jnpf-java-boot/jnpf-web/src/views/example/storehouse/form.vue create mode 100644 jnpf-java-boot/jnpf-web/src/views/example/storehouse/index.vue diff --git a/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/mapper/StoreAreaMapper.java b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/mapper/StoreAreaMapper.java new file mode 100644 index 0000000..ba22ac2 --- /dev/null +++ b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/mapper/StoreAreaMapper.java @@ -0,0 +1,11 @@ +package jnpf.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import jnpf.model.store.StoreAreaEntity; + +/** + * 库区主数据 Mapper + */ +public interface StoreAreaMapper extends BaseMapper { + +} diff --git a/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/mapper/StoreHouseMapper.java b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/mapper/StoreHouseMapper.java new file mode 100644 index 0000000..904d773 --- /dev/null +++ b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/mapper/StoreHouseMapper.java @@ -0,0 +1,12 @@ +package jnpf.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import jnpf.model.store.StoreHouseEntity; + +/** + * 仓储主数据 Mapper + */ +public interface StoreHouseMapper extends BaseMapper { + +} diff --git a/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/StoreAreaService.java b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/StoreAreaService.java new file mode 100644 index 0000000..de153a8 --- /dev/null +++ b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/StoreAreaService.java @@ -0,0 +1,28 @@ +package jnpf.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import jnpf.model.store.StoreAreaEntity; +import jnpf.model.store.StoreAreaForm; +import jnpf.model.store.StoreAreaPagination; + +import java.util.List; + +/** + * 库区主数据 Service + */ +public interface StoreAreaService extends IService { + + List getList(StoreAreaPagination storeAreaPagination); + + StoreAreaEntity getInfo(String id); + + void delete(StoreAreaEntity entity); + + void create(StoreAreaEntity entity); + + boolean update(String id, StoreAreaEntity entity); + + String checkForm(StoreAreaForm form, int type); + + void saveOrUpdate(StoreAreaForm storeAreaForm, String id, boolean isSave) throws Exception; +} diff --git a/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/StoreHouseService.java b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/StoreHouseService.java new file mode 100644 index 0000000..5e1bc33 --- /dev/null +++ b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/StoreHouseService.java @@ -0,0 +1,30 @@ +package jnpf.service; + + +import com.baomidou.mybatisplus.extension.service.IService; +import jnpf.model.store.StoreHouseEntity; +import jnpf.model.store.StoreHouseForm; +import jnpf.model.store.StoreHousePagination; + +import java.util.List; + +/** + * 仓储主数据 Service + */ +public interface StoreHouseService extends IService { + + + List getList(StoreHousePagination storeHousePagination); + StoreHouseEntity getInfo(String id); + + void delete(StoreHouseEntity entity); + + void create(StoreHouseEntity entity); + + boolean update(String id, StoreHouseEntity entity); + String checkForm(StoreHouseForm form, int i); + void saveOrUpdate(StoreHouseForm storeHouseForm, String id, boolean isSave) throws Exception; + + List getSelectorList(); + +} diff --git a/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/InspPlanServiceImpl.java b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/InspPlanServiceImpl.java index 5320c54..8765bd4 100644 --- a/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/InspPlanServiceImpl.java +++ b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/InspPlanServiceImpl.java @@ -6,15 +6,14 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import jnpf.base.UserInfo; +import jnpf.mapper.InspPlanMapper; import jnpf.model.inspplan.InspPlanEntity; import jnpf.model.inspplan.InspPlanForm; -import jnpf.mapper.InspPlanMapper; import jnpf.model.inspplan.InspPlanPagination; import jnpf.service.InspPlanService; -import jnpf.util.JsonUtil; import jnpf.util.StringUtil; import jnpf.util.UserProvider; +import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -123,14 +122,11 @@ public class InspPlanServiceImpl extends ServiceImpl page = new Page<>(machinePagination.getCurrentPage(), machinePagination.getPageSize()); @@ -160,16 +159,11 @@ public class MachineServiceImpl extends ServiceImpl page = new Page<>(proLinePagination.getCurrentPage(), proLinePagination.getPageSize()); @@ -121,16 +120,11 @@ public class ProLineServiceImpl extends ServiceImpl impleme if (ObjectUtil.isNotEmpty(procPagination.getEnabledStatus())) { procWrapper.eq(ProcEntity::getEnabledStatus, procPagination.getEnabledStatus()); } - procWrapper.eq(ProcEntity::getDeleteMark,0); + procWrapper.eq(ProcEntity::getDeleteMark, 0); procWrapper.orderByDesc(ProcEntity::getCreatorTime); if ("0".equals(procPagination.getDataType())) { Page page = new Page<>(procPagination.getCurrentPage(), procPagination.getPageSize()); @@ -124,16 +123,11 @@ public class ProcServiceImpl extends ServiceImpl impleme @Override @Transactional public void saveOrUpdate(ProcForm procForm, String id, boolean isSave) throws Exception { - UserInfo userInfo = userProvider.get(); - ProcEntity entity = JsonUtil.getJsonToBean(procForm, ProcEntity.class); - - if (!isSave) { - // 更新时设置ID - if (StringUtil.isNotEmpty(id)) { - entity.setId(Long.valueOf(id)); - } + ProcEntity entity = getInfo(id); + if (entity == null) { + entity = new ProcEntity(); } - // 新增时ID由数据库自动生成,不需要设置 + BeanUtils.copyProperties(procForm, entity); this.saveOrUpdate(entity); } diff --git a/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/StoreAreaServiceImpl.java b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/StoreAreaServiceImpl.java new file mode 100644 index 0000000..b7f571a --- /dev/null +++ b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/StoreAreaServiceImpl.java @@ -0,0 +1,142 @@ +package jnpf.service.impl; + + +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; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import jnpf.mapper.StoreAreaMapper; +import jnpf.model.store.StoreAreaEntity; +import jnpf.model.store.StoreAreaForm; +import jnpf.model.store.StoreAreaPagination; +import jnpf.model.store.StoreHouseEntity; +import jnpf.service.StoreAreaService; +import jnpf.service.StoreHouseService; +import jnpf.util.StringUtil; +import jnpf.util.UserProvider; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 库区主数据 ServiceImpl + */ +@Service +public class StoreAreaServiceImpl extends ServiceImpl implements StoreAreaService { + + @Resource + private UserProvider userProvider; + + @Resource + private StoreHouseService storeHouseService; + + @Override + public List getList(StoreAreaPagination storeAreaPagination) { + LambdaQueryWrapper storeAreaWrapper = new LambdaQueryWrapper<>(); + + if (ObjectUtil.isNotEmpty(storeAreaPagination.getStoreAreCd())) { + storeAreaWrapper.like(StoreAreaEntity::getStoreAreCd, storeAreaPagination.getStoreAreCd()); + } + if (ObjectUtil.isNotEmpty(storeAreaPagination.getStoreAreaName())) { + storeAreaWrapper.like(StoreAreaEntity::getStoreAreaName, storeAreaPagination.getStoreAreaName()); + } + if (ObjectUtil.isNotEmpty(storeAreaPagination.getEnabledStatus())) { + storeAreaWrapper.eq(StoreAreaEntity::getEnabledStatus, storeAreaPagination.getEnabledStatus()); + } + if (ObjectUtil.isNotEmpty(storeAreaPagination.getStoreHouseId())) { + storeAreaWrapper.eq(StoreAreaEntity::getStoreHouseId, storeAreaPagination.getStoreHouseId()); + } + storeAreaWrapper.eq(StoreAreaEntity::getDeleteMark, 0); + storeAreaWrapper.orderByDesc(StoreAreaEntity::getCreatorTime); + List storeAreaList; + if ("0".equals(storeAreaPagination.getDataType())) { + Page page = new Page<>(storeAreaPagination.getCurrentPage(), storeAreaPagination.getPageSize()); + IPage userIPage = this.page(page, storeAreaWrapper); + storeAreaList = storeAreaPagination.setData(userIPage.getRecords(), userIPage.getTotal()); + } else { + storeAreaList = this.list(storeAreaWrapper); + } + for (StoreAreaEntity storeAreaEntity : storeAreaList) { + StoreHouseEntity storeHouseEntity = storeHouseService.getInfo(storeAreaEntity.getStoreHouseId()); + if (storeHouseEntity != null) { + storeAreaEntity.setStoreHouseName(storeHouseEntity.getStoreHouseName()); + } + } + return storeAreaList; + } + + @Override + public StoreAreaEntity getInfo(String id) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().eq(StoreAreaEntity::getId, id); + return this.getOne(queryWrapper); + } + + @Override + public void create(StoreAreaEntity entity) { + this.save(entity); + } + + @Override + public boolean update(String id, StoreAreaEntity entity) { + return this.updateById(entity); + } + + @Override + public void delete(StoreAreaEntity entity) { + if (entity != null) { + this.removeById(entity.getId()); + } + } + + /** + * 验证表单唯一字段,正则,非空 i-0新增-1修改 + */ + @Override + public String checkForm(StoreAreaForm form, int i) { + boolean isUp = StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0"); + String id = ""; + String countRecover = ""; + if (isUp) { + id = form.getId(); + } + //主表字段验证 + //库区编码唯一性验证 + if (ObjectUtil.isNotEmpty(form.getStoreAreCd())) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(StoreAreaEntity::getStoreAreCd, form.getStoreAreCd()); + if (isUp) { + wrapper.ne(StoreAreaEntity::getId, id); + } + long count = this.count(wrapper); + if (count > 0) { + countRecover += "库区编码已存在,请重新输入!"; + } + } + + return countRecover; + } + + /** + * 新增修改数据(事务回滚) + * + * @param id + * @param storeAreaForm + * @return + */ + @Override + public void saveOrUpdate(StoreAreaForm storeAreaForm, String id, boolean isSave) throws Exception { + StoreAreaEntity entity = getInfo(id); + if (entity == null) { + // 新增时初始化数据 + entity = new StoreAreaEntity(); + } + BeanUtils.copyProperties(storeAreaForm, entity); + this.saveOrUpdate(entity); + } + +} diff --git a/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/StoreHouseServiceImpl.java b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/StoreHouseServiceImpl.java new file mode 100644 index 0000000..1f825a6 --- /dev/null +++ b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/StoreHouseServiceImpl.java @@ -0,0 +1,135 @@ +package jnpf.service.impl; + +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; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import jnpf.mapper.StoreHouseMapper; +import jnpf.model.store.StoreHouseEntity; +import jnpf.model.store.StoreHouseForm; +import jnpf.model.store.StoreHousePagination; +import jnpf.service.StoreHouseService; +import jnpf.util.StringUtil; +import jnpf.util.UserProvider; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 仓储主数据 ServiceImpl + */ +@Service +public class StoreHouseServiceImpl extends ServiceImpl implements StoreHouseService { + + @Resource + private UserProvider userProvider; + + @Override + public List getList(StoreHousePagination storeHousePagination) { + LambdaQueryWrapper storeHouseWrapper = new LambdaQueryWrapper<>(); + + if (ObjectUtil.isNotEmpty(storeHousePagination.getStoreHouseCd())) { + storeHouseWrapper.like(StoreHouseEntity::getStoreHouseCd, storeHousePagination.getStoreHouseCd()); + } + if (ObjectUtil.isNotEmpty(storeHousePagination.getStoreHouseName())) { + storeHouseWrapper.like(StoreHouseEntity::getStoreHouseName, storeHousePagination.getStoreHouseName()); + } + if (ObjectUtil.isNotEmpty(storeHousePagination.getEnabledStatus())) { + storeHouseWrapper.eq(StoreHouseEntity::getEnabledStatus, storeHousePagination.getEnabledStatus()); + } + storeHouseWrapper.eq(StoreHouseEntity::getDeleteMark, 0); + storeHouseWrapper.orderByDesc(StoreHouseEntity::getCreatorTime); + if ("0".equals(storeHousePagination.getDataType())) { + Page page = new Page<>(storeHousePagination.getCurrentPage(), storeHousePagination.getPageSize()); + IPage userIPage = this.page(page, storeHouseWrapper); + return storeHousePagination.setData(userIPage.getRecords(), userIPage.getTotal()); + } else { + return this.list(storeHouseWrapper); + } + } + + @Override + public StoreHouseEntity getInfo(String id) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().eq(StoreHouseEntity::getId, id); + return this.getOne(queryWrapper); + } + + @Override + public void create(StoreHouseEntity entity) { + this.save(entity); + } + + @Override + public boolean update(String id, StoreHouseEntity entity) { + return this.updateById(entity); + } + + @Override + public void delete(StoreHouseEntity entity) { + if (entity != null) { + this.removeById(entity.getId()); + } + } + + /** + * 验证表单唯一字段,正则,非空 i-0新增-1修改 + */ + @Override + public String checkForm(StoreHouseForm form, int i) { + boolean isUp = StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0"); + String id = ""; + String countRecover = ""; + if (isUp) { + id = form.getId(); + } + //主表字段验证 + //仓储编码唯一性验证 + if (ObjectUtil.isNotEmpty(form.getStoreHouseCd())) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(StoreHouseEntity::getStoreHouseCd, form.getStoreHouseCd()); + if (isUp) { + wrapper.ne(StoreHouseEntity::getId, id); + } + long count = this.count(wrapper); + if (count > 0) { + countRecover += "仓储编码已存在,请重新输入!"; + } + } + + return countRecover; + } + + /** + * 新增修改数据(事务回滚) + * + * @param id + * @param storeHouseForm + * @return + */ + @Override + @Transactional + public void saveOrUpdate(StoreHouseForm storeHouseForm, String id, boolean isSave) throws Exception { + StoreHouseEntity entity = getInfo(id); + if (entity == null) { + entity = new StoreHouseEntity(); + } + BeanUtils.copyProperties(storeHouseForm, entity); + this.saveOrUpdate(entity); + } + + @Override + public List getSelectorList() { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(StoreHouseEntity::getDeleteMark, 0); + wrapper.eq(StoreHouseEntity::getEnabledStatus, 1); + wrapper.orderByDesc(StoreHouseEntity::getCreatorTime); + return this.list(wrapper); + } + +} diff --git a/jnpf-java-boot/jnpf-example/jnpf-example-controller/src/main/java/jnpf/controller/StoreAreaController.java b/jnpf-java-boot/jnpf-example/jnpf-example-controller/src/main/java/jnpf/controller/StoreAreaController.java new file mode 100644 index 0000000..8a6a37a --- /dev/null +++ b/jnpf-java-boot/jnpf-example/jnpf-example-controller/src/main/java/jnpf/controller/StoreAreaController.java @@ -0,0 +1,117 @@ + +package jnpf.controller; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import jnpf.base.ActionResult; +import jnpf.base.vo.PageListVO; +import jnpf.base.vo.PaginationVO; +import jnpf.model.store.StoreAreaEntity; +import jnpf.model.store.StoreAreaForm; +import jnpf.model.store.StoreAreaPagination; +import jnpf.service.StoreAreaService; +import jnpf.util.JsonUtil; +import jnpf.util.StringUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * 库区主数据 控制类 + */ +@Tag(name = "库区主数据", description = "StoreArea") +@RestController +@RequestMapping("/api/example/storearea") +public class StoreAreaController { + + @Autowired + private StoreAreaService storeAreaService; + + /** + * 列表 + * @param storeAreaPagination 分页查询对象 + * @return 列表结果集 + */ + @Operation(summary = "获取库区列表") + @PostMapping("/getList") + public ActionResult getList(@RequestBody StoreAreaPagination storeAreaPagination) { + List list = storeAreaService.getList(storeAreaPagination); + List> realList = list.stream() + .map(JsonUtil::entityToMap) + .collect(Collectors.toList()); + + //返回对象 + PageListVO vo = new PageListVO(); + vo.setList(realList); + PaginationVO page = JsonUtil.getJsonToBean(storeAreaPagination, PaginationVO.class); + vo.setPagination(page); + return ActionResult.success(vo); + } + + /** + * 详情 + * @param id 主键 + * @return 详情结果集 + */ + @Operation(summary = "获取库区详情") + @GetMapping("/{id}") + public ActionResult info(@PathVariable("id") String id) { + StoreAreaEntity entity = storeAreaService.getInfo(id); + if (entity != null) { + return ActionResult.success(JsonUtil.entityToMap(entity)); + } + return ActionResult.fail("数据不存在"); + } + + /** + * 新建 + * @param storeAreaForm 表单对象 + * @return 新建结果 + */ + @Operation(summary = "新建库区") + @PostMapping + public ActionResult create(@RequestBody @Valid StoreAreaForm storeAreaForm) { + String b = storeAreaService.checkForm(storeAreaForm, 0); + if (StringUtil.isNotEmpty(b)) { + return ActionResult.fail(b); + } + try { + storeAreaService.saveOrUpdate(storeAreaForm, "", true); + return ActionResult.success("新建成功"); + } catch (Exception e) { + return ActionResult.fail("新建数据失败:" + e.getMessage()); + } + } + + /** + * 编辑 + * @param id 主键 + * @param storeAreaForm 表单对象 + * @return 编辑结果 + */ + @Operation(summary = "更新库区") + @PutMapping("/{id}") + public ActionResult update(@PathVariable("id") String id, @RequestBody @Valid StoreAreaForm storeAreaForm) { + storeAreaForm.setId(id); + String b = storeAreaService.checkForm(storeAreaForm, 1); + if (StringUtil.isNotEmpty(b)) { + return ActionResult.fail(b); + } + StoreAreaEntity entity = storeAreaService.getInfo(id); + if (entity != null) { + try { + storeAreaService.saveOrUpdate(storeAreaForm, id, false); + return ActionResult.success("更新成功"); + } catch (Exception e) { + return ActionResult.fail("更新数据失败:" + e.getMessage()); + } + } else { + return ActionResult.fail("更新失败,数据不存在"); + } + } + +} diff --git a/jnpf-java-boot/jnpf-example/jnpf-example-controller/src/main/java/jnpf/controller/StoreHouseController.java b/jnpf-java-boot/jnpf-example/jnpf-example-controller/src/main/java/jnpf/controller/StoreHouseController.java new file mode 100644 index 0000000..6526159 --- /dev/null +++ b/jnpf-java-boot/jnpf-example/jnpf-example-controller/src/main/java/jnpf/controller/StoreHouseController.java @@ -0,0 +1,128 @@ +package jnpf.controller; + + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import jnpf.base.ActionResult; +import jnpf.base.vo.PageListVO; +import jnpf.base.vo.PaginationVO; +import jnpf.model.store.StoreHouseEntity; +import jnpf.model.store.StoreHouseForm; +import jnpf.model.store.StoreHousePagination; +import jnpf.service.StoreHouseService; +import jnpf.util.JsonUtil; +import jnpf.util.StringUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * 仓储主数据 控制类 + */ +@Tag(name = "仓储主数据", description = "StoreHouse") +@RestController +@RequestMapping("/api/example/storehouse") +public class StoreHouseController { + + @Autowired + private StoreHouseService storeHouseService; + + /** + * 列表 + * @param storeHousePagination 分页查询对象 + * @return 列表结果集 + */ + @Operation(summary = "获取仓储列表") + @PostMapping("/getList") + public ActionResult getList(@RequestBody StoreHousePagination storeHousePagination) { + List list = storeHouseService.getList(storeHousePagination); + List> realList = list.stream() + .map(JsonUtil::entityToMap) + .collect(Collectors.toList()); + + //返回对象 + PageListVO vo = new PageListVO(); + vo.setList(realList); + PaginationVO page = JsonUtil.getJsonToBean(storeHousePagination, PaginationVO.class); + vo.setPagination(page); + return ActionResult.success(vo); + } + + /** + * 详情 + * @param id 主键 + * @return 详情结果集 + */ + @Operation(summary = "获取仓储详情") + @GetMapping("/{id}") + public ActionResult info(@PathVariable("id") String id) { + StoreHouseEntity entity = storeHouseService.getInfo(id); + if (entity != null) { + return ActionResult.success(JsonUtil.entityToMap(entity)); + } + return ActionResult.fail("数据不存在"); + } + + /** + * 新建 + * @param storeHouseForm 表单对象 + * @return 新建结果 + */ + @Operation(summary = "新建仓储") + @PostMapping + public ActionResult create(@RequestBody @Valid StoreHouseForm storeHouseForm) { + String b = storeHouseService.checkForm(storeHouseForm, 0); + if (StringUtil.isNotEmpty(b)) { + return ActionResult.fail(b); + } + try { + storeHouseService.saveOrUpdate(storeHouseForm, "", true); + return ActionResult.success("新建成功"); + } catch (Exception e) { + return ActionResult.fail("新建数据失败:" + e.getMessage()); + } + } + + /** + * 编辑 + * @param id 主键 + * @param storeHouseForm 表单对象 + * @return 编辑结果 + */ + @Operation(summary = "更新仓储") + @PutMapping("/{id}") + public ActionResult update(@PathVariable("id") String id, @RequestBody @Valid StoreHouseForm storeHouseForm) { + storeHouseForm.setId(id); + String b = storeHouseService.checkForm(storeHouseForm, 1); + if (StringUtil.isNotEmpty(b)) { + return ActionResult.fail(b); + } + StoreHouseEntity entity = storeHouseService.getInfo(id); + if (entity != null) { + try { + storeHouseService.saveOrUpdate(storeHouseForm, id, false); + return ActionResult.success("更新成功"); + } catch (Exception e) { + return ActionResult.fail("更新数据失败:" + e.getMessage()); + } + } else { + return ActionResult.fail("更新失败,数据不存在"); + } + } + + /** + * 获取仓储下拉列表 + * @return 下拉列表结果集 + */ + @Operation(summary = "获取仓储下拉列表") + @GetMapping("/getSelector") + public ActionResult getSelector() { + List list = storeHouseService.getSelectorList(); + return ActionResult.success(list); + } + +} diff --git a/jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/model/machine/MachineEntity.java b/jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/model/machine/MachineEntity.java index 628064b..ceb995e 100644 --- a/jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/model/machine/MachineEntity.java +++ b/jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/model/machine/MachineEntity.java @@ -41,9 +41,9 @@ public class MachineEntity { @TableField(value = "remark", updateStrategy = FieldStrategy.IGNORED) private String remark; @TableField(value = "belg_line_id", updateStrategy = FieldStrategy.IGNORED) - private Long belgLineId; + private String belgLineId; @TableField(value = "belg_proc_id", updateStrategy = FieldStrategy.IGNORED) - private Long belgProcId; + private String belgProcId; @TableField(exist = false) private String belgLineName; diff --git a/jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/model/material/MaterialEntity.java b/jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/model/material/MaterialEntity.java index 8b70365..3d9c059 100644 --- a/jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/model/material/MaterialEntity.java +++ b/jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/model/material/MaterialEntity.java @@ -73,7 +73,7 @@ public class MaterialEntity { private BigDecimal safeStock; @TableField(value = "scheme_id", updateStrategy = FieldStrategy.IGNORED) - private Long schemeId; + private String schemeId; @TableField(exist = false) private String schemeName; diff --git a/jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/model/store/StoreAreaEntity.java b/jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/model/store/StoreAreaEntity.java new file mode 100644 index 0000000..481862d --- /dev/null +++ b/jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/model/store/StoreAreaEntity.java @@ -0,0 +1,63 @@ + +package jnpf.model.store; + +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; + +import java.util.Date; + +/** + * 库区主数据 + */ +@Data +@TableName("tba_store_area") +public class StoreAreaEntity { + + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @TableField(value = "f_creator_user_id", fill = FieldFill.INSERT) + private String creatorUserId; + + @TableField(value = "f_creator_time", fill = FieldFill.INSERT) + private Date creatorTime; + + @TableField(value = "f_last_modify_user_id", fill = FieldFill.INSERT_UPDATE) + private String lastModifyUserId; + + @TableField(value = "f_last_modify_time", fill = FieldFill.INSERT_UPDATE) + private Date lastModifyTime; + + @TableField(value = "f_delete_user_id", fill = FieldFill.UPDATE) + private String deleteUserId; + + @TableField(value = "f_delete_time", fill = FieldFill.UPDATE) + private Date deleteTime; + + @TableField(value = "f_delete_mark", updateStrategy = FieldStrategy.IGNORED) + private Integer deleteMark; + + @TableField(value = "f_flow_id", updateStrategy = FieldStrategy.IGNORED) + private String flowId; + + @TableField(value = "f_flow_task_id", updateStrategy = FieldStrategy.IGNORED) + private String flowTaskId; + + @TableField("store_are_cd") + private String storeAreCd; + + @TableField("store_area_name") + private String storeAreaName; + + @TableField(value = "enabled_status", updateStrategy = FieldStrategy.IGNORED) + private Integer enabledStatus; + + @TableField(value = "remark", updateStrategy = FieldStrategy.IGNORED) + private String remark; + + @TableField(value = "store_house_id", updateStrategy = FieldStrategy.IGNORED) + private String storeHouseId; + + @TableField(exist = false) + private String storeHouseName; +} diff --git a/jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/model/store/StoreAreaForm.java b/jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/model/store/StoreAreaForm.java new file mode 100644 index 0000000..a4cf2bc --- /dev/null +++ b/jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/model/store/StoreAreaForm.java @@ -0,0 +1,39 @@ +package jnpf.model.store; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * 库区主数据 Form + */ +@Data +public class StoreAreaForm { + + @Schema(description = "主键") + private String id; + + @NotBlank(message = "库区编码不能为空") + @Schema(description = "库区编码") + private String storeAreCd; + + @NotBlank(message = "库区名称不能为空") + @Schema(description = "库区名称") + private String storeAreaName; + + @Schema(description = "状态(1启用 2 未启用)") + private Integer enabledStatus; + + @Schema(description = "备注") + private String remark; + + @Schema(description = "仓库id") + private Integer storeHouseId; + + @Schema(description = "流程ID") + private String flowId; + + @Schema(description = "流程任务ID") + private String flowTaskId; +} diff --git a/jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/model/store/StoreAreaPagination.java b/jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/model/store/StoreAreaPagination.java new file mode 100644 index 0000000..2ecca49 --- /dev/null +++ b/jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/model/store/StoreAreaPagination.java @@ -0,0 +1,42 @@ +package jnpf.model.store; + +import jnpf.base.Pagination; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + * 库区主数据分页查询 + */ +@Data +public class StoreAreaPagination extends Pagination { + + @Schema(description = "selectKey") + private String selectKey; + + @Schema(description = "json") + private String json; + + @Schema(description = "数据类型") + private String dataType; + + @Schema(description = "特殊查询json") + private String superQueryJson; + + @Schema(description = "模块id") + private String moduleId; + + @Schema(description = "菜单id") + private String menuId; + + @Schema(description = "库区编码") + private String storeAreCd; + + @Schema(description = "库区名称") + private String storeAreaName; + + @Schema(description = "状态(1启用 2 未启用)") + private Integer enabledStatus; + + @Schema(description = "仓库id") + private Integer storeHouseId; +} diff --git a/jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/model/store/StoreHouseEntity.java b/jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/model/store/StoreHouseEntity.java new file mode 100644 index 0000000..5901c35 --- /dev/null +++ b/jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/model/store/StoreHouseEntity.java @@ -0,0 +1,43 @@ +package jnpf.model.store; + +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; + +import java.util.Date; + +/** + * 仓储主数据表 + */ +@Data +@TableName("tba_store_house") +public class StoreHouseEntity { + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + @TableField(value = "f_creator_user_id", fill = FieldFill.INSERT) + private String creatorUserId; + @TableField(value = "f_creator_time", fill = FieldFill.INSERT) + private Date creatorTime; + @TableField(value = "f_last_modify_user_id", fill = FieldFill.INSERT_UPDATE) + private String lastModifyUserId; + @TableField(value = "f_last_modify_time", fill = FieldFill.INSERT_UPDATE) + private Date lastModifyTime; + @TableField(value = "f_delete_user_id", fill = FieldFill.UPDATE) + private String deleteUserId; + @TableField(value = "f_delete_time", fill = FieldFill.UPDATE) + private Date deleteTime; + @TableField(value = "f_delete_mark", updateStrategy = FieldStrategy.IGNORED) + private Integer deleteMark; + @TableField(value = "f_flow_id") + private String flowId; + @TableField(value = "f_flow_task_id") + private String flowTaskId; + @TableField("store_house_cd") + private String storeHouseCd; + @TableField("store_house_name") + private String storeHouseName; + @TableField(value = "enabled_status", updateStrategy = FieldStrategy.IGNORED) + private Integer enabledStatus; + @TableField(value = "remark", updateStrategy = FieldStrategy.IGNORED) + private String remark; + +} diff --git a/jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/model/store/StoreHouseForm.java b/jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/model/store/StoreHouseForm.java new file mode 100644 index 0000000..eda9b22 --- /dev/null +++ b/jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/model/store/StoreHouseForm.java @@ -0,0 +1,33 @@ +package jnpf.model.store; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + * 仓储主数据 Form + */ +@Data +public class StoreHouseForm { + + @Schema(description = "主键") + private String id; + + @Schema(description = "仓储编码") + private String storeHouseCd; + + @Schema(description = "仓储名称") + private String storeHouseName; + + @Schema(description = "状态(1启用 2 未启用)") + private Integer enabledStatus; + + @Schema(description = "备注") + private String remark; + + @Schema(description = "流程ID") + private String flowId; + + @Schema(description = "流程任务ID") + private String flowTaskId; + +} diff --git a/jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/model/store/StoreHousePagination.java b/jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/model/store/StoreHousePagination.java new file mode 100644 index 0000000..696e4df --- /dev/null +++ b/jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/model/store/StoreHousePagination.java @@ -0,0 +1,34 @@ +package jnpf.model.store; + +import jnpf.base.Pagination; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + * 仓储主数据分页查询 + */ +@Data +public class StoreHousePagination extends Pagination { + /** 查询key */ + private String[] selectKey; + /** json */ + private String json; + /** 数据类型 0-当前页,1-全部数据 */ + private String dataType; + /** 高级查询 */ + private String superQueryJson; + /** 功能id */ + private String moduleId; + /** 菜单id */ + private String menuId; + + @Schema(description = "仓储编码") + private String storeHouseCd; + + @Schema(description = "仓储名称") + private String storeHouseName; + + @Schema(description = "状态(1启用 2 未启用)") + private Integer enabledStatus; + +} diff --git a/jnpf-java-boot/jnpf-web/src/views/example/storearea/form.vue b/jnpf-java-boot/jnpf-web/src/views/example/storearea/form.vue new file mode 100644 index 0000000..96546ab --- /dev/null +++ b/jnpf-java-boot/jnpf-web/src/views/example/storearea/form.vue @@ -0,0 +1,167 @@ + + + diff --git a/jnpf-java-boot/jnpf-web/src/views/example/storearea/index.vue b/jnpf-java-boot/jnpf-web/src/views/example/storearea/index.vue new file mode 100644 index 0000000..508a924 --- /dev/null +++ b/jnpf-java-boot/jnpf-web/src/views/example/storearea/index.vue @@ -0,0 +1,159 @@ + + + diff --git a/jnpf-java-boot/jnpf-web/src/views/example/storehouse/form.vue b/jnpf-java-boot/jnpf-web/src/views/example/storehouse/form.vue new file mode 100644 index 0000000..5f551bb --- /dev/null +++ b/jnpf-java-boot/jnpf-web/src/views/example/storehouse/form.vue @@ -0,0 +1,149 @@ +NEW_FILE_CODE + + + diff --git a/jnpf-java-boot/jnpf-web/src/views/example/storehouse/index.vue b/jnpf-java-boot/jnpf-web/src/views/example/storehouse/index.vue new file mode 100644 index 0000000..d3189a0 --- /dev/null +++ b/jnpf-java-boot/jnpf-web/src/views/example/storehouse/index.vue @@ -0,0 +1,157 @@ +NEW_FILE_CODE + + +