|
@@ -3,11 +3,9 @@ package com.boman.web.core.mapper;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.boman.common.core.utils.SqlProviderUtils;
|
|
|
import com.boman.domain.jflow.ProcessNodeCandidator;
|
|
|
+import io.swagger.models.auth.In;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.apache.ibatis.annotations.Mapper;
|
|
|
-import org.apache.ibatis.annotations.Param;
|
|
|
-import org.apache.ibatis.annotations.Select;
|
|
|
-import org.apache.ibatis.annotations.SelectProvider;
|
|
|
+import org.apache.ibatis.annotations.*;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.stereotype.Component;
|
|
@@ -26,7 +24,7 @@ public interface MessageMapper {
|
|
|
|
|
|
/**
|
|
|
* 功能描述: 自定义查询,需要查询的字段和value都在condition中
|
|
|
- * {@link StandardMapper.SqlProvider#countByCondition(Map)}
|
|
|
+ * {@link MessageMapper.SqlProvider#countByCondition(Map)}
|
|
|
*
|
|
|
* @param username username
|
|
|
* @return int
|
|
@@ -34,12 +32,58 @@ public interface MessageMapper {
|
|
|
@SelectProvider(type = MessageMapper.SqlProvider.class, method = "countByCondition")
|
|
|
int countByCondition(@Param("username") String username);
|
|
|
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 功能描述: 查询
|
|
|
+ * {@link MessageMapper.SqlProvider#selectByCondition(Map)}
|
|
|
+ *
|
|
|
+ * @param username username
|
|
|
+ * @return int
|
|
|
+ */
|
|
|
@SelectProvider(type = MessageMapper.SqlProvider.class, method = "selectByCondition")
|
|
|
List<JSONObject> toDoMessage(@Param("username") String username
|
|
|
, @Param("limit") int limit
|
|
|
, @Param("offset") int offset);
|
|
|
|
|
|
+ /**
|
|
|
+ * 功能描述: 查询
|
|
|
+ * {@link MessageMapper.SqlProvider#getIndexCountInfo(Map)}
|
|
|
+ *
|
|
|
+ * @param userId userId
|
|
|
+ * @return int
|
|
|
+ */
|
|
|
+ @SelectProvider(type = MessageMapper.SqlProvider.class, method = "getIndexCountInfo")
|
|
|
+ Long getIndexCountInfo(@Param("userId") Long userId, @Param("dateStr") String dateStr);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 功能描述: 统计是否完成全部已读
|
|
|
+ *
|
|
|
+ * {@link MessageMapper.SqlProvider#countReceive(Map)}
|
|
|
+ *
|
|
|
+ * @param messageId userId
|
|
|
+ * @return int
|
|
|
+ */
|
|
|
+ @SelectProvider(type = MessageMapper.SqlProvider.class, method = "countReceive")
|
|
|
+ Integer countReceive(@Param("messageId") Long messageId);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * {@link MessageMapper.SqlProvider#updateReceive(Map)}
|
|
|
+ *
|
|
|
+ * @param dataId
|
|
|
+ * @param receiveTime
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @UpdateProvider(type = MessageMapper.SqlProvider.class, method = "updateReceive")
|
|
|
+ int updateReceive(@Param("dataId") Long dataId, @Param("receiveTime") String receiveTime);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * {@link MessageMapper.SqlProvider#updateMessageSituationStatus(Map)}
|
|
|
+ *
|
|
|
+ * @param dataId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @UpdateProvider(type = MessageMapper.SqlProvider.class, method = "updateMessageSituationStatus")
|
|
|
+ int updateMessageSituationStatus(@Param("dataId") Long dataId);
|
|
|
+
|
|
|
class SqlProvider {
|
|
|
|
|
|
public String countByCondition(Map<String, Object> para) {
|
|
@@ -59,5 +103,28 @@ public interface MessageMapper {
|
|
|
LOGGER.info("查询拼出的sql语句为:{} \r\n", result);
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
+ public String getIndexCountInfo(Map<String, Object> para) {
|
|
|
+ String result = "SELECT count(1) FROM boman_message WHERE send_user_id = " + para.get("userId") + " " +
|
|
|
+ " AND DATE_FORMAT(create_time, '%Y-%m-%d') = '" + para.get("dateStr") + "' AND message_situation <> '3'";
|
|
|
+
|
|
|
+ LOGGER.info("查询拼出的sql语句为:{} \r\n", result);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String countReceive(Map<String, Object> para) {
|
|
|
+ String result = "select count(1) from boman_message_receive t where t.visible = 'Y' and status = 'N' and t.message_id = " + para.get("messageId");
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String updateReceive(Map<String, Object> para) {
|
|
|
+ String sql = "update boman_message_receive set status = 'Y', receive_time = str_to_date('" + para.get("receiveTime") + "', '%Y-%m-%d %H:%i:%s') where id = " + para.get("dataId");
|
|
|
+ return sql;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String updateMessageSituationStatus(Map<String, Object> para) {
|
|
|
+ String sql = "update boman_message set message_situation = '2' where id = " + para.get("dataId");
|
|
|
+ return sql;
|
|
|
+ }
|
|
|
}
|
|
|
}
|