yubin vor 4 Tagen
Ursprung
Commit
9a170f393a

+ 206 - 0
mall-api/src/main/java/com/txz/mall/dto/MidFavoriteDTO.java

@@ -0,0 +1,206 @@
+/*
+*
+* MidFavoriteDTO.java
+* Copyright(C) 2017-2020 fendo公司
+* @date 2025-08-13
+*/
+package com.txz.mall.dto;
+
+import java.io.Serializable;
+import java.util.Date;
+
+public class MidFavoriteDTO implements Serializable {
+    /**
+     * 
+     */
+    private Long id;
+
+    /**
+     * 用户id
+     */
+    private Long userId;
+
+    /**
+     * 商品id
+     */
+    private Long productId;
+
+    /**
+     * 创建人
+     */
+    private String createUser;
+
+    /**
+     * 更新人
+     */
+    private String updateUser;
+
+    /**
+     * 更新时间
+     */
+    private Date updateTime;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 删除标识 1是0否
+     */
+    private Byte isValid;
+
+    /**
+     * 版本号
+     */
+    private String version;
+
+    /**
+     * m_mid_favorite
+     */
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 
+     * @return id 
+     */
+    public Long getId() {
+        return id;
+    }
+
+    /**
+     * 
+     * @param id 
+     */
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    /**
+     * 用户id
+     * @return user_id 用户id
+     */
+    public Long getUserId() {
+        return userId;
+    }
+
+    /**
+     * 用户id
+     * @param userId 用户id
+     */
+    public void setUserId(Long userId) {
+        this.userId = userId;
+    }
+
+    /**
+     * 商品id
+     * @return product_id 商品id
+     */
+    public Long getProductId() {
+        return productId;
+    }
+
+    /**
+     * 商品id
+     * @param productId 商品id
+     */
+    public void setProductId(Long productId) {
+        this.productId = productId;
+    }
+
+    /**
+     * 创建人
+     * @return create_user 创建人
+     */
+    public String getCreateUser() {
+        return createUser;
+    }
+
+    /**
+     * 创建人
+     * @param createUser 创建人
+     */
+    public void setCreateUser(String createUser) {
+        this.createUser = createUser;
+    }
+
+    /**
+     * 更新人
+     * @return update_user 更新人
+     */
+    public String getUpdateUser() {
+        return updateUser;
+    }
+
+    /**
+     * 更新人
+     * @param updateUser 更新人
+     */
+    public void setUpdateUser(String updateUser) {
+        this.updateUser = updateUser;
+    }
+
+    /**
+     * 更新时间
+     * @return update_time 更新时间
+     */
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    /**
+     * 更新时间
+     * @param updateTime 更新时间
+     */
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    /**
+     * 创建时间
+     * @return create_time 创建时间
+     */
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    /**
+     * 创建时间
+     * @param createTime 创建时间
+     */
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    /**
+     * 删除标识 1是0否
+     * @return is_valid 删除标识 1是0否
+     */
+    public Byte getIsValid() {
+        return isValid;
+    }
+
+    /**
+     * 删除标识 1是0否
+     * @param isValid 删除标识 1是0否
+     */
+    public void setIsValid(Byte isValid) {
+        this.isValid = isValid;
+    }
+
+    /**
+     * 版本号
+     * @return version 版本号
+     */
+    public String getVersion() {
+        return version;
+    }
+
+    /**
+     * 版本号
+     * @param version 版本号
+     */
+    public void setVersion(String version) {
+        this.version = version;
+    }
+}

+ 27 - 0
mall-interface/src/main/java/com/txz/mall/service/MidFavoriteServiceClient.java

@@ -0,0 +1,27 @@
+package com.txz.mall.service;
+
+
+import com.txz.mall.dto.*;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.*;
+import java.util.List;
+
+
+@FeignClient("mall")
+public interface MidFavoriteServiceClient {
+
+	@RequestMapping( value = {"/mid/favorite/add"}, method = {RequestMethod.POST} )
+    public Result add(@RequestBody MidFavoriteDPO midFavorite,@RequestParam("userId") Long userId);
+
+	@RequestMapping( value = {"/mid/favorite/delete"}, method = {RequestMethod.POST} )
+	public Result delete(@RequestParam("id") Integer id,@RequestParam("userId") Long userId);
+
+	@RequestMapping( value = {"/mid/favorite/update"}, method = {RequestMethod.POST} )
+	public Result update(@RequestBody MidFavoriteDPO midFavorite,@RequestParam("userId") Long userId);
+
+	@RequestMapping( value = {"/mid/favorite/detail"}, method = {RequestMethod.POST} )
+	public Result<MidFavoriteDPO> detail(@RequestParam("id") Integer id,@RequestParam("userId") Long userId);
+
+	@RequestMapping( value = {"/mid/favorite/list"}, method = {RequestMethod.POST} )
+	public Result<List<MidFavoriteDPO>> list(@RequestBody MidFavoriteDPO midFavorite, @RequestParam("page") Integer page, @RequestParam("size") Integer size,@RequestParam("userId") Long userId);
+}

+ 7 - 0
mall-service/src/main/java/com/txz/mall/dao/MidFavoriteMapper.java

@@ -0,0 +1,7 @@
+package com.txz.mall.dao;
+
+import com.txz.mall.core.Mapper;
+import com.txz.mall.model.MidFavorite;
+
+public interface MidFavoriteMapper extends Mapper<MidFavorite> {
+}

+ 216 - 0
mall-service/src/main/java/com/txz/mall/model/MidFavorite.java

@@ -0,0 +1,216 @@
+package com.txz.mall.model;
+
+import java.util.Date;
+import javax.persistence.*;
+
+@Table(name = "m_mid_favorite")
+public class MidFavorite {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Long id;
+
+    /**
+     * 用户id
+     */
+    @Column(name = "user_id")
+    private Long userId;
+
+    /**
+     * 商品id
+     */
+    @Column(name = "product_id")
+    private Long productId;
+
+    /**
+     * 创建人
+     */
+    @Column(name = "create_user")
+    private String createUser;
+
+    /**
+     * 更新人
+     */
+    @Column(name = "update_user")
+    private String updateUser;
+
+    /**
+     * 更新时间
+     */
+    @Column(name = "update_time")
+    private Date updateTime;
+
+    /**
+     * 创建时间
+     */
+    @Column(name = "create_time")
+    private Date createTime;
+
+    /**
+     * 删除标识 1是0否
+     */
+    @Column(name = "is_valid")
+    private Byte isValid;
+
+    /**
+     * 版本号
+     */
+    private String version;
+
+    /**
+     * @return id
+     */
+    public Long getId() {
+        return id;
+    }
+
+    /**
+     * @param id
+     */
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    /**
+     * 获取用户id
+     *
+     * @return user_id - 用户id
+     */
+    public Long getUserId() {
+        return userId;
+    }
+
+    /**
+     * 设置用户id
+     *
+     * @param userId 用户id
+     */
+    public void setUserId(Long userId) {
+        this.userId = userId;
+    }
+
+    /**
+     * 获取商品id
+     *
+     * @return product_id - 商品id
+     */
+    public Long getProductId() {
+        return productId;
+    }
+
+    /**
+     * 设置商品id
+     *
+     * @param productId 商品id
+     */
+    public void setProductId(Long productId) {
+        this.productId = productId;
+    }
+
+    /**
+     * 获取创建人
+     *
+     * @return create_user - 创建人
+     */
+    public String getCreateUser() {
+        return createUser;
+    }
+
+    /**
+     * 设置创建人
+     *
+     * @param createUser 创建人
+     */
+    public void setCreateUser(String createUser) {
+        this.createUser = createUser;
+    }
+
+    /**
+     * 获取更新人
+     *
+     * @return update_user - 更新人
+     */
+    public String getUpdateUser() {
+        return updateUser;
+    }
+
+    /**
+     * 设置更新人
+     *
+     * @param updateUser 更新人
+     */
+    public void setUpdateUser(String updateUser) {
+        this.updateUser = updateUser;
+    }
+
+    /**
+     * 获取更新时间
+     *
+     * @return update_time - 更新时间
+     */
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    /**
+     * 设置更新时间
+     *
+     * @param updateTime 更新时间
+     */
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    /**
+     * 获取创建时间
+     *
+     * @return create_time - 创建时间
+     */
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    /**
+     * 设置创建时间
+     *
+     * @param createTime 创建时间
+     */
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    /**
+     * 获取删除标识 1是0否
+     *
+     * @return is_valid - 删除标识 1是0否
+     */
+    public Byte getIsValid() {
+        return isValid;
+    }
+
+    /**
+     * 设置删除标识 1是0否
+     *
+     * @param isValid 删除标识 1是0否
+     */
+    public void setIsValid(Byte isValid) {
+        this.isValid = isValid;
+    }
+
+    /**
+     * 获取版本号
+     *
+     * @return version - 版本号
+     */
+    public String getVersion() {
+        return version;
+    }
+
+    /**
+     * 设置版本号
+     *
+     * @param version 版本号
+     */
+    public void setVersion(String version) {
+        this.version = version;
+    }
+}

+ 11 - 0
mall-service/src/main/java/com/txz/mall/service/MidFavoriteService.java

@@ -0,0 +1,11 @@
+package com.txz.mall.service;
+import com.txz.mall.model.MidFavorite;
+import com.txz.mall.core.Service;
+
+
+/**
+ * Created by CodeGenerator on 2025/08/13.
+ */
+public interface MidFavoriteService extends Service<MidFavorite> {
+
+}

+ 22 - 0
mall-service/src/main/java/com/txz/mall/service/impl/MidFavoriteServiceImpl.java

@@ -0,0 +1,22 @@
+package com.txz.mall.service.impl;
+
+import com.txz.mall.dao.MidFavoriteMapper;
+import com.txz.mall.model.MidFavorite;
+import com.txz.mall.service.MidFavoriteService;
+import com.txz.mall.core.AbstractService;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+
+
+/**
+ * Created by CodeGenerator on 2025/08/13.
+ */
+@Service
+@Transactional
+public class MidFavoriteServiceImpl extends AbstractService<MidFavorite> implements MidFavoriteService {
+    @Resource
+    private MidFavoriteMapper mMidFavoriteMapper;
+
+}

+ 130 - 0
mall-service/src/main/java/com/txz/mall/web/mng/MidFavoriteController.java

@@ -0,0 +1,130 @@
+package com.txz.mall.web.mng;
+import com.txz.mall.core.Result;
+import com.txz.mall.model.MidFavorite;
+import com.txz.mall.service.MidFavoriteService;
+
+import com.txz.mall.core.ResultCode;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import tk.mybatis.mapper.entity.Condition;
+import tk.mybatis.mapper.entity.Example.Criteria;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.validation.annotation.Validated;
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.Date;
+
+/**
+* Created by CodeGenerator on 2025/08/13.
+*/
+@Api(tags = "[后台]midFavorite管理")
+@RestController
+@RequestMapping("/mid/favorite")
+public class MidFavoriteController {
+
+	private static Logger log = LoggerFactory.getLogger(MidFavoriteController.class);
+
+    @Resource
+    private MidFavoriteService midFavoriteService;
+
+    @PostMapping("/add")
+	@ApiOperation(value = "midFavorite新增")
+	public Result add(@RequestBody MidFavorite midFavorite) {
+    	if(midFavorite == null){
+    		return Result.fail(ResultCode.OBJECT_IS_NULL);
+    	}
+    	try {
+    		midFavorite.setCreateTime(new Date());
+//            midFavorite.setCreateUserId(userId);
+    		midFavoriteService.save(midFavorite);
+		} catch (Exception e) {
+			log.error("新增对象操作异常e:{}",e);
+			return Result.fail(ResultCode.INTERNAL_SERVER_ERROR);
+		}
+        return Result.success();
+    }
+
+    @DeleteMapping("/delete")
+	@ApiOperation(value = "midFavorite删除")
+	public Result delete(@RequestParam Long id) {
+    	if(id == null){
+    		return Result.fail(ResultCode.ID_IS_NULL);
+    	}
+    	try {
+            MidFavorite midFavorite = new MidFavorite();
+			midFavorite.setId(id);
+			midFavorite.setIsDelete(1);
+			midFavoriteService.update(midFavorite);
+		} catch (Exception e) {
+			log.error("删除对象操作异常e:{}",e);
+			return Result.fail(ResultCode.INTERNAL_SERVER_ERROR);
+		}
+        return Result.success();
+    }
+
+    @PutMapping("/update")
+	@ApiOperation(value = "midFavorite更新")
+	public Result update(@RequestBody MidFavorite midFavorite) {
+    	if(midFavorite == null){
+    		return Result.fail(ResultCode.OBJECT_IS_NULL);
+    	}
+    	if(midFavorite.getId() == null){
+    		return Result.fail(ResultCode.ID_IS_NULL);
+    	}
+    	try {
+    		midFavorite.setUpdateTime(new Date());
+//            midFavorite.setUpdateUserId(userId);
+    		midFavoriteService.update(midFavorite);
+		} catch (Exception e) {
+			log.error("更新对象操作异常e:{}",e);
+			return Result.fail(ResultCode.INTERNAL_SERVER_ERROR);
+		}
+        return Result.success();
+    }
+
+    @GetMapping("/detail")
+	@ApiOperation(value = "midFavorite获取详情")
+	public Result<MidFavorite> detail(@RequestParam Long id) {
+    	if(id == null){
+    		return Result.fail(ResultCode.ID_IS_NULL);
+    	}
+    	MidFavorite midFavorite = null;
+    	try {
+    		midFavorite = midFavoriteService.findById(id);
+		} catch (Exception e) {
+			log.error("查询对象操作异常e:{}",e);
+			return Result.fail(ResultCode.INTERNAL_SERVER_ERROR);
+		}
+        return Result.success(midFavorite);
+    }
+
+    @PostMapping("/list")
+	@ApiOperation(value = "midFavorite获取列表")
+	public Result<List<MidFavorite>> list(@Validated @RequestBody MidFavoriteDTO dto) {
+        PageHelper.startPage(dto.getPage(), dto.getSize());
+
+        Condition condition = new Condition(MidFavorite.class);
+        Criteria criteria = condition.createCriteria();
+		criteria.andEqualTo("isDelete", 0);
+		condition.setOrderByClause("create_time DESC");
+		PageInfo pageInfo = null;
+		try {
+    		 List<MidFavorite> list = midFavoriteService.findByCondition(condition);
+    		 pageInfo = new PageInfo(list);
+		} catch (Exception e) {
+			log.error("查询对象操作异常e:{}",e);
+			return Result.fail(ResultCode.INTERNAL_SERVER_ERROR);
+		}
+        return Result.success(pageInfo);
+    }
+}

+ 18 - 0
mall-service/src/main/resources/mapper/MidFavoriteMapper.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.txz.mall.dao.MidFavoriteMapper">
+  <resultMap id="BaseResultMap" type="com.txz.mall.model.MidFavorite">
+    <!--
+      WARNING - @mbg.generated
+    -->
+    <id column="id" jdbcType="BIGINT" property="id" />
+    <result column="user_id" jdbcType="BIGINT" property="userId" />
+    <result column="product_id" jdbcType="BIGINT" property="productId" />
+    <result column="create_user" jdbcType="VARCHAR" property="createUser" />
+    <result column="update_user" jdbcType="VARCHAR" property="updateUser" />
+    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+    <result column="is_valid" jdbcType="TINYINT" property="isValid" />
+    <result column="version" jdbcType="VARCHAR" property="version" />
+  </resultMap>
+</mapper>