代码更新
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
|
||||
package org.nl.wms.basedata.master.rest;
|
||||
|
||||
|
||||
import org.nl.wms.basedata.master.service.InterfacebackService;
|
||||
import org.nl.wms.basedata.master.service.dto.InterfacebackDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @author liuxy
|
||||
* @date 2022-12-09
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "接口回传设置管理")
|
||||
@RequestMapping("/api/interfaceback")
|
||||
@Slf4j
|
||||
public class InterfacebackController {
|
||||
|
||||
private final InterfacebackService interfacebackService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询接口回传设置")
|
||||
@ApiOperation("查询接口回传设置")
|
||||
//@SaCheckPermission("@el.check('interfaceback:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(interfacebackService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增接口回传设置")
|
||||
@ApiOperation("新增接口回传设置")
|
||||
//@SaCheckPermission("@el.check('interfaceback:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody InterfacebackDto dto) {
|
||||
interfacebackService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改接口回传设置")
|
||||
@ApiOperation("修改接口回传设置")
|
||||
//@SaCheckPermission("@el.check('interfaceback:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody InterfacebackDto dto) {
|
||||
interfacebackService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除接口回传设置")
|
||||
@ApiOperation("删除接口回传设置")
|
||||
//@SaCheckPermission("@el.check('interfaceback:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
interfacebackService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
|
||||
package org.nl.wms.basedata.master.service;
|
||||
|
||||
import org.nl.wms.basedata.master.service.dto.InterfacebackDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @author liuxy
|
||||
* @description 服务接口
|
||||
* @date 2022-12-09
|
||||
**/
|
||||
public interface InterfacebackService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
*
|
||||
* @param whereJson 条件参数
|
||||
* @return List<InterfacebackDto>
|
||||
*/
|
||||
List<InterfacebackDto> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*
|
||||
* @param interface_id ID
|
||||
* @return Interfaceback
|
||||
*/
|
||||
InterfacebackDto findById(Long interface_id);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
*
|
||||
* @param code code
|
||||
* @return Interfaceback
|
||||
*/
|
||||
InterfacebackDto findByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void create(InterfacebackDto dto);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void update(InterfacebackDto dto);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package org.nl.wms.basedata.master.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
|
||||
/**
|
||||
* @author liuxy
|
||||
* @description /
|
||||
* @date 2022-12-09
|
||||
**/
|
||||
@Data
|
||||
public class InterfacebackDto implements Serializable {
|
||||
|
||||
/** 标识 */
|
||||
/**
|
||||
* 防止精度丢失
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long interface_id;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private String interface_type;
|
||||
|
||||
/**
|
||||
* 接口名称
|
||||
*/
|
||||
private String interface_name;
|
||||
|
||||
/**
|
||||
* 接口描述
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 是否回传
|
||||
*/
|
||||
private String is_back;
|
||||
|
||||
/**
|
||||
* 业务说明
|
||||
*/
|
||||
private String business_comment;
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
|
||||
package org.nl.wms.basedata.master.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.wms.basedata.master.service.InterfacebackService;
|
||||
import org.nl.wms.basedata.master.service.dto.InterfacebackDto;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.modules.common.utils.SecurityUtils;
|
||||
import org.nl.modules.wql.core.bean.ResultBean;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
|
||||
/**
|
||||
* @author liuxy
|
||||
* @description 服务实现
|
||||
* @date 2022-12-09
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class InterfacebackServiceImpl implements InterfacebackService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
String interface_name = MapUtil.getStr(whereJson, "interface_name");
|
||||
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("flag", "1");
|
||||
if (ObjectUtil.isNotEmpty(interface_name)) map.put("interface_name","%"+interface_name+"%");
|
||||
|
||||
JSONObject json = WQL.getWO("QMD_PB_INTERFACEBACK").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "interface_type ASC");
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<InterfacebackDto> queryAll(Map whereJson) {
|
||||
WQLObject wo = WQLObject.getWQLObject("md_pb_interfaceback");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(InterfacebackDto.class);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InterfacebackDto findById(Long interface_id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("md_pb_interfaceback");
|
||||
JSONObject json = wo.query("interface_id = '" + interface_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)) {
|
||||
return json.toJavaObject(InterfacebackDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InterfacebackDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("md_pb_interfaceback");
|
||||
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)) {
|
||||
return json.toJavaObject(InterfacebackDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(InterfacebackDto dto) {
|
||||
dto.setInterface_id(IdUtil.getSnowflake(1, 1).nextId());
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("md_pb_interfaceback");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.insert(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(InterfacebackDto dto) {
|
||||
InterfacebackDto entity = this.findById(dto.getInterface_id());
|
||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("md_pb_interfaceback");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.update(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(Long[] ids) {
|
||||
WQLObject wo = WQLObject.getWQLObject("md_pb_interfaceback");
|
||||
for (Long interface_id : ids) {
|
||||
wo.delete("interface_id = '"+interface_id+"'");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
[交易说明]
|
||||
交易名: 接口回传设置分页查询
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.interface_name TYPEAS s_string
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
|
||||
IF 输入.flag = "1"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
md_pb_interfaceback
|
||||
WHERE
|
||||
1=1
|
||||
|
||||
OPTION 输入.interface_name <> ""
|
||||
interface_name like 输入.interface_name
|
||||
ENDOPTION
|
||||
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user