fix: 优化过鱼历史查询
This commit is contained in:
parent
59890a5659
commit
1e44d6ee4f
@ -89,10 +89,17 @@ public class FishDraftDataController {
|
||||
return t;
|
||||
});
|
||||
|
||||
// @PostMapping("/page")
|
||||
// @Operation(summary = "分页查询过鱼数据(关联电站和设施)")
|
||||
// public ResponseResult queryPageList(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
// Page<FishDraftDataVO> result = fishDraftDataService.queryPageList(dataSourceRequest);
|
||||
// return ResponseResult.successData(result);
|
||||
// }
|
||||
|
||||
@PostMapping("/page")
|
||||
@Operation(summary = "分页查询过鱼数据(关联电站和设施)")
|
||||
public ResponseResult queryPageList(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
Page<FishDraftDataVO> result = fishDraftDataService.queryPageList(dataSourceRequest);
|
||||
@Operation(summary = "分页查询过鱼数据(关联电站和设施,APPROVED状态时根据当前用户电站权限过滤)")
|
||||
public ResponseResult queryPageListWithScope(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
Page<FishDraftDataVO> result = fishDraftDataService.queryPageListWithScope(dataSourceRequest);
|
||||
return ResponseResult.successData(result);
|
||||
}
|
||||
|
||||
|
||||
@ -8,6 +8,7 @@ import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -33,6 +34,24 @@ public interface FishDraftDataMapper extends BaseMapper<FishDraftData> {
|
||||
@Param("hbrvcd") String hbrvcd,
|
||||
@Param("approvalId") String approvalId);
|
||||
|
||||
/**
|
||||
* 关联查询过鱼数据(分页,含电站权限过滤)
|
||||
*/
|
||||
Page<FishDraftDataVO> selectJoinPageWithStationScope(Page<FishDraftDataVO> page,
|
||||
@Param("stcd") String stcd,
|
||||
@Param("rstcd") String rstcd,
|
||||
@Param("baseId") String baseId,
|
||||
@Param("rvcd") String rvcd,
|
||||
@Param("direction") String direction,
|
||||
@Param("status") String status,
|
||||
@Param("ftp") String ftp,
|
||||
@Param("startTime") String startTime,
|
||||
@Param("endTime") String endTime,
|
||||
@Param("userId") String userId,
|
||||
@Param("hbrvcd") String hbrvcd,
|
||||
@Param("approvalId") String approvalId,
|
||||
@Param("stationCodes") Set<String> stationCodes);
|
||||
|
||||
/**
|
||||
* 关联查询过鱼数据(不分页)
|
||||
*/
|
||||
|
||||
@ -20,6 +20,12 @@ public interface IFishDraftDataService extends IService<FishDraftData> {
|
||||
*/
|
||||
Page<FishDraftDataVO> queryPageList(DataSourceRequest dataSourceRequest);
|
||||
|
||||
/**
|
||||
* 分页查询草稿数据(关联电站和设施表,含电站权限过滤)
|
||||
* 当 status = APPROVED 时,根据当前用户有权限的电站编码过滤数据
|
||||
*/
|
||||
Page<FishDraftDataVO> queryPageListWithScope(DataSourceRequest dataSourceRequest);
|
||||
|
||||
/**
|
||||
* 查询草稿数据列表(关联电站和设施表,不分页)
|
||||
*/
|
||||
|
||||
@ -8,6 +8,7 @@ import com.yfd.platform.common.DataSourceLoadOptionsBase;
|
||||
import com.yfd.platform.common.DataSourceRequest;
|
||||
import com.yfd.platform.qgc_base.domain.SdRvcdDic;
|
||||
import com.yfd.platform.qgc_base.mapper.SdRvcdDicMapper;
|
||||
import com.yfd.platform.qgc_base.service.ICurrentUserDataScopeService;
|
||||
import com.yfd.platform.qgc_data.domain.ApprovalMain;
|
||||
import com.yfd.platform.qgc_data.domain.FishDraftData;
|
||||
import com.yfd.platform.qgc_data.domain.SysUserDataScope;
|
||||
@ -89,6 +90,9 @@ public class FishDraftDataServiceImpl extends ServiceImpl<FishDraftDataMapper, F
|
||||
@Resource
|
||||
private ISdFpssRService sdFpssRService;
|
||||
|
||||
@Resource
|
||||
private ICurrentUserDataScopeService currentUserDataScopeService;
|
||||
|
||||
@Resource
|
||||
private PlatformTransactionManager transactionManager;
|
||||
|
||||
@ -125,6 +129,55 @@ public class FishDraftDataServiceImpl extends ServiceImpl<FishDraftDataMapper, F
|
||||
return resultPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<FishDraftDataVO> queryPageListWithScope(DataSourceRequest dataSourceRequest) {
|
||||
Page<FishDraftDataVO> page = KendoUtil.getPage(dataSourceRequest);
|
||||
page.setSize(dataSourceRequest.getTake());
|
||||
page.setCurrent(dataSourceRequest.getSkip());
|
||||
DataSourceLoadOptionsBase loadOptions = dataSourceRequest.toDevRequest();
|
||||
String stcd = QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "stcd");
|
||||
String approvalId = QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "approvalId");
|
||||
String rstcd = QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "rstcd");
|
||||
String hbrvcd = QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "hbrvcd");
|
||||
String rvcd = QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "rvcd");
|
||||
String baseId = QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "baseId");
|
||||
String ftp = QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "ftp");
|
||||
String direction = QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "direction");
|
||||
String status = QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "status");
|
||||
String STRDT = QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "strdt");
|
||||
String startTime = null;
|
||||
String endTime = null;
|
||||
String userId = SecurityUtils.getUserId();
|
||||
if (StrUtil.isNotBlank(approvalId)) {
|
||||
userId = null;
|
||||
}
|
||||
if (StrUtil.isNotBlank(STRDT) && STRDT.split(",").length == 2) {
|
||||
startTime = STRDT.split(",")[0];
|
||||
endTime = STRDT.split(",")[1];
|
||||
}
|
||||
|
||||
// 当 status = APPROVED 时,加上当前用户的电站权限过滤
|
||||
Set<String> stationCodes = null;
|
||||
if ("APPROVED".equals(status)) {
|
||||
userId=null;
|
||||
if (!currentUserDataScopeService.getCurrentUserDataScope().isManagedAdmin()) {
|
||||
stationCodes = currentUserDataScopeService.getCurrentUserDataScope().getStationCodes();
|
||||
// 如果用户没有电站权限且不是管理员,返回空结果
|
||||
if (stationCodes == null || stationCodes.isEmpty()) {
|
||||
page.setRecords(Collections.emptyList());
|
||||
page.setTotal(0);
|
||||
return page;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Page<FishDraftDataVO> resultPage = fishDraftDataMapper.selectJoinPageWithStationScope(
|
||||
page, stcd, rstcd, baseId, rvcd, direction, status, ftp,
|
||||
startTime, endTime, userId, hbrvcd, approvalId, stationCodes);
|
||||
fillUserNames(resultPage.getRecords());
|
||||
return resultPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FishDraftDataVO> queryJoinList(DataSourceRequest dataSourceRequest) {
|
||||
DataSourceLoadOptionsBase loadOptions = dataSourceRequest.toDevRequest();
|
||||
|
||||
@ -191,6 +191,61 @@
|
||||
ORDER BY D.TM DESC, D.ROW_INDEX ASC
|
||||
</select>
|
||||
|
||||
<select id="selectJoinPageWithStationScope" resultMap="JoinResultMap">
|
||||
SELECT
|
||||
<include refid="joinColumns"/>
|
||||
FROM FISH_DRAFT_DATA D
|
||||
LEFT JOIN SD_FPSS_B_H F ON D.STCD = F.STCD
|
||||
LEFT JOIN SD_FISHDICTORY_B FB ON FB.ID = D.FTP
|
||||
LEFT JOIN SD_ENGINFO_B_H E ON F.RSTCD = E.STCD
|
||||
LEFT JOIN SD_HYDROBASE H ON E.BASE_ID = H.BASEID
|
||||
<include refid="rvcdDisplayJoin"/>
|
||||
WHERE D.DELETED_FLAG = 0
|
||||
<if test="stcd != null and stcd != ''">
|
||||
AND D.STCD = #{stcd}
|
||||
</if>
|
||||
<if test="userId != null and userId != ''">
|
||||
AND D.CREATED_BY = #{userId}
|
||||
</if>
|
||||
<if test="ftp != null and ftp != ''">
|
||||
AND D.FTP = #{ftp}
|
||||
</if>
|
||||
<if test="rstcd != null and rstcd != ''">
|
||||
AND F.RSTCD = #{rstcd}
|
||||
</if>
|
||||
<if test="baseId != null and baseId != ''">
|
||||
AND E.BASE_ID = #{baseId}
|
||||
</if>
|
||||
<if test="rvcd != null and rvcd != ''">
|
||||
AND E.REACHCD = #{rvcd}
|
||||
</if>
|
||||
<if test="hbrvcd != null and hbrvcd != ''">
|
||||
AND E.HBRVCD = #{hbrvcd}
|
||||
</if>
|
||||
<if test="direction != null and direction != ''">
|
||||
AND D.DIRECTION = #{direction}
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND D.STATUS = #{status}
|
||||
</if>
|
||||
<if test="approvalId != null and approvalId != ''">
|
||||
AND D.APPROVAL_ID = #{approvalId}
|
||||
</if>
|
||||
<if test="startTime != null and startTime != ''">
|
||||
AND D.STRDT >= TO_DATE(#{startTime}, 'yyyy-mm-dd hh24:mi:ss')
|
||||
</if>
|
||||
<if test="endTime != null and endTime != ''">
|
||||
AND D.STRDT <= TO_DATE(#{endTime}, 'yyyy-mm-dd hh24:mi:ss')
|
||||
</if>
|
||||
<if test="stationCodes != null and stationCodes.size() > 0">
|
||||
AND E.STCD IN
|
||||
<foreach collection="stationCodes" item="code" open="(" separator="," close=")">
|
||||
#{code}
|
||||
</foreach>
|
||||
</if>
|
||||
ORDER BY H.ORDER_INDEX ASC,E.ORDER_INDEX ASC, D.TM DESC, D.ROW_INDEX ASC
|
||||
</select>
|
||||
|
||||
<select id="selectJoinList" resultMap="JoinResultMap">
|
||||
SELECT
|
||||
<include refid="joinColumns"/>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user