瀏覽代碼

update:审核列表

yonge 4 年之前
父節點
當前提交
f3801cc60b

+ 4 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SysMessageDao.java

@@ -1,15 +1,19 @@
 package com.ym.mec.biz.dal.dao;
 
 import java.util.List;
+import java.util.Map;
 
 import org.apache.ibatis.annotations.Param;
 
 import com.ym.mec.biz.dal.dto.Mapper;
+import com.ym.mec.biz.dal.dto.SysMessageDto;
 import com.ym.mec.biz.dal.entity.SysMessage;
 import com.ym.mec.biz.dal.enums.MessageSendMode;
 import com.ym.mec.common.dal.BaseDAO;
 
 public interface SysMessageDao extends BaseDAO<Long, SysMessage> {
+	
+	public List<SysMessageDto> queryListPage(Map<String, Object> params);
 
 	public List<SysMessage> queryUserInRecentMinList(@Param("mobile") String mobile, @Param("recentMin") int recentMin, @Param("type") MessageSendMode type);
 

+ 17 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/SysMessageDto.java

@@ -0,0 +1,17 @@
+package com.ym.mec.biz.dal.dto;
+
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.entity.SysMessage;
+
+public class SysMessageDto extends SysMessage {
+
+	private SysUser user = new SysUser();
+
+	public SysUser getUser() {
+		return user;
+	}
+
+	public void setUser(SysUser user) {
+		this.user = user;
+	}
+}

+ 5 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/SysMessageService.java

@@ -5,13 +5,18 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import com.ym.mec.biz.dal.dto.SysMessageDto;
 import com.ym.mec.biz.dal.entity.SysMessage;
 import com.ym.mec.biz.dal.enums.MessageSendMode;
 import com.ym.mec.biz.dal.enums.MessageTypeEnum;
+import com.ym.mec.common.page.PageInfo;
+import com.ym.mec.common.page.QueryInfo;
 import com.ym.mec.common.service.BaseService;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext.MessageSender;
 
 public interface SysMessageService extends BaseService<Long, SysMessage> {
+	
+	public PageInfo<SysMessageDto> queryListPage(QueryInfo queryInfo);
 
 	/**
 	 * 修改消息对象

+ 25 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysMessageServiceImpl.java

@@ -7,6 +7,7 @@ import com.ym.mec.biz.dal.dao.SysConfigDao;
 import com.ym.mec.biz.dal.dao.SysMessageDao;
 import com.ym.mec.biz.dal.dao.WaitSendMessageDao;
 import com.ym.mec.biz.dal.dto.Mapper;
+import com.ym.mec.biz.dal.dto.SysMessageDto;
 import com.ym.mec.biz.dal.entity.SysMessage;
 import com.ym.mec.biz.dal.entity.SysMessageConfig;
 import com.ym.mec.biz.dal.entity.WaitSendMessage;
@@ -21,13 +22,17 @@ import com.ym.mec.common.entity.ImPlayMidiMessage;
 import com.ym.mec.common.entity.ImPrivateMessage;
 import com.ym.mec.common.entity.ImTxtMessage;
 import com.ym.mec.common.exception.BizException;
+import com.ym.mec.common.page.PageInfo;
+import com.ym.mec.common.page.QueryInfo;
 import com.ym.mec.common.redis.service.RedisCache;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.im.ImFeignService;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext.MessageSender;
+import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
 import com.ym.mec.util.string.MessageFormatter;
+
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -87,6 +92,26 @@ public class SysMessageServiceImpl extends BaseServiceImpl<Long, SysMessage> imp
 		return sysMessageDao;
 	}
 
+	@Override
+	public PageInfo<SysMessageDto> queryListPage(QueryInfo queryInfo) {
+		PageInfo<SysMessageDto> pageInfo = new PageInfo<SysMessageDto>(queryInfo.getPage(), queryInfo.getRows());
+		Map<String, Object> params = new HashMap<String, Object>();
+		MapUtil.populateMap(params, queryInfo);
+		
+		List<SysMessageDto> dataList = null;
+		int count = this.findCount(params);
+		if (count > 0) {
+			pageInfo.setTotal(count);
+			params.put("offset", pageInfo.getOffset());
+			dataList = sysMessageDao.queryListPage(params);
+		}
+		if (count == 0) {
+			dataList = new ArrayList<SysMessageDto>();
+		}
+		pageInfo.setRows(dataList);
+		return pageInfo;
+	}
+
 	/**
 	 * 添加消息
 	 * @param subject 消息主题

+ 24 - 13
mec-biz/src/main/resources/config/mybatis/SysMessageMapper.xml

@@ -24,6 +24,10 @@
         <result column="jpush_type_" property="jpushType"/>
     </resultMap>
     
+    <resultMap type="com.ym.mec.biz.dal.dto.SysMessageDto" id="messageDto" extends="message">
+        <result column="username_" property="user.username"/>
+    </resultMap>
+    
     <resultMap type="com.ym.mec.biz.dal.dto.Mapper" id="Mapper">
     	<result column="key_" property="key"/>
         <result column="value_" property="value"/>
@@ -32,31 +36,31 @@
 	<sql id="queryCondition">
 		<where>
 			<if test="jpushType != null and jpushType != ''">
-				and (jpush_type_ = #{jpushType} OR jpush_type_ IS NULL)
+				and (m.jpush_type_ = #{jpushType} OR m.jpush_type_ IS NULL)
 			</if>
 			<if test="userId != null">
-				and user_id_ = #{userId}
+				and m.user_id_ = #{userId}
 			</if>
 			<if test="receiver != null">
-				and receiver_ like '%' #{receiver} '%'
+				and m.receiver_ like '%' #{receiver} '%'
 			</if>
 			<if test="status != null">
-				and status_ = #{status,jdbcType=TINYINT}
+				and m.status_ = #{status,jdbcType=TINYINT}
 			</if>
 			<if test="readStatus != null">
-				and read_status_ = #{readStatus,jdbcType=TINYINT}
+				and m.read_status_ = #{readStatus,jdbcType=TINYINT}
 			</if>
 			<if test="title != null">
-				and title_ like '%' #{title} '%'
+				and m.title_ like '%' #{title} '%'
 			</if>
 			<if test="type != null">
-				and type_ = #{type}
+				and m.type_ = #{type}
 			</if>
 			<if test="group != null">
-				and group_ = #{group}
+				and m.group_ = #{group}
 			</if>
 			<if test="readStatus != null">
-				and read_status_ = #{readStatus}
+				and m.read_status_ = #{readStatus}
 			</if>
 		</where>
 	</sql>
@@ -158,15 +162,22 @@
     </update>
 
     <select id="queryCount" parameterType="map" resultType="int">
-		select count(*) from sys_message
+		select count(m.id_) from sys_message m
 		<include refid="queryCondition" />
-		order by create_on_ desc
+		order by m.create_on_ desc
 	</select>
 
 	<select id="queryPage" parameterType="map" resultMap="message">
-		select * from sys_message
+		select m.* from sys_message m
+		<include refid="queryCondition" />
+		order by m.create_on_ desc
+		<include refid="global.limit" />
+	</select>
+
+	<select id="queryListPage" parameterType="map" resultMap="messageDto">
+		select m.*,u.username_ from sys_message m left join sys_user u on m.user_id_ = u.id_
 		<include refid="queryCondition" />
-		order by create_on_ desc
+		order by m.create_on_ desc
 		<include refid="global.limit" />
 	</select>
 

+ 2 - 8
mec-web/src/main/java/com/ym/mec/web/controller/SysMessageController.java

@@ -3,9 +3,6 @@ package com.ym.mec.web.controller;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 
-import java.io.IOException;
-
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -15,15 +12,12 @@ import org.springframework.web.bind.annotation.RestController;
 
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
-import com.ym.mec.biz.dal.entity.SysMessage;
+import com.ym.mec.biz.dal.dto.SysMessageDto;
 import com.ym.mec.biz.dal.enums.MessageSendMode;
 import com.ym.mec.biz.dal.page.SysMessageQueryInfo;
 import com.ym.mec.biz.service.SysMessageService;
 import com.ym.mec.common.controller.BaseController;
-import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
-import com.ym.mec.thirdparty.message.MessageSenderPluginContext.MessageSender;
-import com.ym.mec.util.validator.CommonValidator;
 
 @RestController
 @Api(tags = "消息服务")
@@ -47,7 +41,7 @@ public class SysMessageController extends BaseController {
 			queryInfo.setUserId(sysUser.getId());
 		}
 		queryInfo.setType(MessageSendMode.SEO.getCode());
-		PageInfo<SysMessage> pageInfo = sysMessageService.queryPage(queryInfo);
+		PageInfo<SysMessageDto> pageInfo = sysMessageService.queryListPage(queryInfo);
 		return succeed(pageInfo);
 	}