下拉选
This commit is contained in:
parent
7b541311ca
commit
1d55e42154
|
|
@ -2,6 +2,7 @@ package com.bonus.imgTool.system.controller;
|
||||||
|
|
||||||
import com.bonus.imgTool.annotation.DecryptAndVerify;
|
import com.bonus.imgTool.annotation.DecryptAndVerify;
|
||||||
import com.bonus.imgTool.annotation.LogAnnotation;
|
import com.bonus.imgTool.annotation.LogAnnotation;
|
||||||
|
import com.bonus.imgTool.backstage.entity.QueryParamDto;
|
||||||
import com.bonus.imgTool.system.service.DictService;
|
import com.bonus.imgTool.system.service.DictService;
|
||||||
import com.bonus.imgTool.system.service.SelectService;
|
import com.bonus.imgTool.system.service.SelectService;
|
||||||
import com.bonus.imgTool.system.vo.Dict;
|
import com.bonus.imgTool.system.vo.Dict;
|
||||||
|
|
@ -10,6 +11,7 @@ import com.bonus.imgTool.system.vo.SelectVo;
|
||||||
import com.bonus.imgTool.system.vo.dto.SelectDto;
|
import com.bonus.imgTool.system.vo.dto.SelectDto;
|
||||||
import com.bonus.imgTool.utils.ServerResponse;
|
import com.bonus.imgTool.utils.ServerResponse;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
|
@ -98,4 +100,25 @@ public class SelectController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("工程下拉选-按权限划分")
|
||||||
|
@PostMapping(value = "getProsSelect")
|
||||||
|
@DecryptAndVerify(decryptedClass = QueryParamDto.class)//加解密统一管理
|
||||||
|
public ServerResponse getProsSelect(EncryptedReq<QueryParamDto> dto) {
|
||||||
|
return service.getProsSelect(dto.getData());
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("专业下拉选")
|
||||||
|
@PostMapping(value = "getMajorsSelect")
|
||||||
|
@DecryptAndVerify(decryptedClass = QueryParamDto.class)//加解密统一管理
|
||||||
|
public ServerResponse getMajorsSelect(EncryptedReq<QueryParamDto> dto) {
|
||||||
|
return service.getMajorsSelect(dto.getData());
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("工序下拉选")
|
||||||
|
@PostMapping(value = "getGxsSelect")
|
||||||
|
@DecryptAndVerify(decryptedClass = QueryParamDto.class)//加解密统一管理
|
||||||
|
public ServerResponse getGxsSelect(EncryptedReq<QueryParamDto> dto) {
|
||||||
|
return service.getGxsSelect(dto.getData());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.bonus.imgTool.system.dao;
|
package com.bonus.imgTool.system.dao;
|
||||||
|
|
||||||
|
import com.bonus.imgTool.backstage.entity.QueryParamDto;
|
||||||
import com.bonus.imgTool.system.vo.SelectVo;
|
import com.bonus.imgTool.system.vo.SelectVo;
|
||||||
import com.bonus.imgTool.system.vo.dto.SelectDto;
|
import com.bonus.imgTool.system.vo.dto.SelectDto;
|
||||||
import org.apache.ibatis.annotations.*;
|
import org.apache.ibatis.annotations.*;
|
||||||
|
|
@ -16,4 +17,29 @@ public interface SelectDao {
|
||||||
List<SelectVo> getProcessSelect(SelectDto data);
|
List<SelectVo> getProcessSelect(SelectDto data);
|
||||||
|
|
||||||
List<SelectVo> getProjectSelect(SelectDto data);
|
List<SelectVo> getProjectSelect(SelectDto data);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工程下拉选-按权限划分
|
||||||
|
* @param dto
|
||||||
|
* @return List<SelectVo>
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2025/4/3 13:53
|
||||||
|
*/
|
||||||
|
List<SelectVo> getProsSelect(QueryParamDto dto);
|
||||||
|
/**
|
||||||
|
* 专业下拉选
|
||||||
|
* @param dto
|
||||||
|
* @return List<SelectVo>
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2025/4/3 13:53
|
||||||
|
*/
|
||||||
|
List<SelectVo> getMajorsSelect(QueryParamDto dto);
|
||||||
|
/**
|
||||||
|
* 工序下拉选
|
||||||
|
* @param dto
|
||||||
|
* @return List<SelectVo>
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2025/4/3 13:53
|
||||||
|
*/
|
||||||
|
List<SelectVo> getGxsSelect(QueryParamDto dto);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.bonus.imgTool.system.service;
|
package com.bonus.imgTool.system.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.bonus.imgTool.backstage.entity.QueryParamDto;
|
||||||
import com.bonus.imgTool.system.vo.Dict;
|
import com.bonus.imgTool.system.vo.Dict;
|
||||||
import com.bonus.imgTool.system.vo.SelectVo;
|
import com.bonus.imgTool.system.vo.SelectVo;
|
||||||
import com.bonus.imgTool.system.vo.dto.SelectDto;
|
import com.bonus.imgTool.system.vo.dto.SelectDto;
|
||||||
|
|
@ -17,4 +18,29 @@ public interface SelectService {
|
||||||
List<SelectVo> getProcessSelect(SelectDto data);
|
List<SelectVo> getProcessSelect(SelectDto data);
|
||||||
|
|
||||||
List<SelectVo> getProjectSelect(SelectDto data);
|
List<SelectVo> getProjectSelect(SelectDto data);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工程下拉选-按权限划分
|
||||||
|
* @param data
|
||||||
|
* @return ServerResponse
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2025/4/3 13:46
|
||||||
|
*/
|
||||||
|
ServerResponse getProsSelect(QueryParamDto data);
|
||||||
|
/**
|
||||||
|
* 获取专业下拉选
|
||||||
|
* @param data
|
||||||
|
* @return ServerResponse
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2025/4/3 13:46
|
||||||
|
*/
|
||||||
|
ServerResponse getMajorsSelect(QueryParamDto data);
|
||||||
|
/**
|
||||||
|
* 获取工序下拉选
|
||||||
|
* @param data
|
||||||
|
* @return ServerResponse
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2025/4/3 13:46
|
||||||
|
*/
|
||||||
|
ServerResponse getGxsSelect(QueryParamDto data);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,26 @@
|
||||||
package com.bonus.imgTool.system.service.impl;
|
package com.bonus.imgTool.system.service.impl;
|
||||||
|
|
||||||
|
import com.bonus.imgTool.backstage.entity.QueryParamDto;
|
||||||
|
import com.bonus.imgTool.backstage.entity.SynthesisQueryVo;
|
||||||
import com.bonus.imgTool.system.dao.DictDao;
|
import com.bonus.imgTool.system.dao.DictDao;
|
||||||
import com.bonus.imgTool.system.dao.SelectDao;
|
import com.bonus.imgTool.system.dao.SelectDao;
|
||||||
import com.bonus.imgTool.system.service.DictService;
|
import com.bonus.imgTool.system.service.DictService;
|
||||||
import com.bonus.imgTool.system.service.SelectService;
|
import com.bonus.imgTool.system.service.SelectService;
|
||||||
import com.bonus.imgTool.system.vo.Dict;
|
import com.bonus.imgTool.system.vo.Dict;
|
||||||
|
import com.bonus.imgTool.system.vo.LoginUser;
|
||||||
import com.bonus.imgTool.system.vo.SelectVo;
|
import com.bonus.imgTool.system.vo.SelectVo;
|
||||||
import com.bonus.imgTool.system.vo.dto.SelectDto;
|
import com.bonus.imgTool.system.vo.dto.SelectDto;
|
||||||
import com.bonus.imgTool.utils.ServerResponse;
|
import com.bonus.imgTool.utils.ServerResponse;
|
||||||
|
import com.bonus.imgTool.utils.UserUtil;
|
||||||
|
import com.bonus.imgTool.webResult.Constants;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
|
@ -45,4 +51,44 @@ public class SelectServiceImpl implements SelectService {
|
||||||
public List<SelectVo> getProjectSelect(SelectDto data) {
|
public List<SelectVo> getProjectSelect(SelectDto data) {
|
||||||
return dao.getProjectSelect(data);
|
return dao.getProjectSelect(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ServerResponse getProsSelect(QueryParamDto dto) {
|
||||||
|
try {
|
||||||
|
String roleLevel = Optional.ofNullable(UserUtil.getLoginUser()).map(LoginUser::getRoleLevel).orElse("0");
|
||||||
|
String proIds = Optional.ofNullable(UserUtil.getLoginUser()).map(LoginUser::getProIds).orElse("-1");
|
||||||
|
if(Objects.equals(roleLevel, Constants.ROLE_LEVEL)){ // 项目部级
|
||||||
|
List<Long> proList = Arrays.stream(proIds.split(",")).map(String::trim).filter(s -> !s.isEmpty()).map(Long::valueOf).collect(Collectors.toList());
|
||||||
|
dto.setProIds(proList);
|
||||||
|
}
|
||||||
|
dto.setRoleLevel(roleLevel);
|
||||||
|
List<SelectVo> list = Optional.ofNullable(dao.getProsSelect(dto)).orElseGet(ArrayList::new);
|
||||||
|
return ServerResponse.createSuccess(list);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.toString(),e);
|
||||||
|
return ServerResponse.createErroe("查询失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ServerResponse getMajorsSelect(QueryParamDto dto) {
|
||||||
|
try {
|
||||||
|
List<SelectVo> list = Optional.ofNullable(dao.getMajorsSelect(dto)).orElseGet(ArrayList::new);
|
||||||
|
return ServerResponse.createSuccess(list);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.toString(),e);
|
||||||
|
return ServerResponse.createErroe("查询失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ServerResponse getGxsSelect(QueryParamDto dto) {
|
||||||
|
try {
|
||||||
|
List<SelectVo> list = Optional.ofNullable(dao.getGxsSelect(dto)).orElseGet(ArrayList::new);
|
||||||
|
return ServerResponse.createSuccess(list);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.toString(),e);
|
||||||
|
return ServerResponse.createErroe("查询失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@
|
||||||
SELECT sd.dict_value,sd.dict_name
|
SELECT sd.dict_value,sd.dict_name
|
||||||
FROM sys_distinct sd
|
FROM sys_distinct sd
|
||||||
LEFT JOIN sys_distinct sd2 ON sd.p_id = sd2.id
|
LEFT JOIN sys_distinct sd2 ON sd.p_id = sd2.id
|
||||||
WHERE sd2.dict_code = 'file_source_type'
|
WHERE sd2.dict_code = 'file_source_type' AND sd.del_flag = 0
|
||||||
) A ON A.dict_value = sfr.source_type
|
) A ON A.dict_value = sfr.source_type
|
||||||
<where>
|
<where>
|
||||||
<if test="queryType == 1">
|
<if test="queryType == 1">
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,37 @@
|
||||||
t.name
|
t.name
|
||||||
from tb_project t where is_active = 1
|
from tb_project t where is_active = 1
|
||||||
</select>
|
</select>
|
||||||
|
<!--工程下拉选-按权限划分-->
|
||||||
|
<select id="getProsSelect" resultType="com.bonus.imgTool.system.vo.SelectVo">
|
||||||
|
SELECT id,name
|
||||||
|
FROM tb_project
|
||||||
|
<where>
|
||||||
|
<if test="roleLevel = 0 and proIds != null and proIds.size() > 0">
|
||||||
|
AND id IN
|
||||||
|
<foreach collection="proIds" item="proId" open="(" separator="," close=")">
|
||||||
|
#{proId}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
<!--专业下拉选-->
|
||||||
|
<select id="getMajorsSelect" resultType="com.bonus.imgTool.system.vo.SelectVo">
|
||||||
|
SELECT sd.dict_value AS `id`,sd.dict_name AS `name`
|
||||||
|
FROM sys_distinct sd
|
||||||
|
LEFT JOIN sys_distinct sd2 ON sd.p_id = sd2.id
|
||||||
|
WHERE sd2.dict_code = 'profession' AND sd.del_flag = 0
|
||||||
|
</select>
|
||||||
|
<!--工序下拉选-->
|
||||||
|
<select id="getGxsSelect" resultType="com.bonus.imgTool.system.vo.SelectVo">
|
||||||
|
SELECT gx_id AS `id`,gx_name AS `name`
|
||||||
|
FROM tb_gx
|
||||||
|
<where>
|
||||||
|
<if test="id!=null">
|
||||||
|
AND major_id = #{id}
|
||||||
|
</if>
|
||||||
|
AND is_active = '1'
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
|
|
@ -245,6 +245,7 @@ function getProsSelect() {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**专业下拉选*/
|
||||||
function getMajorsSelect() {
|
function getMajorsSelect() {
|
||||||
let data = [];
|
let data = [];
|
||||||
let url = dataUrl + "/sys/select/getMajorsSelect"
|
let url = dataUrl + "/sys/select/getMajorsSelect"
|
||||||
|
|
@ -266,11 +267,11 @@ function getMajorsSelect() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**工序下拉选*/
|
/**工序下拉选*/
|
||||||
function getGxsSelect(major) {
|
function getGxsSelect(majorId) {
|
||||||
let data = [];
|
let data = [];
|
||||||
let url = dataUrl + "/sys/select/getGxsSelect"
|
let url = dataUrl + "/sys/select/getGxsSelect"
|
||||||
let obj = {
|
let obj = {
|
||||||
id: major
|
id: majorId
|
||||||
}
|
}
|
||||||
let params = {
|
let params = {
|
||||||
encryptedData: encryptCBC(JSON.stringify(obj))
|
encryptedData: encryptCBC(JSON.stringify(obj))
|
||||||
|
|
|
||||||
|
|
@ -12,11 +12,21 @@ function setParams(obj) {
|
||||||
type: 'date',
|
type: 'date',
|
||||||
range: true
|
range: true
|
||||||
});
|
});
|
||||||
|
let pros = getProsSelect();
|
||||||
|
let majors = getMajorsSelect();
|
||||||
|
let gxs =getGxsSelect();
|
||||||
|
setSelectValueName(pros,'proId','请选择工程');
|
||||||
|
setSelectValueName(majors,'majorId','请选择专业');
|
||||||
|
setSelectValueName(gxs,'gxId','请选择工序');
|
||||||
form.val('formInfo', highSearchData);
|
form.val('formInfo', highSearchData);
|
||||||
$.each(highSearchData.photoType,function(index,item){
|
$.each(highSearchData.photoType,function(index,item){
|
||||||
$('input[name="photoType"][value='+item+']').prop('checked', true);
|
$('input[name="photoType"][value='+item+']').prop('checked', true);
|
||||||
})
|
})
|
||||||
layui.form.render();
|
layui.form.render();
|
||||||
|
form.on('select(majorId)', function(data){
|
||||||
|
let gxs =getGxsSelect(data.value);
|
||||||
|
setSelectValueName(gxs,'gxId','请选择工序');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@
|
||||||
<div class="layui-inline">
|
<div class="layui-inline">
|
||||||
<label class="layui-form-label">工程</label>
|
<label class="layui-form-label">工程</label>
|
||||||
<div class="layui-input-inline" style="width: 575px !important;">
|
<div class="layui-input-inline" style="width: 575px !important;">
|
||||||
<select name="proId" class="layui-select" lay-search></select>
|
<select name="proId" id="proId" class="layui-select" lay-search></select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -50,13 +50,13 @@
|
||||||
<div class="layui-inline">
|
<div class="layui-inline">
|
||||||
<label class="layui-form-label">专业</label>
|
<label class="layui-form-label">专业</label>
|
||||||
<div class="layui-input-inline">
|
<div class="layui-input-inline">
|
||||||
<select class="layui-select" lay-search name="majorId"></select>
|
<select class="layui-select" lay-search name="majorId" id="majorId" lay-filter="majorId"></select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-inline">
|
<div class="layui-inline">
|
||||||
<label class="layui-form-label">工序</label>
|
<label class="layui-form-label">工序</label>
|
||||||
<div class="layui-input-inline">
|
<div class="layui-input-inline">
|
||||||
<select class="layui-select" lay-search name="gxId"></select>
|
<select class="layui-select" lay-search name="gxId" id="gxId"></select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue