forked from luyan/epmet-cloud-lingshan
				
			
				 10 changed files with 290 additions and 3 deletions
			
			
		@ -0,0 +1,33 @@ | 
				
			|||
package com.epmet.dataaggre.dto.message.form; | 
				
			|||
 | 
				
			|||
import com.epmet.commons.tools.dto.form.PageFormDTO; | 
				
			|||
import lombok.Data; | 
				
			|||
 | 
				
			|||
import javax.validation.constraints.NotBlank; | 
				
			|||
import java.io.Serializable; | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * @Description 我发出的消息列表查询 | 
				
			|||
 * @Author yinzuomei | 
				
			|||
 * @Date 2021/8/20 2:58 下午 | 
				
			|||
 */ | 
				
			|||
@Data | 
				
			|||
public class MySentFormDTO extends PageFormDTO implements Serializable { | 
				
			|||
    private static final long serialVersionUID = 2007425752362914036L; | 
				
			|||
 | 
				
			|||
    private String content; | 
				
			|||
 | 
				
			|||
    //以下参数从token中获取
 | 
				
			|||
    /** | 
				
			|||
     * 当前用户id | 
				
			|||
     */ | 
				
			|||
    @NotBlank(message = "userId不能为空",groups =PageFormDTO.AddUserInternalGroup.class) | 
				
			|||
    private String userId; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 当前客户id | 
				
			|||
     */ | 
				
			|||
    @NotBlank(message = "customerId不能为空",groups = PageFormDTO.AddUserInternalGroup.class) | 
				
			|||
    private String customerId; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
@ -0,0 +1,29 @@ | 
				
			|||
package com.epmet.dataaggre.dto.message.result; | 
				
			|||
 | 
				
			|||
import com.epmet.commons.tools.dto.form.FileCommonDTO; | 
				
			|||
import lombok.Data; | 
				
			|||
 | 
				
			|||
import java.io.Serializable; | 
				
			|||
import java.util.Date; | 
				
			|||
import java.util.List; | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * @Description 我发送的消息列表 | 
				
			|||
 * @Author yinzuomei | 
				
			|||
 * @Date 2021/8/20 3:01 下午 | 
				
			|||
 */ | 
				
			|||
@Data | 
				
			|||
public class MySentResDTO implements Serializable { | 
				
			|||
    private static final long serialVersionUID = -6765856639039569052L; | 
				
			|||
    private String infoId; | 
				
			|||
    private String content; | 
				
			|||
    private Date publishTime; | 
				
			|||
    private Integer totalReceiver; | 
				
			|||
    private Integer readTotal; | 
				
			|||
    private String firstAttId; | 
				
			|||
    /** | 
				
			|||
     * 附件列表 列表默认返回一个 | 
				
			|||
     */ | 
				
			|||
    private List<FileCommonDTO> attachmentList; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
@ -0,0 +1,46 @@ | 
				
			|||
/** | 
				
			|||
 * Copyright 2018 人人开源 https://www.renren.io
 | 
				
			|||
 * <p> | 
				
			|||
 * This program is free software: you can redistribute it and/or modify | 
				
			|||
 * it under the terms of the GNU General Public License as published by | 
				
			|||
 * the Free Software Foundation, either version 3 of the License, or | 
				
			|||
 * (at your option) any later version. | 
				
			|||
 * <p> | 
				
			|||
 * This program is distributed in the hope that it will be useful, | 
				
			|||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
				
			|||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
				
			|||
 * GNU General Public License for more details. | 
				
			|||
 * <p> | 
				
			|||
 * You should have received a copy of the GNU General Public License | 
				
			|||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			|||
 */ | 
				
			|||
 | 
				
			|||
package com.epmet.dataaggre.dao.epmetmessage; | 
				
			|||
 | 
				
			|||
import com.epmet.commons.mybatis.dao.BaseDao; | 
				
			|||
import com.epmet.dataaggre.dto.message.result.MySentResDTO; | 
				
			|||
import com.epmet.dataaggre.entity.epmetmessage.InfoProfileEntity; | 
				
			|||
import org.apache.ibatis.annotations.Mapper; | 
				
			|||
import org.apache.ibatis.annotations.Param; | 
				
			|||
 | 
				
			|||
import java.util.List; | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * 消息概要表 | 
				
			|||
 * | 
				
			|||
 * @author generator generator@elink-cn.com | 
				
			|||
 * @since v1.0.0 2021-08-18 | 
				
			|||
 */ | 
				
			|||
@Mapper | 
				
			|||
public interface InfoProfileDao extends BaseDao<InfoProfileEntity> { | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 我发出的消息列表 | 
				
			|||
     * | 
				
			|||
     * @param publishStaffId | 
				
			|||
     * @return  java.util.List<com.epmet.dataaggre.dto.message.result.MySentResDTO> | 
				
			|||
     * @author yinzuomei | 
				
			|||
     * @date 2021/8/20 3:46 下午 | 
				
			|||
     */ | 
				
			|||
    List<MySentResDTO> selectListMySent(@Param("publishStaffId") String publishStaffId,@Param("content") String content); | 
				
			|||
} | 
				
			|||
@ -0,0 +1,78 @@ | 
				
			|||
/** | 
				
			|||
 * Copyright 2018 人人开源 https://www.renren.io
 | 
				
			|||
 * <p> | 
				
			|||
 * This program is free software: you can redistribute it and/or modify | 
				
			|||
 * it under the terms of the GNU General Public License as published by | 
				
			|||
 * the Free Software Foundation, either version 3 of the License, or | 
				
			|||
 * (at your option) any later version. | 
				
			|||
 * <p> | 
				
			|||
 * This program is distributed in the hope that it will be useful, | 
				
			|||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
				
			|||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
				
			|||
 * GNU General Public License for more details. | 
				
			|||
 * <p> | 
				
			|||
 * You should have received a copy of the GNU General Public License | 
				
			|||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			|||
 */ | 
				
			|||
 | 
				
			|||
package com.epmet.dataaggre.entity.epmetmessage; | 
				
			|||
 | 
				
			|||
import com.baomidou.mybatisplus.annotation.TableName; | 
				
			|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; | 
				
			|||
import lombok.Data; | 
				
			|||
import lombok.EqualsAndHashCode; | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * 消息概要表 | 
				
			|||
 * | 
				
			|||
 * @author generator generator@elink-cn.com | 
				
			|||
 * @since v1.0.0 2021-08-18 | 
				
			|||
 */ | 
				
			|||
@Data | 
				
			|||
@EqualsAndHashCode(callSuper=false) | 
				
			|||
@TableName("info_profile") | 
				
			|||
public class InfoProfileEntity extends BaseEpmetEntity { | 
				
			|||
 | 
				
			|||
	private static final long serialVersionUID = 1L; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 客户id | 
				
			|||
     */ | 
				
			|||
	private String customerId; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 消息主表的id | 
				
			|||
     */ | 
				
			|||
	private String infoId; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 发布人id | 
				
			|||
     */ | 
				
			|||
	private String publishStaffId; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 内容概要,取前100字 | 
				
			|||
     */ | 
				
			|||
	private String content; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 附件ID,第一个用于展示 | 
				
			|||
     */ | 
				
			|||
	private String firstAttId; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 应读人数 | 
				
			|||
     */ | 
				
			|||
	private Integer totalReceiver; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 已读人数,插入是为0 | 
				
			|||
     */ | 
				
			|||
	private Integer readTotal; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 未读的回复数量:发布人每次查看详情后,置为0;接收人回复一条+1 | 
				
			|||
     */ | 
				
			|||
	private Integer unReadReplyNum; | 
				
			|||
 | 
				
			|||
} | 
				
			|||
@ -0,0 +1,52 @@ | 
				
			|||
<?xml version="1.0" encoding="UTF-8"?> | 
				
			|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | 
				
			|||
 | 
				
			|||
<mapper namespace="com.epmet.dataaggre.dao.epmetmessage.InfoProfileDao"> | 
				
			|||
 | 
				
			|||
    <resultMap id="MySentResDTOMap" type="com.epmet.dataaggre.dto.message.result.MySentResDTO"> | 
				
			|||
        <id property="infoId" column="id" /> | 
				
			|||
        <result property="content" column="content"/> | 
				
			|||
        <result property="publishTime" column="CREATED_TIME"/> | 
				
			|||
        <result property="totalReceiver" column="total_receiver"/> | 
				
			|||
        <result property="readTotal" column="read_total"/> | 
				
			|||
        <result property="firstAttId" column="first_att_id"/> | 
				
			|||
        <collection property="attachmentList" ofType="com.epmet.commons.tools.dto.form.FileCommonDTO" > | 
				
			|||
            <result property="name" column=""/> | 
				
			|||
            <result property="url" column=""/> | 
				
			|||
            <result property="type" column=""/> | 
				
			|||
            <result property="format" column=""/> | 
				
			|||
            <result property="size" column=""/> | 
				
			|||
            <result property="duration" column=""/> | 
				
			|||
        </collection> | 
				
			|||
    </resultMap> | 
				
			|||
 | 
				
			|||
    <!--    我发出的消息列表--> | 
				
			|||
    <select id="selectListMySent" parameterType="java.lang.String" resultMap="MySentResDTOMap"> | 
				
			|||
        select | 
				
			|||
            i.id, | 
				
			|||
            ip.content, | 
				
			|||
            i.CREATED_TIME, | 
				
			|||
            ip.total_receiver, | 
				
			|||
            ip.read_total, | 
				
			|||
            ip.first_att_id, | 
				
			|||
            IFNULL(ia.ATTACHMENT_NAME,'') AS name, | 
				
			|||
            IFNULL(ia.ATTACHMENT_FORMAT,'') AS format, | 
				
			|||
            IFNULL(ia.ATTACHMENT_TYPE,'') AS type, | 
				
			|||
            IFNULL(ia.ATTACHMENT_URL,'') AS url, | 
				
			|||
            IFNULL(ia.ATTACHMENT_SIZE,'') AS size, | 
				
			|||
            IFNULL(ia.DURATION,'') AS duration | 
				
			|||
        from info_profile ip | 
				
			|||
            inner join info i | 
				
			|||
        on(ip.INFO_ID=i.id) | 
				
			|||
            left join info_att ia | 
				
			|||
            on(ip.first_att_id=ia.id and ia.DEL_FLAG='0') | 
				
			|||
        where ip.DEL_FLAG='0' | 
				
			|||
          and i.DEL_FLAG='0' | 
				
			|||
          and i.publish_staff_id=#{publishStaffId} | 
				
			|||
         <if test="null != content and content !=''"> | 
				
			|||
             i.content like concat('%',#{content},'%') | 
				
			|||
         </if> | 
				
			|||
        order by i.CREATED_TIME desc | 
				
			|||
    </select> | 
				
			|||
 | 
				
			|||
</mapper> | 
				
			|||
@ -1 +1,2 @@ | 
				
			|||
alter table info add fulltext index idx_fulltext_infocontent(content); | 
				
			|||
alter table info add fulltext index idx_fulltext_infocontent(content) WITH PARSER ngram; | 
				
			|||
drop index idx_fulltext_infocontent on info; | 
				
			|||
 | 
				
			|||
					Loading…
					
					
				
		Reference in new issue