Browse Source

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

dev
youjianchi 10 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. 36
      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);
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 keyword;
public String getApplyUserName() {
return applyUserName;
}
@ -89,6 +94,14 @@ public class ErpMaterialVo extends ErpMaterial {
this.instanceTypeName = instanceTypeName;
}
public String getKeyword() {
return keyword;
}
public void setKeyword(String keyword) {
this.keyword = keyword;
}
@Override
public String toString() {
return "ErpMaterialVo{" +
@ -100,6 +113,7 @@ public class ErpMaterialVo extends ErpMaterial {
", suspendState='" + suspendState + '\'' +
", todoUserId='" + todoUserId + '\'' +
", instanceTypeName='" + instanceTypeName + '\'' +
'}';
", keyword='" + keyword + '\'' +
"} " + super.toString();
}
}

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

@ -7,25 +7,25 @@ spring:
port: 6379
password: Read-in2023
timeout: 6000ms # 连接超时时长(毫秒)
# lettuce:
# cluster:
# refresh:
# adptive: true
# pool:
# max-active: 1000 # 连接池最大连接数(使用负值表示没有限制)
# max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)
# max-idle: 10 # 连接池中的最大空闲连接
# min-idle: 5 # 连接池中的最小空闲连接
jedis:
lettuce:
cluster:
refresh:
adptive: true
pool:
# 最大空闲连接
max-idle: 10
# 最小空闲链接
min-idle: 5
# 最大连接数(负数表示没有限制)
max-active: 1000
# 最大阻塞等待时间(负数表示没有限制)
max-wait: -1
max-active: 1000 # 连接池最大连接数(使用负值表示没有限制)
max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)
max-idle: 10 # 连接池中的最大空闲连接
min-idle: 5 # 连接池中的最小空闲连接
# jedis:
# pool:
# # 最大空闲连接
# max-idle: 10
# # 最小空闲链接
# min-idle: 5
# # 最大连接数(负数表示没有限制)
# max-active: 1000
# # 最大阻塞等待时间(负数表示没有限制)
# max-wait: -1
datasource:
type: com.alibaba.druid.pool.DruidDataSource
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="applyUser != null and applyUser != ''"> and erp.apply_user = #{applyUser}</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>
order by erp.update_time desc
</select>

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

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

11
ruoyi-common/pom.xml

@ -66,17 +66,6 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<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>
<!-- 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.List;
import com.alibaba.fastjson.JSONArray;
import org.springframework.stereotype.Component;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.entity.SysDictData;
@ -40,11 +42,11 @@ public class DictUtils
*/
public static List<SysDictData> getDictCache(String key)
{
Object cacheObj = SpringUtils.getBean(RedisCache.class).getCacheObject(getCacheKey(key));
if (StringUtils.isNotNull(cacheObj))
JSONArray arrayCache = SpringUtils.getBean(RedisCache.class).getCacheObject(getCacheKey(key));
if (StringUtils.isNotNull(arrayCache))
{
List<SysDictData> DictDatas = StringUtils.cast(cacheObj);
return DictDatas;
String jsonString = JSONArray.toJSONString(arrayCache);
return JSONArray.parseArray(jsonString, SysDictData.class);
}
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<SysDictData> sysDictDataList = dictTypeService.selectDictDataByType(dictType);
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<>();
String value = sysDictData.getDictValue();
String text = sysDictData.getDictLabel();

Loading…
Cancel
Save