Commit e8c18c66 authored by shiyu's avatar shiyu

签到笔记点赞

parent 19ad3519
...@@ -8,4 +8,6 @@ public interface QdGiveLikeRecordDao { ...@@ -8,4 +8,6 @@ public interface QdGiveLikeRecordDao {
boolean insert(QdGiveLikeRecord qdGiveLikeRecord); boolean insert(QdGiveLikeRecord qdGiveLikeRecord);
long countByNoteId(long noteId); long countByNoteId(long noteId);
boolean cancel(long userId, long noteId);
} }
...@@ -42,4 +42,10 @@ public interface QdUserSignInDao { ...@@ -42,4 +42,10 @@ public interface QdUserSignInDao {
boolean updateInvalid(QdUserSignInRequestDto dto); boolean updateInvalid(QdUserSignInRequestDto dto);
/**
* 查询总打卡数
* 签到任务id为空时,则统计所有任务
*/
long countTotalRecord(Long userId, Long taskId);
} }
...@@ -11,5 +11,7 @@ public interface QdUserSignInNoteDao { ...@@ -11,5 +11,7 @@ public interface QdUserSignInNoteDao {
List<QdUserSignInNote> findByPage(QdUserSignInNoteRequestDto dto); List<QdUserSignInNote> findByPage(QdUserSignInNoteRequestDto dto);
QdUserSignInNote findByNoteId(long noteId);
boolean updateByPrimaryKey(QdUserSignInNote qdUserSignInNote);
} }
...@@ -10,4 +10,11 @@ public interface QdUserSignInTaskDao { ...@@ -10,4 +10,11 @@ public interface QdUserSignInTaskDao {
boolean insert(QdUserSignInTask qdUserSignInTask); boolean insert(QdUserSignInTask qdUserSignInTask);
List<QdUserSignInTask> findByPage(QdUserSignInTaskRequestDto dto); List<QdUserSignInTask> findByPage(QdUserSignInTaskRequestDto dto);
/**
* 统计用户参加的签到任务数量
* @param userId
* @return
*/
long count(long userId);
} }
package com.wwdz.ch.db.domain.qiandao; package com.wwdz.ch.db.domain.qiandao;
import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date; import java.util.Date;
import com.xxdxxs.entity.Entity; import com.xxdxxs.entity.Entity;
import lombok.Data; import lombok.Data;
/** /**
* @author shiyu * @author shiyu
* @date 2024/12/19 * @date 2024/12/23
*/ */
@Data @Data
public class QdGiveLikeRecord implements Entity { public class QdGiveLikeRecord implements Entity {
...@@ -40,7 +42,7 @@ public class QdGiveLikeRecord implements Entity { ...@@ -40,7 +42,7 @@ public class QdGiveLikeRecord implements Entity {
/** /**
* 更新时间 * 更新时间
*/ */
private Integer updateTime; private Date updateTime;
/** /**
* 是否有效 * 是否有效
...@@ -115,7 +117,7 @@ public class QdGiveLikeRecord implements Entity { ...@@ -115,7 +117,7 @@ public class QdGiveLikeRecord implements Entity {
noteId("note_id", "noteId", "BIGINT", false), noteId("note_id", "noteId", "BIGINT", false),
noteCreatorId("note_creator_id", "noteCreatorId", "BIGINT", false), noteCreatorId("note_creator_id", "noteCreatorId", "BIGINT", false),
createTime("create_time", "createTime", "TIMESTAMP", false), createTime("create_time", "createTime", "TIMESTAMP", false),
updateTime("update_time", "updateTime", "INTEGER", false), updateTime("update_time", "updateTime", "TIMESTAMP", false),
isValid("is_valid", "isValid", "BIT", false); isValid("is_valid", "isValid", "BIT", false);
/** /**
......
...@@ -818,7 +818,7 @@ public class QdGiveLikeRecordExample { ...@@ -818,7 +818,7 @@ public class QdGiveLikeRecordExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUpdateTimeEqualTo(Integer value) { public Criteria andUpdateTimeEqualTo(Date value) {
addCriterion("update_time =", value, "updateTime"); addCriterion("update_time =", value, "updateTime");
return (Criteria) this; return (Criteria) this;
} }
...@@ -835,7 +835,7 @@ public class QdGiveLikeRecordExample { ...@@ -835,7 +835,7 @@ public class QdGiveLikeRecordExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUpdateTimeNotEqualTo(Integer value) { public Criteria andUpdateTimeNotEqualTo(Date value) {
addCriterion("update_time <>", value, "updateTime"); addCriterion("update_time <>", value, "updateTime");
return (Criteria) this; return (Criteria) this;
} }
...@@ -852,7 +852,7 @@ public class QdGiveLikeRecordExample { ...@@ -852,7 +852,7 @@ public class QdGiveLikeRecordExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUpdateTimeGreaterThan(Integer value) { public Criteria andUpdateTimeGreaterThan(Date value) {
addCriterion("update_time >", value, "updateTime"); addCriterion("update_time >", value, "updateTime");
return (Criteria) this; return (Criteria) this;
} }
...@@ -869,7 +869,7 @@ public class QdGiveLikeRecordExample { ...@@ -869,7 +869,7 @@ public class QdGiveLikeRecordExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUpdateTimeGreaterThanOrEqualTo(Integer value) { public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("update_time >=", value, "updateTime"); addCriterion("update_time >=", value, "updateTime");
return (Criteria) this; return (Criteria) this;
} }
...@@ -886,7 +886,7 @@ public class QdGiveLikeRecordExample { ...@@ -886,7 +886,7 @@ public class QdGiveLikeRecordExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUpdateTimeLessThan(Integer value) { public Criteria andUpdateTimeLessThan(Date value) {
addCriterion("update_time <", value, "updateTime"); addCriterion("update_time <", value, "updateTime");
return (Criteria) this; return (Criteria) this;
} }
...@@ -903,7 +903,7 @@ public class QdGiveLikeRecordExample { ...@@ -903,7 +903,7 @@ public class QdGiveLikeRecordExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUpdateTimeLessThanOrEqualTo(Integer value) { public Criteria andUpdateTimeLessThanOrEqualTo(Date value) {
addCriterion("update_time <=", value, "updateTime"); addCriterion("update_time <=", value, "updateTime");
return (Criteria) this; return (Criteria) this;
} }
...@@ -920,22 +920,22 @@ public class QdGiveLikeRecordExample { ...@@ -920,22 +920,22 @@ public class QdGiveLikeRecordExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUpdateTimeIn(List<Integer> values) { public Criteria andUpdateTimeIn(List<Date> values) {
addCriterion("update_time in", values, "updateTime"); addCriterion("update_time in", values, "updateTime");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUpdateTimeNotIn(List<Integer> values) { public Criteria andUpdateTimeNotIn(List<Date> values) {
addCriterion("update_time not in", values, "updateTime"); addCriterion("update_time not in", values, "updateTime");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUpdateTimeBetween(Integer value1, Integer value2) { public Criteria andUpdateTimeBetween(Date value1, Date value2) {
addCriterion("update_time between", value1, value2, "updateTime"); addCriterion("update_time between", value1, value2, "updateTime");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUpdateTimeNotBetween(Integer value1, Integer value2) { public Criteria andUpdateTimeNotBetween(Date value1, Date value2) {
addCriterion("update_time not between", value1, value2, "updateTime"); addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this; return (Criteria) this;
} }
......
package com.wwdz.ch.db.domain.qiandao; package com.wwdz.ch.db.domain.qiandao;
import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date; import java.util.Date;
import com.xxdxxs.entity.Entity; import com.xxdxxs.entity.Entity;
import lombok.Data; import lombok.Data;
/** /**
* @author shiyu * @author shiyu
* @date 2024/12/18 * @date 2024/12/23
*/ */
@Data @Data
public class QdUserSignInNote implements Entity { public class QdUserSignInNote implements Entity {
...@@ -74,6 +76,11 @@ public class QdUserSignInNote implements Entity { ...@@ -74,6 +76,11 @@ public class QdUserSignInNote implements Entity {
*/ */
private Boolean isDeleted; private Boolean isDeleted;
/**
* 点赞数
*/
private Integer likeNum;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Override @Override
...@@ -95,6 +102,7 @@ public class QdUserSignInNote implements Entity { ...@@ -95,6 +102,7 @@ public class QdUserSignInNote implements Entity {
sb.append(", createTime=").append(createTime); sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime); sb.append(", updateTime=").append(updateTime);
sb.append(", isDeleted=").append(isDeleted); sb.append(", isDeleted=").append(isDeleted);
sb.append(", likeNum=").append(likeNum);
sb.append(", serialVersionUID=").append(serialVersionUID); sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]"); sb.append("]");
return sb.toString(); return sb.toString();
...@@ -124,7 +132,8 @@ public class QdUserSignInNote implements Entity { ...@@ -124,7 +132,8 @@ public class QdUserSignInNote implements Entity {
&& (this.getIsPrivate() == null ? other.getIsPrivate() == null : this.getIsPrivate().equals(other.getIsPrivate())) && (this.getIsPrivate() == null ? other.getIsPrivate() == null : this.getIsPrivate().equals(other.getIsPrivate()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())) && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getIsDeleted() == null ? other.getIsDeleted() == null : this.getIsDeleted().equals(other.getIsDeleted())); && (this.getIsDeleted() == null ? other.getIsDeleted() == null : this.getIsDeleted().equals(other.getIsDeleted()))
&& (this.getLikeNum() == null ? other.getLikeNum() == null : this.getLikeNum().equals(other.getLikeNum()));
} }
@Override @Override
...@@ -144,6 +153,7 @@ public class QdUserSignInNote implements Entity { ...@@ -144,6 +153,7 @@ public class QdUserSignInNote implements Entity {
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getIsDeleted() == null) ? 0 : getIsDeleted().hashCode()); result = prime * result + ((getIsDeleted() == null) ? 0 : getIsDeleted().hashCode());
result = prime * result + ((getLikeNum() == null) ? 0 : getLikeNum().hashCode());
return result; return result;
} }
...@@ -167,7 +177,8 @@ public class QdUserSignInNote implements Entity { ...@@ -167,7 +177,8 @@ public class QdUserSignInNote implements Entity {
isPrivate("is_private", "isPrivate", "BIT", false), isPrivate("is_private", "isPrivate", "BIT", false),
createTime("create_time", "createTime", "TIMESTAMP", false), createTime("create_time", "createTime", "TIMESTAMP", false),
updateTime("update_time", "updateTime", "TIMESTAMP", false), updateTime("update_time", "updateTime", "TIMESTAMP", false),
isDeleted("is_deleted", "isDeleted", "BIT", false); isDeleted("is_deleted", "isDeleted", "BIT", false),
likeNum("like_num", "likeNum", "INTEGER", false);
/** /**
* This field was generated by MyBatis Generator. * This field was generated by MyBatis Generator.
......
...@@ -1913,6 +1913,138 @@ public class QdUserSignInNoteExample { ...@@ -1913,6 +1913,138 @@ public class QdUserSignInNoteExample {
addCriterion("is_deleted not between", value1, value2, "isDeleted"); addCriterion("is_deleted not between", value1, value2, "isDeleted");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andLikeNumIsNull() {
addCriterion("like_num is null");
return (Criteria) this;
}
public Criteria andLikeNumIsNotNull() {
addCriterion("like_num is not null");
return (Criteria) this;
}
public Criteria andLikeNumEqualTo(Integer value) {
addCriterion("like_num =", value, "likeNum");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table qd_user_sign_in_note
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andLikeNumEqualToColumn(QdUserSignInNote.Column column) {
addCriterion(new StringBuilder("like_num = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andLikeNumNotEqualTo(Integer value) {
addCriterion("like_num <>", value, "likeNum");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table qd_user_sign_in_note
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andLikeNumNotEqualToColumn(QdUserSignInNote.Column column) {
addCriterion(new StringBuilder("like_num <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andLikeNumGreaterThan(Integer value) {
addCriterion("like_num >", value, "likeNum");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table qd_user_sign_in_note
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andLikeNumGreaterThanColumn(QdUserSignInNote.Column column) {
addCriterion(new StringBuilder("like_num > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andLikeNumGreaterThanOrEqualTo(Integer value) {
addCriterion("like_num >=", value, "likeNum");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table qd_user_sign_in_note
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andLikeNumGreaterThanOrEqualToColumn(QdUserSignInNote.Column column) {
addCriterion(new StringBuilder("like_num >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andLikeNumLessThan(Integer value) {
addCriterion("like_num <", value, "likeNum");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table qd_user_sign_in_note
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andLikeNumLessThanColumn(QdUserSignInNote.Column column) {
addCriterion(new StringBuilder("like_num < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andLikeNumLessThanOrEqualTo(Integer value) {
addCriterion("like_num <=", value, "likeNum");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table qd_user_sign_in_note
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andLikeNumLessThanOrEqualToColumn(QdUserSignInNote.Column column) {
addCriterion(new StringBuilder("like_num <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andLikeNumIn(List<Integer> values) {
addCriterion("like_num in", values, "likeNum");
return (Criteria) this;
}
public Criteria andLikeNumNotIn(List<Integer> values) {
addCriterion("like_num not in", values, "likeNum");
return (Criteria) this;
}
public Criteria andLikeNumBetween(Integer value1, Integer value2) {
addCriterion("like_num between", value1, value2, "likeNum");
return (Criteria) this;
}
public Criteria andLikeNumNotBetween(Integer value1, Integer value2) {
addCriterion("like_num not between", value1, value2, "likeNum");
return (Criteria) this;
}
} }
public static class Criteria extends GeneratedCriteria { public static class Criteria extends GeneratedCriteria {
......
...@@ -7,6 +7,8 @@ import com.wwdz.ch.db.mapper.qiandao.QdGiveLikeRecordMapper; ...@@ -7,6 +7,8 @@ import com.wwdz.ch.db.mapper.qiandao.QdGiveLikeRecordMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.Date;
@Repository @Repository
public class QdGiveLikeRecordDaoImpl implements QdGiveLikeRecordDao { public class QdGiveLikeRecordDaoImpl implements QdGiveLikeRecordDao {
...@@ -26,4 +28,16 @@ public class QdGiveLikeRecordDaoImpl implements QdGiveLikeRecordDao { ...@@ -26,4 +28,16 @@ public class QdGiveLikeRecordDaoImpl implements QdGiveLikeRecordDao {
criteria.andIsValidEqualTo(true); criteria.andIsValidEqualTo(true);
return qdGiveLikeRecordMapper.countByExample(example); return qdGiveLikeRecordMapper.countByExample(example);
} }
@Override
public boolean cancel(long userId, long noteId) {
QdGiveLikeRecordExample example = new QdGiveLikeRecordExample();
QdGiveLikeRecordExample.Criteria criteria = example.createCriteria();
criteria.andUserIdEqualTo(userId);
criteria.andNoteIdEqualTo(noteId);
QdGiveLikeRecord qdGiveLikeRecord = new QdGiveLikeRecord();
qdGiveLikeRecord.setIsValid(false);
qdGiveLikeRecord.setUpdateTime(new Date());
return qdGiveLikeRecordMapper.updateByExampleSelective(qdGiveLikeRecord, example) > 0;
}
} }
...@@ -135,4 +135,13 @@ public class QdUserSignInDaoImpl implements QdUserSignInDao { ...@@ -135,4 +135,13 @@ public class QdUserSignInDaoImpl implements QdUserSignInDao {
} }
@Override
public long countTotalRecord(Long userId, Long taskId) {
QdUserSignInExample example = new QdUserSignInExample();
QdUserSignInExample.Criteria criteria = example.createCriteria();
criteria.andUserIdEqualTo(userId);
JdbcHelper.ifPresent(taskId, criteria::andTaskIdEqualTo);
criteria.andIsValidEqualTo(true);
return qdUserSignInMapper.countByExample(example);
}
} }
...@@ -30,8 +30,22 @@ public class QdUserSignInNoteDaoImpl implements QdUserSignInNoteDao { ...@@ -30,8 +30,22 @@ public class QdUserSignInNoteDaoImpl implements QdUserSignInNoteDao {
JdbcHelper.ifPresent(dto.getTaskId(), criteria :: andTaskIdEqualTo); JdbcHelper.ifPresent(dto.getTaskId(), criteria :: andTaskIdEqualTo);
JdbcHelper.ifPresent(dto.getUserId(), criteria :: andUserIdEqualTo); JdbcHelper.ifPresent(dto.getUserId(), criteria :: andUserIdEqualTo);
JdbcHelper.ifPresent(dto.getIsPrivate(), criteria :: andIsPrivateEqualTo); JdbcHelper.ifPresent(dto.getIsPrivate(), criteria :: andIsPrivateEqualTo);
criteria.andIsDeletedEqualTo(false);
PageHelper.startPage(dto.getPage(), dto.getLimit()); PageHelper.startPage(dto.getPage(), dto.getLimit());
example.setOrderByClause("create_time desc"); example.setOrderByClause("create_time desc");
return qdUserSignInNoteMapper.selectByExample(example); return qdUserSignInNoteMapper.selectByExample(example);
} }
@Override
public QdUserSignInNote findByNoteId(long noteId) {
QdUserSignInNoteExample example = new QdUserSignInNoteExample();
QdUserSignInNoteExample.Criteria criteria = example.createCriteria();
criteria.andIdEqualTo(noteId);
return qdUserSignInNoteMapper.selectOneByExample(example);
}
@Override
public boolean updateByPrimaryKey(QdUserSignInNote qdUserSignInNote) {
return qdUserSignInNoteMapper.updateByPrimaryKeySelective(qdUserSignInNote) > 0;
}
} }
...@@ -35,4 +35,14 @@ public class QdUserSignInTaskDaoImpl implements QdUserSignInTaskDao { ...@@ -35,4 +35,14 @@ public class QdUserSignInTaskDaoImpl implements QdUserSignInTaskDao {
example.setOrderByClause("create_time desc"); example.setOrderByClause("create_time desc");
return qdUserSignInTaskMapper.selectByExample(example); return qdUserSignInTaskMapper.selectByExample(example);
} }
@Override
public long count(long userId) {
QdUserSignInTaskExample example = new QdUserSignInTaskExample();
QdUserSignInTaskExample.Criteria criteria = example.createCriteria();
criteria.andUserIdEqualTo(userId);
criteria.andIsValidEqualTo(true);
return qdUserSignInTaskMapper.countByExample(example);
}
} }
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<result column="note_id" jdbcType="BIGINT" property="noteId" /> <result column="note_id" jdbcType="BIGINT" property="noteId" />
<result column="note_creator_id" jdbcType="BIGINT" property="noteCreatorId" /> <result column="note_creator_id" jdbcType="BIGINT" property="noteCreatorId" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="INTEGER" property="updateTime" /> <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="is_valid" jdbcType="BIT" property="isValid" /> <result column="is_valid" jdbcType="BIT" property="isValid" />
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
distinct distinct
</if> </if>
<choose> <choose>
<when test="selective != null and selective.length > 0"> <when test="selective != null and selective.length &gt; 0">
<foreach collection="selective" item="column" separator=","> <foreach collection="selective" item="column" separator=",">
${column.escapedColumnName} ${column.escapedColumnName}
</foreach> </foreach>
...@@ -129,7 +129,7 @@ ...@@ -129,7 +129,7 @@
--> -->
select select
<choose> <choose>
<when test="selective != null and selective.length > 0"> <when test="selective != null and selective.length &gt; 0">
<foreach collection="selective" item="column" separator=","> <foreach collection="selective" item="column" separator=",">
${column.escapedColumnName} ${column.escapedColumnName}
</foreach> </foreach>
...@@ -159,7 +159,7 @@ ...@@ -159,7 +159,7 @@
create_time, update_time, is_valid create_time, update_time, is_valid
) )
values (#{userId,jdbcType=BIGINT}, #{noteId,jdbcType=BIGINT}, #{noteCreatorId,jdbcType=BIGINT}, values (#{userId,jdbcType=BIGINT}, #{noteId,jdbcType=BIGINT}, #{noteCreatorId,jdbcType=BIGINT},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=INTEGER}, #{isValid,jdbcType=BIT} #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{isValid,jdbcType=BIT}
) )
</insert> </insert>
<insert id="insertSelective" parameterType="com.wwdz.ch.db.domain.qiandao.QdGiveLikeRecord"> <insert id="insertSelective" parameterType="com.wwdz.ch.db.domain.qiandao.QdGiveLikeRecord">
...@@ -201,7 +201,7 @@ ...@@ -201,7 +201,7 @@
#{createTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP},
</if> </if>
<if test="updateTime != null"> <if test="updateTime != null">
#{updateTime,jdbcType=INTEGER}, #{updateTime,jdbcType=TIMESTAMP},
</if> </if>
<if test="isValid != null"> <if test="isValid != null">
#{isValid,jdbcType=BIT}, #{isValid,jdbcType=BIT},
...@@ -233,7 +233,7 @@ ...@@ -233,7 +233,7 @@
create_time = #{record.createTime,jdbcType=TIMESTAMP}, create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if> </if>
<if test="record.updateTime != null"> <if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=INTEGER}, update_time = #{record.updateTime,jdbcType=TIMESTAMP},
</if> </if>
<if test="record.isValid != null"> <if test="record.isValid != null">
is_valid = #{record.isValid,jdbcType=BIT}, is_valid = #{record.isValid,jdbcType=BIT},
...@@ -250,7 +250,7 @@ ...@@ -250,7 +250,7 @@
note_id = #{record.noteId,jdbcType=BIGINT}, note_id = #{record.noteId,jdbcType=BIGINT},
note_creator_id = #{record.noteCreatorId,jdbcType=BIGINT}, note_creator_id = #{record.noteCreatorId,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=TIMESTAMP}, create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=INTEGER}, update_time = #{record.updateTime,jdbcType=TIMESTAMP},
is_valid = #{record.isValid,jdbcType=BIT} is_valid = #{record.isValid,jdbcType=BIT}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
...@@ -272,7 +272,7 @@ ...@@ -272,7 +272,7 @@
create_time = #{createTime,jdbcType=TIMESTAMP}, create_time = #{createTime,jdbcType=TIMESTAMP},
</if> </if>
<if test="updateTime != null"> <if test="updateTime != null">
update_time = #{updateTime,jdbcType=INTEGER}, update_time = #{updateTime,jdbcType=TIMESTAMP},
</if> </if>
<if test="isValid != null"> <if test="isValid != null">
is_valid = #{isValid,jdbcType=BIT}, is_valid = #{isValid,jdbcType=BIT},
...@@ -286,7 +286,7 @@ ...@@ -286,7 +286,7 @@
note_id = #{noteId,jdbcType=BIGINT}, note_id = #{noteId,jdbcType=BIGINT},
note_creator_id = #{noteCreatorId,jdbcType=BIGINT}, note_creator_id = #{noteCreatorId,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=TIMESTAMP}, create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=INTEGER}, update_time = #{updateTime,jdbcType=TIMESTAMP},
is_valid = #{isValid,jdbcType=BIT} is_valid = #{isValid,jdbcType=BIT}
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
...@@ -317,7 +317,7 @@ ...@@ -317,7 +317,7 @@
select select
'true' as QUERYID, 'true' as QUERYID,
<choose> <choose>
<when test="selective != null and selective.length > 0"> <when test="selective != null and selective.length &gt; 0">
<foreach collection="selective" item="column" separator=","> <foreach collection="selective" item="column" separator=",">
${column.escapedColumnName} ${column.escapedColumnName}
</foreach> </foreach>
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="is_deleted" jdbcType="BIT" property="isDeleted" /> <result column="is_deleted" jdbcType="BIT" property="isDeleted" />
<result column="like_num" jdbcType="INTEGER" property="likeNum" />
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<where> <where>
...@@ -76,7 +77,7 @@ ...@@ -76,7 +77,7 @@
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, user_id, task_id, title, content, image, audio, sign_in_date, record_id, is_private, id, user_id, task_id, title, content, image, audio, sign_in_date, record_id, is_private,
create_time, update_time, is_deleted create_time, update_time, is_deleted, like_num
</sql> </sql>
<select id="selectByExample" parameterType="com.wwdz.ch.db.domain.qiandao.QdUserSignInNoteExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="com.wwdz.ch.db.domain.qiandao.QdUserSignInNoteExample" resultMap="BaseResultMap">
select select
...@@ -105,14 +106,14 @@ ...@@ -105,14 +106,14 @@
distinct distinct
</if> </if>
<choose> <choose>
<when test="selective != null and selective.length > 0"> <when test="selective != null and selective.length &gt; 0">
<foreach collection="selective" item="column" separator=","> <foreach collection="selective" item="column" separator=",">
${column.escapedColumnName} ${column.escapedColumnName}
</foreach> </foreach>
</when> </when>
<otherwise> <otherwise>
id, user_id, task_id, title, content, image, audio, sign_in_date, record_id, is_private, id, user_id, task_id, title, content, image, audio, sign_in_date, record_id, is_private,
create_time, update_time, is_deleted create_time, update_time, is_deleted, like_num
</otherwise> </otherwise>
</choose> </choose>
from qd_user_sign_in_note from qd_user_sign_in_note
...@@ -137,14 +138,14 @@ ...@@ -137,14 +138,14 @@
--> -->
select select
<choose> <choose>
<when test="selective != null and selective.length > 0"> <when test="selective != null and selective.length &gt; 0">
<foreach collection="selective" item="column" separator=","> <foreach collection="selective" item="column" separator=",">
${column.escapedColumnName} ${column.escapedColumnName}
</foreach> </foreach>
</when> </when>
<otherwise> <otherwise>
id, user_id, task_id, title, content, image, audio, sign_in_date, record_id, is_private, id, user_id, task_id, title, content, image, audio, sign_in_date, record_id, is_private,
create_time, update_time, is_deleted create_time, update_time, is_deleted, like_num
</otherwise> </otherwise>
</choose> </choose>
from qd_user_sign_in_note from qd_user_sign_in_note
...@@ -167,13 +168,13 @@ ...@@ -167,13 +168,13 @@
insert into qd_user_sign_in_note (user_id, task_id, title, insert into qd_user_sign_in_note (user_id, task_id, title,
content, image, audio, content, image, audio,
sign_in_date, record_id, is_private, sign_in_date, record_id, is_private,
create_time, update_time, is_deleted create_time, update_time, is_deleted,
) like_num)
values (#{userId,jdbcType=BIGINT}, #{taskId,jdbcType=BIGINT}, #{title,jdbcType=VARCHAR}, values (#{userId,jdbcType=BIGINT}, #{taskId,jdbcType=BIGINT}, #{title,jdbcType=VARCHAR},
#{content,jdbcType=VARCHAR}, #{image,jdbcType=VARCHAR}, #{audio,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR}, #{image,jdbcType=VARCHAR}, #{audio,jdbcType=VARCHAR},
#{signInDate,jdbcType=VARCHAR}, #{recordId,jdbcType=BIGINT}, #{isPrivate,jdbcType=BIT}, #{signInDate,jdbcType=VARCHAR}, #{recordId,jdbcType=BIGINT}, #{isPrivate,jdbcType=BIT},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{isDeleted,jdbcType=BIT} #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{isDeleted,jdbcType=BIT},
) #{likeNum,jdbcType=INTEGER})
</insert> </insert>
<insert id="insertSelective" parameterType="com.wwdz.ch.db.domain.qiandao.QdUserSignInNote"> <insert id="insertSelective" parameterType="com.wwdz.ch.db.domain.qiandao.QdUserSignInNote">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long"> <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
...@@ -217,6 +218,9 @@ ...@@ -217,6 +218,9 @@
<if test="isDeleted != null"> <if test="isDeleted != null">
is_deleted, is_deleted,
</if> </if>
<if test="likeNum != null">
like_num,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null"> <if test="userId != null">
...@@ -255,6 +259,9 @@ ...@@ -255,6 +259,9 @@
<if test="isDeleted != null"> <if test="isDeleted != null">
#{isDeleted,jdbcType=BIT}, #{isDeleted,jdbcType=BIT},
</if> </if>
<if test="likeNum != null">
#{likeNum,jdbcType=INTEGER},
</if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="com.wwdz.ch.db.domain.qiandao.QdUserSignInNoteExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="com.wwdz.ch.db.domain.qiandao.QdUserSignInNoteExample" resultType="java.lang.Long">
...@@ -305,6 +312,9 @@ ...@@ -305,6 +312,9 @@
<if test="record.isDeleted != null"> <if test="record.isDeleted != null">
is_deleted = #{record.isDeleted,jdbcType=BIT}, is_deleted = #{record.isDeleted,jdbcType=BIT},
</if> </if>
<if test="record.likeNum != null">
like_num = #{record.likeNum,jdbcType=INTEGER},
</if>
</set> </set>
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
...@@ -324,7 +334,8 @@ ...@@ -324,7 +334,8 @@
is_private = #{record.isPrivate,jdbcType=BIT}, is_private = #{record.isPrivate,jdbcType=BIT},
create_time = #{record.createTime,jdbcType=TIMESTAMP}, create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP}, update_time = #{record.updateTime,jdbcType=TIMESTAMP},
is_deleted = #{record.isDeleted,jdbcType=BIT} is_deleted = #{record.isDeleted,jdbcType=BIT},
like_num = #{record.likeNum,jdbcType=INTEGER}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
...@@ -368,6 +379,9 @@ ...@@ -368,6 +379,9 @@
<if test="isDeleted != null"> <if test="isDeleted != null">
is_deleted = #{isDeleted,jdbcType=BIT}, is_deleted = #{isDeleted,jdbcType=BIT},
</if> </if>
<if test="likeNum != null">
like_num = #{likeNum,jdbcType=INTEGER},
</if>
</set> </set>
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
...@@ -384,7 +398,8 @@ ...@@ -384,7 +398,8 @@
is_private = #{isPrivate,jdbcType=BIT}, is_private = #{isPrivate,jdbcType=BIT},
create_time = #{createTime,jdbcType=TIMESTAMP}, create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}, update_time = #{updateTime,jdbcType=TIMESTAMP},
is_deleted = #{isDeleted,jdbcType=BIT} is_deleted = #{isDeleted,jdbcType=BIT},
like_num = #{likeNum,jdbcType=INTEGER}
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
<select id="selectOneByExample" parameterType="com.wwdz.ch.db.domain.qiandao.QdUserSignInNoteExample" resultMap="BaseResultMap"> <select id="selectOneByExample" parameterType="com.wwdz.ch.db.domain.qiandao.QdUserSignInNoteExample" resultMap="BaseResultMap">
...@@ -414,14 +429,14 @@ ...@@ -414,14 +429,14 @@
select select
'true' as QUERYID, 'true' as QUERYID,
<choose> <choose>
<when test="selective != null and selective.length > 0"> <when test="selective != null and selective.length &gt; 0">
<foreach collection="selective" item="column" separator=","> <foreach collection="selective" item="column" separator=",">
${column.escapedColumnName} ${column.escapedColumnName}
</foreach> </foreach>
</when> </when>
<otherwise> <otherwise>
id, user_id, task_id, title, content, image, audio, sign_in_date, record_id, is_private, id, user_id, task_id, title, content, image, audio, sign_in_date, record_id, is_private,
create_time, update_time, is_deleted create_time, update_time, is_deleted, like_num
</otherwise> </otherwise>
</choose> </choose>
from qd_user_sign_in_note from qd_user_sign_in_note
......
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
<javaClientGenerator type="XMLMAPPER" targetPackage="com.wwdz.ch.db.mapper.qiandao" <javaClientGenerator type="XMLMAPPER" targetPackage="com.wwdz.ch.db.mapper.qiandao"
targetProject="ch-dao/src/main/java"/> targetProject="ch-dao/src/main/java"/>
<table tableName="sign_in_task" enableCountByExample="true" enableUpdateByExample="true" enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true"> <table tableName="qd_user_sign_in_note" enableCountByExample="true" enableUpdateByExample="true" enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true">
<generatedKey column="id" sqlStatement="Mysql" identity="true" /> <generatedKey column="id" sqlStatement="Mysql" identity="true" />
</table> </table>
......
package com.wwdz.ch.wx.entity.request;
import com.xxdxxs.entity.Entity;
import lombok.Data;
@Data
public class QdHomePageRequestDto implements Entity {
private Long userId;
/**
* 只看自己
*/
private Boolean onlySelf;
}
package com.wwdz.ch.wx.entity.vo.qiandao;
import com.xxdxxs.entity.Entity;
import lombok.Data;
@Data
public class QdHomePageVo implements Entity {
}
package com.wwdz.ch.wx.impl.qiandao;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.db.dao.qiandao.QdGiveLikeRecordDao;
import com.wwdz.ch.db.dao.qiandao.QdUserSignInNoteDao;
import com.wwdz.ch.db.domain.qiandao.QdGiveLikeRecord;
import com.wwdz.ch.db.domain.qiandao.QdUserSignInNote;
import com.wwdz.ch.db.dto.request.qiandao.QdGiveLikeRecordRequestDto;
import com.wwdz.ch.wx.service.qiandao.QdGiveLikeRecordService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
@Service
public class QdGiveLikeRecordServiceImpl implements QdGiveLikeRecordService {
private static final Logger logger = LoggerFactory.getLogger(QdGiveLikeRecordServiceImpl.class);
@Autowired
QdGiveLikeRecordDao qdGiveLikeRecordDao;
@Autowired
QdUserSignInNoteDao qdUserSignInNoteDao;
@Override
public Result giveLike(QdGiveLikeRecordRequestDto dto) {
try {
Date now = new Date();
QdGiveLikeRecord qdGiveLikeRecord = new QdGiveLikeRecord();
qdGiveLikeRecord.setUserId(dto.getUserId());
qdGiveLikeRecord.setNoteId(dto.getNoteId());
//查询笔记信息
QdUserSignInNote qdUserSignInNote = qdUserSignInNoteDao.findByNoteId(dto.getNoteId());
qdGiveLikeRecord.setNoteCreatorId(qdUserSignInNote.getUserId());
qdGiveLikeRecord.setCreateTime(now);
qdGiveLikeRecord.setUpdateTime(now);
qdGiveLikeRecord.setIsValid(true);
qdGiveLikeRecordDao.insert(qdGiveLikeRecord);
//更新笔记点赞数
QdUserSignInNote qdUserSignInNoteUpdateDto = new QdUserSignInNote();
qdUserSignInNoteUpdateDto.setId(qdUserSignInNote.getId());
qdUserSignInNoteUpdateDto.setLikeNum(qdUserSignInNote.getLikeNum() + 1);
qdUserSignInNoteUpdateDto.setUpdateTime(now);
qdUserSignInNoteDao.updateByPrimaryKey(qdUserSignInNote);
return Result.success();
} catch (Exception e) {
logger.error("点赞签到笔记失败 error:{}", e);
}
return Result.failed();
}
@Override
public Result cancelLike(QdGiveLikeRecordRequestDto dto) {
try {
qdGiveLikeRecordDao.cancel(dto.getUserId(), dto.getNoteId());
QdUserSignInNote qdUserSignInNote = qdUserSignInNoteDao.findByNoteId(dto.getNoteId());
//更新笔记点赞数
QdUserSignInNote qdUserSignInNoteUpdateDto = new QdUserSignInNote();
qdUserSignInNoteUpdateDto.setId(qdUserSignInNote.getId());
qdUserSignInNoteUpdateDto.setLikeNum(qdUserSignInNote.getLikeNum() - 1);
qdUserSignInNoteUpdateDto.setUpdateTime(new Date());
qdUserSignInNoteDao.updateByPrimaryKey(qdUserSignInNote);
return Result.success();
} catch (Exception e) {
logger.error("取消点赞失败 error:{}", e);
}
return Result.failed();
}
}
package com.wwdz.ch.wx.impl.qiandao;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.db.dao.qiandao.QdUserDao;
import com.wwdz.ch.db.dao.qiandao.QdUserSignInNoteDao;
import com.wwdz.ch.db.dao.qiandao.QdUserSignInTaskDao;
import com.wwdz.ch.db.dao.qiandao.SignInTaskDao;
import com.wwdz.ch.wx.entity.request.QdHomePageRequestDto;
import com.wwdz.ch.wx.service.qiandao.QdHomePageService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class QdHomePageServiceImpl implements QdHomePageService {
private static final Logger logger = LoggerFactory.getLogger(QdHomePageServiceImpl.class);
@Autowired
QdUserDao qdUserDao;
@Autowired
QdUserSignInTaskDao qdUserSignInTaskDao;
@Autowired
QdUserSignInNoteDao qdUserSignInNoteDao;
@Autowired
SignInTaskDao signInTaskDao;
@Override
public Result findHomePage(QdHomePageRequestDto dto) {
try {
return Result.success();
} catch (Exception e) {
logger.error("查询乾岛首页信息失败 error:{}", e);
}
return Result.failed();
}
@Override
public Result findSignInNoteList(QdHomePageRequestDto dto) {
try {
} catch (Exception e) {
logger.error("查询签到笔记失败 error:{}", e);
}
return Result.failed();
}
}
package com.wwdz.ch.wx.service.qiandao;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.db.dto.request.qiandao.QdGiveLikeRecordRequestDto;
public interface QdGiveLikeRecordService {
/**
* 点赞
* @return
*/
Result giveLike(QdGiveLikeRecordRequestDto dto);
/**
* 取消点赞
* @param dto
* @return
*/
Result cancelLike(QdGiveLikeRecordRequestDto dto);
}
package com.wwdz.ch.wx.service.qiandao;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.wx.entity.request.QdHomePageRequestDto;
public interface QdHomePageService {
/**
* 查询首页信息
* @param dto
* @return
*/
Result findHomePage(QdHomePageRequestDto dto);
Result findSignInNoteList(QdHomePageRequestDto dto);
}
package com.wwdz.ch.wx.web.qiandao;
import com.alibaba.fastjson.JSON;
import com.wwdz.ch.core.consts.ResultCode;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.db.dto.request.qiandao.QdGiveLikeRecordRequestDto;
import com.wwdz.ch.wx.service.qiandao.QdGiveLikeRecordService;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/wx/qdGiveLikeRecord")
public class QdGiveLikeRecordController {
private static final Logger logger = LoggerFactory.getLogger(QdUserController.class);
@Autowired
QdGiveLikeRecordService qdGiveLikeRecordService;
@ApiOperation(value = "点赞")
@PostMapping("/giveLike")
public Result giveLike(@RequestBody QdGiveLikeRecordRequestDto dto) {
logger.info("【请求开始】签到笔记点赞,请求参数:{}", JSON.toJSONString(dto));
if (dto.getUserId() == null || dto.getNoteId() == null) {
return Result.failed(ResultCode.PARAM_ERROR);
}
return qdGiveLikeRecordService.giveLike(dto);
}
@ApiOperation(value = "取消点赞")
@PostMapping("/cancelLike")
public Result cancelLike(@RequestBody QdGiveLikeRecordRequestDto dto) {
logger.info("【请求开始】取消点赞,请求参数:{}", JSON.toJSONString(dto));
if (dto.getUserId() == null || dto.getNoteId() == null) {
return Result.failed(ResultCode.PARAM_ERROR);
}
return qdGiveLikeRecordService.cancelLike(dto);
}
}
...@@ -89,7 +89,7 @@ public class WxPayServiceTest { ...@@ -89,7 +89,7 @@ public class WxPayServiceTest {
@Test @Test
public void refund() { public void refund() {
List<String> list = Arrays.asList("DA2412231150567567502", "DA2412231152083026099"); List<String> list = Arrays.asList("DA2412231422109063526");
list.forEach(orderId ->{ list.forEach(orderId ->{
DistributionOrderRequestDto dto = new DistributionOrderRequestDto(); DistributionOrderRequestDto dto = new DistributionOrderRequestDto();
dto.setDistributionOrderId(orderId); dto.setDistributionOrderId(orderId);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment