提交 733a11ae authored 作者: 吕本才's avatar 吕本才

fix(promotion-service): 修改任务图片问题

上级 7b256207
......@@ -143,7 +143,22 @@ public class TemporaryActivityPhotoDaoImpl implements TemporaryActivityPhotoDao
@Override
public void saveClockTaskPhoto(TemporaryActivityPhotoDto dto, List<String> clockPhtos) {
// 新增数据
saveReportedList(dto.getClockId(),dto.getTemporaryId(), null, dto.getType(), clockPhtos);
// saveReportedList(dto.getClockId(),dto.getTemporaryId(), null, dto.getType(), clockPhtos);
List<TemporaryActivityPhotoDO> dos = new ArrayList<>();
for (String url : clockPhtos) {
String[] uArr = url.split("/");
String uId = uArr[uArr.length - 1];
TemporaryActivityPhotoDO photoDo = new TemporaryActivityPhotoDO()
.setTemporaryId(dto.getTemporaryId())
.setReportedId(dto.getReportedId())
.setClockId(dto.getClockId())
.setType(dto.getType())
.setPhotoUrl(url)
.setPhotoFiledId(uId);
dos.add(photoDo);
}
temporaryActivityPhotoMapper.insertListByClockId(dos);
temporaryActivityPhotoMapper.updateListByClockId(dto.getClockId(),dto.getType(),dos);
}
@Override
......
......@@ -24,6 +24,10 @@ public interface TemporaryActivityPhotoMapper extends BaseMapper<TemporaryActivi
void updateListIsDelete(@Param("reportedId") Long reportedId,@Param("photoType") Integer photoType,@Param("dos") List<TemporaryActivityPhotoDO> dos);
void deletebyReportedId(@Param("reportedId") Long reportedId,@Param("photoType") int type);
void insertListByClockId(@Param("dos") List<TemporaryActivityPhotoDO> dos);
void updateListByClockId(@Param("clockId")Long clockId,@Param("photoType") Integer type,@Param("dos") List<TemporaryActivityPhotoDO> dos);
}
......
......@@ -41,6 +41,22 @@
</foreach>
</update>
<insert id="insertListByClockId">
insert into temporary_activity_photo (temporary_id, reported_id,clock_id, type, photo_url, photo_filed_id)
<foreach collection="dos" item="item" index="index" separator=" UNION ALL ">
SELECT #{item.temporaryId}, #{item.reportedId}, #{item.clockId}, #{item.type}, #{item.photoUrl}, #{item.photoFiledId} FROM dual
WHERE NOT EXISTS( SELECT 1 FROM temporary_activity_photo WHERE clock_id = #{item.clockId} AND type = #{item.type} AND photo_filed_id = #{item.photoFiledId} )
</foreach>
</insert>
<update id="updateListByClockId">
update temporary_activity_photo set is_delete = 0 where clock_id = #{clockId} and type = #{photoType} and photo_filed_id not in
<foreach collection="dos" item="item" index="index" open="(" separator="," close=")">
#{item.photoFiledId}
</foreach>
</update>
<update id="deletebyReportedId">
update temporary_activity_photo set is_delete = 0 where reported_id = #{reportedId} and type = #{photoType};
</update>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论