diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/interfaceback/controller/InterfaceBackController.java b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/interfaceback/controller/InterfaceBackController.java new file mode 100644 index 0000000..892bdb5 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/interfaceback/controller/InterfaceBackController.java @@ -0,0 +1,59 @@ +package org.nl.wms.basedata.master.interfaceback.controller; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.nl.common.TableDataInfo; +import org.nl.common.domain.query.PageQuery; +import org.nl.modules.logging.annotation.Log; +import org.nl.wms.basedata.master.interfaceback.service.IInterfaceBackService; +import org.nl.wms.basedata.master.interfaceback.service.dao.InterfaceBack; +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; + +/** + * @Author: lyd + * @Date: 2024/10/15 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/interfaceback") +@Slf4j +public class InterfaceBackController { + @Autowired + private IInterfaceBackService interfaceBackService; + @GetMapping + @Log("查询接口回传设置") + //@SaCheckPermission("@el.check('interfaceback:list')") + public ResponseEntity query(@RequestParam Map whereJson, PageQuery page) { + return new ResponseEntity<>(TableDataInfo.build(interfaceBackService.queryAll(whereJson, page)), HttpStatus.OK); + } + + @PostMapping + @Log("新增接口回传设置") + //@SaCheckPermission("@el.check('interfaceback:add')") + public ResponseEntity create(@Validated @RequestBody InterfaceBack dto) { + interfaceBackService.create(dto); + return new ResponseEntity<>(HttpStatus.CREATED); + } + + @PutMapping + @Log("修改接口回传设置") + //@SaCheckPermission("@el.check('interfaceback:edit')") + public ResponseEntity update(@Validated @RequestBody InterfaceBack dto) { + interfaceBackService.update(dto); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @Log("删除接口回传设置") + //@SaCheckPermission("@el.check('interfaceback:del')") + @DeleteMapping + public ResponseEntity delete(@RequestBody String[] ids) { + interfaceBackService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/interfaceback/package-info.java b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/interfaceback/package-info.java new file mode 100644 index 0000000..b31bbea --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/interfaceback/package-info.java @@ -0,0 +1,4 @@ +/** + * 接口回传 + */ +package org.nl.wms.basedata.master.interfaceback; diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/interfaceback/service/IInterfaceBackService.java b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/interfaceback/service/IInterfaceBackService.java new file mode 100644 index 0000000..5f58e86 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/interfaceback/service/IInterfaceBackService.java @@ -0,0 +1,57 @@ +package org.nl.wms.basedata.master.interfaceback.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import org.nl.common.domain.query.PageQuery; +import org.nl.wms.basedata.master.interfaceback.service.dao.InterfaceBack; +import org.nl.wms.basedata.master.service.dto.InterfacebackDto; +import org.springframework.data.domain.Pageable; + +import java.util.List; +import java.util.Map; + +/** + * 接口回传 + * @Author: lyd + * @Date: 2024/10/15 + */ +public interface IInterfaceBackService extends IService { + /** + * 查询数据分页 + * + * @param whereJson 条件 + * @param page 分页参数 + * @return Map + */ + IPage queryAll(Map whereJson, PageQuery page); + + /** + * 根据编码查询 + * + * @param code code + * @return Interfaceback + */ + InterfaceBack findByCode(String code); + + + /** + * 创建 + * + * @param dto / + */ + void create(InterfaceBack dto); + + /** + * 编辑 + * + * @param dto / + */ + void update(InterfaceBack dto); + + /** + * 多选删除 + * + * @param ids / + */ + void deleteAll(String[] ids); +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/interfaceback/service/dao/InterfaceBack.java b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/interfaceback/service/dao/InterfaceBack.java new file mode 100644 index 0000000..40c1c74 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/interfaceback/service/dao/InterfaceBack.java @@ -0,0 +1,57 @@ +package org.nl.wms.basedata.master.interfaceback.service.dao; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.List; + +/** + * @Author: lyd + * @Date: 2024/10/15 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@TableName("md_pb_interfaceback") +public class InterfaceBack { + /** 标识 */ + /** + * 防止精度丢失 + */ + @TableId + private String interface_id; + + /** + * 类型 + */ + private String interface_type; + + /** + * 接口名称 + */ + private String interface_name; + + /** + * 接口描述 + */ + private String remark; + + /** + * 是否回传 + */ + private String is_back; + + /** + * 业务说明 + */ + private String business_comment; + + /** + * 业务说明 + */ + private String product_area; + @TableField(exist = false) + private String[] product_areas; +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/interfaceback/service/dao/mapper/InterfaceBackMapper.java b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/interfaceback/service/dao/mapper/InterfaceBackMapper.java new file mode 100644 index 0000000..dd06c65 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/interfaceback/service/dao/mapper/InterfaceBackMapper.java @@ -0,0 +1,11 @@ +package org.nl.wms.basedata.master.interfaceback.service.dao.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.nl.wms.basedata.master.interfaceback.service.dao.InterfaceBack; + +/** + * @Author: lyd + * @Date: 2024/10/15 + */ +public interface InterfaceBackMapper extends BaseMapper { +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/interfaceback/service/dao/mapper/InterfaceBackMapper.xml b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/interfaceback/service/dao/mapper/InterfaceBackMapper.xml new file mode 100644 index 0000000..2542188 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/interfaceback/service/dao/mapper/InterfaceBackMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/interfaceback/service/impl/InterfaceBackServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/interfaceback/service/impl/InterfaceBackServiceImpl.java new file mode 100644 index 0000000..2158eae --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/interfaceback/service/impl/InterfaceBackServiceImpl.java @@ -0,0 +1,87 @@ +package org.nl.wms.basedata.master.interfaceback.service.impl; + +import cn.hutool.core.map.MapUtil; +import cn.hutool.core.util.IdUtil; +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 org.nl.common.domain.query.PageQuery; +import org.nl.modules.common.exception.BadRequestException; +import org.nl.wms.basedata.master.interfaceback.service.IInterfaceBackService; +import org.nl.wms.basedata.master.interfaceback.service.dao.InterfaceBack; +import org.nl.wms.basedata.master.interfaceback.service.dao.mapper.InterfaceBackMapper; +import org.nl.wms.basedata.master.service.dto.InterfacebackDto; +import org.nl.wms.basedata.master.standard.service.dao.ClassStandard; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * @Author: lyd + * @Date: 2024/10/15 + */ +@Service +public class InterfaceBackServiceImpl extends ServiceImpl implements IInterfaceBackService { + @Autowired + private InterfaceBackMapper interfaceBackMapper; + @Override + public IPage queryAll(Map whereJson, PageQuery page) { + String interface_name = MapUtil.getStr(whereJson, "interface_name"); + LambdaQueryWrapper lam = new QueryWrapper().lambda(); + lam.like(ObjectUtil.isNotEmpty(interface_name), InterfaceBack::getInterface_name, interface_name); + IPage pages = new Page<>(page.getPage() + 1, page.getSize()); + interfaceBackMapper.selectPage(pages, lam); + pages.getRecords().forEach(ib -> { + if (ObjectUtil.isEmpty(ib.getProduct_area())) { + return; + } + String product_area = (ib.getProduct_area().replace("[", "").replace("]", "")).replaceAll("\\\"", ""); + ib.setProduct_areas(product_area.split(",")); + }); + return pages; + } + @Override + public InterfaceBack findByCode(String code) { + LambdaQueryWrapper lam = new LambdaQueryWrapper<>(); + lam.eq(InterfaceBack::getInterface_name, code); + InterfaceBack one = getOne(lam); + if (ObjectUtil.isNotEmpty(one.getProduct_area())) { + String product_area = (one.getProduct_area().replace("[", "").replace("]", "")).replaceAll("\\\"", ""); + one.setProduct_areas(product_area.split(",")); + } + return one; + } + + @Override + public void create(InterfaceBack dto) { + dto.setInterface_id(IdUtil.getSnowflake(1, 1).nextIdStr()); + String result = Arrays.toString(dto.getProduct_areas()); + result = result.replaceAll(" ", ""); + dto.setProduct_area(result); + interfaceBackMapper.insert(dto); + } + + @Override + public void update(InterfaceBack dto) { + InterfaceBack entity = this.getById(dto.getInterface_id()); + if (entity == null) { + throw new BadRequestException("被删除或无权限,操作失败!"); + } + String result = Arrays.toString(dto.getProduct_areas()); + result = result.replaceAll(" ", ""); + dto.setProduct_area(result); + interfaceBackMapper.updateById(dto); + } + + @Override + public void deleteAll(String[] ids) { + removeByIds(Arrays.asList(ids)); + } +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/rest/InterfacebackController.java b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/rest/InterfacebackController.java index eef2f5e..1b9fe3c 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/rest/InterfacebackController.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/rest/InterfacebackController.java @@ -21,7 +21,7 @@ import java.util.Map; @RestController @RequiredArgsConstructor -@RequestMapping("/api/interfaceback") +@RequestMapping("/api/interfaceback2") @Slf4j public class InterfacebackController { diff --git a/lms/nladmin-ui/src/views/wms/basedata/master/interfaceback/index.vue b/lms/nladmin-ui/src/views/wms/basedata/master/interfaceback/index.vue index dc61e97..049b95f 100644 --- a/lms/nladmin-ui/src/views/wms/basedata/master/interfaceback/index.vue +++ b/lms/nladmin-ui/src/views/wms/basedata/master/interfaceback/index.vue @@ -71,7 +71,7 @@ - + @@ -105,10 +105,10 @@ - - - - + + + +