feat: 软约 用户参加的活动

This commit is contained in:
萌狼蓝天 2024-11-17 18:29:32 +08:00
parent c70d123fe5
commit ebc2e3a22b
8 changed files with 77 additions and 5 deletions

View File

@ -89,4 +89,8 @@ public class ActivateController {
public ResponseEntity detailActivate(@RequestBody ActivateUser au){ public ResponseEntity detailActivate(@RequestBody ActivateUser au){
return ResponseEntity.ok(activateService.detailActivate(au)); return ResponseEntity.ok(activateService.detailActivate(au));
} }
@GetMapping("/my")
public ResponseEntity MyActivate(@RequestParam("uid") Long uid){
return ResponseEntity.ok(activateService.myActivate(uid));
}
} }

View File

@ -86,11 +86,11 @@ public class AuthController {
description = "用户退出登录", description = "用户退出登录",
tags = {"系统认证接口"} tags = {"系统认证接口"}
) )
@PostMapping("/logout") @GetMapping("/logout")
public ResponseEntity logout() { public ResponseEntity logout() {
String id = StpUtil.getLoginId().toString(); String id = StpUtil.getLoginId().toString();
StpUtil.logout(); StpUtil.logout();
log.info("用户"+id+"退出"); log.info("用户{}退出", id);
return ResponseEntity.ok().build(); return ResponseEntity.ok().build();
} }
@Operation( @Operation(

View File

@ -1,5 +1,6 @@
package com.guaiguailang.harmony.domain.vo; package com.guaiguailang.harmony.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
@Data @Data
@ -12,5 +13,17 @@ public class ActivateUserVO {
private long sf; private long sf;
private String about; private String about;
private int status; private int status;
private String title;
private String creatorName;
private long creatorId;
private String titleNext;
private String agentId;
private java.sql.Timestamp createTime;
private java.sql.Timestamp updateTime;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm")
private java.sql.Timestamp startTime;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm")
private java.sql.Timestamp endTime;
private String description;
private String imgUrl;
} }

View File

@ -2,7 +2,7 @@ package com.guaiguailang.harmony.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.guaiguailang.harmony.domain.entity.ActiveBaseInfo; import com.guaiguailang.harmony.domain.entity.ActiveBaseInfo;
import org.apache.ibatis.annotations.Insert; import com.guaiguailang.harmony.domain.vo.ActivateUserVO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
@ -13,5 +13,6 @@ import java.util.List;
public interface ActivateMapper extends BaseMapper<ActiveBaseInfo> { public interface ActivateMapper extends BaseMapper<ActiveBaseInfo> {
@Select("SELECT * FROM active_base_info WHERE ${paramName} != #{paramValue}") @Select("SELECT * FROM active_base_info WHERE ${paramName} != #{paramValue}")
List<ActiveBaseInfo> getActivate(@Param("paramName") String paramName, @Param("paramValue") String paramValue); List<ActiveBaseInfo> getActivate(@Param("paramName") String paramName, @Param("paramValue") String paramValue);
// @Select("SELECT * FROM active_base_info JOIN activate_user on active_base_info.id = activate_user.acid where activate_user.uid=#{uid}")
List<ActivateUserVO> getMyActivate(Long uid);
} }

View File

@ -28,4 +28,6 @@ public interface ActivateService {
ResponseResult detailActivate(ActivateUser au); ResponseResult detailActivate(ActivateUser au);
ResponseResult loadActivateSelect(ParamSelect paramSelect); ResponseResult loadActivateSelect(ParamSelect paramSelect);
ResponseResult myActivate(Long uid);
} }

View File

@ -215,4 +215,9 @@ public class ActivateServiceImpl implements ActivateService {
public ResponseResult loadActivateSelect(ParamSelect paramSelect) { public ResponseResult loadActivateSelect(ParamSelect paramSelect) {
return ResponseResult.success(activateMapper.getActivate(paramSelect.getParamName(),paramSelect.getParamValue())); return ResponseResult.success(activateMapper.getActivate(paramSelect.getParamName(),paramSelect.getParamValue()));
} }
@Override
public ResponseResult myActivate(Long uid) {
return ResponseResult.success(activateMapper.getMyActivate(uid));
}
} }

View File

@ -53,6 +53,7 @@ public class AuthServiceImpl implements AuthService {
// 根据账号查询用户 // 根据账号查询用户
UserInfo userInfo = userMapper.getUserByAccount(loginParam.getUsername()); UserInfo userInfo = userMapper.getUserByAccount(loginParam.getUsername());
if (userInfo == null) { if (userInfo == null) {
return ResponseResult.error("用户不存在"); return ResponseResult.error("用户不存在");
} }

View File

@ -3,5 +3,51 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.guaiguailang.harmony.mapper.ActivateMapper"> <mapper namespace="com.guaiguailang.harmony.mapper.ActivateMapper">
<resultMap id="ActivateUserResultMap" type="com.guaiguailang.harmony.domain.vo.ActivateUserVO">
<id property="id" column="id"/>
<result property="uid" column="uid"/>
<result property="acid" column="acid"/>
<result property="sf" column="sf"/>
<result property="about" column="about"/>
<result property="status" column="userStatus"/>
<result property="title" column="title"/>
<result property="creatorName" column="creatorName"/>
<result property="creatorId" column="creatorId"/>
<result property="titleNext" column="titleNext"/>
<result property="agentId" column="agentId"/>
<result property="createTime" column="createTime"/>
<result property="updateTime" column="updateTime"/>
<result property="startTime" column="startTime"/>
<result property="endTime" column="endTime"/>
<result property="description" column="description"/>
<result property="imgUrl" column="imgUrl"/>
<result property="status" column="status"/>
</resultMap>
<select id="getMyActivate" resultMap="ActivateUserResultMap">
SELECT
au.id,
au.uid,
au.acid,
au.sf,
au.about,
abi.title,
abi.creator_name AS creatorName,
abi.creator_id AS creatorId,
abi.title_next AS titleNext,
abi.agent_id AS agentId,
abi.create_time AS createTime,
abi.update_time AS updateTime,
abi.start_time AS startTime,
abi.end_time AS endTime,
abi.description,
abi.img_url AS imgUrl,
abi.status AS status
FROM
activate_user au
JOIN
active_base_info abi ON au.acid = abi.id
WHERE
au.uid = #{uid};
</select>
</mapper> </mapper>