fix: 优化过鱼历史查询
This commit is contained in:
parent
59890a5659
commit
1e44d6ee4f
@ -89,10 +89,17 @@ public class FishDraftDataController {
|
|||||||
return t;
|
return t;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// @PostMapping("/page")
|
||||||
|
// @Operation(summary = "分页查询过鱼数据(关联电站和设施)")
|
||||||
|
// public ResponseResult queryPageList(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||||
|
// Page<FishDraftDataVO> result = fishDraftDataService.queryPageList(dataSourceRequest);
|
||||||
|
// return ResponseResult.successData(result);
|
||||||
|
// }
|
||||||
|
|
||||||
@PostMapping("/page")
|
@PostMapping("/page")
|
||||||
@Operation(summary = "分页查询过鱼数据(关联电站和设施)")
|
@Operation(summary = "分页查询过鱼数据(关联电站和设施,APPROVED状态时根据当前用户电站权限过滤)")
|
||||||
public ResponseResult queryPageList(@RequestBody DataSourceRequest dataSourceRequest) {
|
public ResponseResult queryPageListWithScope(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||||
Page<FishDraftDataVO> result = fishDraftDataService.queryPageList(dataSourceRequest);
|
Page<FishDraftDataVO> result = fishDraftDataService.queryPageListWithScope(dataSourceRequest);
|
||||||
return ResponseResult.successData(result);
|
return ResponseResult.successData(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import org.apache.ibatis.annotations.Param;
|
|||||||
import org.apache.ibatis.annotations.Select;
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@ -33,6 +34,24 @@ public interface FishDraftDataMapper extends BaseMapper<FishDraftData> {
|
|||||||
@Param("hbrvcd") String hbrvcd,
|
@Param("hbrvcd") String hbrvcd,
|
||||||
@Param("approvalId") String approvalId);
|
@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);
|
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.common.DataSourceRequest;
|
||||||
import com.yfd.platform.qgc_base.domain.SdRvcdDic;
|
import com.yfd.platform.qgc_base.domain.SdRvcdDic;
|
||||||
import com.yfd.platform.qgc_base.mapper.SdRvcdDicMapper;
|
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.ApprovalMain;
|
||||||
import com.yfd.platform.qgc_data.domain.FishDraftData;
|
import com.yfd.platform.qgc_data.domain.FishDraftData;
|
||||||
import com.yfd.platform.qgc_data.domain.SysUserDataScope;
|
import com.yfd.platform.qgc_data.domain.SysUserDataScope;
|
||||||
@ -89,6 +90,9 @@ public class FishDraftDataServiceImpl extends ServiceImpl<FishDraftDataMapper, F
|
|||||||
@Resource
|
@Resource
|
||||||
private ISdFpssRService sdFpssRService;
|
private ISdFpssRService sdFpssRService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ICurrentUserDataScopeService currentUserDataScopeService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private PlatformTransactionManager transactionManager;
|
private PlatformTransactionManager transactionManager;
|
||||||
|
|
||||||
@ -108,19 +112,68 @@ public class FishDraftDataServiceImpl extends ServiceImpl<FishDraftDataMapper, F
|
|||||||
String direction = QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "direction");
|
String direction = QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "direction");
|
||||||
String status = QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "status");
|
String status = QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "status");
|
||||||
String STRDT = QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "strdt");
|
String STRDT = QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "strdt");
|
||||||
String startTime=null;
|
String startTime = null;
|
||||||
String endTime=null;
|
String endTime = null;
|
||||||
// String userId = (SecurityUtils.hasPermission("sjtb:edit-review") || "admin".equals(SecurityUtils.getCurrentUsername())) ?null:SecurityUtils.getUserId();
|
// String userId = (SecurityUtils.hasPermission("sjtb:edit-review") || "admin".equals(SecurityUtils.getCurrentUsername())) ?null:SecurityUtils.getUserId();
|
||||||
String userId = SecurityUtils.getUserId();
|
String userId = SecurityUtils.getUserId();
|
||||||
if(StrUtil.isNotBlank(approvalId)){
|
if (StrUtil.isNotBlank(approvalId)) {
|
||||||
userId=null;
|
userId = null;
|
||||||
}
|
}
|
||||||
// 如果 startTime 和 endTime 为空,尝试从 TM 字段解析
|
// 如果 startTime 和 endTime 为空,尝试从 TM 字段解析
|
||||||
if (StrUtil.isNotBlank(STRDT)&& STRDT.split( ",").length==2) {
|
if (StrUtil.isNotBlank(STRDT) && STRDT.split(",").length == 2) {
|
||||||
startTime=STRDT.split(",")[0];
|
startTime = STRDT.split(",")[0];
|
||||||
endTime=STRDT.split(",")[1];
|
endTime = STRDT.split(",")[1];
|
||||||
}
|
}
|
||||||
Page<FishDraftDataVO> resultPage = fishDraftDataMapper.selectJoinPage(page, stcd, rstcd, baseId, rvcd, direction, status, ftp, startTime, endTime,userId,hbrvcd,approvalId);
|
Page<FishDraftDataVO> resultPage = fishDraftDataMapper.selectJoinPage(page, stcd, rstcd, baseId, rvcd, direction, status, ftp, startTime, endTime, userId, hbrvcd, approvalId);
|
||||||
|
fillUserNames(resultPage.getRecords());
|
||||||
|
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());
|
fillUserNames(resultPage.getRecords());
|
||||||
return resultPage;
|
return resultPage;
|
||||||
}
|
}
|
||||||
@ -262,7 +315,7 @@ public class FishDraftDataServiceImpl extends ServiceImpl<FishDraftDataMapper, F
|
|||||||
@Override
|
@Override
|
||||||
public boolean batchRemoveDraft(List<String> ids) {
|
public boolean batchRemoveDraft(List<String> ids) {
|
||||||
long count = countByIdsAndLockFlag(ids, 1);
|
long count = countByIdsAndLockFlag(ids, 1);
|
||||||
if(count > 0){
|
if (count > 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String userId = SecurityUtils.getUserId();
|
String userId = SecurityUtils.getUserId();
|
||||||
@ -392,7 +445,7 @@ public class FishDraftDataServiceImpl extends ServiceImpl<FishDraftDataMapper, F
|
|||||||
// hbrvnmSet.add(hbrv.getRvnm());
|
// hbrvnmSet.add(hbrv.getRvnm());
|
||||||
// }
|
// }
|
||||||
|
|
||||||
List<SdEngInfoBH> stationList = engInfoBHMapper.selectByRvcd(null,orgId);
|
List<SdEngInfoBH> stationList = engInfoBHMapper.selectByRvcd(null, orgId);
|
||||||
if (stationList != null) {
|
if (stationList != null) {
|
||||||
for (SdEngInfoBH station : stationList) {
|
for (SdEngInfoBH station : stationList) {
|
||||||
if (station.getStcd() != null) {
|
if (station.getStcd() != null) {
|
||||||
@ -401,7 +454,7 @@ public class FishDraftDataServiceImpl extends ServiceImpl<FishDraftDataMapper, F
|
|||||||
if (station.getEnnm() != null) {
|
if (station.getEnnm() != null) {
|
||||||
ennmSet.add(station.getEnnm());
|
ennmSet.add(station.getEnnm());
|
||||||
}
|
}
|
||||||
if(station.getReachcdName() != null){
|
if (station.getReachcdName() != null) {
|
||||||
hbrvnmSet.add(station.getReachcdName());
|
hbrvnmSet.add(station.getReachcdName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -419,7 +472,7 @@ public class FishDraftDataServiceImpl extends ServiceImpl<FishDraftDataMapper, F
|
|||||||
if (station.getEnnm() != null) {
|
if (station.getEnnm() != null) {
|
||||||
ennmSet.add(station.getEnnm());
|
ennmSet.add(station.getEnnm());
|
||||||
}
|
}
|
||||||
if(station.getReachcdName() != null){
|
if (station.getReachcdName() != null) {
|
||||||
hbrvnmSet.add(station.getReachcdName());
|
hbrvnmSet.add(station.getReachcdName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -191,6 +191,61 @@
|
|||||||
ORDER BY D.TM DESC, D.ROW_INDEX ASC
|
ORDER BY D.TM DESC, D.ROW_INDEX ASC
|
||||||
</select>
|
</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 id="selectJoinList" resultMap="JoinResultMap">
|
||||||
SELECT
|
SELECT
|
||||||
<include refid="joinColumns"/>
|
<include refid="joinColumns"/>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user