Browse Source

[update]:redis还原,BOM新增页面料号下拉查询修复

dev
youjianchi 7 months ago
parent
commit
84283ae246
  1. 8
      ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpMaterialController.java
  2. 16
      ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpMaterialVo.java
  3. 36
      ruoyi-admin/src/main/resources/application-druid.yml
  4. 1
      ruoyi-admin/src/main/resources/mapper/erp/ErpMaterialMapper.xml
  5. 26
      ruoyi-admin/src/main/resources/templates/erp/bom/add.html
  6. 11
      ruoyi-common/pom.xml
  7. 10
      ruoyi-common/src/main/java/com/ruoyi/common/utils/DictUtils.java
  8. 3
      ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/DictService.java

8
ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpMaterialController.java

@ -369,4 +369,12 @@ public class ErpMaterialController extends BaseController
erpMaterialProductItemService.insertSysErpMaterialProductItem(sysErpMaterialProductItem); erpMaterialProductItemService.insertSysErpMaterialProductItem(sysErpMaterialProductItem);
return "保存成功"; return "保存成功";
} }
@RequestMapping("/getMaterialSelList")
@ResponseBody
public AjaxResult getMaterialSelList(@RequestParam(required = false,value = "keyword")String keyword){
ErpMaterialVo materialVo = new ErpMaterialVo();
materialVo.setKeyword(keyword);
return success(erpMaterialMapper.selectErpMaterialList(materialVo));
}
} }

16
ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpMaterialVo.java

@ -25,6 +25,11 @@ public class ErpMaterialVo extends ErpMaterial {
/** 流程实例类型名称 */ /** 流程实例类型名称 */
private String instanceTypeName; private String instanceTypeName;
/**
* 关键词
*/
private String keyword;
public String getApplyUserName() { public String getApplyUserName() {
return applyUserName; return applyUserName;
} }
@ -89,6 +94,14 @@ public class ErpMaterialVo extends ErpMaterial {
this.instanceTypeName = instanceTypeName; this.instanceTypeName = instanceTypeName;
} }
public String getKeyword() {
return keyword;
}
public void setKeyword(String keyword) {
this.keyword = keyword;
}
@Override @Override
public String toString() { public String toString() {
return "ErpMaterialVo{" + return "ErpMaterialVo{" +
@ -100,6 +113,7 @@ public class ErpMaterialVo extends ErpMaterial {
", suspendState='" + suspendState + '\'' + ", suspendState='" + suspendState + '\'' +
", todoUserId='" + todoUserId + '\'' + ", todoUserId='" + todoUserId + '\'' +
", instanceTypeName='" + instanceTypeName + '\'' + ", instanceTypeName='" + instanceTypeName + '\'' +
'}'; ", keyword='" + keyword + '\'' +
"} " + super.toString();
} }
} }

36
ruoyi-admin/src/main/resources/application-druid.yml

@ -7,25 +7,25 @@ spring:
port: 6379 port: 6379
password: Read-in2023 password: Read-in2023
timeout: 6000ms # 连接超时时长(毫秒) timeout: 6000ms # 连接超时时长(毫秒)
# lettuce: lettuce:
# cluster: cluster:
# refresh: refresh:
# adptive: true adptive: true
# pool:
# max-active: 1000 # 连接池最大连接数(使用负值表示没有限制)
# max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)
# max-idle: 10 # 连接池中的最大空闲连接
# min-idle: 5 # 连接池中的最小空闲连接
jedis:
pool: pool:
# 最大空闲连接 max-active: 1000 # 连接池最大连接数(使用负值表示没有限制)
max-idle: 10 max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)
# 最小空闲链接 max-idle: 10 # 连接池中的最大空闲连接
min-idle: 5 min-idle: 5 # 连接池中的最小空闲连接
# 最大连接数(负数表示没有限制) # jedis:
max-active: 1000 # pool:
# 最大阻塞等待时间(负数表示没有限制) # # 最大空闲连接
max-wait: -1 # max-idle: 10
# # 最小空闲链接
# min-idle: 5
# # 最大连接数(负数表示没有限制)
# max-active: 1000
# # 最大阻塞等待时间(负数表示没有限制)
# max-wait: -1
datasource: datasource:
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver driverClassName: com.mysql.cj.jdbc.Driver

1
ruoyi-admin/src/main/resources/mapper/erp/ErpMaterialMapper.xml

@ -92,6 +92,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="applyTitle != null and applyTitle != ''"> and erp.apply_title = #{applyTitle}</if> <if test="applyTitle != null and applyTitle != ''"> and erp.apply_title = #{applyTitle}</if>
<if test="applyUser != null and applyUser != ''"> and erp.apply_user = #{applyUser}</if> <if test="applyUser != null and applyUser != ''"> and erp.apply_user = #{applyUser}</if>
<if test="applyTime != null "> and erp.apply_time = #{applyTime}</if> <if test="applyTime != null "> and erp.apply_time = #{applyTime}</if>
<if test="keyword != null and keyword != ''"> and (erp.material_no like concat('%',#{keyword},'%') or erp.material_name like concat('%',#{keyword},'%'))</if>
</where> </where>
order by erp.update_time desc order by erp.update_time desc
</select> </select>

26
ruoyi-admin/src/main/resources/templates/erp/bom/add.html

@ -10,11 +10,11 @@
<body class="white-bg"> <body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> <div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-bom-add"> <form class="form-horizontal m" id="form-bom-add">
<input class="form-control" name="id" hidden="hidden"> <input class="form-control" name="id" type="hidden">
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label is-required">料号:</label> <label class="col-sm-3 control-label is-required">料号:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<select class="form-control" onclick="selMaterialTb()" id="materialNo" name="materialNo" required> <select class="form-control" id="materialNo" name="materialNo" required>
</select> </select>
</div> </div>
@ -106,40 +106,36 @@
allowClear: true, allowClear: true,
placeholder: "请选择一个料号", placeholder: "请选择一个料号",
ajax:{ ajax:{
type: "post", type: "get",
url:ctx + "erp/material/list", url:ctx + "erp/material/getMaterialSelList",
dataType:"json", dataType:"json",
delay:250, delay:250,
data:function(params){ data:function(params){
var searchVal = params.term; var searchVal = params.term;
var obj = { var obj = {
params:{ keyword: searchVal
materialNo: searchVal
}
}; };
return obj; return obj;
}, },
cache:true, cache:true,
processResults: function (res, params) { processResults: function (res, params) {
var resultList = res.rows;
console.log("传输的数值");
console.log(resultList);
var options = []; var options = [];
if(res.code==0){
var resultList = res.data;
console.log(resultList);
for(var i= 0, len=resultList.length;i<len;i++){ for(var i= 0, len=resultList.length;i<len;i++){
var option = resultList[i]; var option = resultList[i];
option.id = resultList[i]["materialNo"]; option.id = resultList[i]["materialNo"];
option.text = resultList[i]["materialNo"]; option.text = resultList[i]["materialNo"];
options.push(option); options.push(option);
} }
return {
results: options,
pagination: {
// more:res["data"]["more"]
} }
return {
results: options
}; };
}, },
escapeMarkup: function (markup) { return markup; }, escapeMarkup: function (markup) { return markup; },
// minimumInputLength: 1 minimumInputLength: 1
} }
}); });
$('#materialNo').on('select2:select', function (e) { $('#materialNo').on('select2:select', function (e) {

11
ruoyi-common/pom.xml

@ -66,17 +66,6 @@
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId> <artifactId>spring-boot-starter-data-redis</artifactId>
<exclusions>
<exclusion>
<groupId>io.lettuce</groupId>
<artifactId>lettuce-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
</dependency> </dependency>
<!-- pagehelper 分页插件 --> <!-- pagehelper 分页插件 -->

10
ruoyi-common/src/main/java/com/ruoyi/common/utils/DictUtils.java

@ -2,6 +2,8 @@ package com.ruoyi.common.utils;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import com.alibaba.fastjson.JSONArray;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.entity.SysDictData; import com.ruoyi.common.core.domain.entity.SysDictData;
@ -40,11 +42,11 @@ public class DictUtils
*/ */
public static List<SysDictData> getDictCache(String key) public static List<SysDictData> getDictCache(String key)
{ {
Object cacheObj = SpringUtils.getBean(RedisCache.class).getCacheObject(getCacheKey(key)); JSONArray arrayCache = SpringUtils.getBean(RedisCache.class).getCacheObject(getCacheKey(key));
if (StringUtils.isNotNull(cacheObj)) if (StringUtils.isNotNull(arrayCache))
{ {
List<SysDictData> DictDatas = StringUtils.cast(cacheObj); String jsonString = JSONArray.toJSONString(arrayCache);
return DictDatas; return JSONArray.parseArray(jsonString, SysDictData.class);
} }
return null; return null;
} }

3
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/DictService.java

@ -59,7 +59,8 @@ public class DictService
List<Map<String,String>> result = new ArrayList<>(); List<Map<String,String>> result = new ArrayList<>();
List<SysDictData> sysDictDataList = dictTypeService.selectDictDataByType(dictType); List<SysDictData> sysDictDataList = dictTypeService.selectDictDataByType(dictType);
if(CollectionUtils.isNotEmpty(sysDictDataList)){ if(CollectionUtils.isNotEmpty(sysDictDataList)){
for(SysDictData sysDictData:sysDictDataList){ for (int i = 0; i < sysDictDataList.size(); i++) {
com.ruoyi.common.core.domain.entity.SysDictData sysDictData = sysDictDataList.get(i);
Map<String,String> dictOne = new HashMap<>(); Map<String,String> dictOne = new HashMap<>();
String value = sysDictData.getDictValue(); String value = sysDictData.getDictValue();
String text = sysDictData.getDictLabel(); String text = sysDictData.getDictLabel();

Loading…
Cancel
Save