reghao 7 месяцев назад
Родитель
Сommit
64e0d62b1e

+ 3 - 0
content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/db/mapper/CameraPhotoMapper.java

@@ -16,6 +16,7 @@ import java.util.List;
 @Mapper
 public interface CameraPhotoMapper extends BaseMapper<CameraPhoto> {
     void updateSetAlbumId(@Param("objectId") String objectId, @Param("albumId") Long albumId);
+    void updateSetAlbumType(@Param("objectId") String objectId, @Param("albumType") String albumType);
 
     List<MapMarker> findByWestGeoGroup(@Param("pageSize") int pageSize, @Param("itemType") int itemType);
     List<MapMarker> findAllByReplyIdGroup(int pageSize);
@@ -23,4 +24,6 @@ public interface CameraPhotoMapper extends BaseMapper<CameraPhoto> {
     MarkerInfo findCommentMarkerInfo(int id);
     MarkerInfo findMarkerInfo(int id);
     MarkerInfo findAlbumMarkerInfo(int id);
+    List<CameraPhoto> findByAlbumId(String albumId);
+    List<CameraPhoto> findByAlbumType(String albumType);
 }

+ 2 - 2
content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/model/po/CameraPhoto.java

@@ -17,7 +17,7 @@ import java.time.LocalDateTime;
 @Setter
 @Getter
 public class CameraPhoto extends BaseObject<Integer> {
-    private Integer type;
+    private String albumType;
     private Long albumId;
     private String objectId;
     private Integer channelId;
@@ -30,7 +30,7 @@ public class CameraPhoto extends BaseObject<Integer> {
     private BigDecimal latitude;
 
     public CameraPhoto(MallReplyPhotoDto mallReplyPhotoDto) {
-        this.type = 2;
+        this.albumType = "MallReply";
         this.albumId = Long.parseLong(mallReplyPhotoDto.getReplyId());
         this.objectId = mallReplyPhotoDto.getUploadId();
         this.channelId = mallReplyPhotoDto.getChannelId();

+ 1 - 0
content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/model/vo/MarkerInfo.java

@@ -11,6 +11,7 @@ import lombok.Setter;
 @Getter
 public class MarkerInfo {
     private Integer type;
+    private String albumType;
     private String itemId;
     private String replyId;
     private String sku;

+ 4 - 6
content/content-service/src/main/java/cn/reghao/tnb/content/app/geo/service/PhotoMapService.java

@@ -129,18 +129,16 @@ public class PhotoMapService {
             return null;
         }
         
-        int type = cameraPhoto.getType();
+        String albumType = cameraPhoto.getAlbumType();
         MarkerInfo markerInfo;
-        if (type == 1) {
+        if (albumType.equals("ImagePost")) {
             markerInfo = cameraPhotoMapper.findMarkerInfo(id);
-        } else if (type == 2) {
+        } else if (albumType.equals("MallReply")) {
             markerInfo = cameraPhotoMapper.findCommentMarkerInfo(id);
-        } else if (type == 3) {
-            markerInfo = cameraPhotoMapper.findMarkerInfo(id);
         } else {
             markerInfo = cameraPhotoMapper.findAlbumMarkerInfo(id);
         }
-        markerInfo.setType(type);
+        markerInfo.setAlbumType(albumType);
 
         int channelId = markerInfo.getChannelId();
         if (channelId != 0) {

+ 22 - 7
content/content-service/src/main/resources/mapper/geo/CameraPhotoMapper.xml

@@ -4,16 +4,16 @@
 <mapper namespace="cn.reghao.tnb.content.app.geo.db.mapper.CameraPhotoMapper">
     <insert id="save" useGeneratedKeys="true" keyProperty="id">
         insert into geo_camera_photo
-        (`type`,`album_id`,`object_id`,`channel_id`,`photo_url`,`manufacturer`,`model`,`software`,`shot_at`,`geo`)
+        (`album_type`,`album_id`,`object_id`,`channel_code`,`photo_url`,`manufacturer`,`model`,`software`,`shot_at`,`geo`)
         values 
-        (#{type},#{albumId},#{objectId},#{channelId},#{photoUrl},#{manufacturer},#{model},#{software},#{shotAt},point(#{longitude},#{latitude}))
+        (#{albumType},#{albumId},#{objectId},#{channelCode},#{photoUrl},#{manufacturer},#{model},#{software},#{shotAt},point(#{longitude},#{latitude}))
     </insert>
     <insert id="saveAll" useGeneratedKeys="true" keyProperty="id">
         insert ignore into geo_camera_photo
-        (`type`,`album_id`,`object_id`,`channel_id`,`photo_url`,`manufacturer`,`model`,`software`,`shot_at`,`geo`)
+        (`album_type`,`album_id`,`object_id`,`channel_code`,`photo_url`,`manufacturer`,`model`,`software`,`shot_at`,`geo`)
         values
         <foreach collection="list" item="item" index="index" separator=",">
-            (#{item.type},#{item.albumId},#{item.objectId},#{item.channelId},#{item.photoUrl},#{item.manufacturer},#{item.model},#{item.software},#{item.shotAt},point(#{item.longitude},#{item.latitude}))
+            (#{item.albumType},#{item.albumId},#{item.objectId},#{item.channelCode},#{item.photoUrl},#{item.manufacturer},#{item.model},#{item.software},#{item.shotAt},point(#{item.longitude},#{item.latitude}))
         </foreach>
     </insert>
 
@@ -22,6 +22,11 @@
         set album_id=#{albumId}
         where object_id=#{objectId}
     </update>
+    <update id="updateSetAlbumType">
+        update geo_camera_photo
+        set album_type=#{albumType}
+        where object_id=#{objectId}
+    </update>
 
     <delete id="delete">
         delete from geo_camera_photo
@@ -76,19 +81,29 @@
     </select>
     <select id="findCommentMarkerInfo" resultType="cn.reghao.tnb.content.app.geo.model.vo.MarkerInfo">
         select reply.item_id,reply.reply_id,reply.extra as sku,reply.reply_content,reply.append_content,
-        photo.object_id as upload_id,photo.channel_id,photo.photo_url
+        photo.object_id as upload_id,photo.channel_code,photo.photo_url
         from geo_camera_photo photo
         inner join geo_mall_reply reply
         on photo.album_id=reply.reply_id and photo.id=#{id} and photo.geo is not null
     </select>
     <select id="findMarkerInfo" resultType="cn.reghao.tnb.content.app.geo.model.vo.MarkerInfo">
-        select object_id as upload_id,channel_id,photo_url
+        select object_id as upload_id,channel_code,photo_url
         from geo_camera_photo
         where id=#{id} and geo is not null
     </select>
     <select id="findAlbumMarkerInfo" resultType="cn.reghao.tnb.content.app.geo.model.vo.MarkerInfo">
-        select object_id as upload_id,album_id as item_id,channel_id,photo_url
+        select object_id as upload_id,album_id as item_id,channel_code,photo_url
         from geo_camera_photo
         where id=#{id} and geo is not null
     </select>
+    <select id="findByAlbumId" resultType="cn.reghao.tnb.content.app.geo.model.po.CameraPhoto">
+        select *
+        from geo_camera_photo
+        where album_id=#{albumId}
+    </select>
+    <select id="findByAlbumType" resultType="cn.reghao.tnb.content.app.geo.model.po.CameraPhoto">
+        select *
+        from geo_camera_photo
+        where album_type is null
+    </select>
 </mapper>