lzy 2 months ago
parent
commit
c177fa72e4
17 changed files with 436 additions and 0 deletions
  1. 30 0
      Marketplace/src/main/java/com/dt/child/controller/LzyNeirongXiangqingController.java
  2. 25 0
      Marketplace/src/main/java/com/dt/child/controller/LzyYverneirongTypeController.java
  3. 84 0
      Marketplace/src/main/java/com/dt/child/domain/LzyNeirongXiangqing.java
  4. 68 0
      Marketplace/src/main/java/com/dt/child/domain/LzyYverneirongType.java
  5. 14 0
      Marketplace/src/main/java/com/dt/child/dto/LzyNeirongXiangqingDto.java
  6. 18 0
      Marketplace/src/main/java/com/dt/child/mapper/LzyNeirongXiangqingMapper.java
  7. 18 0
      Marketplace/src/main/java/com/dt/child/mapper/LzyYverneirongTypeMapper.java
  8. 19 0
      Marketplace/src/main/java/com/dt/child/service/LzyNeirongXiangqingService.java
  9. 18 0
      Marketplace/src/main/java/com/dt/child/service/LzyYverneirongTypeService.java
  10. 3 0
      Marketplace/src/main/java/com/dt/child/service/impl/LzyFoodContentServiceImpl.java
  11. 41 0
      Marketplace/src/main/java/com/dt/child/service/impl/LzyNeirongXiangqingServiceImpl.java
  12. 3 0
      Marketplace/src/main/java/com/dt/child/service/impl/LzyShiwuServiceImpl.java
  13. 46 0
      Marketplace/src/main/java/com/dt/child/service/impl/LzyYverneirongTypeServiceImpl.java
  14. 13 0
      Marketplace/src/main/java/com/dt/child/vo/UsersVo.java
  15. 3 0
      Marketplace/src/main/java/com/dt/common/service/impl/ChildServiceImpl.java
  16. 18 0
      Marketplace/src/main/resources/mapper/LzyNeirongXiangqingMapper.xml
  17. 15 0
      Marketplace/src/main/resources/mapper/LzyYverneirongTypeMapper.xml

+ 30 - 0
Marketplace/src/main/java/com/dt/child/controller/LzyNeirongXiangqingController.java

@@ -0,0 +1,30 @@
+package com.dt.child.controller;
+
+import com.dt.child.service.LzyNeirongXiangqingService;
+import com.dt.vo.Result;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+
+@RestController
+@RequestMapping("lzyNeirongXiangqings")
+public class LzyNeirongXiangqingController {
+
+
+
+    @Resource
+    private LzyNeirongXiangqingService lzyNeirongXiangqingService;
+
+
+
+
+    @RequestMapping("selNeirongXiangqing")
+    public Result selNeirongXiangqing(@RequestParam("id") Long id)
+    {
+        return lzyNeirongXiangqingService.find(id);
+    }
+
+
+}

+ 25 - 0
Marketplace/src/main/java/com/dt/child/controller/LzyYverneirongTypeController.java

@@ -0,0 +1,25 @@
+package com.dt.child.controller;
+
+import com.dt.child.service.LzyYverneirongTypeService;
+import com.dt.vo.Result;
+import lombok.Data;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+
+@RestController
+@RequestMapping("lzyYverneirongType")
+public class LzyYverneirongTypeController {
+
+    @Resource
+    private LzyYverneirongTypeService lzyYverneirongTypeService;
+
+//     查询标题
+    @RequestMapping("selType")
+    public Result selType(@RequestParam("id") Long id) {
+        return lzyYverneirongTypeService.selType(id);
+    }
+
+}

+ 84 - 0
Marketplace/src/main/java/com/dt/child/domain/LzyNeirongXiangqing.java

@@ -0,0 +1,84 @@
+package com.dt.child.domain;
+
+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 java.io.Serializable;
+import lombok.Data;
+
+/**
+ * 
+ * @TableName lzy_neirong_xiangqing
+ */
+@TableName(value ="lzy_neirong_xiangqing")
+@Data
+public class LzyNeirongXiangqing implements Serializable {
+    /**
+     * id
+     */
+    @TableId
+    private Long id;
+
+    /**
+     * 内容
+     */
+    private Object neirong;
+
+    /**
+     * 标题id
+     */
+    private Long neirongId;
+
+    /**
+     * 标签id
+     */
+    private Long yverbeirongId;
+
+    @TableField(exist = false)
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public boolean equals(Object that) {
+        if (this == that) {
+            return true;
+        }
+        if (that == null) {
+            return false;
+        }
+        if (getClass() != that.getClass()) {
+            return false;
+        }
+        LzyNeirongXiangqing other = (LzyNeirongXiangqing) that;
+        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
+            && (this.getNeirong() == null ? other.getNeirong() == null : this.getNeirong().equals(other.getNeirong()))
+            && (this.getNeirongId() == null ? other.getNeirongId() == null : this.getNeirongId().equals(other.getNeirongId()))
+            && (this.getYverbeirongId() == null ? other.getYverbeirongId() == null : this.getYverbeirongId().equals(other.getYverbeirongId()));
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
+        result = prime * result + ((getNeirong() == null) ? 0 : getNeirong().hashCode());
+        result = prime * result + ((getNeirongId() == null) ? 0 : getNeirongId().hashCode());
+        result = prime * result + ((getYverbeirongId() == null) ? 0 : getYverbeirongId().hashCode());
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", id=").append(id);
+        sb.append(", neirong=").append(neirong);
+        sb.append(", neirongId=").append(neirongId);
+        sb.append(", yverbeirongId=").append(yverbeirongId);
+        sb.append(", serialVersionUID=").append(serialVersionUID);
+        sb.append("]");
+        return sb.toString();
+    }
+}

+ 68 - 0
Marketplace/src/main/java/com/dt/child/domain/LzyYverneirongType.java

@@ -0,0 +1,68 @@
+package com.dt.child.domain;
+
+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 java.io.Serializable;
+import lombok.Data;
+
+/**
+ * 
+ * @TableName lzy_yverneirong_type
+ */
+@TableName(value ="lzy_yverneirong_type")
+@Data
+public class LzyYverneirongType implements Serializable {
+    /**
+     * 主键
+     */
+    @TableId
+    private Long id;
+
+    /**
+     * 标题
+     */
+    private String title;
+
+    @TableField(exist = false)
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public boolean equals(Object that) {
+        if (this == that) {
+            return true;
+        }
+        if (that == null) {
+            return false;
+        }
+        if (getClass() != that.getClass()) {
+            return false;
+        }
+        LzyYverneirongType other = (LzyYverneirongType) that;
+        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
+            && (this.getTitle() == null ? other.getTitle() == null : this.getTitle().equals(other.getTitle()));
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
+        result = prime * result + ((getTitle() == null) ? 0 : getTitle().hashCode());
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", id=").append(id);
+        sb.append(", title=").append(title);
+        sb.append(", serialVersionUID=").append(serialVersionUID);
+        sb.append("]");
+        return sb.toString();
+    }
+}

+ 14 - 0
Marketplace/src/main/java/com/dt/child/dto/LzyNeirongXiangqingDto.java

@@ -0,0 +1,14 @@
+package com.dt.child.dto;
+
+import com.dt.child.vo.UsersVo;
+import lombok.Data;
+
+@Data
+public class LzyNeirongXiangqingDto {
+
+
+    private UsersVo usersVo;
+
+    private Object neirong;
+
+}

+ 18 - 0
Marketplace/src/main/java/com/dt/child/mapper/LzyNeirongXiangqingMapper.java

@@ -0,0 +1,18 @@
+package com.dt.child.mapper;
+
+import com.dt.child.domain.LzyNeirongXiangqing;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+* @author lzy
+* @description 针对表【lzy_neirong_xiangqing】的数据库操作Mapper
+* @createDate 2025-07-10 20:49:59
+* @Entity com.dt.child.domain.LzyNeirongXiangqing
+*/
+public interface LzyNeirongXiangqingMapper extends BaseMapper<LzyNeirongXiangqing> {
+
+}
+
+
+
+

+ 18 - 0
Marketplace/src/main/java/com/dt/child/mapper/LzyYverneirongTypeMapper.java

@@ -0,0 +1,18 @@
+package com.dt.child.mapper;
+
+import com.dt.child.domain.LzyYverneirongType;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+* @author lzy
+* @description 针对表【lzy_yverneirong_type】的数据库操作Mapper
+* @createDate 2025-07-10 20:49:59
+* @Entity com.dt.child.domain.LzyYverneirongType
+*/
+public interface LzyYverneirongTypeMapper extends BaseMapper<LzyYverneirongType> {
+
+}
+
+
+
+

+ 19 - 0
Marketplace/src/main/java/com/dt/child/service/LzyNeirongXiangqingService.java

@@ -0,0 +1,19 @@
+package com.dt.child.service;
+
+import com.dt.child.domain.LzyNeirongXiangqing;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.dt.vo.Result;
+
+/**
+* @author lzy
+* @description 针对表【lzy_neirong_xiangqing】的数据库操作Service
+* @createDate 2025-07-10 20:49:59
+*/
+public interface LzyNeirongXiangqingService extends IService<LzyNeirongXiangqing> {
+
+
+//    查询内容
+    Result find(Long id);
+
+
+}

+ 18 - 0
Marketplace/src/main/java/com/dt/child/service/LzyYverneirongTypeService.java

@@ -0,0 +1,18 @@
+package com.dt.child.service;
+
+import com.dt.child.domain.LzyYverneirongType;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.dt.vo.Result;
+
+/**
+* @author lzy
+* @description 针对表【lzy_yverneirong_type】的数据库操作Service
+* @createDate 2025-07-10 20:49:59
+*/
+public interface LzyYverneirongTypeService extends IService<LzyYverneirongType> {
+
+
+//    查询标题
+    public Result selType(Long id);
+
+}

+ 3 - 0
Marketplace/src/main/java/com/dt/child/service/impl/LzyFoodContentServiceImpl.java

@@ -20,6 +20,9 @@ public class LzyFoodContentServiceImpl extends ServiceImpl<LzyFoodContentMapper,
     @Override
     @Override
     public Result selFoodContent(Long id) {
     public Result selFoodContent(Long id) {
         LzyFoodContent lzyFoodContent = this.baseMapper.selectOne(new LambdaQueryWrapper<LzyFoodContent>().eq(LzyFoodContent::getFoodId, id));
         LzyFoodContent lzyFoodContent = this.baseMapper.selectOne(new LambdaQueryWrapper<LzyFoodContent>().eq(LzyFoodContent::getFoodId, id));
+        if (lzyFoodContent==null){
+            return Result.ok("没有内容","没有内容");
+        }
         return Result.ok(lzyFoodContent,"查询成功");
         return Result.ok(lzyFoodContent,"查询成功");
     }
     }
 }
 }

+ 41 - 0
Marketplace/src/main/java/com/dt/child/service/impl/LzyNeirongXiangqingServiceImpl.java

@@ -0,0 +1,41 @@
+package com.dt.child.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.dt.child.domain.LzyNeirongXiangqing;
+import com.dt.child.dto.LzyNeirongXiangqingDto;
+import com.dt.child.service.LzyNeirongXiangqingService;
+import com.dt.child.mapper.LzyNeirongXiangqingMapper;
+import com.dt.child.vo.UserVo;
+import com.dt.child.vo.UsersVo;
+import com.dt.vo.Result;
+import org.springframework.stereotype.Service;
+
+/**
+* @author lzy
+* @description 针对表【lzy_neirong_xiangqing】的数据库操作Service实现
+* @createDate 2025-07-10 20:49:59
+*/
+@Service
+public class LzyNeirongXiangqingServiceImpl extends ServiceImpl<LzyNeirongXiangqingMapper, LzyNeirongXiangqing>
+    implements LzyNeirongXiangqingService{
+
+
+//    查询内容
+    @Override
+    public Result find(Long id) {
+        UsersVo usersVo=new UsersVo();
+        LzyNeirongXiangqing lzyNeirongXiangqing = this.baseMapper.selectOne(new LambdaQueryWrapper<LzyNeirongXiangqing>().eq(LzyNeirongXiangqing::getYverbeirongId, id));
+        if (lzyNeirongXiangqing==null){
+            return Result.Err(null,"没有内容");
+        }
+        LzyNeirongXiangqingDto lzyNeirongXiangqingDto=new LzyNeirongXiangqingDto();
+        lzyNeirongXiangqingDto.setUsersVo(usersVo);
+        lzyNeirongXiangqingDto.setNeirong(lzyNeirongXiangqing.getNeirong());
+        return Result.ok(lzyNeirongXiangqingDto,"查询成功");
+    }
+}
+
+
+
+

+ 3 - 0
Marketplace/src/main/java/com/dt/child/service/impl/LzyShiwuServiceImpl.java

@@ -66,6 +66,9 @@ public class LzyShiwuServiceImpl extends ServiceImpl<LzyShiwuMapper, LzyShiwu>
     @Override
     @Override
     public Result selshiwuxiangqing(LzyShiwuXiangqingDto selShiWuDto) {
     public Result selshiwuxiangqing(LzyShiwuXiangqingDto selShiWuDto) {
         LzyShiwuXiangqing lzyShiwuXiangqing = lzyShiwuXiangqingMapper.selectOne(new LambdaQueryWrapper<LzyShiwuXiangqing>().eq(LzyShiwuXiangqing::getFoodId, selShiWuDto.getId()));
         LzyShiwuXiangqing lzyShiwuXiangqing = lzyShiwuXiangqingMapper.selectOne(new LambdaQueryWrapper<LzyShiwuXiangqing>().eq(LzyShiwuXiangqing::getFoodId, selShiWuDto.getId()));
+        if (lzyShiwuXiangqing==null){
+            return Result.Err(null,"没有此食物");
+        }
         LzyShiwuXiangqingVo lzyShiwuXiangqingVo=new LzyShiwuXiangqingVo();
         LzyShiwuXiangqingVo lzyShiwuXiangqingVo=new LzyShiwuXiangqingVo();
         lzyShiwuXiangqingVo.setName(lzyShiwuXiangqing.getName());
         lzyShiwuXiangqingVo.setName(lzyShiwuXiangqing.getName());
         lzyShiwuXiangqingVo.setImg(lzyShiwuXiangqing.getImg());
         lzyShiwuXiangqingVo.setImg(lzyShiwuXiangqing.getImg());

+ 46 - 0
Marketplace/src/main/java/com/dt/child/service/impl/LzyYverneirongTypeServiceImpl.java

@@ -0,0 +1,46 @@
+package com.dt.child.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.dt.child.domain.LzyNeirongXiangqing;
+import com.dt.child.domain.LzyYverneirongType;
+import com.dt.child.mapper.LzyNeirongXiangqingMapper;
+import com.dt.child.service.LzyYverneirongTypeService;
+import com.dt.child.mapper.LzyYverneirongTypeMapper;
+import com.dt.vo.Result;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+* @author lzy
+* @description 针对表【lzy_yverneirong_type】的数据库操作Service实现
+* @createDate 2025-07-10 20:49:59
+*/
+@Service
+public class LzyYverneirongTypeServiceImpl extends ServiceImpl<LzyYverneirongTypeMapper, LzyYverneirongType>
+    implements LzyYverneirongTypeService{
+
+    @Resource
+    private LzyNeirongXiangqingMapper lzyNeirongXiangqingMapper;
+
+//    查询标签
+    @Override
+    public Result selType(Long id) {
+        List<LzyNeirongXiangqing> lzyNeirongXiangqings = lzyNeirongXiangqingMapper.selectList(new LambdaQueryWrapper<LzyNeirongXiangqing>().eq(LzyNeirongXiangqing::getNeirongId, id));
+        if (lzyNeirongXiangqings.size() == 0){
+            return Result.Err(null,"没有数据");
+        }
+        List<Long> collect = lzyNeirongXiangqings.stream().map(a -> a.getYverbeirongId()).collect(Collectors.toList());
+        List<Long> collect1 = collect.stream().distinct().collect(Collectors.toList());
+        System.err.println(collect1);
+        List<LzyYverneirongType> lzyYverneirongTypes = this.baseMapper.selectList(new LambdaQueryWrapper<LzyYverneirongType>().in(LzyYverneirongType::getId, collect1));
+        return Result.ok(lzyYverneirongTypes,"查询成功");
+    }
+}
+
+
+
+

+ 13 - 0
Marketplace/src/main/java/com/dt/child/vo/UsersVo.java

@@ -0,0 +1,13 @@
+package com.dt.child.vo;
+
+import lombok.Data;
+
+@Data
+public class UsersVo {
+    private   String name="韩医生";
+
+    private   String url="https://lzy8.oss-cn-beijing.aliyuncs.com/175258050036592a525-5.png";
+
+    private   String title="2407A班主导医生";
+
+}

+ 3 - 0
Marketplace/src/main/java/com/dt/common/service/impl/ChildServiceImpl.java

@@ -69,6 +69,9 @@ public class ChildServiceImpl extends ServiceImpl<ChildMapper, Child>
     public Result selChild(Long userId) {
     public Result selChild(Long userId) {
         try {
         try {
             List<ParentChild> parentChildren = parentChildMapper.selectList(new LambdaQueryWrapper<ParentChild>().eq(ParentChild::getParentId, userId));
             List<ParentChild> parentChildren = parentChildMapper.selectList(new LambdaQueryWrapper<ParentChild>().eq(ParentChild::getParentId, userId));
+            if (parentChildren.size() == 0 && parentChildren == null){
+                return Result.ok(null, "没有数据");
+            }
             List<Long> collect = parentChildren.stream().map(opt -> opt.getChildId()).collect(Collectors.toList());
             List<Long> collect = parentChildren.stream().map(opt -> opt.getChildId()).collect(Collectors.toList());
             List<Child> children = this.baseMapper.selectBatchIds(collect);
             List<Child> children = this.baseMapper.selectBatchIds(collect);
             return Result.ok(children, "查询成功");
             return Result.ok(children, "查询成功");

+ 18 - 0
Marketplace/src/main/resources/mapper/LzyNeirongXiangqingMapper.xml

@@ -0,0 +1,18 @@
+<?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="com.dt.child.mapper.LzyNeirongXiangqingMapper">
+
+    <resultMap id="BaseResultMap" type="com.dt.child.domain.LzyNeirongXiangqing">
+            <id property="id" column="id" jdbcType="BIGINT"/>
+            <result property="neirong" column="neirong" jdbcType="OTHER"/>
+            <result property="neirongId" column="neirong_id" jdbcType="BIGINT"/>
+            <result property="yverbeirongId" column="yverbeirong_id" jdbcType="BIGINT"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id,neirong,neirong_id,
+        yverbeirong_id
+    </sql>
+</mapper>

+ 15 - 0
Marketplace/src/main/resources/mapper/LzyYverneirongTypeMapper.xml

@@ -0,0 +1,15 @@
+<?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="com.dt.child.mapper.LzyYverneirongTypeMapper">
+
+    <resultMap id="BaseResultMap" type="com.dt.child.domain.LzyYverneirongType">
+            <id property="id" column="id" jdbcType="BIGINT"/>
+            <result property="title" column="title" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id,title
+    </sql>
+</mapper>