解决方案详情关联案例

main
mhsnet 1 year ago
parent 3013e76040
commit 27d9559a8d

@ -42,4 +42,10 @@ public class SolutionController {
public Result<?> getInfo(@RequestParam(name="id",required=true) String id) { public Result<?> getInfo(@RequestParam(name="id",required=true) String id) {
return Result.OK(this.solutionService.query().select("id","title","des","img","date","cases","article").eq("id",id).one()); return Result.OK(this.solutionService.query().select("id","title","des","img","date","cases","article").eq("id",id).one());
} }
@ApiOperation(value="解决方案含案例详情", notes="解决方案含案例详情")
@GetMapping("/info-all")
public Result<?> getInfoAll(@RequestParam(name="id",required=true) String id) {
return Result.OK(this.solutionService.getInfoAll(id));
}
} }

@ -2,8 +2,10 @@ package org.jeecg.modules.demo.yxgwf.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.demo.test.entity.JeecgOrderCustomer; import org.jeecg.modules.demo.test.entity.JeecgOrderCustomer;
import org.jeecg.modules.demo.yxgwf.entity.Case;
import org.jeecg.modules.demo.yxgwf.entity.Solution; import org.jeecg.modules.demo.yxgwf.entity.Solution;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -12,4 +14,5 @@ import java.util.List;
@Service @Service
public interface SolutionMapper extends BaseMapper<Solution> { public interface SolutionMapper extends BaseMapper<Solution> {
public List<Solution> getAll(); public List<Solution> getAll();
Solution getInfoAll(@Param("id") String id);
} }

@ -4,4 +4,7 @@
<select id="getAll" resultType="org.jeecg.modules.demo.yxgwf.entity.Solution"> <select id="getAll" resultType="org.jeecg.modules.demo.yxgwf.entity.Solution">
SELECT id,title,des,img,date,cases FROM yxgw_solution SELECT id,title,des,img,date,cases FROM yxgw_solution
</select> </select>
<select id="getInfoAll" resultType="org.jeecg.modules.demo.yxgwf.entity.Solution">
SELECT id,title,des,img,date,cases,article FROM yxgw_solution where id = #{id}
</select>
</mapper> </mapper>

@ -7,4 +7,5 @@ import java.util.List;
public interface ISolutionService extends IService<Solution> { public interface ISolutionService extends IService<Solution> {
List<Solution> getAll(); List<Solution> getAll();
Solution getInfoAll(String id);
} }

@ -27,4 +27,11 @@ public class SolutionServiceImpl extends ServiceImpl<SolutionMapper, Solution> i
}); });
return solution_list; return solution_list;
} }
public Solution getInfoAll(String id) {
Solution solution = solutionMapper.getInfoAll(id);
String[] caseIds = solution.cases.split(",");
List<Case> case_list = caseMapper.getAll(caseIds);
solution.caseslist = case_list;
return solution;
}
} }

@ -4,4 +4,7 @@
<select id="getAll" resultType="org.jeecg.modules.demo.yxgwf.entity.Solution"> <select id="getAll" resultType="org.jeecg.modules.demo.yxgwf.entity.Solution">
SELECT id,title,des,img,date,cases FROM yxgw_solution SELECT id,title,des,img,date,cases FROM yxgw_solution
</select> </select>
<select id="getInfoAll" resultType="org.jeecg.modules.demo.yxgwf.entity.Solution">
SELECT id,title,des,img,date,cases,article FROM yxgw_solution where id = #{id}
</select>
</mapper> </mapper>
Loading…
Cancel
Save