[修改] 报告列表sql
This commit is contained in:
@@ -96,6 +96,19 @@ public class ReportManageConroller {
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 报告列表
|
||||
* @param vo
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@ApiOperation("报告列表")
|
||||
@PostMapping("/page")
|
||||
public ResponseMessage page(@RequestBody ReportQueryVo vo) throws Exception {
|
||||
IPage<ReportVo> list = reportService.page(vo);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 报告列表(带权限验证)
|
||||
* @param vo
|
||||
|
||||
@@ -34,4 +34,6 @@ public interface ReportDao extends BaseMapper<ReportEntity> {
|
||||
List<String> getReportDateList(@Param("usid")String usid);
|
||||
|
||||
IPage<ReportVo> getAddReportPage(IPage<ReportEntity> page, @Param("pageVO") ReportQueryVo vo);
|
||||
|
||||
IPage<ReportVo> page(IPage<ReportEntity> page,@Param("pageVO") ReportQueryVo vo);
|
||||
}
|
||||
|
||||
@@ -49,4 +49,6 @@ public interface IReportService {
|
||||
String reportHtml(String id);
|
||||
|
||||
IPage<ReportVo> addReportPage(ReportQueryVo vo) throws Exception;
|
||||
|
||||
IPage<ReportVo> page(ReportQueryVo vo);
|
||||
}
|
||||
|
||||
@@ -372,6 +372,30 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<ReportVo> page(ReportQueryVo vo) {
|
||||
IPage<ReportEntity> page = new Page<>();
|
||||
page.setCurrent(vo.getPageNo());
|
||||
page.setSize(vo.getPageSize());
|
||||
//判断是不是管理员
|
||||
boolean admin = false;
|
||||
List<RoleEO> roleEOList = roleEODao.selectByuserId(UserUtils.getUserId());
|
||||
for (RoleEO roleEO : roleEOList) {
|
||||
if ("管理员".equals(roleEO.getName())){
|
||||
admin= !admin;
|
||||
}
|
||||
}
|
||||
if (admin) {
|
||||
vo.setUsid(null);
|
||||
} else {
|
||||
vo.setUsid(UserUtils.getUserId());
|
||||
}
|
||||
|
||||
IPage<ReportVo> list = reportDao.page(page, vo);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建htmlstring
|
||||
*
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.adc.da.report.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
@@ -27,6 +26,10 @@ public class ReportVo {
|
||||
*/
|
||||
private String keyContent;
|
||||
|
||||
/**
|
||||
* 权限
|
||||
*/
|
||||
private Integer power;
|
||||
/**
|
||||
* 主要内容
|
||||
*/
|
||||
|
||||
@@ -223,6 +223,58 @@
|
||||
|
||||
|
||||
|
||||
</select>
|
||||
<select id="page" resultType="com.adc.da.report.vo.ReportVo">
|
||||
|
||||
SELECT
|
||||
eo.id,
|
||||
eo.NAME,
|
||||
eo.keycontent,
|
||||
eo.maincontent,
|
||||
eo.DEPARTMENT,
|
||||
eo.YEAR,
|
||||
eo.fileid,
|
||||
eo.confidentialLevel,
|
||||
eo.privacyLevel,
|
||||
pa.report_id,
|
||||
pa.user_id,
|
||||
pa.power
|
||||
FROM
|
||||
TT_REPORT_MANAGE eo
|
||||
LEFT JOIN tr_report_user ru ON eo.id = ru.reportId
|
||||
LEFT JOIN power_apply pa ON pa.report_id = eo.id
|
||||
WHERE
|
||||
eo.DEL_FLAG = 0
|
||||
<if test="pageVO.usid !='' and pageVO.usid != null">
|
||||
and ru.userId = #{pageVO.usid}
|
||||
</if>
|
||||
<if test="pageVO.usid !='' and pageVO.usid != null">
|
||||
or eo.id in (
|
||||
SELECT tt.report_id from power_apply tt WHERE tt.user_id = #{pageVO.usid}
|
||||
)
|
||||
</if>
|
||||
<if test="pageVO.name !='' and pageVO.name != null">
|
||||
and name like CONCAT(CONCAT('%',#{pageVO.name}),'%')
|
||||
</if>
|
||||
<!--年份搜索-->
|
||||
<if test="pageVO.year != null and pageVO.year.size() > 0">
|
||||
and year in
|
||||
<foreach collection="pageVO.year" item="year" open="(" separator="," close=")">
|
||||
#{year}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="pageVO.ids != null and pageVO.ids.size() > 0">
|
||||
and eo.id in
|
||||
<foreach collection="pageVO.ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
GROUP BY
|
||||
eo.id
|
||||
ORDER BY
|
||||
eo.updateDate DESC
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user