lzy 8 hours ago
parent
commit
d17fa95ea4

+ 124 - 0
Marketplace/src/main/java/com/dt/child/domain/LzyShiwu.java

@@ -0,0 +1,124 @@
+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_shiwu
+ */
+@TableName(value ="lzy_shiwu")
+@Data
+public class LzyShiwu implements Serializable {
+    /**
+     * id
+     */
+    @TableId
+    private Long id;
+
+    /**
+     * 名字
+     */
+    private String name;
+
+    /**
+     * 图片
+     */
+    private String img;
+
+    /**
+     * 详情
+     */
+    private String details;
+
+    /**
+     * 类型 1能吃 2不推荐吃 3不能吃
+     */
+    private Integer isPregnant;
+
+    /**
+     * 类型 1能吃 2不推荐吃 3不能吃
+     */
+    private Integer isPostpartum;
+
+    /**
+     * 类型 1能吃 2不推荐吃 3不能吃
+     */
+    private Integer isBreastfeeding;
+
+    /**
+     * 类型 1能吃 2不推荐吃 3不能吃
+     */
+    private Integer isSixMonthOld;
+
+    /**
+     * 食物类型
+     */
+    private Integer shiwuType;
+
+    @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;
+        }
+        LzyShiwu other = (LzyShiwu) that;
+        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
+            && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
+            && (this.getImg() == null ? other.getImg() == null : this.getImg().equals(other.getImg()))
+            && (this.getDetails() == null ? other.getDetails() == null : this.getDetails().equals(other.getDetails()))
+            && (this.getIsPregnant() == null ? other.getIsPregnant() == null : this.getIsPregnant().equals(other.getIsPregnant()))
+            && (this.getIsPostpartum() == null ? other.getIsPostpartum() == null : this.getIsPostpartum().equals(other.getIsPostpartum()))
+            && (this.getIsBreastfeeding() == null ? other.getIsBreastfeeding() == null : this.getIsBreastfeeding().equals(other.getIsBreastfeeding()))
+            && (this.getIsSixMonthOld() == null ? other.getIsSixMonthOld() == null : this.getIsSixMonthOld().equals(other.getIsSixMonthOld()))
+            && (this.getShiwuType() == null ? other.getShiwuType() == null : this.getShiwuType().equals(other.getShiwuType()));
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
+        result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
+        result = prime * result + ((getImg() == null) ? 0 : getImg().hashCode());
+        result = prime * result + ((getDetails() == null) ? 0 : getDetails().hashCode());
+        result = prime * result + ((getIsPregnant() == null) ? 0 : getIsPregnant().hashCode());
+        result = prime * result + ((getIsPostpartum() == null) ? 0 : getIsPostpartum().hashCode());
+        result = prime * result + ((getIsBreastfeeding() == null) ? 0 : getIsBreastfeeding().hashCode());
+        result = prime * result + ((getIsSixMonthOld() == null) ? 0 : getIsSixMonthOld().hashCode());
+        result = prime * result + ((getShiwuType() == null) ? 0 : getShiwuType().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(", name=").append(name);
+        sb.append(", img=").append(img);
+        sb.append(", details=").append(details);
+        sb.append(", isPregnant=").append(isPregnant);
+        sb.append(", isPostpartum=").append(isPostpartum);
+        sb.append(", isBreastfeeding=").append(isBreastfeeding);
+        sb.append(", isSixMonthOld=").append(isSixMonthOld);
+        sb.append(", shiwuType=").append(shiwuType);
+        sb.append(", serialVersionUID=").append(serialVersionUID);
+        sb.append("]");
+        return sb.toString();
+    }
+}

+ 84 - 0
Marketplace/src/main/java/com/dt/child/domain/LzyShiwuType.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_shiwu_type
+ */
+@TableName(value ="lzy_shiwu_type")
+@Data
+public class LzyShiwuType implements Serializable {
+    /**
+     * id
+     */
+    @TableId
+    private Long id;
+
+    /**
+     * 名字
+     */
+    private String typeName;
+
+    /**
+     * 图片
+     */
+    private String url;
+
+    /**
+     * 类型
+     */
+    private Integer level;
+
+    @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;
+        }
+        LzyShiwuType other = (LzyShiwuType) that;
+        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
+            && (this.getTypeName() == null ? other.getTypeName() == null : this.getTypeName().equals(other.getTypeName()))
+            && (this.getUrl() == null ? other.getUrl() == null : this.getUrl().equals(other.getUrl()))
+            && (this.getLevel() == null ? other.getLevel() == null : this.getLevel().equals(other.getLevel()));
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
+        result = prime * result + ((getTypeName() == null) ? 0 : getTypeName().hashCode());
+        result = prime * result + ((getUrl() == null) ? 0 : getUrl().hashCode());
+        result = prime * result + ((getLevel() == null) ? 0 : getLevel().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(", typeName=").append(typeName);
+        sb.append(", url=").append(url);
+        sb.append(", level=").append(level);
+        sb.append(", serialVersionUID=").append(serialVersionUID);
+        sb.append("]");
+        return sb.toString();
+    }
+}

+ 76 - 0
Marketplace/src/main/java/com/dt/child/domain/LzyType.java

@@ -0,0 +1,76 @@
+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_type
+ */
+@TableName(value ="lzy_type")
+@Data
+public class LzyType implements Serializable {
+    /**
+     * 主键
+     */
+    @TableId
+    private Long id;
+
+    /**
+     * 名字
+     */
+    private String name;
+
+    /**
+     * 标题
+     */
+    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;
+        }
+        LzyType other = (LzyType) that;
+        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
+            && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
+            && (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 + ((getName() == null) ? 0 : getName().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(", name=").append(name);
+        sb.append(", title=").append(title);
+        sb.append(", serialVersionUID=").append(serialVersionUID);
+        sb.append("]");
+        return sb.toString();
+    }
+}

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

@@ -0,0 +1,18 @@
+package com.dt.child.mapper;
+
+import com.dt.child.domain.LzyShiwu;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+* @author lzy
+* @description 针对表【lzy_shiwu(查禁忌食物)】的数据库操作Mapper
+* @createDate 2025-07-08 10:52:23
+* @Entity com.dt.child.domain.LzyShiwu
+*/
+public interface LzyShiwuMapper extends BaseMapper<LzyShiwu> {
+
+}
+
+
+
+

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

@@ -0,0 +1,18 @@
+package com.dt.child.mapper;
+
+import com.dt.child.domain.LzyShiwuType;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+* @author lzy
+* @description 针对表【lzy_shiwu_type】的数据库操作Mapper
+* @createDate 2025-07-08 14:18:35
+* @Entity com.dt.child.domain.LzyShiwuType
+*/
+public interface LzyShiwuTypeMapper extends BaseMapper<LzyShiwuType> {
+
+}
+
+
+
+

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

@@ -0,0 +1,18 @@
+package com.dt.child.service;
+
+import com.dt.child.domain.LzyShiwu;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.dt.child.dto.SelShiWuDto;
+import com.dt.vo.Result;
+
+/**
+* @author lzy
+* @description 针对表【lzy_shiwu(查禁忌食物)】的数据库操作Service
+* @createDate 2025-07-08 10:52:23
+*/
+public interface LzyShiwuService extends IService<LzyShiwu> {
+
+//  查询食物
+     Result selshiwu(SelShiWuDto selShiWuDto);
+
+}

+ 25 - 0
Marketplace/src/main/java/com/dt/child/service/LzyShiwuTypeService.java

@@ -0,0 +1,25 @@
+package com.dt.child.service;
+
+import com.dt.child.domain.LzyShiwuType;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.dt.child.dto.SelShiwuDto1;
+import com.dt.vo.Result;
+
+/**
+* @author lzy
+* @description 针对表【lzy_shiwu_type】的数据库操作Service
+* @createDate 2025-07-08 14:18:35
+*/
+public interface LzyShiwuTypeService extends IService<LzyShiwuType> {
+    //    查询菜单
+    Result selShiwuType();
+
+//    查询状态
+    Result selShiwuType1();
+
+//    是否能吃
+    Result selShiwuType2();
+
+//查询类型中的食物
+    Result selShiwu(SelShiwuDto1 selShiwuDto1);
+}

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

@@ -0,0 +1,57 @@
+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.LzyShiwu;
+import com.dt.child.dto.SelShiWuDto;
+import com.dt.child.service.LzyShiwuService;
+import com.dt.child.mapper.LzyShiwuMapper;
+import com.dt.vo.Result;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+* @author lzy
+* @description 针对表【lzy_shiwu(查禁忌食物)】的数据库操作Service实现
+* @createDate 2025-07-08 10:52:23
+*/
+@Service
+public class LzyShiwuServiceImpl extends ServiceImpl<LzyShiwuMapper, LzyShiwu>
+    implements LzyShiwuService{
+
+    //    查询食物
+    @Override
+    public Result selshiwu(SelShiWuDto selShiWuDto) {
+        if (selShiWuDto.getId()==0L && selShiWuDto.getId()==null){
+            selShiWuDto.setId(16L);
+        }
+        if (selShiWuDto.getType_id()==0 && selShiWuDto.getType_id()==null){
+            selShiWuDto.setType_id(19L);
+        }
+//      孕妇
+        if (selShiWuDto.getId()==13){
+            List<LzyShiwu> lzyShiwus = this.baseMapper.selectList(new LambdaQueryWrapper<LzyShiwu>().eq(LzyShiwu::getIsPregnant, selShiWuDto.getType_id()));
+            return Result.ok(lzyShiwus,"查询成功");
+        }
+//        月子期
+        if (selShiWuDto.getId()==14){
+            List<LzyShiwu> lzyShiwus = this.baseMapper.selectList(new LambdaQueryWrapper<LzyShiwu>().eq(LzyShiwu::getIsPostpartum, selShiWuDto.getType_id()));
+            return Result.ok(lzyShiwus,"查询成功");
+        }
+//        哺乳期
+        if (selShiWuDto.getId()==15){
+            List<LzyShiwu> lzyShiwus = this.baseMapper.selectList(new LambdaQueryWrapper<LzyShiwu>().eq(LzyShiwu::getIsBreastfeeding, selShiWuDto.getType_id()));
+            return Result.ok(lzyShiwus,"查询成功");
+        }
+        if (selShiWuDto.getId()==16){
+            List<LzyShiwu> lzyShiwus = this.baseMapper.selectList(new LambdaQueryWrapper<LzyShiwu>().eq(LzyShiwu::getIsSixMonthOld, selShiWuDto.getType_id()));
+            return Result.ok(lzyShiwus,"查询成功");
+        }
+        return Result.Err(null,"查询失败");
+    }
+}
+
+
+
+

+ 62 - 0
Marketplace/src/main/java/com/dt/child/service/impl/LzyShiwuTypeServiceImpl.java

@@ -0,0 +1,62 @@
+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.LzyShiwu;
+import com.dt.child.domain.LzyShiwuType;
+import com.dt.child.dto.SelShiwuDto1;
+import com.dt.child.mapper.LzyShiwuMapper;
+import com.dt.child.service.LzyShiwuService;
+import com.dt.child.service.LzyShiwuTypeService;
+import com.dt.child.mapper.LzyShiwuTypeMapper;
+import com.dt.vo.Result;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+* @author lzy
+* @description 针对表【lzy_shiwu_type】的数据库操作Service实现
+* @createDate 2025-07-08 14:18:35
+*/
+@Service
+public class LzyShiwuTypeServiceImpl extends ServiceImpl<LzyShiwuTypeMapper, LzyShiwuType>
+    implements LzyShiwuTypeService{
+
+    @Resource
+    private LzyShiwuMapper lzyShiwuMapper;
+
+//  查询菜单
+    @Override
+    public Result selShiwuType() {
+        List<LzyShiwuType> lzyShiwuTypes = this.baseMapper.selectList(new LambdaQueryWrapper<LzyShiwuType>().eq(LzyShiwuType::getLevel, 1));
+        return Result.ok(lzyShiwuTypes,"查询成功");
+    }
+
+//    查询状态
+    @Override
+    public Result selShiwuType1() {
+        List<LzyShiwuType> lzyShiwuTypes = this.baseMapper.selectList(new LambdaQueryWrapper<LzyShiwuType>().eq(LzyShiwuType::getLevel, 2));
+        return Result.ok(lzyShiwuTypes,"查询成功");
+    }
+    //    是否能吃
+    @Override
+    public Result selShiwuType2() {
+        List<LzyShiwuType> lzyShiwuTypes = this.baseMapper.selectList(new LambdaQueryWrapper<LzyShiwuType>().eq(LzyShiwuType::getLevel, 3));
+        return Result.ok(lzyShiwuTypes,"查询成功");
+    }
+
+    //    查询商品
+    @Override
+    public Result selShiwu(SelShiwuDto1 selShiwuDto1) {
+        List<LzyShiwu> lzyShiwus = lzyShiwuMapper.selectList(new LambdaQueryWrapper<LzyShiwu>().eq(LzyShiwu::getShiwuType, selShiwuDto1.getId()));
+        return Result.ok(lzyShiwus,"查询成功");
+    }
+
+
+}
+
+
+
+

+ 24 - 0
Marketplace/src/main/resources/mapper/LzyShiwuMapper.xml

@@ -0,0 +1,24 @@
+<?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.LzyShiwuMapper">
+
+    <resultMap id="BaseResultMap" type="com.dt.child.domain.LzyShiwu">
+            <id property="id" column="id" jdbcType="BIGINT"/>
+            <result property="name" column="name" jdbcType="VARCHAR"/>
+            <result property="img" column="img" jdbcType="VARCHAR"/>
+            <result property="details" column="details" jdbcType="VARCHAR"/>
+            <result property="isPregnant" column="is_pregnant" jdbcType="INTEGER"/>
+            <result property="isPostpartum" column="is_postpartum" jdbcType="INTEGER"/>
+            <result property="isBreastfeeding" column="is_breastfeeding" jdbcType="INTEGER"/>
+            <result property="isSixMonthOld" column="is_six_month_old" jdbcType="INTEGER"/>
+            <result property="shiwuType" column="shiwu_type" jdbcType="INTEGER"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id,name,img,
+        details,is_pregnant,is_postpartum,
+        is_breastfeeding,is_six_month_old,shiwu_type
+    </sql>
+</mapper>

+ 18 - 0
Marketplace/src/main/resources/mapper/LzyShiwuTypeMapper.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.LzyShiwuTypeMapper">
+
+    <resultMap id="BaseResultMap" type="com.dt.child.domain.LzyShiwuType">
+            <id property="id" column="id" jdbcType="BIGINT"/>
+            <result property="typeName" column="type_name" jdbcType="VARCHAR"/>
+            <result property="url" column="url" jdbcType="VARCHAR"/>
+            <result property="level" column="level" jdbcType="INTEGER"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id,type_name,url,
+        level
+    </sql>
+</mapper>