Commit f0f5f181 authored by 李秀明's avatar 李秀明

feat(jg): 安装告知-列表页面(企业、监管)-列表数据接口

parent a85f9977
...@@ -8,7 +8,7 @@ import lombok.EqualsAndHashCode; ...@@ -8,7 +8,7 @@ import lombok.EqualsAndHashCode;
import java.util.Date; import java.util.Date;
/** /**
* *
* *
* @author system_generator * @author system_generator
* @date 2023-12-12 * @date 2023-12-12
...@@ -27,9 +27,12 @@ public class JgInstallationNoticeDto extends BaseDto { ...@@ -27,9 +27,12 @@ public class JgInstallationNoticeDto extends BaseDto {
@ApiModelProperty(value = "设备种类") @ApiModelProperty(value = "设备种类")
private String equList; private String equList;
@ApiModelProperty(value = "告知状态") @ApiModelProperty(value = "告知状态编号")
private String noticeStatus; private String noticeStatus;
@ApiModelProperty(value = "告知状态描述")
private String noticeStatusDesc;
@ApiModelProperty(value = "设备数量") @ApiModelProperty(value = "设备数量")
private Integer deviceNum; private Integer deviceNum;
......
package com.yeejoin.amos.boot.module.jg.api.mapper; package com.yeejoin.amos.boot.module.jg.api.mapper;
import com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNotice;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jg.api.dto.JgInstallationNoticeDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNotice;
import org.apache.ibatis.annotations.Param;
/** /**
* Mapper 接口 * Mapper 接口
* *
* @author system_generator * @author system_generator
* @date 2023-12-12 * @date 2023-12-12
*/ */
public interface JgInstallationNoticeMapper extends BaseMapper<JgInstallationNotice> { public interface JgInstallationNoticeMapper extends BaseMapper<JgInstallationNotice> {
Page<JgInstallationNotice> queryForPage(Page<JgInstallationNotice> page, @Param("param") JgInstallationNoticeDto model, @Param("type") String type);
} }
...@@ -2,4 +2,47 @@ ...@@ -2,4 +2,47 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jg.api.mapper.JgInstallationNoticeMapper"> <mapper namespace="com.yeejoin.amos.boot.module.jg.api.mapper.JgInstallationNoticeMapper">
<select id="queryForPage" resultType="com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNotice">
select
isn.sequence_nbr AS sequenceNbr,
isn.apply_no AS applyNo,
isn.notice_date AS noticeDate,
isn.use_unit_id AS useUnitId,
isn.use_unit_name AS useUnitName,
isn.receive_org_id AS receiveOrgId,
isn.receive_org_name AS receiveOrgName,
isn.region_no AS regionNo,
isn.address AS address,
isn.notice_status AS noticeStatus,
isn.install_unit_id AS installUnitId,
isn.install_unit_name AS installUnitName
FROM
tzs_jg_installation_notice isn
<where>
isn.is_delete = false
<if test="param != null ">
<if test="param.applyNo != null and param.applyNo != ''">
AND isn.apply_no LIKE CONCAT('%', #{param.applyNo}, '%')
</if>
<if test="param.receiveOrgName != null and param.receiveOrgName != ''">
AND isn.receive_org_name LIKE CONCAT('%', #{param.receiveOrgName}, '%')
</if>
<if test="param.useUnitName != null and param.useUnitName != ''">
AND isn.use_unit_name LIKE CONCAT('%', #{param.useUnitName}, '%')
</if>
<if test="param.installUnitName != null and param.installUnitName != ''">
AND isn.install_unit_name LIKE CONCAT('%', #{param.installUnitName}, '%')
</if>
<if test="param.noticeStatus != null and param.noticeStatus != ''">
AND isn.notice_status = #{param.noticeStatus}
</if>
</if>
<if test="type == 'supervision'">
AND isn.notice_status in ('6612', '6613', '6614')
</if>
</where>
ORDER BY
isn.notice_date DESC
</select>
</mapper> </mapper>
package com.yeejoin.amos.boot.module.jg.biz.controller; package com.yeejoin.amos.boot.module.jg.biz.controller;
import org.springframework.web.bind.annotation.RequestMapping; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.List; import com.yeejoin.amos.boot.module.jg.api.dto.JgInstallationNoticeDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNotice;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgInstallationNoticeServiceImpl; import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgInstallationNoticeServiceImpl;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import io.swagger.annotations.Api;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jg.api.dto.JgInstallationNoticeDto;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/** /**
* 安装告知 * 安装告知
...@@ -37,28 +38,28 @@ public class JgInstallationNoticeController extends BaseController { ...@@ -37,28 +38,28 @@ public class JgInstallationNoticeController extends BaseController {
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save") @PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增安装告知", notes = "新增安装告知") @ApiOperation(httpMethod = "POST", value = "新增安装告知", notes = "新增安装告知")
public ResponseModel<JgInstallationNoticeDto> save(@RequestBody JgInstallationNoticeDto model) { public ResponseModel<JgInstallationNoticeDto> save(@RequestBody JgInstallationNoticeDto model) {
model = jgInstallationNoticeServiceImpl.createWithModel(model); model = jgInstallationNoticeServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(model); return ResponseHelper.buildResponse(model);
} }
/** /**
* 根据sequenceNbr更新 * 根据sequenceNbr更新
* *
* @param sequenceNbr 主键 * @param sequenceNbr 主键
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{sequenceNbr}") @PutMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新安装告知", notes = "根据sequenceNbr更新安装告知") @ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新安装告知", notes = "根据sequenceNbr更新安装告知")
public ResponseModel<JgInstallationNoticeDto> updateBySequenceNbrJgInstallationNotice(@RequestBody JgInstallationNoticeDto model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) { public ResponseModel<JgInstallationNoticeDto> updateBySequenceNbrJgInstallationNotice(@RequestBody JgInstallationNoticeDto model, @PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr); model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(jgInstallationNoticeServiceImpl.updateWithModel(model)); return ResponseHelper.buildResponse(jgInstallationNoticeServiceImpl.updateWithModel(model));
} }
/** /**
* 根据sequenceNbr删除 * 根据sequenceNbr删除
* *
* @param sequenceNbr 主键 * @param sequenceNbr 主键
...@@ -67,50 +68,52 @@ public class JgInstallationNoticeController extends BaseController { ...@@ -67,50 +68,52 @@ public class JgInstallationNoticeController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/{sequenceNbr}") @DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除安装告知", notes = "根据sequenceNbr删除安装告知") @ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除安装告知", notes = "根据sequenceNbr删除安装告知")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){ public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr) {
return ResponseHelper.buildResponse(jgInstallationNoticeServiceImpl.removeById(sequenceNbr)); return ResponseHelper.buildResponse(jgInstallationNoticeServiceImpl.removeById(sequenceNbr));
} }
/** /**
* 根据sequenceNbr查询 * 根据sequenceNbr查询
* *
* @param sequenceNbr 主键 * @param sequenceNbr 主键
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}") @GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个安装告知", notes = "根据sequenceNbr查询单个安装告知") @ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个安装告知", notes = "根据sequenceNbr查询单个安装告知")
public ResponseModel<JgInstallationNoticeDto> selectOne(@PathVariable Long sequenceNbr) { public ResponseModel<JgInstallationNoticeDto> selectOne(@PathVariable Long sequenceNbr) {
return ResponseHelper.buildResponse(jgInstallationNoticeServiceImpl.queryBySeq(sequenceNbr)); return ResponseHelper.buildResponse(jgInstallationNoticeServiceImpl.queryBySeq(sequenceNbr));
} }
/** /**
* 列表分页查询 * 列表分页查询
* *
* @param current 当前页 * @param current 当前页
* @param current 每页大小 * @param current 每页大小
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page") @PostMapping(value = "/page")
@ApiOperation(httpMethod = "GET",value = "安装告知分页查询", notes = "安装告知分页查询") @ApiOperation(httpMethod = "GET", value = "安装告知分页查询", notes = "安装告知分页查询")
public ResponseModel<Page<JgInstallationNoticeDto>> queryForPage(@RequestParam(value = "current") int current,@RequestParam public ResponseModel<Page<JgInstallationNoticeDto>> queryForPage(
(value = "size") int size) { @ApiParam(value = "当前页码", required = true) @RequestParam(value = "current", defaultValue = "1") int current,
Page<JgInstallationNoticeDto> page = new Page<JgInstallationNoticeDto>(); @ApiParam(value = "每页大小", required = true) @RequestParam(value = "size", defaultValue = "20") int size,
page.setCurrent(current); @ApiParam(value = "类型:enterprise-企业端、supervision-监管端", required = true) @RequestParam(value = "type", defaultValue = "enterprise") String type,
page.setSize(size); @RequestBody(required = false) JgInstallationNoticeDto model
return ResponseHelper.buildResponse(jgInstallationNoticeServiceImpl.queryForJgInstallationNoticePage(page)); ) {
} Page<JgInstallationNotice> page = new Page<>(current, size);
return ResponseHelper.buildResponse(jgInstallationNoticeServiceImpl.queryForJgInstallationNoticePage(page, model, type));
}
/** /**
* 列表全部数据查询 * 列表全部数据查询
* *
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "安装告知列表全部数据查询", notes = "安装告知列表全部数据查询") @ApiOperation(httpMethod = "GET", value = "安装告知列表全部数据查询", notes = "安装告知列表全部数据查询")
@GetMapping(value = "/list") @GetMapping(value = "/list")
public ResponseModel<List<JgInstallationNoticeDto>> selectForList() { public ResponseModel<List<JgInstallationNoticeDto>> selectForList() {
return ResponseHelper.buildResponse(jgInstallationNoticeServiceImpl.queryForJgInstallationNoticeList()); return ResponseHelper.buildResponse(jgInstallationNoticeServiceImpl.queryForJgInstallationNoticeList());
} }
} }
package com.yeejoin.amos.boot.module.jg.biz.service.impl; package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNotice; import com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNotice;
import com.yeejoin.amos.boot.module.jg.api.enums.FlowStatusEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgInstallationNoticeMapper; import com.yeejoin.amos.boot.module.jg.api.mapper.JgInstallationNoticeMapper;
import com.yeejoin.amos.boot.module.jg.api.service.IJgInstallationNoticeService; import com.yeejoin.amos.boot.module.jg.api.service.IJgInstallationNoticeService;
import com.yeejoin.amos.boot.module.jg.api.dto.JgInstallationNoticeDto; import com.yeejoin.amos.boot.module.jg.api.dto.JgInstallationNoticeDto;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List; import java.util.List;
import java.util.Objects;
/** /**
* 服务实现类 * 服务实现类
...@@ -16,18 +21,37 @@ import java.util.List; ...@@ -16,18 +21,37 @@ import java.util.List;
* @date 2023-12-12 * @date 2023-12-12
*/ */
@Service @Service
public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationNoticeDto,JgInstallationNotice,JgInstallationNoticeMapper> implements IJgInstallationNoticeService { public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationNoticeDto, JgInstallationNotice, JgInstallationNoticeMapper> implements IJgInstallationNoticeService {
@Autowired
private JgInstallationNoticeMapper jgInstallationNoticeMapper;
/** /**
* 分页查询 * 分页查询
*/ */
public Page<JgInstallationNoticeDto> queryForJgInstallationNoticePage(Page<JgInstallationNoticeDto> page) { public Page<JgInstallationNoticeDto> queryForJgInstallationNoticePage(Page<JgInstallationNotice> page, JgInstallationNoticeDto model, String type) {
return this.queryForPage(page, null, false); Page<JgInstallationNotice> noticePage = jgInstallationNoticeMapper.queryForPage(page, model, type);
// 将Page<JgInstallationNotice>转化为Page<JgInstallationNoticeDto>
Page<JgInstallationNoticeDto> noticeDtoPage = new Page<>();
BeanUtils.copyProperties(noticePage, noticeDtoPage, "records");
List<JgInstallationNoticeDto> records = noticePage.getRecords().stream().map(notice -> {
JgInstallationNoticeDto noticeDto = new JgInstallationNoticeDto();
BeanUtils.copyProperties(notice, noticeDto);
if (Objects.nonNull(notice.getNoticeStatus())) {
String noticeStatusDesc = FlowStatusEnum.getNameByType(Long.valueOf(notice.getNoticeStatus()));
noticeDto.setNoticeStatusDesc(noticeStatusDesc);
}
return noticeDto;
}).collect(java.util.stream.Collectors.toList());
noticeDtoPage.setRecords(records);
return noticeDtoPage;
} }
/** /**
* 列表查询 示例 * 列表查询 示例
*/ */
public List<JgInstallationNoticeDto> queryForJgInstallationNoticeList() { public List<JgInstallationNoticeDto> queryForJgInstallationNoticeList() {
return this.queryForList("" , false); return this.queryForList("", false);
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment