Browse Source

[update]:物料信息查询优化

dev
youjianchi 10 months ago
parent
commit
1d10e98ecf
  1. 14
      ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpMaterialVo.java
  2. 9
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
  3. 1
      ruoyi-admin/src/main/resources/templates/demo/table/fixedColumns.html
  4. 47
      ruoyi-admin/src/main/resources/templates/erp/material/material.html
  5. 8
      ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java
  6. 5
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java
  7. 3
      ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java
  8. 6
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
  9. 10
      ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml

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

@ -88,4 +88,18 @@ public class ErpMaterialVo extends ErpMaterial {
public void setInstanceTypeName(String instanceTypeName) { public void setInstanceTypeName(String instanceTypeName) {
this.instanceTypeName = instanceTypeName; this.instanceTypeName = instanceTypeName;
} }
@Override
public String toString() {
return "ErpMaterialVo{" +
"applyUserName='" + applyUserName + '\'' +
", taskId='" + taskId + '\'' +
", taskName='" + taskName + '\'' +
", doneTime=" + doneTime +
", createUserName='" + createUserName + '\'' +
", suspendState='" + suspendState + '\'' +
", todoUserId='" + todoUserId + '\'' +
", instanceTypeName='" + instanceTypeName + '\'' +
'}';
}
} }

9
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java

@ -25,6 +25,7 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -292,4 +293,12 @@ public class SysUserController extends BaseController
//System.out.println(allUser); //System.out.println(allUser);
return Result.getSuccessResult(allUser); return Result.getSuccessResult(allUser);
} }
@GetMapping("/selectUserSelList")
@ResponseBody
public AjaxResult selectUserSelList(@RequestParam(required = false,value = "userName")String userName)
{
List<Map<String, String>> userSelList = userService.selectUserSelList(userName);
return success(userSelList);
}
} }

1
ruoyi-admin/src/main/resources/templates/demo/table/fixedColumns.html

@ -23,6 +23,7 @@
</div> </div>
</div> </div>
<div th:include="include :: footer"></div> <div th:include="include :: footer"></div>
<th:block th:include="include :: bootstrap-table-fixed-columns-js" />
<script th:inline="javascript"> <script th:inline="javascript">
var prefix = ctx + "demo/table"; var prefix = ctx + "demo/table";
var datas = [[${@dict.getType('sys_normal_disable')}]]; var datas = [[${@dict.getType('sys_normal_disable')}]];

47
ruoyi-admin/src/main/resources/templates/erp/material/material.html

@ -2,6 +2,7 @@
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"> <html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head> <head>
<th:block th:include="include :: header('物料信息列表')" /> <th:block th:include="include :: header('物料信息列表')" />
<th:block th:include="include :: select2-css" />
</head> </head>
<body class="gray-bg"> <body class="gray-bg">
<div class="container-div"> <div class="container-div">
@ -12,7 +13,7 @@
<ul> <ul>
<li> <li>
<label>料号:</label> <label>料号:</label>
<input type="text" name="materialNo"/> <input type="text" name="params[materialNo]"/>
</li> </li>
<li> <li>
<label>物料名称:</label> <label>物料名称:</label>
@ -34,18 +35,20 @@
</li> </li>
<li> <li>
<label>工程员:</label> <label>工程员:</label>
<input type="text" name="createBy"/> <select id="createBySel" name="createBy">
</select>
</li> </li>
<li> <li>
<label>是否有生产团队:</label> <label>是否有生产团队:</label>
<select name="createBy" th:with="type=${@dict.getType('havaProductTem')}"> <select name="havaProductTem" th:with="type=${@dict.getType('havaProductTem')}">
<option value="">所有</option> <option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option> <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select> </select>
</li> </li>
<li> <li>
<label>物料类型:</label> <label>物料类型:</label>
<select id="selectMaterialType" th:with="childList=${@category.getChildByCode('materialType')}"> <select name="materialType" id="selectMaterialType" th:with="childList=${@category.getChildByCode('materialType')}">
<optgroup th:each="child: ${childList}" th:label="${child.name}"> <optgroup th:each="child: ${childList}" th:label="${child.name}">
<option th:each="childSon: ${child.children}" th:value="${childSon.code}" th:text="${#strings.concat(child.name,'-',childSon.name)}"></option> <option th:each="childSon: ${child.children}" th:value="${childSon.code}" th:text="${#strings.concat(child.name,'-',childSon.name)}"></option>
</optgroup> </optgroup>
@ -425,6 +428,42 @@
var productItems = []; var productItems = [];
var prefix = ctx + "erp/material"; var prefix = ctx + "erp/material";
$(function() { $(function() {
$('#createBySel').select2({
placeholder: "请选择工程员",
allowClear: true, // 允许清除
minimumInputLength: 1, // 触发搜索的最小字符数
ajax: {
url: ctx + "system/user/selectUserSelList", // 你的搜索接口 URL
dataType: 'json',
delay: 250, // 查询延迟
data: function (params) {
console.log(params);
return {
userName: params.term, // 当前查询的关键词
};
},
processResults: function (data, params) {
console.log(data);
if(data.code==0){
return {
results: data.data
};
}
return {
results: []
};
},
cache: true // 启用缓存
},
/*escapeMarkup: function (markup) { return markup; }, // 让 Select2 正确处理 HTML 内容
templateResult: function (data) {
return data.text; // 自定义显示的内容
},
templateSelection: function (data) {
return data.text; // 自定义选择后显示的内容
}*/
});
var options = { var options = {
url: prefix + "/list", url: prefix + "/list",
createUrl: prefix + "/add", createUrl: prefix + "/add",

8
ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java

@ -185,6 +185,14 @@ public class BaseController
return AjaxResult.success(message); return AjaxResult.success(message);
} }
/**
* 返回成功数据
*/
public static AjaxResult success(Object data)
{
return AjaxResult.success("操作成功", data);
}
/** /**
* 返回失败消息 * 返回失败消息
*/ */

5
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java

@ -1,8 +1,10 @@
package com.ruoyi.system.mapper; package com.ruoyi.system.mapper;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUser;
import org.apache.ibatis.annotations.MapKey;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 用户表 数据层 * 用户表 数据层
@ -124,4 +126,7 @@ public interface SysUserMapper
public SysUser checkEmailUnique(String email); public SysUser checkEmailUnique(String email);
public List<SysUser> selectAllUser(); public List<SysUser> selectAllUser();
@MapKey("id")
List<Map<String,String>> selectUserSelList(String userName);
} }

3
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java

@ -4,6 +4,7 @@ import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.system.domain.SysUserRole; import com.ruoyi.system.domain.SysUserRole;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 用户 业务层 * 用户 业务层
@ -207,4 +208,6 @@ public interface ISysUserService
public int changeStatus(SysUser user); public int changeStatus(SysUser user);
public List<SysUser> getAllUser()throws Exception; public List<SysUser> getAllUser()throws Exception;
List<Map<String,String>> selectUserSelList(String userName);
} }

6
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java

@ -22,6 +22,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 用户 业务层处理 * 用户 业务层处理
@ -525,4 +526,9 @@ public class SysUserServiceImpl implements ISysUserService
public List<SysUser> getAllUser() throws Exception { public List<SysUser> getAllUser() throws Exception {
return userMapper.selectAllUser(); return userMapper.selectAllUser();
} }
@Override
public List<Map<String, String>> selectUserSelList(String userName) {
return userMapper.selectUserSelList(userName);
}
} }

10
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml

@ -227,5 +227,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectAllUser" resultType="SysUser" resultMap="SysUserResult"> <select id="selectAllUser" resultType="SysUser" resultMap="SysUserResult">
select sys_user.user_name from sys_user select sys_user.user_name from sys_user
</select> </select>
<select id="selectUserSelList" resultType="java.util.Map">
select
login_name as id
,user_name as text
from sys_user
where del_flag = '0'
and user_name like concat('%', #{userName}, '%')
</select>
</mapper> </mapper>
Loading…
Cancel
Save