Browse Source

[fix]工程管理:

修改开发修改单的工程员的查询方式。写一个通用查询,通过指定roleKey查询特定角色的用户集合
dev
liuxiaoxu 7 months ago
parent
commit
8ee0f637f4
  1. 17
      ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpDevelopModifyorderController.java
  2. 19
      ruoyi-admin/src/main/resources/mapper/erp/ErpDevelopModifyorderMapper.xml
  3. 33
      ruoyi-admin/src/main/resources/templates/erp/developModifyOrder/add.html
  4. 2
      ruoyi-admin/src/main/resources/templates/erp/developModifyOrder/developModifyOrder.html
  5. 6
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java
  6. 7
      ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java
  7. 11
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
  8. 8
      ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml

17
ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpDevelopModifyorderController.java

@ -1,6 +1,9 @@
package com.ruoyi.erp.controller; package com.ruoyi.erp.controller;
import java.util.List; import java.util.List;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.system.service.ISysUserService;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
@ -31,6 +34,9 @@ public class ErpDevelopModifyorderController extends BaseController
{ {
private String prefix = "erp/developModifyOrder"; private String prefix = "erp/developModifyOrder";
@Autowired
private ISysUserService sysUserService;
@Autowired @Autowired
private IErpDevelopModifyorderService erpDevelopModifyorderService; private IErpDevelopModifyorderService erpDevelopModifyorderService;
@ -54,6 +60,17 @@ public class ErpDevelopModifyorderController extends BaseController
return getDataTable(list); return getDataTable(list);
} }
/**
* 查找所有的工程员
* */
@ResponseBody
@PostMapping("/getEngineerList")
public AjaxResult getEngineerList(String roleKey){
List<SysUser> engineerList = sysUserService.getSpecificRoleList(roleKey);
return AjaxResult.success(engineerList);
}
/** /**
* 导出开发修改单列表 * 导出开发修改单列表
*/ */

19
ruoyi-admin/src/main/resources/mapper/erp/ErpDevelopModifyorderMapper.xml

@ -32,18 +32,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectErpDevelopModifyorderVo"> <sql id="selectErpDevelopModifyorderVo">
select develop_order_id, develop_oder_code, material_no, purchase_storage_status, quality_status, audit_status, complete_status, finsh_status, use_status, material_name, material_type, material_photo_url, material_unit, material_brand, material_describe, material_process_mode, user_id, create_by, create_time, user_name, update_by, update_time, remark from erp_develop_modifyorder select develop_order_id, develop_oder_code, material_no, purchase_storage_status, quality_status, audit_status, complete_status, finsh_status, use_status, material_name, material_type, material_photo_url, material_unit, material_brand, material_describe, material_process_mode, user_id, create_by, create_time, user_name, update_by, update_time, remark from erp_develop_modifyorder
</sql> </sql>
<select id="selectErpDevelopModifyorderList" parameterType="ErpDevelopModifyorder" resultMap="ErpDevelopModifyorderResult"> <select id="selectErpDevelopModifyorderList" parameterType="ErpDevelopModifyorder" resultMap="ErpDevelopModifyorderResult">
<include refid="selectErpDevelopModifyorderVo"/> select edm.develop_order_id, edm.develop_oder_code, edm.material_no, edm.purchase_storage_status, edm.quality_status, edm.audit_status, edm.complete_status, edm.finsh_status, edm.use_status, edm.material_name, edm.material_type, edm.material_photo_url, edm.material_unit, edm.material_brand, edm.material_describe, edm.material_process_mode, edm.user_id, edm.create_by, edm.create_time, edm.update_by, edm.update_time, edm.remark,su.user_name
from erp_develop_modifyorder edm
left join sys_user su on su.user_id = edm.user_id
<where> <where>
<if test="developOderCode != null and developOderCode != ''"> and develop_oder_code = #{developOderCode}</if> <if test="developOderCode != null and developOderCode != ''"> and edm.develop_oder_code = #{developOderCode}</if>
<if test="materialNo != null and materialNo != ''"> and material_no = #{materialNo}</if> <if test="materialNo != null and materialNo != ''"> and edm.material_no = #{materialNo}</if>
<if test="auditStatus != null and auditStatus != ''"> and audit_status = #{auditStatus}</if> <if test="auditStatus != null and auditStatus != ''"> and edm.audit_status = #{auditStatus}</if>
<if test="finshStatus != null and finshStatus != ''"> and finsh_status = #{finshStatus}</if> <if test="finshStatus != null and finshStatus != ''"> and edm.finsh_status = #{finshStatus}</if>
<if test="materialName != null and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if> <if test="materialName != null and materialName != ''"> and edm.material_name like concat('%', #{materialName}, '%')</if>
<if test="userId != null "> and user_id = #{userId}</if> <if test="userId != null "> and edm.user_id = #{userId}</if>
<if test="createTime != null "> and create_time = #{createTime}</if> <if test="createTime != null "> and edm.create_time = #{createTime}</if>
</where> </where>
</select> </select>

33
ruoyi-admin/src/main/resources/templates/erp/developModifyOrder/add.html

@ -111,17 +111,11 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">工程员:</label> <label class="col-sm-3 control-label">工程员:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<select name="userId" class="form-control m-b"> <select id="userId_add" name="userId" class="form-control m-b">
<option value="">所有</option> <option value="">所有</option>
</select> </select>
</div> </div>
</div> </div>
<div class="form-group">
<label class="col-sm-3 control-label">工程员姓名:</label>
<div class="col-sm-8">
<input name="userName" class="form-control" type="text">
</div>
</div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">备注信息:</label> <label class="col-sm-3 control-label">备注信息:</label>
<div class="col-sm-8"> <div class="col-sm-8">
@ -137,6 +131,31 @@
focusCleanup: true focusCleanup: true
}); });
$(function () {
$.ajax({
url: ctx + 'erp/developModifyOrder/getEngineerList',
type: 'post',
data: { roleKey: 'gcwyRole' },
success: function (res) {
if (res.data.length > 0) {
var userData = res.data;
for (let i in userData) {
$("#userId_add").append(
"<option value='" + userData[i].userId + "'>" + userData[i].userName + "</option>" // 显示用户姓名
);
}
$("userId_add").val(userData[i].userId).trigger("change");
} else {
$.modal.msgError(res.msg);
}
}
});
})
function submitHandler() { function submitHandler() {
if ($.validate.form()) { if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-developModifyOrder-add').serialize()); $.operate.save(prefix + "/add", $('#form-developModifyOrder-add').serialize());

2
ruoyi-admin/src/main/resources/templates/erp/developModifyOrder/developModifyOrder.html

@ -150,7 +150,7 @@
}, },
{ {
title: '工程员', title: '工程员',
field: 'userId', field: 'userName',
}, },
{ {
title: '料号', title: '料号',

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

@ -127,6 +127,12 @@ public interface SysUserMapper
public List<SysUser> selectAllUser(); public List<SysUser> selectAllUser();
/**
* 查找所有工程员
* */
public List<SysUser> selectSpecificRoleList(String roleKey);
@MapKey("id") @MapKey("id")
List<Map<String,String>> selectUserSelList(String userName); List<Map<String,String>> selectUserSelList(String userName);
} }

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

@ -77,6 +77,13 @@ public interface ISysUserService
*/ */
public List<SysUserRole> selectUserRoleByUserId(Long userId); public List<SysUserRole> selectUserRoleByUserId(Long userId);
/**
* 查找所有工程员
*
* @return 工程员列表
*/
public List<SysUser> getSpecificRoleList(String roleKey);
/** /**
* 通过用户ID删除用户 * 通过用户ID删除用户
* *

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

@ -151,6 +151,17 @@ public class SysUserServiceImpl implements ISysUserService
return userRoleMapper.selectUserRoleByUserId(userId); return userRoleMapper.selectUserRoleByUserId(userId);
} }
/**
* 查找所有工程员
*
* @return 工程员列表
*/
@Override
public List<SysUser> getSpecificRoleList(String roleKey) {
List<SysUser> sysUsers = userMapper.selectSpecificRoleList(roleKey);
return sysUsers;
}
/** /**
* 通过用户ID删除用户 * 通过用户ID删除用户
* *

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

@ -228,6 +228,14 @@ 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="selectSpecificRoleList" parameterType="String" resultType="SysUser" resultMap="SysUserResult">
SELECT su.user_name, su.user_id
FROM sys_user su
JOIN sys_user_role sur ON su.user_id = sur.user_id
JOIN sys_role sr ON sr.role_id = sur.role_id
WHERE sr.role_key = #{roleKey}
</select>
<select id="selectUserSelList" resultType="java.util.Map"> <select id="selectUserSelList" resultType="java.util.Map">
select select
login_name as id login_name as id

Loading…
Cancel
Save