统一接口修改

This commit is contained in:
cwchen 2023-12-21 11:12:12 +08:00
parent 30f1d42635
commit 4524eb173f
7 changed files with 73 additions and 3 deletions

View File

@ -111,4 +111,10 @@ public class SelectController {
public AjaxResult getUserByRoleIdCbx(@RequestBody SelectDto dto){
return service.getUserByRoleIdCbx(dto);
}
@ApiOperation(value = "往来单位id和标段工程id获取协议信息")
@PostMapping("getAgreementInfoById")
public AjaxResult getAgreementInfoById(@RequestBody SelectDto dto){
return service.getAgreementInfoById(dto);
}
}

View File

@ -0,0 +1,17 @@
package com.bonus.sgzb.system.domain;
import lombok.Data;
/**
* @author 10488
* 协议信息
*/
@Data
public class AgreementVo {
/** 协议ID*/
private Integer agreementId;
/** 协议编号*/
private String agreementCode;
}

View File

@ -25,4 +25,10 @@ public class SelectDto {
/** 角色权限字符串*/
private String roleKey;
/** 往来单位id*/
private int unitId;
/** 标段工程id*/
private int projectId;
}

View File

@ -1,5 +1,6 @@
package com.bonus.sgzb.system.mapper;
import com.bonus.sgzb.system.domain.AgreementVo;
import com.bonus.sgzb.system.domain.SelectDto;
import com.bonus.sgzb.system.domain.SelectVo;
import com.bonus.sgzb.system.domain.TreeNode;
@ -156,4 +157,13 @@ public interface SelectMapper {
* @date 2023/12/20 21:02
*/
List<TreeNode> getUserByRoleIdCbxTree(SelectDto dto);
/**
* @param dto
* @return AgreementVo
* @description 往来单位id和标段工程id获取协议信息
* @author cwchen
* @date 2023/12/21 10:53
*/
List<AgreementVo> getAgreementInfoById(SelectDto dto);
}

View File

@ -143,4 +143,13 @@ public interface SelectService {
* @date 2023/12/20 20:48
*/
AjaxResult getUserByRoleIdCbx(SelectDto dto);
/**
* @param dto
* @return AjaxResult
* @description 往来单位id和标段工程id获取协议信息
* @author cwchen
* @date 2023/12/21 10:47
*/
AjaxResult getAgreementInfoById(SelectDto dto);
}

View File

@ -1,6 +1,7 @@
package com.bonus.sgzb.system.service.impl;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.system.domain.AgreementVo;
import com.bonus.sgzb.system.domain.SelectDto;
import com.bonus.sgzb.system.domain.SelectVo;
import com.bonus.sgzb.system.domain.TreeNode;
@ -212,12 +213,12 @@ public class SelectServiceImpl implements SelectService {
@Override
public AjaxResult getUserByRoleIdCbx(SelectDto dto) {
try {
if(Objects.equals("1",dto.getType())){
if (Objects.equals("1", dto.getType())) {
// 用户/维修员/库管员/采购员-下拉选
List<SelectVo> list = new ArrayList<>();
list = mapper.getUserByRoleIdCbxSelect(dto);
return AjaxResult.success(list);
}else if(Objects.equals("2",dto.getType())){
} else if (Objects.equals("2", dto.getType())) {
List<TreeNode> groupList = new ArrayList<>();
List<TreeNode> list = new ArrayList<>();
// 用户/维修员/库管员/采购员-
@ -231,8 +232,22 @@ public class SelectServiceImpl implements SelectService {
return AjaxResult.success(groupList);
}
} catch (Exception e) {
log.error("用户/维修员/库管员/采购员-查询失败",e);
log.error("用户/维修员/库管员/采购员-查询失败", e);
}
return AjaxResult.success(null);
}
@Override
public AjaxResult getAgreementInfoById(SelectDto dto) {
AgreementVo vo = new AgreementVo();
try {
List<AgreementVo> list = mapper.getAgreementInfoById(dto);
if (CollectionUtils.isNotEmpty(list)) {
vo = list.get(0);
}
} catch (Exception e) {
log.error("往来单位id和标段工程id获取协议信息", e);
}
return AjaxResult.success(vo);
}
}

View File

@ -174,4 +174,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN sys_user su ON sur.user_id = su.user_id AND su.del_flag = '0'
WHERE sr.role_key = #{roleKey} AND sr.del_flag = '0'
</select>
<!--往来单位id和标段工程id获取协议信息-->
<select id="getAgreementInfoById" resultType="com.bonus.sgzb.system.domain.AgreementVo">
SELECT agreement_id AS agreementId,
agreement_code AS agreementCode
FROM bm_agreement_info
WHERE unit_id = #{unitId} AND project_id = #{projectId} AND status = '1'
</select>
</mapper>