小程序 打卡社区动态接口加上点赞人信息、增加点赞接口

This commit is contained in:
xiezhijun
2021-07-15 18:13:03 +08:00
parent f71fe6f4cd
commit 6165838288
8 changed files with 421 additions and 0 deletions

View File

@ -0,0 +1,78 @@
<?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.stdiet.custom.mapper.SysPunchThumbsupMapper">
<resultMap type="SysPunchThumbsup" id="SysPunchThumbsupResult">
<result property="id" column="id" />
<result property="punchId" column="punch_id" />
<result property="cusOpenid" column="cus_openid" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="delFlag" column="del_flag" />
</resultMap>
<sql id="selectSysPunchThumbsupVo">
select id, punch_id, cus_openid, create_time, update_time, del_flag from sys_punch_thumbsup
</sql>
<select id="selectSysPunchThumbsupList" parameterType="SysPunchThumbsup" resultMap="SysPunchThumbsupResult">
<include refid="selectSysPunchThumbsupVo"/> where del_flag = 0
</select>
<select id="selectSysPunchThumbsupById" parameterType="Long" resultMap="SysPunchThumbsupResult">
<include refid="selectSysPunchThumbsupVo"/>
where id = #{id} and del_flag = 0
</select>
<insert id="insertSysPunchThumbsup" parameterType="SysPunchThumbsup" useGeneratedKeys="true" keyProperty="id">
insert into sys_punch_thumbsup
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="punchId != null">punch_id,</if>
<if test="cusOpenid != null">cus_openid,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="delFlag != null">del_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="punchId != null">#{punchId},</if>
<if test="cusOpenid != null">#{cusOpenid},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="delFlag != null">#{delFlag},</if>
</trim>
</insert>
<update id="updateSysPunchThumbsup" parameterType="SysPunchThumbsup">
update sys_punch_thumbsup
<trim prefix="SET" suffixOverrides=",">
<if test="punchId != null">punch_id = #{punchId},</if>
<if test="cusOpenid != null">cus_openid = #{cusOpenid},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
</trim>
where id = #{id}
</update>
<update id="deleteSysPunchThumbsupById" parameterType="Long">
update sys_punch_thumbsup set del_flag = 1 where id = #{id}
</update>
<update id="deleteSysPunchThumbsupByIds" parameterType="String">
update sys_punch_thumbsup set del_flag = 1 where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<update id="deleteThumbsupByPunchIdAndOpenid" parameterType="SysPunchThumbsup">
update sys_punch_thumbsup set del_flag = 1 where punch_id = #{punchId} and cus_openid =#{cusOpenid}
</update>
<select id="getThumbsupByPunchIdAndOpenid" parameterType="SysPunchThumbsup" resultMap="SysPunchThumbsupResult">
<include refid="selectSysPunchThumbsupVo"/> where del_flag = 0 and punch_id = #{punchId} and cus_openid =#{cusOpenid} limit 1
</select>
</mapper>

View File

@ -331,6 +331,8 @@
<result property="healthManifesto" column="health_manifesto"/>
<!-- 查询最近五天体重 -->
<association property="recentWeight" column="{cusId=cus_id,logTime=log_time}" select="getRecentWeight"/>
<!-- 查询点赞的openid -->
<association property="thumbsupOpenid" column="id" select="getPunchThumbsupList"/>
</resultMap>
<!-- 查询打卡社区内容 -->
@ -341,6 +343,12 @@
order by wxlog.log_time desc
</select>
<!-- 查询打卡社区中点赞的openid -->
<select id="getPunchThumbsupList" parameterType="Long" resultType="Map">
select cus_openid as openid from sys_punch_thumbsup
where punch_id = #{id} and del_flag = 0
</select>
<!-- 查询最近一周的打卡体重 -->
<select id="getRecentWeight" resultType="Map">
select DATE_FORMAT(wxlog.log_time,'%Y-%m-%d') as logTime,wxlog.weight as weight from sys_wx_user_log wxlog