Commit 6b6c5576 by zhiwj

红点提示

parent 9e774499
...@@ -66,6 +66,8 @@ public class IndexDescDTO implements Serializable { ...@@ -66,6 +66,8 @@ public class IndexDescDTO implements Serializable {
private Integer updateTipsId; private Integer updateTipsId;
private Integer indexId;
private String remark; private String remark;
private int seq; private int seq;
...@@ -199,4 +201,12 @@ public class IndexDescDTO implements Serializable { ...@@ -199,4 +201,12 @@ public class IndexDescDTO implements Serializable {
public void setRemark(String remark) { public void setRemark(String remark) {
this.remark = remark; this.remark = remark;
} }
public Integer getIndexId() {
return indexId;
}
public void setIndexId(Integer indexId) {
this.indexId = indexId;
}
} }
...@@ -3,6 +3,8 @@ package com.gic.cloud.dao.mapper; ...@@ -3,6 +3,8 @@ package com.gic.cloud.dao.mapper;
import com.gic.cloud.entity.TabUpdateTips; import com.gic.cloud.entity.TabUpdateTips;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface TabUpdateTipsMapper { public interface TabUpdateTipsMapper {
/** /**
* 根据主键删除 * 根据主键删除
...@@ -53,4 +55,6 @@ public interface TabUpdateTipsMapper { ...@@ -53,4 +55,6 @@ public interface TabUpdateTipsMapper {
int updateByPrimaryKey(TabUpdateTips record); int updateByPrimaryKey(TabUpdateTips record);
void updateStatus(@Param("businessId") Integer businessId, @Param("type") Integer type, @Param("userId") Integer userId, @Param("showStatus") Integer showStatus); void updateStatus(@Param("businessId") Integer businessId, @Param("type") Integer type, @Param("userId") Integer userId, @Param("showStatus") Integer showStatus);
List<TabUpdateTips> listByIndexIdAndUser(@Param("ids") List<Integer> businessIdList, @Param("type") int type, @Param("userId") Integer userId);
} }
\ No newline at end of file
package com.gic.cloud.service; package com.gic.cloud.service;
import com.gic.cloud.entity.TabUpdateTips;
import java.util.List;
import java.util.Map;
/** /**
* @author zhiwj * @author zhiwj
* @Description: * @Description:
...@@ -18,4 +23,6 @@ public interface UpdateTipService { ...@@ -18,4 +23,6 @@ public interface UpdateTipService {
void erase(Integer userId, Integer businessId, Integer type); void erase(Integer userId, Integer businessId, Integer type);
Map<Integer, TabUpdateTips> mapByIndexIdAndUser(List<Integer> indexIdList, int type, Integer userId);
} }
...@@ -4,13 +4,18 @@ import com.gic.cloud.dao.mapper.TabIndexDescMapper; ...@@ -4,13 +4,18 @@ import com.gic.cloud.dao.mapper.TabIndexDescMapper;
import com.gic.cloud.dto.IndexDescDTO; import com.gic.cloud.dto.IndexDescDTO;
import com.gic.cloud.entity.TabIndexDesc; import com.gic.cloud.entity.TabIndexDesc;
import com.gic.cloud.entity.TabIndexDescEnterprise; import com.gic.cloud.entity.TabIndexDescEnterprise;
import com.gic.cloud.entity.TabUpdateTips;
import com.gic.cloud.service.IndexDescEnterpriseService; import com.gic.cloud.service.IndexDescEnterpriseService;
import com.gic.cloud.service.IndexDescService; import com.gic.cloud.service.IndexDescService;
import com.gic.cloud.service.UpdateTipService;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/** /**
* @author zhiwj * @author zhiwj
...@@ -24,6 +29,8 @@ public class IndexDescServiceImpl implements IndexDescService { ...@@ -24,6 +29,8 @@ public class IndexDescServiceImpl implements IndexDescService {
private TabIndexDescMapper tabIndexDescMapper; private TabIndexDescMapper tabIndexDescMapper;
@Autowired @Autowired
private IndexDescEnterpriseService indexDescEnterpriseService; private IndexDescEnterpriseService indexDescEnterpriseService;
@Autowired
private UpdateTipService updateTipService;
@Override @Override
public List<IndexDescDTO> listByEnterpriseAndModule(Integer enterpriseId, String moduleId, String indexGroupName) { public List<IndexDescDTO> listByEnterpriseAndModule(Integer enterpriseId, String moduleId, String indexGroupName) {
...@@ -32,12 +39,34 @@ public class IndexDescServiceImpl implements IndexDescService { ...@@ -32,12 +39,34 @@ public class IndexDescServiceImpl implements IndexDescService {
@Override @Override
public List<IndexDescDTO> listByEnterpriseAndModuleDetail(Integer enterpriseId, String moduleId, String indexGroupName, Integer userId) { public List<IndexDescDTO> listByEnterpriseAndModuleDetail(Integer enterpriseId, String moduleId, String indexGroupName, Integer userId) {
return tabIndexDescMapper.listByEnterpriseAndModuleDetail(enterpriseId, moduleId, indexGroupName, userId, 1); List<IndexDescDTO> indexDescDTOList = tabIndexDescMapper.listByEnterpriseAndModuleDetail(enterpriseId, moduleId, indexGroupName, userId, 1);
return parse(indexDescDTOList, userId);
} }
@Override @Override
public List<IndexDescDTO> listRecycle(Integer enterpriseId, String moduleId, String indexGroupName, Integer userId) { public List<IndexDescDTO> listRecycle(Integer enterpriseId, String moduleId, String indexGroupName, Integer userId) {
return tabIndexDescMapper.listByEnterpriseAndModuleDetail(enterpriseId, moduleId, indexGroupName, userId, 0); List<IndexDescDTO> indexDescDTOList = tabIndexDescMapper.listByEnterpriseAndModuleDetail(enterpriseId, moduleId, indexGroupName, userId, 0);
return parse(indexDescDTOList, userId);
}
private List<IndexDescDTO> parse(List<IndexDescDTO> indexDescDTOList, Integer userId) {
if (CollectionUtils.isNotEmpty(indexDescDTOList)) {
List<Integer> indexIdList = indexDescDTOList.stream().map(IndexDescDTO::getIndexId).collect(Collectors.toList());
Map<Integer, TabUpdateTips> updateTipsMap = updateTipService.mapByIndexIdAndUser(indexIdList, 1, userId);
for (IndexDescDTO indexDescDTO : indexDescDTOList) {
// -- ,ifnull(t4.show_status, 2) updateTips
// -- ,t4.update_tips_id updateTipsId
TabUpdateTips updateTips = updateTipsMap.get(indexDescDTO.getIndexId());
if (updateTips != null) {
indexDescDTO.setUpdateTips(updateTips.getShowStatus());
indexDescDTO.setUpdateTipsId(updateTips.getUpdateTipsId());
} else {
indexDescDTO.setUpdateTips(2);
indexDescDTO.setUpdateTipsId(null);
}
}
}
return indexDescDTOList;
} }
@Override @Override
......
...@@ -13,10 +13,14 @@ import com.gic.cloud.service.DataExplainService; ...@@ -13,10 +13,14 @@ import com.gic.cloud.service.DataExplainService;
import com.gic.cloud.service.IndexService; import com.gic.cloud.service.IndexService;
import com.gic.cloud.service.UpdateTipService; import com.gic.cloud.service.UpdateTipService;
import com.gic.cloud.service.UserService; import com.gic.cloud.service.UserService;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/** /**
* @author zhiwj * @author zhiwj
...@@ -80,4 +84,16 @@ public class UpdateTipServiceImpl implements UpdateTipService { ...@@ -80,4 +84,16 @@ public class UpdateTipServiceImpl implements UpdateTipService {
tabUpdateTipsMapper.updateStatus(businessId, type, userId, 0); tabUpdateTipsMapper.updateStatus(businessId, type, userId, 0);
} }
@Override
public Map<Integer, TabUpdateTips> mapByIndexIdAndUser(List<Integer> indexIdList, int type, Integer userId) {
if (CollectionUtils.isNotEmpty(indexIdList)) {
List<TabUpdateTips> updateTipsList = tabUpdateTipsMapper.listByIndexIdAndUser(indexIdList, type, userId);
if (CollectionUtils.isNotEmpty(updateTipsList)) {
return updateTipsList.stream().collect(Collectors.toMap(TabUpdateTips::getBusinessId, e -> e, (a, b) -> a));
}
}
return Collections.emptyMap();
}
} }
...@@ -163,13 +163,14 @@ ...@@ -163,13 +163,14 @@
</include> </include>
,t2.index_desc_enterprise_id indexDescEnterpriseId ,t2.index_desc_enterprise_id indexDescEnterpriseId
,t2.sort ,t2.sort
,ifnull(t4.show_status, 2) updateTips ,t3.index_id indexId
,t4.update_tips_id updateTipsId -- ,ifnull(t4.show_status, 2) updateTips
-- ,t4.update_tips_id updateTipsId
from tab_index_desc t1 from tab_index_desc t1
left join tab_index_desc_enterprise t2 on t1.index_desc_id = t2.index_desc_id left join tab_index_desc_enterprise t2 on t1.index_desc_id = t2.index_desc_id
left join tab_index_module_rel t5 on t1.index_desc_id = t5.module_id left join tab_index_module_rel t5 on t1.index_desc_id = t5.module_id
left join tab_index t3 on t5.business_id = t3.index_id left join tab_index t3 on t5.business_id = t3.index_id
left join tab_update_tips t4 on t3.index_id = t4.business_id -- left join tab_update_tips t4 on t3.index_id = t4.business_id
where t1.status = 1 where t1.status = 1
and t2.enterprise_id = #{enterpriseId} and t2.enterprise_id = #{enterpriseId}
and t1.module_id = #{moduleId} and t1.module_id = #{moduleId}
...@@ -179,12 +180,11 @@ ...@@ -179,12 +180,11 @@
and t2.index_status = #{indexStatus} and t2.index_status = #{indexStatus}
and (t3.status = 1 or t3.status is null) and (t3.status = 1 or t3.status is null)
and (t3.classify_type = 1 or t3.classify_type is null) and (t3.classify_type = 1 or t3.classify_type is null)
-- AND (t4.business_id = 1 or t4.business_id is null) -- AND (t4.type = 1 or t4.type is null)
AND (t4.type = 1 or t4.type is null)
and (t5.type = 1 or t5.type = 1 is null) and (t5.type = 1 or t5.type = 1 is null)
<if test="userId != null "> <!--<if test="userId != null ">
AND (t4.user_id = #{userId} or t4.user_id is null ) AND (t4.user_id = #{userId} or t4.user_id is null )
</if> </if>-->
order by t2.sort order by t2.sort
</select> </select>
<!-- <select id="listRecycle" resultMap="DTOResultMap"> <!-- <select id="listRecycle" resultMap="DTOResultMap">
......
...@@ -104,4 +104,15 @@ ...@@ -104,4 +104,15 @@
</if> </if>
</where> </where>
</update> </update>
<select id="listByIndexIdAndUser" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_update_tips
where type = #{type}
and user_id = #{userId}
and business_id in
<foreach collection="ids" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment