Commit 6b17f7ae authored by 刘帅阳's avatar 刘帅阳

超级管理员商家管理员展示

parent a330d226
...@@ -51,5 +51,7 @@ public interface CmsNewsRepository extends CyBaseMapper<CmsNews> { ...@@ -51,5 +51,7 @@ public interface CmsNewsRepository extends CyBaseMapper<CmsNews> {
IPage<CmsVideo> listTopVideoAdmin(CyPageInfo<CmsNews> paginationUtility, CmsVideo cmsVideo); IPage<CmsVideo> listTopVideoAdmin(CyPageInfo<CmsNews> paginationUtility, CmsVideo cmsVideo);
IPage<CmsNews> listByClassificationAdmin(CyPageInfo<CmsNews> paginationUtility, CmsNews cmsNews); IPage<CmsNews> listByClassificationAdmin(CyPageInfo<CmsNews> paginationUtility, CmsNews cmsNews);
IPage<CmsNews> listByClassificationMerchants(CyPageInfo<CmsNews> paginationUtility, @Param("entity") CmsNews cmsNews);
} }
...@@ -429,6 +429,19 @@ public class CmsNewsServiceImpl extends ServiceImpl<CmsNewsRepository, CmsNews> ...@@ -429,6 +429,19 @@ public class CmsNewsServiceImpl extends ServiceImpl<CmsNewsRepository, CmsNews>
} }
return cmsNewsIPage; return cmsNewsIPage;
} }
//商家管理员
if (CyUserUtil.getAuthenRoleIds().equals(cyInitComp.unit[0])) {
//商家管理员
IPage<CmsNews> cmsNewsIPage = baseMapper.listByClassificationMerchants(paginationUtility, cmsNews);
List<CmsNews> records = cmsNewsIPage.getRecords();
for (CmsNews cmsNews1 : records) {
if (cmsNews1.getPath() != null) {
cmsNews1.setPath(global.getBase_Discovery() + cmsNews1.getPath());
}
}
return cmsNewsIPage;
}
//校验是否包含商家信息 //校验是否包含商家信息
if (StringUtils.isEmpty(cmsNews.getUnitId())) { if (StringUtils.isEmpty(cmsNews.getUnitId())) {
......
...@@ -31,5 +31,7 @@ public interface CmsVideoRepository extends CyBaseMapper<CmsVideo> { ...@@ -31,5 +31,7 @@ public interface CmsVideoRepository extends CyBaseMapper<CmsVideo> {
IPage<CmsVideo> businessAdminsPaginatedQuery(CyPageInfo<CmsVideo> paginationUtility, @Param("entity") CmsVideo cmsVideo); IPage<CmsVideo> businessAdminsPaginatedQuery(CyPageInfo<CmsVideo> paginationUtility, @Param("entity") CmsVideo cmsVideo);
IPage<CmsVideo> listByClassificationAdmin(CyPageInfo<CmsVideo> paginationUtility, CmsVideo cmsVideo); IPage<CmsVideo> listByClassificationAdmin(CyPageInfo<CmsVideo> paginationUtility, CmsVideo cmsVideo);
IPage<CmsVideo> listByClassificationMerchants(CyPageInfo<CmsVideo> paginationUtility, @Param("entity") CmsVideo cmsVideo);
} }
...@@ -284,6 +284,18 @@ public class CmsVideoServiceImpl extends ServiceImpl<CmsVideoRepository, CmsVide ...@@ -284,6 +284,18 @@ public class CmsVideoServiceImpl extends ServiceImpl<CmsVideoRepository, CmsVide
} }
return page; return page;
} }
//商家管理员
if (CyUserUtil.getAuthenRoleIds().equals(cyInitComp.unit[0])) {
cmsVideo.setUserId(Integer.valueOf(CyUserUtil.getAuthenBusinessId()));
IPage<CmsVideo> page = baseMapper.listByClassificationMerchants(paginationUtility, cmsVideo);
List<CmsVideo> records = page.getRecords();
for (CmsVideo cmsVideo1 : records) {
if (cmsVideo1.getPath() != null) {
cmsVideo1.setPath(global.getBase_Discovery() + cmsVideo1.getPath());
}
}
return page;
}
//校验是否包含商家信息 //校验是否包含商家信息
......
...@@ -90,5 +90,7 @@ public interface SysUnitRepository extends CyBaseMapper<SysUnit> { ...@@ -90,5 +90,7 @@ public interface SysUnitRepository extends CyBaseMapper<SysUnit> {
void deleteTheUserByUserId(@Param("entity") SysUser sysUser); void deleteTheUserByUserId(@Param("entity") SysUser sysUser);
ArrayList<Integer> findUserId(Integer unitId); ArrayList<Integer> findUserId(Integer unitId);
List<SysUnit> findUnit(String userId);
} }
...@@ -260,7 +260,12 @@ public class SysUnitServiceImpl extends ServiceImpl<SysUnitRepository, SysUnit> ...@@ -260,7 +260,12 @@ public class SysUnitServiceImpl extends ServiceImpl<SysUnitRepository, SysUnit>
throw new CyServiceException(ResultServiceEnums.NOT_LOGIN.getCode(), throw new CyServiceException(ResultServiceEnums.NOT_LOGIN.getCode(),
ResultServiceEnums.NOT_LOGIN.getMessage()); ResultServiceEnums.NOT_LOGIN.getMessage());
} }
//根据用户id查询当前人的商家信息 //商家
if (cyInitComp.unit[0].equals(CyUserUtil.getAuthenRoleIds())) {
return baseMapper.findUnit(userId);
}
//根据用户id查询当前人的商家信息 (代言人)
return baseMapper.findUnitByUnit(userId); return baseMapper.findUnitByUnit(userId);
} }
......
...@@ -447,4 +447,30 @@ ...@@ -447,4 +447,30 @@
DESC, cn.update_date DESC) cn DESC, cn.update_date DESC) cn
GROUP BY cn.business_id GROUP BY cn.business_id
</select> </select>
<select id="listByClassificationMerchants" resultType="org.rcisoft.business.cmsnews.entity.CmsNews">
SELECT cn.*,
SUM(cn.click_through_rate) AS readNum
FROM (SELECT cn.*,
cpc.click_through_rate AS click_through_rate,
oi.path AS path
FROM cms_news cn
LEFT JOIN cms_unit_new_video cunv
ON cn.business_id = cunv.news_video_id AND cunv.type = 0
LEFT JOIN sys_user_unit suu ON cunv.unit_id = suu.unit_id
LEFT JOIN sys_user su ON suu.user_id = su.business_id
LEFT JOIN oss_info oi ON cn.picture_id = oi.business_id
LEFT JOIN cms_price_click cpc
ON cpc.news_video_id = cn.business_id AND cpc.del_flag = 0 AND cpc.type = 0 AND
cpc.unit_id = #{entity.unitId}
AND cpc.user_id = su.business_id
WHERE 1 = 1
AND cunv.unit_id = #{entity.unitId}
AND cn.del_flag = 0
AND cn.flag = 1
# AND cn.is_recommended = 1
GROUP BY cn.business_id, cpc.business_id
ORDER BY cn.is_top
DESC, cn.update_date DESC) cn
GROUP BY cn.business_id
</select>
</mapper> </mapper>
...@@ -210,4 +210,29 @@ ...@@ -210,4 +210,29 @@
order by cv.flag DESC, cv.update_date DESC) cv order by cv.flag DESC, cv.update_date DESC) cv
GROUP BY cv.business_id GROUP BY cv.business_id
</select> </select>
<select id="listByClassificationMerchants" resultType="org.rcisoft.business.cmsvideo.entity.CmsVideo">
SELECT cv.*,
SUM(cv.click_through_rate) AS readNum
FROM (SELECT cv.*,
cpc.click_through_rate AS click_through_rate,
oi1.path AS path,
oi.path AS defaultUrl
FROM cms_video cv
LEFT JOIN cms_unit_new_video cunv ON cv.business_id = cunv.news_video_id AND cunv.type = 1
LEFT JOIN sys_user_unit suu ON cunv.unit_id = suu.unit_id
LEFT JOIN sys_user su ON suu.user_id = su.business_id
AND su.del_flag = 0
AND su.flag = 1
LEFT JOIN cms_price_click cpc
ON cpc.news_video_id = cv.business_id AND cpc.del_flag = 0 AND cpc.type = 1 AND
cpc.unit_id = #{entity.unitId}
LEFT JOIN oss_info oi ON cv.video_url_id = oi.business_id
LEFT JOIN oss_info oi1 ON cv.default_url = oi1.business_id
WHERE 1 = 1
AND cunv.unit_id = #{entity.unitId}
AND cv.del_flag = 0
GROUP BY cv.business_id, cpc.business_id
order by cv.flag DESC, cv.update_date DESC) cv
GROUP BY cv.business_id
</select>
</mapper> </mapper>
...@@ -321,5 +321,22 @@ ...@@ -321,5 +321,22 @@
from sys_user_unit from sys_user_unit
where unit_id = #{unitId} where unit_id = #{unitId}
</select> </select>
<select id="findUnit" resultType="org.rcisoft.business.sysunit.entity.SysUnit">
SELECT
sun.*
FROM sys_user su
LEFT JOIN sys_unit sun ON sun.business_id = su.dept_id
WHERE 1=1
<if test="userId !=null and userId != '' ">
AND su.business_id = #{userId}
</if>
AND su.del_flag = 0
AND su.flag =1
AND sun.del_flag = 0
AND sun.flag = 1
</select>
</mapper> </mapper>
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