remove pageByBizId and add deleteByBizId

This commit is contained in:
Timi
2025-12-09 17:43:27 +08:00
parent 40760ed517
commit e2a3c193d8
3 changed files with 19 additions and 10 deletions

View File

@ -4,8 +4,6 @@ import com.imyeyu.api.modules.common.entity.Attachment;
import com.imyeyu.api.modules.common.vo.attachment.AttachmentRequest;
import com.imyeyu.api.modules.common.vo.attachment.AttachmentView;
import com.imyeyu.java.bean.timi.TimiException;
import com.imyeyu.spring.bean.Page;
import com.imyeyu.spring.bean.PageResult;
import com.imyeyu.spring.service.DeletableService;
import com.imyeyu.spring.service.DestroyableService;
import com.imyeyu.spring.service.GettableService;
@ -81,5 +79,5 @@ public interface AttachmentService extends GettableService<Attachment, Long>, Pa
List<Attachment> listByMd5s(Attachment.BizType bizType, Long bizId, List<Enum<?>> attachTypeList, List<String> md5s) throws TimiException;
PageResult<Attachment> pageByBizId(Attachment.BizType bizType, Long bizId, List<Enum<?>> attachTypeList, Page page) throws TimiException;
void deleteByBizId(Attachment.BizType bizType, long bizId, Enum<?> ...attachTypes);
}

View File

@ -15,8 +15,6 @@ import com.imyeyu.java.TimiJava;
import com.imyeyu.java.bean.timi.TimiCode;
import com.imyeyu.java.bean.timi.TimiException;
import com.imyeyu.network.Network;
import com.imyeyu.spring.bean.Page;
import com.imyeyu.spring.bean.PageResult;
import com.imyeyu.spring.mapper.BaseMapper;
import com.imyeyu.spring.service.AbstractEntityService;
import com.imyeyu.utils.Time;
@ -244,10 +242,17 @@ public class AttachmentServiceImplement extends AbstractEntityService<Attachment
}
@Override
public PageResult<Attachment> pageByBizId(Attachment.BizType bizType, Long bizId, List<Enum<?>> attachTypeList, Page page) throws TimiException {
PageResult<Attachment> result = new PageResult<>();
result.setList(mapper.listByBizId(bizType, bizId, attachTypeList, page));
result.setTotal(mapper.countByBizId(bizType, bizId, attachTypeList));
return result;
public void deleteByBizId(Attachment.BizType bizType, long bizId, Enum<?>... attachTypes) {
Attachment example = new Attachment();
example.setBizType(bizType);
example.setBizId(bizId);
if (TimiJava.isEmpty(attachTypes)) {
mapper.deleteAllByExample(example);
} else {
for (int i = 0; i < attachTypes.length; i++) {
example.setAttachTypeValue(attachTypes[i]);
mapper.deleteAllByExample(example);
}
}
}
}

View File

@ -67,6 +67,12 @@
#{item}
</foreach>
</if>
<if test="md5s != null and 0 &lt; md5s.size()">
AND `md5` IN
<foreach collection="md5s" item="md5" open="(" separator="," close=")">
#{md5}
</foreach>
</if>
AND deleted_at IS NULL
AND destroy_at IS NULL
</select>