fix
This commit is contained in:
parent
11ba920fcc
commit
42ea13df4b
|
|
@ -47,6 +47,15 @@ public class DevInfoController extends BaseController
|
|||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "收藏装备列表")
|
||||
@PostMapping("/userCollectList")
|
||||
public TableDataInfo userCollectList(@RequestBody DevInfoVo devInfo)
|
||||
{
|
||||
startPage(devInfo.getPageNum(), devInfo.getPageSize());
|
||||
List<DevInfoVo> list = devInfoService.selectUserCollectList(devInfo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
// @RequiresPermissions("equip:info:list")
|
||||
@ApiOperation(value = "装备推荐列表")
|
||||
@GetMapping("/hotList")
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.bonus.zlpt.equip.mapper;
|
|||
import java.util.List;
|
||||
import com.bonus.zlpt.common.core.domain.system.SysFile;
|
||||
import com.bonus.zlpt.equip.api.domain.DevInfo;
|
||||
import com.bonus.zlpt.equip.api.domain.UserCollect;
|
||||
import com.bonus.zlpt.equip.api.domain.dto.InforMationDto;
|
||||
import com.bonus.zlpt.equip.api.domain.vo.DevInfoVo;
|
||||
import com.bonus.zlpt.system.api.domain.BaseAddress;
|
||||
|
|
@ -24,6 +25,8 @@ public interface DevInfoMapper
|
|||
*/
|
||||
public DevInfoVo selectDevInfoByMaId(Long maId);
|
||||
|
||||
public int updateHotSearchByMaId(Long maId);
|
||||
|
||||
/**
|
||||
* 查询设备图片集
|
||||
*
|
||||
|
|
@ -42,6 +45,8 @@ public interface DevInfoMapper
|
|||
*/
|
||||
public List<DevInfoVo> selectDevInfoList(DevInfo devInfo);
|
||||
|
||||
public List<UserCollect> selectUserCollectByUserId(Long userId);
|
||||
|
||||
public List<DevInfoVo> selectDevInfoHotList(DevInfo devInfo);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@ public interface IDevInfoService
|
|||
*/
|
||||
public List<DevInfoVo> selectDevInfoList(DevInfoVo devInfo);
|
||||
|
||||
List<DevInfoVo> selectUserCollectList(DevInfoVo devInfo);
|
||||
|
||||
public List<DevInfoVo> selectDevInfoHotList(DevInfoVo devInfo);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -2,8 +2,11 @@ package com.bonus.zlpt.equip.service.impl;
|
|||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.bonus.zlpt.common.security.utils.SecurityUtils;
|
||||
import com.bonus.zlpt.equip.api.domain.DevInfo;
|
||||
import com.bonus.zlpt.equip.api.domain.SysFileInfo;
|
||||
import com.bonus.zlpt.equip.api.domain.UserCollect;
|
||||
import com.bonus.zlpt.equip.api.domain.dto.InforMationDto;
|
||||
import com.bonus.zlpt.equip.api.domain.vo.DevInfoVo;
|
||||
import com.bonus.zlpt.common.core.domain.system.SysFile;
|
||||
|
|
@ -11,6 +14,7 @@ import com.bonus.zlpt.common.core.utils.DateUtils;
|
|||
import com.bonus.zlpt.equip.api.enums.MaStatusEnum;
|
||||
import com.bonus.zlpt.system.api.domain.BaseAddress;
|
||||
import com.bonus.zlpt.system.api.domain.SysDic;
|
||||
import com.bonus.zlpt.system.api.model.LoginUser;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import com.bonus.zlpt.equip.mapper.SysFileInfoMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -51,6 +55,8 @@ public class DevInfoServiceImpl implements IDevInfoService
|
|||
public DevInfoVo selectDevInfoByMaId(Long maId)
|
||||
{
|
||||
DevInfoVo devInfoVo = devInfoMapper.selectDevInfoByMaId(maId);
|
||||
//更新搜索量
|
||||
devInfoMapper.updateHotSearchByMaId(maId);
|
||||
try {
|
||||
List<SysFile> files = devInfoMapper.getFilesByMaId(maId);
|
||||
if (!CollectionUtils.isEmpty(files) && files.get(0) != null) {
|
||||
|
|
@ -112,6 +118,40 @@ public class DevInfoServiceImpl implements IDevInfoService
|
|||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询设备收藏列表
|
||||
*
|
||||
* @param devInfo 设备信息
|
||||
* @return 设备信息
|
||||
*/
|
||||
@Override
|
||||
public List<DevInfoVo> selectUserCollectList(DevInfoVo devInfo)
|
||||
{
|
||||
List<DevInfoVo> result = new ArrayList<>();
|
||||
result = devInfoMapper.selectDevInfoList(devInfo);
|
||||
LoginUser user = SecurityUtils.getLoginUser();
|
||||
if (Objects.nonNull(user)) {
|
||||
List<UserCollect> userCollectList = devInfoMapper.selectUserCollectByUserId(user.getUserid());
|
||||
result = filterUserCollect(result, userCollectList);
|
||||
}
|
||||
fillInMaStatusStr(result);
|
||||
fillInCityStr(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private List<DevInfoVo> filterUserCollect(List<DevInfoVo> list, List<UserCollect> userCollectList) {
|
||||
List<DevInfoVo> result = new ArrayList<>();
|
||||
for (DevInfoVo devInfoVo : list) {
|
||||
for (UserCollect userCollect : userCollectList) {
|
||||
if (devInfoVo.getMaId() == userCollect.getMaId()) {
|
||||
result.add(devInfoVo);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<DevInfoVo> selectDevInfoHotList(DevInfoVo devInfo)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -346,6 +346,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
</select>
|
||||
|
||||
<select id="selectUserCollectByUserId" parameterType="Long" resultType="com.bonus.zlpt.equip.api.domain.UserCollect">
|
||||
select id, user_id, ma_id, time from ma_user_collect
|
||||
where user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<update id="updateHotSearchByMaId" parameterType="Long">
|
||||
update ma_hot_search
|
||||
set search_num = search_num + 1
|
||||
where ma_id = #{maId}
|
||||
</update>
|
||||
|
||||
<select id="getSysDic" resultType="com.bonus.zlpt.system.api.domain.SysDic">
|
||||
select
|
||||
id,p_id,code,`name`,description,`value`,sort,`level`,status,create_time,creator
|
||||
|
|
|
|||
Loading…
Reference in New Issue