提交 b5ab2c0e authored 作者: liupengfei's avatar liupengfei

--no commit message

上级 a702f70d
package com.zrqx.resource.fg.controller.acupointlibrary;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zrqx.core.util.response.CallBack;
import com.zrqx.resource.commons.model.acupointlibrary.AcupointLibrary;
import com.zrqx.resource.commons.model.acupointlibrary.AcupointLibraryDiyType;
import com.zrqx.resource.commons.model.resourcerelation.ResourceRelation;
import com.zrqx.resource.commons.model.videolibrary.VideoLibrary;
import com.zrqx.resource.commons.vo.bg.acupointlibrary.AcupointLibraryVO;
import com.zrqx.resource.fg.service.FgResourceRelationService;
import com.zrqx.resource.fg.service.acupointlibrary.FgAcupointLibraryDiyTypeService;
import com.zrqx.resource.fg.service.acupointlibrary.FgAcupointLibraryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import tk.mybatis.mapper.entity.Example;
/**
* 穴位库Controller
*/
@RestController
@RequestMapping("/fg/acupoint-library")
@Api(description = "资源管理-穴位库")
public class FgAcupointLibraryController {
@Autowired
private FgAcupointLibraryService service;
@Autowired
private FgAcupointLibraryDiyTypeService diyTypeService;
@Autowired
private FgResourceRelationService resourceRelationService;
@Autowired
private FgVideoLibraryService videoLibraryService;
@ApiOperation(value = "查询", notes = "根据ID查询")
@GetMapping(value = "/get/{oid}")
public CallBack<AcupointLibraryVO> getById(@PathVariable String oid) {
AcupointLibrary entity = service.selectByPrimaryKey(oid);
AcupointLibraryVO vo = new AcupointLibraryVO();
BeanUtils.copyProperties(entity,vo);
Example example = new Example(AcupointLibraryDiyType.class);
example.createCriteria().andEqualTo("acupointId",oid);
AcupointLibraryDiyType diyType = diyTypeService.selectOneByExample(example);
vo.setDiyType(diyType);
example = new Example(ResourceRelation.class);
example.createCriteria().andEqualTo("objectId",oid);
List<ResourceRelation> resourceRelationList = resourceRelationService.selectByExample(example);
List<VideoLibrary> videoList = new ArrayList<VideoLibrary>();
resourceRelationList.forEach(f -> {
VideoLibrary videoLibrary = videoLibraryService.selectByPrimaryKey(f.getResourceId());
videoList.add(videoLibrary);
});
vo.setVideoList(videoList);
return CallBack.success(vo);
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论