bug修复

This commit is contained in:
guo 2024-04-03 19:44:32 +08:00
parent 8c99faacf5
commit 56b19822b3
5 changed files with 46 additions and 3 deletions

View File

@ -130,4 +130,17 @@ public class XzNoticeController {
xzNoticeService.markRead(paramMap);
return Result.ok();
}
@ApiOperation(value = "批量删除", notes = "批量删除", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "ids", value = "星纵-消息中心IDs选择的消息删除", paramType = "body", required = false, dataType = "String"),
@ApiImplicitParam(name = "accountId", value = "推送到的账号ID此账号下所有消息删除", paramType = "body", required = true, dataType = "String"),
})
@PostMapping(value = "/batchDelete")
public Result batchDelete(@ApiIgnore @RequestBody HashMap<String, Object> paramMap) {
xzNoticeService.batchDelete(paramMap);
return Result.ok();
}
}

View File

@ -16,4 +16,6 @@ import java.util.HashMap;
public interface XzNoticeMapper extends BaseMapper<XzNotice> {
Boolean markRead(HashMap<String, Object> paramMap);
void batchDelete(HashMap<String, Object> paramMap);
}

View File

@ -3,16 +3,28 @@
<mapper namespace="com.zhgd.xmgl.modules.xz.mapper.XzNoticeMapper">
<select id="markRead" resultType="java.lang.Boolean">
update xz_notice
set isRead = 1
set is_read = 1
where 1 = 1
<if test="accountId != null and accountId != ''">
and account_id = #{accountId}
</if>
<if test="ids != null and ids != ''">
<if test="idList != null and idList != ''">
and id in
<foreach collection="ids" index="index" item="item" open="(" separator="," close=")">
<foreach collection="idList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
<delete id="batchDelete">
delete from xz_notice
where 1=1
and account_id = #{accountId}
<if test="idList != null and idList != ''">
and id in
<foreach collection="idList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</delete>
</mapper>

View File

@ -26,4 +26,6 @@ public interface IXzNoticeService extends IService<XzNotice> {
void delete(String id);
void markRead(HashMap<String, Object> paramMap);
void batchDelete(HashMap<String, Object> paramMap);
}

View File

@ -18,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
@ -81,9 +82,22 @@ public class XzNoticeServiceImpl extends ServiceImpl<XzNoticeMapper, XzNotice> i
@Override
public void markRead(HashMap<String, Object> paramMap) {
String ids = MapUtils.getString(paramMap, "ids");
if (StringUtils.isNotBlank(ids)) {
paramMap.put("idList", Arrays.asList(StringUtils.split(ids, ",")));
}
baseMapper.markRead(paramMap);
}
@Override
public void batchDelete(HashMap<String, Object> paramMap) {
String ids = MapUtils.getString(paramMap, "ids");
if (StringUtils.isNotBlank(ids)) {
paramMap.put("idList", Arrays.asList(StringUtils.split(ids, ",")));
}
baseMapper.batchDelete(paramMap);
}
}