Просмотр исходного кода

意见类型表与语言表的连表,动态查询

Sakana 1 неделя назад
Родитель
Сommit
8d86e343f2
21 измененных файлов с 662 добавлено и 37 удалено
  1. 18 0
      edu-travel-adapter/edu-travel-adapter-country/src/main/java/edu/travel/adapter/service/country/LanguageAdapter.java
  2. 55 0
      edu-travel-remote/edu-travel-remote-commodity/src/main/java/edu/travel/remote/dto/ShopOpinionDto.java
  3. 57 0
      edu-travel-remote/edu-travel-remote-commodity/src/main/java/edu/travel/remote/dto/ShopOpinionTypeDto.java
  4. 8 0
      edu-travel-remote/edu-travel-remote-commodity/src/main/java/edu/travel/remote/opinion/ShopOpinionRemoteController.java
  5. 8 0
      edu-travel-remote/edu-travel-remote-commodity/src/main/java/edu/travel/remote/opinion/ShopOpinionTypeRemoteController.java
  6. 55 0
      edu-travel-remote/edu-travel-remote-commodity/src/main/java/edu/travel/remote/vo/ShopOpinionTypeVo.java
  7. 43 0
      edu-travel-remote/edu-travel-remote-commodity/src/main/java/edu/travel/remote/vo/ShopOpinionVo.java
  8. 5 0
      edu-travel-remote/edu-travel-remote-country/src/main/java/edu/travel/remote/ShopLanguageRemoteController.java
  9. 10 0
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/entity/ShopOpinion.java
  10. 15 0
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/mapper/ShopOpinionMapper.java
  11. 19 1
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/mapper/ShopOpinionTypeMapper.java
  12. 9 1
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/ShopOpinionService.java
  13. 8 1
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/ShopOpinionTypeService.java
  14. 27 2
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/impl/ShopOpinionServiceImpl.java
  15. 104 3
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/impl/ShopOpinionTypeServiceImpl.java
  16. 81 2
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/web/ShopOpinionController.java
  17. 91 3
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/web/ShopOpinionTypeController.java
  18. 36 5
      edu-travel-service/edu-travel-service-commodity/src/main/resources/mapper/ShopOpinionTypeMapper.xml
  19. 0 4
      edu-travel-service/edu-travel-service-country/src/main/java/edu/travel/country/service/impl/BaseCountryServeServiceImpl.java
  20. 6 8
      edu-travel-service/edu-travel-service-country/src/main/java/edu/travel/country/web/ShopCurrencyController.java
  21. 7 7
      edu-travel-service/edu-travel-service-country/src/main/java/edu/travel/country/web/ShopLanguageController.java

+ 18 - 0
edu-travel-adapter/edu-travel-adapter-country/src/main/java/edu/travel/adapter/service/country/LanguageAdapter.java

@@ -0,0 +1,18 @@
+package edu.travel.adapter.service.country;
+
+import edu.travel.adapter.annotation.AdapterAnnotation;
+import edu.travel.remote.ShopLanguageRemoteController;
+import edu.travel.rpc.RPCBaseResponse;
+import edu.travel.vo.ShopLanguageVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class LanguageAdapter {
+    @Autowired
+    private ShopLanguageRemoteController  shopLanguageRemoteController;
+    @AdapterAnnotation
+    public RPCBaseResponse<ShopLanguageVo> getFormId(String id) {
+        return shopLanguageRemoteController.getFormId(id);
+    }
+}

+ 55 - 0
edu-travel-remote/edu-travel-remote-commodity/src/main/java/edu/travel/remote/dto/ShopOpinionDto.java

@@ -0,0 +1,55 @@
+package edu.travel.remote.dto;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import edu.travel.entity.BaseEntity;
+import edu.travel.po.PagePO;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.Date;
+
+/**
+ * 意见表
+ */
+@Data
+public class ShopOpinionDto extends PagePO {
+    /**
+     * 意见类型ID
+     */
+    private Long id;
+
+    /**
+     * 国家id
+     */
+    private Long countryId;
+
+    /**
+     * 意见类型id
+     */
+    private Long typeId;
+
+    /**
+     * 描述
+     */
+    private String description;
+
+    /**
+     * 意见处理,默认0,0未处理,1已处理
+     */
+    private Integer state;
+    /**
+     * 创建时间
+     */
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+    /**
+     * 更新时间
+     */
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date updateTime;
+}

+ 57 - 0
edu-travel-remote/edu-travel-remote-commodity/src/main/java/edu/travel/remote/dto/ShopOpinionTypeDto.java

@@ -0,0 +1,57 @@
+package edu.travel.remote.dto;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import edu.travel.entity.BaseEntity;
+import edu.travel.po.PagePO;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 意见类型
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@TableName(value = "shop_opinion_type")
+public class ShopOpinionTypeDto extends PagePO {
+    /**
+     * 意见类型ID
+     */
+    @TableId(value = "id", type = IdType.ASSIGN_ID)
+    private Long id;
+
+    /**
+     * 类型名
+     */
+    @TableField(value = "type_name")
+    private String typeName;
+
+    /**
+     * 类型描述
+     */
+    @TableField(value = "type_description")
+    private String typeDescription;
+
+    /**
+     * 状态 0启用 1禁用
+     */
+    @TableField(value = "status")
+    private String status;
+
+    /**
+     * 其他类型(用户填写)
+     */
+    @TableField(value = "other_type")
+    private String otherType;
+
+    /**
+     * 语言id
+     */
+    @TableField(value = "language_id")
+    private String languageId;
+
+}

+ 8 - 0
edu-travel-remote/edu-travel-remote-commodity/src/main/java/edu/travel/remote/opinion/ShopOpinionRemoteController.java

@@ -0,0 +1,8 @@
+package edu.travel.remote.opinion;
+
+import edu.travel.remote.base.RemoteBaseController;
+import edu.travel.remote.dto.ShopOpinionDto;
+import edu.travel.remote.vo.ShopOpinionVo;
+
+public interface ShopOpinionRemoteController extends RemoteBaseController<ShopOpinionVo, ShopOpinionDto> {
+}

+ 8 - 0
edu-travel-remote/edu-travel-remote-commodity/src/main/java/edu/travel/remote/opinion/ShopOpinionTypeRemoteController.java

@@ -0,0 +1,8 @@
+package edu.travel.remote.opinion;
+
+import edu.travel.remote.base.RemoteBaseController;
+import edu.travel.remote.dto.ShopOpinionTypeDto;
+import edu.travel.remote.vo.ShopOpinionTypeVo;
+
+public interface ShopOpinionTypeRemoteController extends RemoteBaseController<ShopOpinionTypeVo, ShopOpinionTypeDto> {
+}

+ 55 - 0
edu-travel-remote/edu-travel-remote-commodity/src/main/java/edu/travel/remote/vo/ShopOpinionTypeVo.java

@@ -0,0 +1,55 @@
+package edu.travel.remote.vo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import edu.travel.entity.BaseEntity;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.Map;
+
+/**
+ * 意见类型
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@TableName(value = "shop_opinion_type")
+public class ShopOpinionTypeVo extends BaseEntity {
+    /**
+     * 意见类型ID
+     */
+    private Long id;
+
+    /**
+     * 类型名
+     */
+    private String typeName;
+
+    /**
+     * 类型描述
+     */
+    private String typeDescription;
+
+    /**
+     * 状态 0启用 1禁用
+     */
+    private String status;
+
+    /**
+     * 其他类型(用户填写)
+     */
+    private String otherType;
+
+    /**
+     * 语言id
+     */
+    private String languageId;
+    /**
+     * map
+     */
+    private Map<String, Object> map;
+}

+ 43 - 0
edu-travel-remote/edu-travel-remote-commodity/src/main/java/edu/travel/remote/vo/ShopOpinionVo.java

@@ -0,0 +1,43 @@
+package edu.travel.remote.vo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import edu.travel.entity.BaseEntity;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 意见表
+ */
+@Data
+public class ShopOpinionVo extends BaseEntity {
+    /**
+     * 意见类型ID
+     */
+    private Long id;
+
+    /**
+     * 国家id
+     */
+    private Long countryId;
+
+    /**
+     * 意见类型id
+     */
+    private Long typeId;
+
+    /**
+     * 描述
+     */
+    private String description;
+
+    /**
+     * 意见处理,默认0,0未处理,1已处理
+     */
+    private Integer state;
+
+
+}

+ 5 - 0
edu-travel-remote/edu-travel-remote-country/src/main/java/edu/travel/remote/ShopLanguageRemoteController.java

@@ -9,6 +9,7 @@ import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
 
 import java.util.List;
 
@@ -18,5 +19,9 @@ public interface ShopLanguageRemoteController extends RemoteBaseController<ShopL
     //语言分页
     @GetMapping("/getLanguagePage")
     public RPCBaseResponse<IPage<ShopLanguageVo>> getLanguagePage(ShopLanguageDto shopLanguageDto);
+    @GetMapping("/getFormId")
+    public RPCBaseResponse<ShopLanguageVo> getFormId(@RequestParam(
+            "id"
+    ) String id);
 
 }

+ 10 - 0
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/entity/ShopOpinion.java

@@ -5,7 +5,11 @@ import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import java.util.Date;
+import java.util.Map;
 
+import edu.travel.annotation.LinkOne;
+import edu.travel.commodity.mapper.ShopOpinionTypeMapper;
+import edu.travel.commodity.service.ShopOpinionTypeService;
 import edu.travel.entity.BaseEntity;
 import lombok.AllArgsConstructor;
 import lombok.Data;
@@ -48,6 +52,12 @@ public class ShopOpinion extends BaseEntity {
      */
     @TableField(value = "`state`")
     private Integer state;
+    /**
+     * map
+     */
+    @TableField(exist = false)
+    @LinkOne(linkField = "typeId", linkMapper = ShopOpinionTypeMapper.class, linkPrimaryField = "id")
+    private Map<String, Object> map;
 
 
 }

+ 15 - 0
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/mapper/ShopOpinionMapper.java

@@ -1,7 +1,22 @@
 package edu.travel.commodity.mapper;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import edu.travel.commodity.entity.ShopOpinion;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
 
 public interface ShopOpinionMapper extends BaseMapper<ShopOpinion> {
+    @Select({
+            "<script>",
+            "SELECT so.*, sot.type_name, sot.type_description ",
+            "FROM shop_opinion so ",
+            "LEFT JOIN shop_opinion_type sot ON so.type_id = sot.id ",
+            "<where>",
+            "${ew.sqlSegment}",
+            "</where>",
+            "</script>"
+    })
+    IPage<ShopOpinion> selectOpinionsWithType(IPage<ShopOpinion> page, @Param("ew") LambdaQueryWrapper<ShopOpinion> queryWrapper);
 }

+ 19 - 1
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/mapper/ShopOpinionTypeMapper.java

@@ -2,6 +2,24 @@ package edu.travel.commodity.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import edu.travel.commodity.entity.ShopOpinionType;
+import edu.travel.remote.vo.ShopOpinionTypeVo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 public interface ShopOpinionTypeMapper extends BaseMapper<ShopOpinionType> {
-}
+
+    // 查询带有语言信息的意见类型
+    List<ShopOpinionType> selectOpinionTypeWithLanguage(
+            @Param("typeName") String typeName,
+            @Param("status") String status,
+            @Param("pageSize") int pageSize,
+            @Param("offset") int offset
+    );
+
+    // 统计符合条件的意见类型数量
+    int countAll(
+            @Param("typeName") String typeName,
+            @Param("status") String status
+    );
+}

+ 9 - 1
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/ShopOpinionService.java

@@ -1,8 +1,16 @@
 package edu.travel.commodity.service;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import edu.travel.commodity.entity.ShopOpinion;
 import com.baomidou.mybatisplus.extension.service.IService;
-public interface ShopOpinionService extends IService<ShopOpinion>{
+import edu.travel.remote.dto.ShopOpinionDto;
+import edu.travel.remote.vo.ShopOpinionVo;
+import edu.travel.rpc.RPCBaseResponse;
+
+import java.util.List;
 
+public interface ShopOpinionService extends IService<ShopOpinion>{
 
+//分页连表
+    RPCBaseResponse<List<ShopOpinion>> getAllFormPage(ShopOpinionDto dto);
 }

+ 8 - 1
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/ShopOpinionTypeService.java

@@ -1,8 +1,15 @@
 package edu.travel.commodity.service;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import edu.travel.commodity.entity.ShopOpinionType;
 import com.baomidou.mybatisplus.extension.service.IService;
-public interface ShopOpinionTypeService extends IService<ShopOpinionType>{
+import edu.travel.remote.dto.ShopOpinionTypeDto;
+import edu.travel.remote.vo.ShopOpinionTypeVo;
+import edu.travel.rpc.RPCBaseResponse;
+
+import java.util.List;
 
+public interface ShopOpinionTypeService extends IService<ShopOpinionType>{
 
+    RPCBaseResponse<IPage<ShopOpinionTypeVo>> getAllOpinionTypeLanguage(ShopOpinionTypeDto dto);
 }

+ 27 - 2
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/impl/ShopOpinionServiceImpl.java

@@ -1,12 +1,37 @@
 package edu.travel.commodity.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import edu.travel.commodity.entity.ShopOpinion;
 import edu.travel.commodity.mapper.ShopOpinionMapper;
 import edu.travel.commodity.service.ShopOpinionService;
+import edu.travel.remote.dto.ShopOpinionDto;
+import edu.travel.remote.vo.ShopOpinionVo;
+import edu.travel.rpc.RPCBaseResponse;
+import edu.travel.service.SysServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
 @Service
-public class ShopOpinionServiceImpl extends ServiceImpl<ShopOpinionMapper, ShopOpinion> implements ShopOpinionService {
-
+public class ShopOpinionServiceImpl extends SysServiceImpl<ShopOpinionMapper, ShopOpinion> implements ShopOpinionService {
+    @Override
+    public RPCBaseResponse<List<ShopOpinion>> getAllFormPage(ShopOpinionDto dto) {
+        // 创建 LambdaQueryWrapper 对象
+        LambdaQueryWrapper<ShopOpinion> queryWrapper = new LambdaQueryWrapper<>();
+        // 动态添加查询条件
+        queryWrapper.eq(dto.getCountryId() != null,ShopOpinion::getCountryId, dto.getCountryId());
+        queryWrapper.eq(dto.getTypeId() != null,ShopOpinion::getTypeId, dto.getTypeId());
+        queryWrapper.eq(dto.getState() != null,ShopOpinion::getState, dto.getState());
+        // 使用模糊查询
+        queryWrapper.like(dto.getDescription() != null && !dto.getDescription().isEmpty(),ShopOpinion::getDescription, dto.getDescription());
+        // 分页查询
+        IPage<ShopOpinion> page = new Page<>(dto.getCurrentPage(), dto.getPageSize());
+        // 使用自定义方法查询带联表的结果
+        IPage<ShopOpinion> resultPage = super.getPageLink(queryWrapper,page);
+        // 返回结果
+        return new RPCBaseResponse<>(200, "SUCCESS", resultPage.getRecords());
+    }
 }

+ 104 - 3
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/impl/ShopOpinionTypeServiceImpl.java

@@ -1,12 +1,113 @@
 package edu.travel.commodity.service.impl;
 
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import edu.travel.adapter.service.country.LanguageAdapter;
 import edu.travel.commodity.entity.ShopOpinionType;
 import edu.travel.commodity.mapper.ShopOpinionTypeMapper;
 import edu.travel.commodity.service.ShopOpinionTypeService;
+import edu.travel.remote.dto.ShopOpinionTypeDto;
+import edu.travel.remote.vo.ShopOpinionTypeVo;
+import edu.travel.rpc.RPCBaseResponse;
+import edu.travel.service.SysServiceImpl;
+import edu.travel.vo.ShopLanguageVo;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+
 @Service
-public class ShopOpinionTypeServiceImpl extends ServiceImpl<ShopOpinionTypeMapper, ShopOpinionType> implements ShopOpinionTypeService {
+public class ShopOpinionTypeServiceImpl extends SysServiceImpl<ShopOpinionTypeMapper, ShopOpinionType> implements ShopOpinionTypeService {
+
+    @Autowired
+    private ShopOpinionTypeMapper shopOpinionTypeMapper;
+    @Autowired
+    private LanguageAdapter languageAdapter;
+
+    /**
+     * 分页动态查询(联表)
+     * @param dto
+     * @return
+     */
+    public RPCBaseResponse<IPage<ShopOpinionTypeVo>> getAllOpinionTypeLanguage(ShopOpinionTypeDto dto) {
+        // 创建分页对象
+        Page<ShopOpinionTypeVo> shopOpinionTypeVoPage = new Page<>(dto.getCurrentPage(), dto.getPageSize());
+
+        // 查询意见类型数据
+        List<ShopOpinionType> opinionTypes = shopOpinionTypeMapper.selectOpinionTypeWithLanguage(
+                dto.getTypeName(),
+                dto.getStatus(),
+                dto.getPageSize(),
+                (dto.getCurrentPage() - 1) * dto.getPageSize()
+        );
+
+        // 转换为 ShopOpinionTypeVo 列表
+        List<ShopOpinionTypeVo> opinionTypeList = opinionTypes.stream()
+                .map(this::convertToVo) // 确保这里的 convertToVo 方法返回 `ShopOpinionTypeVo`
+                .collect(Collectors.toList());
+
+        int total = shopOpinionTypeMapper.countAll(dto.getTypeName(), dto.getStatus());
+
+        // 提取语言id
+        Set<String> languageIds = opinionTypeList.stream()
+                .map(ShopOpinionTypeVo::getLanguageId)
+                .collect(Collectors.toSet());
+
+        // 查询语言信息
+        Map<String, ShopOpinionTypeVo> shopOpinionTypeVoMap = fetchLanguageData(languageIds);
+
+        // 将语言信息放入对应的仓库列表中
+        for (ShopOpinionTypeVo opinionTypeVo : opinionTypeList) {
+            if (opinionTypeVo.getMap() == null) {
+                opinionTypeVo.setMap(new HashMap<>()); // 确保 map 被初始化
+            }
+            if (shopOpinionTypeVoMap.containsKey(opinionTypeVo.getLanguageId())) {
+                opinionTypeVo.getMap().put("language", shopOpinionTypeVoMap.get(opinionTypeVo.getLanguageId()));
+            }
+        }
+
+        // 封装返回
+        IPage<ShopOpinionTypeVo> pageVoLink = new Page<>();
+        pageVoLink.setRecords(opinionTypeList);
+        pageVoLink.setTotal(total);
+        pageVoLink.setCurrent(dto.getCurrentPage());
+        pageVoLink.setSize(dto.getPageSize());
+
+        return new RPCBaseResponse<>(200, "SUCCESS", pageVoLink);
+    }
+
+    // 将 ShopOpinionType 转换为 ShopOpinionTypeVo 的方法
+    private ShopOpinionTypeVo convertToVo(ShopOpinionType opinionType) {
+        ShopOpinionTypeVo vo = new ShopOpinionTypeVo();
+        vo.setId(opinionType.getId());
+        vo.setTypeName(opinionType.getTypeName());
+        vo.setLanguageId(opinionType.getLanguageId());
+        // 设置其他字段,如果有的话
+        return vo;
+    }
 
-}
+    // 查询语言数据的方法
+    private Map<String, ShopOpinionTypeVo> fetchLanguageData(Set<String> languageIds) {
+        // 这里是伪代码,您需要实现实际的语言数据查询逻辑
+        Map<String, ShopOpinionTypeVo> languageMap = new HashMap<>();
+        // 假设有一个适配器可以获取语言信息
+        for (String languageId : languageIds) {
+            ShopLanguageVo languageVo = languageAdapter.getFormId(languageId).getData();
+            if (languageVo != null) {
+                ShopOpinionTypeVo opinionTypeVo = new ShopOpinionTypeVo();
+                opinionTypeVo.setLanguageId(languageId);
+                opinionTypeVo.setMap(new HashMap<>()); // 初始化 map
+                opinionTypeVo.getMap().put("languageNameZh", languageVo.getLanguageNameZh());
+                opinionTypeVo.getMap().put("languageNameEn", languageVo.getLanguageNameEn());
+                opinionTypeVo.getMap().put("languageNameLocal", languageVo.getLanguageNameLocal());
+                languageMap.put(languageId, opinionTypeVo);
+            }
+        }
+        return languageMap;
+    }
+}

+ 81 - 2
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/web/ShopOpinionController.java

@@ -1,23 +1,102 @@
 package edu.travel.commodity.web;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import edu.travel.commodity.entity.ShopOpinion;
 import edu.travel.commodity.service.ShopOpinionService;
+import edu.travel.remote.dto.ShopOpinionDto;
+import edu.travel.remote.opinion.ShopOpinionRemoteController;
+import edu.travel.remote.vo.ShopOpinionVo;
+import edu.travel.rpc.RPCBaseResponse;
+import edu.travel.web.BaseController;
+import org.springframework.beans.BeanUtils;
 import org.springframework.web.bind.annotation.*;
 
 import org.springframework.beans.factory.annotation.Autowired;
 
+import java.util.List;
+
 /**
 * 意见表(shop_opinion)表控制层
 *
 * @author xxxxx
 */
 @RestController
-@RequestMapping("/shop_opinion")
-public class ShopOpinionController {
+@RequestMapping("/shopOpinion")
+public class ShopOpinionController extends BaseController<ShopOpinion> implements ShopOpinionRemoteController {
 /**
 * 服务对象
 */
     @Autowired
     private ShopOpinionService shopOpinionService;
+    /**
+     * 分页查询(连表)
+     */
+    @GetMapping("/getAllFormPage")
+    public RPCBaseResponse<List<ShopOpinion>> getAllFormPage(ShopOpinionDto dto) {
+        return shopOpinionService.getAllFormPage(dto);
+     }
+    /**
+     *获取意见
+     */
+    @Override
+    @GetMapping("/getFormId")
+    public RPCBaseResponse<ShopOpinionVo> getFormId(String id) {
+        RPCBaseResponse<ShopOpinion> shopOpinionRPCBaseResponse = super.getId(id);
+        RPCBaseResponse<ShopOpinionVo> shopOpinionVoRPCBaseResponse = new RPCBaseResponse<>();
+        BeanUtils.copyProperties(shopOpinionRPCBaseResponse, shopOpinionVoRPCBaseResponse);
+        return shopOpinionVoRPCBaseResponse;
+    }
+
+    /**
+     * 更新意见
+     */
+    @Override
+    @PostMapping("/updateTargetFormId")
+    public RPCBaseResponse<ShopOpinionVo> updateTargetFormId(ShopOpinionDto entity) {
+        ShopOpinion shopOpinion = new ShopOpinion();
+        BeanUtils.copyProperties(entity, shopOpinion);
+        RPCBaseResponse<ShopOpinion> shopOpinionRPCBaseResponse = super.updateTargetById(shopOpinion);
+        RPCBaseResponse<ShopOpinionVo> shopOpinionVoRPCBaseResponse = new RPCBaseResponse<>();
+        BeanUtils.copyProperties(shopOpinionRPCBaseResponse, shopOpinionVoRPCBaseResponse);
+        return shopOpinionVoRPCBaseResponse;
+    }
+
+    /**
+     * 新增意见
+     */
+    @Override
+    @PostMapping("/saveFormTarget")
+    public RPCBaseResponse<ShopOpinionVo> saveFormTarget(ShopOpinionDto entity) {
+        ShopOpinion shopOpinion = new ShopOpinion();
+        BeanUtils.copyProperties(entity, shopOpinion);
+        RPCBaseResponse<ShopOpinion> shopOpinionRPCBaseResponse = super.saveTarget(shopOpinion);
+        RPCBaseResponse<ShopOpinionVo> shopOpinionVoRPCBaseResponse = new RPCBaseResponse<>();
+        BeanUtils.copyProperties(shopOpinionRPCBaseResponse, shopOpinionVoRPCBaseResponse);
+        return shopOpinionVoRPCBaseResponse;
+    }
+
+    /**
+     * 删除意见
+     */
+    @Override
+    @PostMapping("/deleteTargetFormId")
+    public RPCBaseResponse<ShopOpinionVo> deleteTargetFormId(List<String> ids) {
+        RPCBaseResponse<ShopOpinion> shopOpinionRPCBaseResponse = super.deleteTargetById(ids);
+        RPCBaseResponse<ShopOpinionVo> shopOpinionVoRPCBaseResponse = new RPCBaseResponse<>();
+        BeanUtils.copyProperties(shopOpinionRPCBaseResponse, shopOpinionVoRPCBaseResponse);
+        return shopOpinionVoRPCBaseResponse;
+    }
 
+    /**
+     * 获取所有意见
+     */
+    @Override
+    @GetMapping("/getAllForm")
+    public RPCBaseResponse<List<ShopOpinionVo>> getAllForm() {
+        RPCBaseResponse<List<ShopOpinion>> countryRPCBaseResponse = super.listAll();
+        RPCBaseResponse<List<ShopOpinionVo>> baseCountryVoRPCBaseResponse = new RPCBaseResponse<>();
+        BeanUtils.copyProperties(countryRPCBaseResponse, baseCountryVoRPCBaseResponse);
+        return baseCountryVoRPCBaseResponse;
+    }
 
 }

+ 91 - 3
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/web/ShopOpinionTypeController.java

@@ -1,10 +1,20 @@
 package edu.travel.commodity.web;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import edu.travel.commodity.entity.ShopOpinionType;
 import edu.travel.commodity.service.ShopOpinionTypeService;
+import edu.travel.remote.dto.ShopOpinionTypeDto;
+import edu.travel.remote.opinion.ShopOpinionTypeRemoteController;
+import edu.travel.remote.vo.ShopOpinionTypeVo;
+import edu.travel.rpc.RPCBaseResponse;
+import edu.travel.web.BaseController;
+import org.springframework.beans.BeanUtils;
 import org.springframework.web.bind.annotation.*;
 
 import org.springframework.beans.factory.annotation.Autowired;
 
+import java.util.List;
+
 /**
 * 意见类型(shop_opinion_type)表控制层
 *
@@ -12,12 +22,90 @@ import org.springframework.beans.factory.annotation.Autowired;
 */
 @RestController
 @RequestMapping("/shop_opinion_type")
-public class ShopOpinionTypeController {
+public class ShopOpinionTypeController extends BaseController<ShopOpinionType> implements ShopOpinionTypeRemoteController {
 /**
 * 服务对象
 */
-    @Autowired
-    private ShopOpinionTypeService shopOpinionTypeService;
+@Autowired
+private ShopOpinionTypeService shopOpinionTypeService;
+    /**
+     * 连表查询意见类型
+     */
+    @GetMapping("/getAllOpinionTypeLanguage")
+    public RPCBaseResponse<IPage<ShopOpinionTypeVo>> getAllOpinionTypeLanguage(ShopOpinionTypeDto dto) {
+        return shopOpinionTypeService.getAllOpinionTypeLanguage(dto);
+    }
+
+    /**
+     * 通过id查询意见类型
+     * @param id
+     * @return
+     */
+    @Override
+    @GetMapping("/getFormId")
+    public RPCBaseResponse<ShopOpinionTypeVo> getFormId(String id) {
+        RPCBaseResponse<ShopOpinionType> shopOpinionTypeRPCBaseResponse = super.getId(id);
+        RPCBaseResponse<ShopOpinionTypeVo> shopOpinionTypeVoRPCBaseResponse = new RPCBaseResponse<>();
+        BeanUtils.copyProperties(shopOpinionTypeRPCBaseResponse, shopOpinionTypeVoRPCBaseResponse);
+        return shopOpinionTypeVoRPCBaseResponse;
+    }
+
+    /**
+     * 更新意见类型
+     * @param entity
+     * @return
+     */
+    @Override
+    @PostMapping("/updateFormTarget")
+    public RPCBaseResponse<ShopOpinionTypeVo> updateTargetFormId(ShopOpinionTypeDto entity) {
+        ShopOpinionType shopOpinionType = new ShopOpinionType();
+        BeanUtils.copyProperties(entity, shopOpinionType);
+        RPCBaseResponse<ShopOpinionType> shopOpinionTypeRPCBaseResponse = super.updateTargetById(shopOpinionType);
+        RPCBaseResponse<ShopOpinionTypeVo> shopOpinionTypeVoRPCBaseResponse = new RPCBaseResponse<>();
+        BeanUtils.copyProperties(shopOpinionTypeRPCBaseResponse, shopOpinionTypeVoRPCBaseResponse);
+        return shopOpinionTypeVoRPCBaseResponse;
+    }
+
+    /**
+     * 新增意见类型
+     * @param entity
+     * @return
+     */
+    @Override
+    @PostMapping("/saveFormTarget")
+    public RPCBaseResponse<ShopOpinionTypeVo> saveFormTarget(ShopOpinionTypeDto entity) {
+        ShopOpinionType shopOpinionType = new ShopOpinionType();
+        BeanUtils.copyProperties(entity, shopOpinionType);
+        RPCBaseResponse<ShopOpinionType> shopOpinionTypeRPCBaseResponse = super.saveTarget(shopOpinionType);
+        RPCBaseResponse<ShopOpinionTypeVo> shopOpinionTypeVoRPCBaseResponse = new RPCBaseResponse<>();
+        BeanUtils.copyProperties(shopOpinionTypeRPCBaseResponse, shopOpinionTypeVoRPCBaseResponse);
+        return shopOpinionTypeVoRPCBaseResponse;
+    }
 
+    /**
+     * 删除意见类型
+     * @param ids
+     * @return
+     */
+    @Override
+    @DeleteMapping("/deleteFormId")
+    public RPCBaseResponse<ShopOpinionTypeVo> deleteTargetFormId(List<String> ids) {
+        RPCBaseResponse<ShopOpinionType> shopOpinionTypeRPCBaseResponse = super.deleteTargetById(ids);
+        RPCBaseResponse<ShopOpinionTypeVo> shopOpinionTypeVoRPCBaseResponse = new RPCBaseResponse<>();
+        BeanUtils.copyProperties(shopOpinionTypeRPCBaseResponse, shopOpinionTypeVoRPCBaseResponse);
+        return shopOpinionTypeVoRPCBaseResponse;
+    }
 
+    /**
+     * 获取所有意见类型信息
+     * @return
+     */
+    @Override
+    @GetMapping("/getAllForm")
+    public RPCBaseResponse<List<ShopOpinionTypeVo>> getAllForm() {
+        RPCBaseResponse<List<ShopOpinionType>> countryRPCBaseResponse = super.listAll();
+        RPCBaseResponse<List<ShopOpinionTypeVo>> baseCountryVoRPCBaseResponse = new RPCBaseResponse<>();
+        BeanUtils.copyProperties(countryRPCBaseResponse, baseCountryVoRPCBaseResponse);
+        return baseCountryVoRPCBaseResponse;
+    }
 }

+ 36 - 5
edu-travel-service/edu-travel-service-commodity/src/main/resources/mapper/ShopOpinionTypeMapper.xml

@@ -1,9 +1,10 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
 <mapper namespace="edu.travel.commodity.mapper.ShopOpinionTypeMapper">
+
   <resultMap id="BaseResultMap" type="edu.travel.commodity.entity.ShopOpinionType">
     <!--@mbg.generated-->
-    <!--@Table shop_opinion_type-->
     <id column="id" jdbcType="BIGINT" property="id" />
     <result column="type_name" jdbcType="VARCHAR" property="typeName" />
     <result column="type_description" jdbcType="VARCHAR" property="typeDescription" />
@@ -17,9 +18,39 @@
     <result column="project" jdbcType="VARCHAR" property="project" />
     <result column="language_id" jdbcType="BIGINT" property="languageId" />
   </resultMap>
+
   <sql id="Base_Column_List">
-    <!--@mbg.generated-->
-    id, type_name, create_time, update_time, other_type, create_user_id, update_user_id, language_id,type_description,status,
-    delete_flag, project
+    id, type_name, create_time, update_time, other_type, create_user_id, update_user_id, language_id, type_description, status,
+        delete_flag, project
   </sql>
-</mapper>
+
+  <select id="selectOpinionTypeWithLanguage" resultMap="BaseResultMap">
+    SELECT sot.*
+    FROM shop_opinion_type sot
+    LEFT JOIN shop_language sl ON sot.language_id = sl.id
+    <where>
+      <if test="typeName != null and typeName != ''">
+        AND sot.type_name LIKE CONCAT('%', #{typeName}, '%')
+      </if>
+      <if test="status != null">
+        AND sot.status = #{status}
+      </if>
+    </where>
+    LIMIT #{pageSize} OFFSET #{offset}
+  </select>
+
+  <select id="countAll" resultType="int">
+    SELECT COUNT(*)
+    FROM shop_opinion_type sot
+    <where>
+      <if test="typeName != null and typeName != ''">
+        AND sot.type_name LIKE CONCAT('%', #{typeName}, '%')
+      </if>
+      <if test="status != null">
+        AND sot.status = #{status}
+      </if>
+    </where>
+  </select>
+
+
+</mapper>

+ 0 - 4
edu-travel-service/edu-travel-service-country/src/main/java/edu/travel/country/service/impl/BaseCountryServeServiceImpl.java

@@ -1,8 +1,6 @@
 package edu.travel.country.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 
 import edu.travel.country.entity.BaseCountry;
 import edu.travel.country.entity.BaseCountryServe;
@@ -25,8 +23,6 @@ import java.util.*;
 public class BaseCountryServeServiceImpl extends SysServiceImpl<BaseCountryServeMapper, BaseCountryServe> implements BaseCountryServeService {
     @Autowired
     private BaseCountryMapper baseCountryMapper;
-    @Autowired
-    private ShopCurrencyMapper shopCurrencyMapper;
 
 //分页连表
 @Override

+ 6 - 8
edu-travel-service/edu-travel-service-country/src/main/java/edu/travel/country/web/ShopCurrencyController.java

@@ -1,6 +1,5 @@
 package edu.travel.country.web;
 
-
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import edu.travel.country.entity.ShopCurrency;
 import edu.travel.country.service.ShopCurrencyService;
@@ -22,7 +21,7 @@ import java.util.List;
 * @author xxxxx
 */
 @RestController
-@RequestMapping("/shop_currency")
+@RequestMapping("/shopCurrency")
 public class ShopCurrencyController extends BaseController<ShopCurrency> implements ShopCurrencyRemoteController {
 /**
 * 服务对象
@@ -32,7 +31,6 @@ public class ShopCurrencyController extends BaseController<ShopCurrency> impleme
     /**
      * 分页
      */
-
     @GetMapping("/getCurrencyPage")
     public RPCBaseResponse<IPage<ShopCurrencyVo>> getCurrencyPage(ShopCurrencyDto dto) {
         return shopCurrencyService.getCurrencyPage(dto);
@@ -44,7 +42,7 @@ public class ShopCurrencyController extends BaseController<ShopCurrency> impleme
      */
 
     @Override
-    @GetMapping("/getCurrencyFormId")
+    @GetMapping("/getFormId")
     public RPCBaseResponse<ShopCurrencyVo> getFormId(String id) {
         RPCBaseResponse<ShopCurrency> shopCurrencyRPCBaseResponse = super.getId(id);
         RPCBaseResponse<ShopCurrencyVo> shopCurrencyVoRPCBaseResponse = new RPCBaseResponse<>();
@@ -58,7 +56,7 @@ public class ShopCurrencyController extends BaseController<ShopCurrency> impleme
      * @return
      */
     @Override
-    @PostMapping("/updateCurrencyFormId")
+    @PostMapping("/updateTargetFormId")
     public RPCBaseResponse<ShopCurrencyVo> updateTargetFormId(@RequestBody ShopCurrencyDto entity) {
         ShopCurrency shopCurrency = new ShopCurrency();
         BeanUtils.copyProperties(entity, shopCurrency);
@@ -74,7 +72,7 @@ public class ShopCurrencyController extends BaseController<ShopCurrency> impleme
      * @return
      */
     @Override
-    @PostMapping("/saveCurrencyForm")
+    @PostMapping("/saveFormTarget")
     public RPCBaseResponse<ShopCurrencyVo> saveFormTarget(@RequestBody ShopCurrencyDto entity) {
         ShopCurrency shopCurrency = new ShopCurrency();
         BeanUtils.copyProperties(entity, shopCurrency);
@@ -90,7 +88,7 @@ public class ShopCurrencyController extends BaseController<ShopCurrency> impleme
      * @return
      */
     @Override
-    @PostMapping("/deleteCurrencyFormId")
+    @PostMapping("/deleteTargetFormId")
     public RPCBaseResponse<ShopCurrencyVo> deleteTargetFormId(@RequestBody List<String> ids) {
         RPCBaseResponse<ShopCurrency> shopCurrencyRPCBaseResponse = super.deleteTargetById(ids);
         RPCBaseResponse<ShopCurrencyVo> shopCurrencyVoRPCBaseResponse = new RPCBaseResponse<>();
@@ -103,7 +101,7 @@ public class ShopCurrencyController extends BaseController<ShopCurrency> impleme
      * @return
      */
     @Override
-    @GetMapping("/listCurrencyForm")
+    @GetMapping("/getAllForm")
     public RPCBaseResponse<List<ShopCurrencyVo>> getAllForm() {
         RPCBaseResponse<List<ShopCurrency>> listRPCBaseResponse = super.listAll();
         RPCBaseResponse<List<ShopCurrencyVo>> shopCurrencyVoRPCBaseResponse = new RPCBaseResponse<>();

+ 7 - 7
edu-travel-service/edu-travel-service-country/src/main/java/edu/travel/country/web/ShopLanguageController.java

@@ -20,7 +20,7 @@ import java.util.List;
 * @author xxxxx
 */
 @RestController
-@RequestMapping("/shop_language")
+@RequestMapping("/shopLanguage")
 public class ShopLanguageController extends BaseController<ShopLanguage> implements ShopLanguageRemoteController {
     /**
      * 服务对象
@@ -42,8 +42,8 @@ public class ShopLanguageController extends BaseController<ShopLanguage> impleme
      * @return
      */
     @Override
-    @GetMapping("/getLanguageFormId")
-    public RPCBaseResponse<ShopLanguageVo> getFormId(String id) {
+    @GetMapping("/getFormId")
+    public RPCBaseResponse<ShopLanguageVo> getFormId(@RequestParam("id") String id) {
         RPCBaseResponse<ShopLanguage> languageRPCBaseResponse = super.getId(id);
         RPCBaseResponse<ShopLanguageVo> shopLanguageVoRPCBaseResponse = new RPCBaseResponse<>();
         BeanUtils.copyProperties(languageRPCBaseResponse, shopLanguageVoRPCBaseResponse);
@@ -56,7 +56,7 @@ public class ShopLanguageController extends BaseController<ShopLanguage> impleme
      * @return
      */
     @Override
-    @PostMapping("/updateLanguageFormId")
+    @PostMapping("/updateTargetFormId")
     public RPCBaseResponse<ShopLanguageVo> updateTargetFormId(@RequestBody ShopLanguageDto entity) {
         ShopLanguage shopLanguage = new ShopLanguage();
         BeanUtils.copyProperties(entity, shopLanguage);
@@ -72,7 +72,7 @@ public class ShopLanguageController extends BaseController<ShopLanguage> impleme
      * @return
      */
     @Override
-    @PostMapping("/saveLanguageForm")
+    @PostMapping("/saveFormTarget")
     public RPCBaseResponse<ShopLanguageVo> saveFormTarget(@RequestBody ShopLanguageDto entity) {
         ShopLanguage shopLanguage = new ShopLanguage();
         BeanUtils.copyProperties(entity, shopLanguage);
@@ -88,7 +88,7 @@ public class ShopLanguageController extends BaseController<ShopLanguage> impleme
      * @return
      */
     @Override
-    @PostMapping("/deleteLanguageFormId")
+    @PostMapping("/deleteTargetFormId")
     public RPCBaseResponse<ShopLanguageVo> deleteTargetFormId(@RequestBody List<String> ids) {
         RPCBaseResponse<ShopLanguage> languageRPCBaseResponse = super.deleteTargetById(ids);
         RPCBaseResponse<ShopLanguageVo> shopLanguageVoRPCBaseResponse = new RPCBaseResponse<>();
@@ -101,7 +101,7 @@ public class ShopLanguageController extends BaseController<ShopLanguage> impleme
      * @return
      */
     @Override
-    @GetMapping("/LanguagelistForm")
+    @GetMapping("/getAllForm")
     public RPCBaseResponse<List<ShopLanguageVo>> getAllForm() {
         RPCBaseResponse<List<ShopLanguage>> listRPCBaseResponse = super.listAll();
         RPCBaseResponse<List<ShopLanguageVo>> shopLanguageVoRPCBaseResponse = new RPCBaseResponse<>();