This commit is contained in:
zfhai 2023-12-03 15:34:08 +08:00
parent a89b24a956
commit a8f6f6f19d
16 changed files with 574 additions and 9 deletions

View File

@ -0,0 +1,8 @@
package com.bonus.zlpt.common.core.domain.vo;
import com.bonus.zlpt.common.core.domain.MaDevInfo;
public class MaDevInfoVo extends MaDevInfo {
private long parentId;
}

View File

@ -1,14 +1,19 @@
package com.bonus.zlpt.home.controller; package com.bonus.zlpt.home.controller;
import com.bonus.zlpt.common.core.domain.MaDevInfo;
import com.bonus.zlpt.common.core.domain.vo.MaDevInfoVo;
import com.bonus.zlpt.common.core.web.controller.BaseController; import com.bonus.zlpt.common.core.web.controller.BaseController;
import com.bonus.zlpt.common.core.web.page.TableDataInfo; import com.bonus.zlpt.common.core.web.page.TableDataInfo;
import com.bonus.zlpt.home.service.MaDevInfoService; import com.bonus.zlpt.home.service.MaDevInfoService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController @RestController
@RequestMapping("/devInfo") @RequestMapping("/devInfo")
public class MaDevInfoController extends BaseController { public class MaDevInfoController extends BaseController {
@ -17,15 +22,15 @@ public class MaDevInfoController extends BaseController {
@Autowired @Autowired
private MaDevInfoService maDevInfoService; private MaDevInfoService maDevInfoService;
/**
* 根据条件进行往来单位管理-人员配置查询
*/
//@PostMapping("/getHotEquipList")
/* public TableDataInfo getHotEquipList() {
startPage();
List<BmUnitPerson> list = maDevInfoService.getUnitPerson(bmUnitPerson);
return getDataTable(list);
}*/ /**
* 搜索栏
* @return
*/
@PostMapping("/getEquipmentList")
public TableDataInfo getEquipmentList(@Validated @RequestBody MaDevInfo maDevInfo) {
List<MaDevInfoVo> list = maDevInfoService.getEquipmentList(maDevInfo);
return getDataTable(list);
}
} }

View File

@ -0,0 +1,40 @@
package com.bonus.zlpt.home.controller;
import com.bonus.zlpt.common.core.domain.MaDevInfo;
import com.bonus.zlpt.common.core.domain.MaTypeInfo;
import com.bonus.zlpt.common.core.domain.vo.MaDevInfoVo;
import com.bonus.zlpt.common.core.web.controller.BaseController;
import com.bonus.zlpt.common.core.web.page.TableDataInfo;
import com.bonus.zlpt.home.service.MaHotSearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("/hotSearch")
public class MaHotSearchController extends BaseController {
@Autowired
private MaHotSearchService maHotSearchService;
/**
* 热搜装备
* @return
*/
@PostMapping("getHotEquipList")
public TableDataInfo getHotEquipList(@Validated @RequestBody String more) {
//获取更多
if (more!=null && more != ""){
List<MaDevInfoVo> list = maHotSearchService.getHotEquipList();
return getDataTable(list);
}
//获取热搜前四的装备
List<MaDevInfoVo> list = maHotSearchService.getHotEquipFourList();
return getDataTable(list);
}
}

View File

@ -0,0 +1,34 @@
package com.bonus.zlpt.home.controller;
import com.bonus.zlpt.common.core.domain.MaDevInfo;
import com.bonus.zlpt.common.core.domain.MaTypeInfo;
import com.bonus.zlpt.common.core.web.controller.BaseController;
import com.bonus.zlpt.common.core.web.page.TableDataInfo;
import com.bonus.zlpt.home.service.MaTypeInfoSevice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("/maType")
public class MaTypeInfoController extends BaseController {
@Autowired
private MaTypeInfoSevice maTypeInfoSevice;
/**
* 搜索分类
* @return
*/
@PostMapping("/getEquipmentType")
public TableDataInfo getEquipmentType() {
List<MaTypeInfo> list = maTypeInfoSevice.getMaTypeInfoList();
return getDataTable(list);
}
}

View File

@ -1,4 +1,10 @@
package com.bonus.zlpt.home.mapper; package com.bonus.zlpt.home.mapper;
import com.bonus.zlpt.common.core.domain.MaDevInfo;
import com.bonus.zlpt.common.core.domain.vo.MaDevInfoVo;
import java.util.List;
public interface MaDevInfoMapper { public interface MaDevInfoMapper {
public List<MaDevInfoVo> getEquipmentList(MaDevInfo maDevInfo);
} }

View File

@ -0,0 +1,11 @@
package com.bonus.zlpt.home.mapper;
import com.bonus.zlpt.common.core.domain.vo.MaDevInfoVo;
import java.util.List;
public interface MaHotSearchMapper {
public List<MaDevInfoVo> getHotEquipList();
public List<MaDevInfoVo> getHotEquipFourList();
}

View File

@ -0,0 +1,10 @@
package com.bonus.zlpt.home.mapper;
import com.bonus.zlpt.common.core.domain.MaTypeInfo;
import java.util.List;
public interface MaTypeInfoMapper {
public List<MaTypeInfo> getMaTypeInfoList() ;
}

View File

@ -1,4 +1,10 @@
package com.bonus.zlpt.home.service; package com.bonus.zlpt.home.service;
import com.bonus.zlpt.common.core.domain.MaDevInfo;
import com.bonus.zlpt.common.core.domain.vo.MaDevInfoVo;
import java.util.List;
public interface MaDevInfoService { public interface MaDevInfoService {
public List<MaDevInfoVo> getEquipmentList(MaDevInfo maDevInfo);
} }

View File

@ -0,0 +1,11 @@
package com.bonus.zlpt.home.service;
import com.bonus.zlpt.common.core.domain.vo.MaDevInfoVo;
import java.util.List;
public interface MaHotSearchService {
public List<MaDevInfoVo> getHotEquipList();
public List<MaDevInfoVo> getHotEquipFourList();
}

View File

@ -0,0 +1,11 @@
package com.bonus.zlpt.home.service;
import com.bonus.zlpt.common.core.domain.MaDevInfo;
import com.bonus.zlpt.common.core.domain.MaTypeInfo;
import java.util.List;
public interface MaTypeInfoSevice {
public List<MaTypeInfo> getMaTypeInfoList();
}

View File

@ -1,6 +1,19 @@
package com.bonus.zlpt.home.service.impl; package com.bonus.zlpt.home.service.impl;
import com.bonus.zlpt.common.core.domain.MaDevInfo;
import com.bonus.zlpt.common.core.domain.vo.MaDevInfoVo;
import com.bonus.zlpt.home.mapper.MaDevInfoMapper;
import com.bonus.zlpt.home.service.MaDevInfoService; import com.bonus.zlpt.home.service.MaDevInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
public class MaDevInfoServiceImpl implements MaDevInfoService { public class MaDevInfoServiceImpl implements MaDevInfoService {
@Autowired
private MaDevInfoMapper maDevInfoMapper;
@Override
public List<MaDevInfoVo> getEquipmentList(MaDevInfo maDevInfo) {
return maDevInfoMapper.getEquipmentList(maDevInfo);
}
} }

View File

@ -0,0 +1,25 @@
package com.bonus.zlpt.home.service.impl;
import com.bonus.zlpt.common.core.domain.vo.MaDevInfoVo;
import com.bonus.zlpt.home.mapper.MaHotSearchMapper;
import com.bonus.zlpt.home.service.MaHotSearchService;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
public class MaHotSearchServiceImpl implements MaHotSearchService {
@Autowired
private MaHotSearchMapper maHotSearchMapper;
@Override
public List<MaDevInfoVo> getHotEquipList() {
return maHotSearchMapper.getHotEquipList();
}
@Override
public List<MaDevInfoVo> getHotEquipFourList() {
return maHotSearchMapper.getHotEquipFourList();
}
}

View File

@ -0,0 +1,73 @@
package com.bonus.zlpt.home.service.impl;
import com.bonus.zlpt.common.core.domain.MaDevInfo;
import com.bonus.zlpt.common.core.domain.MaTypeInfo;
import com.bonus.zlpt.home.mapper.MaDevInfoMapper;
import com.bonus.zlpt.home.mapper.MaTypeInfoMapper;
import com.bonus.zlpt.home.service.MaTypeInfoSevice;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class MaTypeInfoServiceImpl implements MaTypeInfoSevice {
@Autowired
private MaTypeInfoMapper maTypeInfoMapper;
@Override
public List<MaTypeInfo> getMaTypeInfoList() {
List<MaTypeInfo> maTypeInfoList = maTypeInfoMapper.getMaTypeInfoList();
List<MaTypeInfo> menuTree = buildMenuTree(maTypeInfoList);
return menuTree;
}
/**
* 构建菜单树
* @param
* @return
*/
private List<MaTypeInfo> buildMenuTree(List<MaTypeInfo> maTypeInfoList) {
//用于存放根菜单
List<MaTypeInfo> rootMenus = new ArrayList<>();
Map<Long, List<MaTypeInfo>> menuMap = new HashMap<>();
// 将菜单按照父菜单ID分组,放在menuMap中
for (MaTypeInfo maTypeInfo : maTypeInfoList) {
Long parentId = maTypeInfo.getParentId() != ' ' ? maTypeInfo.getParentId() : 0;
if (!menuMap.containsKey(parentId)) {
menuMap.put(parentId, new ArrayList<>());
}
menuMap.get(parentId).add(maTypeInfo);
}
// 从根菜单开始构建菜单树
rootMenus.addAll(menuMap.getOrDefault(0, new ArrayList<>()));
System.out.println("rootMenus: "+rootMenus);
for (MaTypeInfo maTypeInfo : rootMenus) {
buildSubMenuTree(maTypeInfo, menuMap);
}
return rootMenus;
}
/**
* 根据父菜单节点逐级构建子树按顺序排列
* @param maTypeInfo
* @param menuMap
*/
private void buildSubMenuTree(MaTypeInfo maTypeInfo, Map<Long, List<MaTypeInfo>> menuMap) {
//获取根菜单的子节点列表
List<MaTypeInfo> children = menuMap.getOrDefault(maTypeInfo.getTypeId(), new ArrayList<>());
//Collections.sort(children);
maTypeInfo.setChildren(children);
for (MaTypeInfo maTypeInfoChildren : children) {
buildSubMenuTree(maTypeInfoChildren, menuMap);
}
}
}

View File

@ -0,0 +1,113 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.zlpt.home.mapper.MaDevInfoMapper">
<resultMap type="com.bonus.zlpt.common.core.domain.MaDevInfo" id="MaDevInfoResult">
<id property="maId" column="ma_id" />
<result property="code" column="code" />
<result property="typeId" column="type_id" />
<result property="maStatus" column="ma_status" />
<result property="leaseScope" column="lease_scope" />
<result property="location" column="location" />
<result property="brand" column="brand" />
<result property="modelName" column="model_name" />
<result property="productionDate" column="production_date" />
<result property="workingHours" column="working_hours" />
<result property="serialNumber" column="serial_number" />
<result property="monthLeasePrice" column="month_lease_price" />
<result property="dayLeasePrice" column="day_lease_price" />
<result property="picUrl" column="pic_url" />
<result property="jsMonthPrice" column="js_month_price" />
<result property="jsDayPrice" column="js_day_price" />
<result property="description" column="description" />
<result property="gpsCode" column="gps_code" />
<result property="ownCo" column="own_co" />
<result property="createTime" column="create_time" />
<result property="creator" column="creator" />
<result property="deposit" column="deposit" />
<result property="isActive" column="is_active" />
</resultMap>
<select id="getEquipmentList" resultType="com.bonus.zlpt.common.core.domain.vo.MaDevInfoVo">
select d.ma_id, d.code, d.type_id, d.ma_status, d.lease_scope, d.location, d.brand, d.model_name,
d.production_date, d.working_hours, d.serial_number, d.month_lease_price, d.day_lease_price,
d.pic_url, d.js_month_price, d.js_day_price, d.description, d.gps_code, d.own_co, d.create_time,
d.creator, d.deposit, d.is_active, t.parent_id
from ma_dev_info d left join ma_type_info t on d.type_id = t.type_id
<where>
<if test="maId != null and maId != ''">
AND ma_id = #{maId}
</if>
<if test="code != null and code != ''">
AND code = #{code}
</if>
<if test="typeId != null and typeId != ''">
AND type_id = #{typeId}
</if>
<if test="maStatus != null and maStatus != ''">
AND ma_status = #{maStatus}
</if>
<if test="leaseScope != null and leaseScope != ''">
AND lease_scope = #{leaseScope}
</if>
<if test="location != null and location != ''">
AND location = #{location}
</if>
<if test="brand != null and brand != ''">
AND brand = #{brand}
</if>
<if test="modelName != null and modelName != ''">
AND model_name = #{modelName}
</if>
<if test="productionDate != null and productionDate != ''">
AND production_date = #{productionDate}
</if>
<if test="workingHours != null and workingHours != ''">
AND working_hours = #{workingHours}
</if>
<if test="serialNumber != null and serialNumber != ''">
AND serial_number = #{serialNumber}
</if>
<if test="monthLeasePrice != null and monthLeasePrice != ''">
AND month_lease_price = #{monthLeasePrice}
</if>
<if test="dayLeasePrice != null and dayLeasePrice != ''">
AND day_lease_price = #{dayLeasePrice}
</if>
<if test="picUrl != null and picUrl != ''">
AND pic_url = #{picUrl}
</if>
<if test="jsMonthPrice != null and jsMonthPrice != ''">
AND js_month_price = #{jsMonthPrice}
</if>
<if test="jsDayPrice != null and jsDayPrice != ''">
AND js_day_price = #{jsDayPrice}
</if>
<if test="description != null and description != ''">
AND description = #{description}
</if>
<if test="gpsCode != null and gpsCode != ''">
AND gps_code = #{gpsCode}
</if>
<if test="ownCo != null and ownCo != ''">
AND own_co = #{ownCo}
</if>
<if test="createTime != null and createTime != ''">
AND create_time = #{createTime}
</if>
<if test="creator != null and creator != ''">
AND creator = #{creator}
</if>
<if test="deposit != null and deposit != ''">
AND deposit = #{deposit}
</if>
<if test="isActive != null and isActive != ''">
AND is_active = #{isActive}
</if>
</where>
</select>
</mapper>

View File

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.zlpt.home.mapper.MaHotSearchMapper">
<resultMap type="com.bonus.zlpt.common.core.domain.vo.MaDevInfoVo" id="MaDevInfoResult">
<id property="maId" column="ma_id" />
<result property="code" column="code" />
<result property="typeId" column="type_id" />
<result property="maStatus" column="ma_status" />
<result property="leaseScope" column="lease_scope" />
<result property="location" column="location" />
<result property="brand" column="brand" />
<result property="modelName" column="model_name" />
<result property="productionDate" column="production_date" />
<result property="workingHours" column="working_hours" />
<result property="serialNumber" column="serial_number" />
<result property="monthLeasePrice" column="month_lease_price" />
<result property="dayLeasePrice" column="day_lease_price" />
<result property="picUrl" column="pic_url" />
<result property="jsMonthPrice" column="js_month_price" />
<result property="jsDayPrice" column="js_day_price" />
<result property="description" column="description" />
<result property="gpsCode" column="gps_code" />
<result property="ownCo" column="own_co" />
<result property="createTime" column="create_time" />
<result property="creator" column="creator" />
<result property="deposit" column="deposit" />
<result property="isActive" column="is_active" />
</resultMap>
<select id="getHotEquipList" resultType="com.bonus.zlpt.common.core.domain.vo.MaDevInfoVo">
select d.ma_id, d.code, d.type_id, d.ma_status, d.lease_scope, d.location, d.brand, d.model_name,
d.production_date, d.working_hours, d.serial_number, d.month_lease_price, d.day_lease_price,
d.pic_url, d.js_month_price, d.js_day_price, d.description, d.gps_code, d.own_co, d.create_time,
d.creator, d.deposit, d.is_active, t.parent_id
from ma_hot_search h join ma_dev_info d on h.ma_id = d.ma_id
join ma_type_info t on d.type_id = t.type_id
</select>
<select id="getHotEquipFourList" resultType="com.bonus.zlpt.common.core.domain.vo.MaDevInfoVo">
select d.ma_id, d.code, d.type_id, d.ma_status, d.lease_scope, d.location, d.brand, d.model_name,
d.production_date, d.working_hours, d.serial_number, d.month_lease_price, d.day_lease_price,
d.pic_url, d.js_month_price, d.js_day_price, d.description, d.gps_code, d.own_co, d.create_time,
d.creator, d.deposit, d.is_active, t.parent_id, h.search_num
from ma_hot_search h join ma_dev_info d on h.ma_id = d.ma_id
join ma_type_info t on d.type_id = t.type_id ORDER BY h.search_num desc LIMIT 4
</select>
</mapper>

View File

@ -0,0 +1,143 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.zlpt.home.mapper.MaDevInfoMapper">
<resultMap type="com.bonus.zlpt.common.core.domain.MaDevInfo" id="MaDevInfoResult">
<id property="typeId" column="type_id" />
<result property="parentId" column="parent_id" />
<result property="typeName" column="type_name" />
<result property="level" column="level" />
<result property="sort" column="sort" />
<result property="isActive" column="is_active" />
</resultMap>
<sql id="bmProjectInfo">
select type_id, parent_id, type_name, level, sort, is_active
from ma_type_info
</sql>
<select id="getMaTypeInfoList" resultType="com.bonus.zlpt.common.core.domain.MaDevInfo">
select type_id, parent_id, type_name, level, sort, is_active
from ma_type_info
</select>
<select id="getProjectInfo" parameterType="com.bonus.zlpt.common.core.domain.MaDevInfo" resultMap="MaDevInfoResult">
select pro_id, pro_name, status, type_id, link_man, telphone, dept_id, del_flag, create_by, create_time,
update_by, update_time, remark, company_id
from bm_project_info
where del_flag = '0'
<if test="proId != null and proId != ''">
AND pro_id = #{proId}
</if>
<if test="proName != null and proName != ''">
AND pro_name like concat('%', #{proName}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
<if test="typeId != null and typeId != ''">
AND type_id = #{typeId}
</if>
<if test="linkMan != null and linkMan != ''">
and link_man = #{linkMan}
</if>
<if test="telphone != null and telphone != ''">
and telphone = #{telphone}
</if>
<if test="deptId != null and deptId != ''">
and dept_id = #{deptId}
</if>
<if test="delFlag != null and delFlag != ''">
and del_flag = #{delFlag}
</if>
<if test="createBy != null and createBy != ''">
and create_by = #{createBy}
</if>
<if test="createTime != null and createTime != ''">
and create_time = #{createTime}
</if>
<if test="updateBy != null and updateBy != ''">
and update_by = #{updateBy}
</if>
<if test="updateTime != null and updateTime != ''">
and update_time = #{updateTime}
</if>
<if test="remark != null and remark != ''">
and remark = #{remark}
</if>
<if test="companyId != null and companyId != ''">
and company_id = #{companyId}
</if>
</select>
<insert id="projectInfoAdd" parameterType="com.bonus.zlpt.common.core.domain.MaDevInfo">
insert into bm_project_info (
<if test="proName != null and proName != '' ">pro_name,</if>
<if test="status != null and status != '' ">status,</if>
<if test="typeId != null and typeId != '' ">type_id,</if>
<if test="linkMan != null and linkMan != '' ">link_man,</if>
<if test="telphone != null and telphone != ''">telphone,</if>
<if test="deptId != null and deptId != ''">dept_id,</if>
<if test="delFlag != null and delFlag != ''">del_flag,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="updateTime != null and updateTime != ''">update_time,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="companyId != null and companyId != ''">company_id,</if>
create_time
)values(
<if test="proName != null and proName != ''">#{proName},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="typeId != null and typeId != ''">#{typeId},</if>
<if test="linkMan != null and linkMan != ''">#{linkMan},</if>
<if test="telphone != null and telphone != ''">#{telphone},</if>
<if test="deptId != null and deptId != ''">#{deptId},</if>
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="updateTime != null and updateTime != ''">#{updateTime},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="companyId != null and companyId != ''">#{companyId},</if>
sysdate()
)
</insert>
<update id="updateBmProjectInfo" parameterType="com.bonus.zlpt.common.core.domain.MaDevInfo">
update bm_project_info
<set>
<if test="proName != null and proName != ''">pro_name = #{proName},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="typeId != null and typeId != ''">type_id = #{typeId},</if>
<if test="linkMan != null and linkMan != ''">link_man = #{linkMan},</if>
<if test="telphone != null and telphone != ''">telphone = #{telphone},</if>
<if test="deptId != null and deptId != ''">dept_id = #{deptId},</if>
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
<if test="createBy != null and createBy != ''">create_by =#{createBy},</if>
<if test="createTime != null and createTime != ''">create_time = #{createTime},</if>
<if test="updateBy != null and updateBy != ''">update_by =#{updateBy},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="companyId != null and companyId != ''">company_id = #{companyId},</if>
update_time = sysdate()
</set>
where pro_id = #{proId}
</update>
<delete id="deleteProjectInfoById" parameterType="Long">
update bm_project_info set del_flag = '2' where pro_id = #{proId}
</delete>
<delete id="remove" parameterType="Long">
delete from bm_project_info where pro_id in
<foreach item="proId" collection="array" open="(" separator="," close=")">
#{proId}
</foreach>
</delete>
</mapper>