接口联调优化
This commit is contained in:
parent
77e577c22d
commit
d60dba621b
|
|
@ -33,8 +33,8 @@ public class MaTypeInfoController extends BaseController {
|
|||
*/
|
||||
@ApiOperation("首页搜索分类树")
|
||||
@GetMapping("/getEquipmentType")
|
||||
public AjaxResult getEquipmentType() {
|
||||
return maTypeInfoSevice.getMaTypeInfoList();
|
||||
public AjaxResult getEquipmentType(TypeInfo typeInfo) {
|
||||
return maTypeInfoSevice.getMaTypeInfoList(typeInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -16,9 +16,10 @@ public interface MaTypeInfoMapper {
|
|||
|
||||
/**
|
||||
* 查询设备类型列表
|
||||
* @param typeInfo
|
||||
* @return
|
||||
*/
|
||||
public List<TreeNode> getMaTypeInfoList() ;
|
||||
public List<TreeNode> getMaTypeInfoList(TypeInfo typeInfo) ;
|
||||
|
||||
/**
|
||||
* 热搜设备
|
||||
|
|
@ -32,7 +33,7 @@ public interface MaTypeInfoMapper {
|
|||
* @param typeInfo
|
||||
* @return
|
||||
*/
|
||||
List<TypeInfo> getTypeList(TypeInfo typeInfo);
|
||||
List<TypeInfo> getParentIdList(TypeInfo typeInfo);
|
||||
|
||||
/**
|
||||
* 租用需求大厅区域
|
||||
|
|
@ -40,4 +41,11 @@ public interface MaTypeInfoMapper {
|
|||
* @return
|
||||
*/
|
||||
List<AreaVo> getArea(AreaVo areaVo);
|
||||
|
||||
/**
|
||||
* 查询设备类型
|
||||
* @param typeInfo
|
||||
* @return
|
||||
*/
|
||||
TypeInfo getTypeId(TypeInfo typeInfo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ public interface MaTypeInfoSevice {
|
|||
* 查询分类树
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult getMaTypeInfoList();
|
||||
public AjaxResult getMaTypeInfoList(TypeInfo typeInfo);
|
||||
|
||||
/**
|
||||
* 首页搜索热搜装备
|
||||
|
|
|
|||
|
|
@ -28,11 +28,11 @@ public class MaTypeInfoServiceImpl implements MaTypeInfoSevice {
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult getMaTypeInfoList() {
|
||||
public AjaxResult getMaTypeInfoList(TypeInfo typeInfo) {
|
||||
List<TreeNode> groupList = new ArrayList<>();
|
||||
List<TreeNode> list = new ArrayList<>();
|
||||
try {
|
||||
list = maTypeInfoMapper.getMaTypeInfoList();
|
||||
list = maTypeInfoMapper.getMaTypeInfoList(typeInfo);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
// 创建树形结构(数据集合作为参数)
|
||||
TreeBuild treeBuild = new TreeBuild(list);
|
||||
|
|
@ -62,7 +62,23 @@ public class MaTypeInfoServiceImpl implements MaTypeInfoSevice {
|
|||
*/
|
||||
@Override
|
||||
public List<TypeInfo> getTypeList(TypeInfo typeInfo) {
|
||||
return maTypeInfoMapper.getTypeList(typeInfo);
|
||||
ArrayList<TypeInfo> infoArrayList = new ArrayList<>();
|
||||
if (typeInfo.getTypeId() == null) {
|
||||
return maTypeInfoMapper.getParentIdList(typeInfo);
|
||||
}
|
||||
List<TypeInfo> typeList = maTypeInfoMapper.getParentIdList(typeInfo);
|
||||
TypeInfo info = maTypeInfoMapper.getTypeId(typeInfo);
|
||||
if (info != null && info.getParentId() != null) {
|
||||
Long parentId = info.getParentId();
|
||||
TypeInfo info1 = new TypeInfo();
|
||||
info1.setTypeId(parentId);
|
||||
List<TypeInfo> list = maTypeInfoMapper.getParentIdList(info1);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
infoArrayList.addAll(list);
|
||||
}
|
||||
}
|
||||
infoArrayList.addAll(typeList);
|
||||
return infoArrayList;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -119,6 +119,12 @@ public class MaLeaseInfo extends BaseEntity implements Serializable {
|
|||
@ApiModelProperty(value = "区域名称")
|
||||
private String areaName;
|
||||
|
||||
@ApiModelProperty(value = "装备类目id集合")
|
||||
private List<String> typeIds;
|
||||
|
||||
@ApiModelProperty(value = "装备类目id集合")
|
||||
private String ids;
|
||||
|
||||
@ApiModelProperty(value = "文件信息")
|
||||
private List<BmFileInfo> fileInfoList;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,9 +50,6 @@ public class MaLeaseVo extends MaLeaseInfo {
|
|||
@ApiModelProperty(value = "装备三级类目名称")
|
||||
private String thirdName;
|
||||
|
||||
@ApiModelProperty(value = "装备类目id集合")
|
||||
private List<String> typeIds;
|
||||
|
||||
@ApiModelProperty(value = "浏览次数")
|
||||
private Integer searchNum;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,8 +25,10 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import javax.annotation.Resource;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 租赁需求大厅实现层
|
||||
|
|
@ -58,6 +60,9 @@ public class MaLeaseInfoServiceImpl implements MaLeaseInfoService {
|
|||
// 2. 生成需求编号及其他字段
|
||||
populateLeaseInfoFields(maLeaseInfo);
|
||||
// 3. 插入租赁需求
|
||||
if (CollectionUtils.isNotEmpty(maLeaseInfo.getTypeIds())) {
|
||||
maLeaseInfo.setIds(String.join(",", maLeaseInfo.getTypeIds()));
|
||||
}
|
||||
int result = leaseInfoMapper.insert(maLeaseInfo);
|
||||
if (result <= 0 || maLeaseInfo.getId() == null) {
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
|
|
@ -94,6 +99,9 @@ public class MaLeaseInfoServiceImpl implements MaLeaseInfoService {
|
|||
return AjaxResult.error(HttpCodeEnum.LEASE_END_TIME_ERROR.getCode(), HttpCodeEnum.LEASE_END_TIME_ERROR.getMsg());
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(maLeaseInfo.getTypeIds())) {
|
||||
maLeaseInfo.setIds(String.join(",", maLeaseInfo.getTypeIds()));
|
||||
}
|
||||
int result = leaseInfoMapper.updateDevInfo(maLeaseInfo);
|
||||
//首先根据id查询文件信息是否存在
|
||||
BmFileInfo bmFileInfo = new BmFileInfo();
|
||||
|
|
@ -129,11 +137,14 @@ public class MaLeaseInfoServiceImpl implements MaLeaseInfoService {
|
|||
if (CollectionUtil.isNotEmpty(fileList)) {
|
||||
maLeaseVo.setFileInfoList(fileList);
|
||||
}
|
||||
list.add(maLeaseVo.getFirstId());
|
||||
list.add(maLeaseVo.getSecondId());
|
||||
list.add(maLeaseVo.getThirdId());
|
||||
list.add(String.valueOf(maLeaseVo.getTypeId()));
|
||||
maLeaseVo.setTypeIds(list);
|
||||
if (StringUtils.isNotBlank(maLeaseVo.getIds())) {
|
||||
// 使用 StringUtils.split() 按逗号分割 ids 字符串
|
||||
String[] idsArray = StringUtils.split(maLeaseVo.getIds(), ",");
|
||||
// 将分割后的元素添加到 list 中
|
||||
// 将分割出来的 id 添加到 list 中
|
||||
list.addAll(Arrays.asList(idsArray));
|
||||
maLeaseVo.setTypeIds(list);
|
||||
}
|
||||
//更新搜索量
|
||||
try {
|
||||
//只针对于待接单状态租赁需求更新浏览量
|
||||
|
|
|
|||
|
|
@ -55,16 +55,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LIMIT 5
|
||||
</select>
|
||||
|
||||
<select id="getTypeList" resultType="com.bonus.common.biz.domain.TypeInfo">
|
||||
<select id="getParentIdList" resultType="com.bonus.common.biz.domain.TypeInfo">
|
||||
select
|
||||
type_id as typeId, parent_id as parentId, type_name as typeName, `level` as level, del_flag as delFlag, unit_name as unitName
|
||||
from ma_type
|
||||
where del_flag = '0' and level = '1'
|
||||
where del_flag = '0'
|
||||
<if test="typeId == null">
|
||||
and level = '1'
|
||||
</if>
|
||||
<if test="typeName != null and typeName != ''">
|
||||
and type_name like concat('%',#{typeName},'%')
|
||||
</if>
|
||||
<if test="parentId != null and parentId != ''">
|
||||
and parent_id = #{parentId}
|
||||
<if test="typeId != null">
|
||||
and parent_id = #{typeId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
|
@ -89,4 +92,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getTypeId" resultType="com.bonus.common.biz.domain.TypeInfo">
|
||||
select
|
||||
type_id as typeId, parent_id as parentId, type_name as typeName, `level` as level, del_flag as delFlag, unit_name as unitName
|
||||
from ma_type
|
||||
where del_flag = '0'
|
||||
<if test="typeId != null">
|
||||
and type_id = #{typeId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -9,6 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="leaseName != null and leaseName != ''">lease_name,</if>
|
||||
<if test="leaseCode != null and leaseCode != ''">lease_code,</if>
|
||||
<if test="typeId != null">type_id,</if>
|
||||
<if test="ids != null">type_ids,</if>
|
||||
<if test="companyId != null">company_id,</if>
|
||||
<if test="areaId != null">area_id,</if>
|
||||
<if test="leaseStatus != null">lease_status,</if>
|
||||
|
|
@ -27,6 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="leaseName != null and leaseName != ''">#{leaseName},</if>
|
||||
<if test="leaseCode != null and leaseCode != ''">#{leaseCode},</if>
|
||||
<if test="typeId != null">#{typeId},</if>
|
||||
<if test="ids != null">#{ids},</if>
|
||||
<if test="companyId != null">#{companyId},</if>
|
||||
<if test="areaId != null">#{areaId},</if>
|
||||
<if test="leaseStatus != null">#{leaseStatus},</if>
|
||||
|
|
@ -53,6 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="leaseName != null and leaseName != ''">lease_name = #{leaseName},</if>
|
||||
<if test="typeId != null">type_id = #{typeId},</if>
|
||||
<if test="ids != null">type_ids = #{ids},</if>
|
||||
<if test="companyId != null">company_id = #{companyId},</if>
|
||||
<if test="areaId != null">area_id = #{areaId},</if>
|
||||
<if test="leaseDay != null ">lease_day = #{leaseDay},</if>
|
||||
|
|
@ -89,6 +92,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
m.lease_name as leaseName,
|
||||
m.lease_code as leaseCode,
|
||||
m.type_id as typeId,
|
||||
m.type_ids as ids,
|
||||
mt4.type_name as typeName,
|
||||
m.company_id as companyId,
|
||||
c.company_name as companyName,
|
||||
|
|
@ -108,7 +112,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
mt2.type_name as secondName,
|
||||
mt1.type_id as firstId,
|
||||
mt1.type_name as firstName,
|
||||
GROUP_CONCAT(CONCAT(mt1.type_name, '/', mt2.type_name, '/', mt3.type_name)) AS groupName,
|
||||
CASE
|
||||
-- 第一级
|
||||
WHEN mt1.type_id IS NULL
|
||||
AND mt2.type_id IS NULL
|
||||
AND mt3.type_id IS NULL
|
||||
AND mt4.type_id IS NOT NULL THEN
|
||||
mt4.type_name
|
||||
-- 第二级
|
||||
WHEN mt1.type_id IS NULL
|
||||
AND mt2.type_id IS NULL
|
||||
AND mt3.type_id IS NOT NULL
|
||||
AND mt4.type_id IS NOT NULL THEN
|
||||
CONCAT( mt3.type_name, '/', mt4.type_name )
|
||||
-- 第三级
|
||||
WHEN mt1.type_id IS NULL
|
||||
AND mt2.type_id IS NOT NULL
|
||||
AND mt3.type_id IS NOT NULL
|
||||
AND mt4.type_id IS NOT NULL THEN
|
||||
CONCAT( mt2.type_name, '/', mt3.type_name, '/', mt4.type_name )
|
||||
-- 第四级
|
||||
WHEN mt1.type_id IS NOT NULL
|
||||
AND mt2.type_id IS NOT NULL
|
||||
AND mt3.type_id IS NOT NULL
|
||||
AND mt4.type_id IS NOT NULL THEN
|
||||
CONCAT( mt1.type_name, '/', mt2.type_name, '/', mt3.type_name, '/', mt4.type_name )
|
||||
ELSE NULL
|
||||
END AS groupName,
|
||||
m.publish_user as publishUser,
|
||||
m.area_id as areaId,
|
||||
b.name as areaName
|
||||
|
|
@ -190,34 +220,60 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<select id="leaseList" resultType="com.bonus.material.lease.domain.vo.MaLeaseVo">
|
||||
SELECT
|
||||
m.id as id,
|
||||
m.lease_name as leaseName,
|
||||
m.lease_code as leaseCode,
|
||||
m.type_id as typeId,
|
||||
mt4.type_name as typeName,
|
||||
m.company_id as companyId,
|
||||
c.company_name as companyName,
|
||||
c.operate_address as operateAddress,
|
||||
m.lease_status as leaseStatus,
|
||||
m.lease_day as leaseDay,
|
||||
m.lease_num as leaseNum,
|
||||
m.start_time as startTime,
|
||||
m.end_time as endTime,
|
||||
m.person as person,
|
||||
m.person_phone as personPhone,
|
||||
m.description as description,
|
||||
mt3.type_id as thirdId,
|
||||
mt3.type_name as thirdName,
|
||||
mt2.type_id as secondId,
|
||||
mt2.type_name as secondName,
|
||||
mt1.type_id as firstId,
|
||||
mt1.type_name as firstName,
|
||||
GROUP_CONCAT(CONCAT(mt1.type_name, '/', mt2.type_name, '/', mt3.type_name)) AS groupName,
|
||||
m.publish_user as publishUser,
|
||||
b.id as areaId,
|
||||
b.name as areaName
|
||||
m.id as id,
|
||||
m.lease_name as leaseName,
|
||||
m.lease_code as leaseCode,
|
||||
m.type_id as typeId,
|
||||
mt4.type_name as typeName,
|
||||
m.company_id as companyId,
|
||||
c.company_name as companyName,
|
||||
c.operate_address as operateAddress,
|
||||
m.lease_status as leaseStatus,
|
||||
m.lease_day as leaseDay,
|
||||
m.lease_num as leaseNum,
|
||||
m.start_time as startTime,
|
||||
m.end_time as endTime,
|
||||
m.person as person,
|
||||
m.person_phone as personPhone,
|
||||
m.description as description,
|
||||
mt3.type_id as thirdId,
|
||||
mt3.type_name as thirdName,
|
||||
mt2.type_id as secondId,
|
||||
mt2.type_name as secondName,
|
||||
mt1.type_id as firstId,
|
||||
mt1.type_name as firstName,
|
||||
CASE
|
||||
-- 第一级
|
||||
WHEN mt1.type_id IS NULL
|
||||
AND mt2.type_id IS NULL
|
||||
AND mt3.type_id IS NULL
|
||||
AND mt4.type_id IS NOT NULL THEN
|
||||
mt4.type_name
|
||||
-- 第二级
|
||||
WHEN mt1.type_id IS NULL
|
||||
AND mt2.type_id IS NULL
|
||||
AND mt3.type_id IS NOT NULL
|
||||
AND mt4.type_id IS NOT NULL THEN
|
||||
CONCAT( mt3.type_name, '/', mt4.type_name )
|
||||
-- 第三级
|
||||
WHEN mt1.type_id IS NULL
|
||||
AND mt2.type_id IS NOT NULL
|
||||
AND mt3.type_id IS NOT NULL
|
||||
AND mt4.type_id IS NOT NULL THEN
|
||||
CONCAT( mt2.type_name, '/', mt3.type_name, '/', mt4.type_name )
|
||||
-- 第四级
|
||||
WHEN mt1.type_id IS NOT NULL
|
||||
AND mt2.type_id IS NOT NULL
|
||||
AND mt3.type_id IS NOT NULL
|
||||
AND mt4.type_id IS NOT NULL THEN
|
||||
CONCAT( mt1.type_name, '/', mt2.type_name, '/', mt3.type_name, '/', mt4.type_name )
|
||||
ELSE NULL
|
||||
END AS groupName,
|
||||
m.publish_user as publishUser,
|
||||
b.id as areaId,
|
||||
b.name as areaName
|
||||
FROM
|
||||
ma_lease_info m
|
||||
ma_lease_info m
|
||||
LEFT JOIN bm_company_info c ON m.company_id = c.company_id
|
||||
LEFT JOIN base_address b ON b.id = m.area_id
|
||||
LEFT JOIN sys_user su ON m.publish_user = su.user_id
|
||||
|
|
@ -238,7 +294,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
and mt2.type_id = #{typeId}
|
||||
</when>
|
||||
<when test="level != null and level == 1">
|
||||
and mt1.type_id = #{typeId}
|
||||
and (
|
||||
mt1.type_id = 1
|
||||
OR mt2.type_id = 1
|
||||
OR mt3.type_id = 1
|
||||
OR mt4.type_id = 1
|
||||
)
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
|
|
|
|||
Loading…
Reference in New Issue