💩 产品模块代码

This commit is contained in:
ronger 2022-06-21 08:32:11 +08:00
parent 0fc7503e65
commit c07007ea8d
6 changed files with 184 additions and 2 deletions

View File

@ -0,0 +1,58 @@
package com.rymcu.forest.entity;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
/**
* Created on 2022/6/13 21:42.
*
* @author ronger
* @email ronger-x@outlook.com
* @desc : 产品表
*/
@Data
@Table(name = "forest_product")
public class Product implements Serializable, Cloneable {
/**
* 主键
*/
@Id
@GeneratedValue(generator = "JDBC")
private Integer id;
/**
* 产品名
*/
private String productTitle;
/**
* 单价(单位:)
*/
private Integer productPrice;
/**
* 产品主图
*/
private String productImgUrl;
/**
* 产品描述
*/
private String productDescription;
/**
* 权重;数值越小权限越大;0:无权限
*/
private Integer weights;
/**
* 创建时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date createdTime;
/**
* 更新时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date updatedTime;
}

View File

@ -0,0 +1,42 @@
package com.rymcu.forest.entity;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
/**
* Created on 2022/6/13 21:51.
*
* @author ronger
* @email ronger-x@outlook.com
* @desc : 产品详情表
*/
@Data
@Table(name = "forest_product_content")
public class ProductContent implements Serializable, Cloneable {
/**
* 产品表主键
*/
private Integer idProduct;
/**
* 产品详情原文
*/
private String productContent;
/**
* 产品详情;Html
*/
private String productContentHtml;
/**
* 创建时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date createdTime;
/**
* 更新时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date updatedTime;
}

View File

@ -3,8 +3,6 @@ package com.rymcu.forest.lucene.service.impl;
import com.rymcu.forest.dto.ArticleDTO;
import com.rymcu.forest.dto.ArticleTagDTO;
import com.rymcu.forest.dto.Author;
import com.rymcu.forest.dto.PortfolioArticleDTO;
import com.rymcu.forest.entity.ArticleContent;
import com.rymcu.forest.entity.User;
import com.rymcu.forest.lucene.lucene.ArticleBeanIndex;
import com.rymcu.forest.lucene.lucene.IKAnalyzer;

View File

@ -0,0 +1,22 @@
package com.rymcu.forest.mapper;
import com.rymcu.forest.core.mapper.Mapper;
import com.rymcu.forest.entity.Product;
import org.apache.ibatis.annotations.Param;
/**
* Created on 2022/6/13 21:53.
*
* @author ronger
* @email ronger-x@outlook.com
*/
public interface ProductMapper extends Mapper<Product> {
/**
* 保存产品详情
* @param idProduct
* @param productContent
* @param productContentHtml
* @return
*/
Integer insertProductContent(@Param("idProduct") Integer idProduct, @Param("productContent") String productContent, @Param("productContentHtml") String productContentHtml);
}

View File

@ -0,0 +1,46 @@
package com.rymcu.forest.web.api.admin;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.rymcu.forest.core.result.GlobalResult;
import com.rymcu.forest.core.result.GlobalResultGenerator;
import com.rymcu.forest.dto.TransactionRecordDTO;
import com.rymcu.forest.entity.CurrencyRule;
import com.rymcu.forest.service.CurrencyRuleService;
import com.rymcu.forest.util.Utils;
import org.springframework.web.bind.annotation.GetMapping;
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;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created on 2022/3/6 18:26.
*
* @author ronger
* @email ronger-x@outlook.com
*/
@RestController
@RequestMapping("/api/v1/admin/rule/currency")
public class AdminCurrencyRuleController {
@Resource
private CurrencyRuleService currencyRuleService;
@GetMapping("/list")
public GlobalResult list(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "20") Integer rows, HttpServletRequest request) {
PageHelper.startPage(page, rows);
List<CurrencyRule> list = currencyRuleService.findAll();
Map map = new HashMap(2);
PageInfo<TransactionRecordDTO> pageInfo = new PageInfo(list);
map.put("rules", pageInfo.getList());
Map pagination = Utils.getPagination(pageInfo);
map.put("pagination", pagination);
return GlobalResultGenerator.genSuccessResult(map);
}
}

View File

@ -0,0 +1,16 @@
<?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.rymcu.forest.mapper.ProductMapper">
<insert id="insertProductContent">
insert into forest_product_content(id_product,
product_content,
product_content_html,
created_time,
updated_time)
values (#{idProduct},
#{productContent},
#{productContentHtml},
sysdate(),
sysdate())
</insert>
</mapper>