分页修改

main
zhangyu 2023-02-27 16:39:05 +08:00
parent d8a715a547
commit e1f45ac0b5
22 changed files with 156 additions and 60 deletions

View File

@ -3,13 +3,14 @@ package com.hbt.safety.supervision.controller;
import java.util.List;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo;
import com.hbt.common.core.domain.R;
import com.hbt.safety.supervision.pojo.EscalateHiddenDanger;
import com.hbt.safety.supervision.pojo.HiddenDanger;
import com.hbt.safety.supervision.service.IHiddenDangerService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.hbt.safety.supervision.service.IEscalateHiddenDangerService;
import com.hbt.common.core.web.controller.BaseController;
import com.hbt.common.core.web.domain.AjaxResult;
@ -27,15 +28,23 @@ public class EscalateHiddenDangerController extends BaseController
@Autowired
private IEscalateHiddenDangerService escalateHiddenDangerService;
@Autowired
private IHiddenDangerService hiddenDangerService;
/**
* id
*
* @param id id
* @param currentPage
* @param pageSize
* @param hiddenDangerName
* @return
*/
@GetMapping("/list")
public String list(String id)
public String list(@RequestParam(value = "id") String id, @RequestParam(value = "currentPage") int currentPage,
@RequestParam(value = "pageSize") int pageSize, @RequestParam(value = "hiddenDangerName", required = false) String hiddenDangerName)
{
List<EscalateHiddenDanger> list = escalateHiddenDangerService.selectEscalateHiddenDangerList(id);
PageInfo<EscalateHiddenDanger> list = escalateHiddenDangerService.selectEscalateHiddenDangerList(id, currentPage, pageSize, hiddenDangerName);
return JSONObject.toJSONString(list);
}

View File

@ -3,12 +3,13 @@ package com.hbt.safety.supervision.controller;
import java.util.List;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo;
import com.hbt.common.core.domain.R;
import com.hbt.safety.supervision.pojo.EscalateRisk;
import com.hbt.safety.supervision.pojo.HiddenDanger;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.hbt.safety.supervision.service.IEscalateRiskService;
import com.hbt.common.core.web.controller.BaseController;
import com.hbt.common.core.web.domain.AjaxResult;
@ -29,12 +30,17 @@ public class EscalateRiskController extends BaseController
*
*
* @param id id
* @param currentPage
* @param pageSize
* @param riskName
* @return
*/
@GetMapping("/list")
public String list(String id)
public String list(@RequestParam(value = "id") String id, @RequestParam(value = "currentPage") int currentPage,
@RequestParam(value = "pageSize") int pageSize, @RequestParam(value = "riskName", required = false) String riskName)
{
List<EscalateRisk> list = escalateRiskService.selectEscalateRiskList(id);
return JSONObject.toJSONString(list);
PageInfo<EscalateRisk> pageInfo = escalateRiskService.selectEscalateRiskList(id, currentPage, pageSize, riskName);
return JSONObject.toJSONString(pageInfo);
}
/**
@ -76,4 +82,6 @@ public class EscalateRiskController extends BaseController
AjaxResult ajaxResult = toAjax(escalateRiskService.deleteEscalateRiskByIds(ids));
return JSONObject.toJSONString(ajaxResult);
}
}

View File

@ -12,6 +12,8 @@ import org.springframework.web.bind.annotation.*;
import com.hbt.common.core.web.controller.BaseController;
import com.hbt.common.core.web.domain.AjaxResult;
import java.util.List;
/**
* Controller
*
@ -28,16 +30,14 @@ public class HiddenDangerController extends BaseController
/**
*
*
* @param currentPage
* @param pageSize
* @return
*/
@ApiOperation("查询隐患列表")
@GetMapping("/list")
public R<PageInfo<HiddenDanger>> list(@RequestParam(value = "currentPage") int currentPage, @RequestParam(value = "pageSize") int pageSize)
public String list()
{
PageInfo<HiddenDanger> pageInfo = hiddenDangerService.selectHiddenDangerList(currentPage, pageSize);
return R.ok(pageInfo);
List<HiddenDanger> list = hiddenDangerService.selectHiddenDangerList();
return JSONObject.toJSONString(list);
}
/**

View File

@ -30,14 +30,19 @@ public class LawEnforcementInspectionController extends BaseController
*
* @param currentPage
* @param pageSize
* @param startTime
* @param endTime
* @return
*/
@ApiOperation("查询执法巡查列表")
@GetMapping("/list")
public R<PageInfo<LawEnforcementInspection>> list(@RequestParam(value = "currentPage") int currentPage, @RequestParam(value = "pageSize") int pageSize)
public String list(@RequestParam(value = "currentPage") int currentPage,
@RequestParam(value = "pageSize") int pageSize,
@RequestParam(value = "startTime", required = false) String startTime,
@RequestParam(value = "endTime", required = false) String endTime)
{
PageInfo<LawEnforcementInspection> pageInfo = lawEnforcementInspectionService.selectLawEnforcementInspectionList(currentPage, pageSize);
return R.ok(pageInfo);
PageInfo<LawEnforcementInspection> pageInfo = lawEnforcementInspectionService.selectLawEnforcementInspectionList(currentPage, pageSize, startTime, endTime);
return JSONObject.toJSONString(pageInfo);
}
/**

View File

@ -12,6 +12,8 @@ import com.hbt.safety.supervision.service.IRiskService;
import com.hbt.common.core.web.controller.BaseController;
import com.hbt.common.core.web.domain.AjaxResult;
import java.util.List;
/**
* Controller
*
@ -28,16 +30,14 @@ public class RiskController extends BaseController
/**
*
*
* @param currentPage
* @param pageSize
* @return
*/
@ApiOperation("查询风险列表")
@GetMapping("/list")
public R<PageInfo<Risk>> list(@RequestParam(value = "currentPage") int currentPage, @RequestParam(value = "pageSize") int pageSize)
public String list()
{
PageInfo<Risk> pageInfo = riskService.selectRiskList(currentPage, pageSize);
return R.ok(pageInfo);
List<Risk> list = riskService.selectRiskList();
return JSONObject.toJSONString(list);
}
/**

View File

@ -4,6 +4,7 @@ import java.util.List;
import com.hbt.safety.supervision.pojo.EscalateHiddenDanger;
import com.hbt.safety.supervision.pojo.HiddenDanger;
import org.apache.ibatis.annotations.Param;
/**
* Mapper
@ -24,9 +25,10 @@ public interface EscalateHiddenDangerMapper
*
*
* @param id id
* @param hiddenDangerName
* @return
*/
List<EscalateHiddenDanger> selectEscalateHiddenDangerList(String id);
List<EscalateHiddenDanger> selectEscalateHiddenDangerList(@Param("id") String id, @Param("hiddenDangerName") String hiddenDangerName);
/**
*

View File

@ -2,6 +2,7 @@ package com.hbt.safety.supervision.mapper;
import java.util.List;
import com.hbt.safety.supervision.pojo.EscalateRisk;
import org.apache.ibatis.annotations.Param;
/**
* Mapper
@ -22,9 +23,10 @@ public interface EscalateRiskMapper
*
*
* @param id id
* @param riskName
* @return
*/
List<EscalateRisk> selectEscalateRiskList(String id);
List<EscalateRisk> selectEscalateRiskList(@Param("id") String id, @Param("riskName") String riskName);
/**
*

View File

@ -5,6 +5,7 @@ import java.util.List;
import com.hbt.safety.supervision.pojo.LawEnforcementInspection;
import com.hbt.safety.supervision.pojo.vo.LawEnforcementInspectionVo;
import org.apache.ibatis.annotations.Param;
/**
* Mapper
@ -26,7 +27,14 @@ public interface LawEnforcementInspectionMapper
*
* @return
*/
List<LawEnforcementInspection> selectLawEnforcementInspectionList();
/**
*
*
* @param startTime
* @param endTime
* @return
*/
List<LawEnforcementInspection> selectLawEnforcementInspectionList(@Param("startTime") String startTime, @Param("endTime") String endTime);
/**
*

View File

@ -23,7 +23,7 @@ public class LawEnforcementInspection extends BaseEntity
/** 巡查日期 */
@ApiModelProperty(value = "巡查日期")
private Date inspectionDate;
private String inspectionDate;
/** 巡查人员 */
@ApiModelProperty(value = "巡查人员")

View File

@ -2,6 +2,7 @@ package com.hbt.safety.supervision.service;
import java.util.List;
import com.github.pagehelper.PageInfo;
import com.hbt.safety.supervision.pojo.EscalateHiddenDanger;
import com.hbt.safety.supervision.pojo.HiddenDanger;
@ -21,12 +22,15 @@ public interface IEscalateHiddenDangerService
HiddenDanger selectEscalateHiddenDangerById(int id);
/**
*
* id
*
* @param id id
* @return
* @param currentPage
* @param pageSize
* @param hiddenDangerName
* @return
*/
List<EscalateHiddenDanger> selectEscalateHiddenDangerList(String id);
PageInfo<EscalateHiddenDanger> selectEscalateHiddenDangerList(String id, int currentPage, int pageSize, String hiddenDangerName);
/**
*

View File

@ -2,6 +2,7 @@ package com.hbt.safety.supervision.service;
import java.util.List;
import com.github.pagehelper.PageInfo;
import com.hbt.safety.supervision.pojo.EscalateRisk;
/**
@ -21,11 +22,14 @@ public interface IEscalateRiskService
/**
*
*
*
* @param id id
* @return
* @param currentPage
* @param pageSize
* @param riskName
* @return
*/
List<EscalateRisk> selectEscalateRiskList(String id);
PageInfo<EscalateRisk> selectEscalateRiskList(String id, int currentPage, int pageSize, String riskName);
/**
*

View File

@ -3,6 +3,8 @@ package com.hbt.safety.supervision.service;
import com.github.pagehelper.PageInfo;
import com.hbt.safety.supervision.pojo.HiddenDanger;
import java.util.List;
/**
* Service
*
@ -19,13 +21,20 @@ public interface IHiddenDangerService
HiddenDanger selectHiddenDangerById(String id);
/**
*
* ()
*
* @param currentPage
* @param pageSize
* @return
*/
PageInfo<HiddenDanger> selectHiddenDangerList(int currentPage, int pageSize);
PageInfo<HiddenDanger> selectHiddenDangerPageInfo(int currentPage, int pageSize);
/**
* ()
*
* @return
*/
List<HiddenDanger> selectHiddenDangerList();
/**
*

View File

@ -24,9 +24,11 @@ public interface ILawEnforcementInspectionService
*
* @param currentPage
* @param pageSize
* @param startTime
* @param endTime
* @return
*/
PageInfo<LawEnforcementInspection> selectLawEnforcementInspectionList(int currentPage, int pageSize);
PageInfo<LawEnforcementInspection> selectLawEnforcementInspectionList(int currentPage, int pageSize, String startTime, String endTime);
/**
*

View File

@ -3,6 +3,8 @@ package com.hbt.safety.supervision.service;
import com.github.pagehelper.PageInfo;
import com.hbt.safety.supervision.pojo.Risk;
import java.util.List;
/**
* Service
*
@ -21,11 +23,9 @@ public interface IRiskService
/**
*
*
* @param currentPage
* @param pageSize
* @return
*/
PageInfo<Risk> selectRiskList(int currentPage, int pageSize);
List<Risk> selectRiskList();
/**
*

View File

@ -2,6 +2,8 @@ package com.hbt.safety.supervision.service.impl;
import java.util.List;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hbt.safety.supervision.mapper.EscalateHiddenDangerMapper;
import com.hbt.safety.supervision.pojo.EscalateHiddenDanger;
import com.hbt.safety.supervision.pojo.HiddenDanger;
@ -33,14 +35,20 @@ public class EscalateHiddenDangerServiceImpl implements IEscalateHiddenDangerSer
}
/**
*
* id
*
* @return
* @param id id
* @param currentPage
* @param pageSize
* @param hiddenDangerName
* @return
*/
@Override
public List<EscalateHiddenDanger> selectEscalateHiddenDangerList(String id)
public PageInfo<EscalateHiddenDanger> selectEscalateHiddenDangerList(String id, int currentPage, int pageSize, String hiddenDangerName)
{
return escalateHiddenDangerMapper.selectEscalateHiddenDangerList(id);
PageHelper.startPage(currentPage, pageSize);
List<EscalateHiddenDanger> list = escalateHiddenDangerMapper.selectEscalateHiddenDangerList(id, hiddenDangerName);
return new PageInfo<>(list);
}
/**

View File

@ -2,6 +2,8 @@ package com.hbt.safety.supervision.service.impl;
import java.util.List;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hbt.safety.supervision.pojo.EscalateRisk;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -34,12 +36,18 @@ public class EscalateRiskServiceImpl implements IEscalateRiskService
/**
*
*
* @return
* @param id id
* @param currentPage
* @param pageSize
* @param riskName
* @return
*/
@Override
public List<EscalateRisk> selectEscalateRiskList(String id)
public PageInfo<EscalateRisk> selectEscalateRiskList(String id, int currentPage, int pageSize, String riskName)
{
return escalateRiskMapper.selectEscalateRiskList(id);
PageHelper.startPage(currentPage, pageSize);
List<EscalateRisk> list = escalateRiskMapper.selectEscalateRiskList(id, riskName);
return new PageInfo<>(list);
}
/**

View File

@ -43,20 +43,34 @@ public class HiddenDangerServiceImpl implements IHiddenDangerService
}
/**
*
* ()
*
* @param currentPage
* @param pageSize
* @return
*/
@Override
public PageInfo<HiddenDanger> selectHiddenDangerList(int currentPage, int pageSize)
public PageInfo<HiddenDanger> selectHiddenDangerPageInfo(int currentPage, int pageSize)
{
PageHelper.startPage(currentPage, pageSize);
List<HiddenDanger> list = hiddenDangerMapper.selectHiddenDangerList();
return new PageInfo<>(list);
}
/**
* ()
*
* @return
*/
@Override
public List<HiddenDanger> selectHiddenDangerList()
{
List<HiddenDanger> list = hiddenDangerMapper.selectHiddenDangerList();
return list;
}
/**
*
*

View File

@ -51,13 +51,15 @@ public class LawEnforcementInspectionServiceImpl implements ILawEnforcementInspe
*
* @param currentPage
* @param pageSize
* @param startTime
* @param endTime
* @return
*/
@Override
public PageInfo<LawEnforcementInspection> selectLawEnforcementInspectionList(int currentPage, int pageSize)
public PageInfo<LawEnforcementInspection> selectLawEnforcementInspectionList(int currentPage, int pageSize, String startTime, String endTime)
{
PageHelper.startPage(currentPage, pageSize);
List<LawEnforcementInspection> list = lawEnforcementInspectionMapper.selectLawEnforcementInspectionList();
List<LawEnforcementInspection> list = lawEnforcementInspectionMapper.selectLawEnforcementInspectionList(startTime, endTime);
return new PageInfo<>(list);
}

View File

@ -43,16 +43,12 @@ public class RiskServiceImpl implements IRiskService
/**
*
*
* @param currentPage
* @param pageSize
* @return
*/
@Override
public PageInfo<Risk> selectRiskList(int currentPage, int pageSize)
public List<Risk> selectRiskList()
{
PageHelper.startPage(currentPage, pageSize);
List<Risk> list = riskMapper.selectRiskList();
return new PageInfo<>(list);
return riskMapper.selectRiskList();
}
/**

View File

@ -22,6 +22,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectEscalateHiddenDangerVo"/>
<where>
a.enforcement_id = #{id}
<if test="hiddenDangerName != null and hiddenDangerName !=''" >
and b.name like "%"#{hiddenDangerName}"%"
</if>
</where>
</select>

View File

@ -22,6 +22,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectEscalateRiskVo"/>
<where>
a.enforcement_id = #{id}
<if test="riskName != null and riskName !=''" >
and b.name like "%"#{riskName}"%"
</if>
</where>
</select>

View File

@ -13,7 +13,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectLawEnforcementInspectionVo">
select distinct(a.id) id, a.inspection_date inspectionDate, a.person person, a.name name,
select distinct(a.id) id, DATE_FORMAT(a.inspection_date,'%Y-%m-%d %H:%i:%S') inspectionDate, a.person person, a.name name,
b.hidden_danger_id hiddenDangerId,
c.risk_id riskId
from law_enforcement_inspection as a
@ -23,6 +23,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectLawEnforcementInspectionList" parameterType="com.hbt.safety.supervision.pojo.LawEnforcementInspection" resultType="LawEnforcementInspection">
<include refid="selectLawEnforcementInspectionVo"/>
<where>
1=1
<if test="startTime != null and startTime !=''" >
and DATE_FORMAT(a.inspection_date,'%Y-%m-%d') >= #{startTime}
</if>
<if test="endTime != null and endTime !=''" >
and DATE_FORMAT(a.inspection_date,'%Y-%m-%d') &lt;= #{endTime}
</if>
</where>
</select>
<select id="selectLawEnforcementInspectionById" parameterType="String" resultType="LawEnforcementInspection">