remove pageByBizId and add deleteByBizId
This commit is contained in:
@ -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.AttachmentRequest;
|
||||||
import com.imyeyu.api.modules.common.vo.attachment.AttachmentView;
|
import com.imyeyu.api.modules.common.vo.attachment.AttachmentView;
|
||||||
import com.imyeyu.java.bean.timi.TimiException;
|
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.DeletableService;
|
||||||
import com.imyeyu.spring.service.DestroyableService;
|
import com.imyeyu.spring.service.DestroyableService;
|
||||||
import com.imyeyu.spring.service.GettableService;
|
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;
|
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);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,8 +15,6 @@ import com.imyeyu.java.TimiJava;
|
|||||||
import com.imyeyu.java.bean.timi.TimiCode;
|
import com.imyeyu.java.bean.timi.TimiCode;
|
||||||
import com.imyeyu.java.bean.timi.TimiException;
|
import com.imyeyu.java.bean.timi.TimiException;
|
||||||
import com.imyeyu.network.Network;
|
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.mapper.BaseMapper;
|
||||||
import com.imyeyu.spring.service.AbstractEntityService;
|
import com.imyeyu.spring.service.AbstractEntityService;
|
||||||
import com.imyeyu.utils.Time;
|
import com.imyeyu.utils.Time;
|
||||||
@ -244,10 +242,17 @@ public class AttachmentServiceImplement extends AbstractEntityService<Attachment
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<Attachment> pageByBizId(Attachment.BizType bizType, Long bizId, List<Enum<?>> attachTypeList, Page page) throws TimiException {
|
public void deleteByBizId(Attachment.BizType bizType, long bizId, Enum<?>... attachTypes) {
|
||||||
PageResult<Attachment> result = new PageResult<>();
|
Attachment example = new Attachment();
|
||||||
result.setList(mapper.listByBizId(bizType, bizId, attachTypeList, page));
|
example.setBizType(bizType);
|
||||||
result.setTotal(mapper.countByBizId(bizType, bizId, attachTypeList));
|
example.setBizId(bizId);
|
||||||
return result;
|
if (TimiJava.isEmpty(attachTypes)) {
|
||||||
|
mapper.deleteAllByExample(example);
|
||||||
|
} else {
|
||||||
|
for (int i = 0; i < attachTypes.length; i++) {
|
||||||
|
example.setAttachTypeValue(attachTypes[i]);
|
||||||
|
mapper.deleteAllByExample(example);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -67,6 +67,12 @@
|
|||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
|
<if test="md5s != null and 0 < md5s.size()">
|
||||||
|
AND `md5` IN
|
||||||
|
<foreach collection="md5s" item="md5" open="(" separator="," close=")">
|
||||||
|
#{md5}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
AND deleted_at IS NULL
|
AND deleted_at IS NULL
|
||||||
AND destroy_at IS NULL
|
AND destroy_at IS NULL
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
Reference in New Issue
Block a user