feat: 体系数据列表手动分页

This commit is contained in:
2023-11-15 15:11:47 +08:00
parent ac9bf76ab2
commit e0918cf94a
5 changed files with 87 additions and 13 deletions
@@ -32,7 +32,7 @@ import java.util.List;
@RestController
@Api(tags = "福田标准法规--标准法规库-菜单标准体系")
@RequestMapping("/${restPath}/lawss/sarMenuStandardLimit")
public class SarMenuStandardNewController extends BaseController<StandSystemDTO> {
public class SarMenuStandardNewController extends BaseController<SarMenuStandardNew> {
@Autowired
private ISarMenuStandardNewService iSarMenuStandardNewService;
@@ -102,8 +102,7 @@ public class SarMenuStandardNewController extends BaseController<StandSystemDTO>
@ApiOperation("法规弹窗列表")
@PostMapping("/standardSystemList")
public ResponseMessage<?> standardSystemList(@RequestBody StandSystemDTO standSystemDTO) {
List<StandSystemDTO> standSystemDTOS = iSarMenuStandardNewService.standardSystemList(standSystemDTO);
return Result.success(getPageInfo(standSystemDTO.getPager(), standSystemDTOS));
return Result.success(iSarMenuStandardNewService.standardSystemList(standSystemDTO));
}
@ApiOperation("法规列表弹窗Excel导出")
@@ -10,6 +10,8 @@ import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;
@@ -18,12 +20,11 @@ import java.util.List;
* @author: Mzaxd
* @Date: 2023/11/14 17:20
*/
@EqualsAndHashCode(callSuper = true)
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class StandSystemDTO extends BasePage {
public class StandSystemDTO {
@ApiModelProperty(value = "节点Id")
private String menuId;
@@ -91,6 +92,12 @@ public class StandSystemDTO extends BasePage {
private List<String> selectIdList;
@NotNull(message = "页码不能为空")
private int page;
@NotEmpty(message = "每页条数不能为空")
private int pageSize;
public void setSelectIds(String selectIds) {
this.selectIds = selectIds;
this.selectIdList = java.util.Arrays.asList(selectIds.split(","));
@@ -35,7 +35,7 @@ public interface ISarMenuStandardNewService extends IService<SarMenuStandardNew>
List<SarMenuStandard> standardSystemTree();
List<StandSystemDTO> standardSystemList(StandSystemDTO standSystemDTO);
IPage<List<StandSystemDTO>> standardSystemList(StandSystemDTO standSystemDTO);
void standardSystemListExport(StandSystemDTO standSystemDTO, HttpServletResponse response);
}
@@ -23,6 +23,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@@ -177,7 +178,7 @@ public class SarMenuStandardNewServiceNewImpl extends ServiceImpl<SarMenuStandar
}
@Override
public List<StandSystemDTO> standardSystemList(StandSystemDTO standSystemDTO) {
public IPage<List<StandSystemDTO>> standardSystemList(StandSystemDTO standSystemDTO) {
String menuId = standSystemDTO.getMenuId();
// 校验menuId不能为空
if (StringUtils.isBlank(menuId)) {
@@ -200,8 +201,27 @@ public class SarMenuStandardNewServiceNewImpl extends ServiceImpl<SarMenuStandar
// 按照标准体系排序
// 体系内部按照国内/海外/企业排序
// 每个类别的标准内部按照搜索中心设定的类别排序
standSystemDTO.getPager().setRowCount(resultList.size());
return resultList;
// 假设 pageNum 和 pageSize 都是从1开始的
Integer pageNum = standSystemDTO.getPage();
Integer pageSize = standSystemDTO.getPageSize();
// 计算总页数
int total = resultList.size();
int totalPages = (total + pageSize - 1) / pageSize;
// 计算当前页应该显示的数据的起始和结束索引
int start = (pageNum - 1) * pageSize;
int end = Math.min(start + pageSize, total);
// 获取当前页面的数据
List<StandSystemDTO> pageList = resultList.subList(start, end);
// 使用MyBatis Plus的Page类来构造分页对象
Page<List<StandSystemDTO>> page = new Page<>(pageNum, pageSize, total);
page.setRecords(Collections.singletonList(pageList)); // 设置当前页面的记录
page.setTotal(total); // 设置总记录数
page.setPages(totalPages); // 设置总页数
return page;
}
@Override
@@ -1268,9 +1268,57 @@
</update>
<select id="getESSystemData" resultType="com.adc.da.slrs.sarMenuStandard.entity.StandSystemDTO">
SELECT
es.ID AS standId,
es.STAND_NUMBER AS standNo,
es.STAND_NAME AS standName,
es.STAND_STATE AS standState,
es.ISSUE_TIME AS releaseDate,
es.PUT_TIME AS implementDate,
es.REPLACE_STAND_NUM AS replaceStandardNo,
esa.QCDW AS dept,
esa.WSSMR AS draftUserName,
FROM
`sar_bussioness_stand` AS es
LEFT JOIN `sar_buss_stand_attr_info` AS esa ON es.ID = esa.STAND_ID
WHERE gb.STAND_TYPE = 'INLAND'
<!--标准编号-->
<if test="param.standNo != null and param.standNo != ''">
AND gb.STAND_NUMBER LIKE CONCAT('%',#{param.standNo},'%')
</if>
<!--标准名称-->
<if test="param.standName != null and param.standName != ''">
AND gb.STAND_NAME LIKE CONCAT('%',#{param.standName},'%')
</if>
<!--发布时间-->
<if test="param.startReleaseDate != null and param.endReleaseDate != null">
AND gb.ISSUE_TIME BETWEEN #{param.startReleaseDate} AND #{param.endReleaseDate}
</if>
<!--实施日期-->
<if test="param.startImplementDate != null and param.endImplementDate != null">
AND gb.PUT_TIME BETWEEN #{param.startImplementDate} AND #{param.endImplementDate}
</if>
<!--代替标准-->
<if test="param.replaceStandardNo != null and param.replaceStandardNo != null">
AND gb.REPLACE_STAND_NUM LIKE CONCAT('%',#{param.replaceStandardNo},'%')
</if>
<!--编制单位-->
<if test="param.dept != null and param.dept != null">
AND gba.QCDW LIKE CONCAT('%',#{param.dept},'%')
</if>
<!--起草人-->
<if test="param.draftUserName != null and param.draftUserName != null">
AND gba.WSSMR LIKE CONCAT('%',#{param.draftUserName},'%')
</if>
<!--数据来源-->
<if test="param.dataSource != null and param.dataSource != null">
AND gb.STAND_TYPE = #{dataSource}
</if>
<if test="param.selectIdList != null and param.selectIdList.size() > 0">
AND gb.ID IN
<foreach item="item" index="index" collection="param.selectIdList" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
</mapper>