提交 07e03f79 authored 作者: 宋文杰's avatar 宋文杰

feat(info information): add reported to me information

上级 06e96cd6
......@@ -29,12 +29,12 @@ public class InfoInformationsController extends BaseController {
/**
* 分页查询
* @param page 分页对象
* @param infoInformations 信息表
* @param receiverId 接收人id
* @return
*/
@GetMapping("/page")
public R getInfoInformationsPage(Page page, InfoInformations infoInformations) {
return new R<>(infoInformationsService.page(page,Wrappers.query(infoInformations)));
@GetMapping("/reportedToMe")
public R getReportedToMe(Page page, Integer receiverId) {
return new R<>(infoInformationsService.getReportedToMe(page,receiverId));
}
......
package com.elephant.framework.galaxy.aroad.module.info.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
/**
* @program:
* @description:
* @author: songwenjie
* @create: 2019-05-05 18:46
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class InfoDto implements Serializable {
/**
* 信息id
*/
private Integer infoId;
/**
* 信息模板id
*/
private Integer templateId;
/**
* 信息标题
*/
private String infoTitle;
/**
* 信息内容
*/
private String infoContent;
/**
* 信息备注
*/
private String infoRemark;
/**
* 上报人id
*/
private Integer reporterId;
/**
* 上报人
*/
private String reporter;
/**
* 上报时间
*/
private Date reportingTime;
/**
* 模板名称
*/
private String templateName;
/**
* 模板类型
*/
private String templateType;
/**
* 接收人id
*/
private Integer receiverId;
/**
* 接收人姓名
*/
private String receiverName;
}
package com.elephant.framework.galaxy.aroad.module.info.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.elephant.framework.galaxy.aroad.module.info.dto.InfoDto;
import com.elephant.framework.galaxy.aroad.module.info.entity.InfoInformations;
import java.util.List;
/**
* 信息表
*
......@@ -18,4 +23,13 @@ public interface InfoInformationsMapper extends BaseMapper<InfoInformations> {
* @Date: 2019/5/5
*/
Boolean saveInformations(InfoInformations informations);
/**
* @Description: 查询报给我的信息
* @Param: [receiverId]
* @return: java.util.List<com.elephant.framework.galaxy.aroad.module.info.dto.InfoDto>
* @Author: songwenjie
* @Date: 2019/5/5
*/
IPage<InfoDto> getReportedToMe (Page page, Integer receiverId);
}
package com.elephant.framework.galaxy.aroad.module.info.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.elephant.framework.galaxy.aroad.module.info.dto.InfoDto;
import com.elephant.framework.galaxy.aroad.module.info.dto.InfoInformationsDto;
import com.elephant.framework.galaxy.aroad.module.info.entity.InfoInformations;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* 信息表
*
......@@ -21,4 +27,13 @@ public interface InfoInformationsService extends IService<InfoInformations> {
* @Date: 2019/5/5
*/
Boolean saveInformations(InfoInformationsDto info);
/**
* @Description: 分页查询报给我的信息
* @Param: [page, receiverId]
* @return: java.util.List<com.elephant.framework.galaxy.aroad.module.info.dto.InfoDto>
* @Author: songwenjie
* @Date: 2019/5/5
*/
public IPage<InfoDto> getReportedToMe (Page page, Integer receiverId);
}
package com.elephant.framework.galaxy.aroad.module.info.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.elephant.framework.galaxy.aroad.module.attendance.dto.MemberDto;
import com.elephant.framework.galaxy.aroad.module.info.dto.InfoDto;
import com.elephant.framework.galaxy.aroad.module.info.dto.InfoInformationsDto;
import com.elephant.framework.galaxy.aroad.module.info.entity.InfoInformations;
import com.elephant.framework.galaxy.aroad.module.info.entity.InfoReceivers;
......@@ -15,6 +18,9 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* 信息表
......@@ -70,4 +76,16 @@ public class InfoInformationsServiceImpl extends ServiceImpl<InfoInformationsMap
});
return infoReceiversService.saveBatch(receivers);
}
/**
* @Description: 分页查询报给我的信息
* @Param: [page, receiverId]
* @return: java.util.List<com.elephant.framework.galaxy.aroad.module.info.dto.InfoDto>
* @Author: songwenjie
* @Date: 2019/5/5
*/
public IPage<InfoDto> getReportedToMe (Page page, Integer receiverId){
IPage<InfoDto> infos = baseMapper.getReportedToMe(page,receiverId);
return infos;
}
}
......@@ -14,10 +14,42 @@
<result property="reportingTime" column="reporting_time"/>
</resultMap>
<resultMap id="infoMap" type="com.elephant.framework.galaxy.aroad.module.info.dto.InfoDto">
<id property="infoId" column="info_id"/>
<result property="templateId" column="template_id"/>
<result property="infoTitle" column="info_title"/>
<result property="infoContent" column="info_content"/>
<result property="infoRemark" column="info_remark"/>
<result property="reporterId" column="reporter_id"/>
<result property="reporter" column="reporter"/>
<result property="reportingTime" column="reporting_time"/>
<result property="templateName" column="template_name"/>
<result property="templateType" column="template_type"/>
<result property="receiverId" column="receiver_id"/>
<result property="receiverName" column="receiver_name"/>
</resultMap>
<insert id="saveInformations" useGeneratedKeys="true" keyProperty="infoId">
insert into
info_informations(template_id, info_title,info_content,info_remark,reporter_id,reporter,reporting_time)
values
(#{templateId}, #{infoTitle},#{infoContent},#{infoRemark},#{reporterId},#{reporter},#{reportingTime})
</insert>
<!--报给我的信息-->
<select id="getReportedToMe" resultMap="infoMap">
select
i.info_id,i.template_id,i.info_title,i.info_content,i.info_remark,i.reporter_id,i.reporter,i.reporting_time,
t.template_name,t.template_type,
r.receiver_id,r.receiver_name
from `info_templates` t
inner join
info_informations i
on t.template_id = i.template_id
inner join
info_receivers r
on i.info_id = r.info_id
where r.receiver_id = #{receiverId}
</select>
</mapper>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论