Browse Source

消息列表接口

master
syc 3 years ago
parent
commit
61499f71f9
  1. 19
      epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/IcMessageListFormDTO.java
  2. 12
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/IcMessageController.java
  3. 7
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/IcMessageDao.java
  4. 15
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/IcMessageService.java
  5. 38
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/IcMessageServiceImpl.java
  6. 20
      epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/IcMessageDao.xml

19
epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/IcMessageListFormDTO.java

@ -0,0 +1,19 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
@Data
public class IcMessageListFormDTO implements Serializable {
private static final long serialVersionUID = 2697079163476964749L;
private Integer pageNo = 1;
private Integer pageSize = 20;
private Boolean isPage = false;
//token中信息
private String customerId;
private String userId;
}

12
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/IcMessageController.java

@ -1,7 +1,9 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
@ -10,6 +12,7 @@ import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.IcMessageDTO;
import com.epmet.dto.form.IcMessageFormDTO;
import com.epmet.dto.form.IcMessageListFormDTO;
import com.epmet.service.IcMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -31,10 +34,11 @@ public class IcMessageController {
@Autowired
private IcMessageService icMessageService;
@RequestMapping("page")
public Result<PageData<IcMessageDTO>> page(@RequestParam Map<String, Object> params){
PageData<IcMessageDTO> page = icMessageService.page(params);
return new Result<PageData<IcMessageDTO>>().ok(page);
@RequestMapping("list")
public Result<PageData<IcMessageDTO>> list(@LoginUser TokenDto tokenDto, @RequestBody IcMessageListFormDTO formDTO){
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setUserId(tokenDto.getUserId());
return new Result<PageData<IcMessageDTO>>().ok(icMessageService.list(formDTO));
}
@RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET})

7
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/IcMessageDao.java

@ -1,9 +1,13 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.IcMessageDTO;
import com.epmet.dto.form.IcMessageListFormDTO;
import com.epmet.entity.IcMessageEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 用户消息表(党建小助手)
*
@ -12,5 +16,6 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface IcMessageDao extends BaseDao<IcMessageEntity> {
List<IcMessageDTO> selectMessageList(IcMessageListFormDTO formDTO);
}

15
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/IcMessageService.java

@ -5,6 +5,7 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.IcMessageDTO;
import com.epmet.dto.form.IcMessageFormDTO;
import com.epmet.dto.form.IcMessageListFormDTO;
import com.epmet.entity.IcMessageEntity;
import java.util.List;
@ -18,25 +19,15 @@ import java.util.Map;
*/
public interface IcMessageService extends BaseService<IcMessageEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<IcMessageDTO>
* @author generator
* @date 2022-08-19
*/
PageData<IcMessageDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @param formDTO
* @return java.util.List<IcMessageDTO>
* @author generator
* @date 2022-08-19
*/
List<IcMessageDTO> list(Map<String, Object> params);
PageData<IcMessageDTO> list(IcMessageListFormDTO formDTO);
/**
* 单条查询

38
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/IcMessageServiceImpl.java

@ -4,20 +4,34 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.enums.DictTypeEnum;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.IcMessageDao;
import com.epmet.dto.IcMessageDTO;
import com.epmet.dto.form.IcMessageFormDTO;
import com.epmet.dto.form.IcMessageListFormDTO;
import com.epmet.dto.form.IcMoveInListFormDTO;
import com.epmet.dto.result.AllGridsByUserIdResultDTO;
import com.epmet.dto.result.HouseInfoDTO;
import com.epmet.dto.result.IcMoveInListResultDTO;
import com.epmet.entity.IcMessageEntity;
import com.epmet.service.IcMessageService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* 用户消息表(党建小助手)
@ -30,19 +44,11 @@ public class IcMessageServiceImpl extends BaseServiceImpl<IcMessageDao, IcMessag
@Override
public PageData<IcMessageDTO> page(Map<String, Object> params) {
IPage<IcMessageEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, IcMessageDTO.class);
}
@Override
public List<IcMessageDTO> list(Map<String, Object> params) {
List<IcMessageEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, IcMessageDTO.class);
public PageData<IcMessageDTO> list(IcMessageListFormDTO formDTO) {
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage());
List<IcMessageDTO> list = baseDao.selectMessageList(formDTO);
PageInfo<IcMessageDTO> pageInfo = new PageInfo<>(list);
return new PageData<>(list, pageInfo.getTotal());
}
private QueryWrapper<IcMessageEntity> getWrapper(Map<String, Object> params){

20
epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/IcMessageDao.xml

@ -3,6 +3,24 @@
<mapper namespace="com.epmet.dao.IcMessageDao">
<select id="selectMessageList" resultType="com.epmet.dto.IcMessageDTO">
SELECT
id,
customer_id,
grid_id,
user_id,
app,
message_type,
target_id,
title,
message_content,
read_flag
FROM
ic_message
WHERE
del_flag = '0'
AND customer_id = #{customerId}
AND user_id = #{userId}
</select>
</mapper>
Loading…
Cancel
Save