Commit fdaafc37 authored by chenyan's avatar chenyan

2024/05/10_模型接口修改

parent eb546eac
...@@ -12,6 +12,7 @@ import com.upyuns.platform.rs.website.mapper.TModelMapper; ...@@ -12,6 +12,7 @@ import com.upyuns.platform.rs.website.mapper.TModelMapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.github.wxiaoqi.security.common.util.Query; import com.github.wxiaoqi.security.common.util.Query;
import java.util.List;
import java.util.Objects; import java.util.Objects;
/** /**
...@@ -44,6 +45,10 @@ public class TModelBiz extends BaseBiz<TModelMapper, TModel>{ ...@@ -44,6 +45,10 @@ public class TModelBiz extends BaseBiz<TModelMapper, TModel>{
public ObjectRestResponse getList(TModelDTO tModelDTO) { public ObjectRestResponse getList(TModelDTO tModelDTO) {
Query query = new Query(tModelDTO); Query query = new Query(tModelDTO);
PageDataVO<TModel> pageDataVO = PageDataVO.pageInfo(query, () -> mapper.selectList(query.getSuper())); PageDataVO<TModel> pageDataVO = PageDataVO.pageInfo(query, () -> mapper.selectList(query.getSuper()));
pageDataVO.getData().forEach(tModel -> {
List<Long> typeIds = mapper.selectTypeIds(tModel);
tModel.setTypeIds(typeIds);
});
return ObjectRestResponse.succ(pageDataVO); return ObjectRestResponse.succ(pageDataVO);
} }
} }
......
...@@ -19,6 +19,8 @@ public interface TModelMapper extends Mapper<TModel> { ...@@ -19,6 +19,8 @@ public interface TModelMapper extends Mapper<TModel> {
int insertTModelTypeRelevance(@Param("modelId") Integer id, @Param("ids") List<Long> typeIds); int insertTModelTypeRelevance(@Param("modelId") Integer id, @Param("ids") List<Long> typeIds);
int insertTModel(TModel tModel); int insertTModel(TModel tModel);
List<Long> selectTypeIds(TModel tModel);
} }
......
...@@ -129,4 +129,10 @@ ...@@ -129,4 +129,10 @@
</when> </when>
</choose> </choose>
</select> </select>
<select id="selectTypeIds" resultType="java.lang.Long">
SELECT ttr.`model_type_id`
FROM t_model_type_relevance ttr
WHERE ttr.is_del = 0
AND ttr.`model_id` = #{id}
</select>
</mapper> </mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment