装备共享大厅联调
This commit is contained in:
parent
7df56e43cc
commit
9409c65920
|
|
@ -17,7 +17,7 @@ public class TreeNode {
|
|||
|
||||
private long id;
|
||||
|
||||
private String label;
|
||||
private String name;
|
||||
|
||||
private long parentId;
|
||||
|
||||
|
|
@ -27,6 +27,9 @@ public class TreeNode {
|
|||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private String unitName;
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private String manageType;
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private String companyId;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
package com.bonus.material.device.controller;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import com.bonus.common.biz.config.ListPagingUtil;
|
||||
import com.bonus.common.biz.domain.BmCompanyInfo;
|
||||
import com.bonus.common.core.utils.ServletUtils;
|
||||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
|
|
@ -17,6 +20,9 @@ import javax.annotation.Resource;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
import static com.bonus.common.core.web.page.TableSupport.PAGE_NUM;
|
||||
import static com.bonus.common.core.web.page.TableSupport.PAGE_SIZE;
|
||||
|
||||
/**
|
||||
* 设备信息Controller
|
||||
*
|
||||
|
|
@ -35,11 +41,12 @@ public class DevInfoController extends BaseController {
|
|||
*/
|
||||
// @RequiresPermissions("equip:info:list")
|
||||
@ApiOperation(value = "装备列表")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(DevInfoVo devInfo) {
|
||||
startPage();
|
||||
@PostMapping("/list")
|
||||
public AjaxResult list(@RequestBody DevInfoVo devInfo) {
|
||||
List<DevInfoVo> list = devInfoService.selectDevInfoList(devInfo);
|
||||
return getDataTable(list);
|
||||
Integer pageIndex = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
|
||||
Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
|
||||
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
package com.bonus.material.home.controller;
|
||||
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import com.bonus.common.biz.domain.TypeInfo;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.material.device.domain.vo.DevInfoVo;
|
||||
import com.bonus.material.home.service.MaTypeInfoSevice;
|
||||
import io.swagger.annotations.Api;
|
||||
|
|
@ -34,9 +32,8 @@ public class MaTypeInfoController extends BaseController {
|
|||
*/
|
||||
@ApiOperation("首页搜索分类树")
|
||||
@GetMapping("/getEquipmentType")
|
||||
public TableDataInfo getEquipmentType() {
|
||||
List<Tree<Long>> list = maTypeInfoSevice.getMaTypeInfoList();
|
||||
return getDataTable(list);
|
||||
public AjaxResult getEquipmentType() {
|
||||
return maTypeInfoSevice.getMaTypeInfoList();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.bonus.material.home.mapper;
|
||||
|
||||
|
||||
import com.bonus.common.biz.domain.TreeNode;
|
||||
import com.bonus.common.biz.domain.TypeInfo;
|
||||
import com.bonus.material.device.domain.vo.DevInfoVo;
|
||||
|
||||
|
|
@ -16,7 +17,7 @@ public interface MaTypeInfoMapper {
|
|||
* 查询设备类型列表
|
||||
* @return
|
||||
*/
|
||||
public List<TypeInfo> getMaTypeInfoList() ;
|
||||
public List<TreeNode> getMaTypeInfoList() ;
|
||||
|
||||
/**
|
||||
* 热搜设备
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.bonus.material.home.service;
|
||||
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import com.bonus.common.biz.domain.TypeInfo;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.device.domain.vo.DevInfoVo;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -15,7 +15,7 @@ public interface MaTypeInfoSevice {
|
|||
* 查询分类树
|
||||
* @return
|
||||
*/
|
||||
public List<Tree<Long>> getMaTypeInfoList();
|
||||
public AjaxResult getMaTypeInfoList();
|
||||
|
||||
/**
|
||||
* 首页搜索热搜装备
|
||||
|
|
|
|||
|
|
@ -1,20 +1,22 @@
|
|||
package com.bonus.material.home.service.impl;
|
||||
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import cn.hutool.core.lang.tree.TreeNode;
|
||||
import cn.hutool.core.lang.tree.TreeUtil;
|
||||
import com.bonus.common.biz.domain.TreeBuild;
|
||||
import com.bonus.common.biz.domain.TreeNode;
|
||||
import com.bonus.common.biz.domain.TypeInfo;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.device.domain.vo.DevInfoVo;
|
||||
import com.bonus.material.home.mapper.MaTypeInfoMapper;
|
||||
import com.bonus.material.home.service.MaTypeInfoSevice;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class MaTypeInfoServiceImpl implements MaTypeInfoSevice {
|
||||
|
||||
@Resource
|
||||
|
|
@ -25,11 +27,21 @@ public class MaTypeInfoServiceImpl implements MaTypeInfoSevice {
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Tree<Long>> getMaTypeInfoList() {
|
||||
List<TypeInfo> maTypeInfoList = maTypeInfoMapper.getMaTypeInfoList();
|
||||
List<TreeNode<Long>> collect = maTypeInfoList
|
||||
.stream().map(getNodeFunction()).collect(Collectors.toList());
|
||||
return TreeUtil.build(collect,0L);
|
||||
public AjaxResult getMaTypeInfoList() {
|
||||
List<TreeNode> groupList = new ArrayList<>();
|
||||
List<TreeNode> list = new ArrayList<>();
|
||||
try {
|
||||
list = maTypeInfoMapper.getMaTypeInfoList();
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
// 创建树形结构(数据集合作为参数)
|
||||
TreeBuild treeBuild = new TreeBuild(list);
|
||||
// 原查询结果转换树形结构
|
||||
groupList = treeBuild.buildTree();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("设备类型树-查询失败", e);
|
||||
}
|
||||
return AjaxResult.success(groupList);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -51,19 +63,4 @@ public class MaTypeInfoServiceImpl implements MaTypeInfoSevice {
|
|||
return maTypeInfoMapper.getTypeList(typeInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取节点转换函数方法抽取
|
||||
* @return
|
||||
*/
|
||||
private Function<TypeInfo, TreeNode<Long>> getNodeFunction() {
|
||||
|
||||
return typeInfo -> {
|
||||
TreeNode<Long> node = new TreeNode<>();
|
||||
node.setId(typeInfo.getTypeId());
|
||||
node.setName(typeInfo.getTypeName());
|
||||
node.setParentId(typeInfo.getParentId());
|
||||
node.setWeight(typeInfo.getLevel());
|
||||
return node;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,24 +89,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN ma_type mt1 ON mt1.type_id = mt2.parent_id and mt1.del_flag = '0'
|
||||
<where>
|
||||
<if test="maId != null "> and d.ma_id = #{maId}</if>
|
||||
<if test="maStatus != null and maStatus != ''"> and d.ma_status = #{maStatus}</if>
|
||||
<if test="code != null and code != ''"> and d.code = #{code}</if>
|
||||
<if test="deviceName != null and deviceName != ''">
|
||||
and d.device_name like concat('%',#{deviceName},'%')
|
||||
</if>
|
||||
<if test="typeId != null">
|
||||
<if test="level != null and level == '4'">
|
||||
and d.type_id = #{typeId}
|
||||
</if>
|
||||
<if test="level != null and level == '3'">
|
||||
and mt3.type_id = #{typeId}
|
||||
</if>
|
||||
<if test="level != null and level == '2'">
|
||||
and mt2.type_id = #{typeId}
|
||||
</if>
|
||||
<if test="level != null and level == '1'">
|
||||
and mt1.type_id = #{typeId}
|
||||
</if>
|
||||
<choose>
|
||||
<when test="level != null and level == 4">
|
||||
and d.type_id = #{typeId}
|
||||
</when>
|
||||
<when test="level != null and level == 3">
|
||||
and mt3.type_id = #{typeId}
|
||||
</when>
|
||||
<when test="level != null and level == 2">
|
||||
and mt2.type_id = #{typeId}
|
||||
</when>
|
||||
<when test="level != null and level == 1">
|
||||
and mt1.type_id = #{typeId}
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
<if test="maStatus != null and maStatus != ''"> and d.ma_status = #{maStatus}</if>
|
||||
<if test="leaseScope != null "> and d.lease_scope = #{leaseScope}</if>
|
||||
|
|
@ -120,6 +121,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
and DATEDIFF(DATE_FORMAT(now(), '%Y-%m-%d'), d.production_date) >= #{ageMin} * 365
|
||||
and DATEDIFF(DATE_FORMAT(now(), '%Y-%m-%d'), d.production_date) <= #{ageMax} * 365
|
||||
</if>
|
||||
<if test="ageMin == null and ageMin == '' and ageMax != null and ageMax != ''">
|
||||
and DATEDIFF(DATE_FORMAT(now(), '%Y-%m-%d'), d.production_date) > #{ageMax} * 365
|
||||
</if>
|
||||
<if test="workingHoursMin != null and workingHoursMin != '' and workingHoursMax != null and workingHoursMax != ''">
|
||||
and d.working_hours >= #{workingHoursMin} and d.working_hours <= #{workingHoursMax}
|
||||
</if>
|
||||
|
|
@ -129,7 +133,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</if>
|
||||
<if test="description != null and description != ''"> and d.description = #{description}</if>
|
||||
<if test="gpsCode != null and gpsCode != ''"> and d.gps_code = #{gpsCode}</if>
|
||||
<if test="companyId != null "> and d.own_co = #{companyId}</if>
|
||||
<if test="companyId != null and companyId != ''"> and d.own_co = #{companyId}</if>
|
||||
<if test="specification != null "> and d.specification = #{specification}</if>
|
||||
<if test="deposit != null "> and d.deposit = #{deposit}</if>
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
|
|
|
|||
|
|
@ -19,11 +19,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where del_flag = '0'
|
||||
</sql>
|
||||
|
||||
<select id="getMaTypeInfoList" 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
|
||||
from ma_type
|
||||
where del_flag = '0'
|
||||
</select>
|
||||
|
||||
<select id="getHotSearch" resultType="com.bonus.material.device.domain.vo.DevInfoVo">
|
||||
SELECT
|
||||
|
|
@ -71,5 +66,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getMaTypeInfoList" resultType="com.bonus.common.biz.domain.TreeNode">
|
||||
select type_id as id, parent_id as parentId, type_name as name, `level` as level, manage_type as manageType,
|
||||
unit_name as unitName, del_flag as delFlag
|
||||
from ma_type
|
||||
where del_flag = '0'
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue