| @@ -0,0 +1,145 @@ | |||||
| package com.iformall.domain.po; | |||||
| import cn.afterturn.easypoi.excel.annotation.Excel; | |||||
| import com.baomidou.mybatisplus.annotation.TableField; | |||||
| import com.baomidou.mybatisplus.annotation.TableName; | |||||
| import com.iformall.common.SortColumn; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import lombok.Data; | |||||
| import lombok.EqualsAndHashCode; | |||||
| import lombok.ToString; | |||||
| import java.math.BigDecimal; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| @TableName(value = "tt_coupon") | |||||
| @Data | |||||
| @ToString(callSuper = true) | |||||
| @EqualsAndHashCode(callSuper = true) | |||||
| public class TtCoupon extends TenantEntity { | |||||
| protected Long id; | |||||
| @TableField(exist = false) | |||||
| protected List<Integer> types; | |||||
| @TableField(exist = false) | |||||
| @SortColumn(column = "sale_price") | |||||
| private String salePriceStr; | |||||
| @TableField(exist = false) | |||||
| @SortColumn(column = "orig_price") | |||||
| private String origPriceStr; | |||||
| @TableField(exist = false) | |||||
| @io.swagger.annotations.ApiModelProperty(value="查询-起始时间",name="startdate") | |||||
| private Date startdate; | |||||
| @TableField(exist = false) | |||||
| @io.swagger.annotations.ApiModelProperty(value="查询-结束时间",name="enddate") | |||||
| private Date enddate; | |||||
| @io.swagger.annotations.ApiModelProperty(value="1:专栏2:单课程3:子课程",name="type") | |||||
| private Integer type; | |||||
| @io.swagger.annotations.ApiModelProperty(value="封面图",name="coverImg") | |||||
| private String coverImg; | |||||
| @io.swagger.annotations.ApiModelProperty(value="多封面图",name="coverPicture") | |||||
| private String coverPicture; | |||||
| @io.swagger.annotations.ApiModelProperty(value="详情多图",name="detailPicture") | |||||
| private String detailPicture; | |||||
| @io.swagger.annotations.ApiModelProperty(value="课程名称",name="title") | |||||
| @Excel(name="名称",width = 20,orderNum = "1") | |||||
| private String title; | |||||
| @io.swagger.annotations.ApiModelProperty(value="副标题",name="subTitle") | |||||
| private String subTitle; | |||||
| @io.swagger.annotations.ApiModelProperty(value="",name="videoId") | |||||
| private String videoId; | |||||
| @io.swagger.annotations.ApiModelProperty(value="视频时长(分钟)",name="videoTime") | |||||
| private Integer videoTime; | |||||
| @io.swagger.annotations.ApiModelProperty(value="富文本内容",name="html") | |||||
| private String html; | |||||
| @io.swagger.annotations.ApiModelProperty(value="是否横屏",name="isLandscape") | |||||
| private Integer isLandscape; | |||||
| @io.swagger.annotations.ApiModelProperty(value="是否付费",name="isPayment") | |||||
| private Integer isPayment; | |||||
| @io.swagger.annotations.ApiModelProperty(value="售价",name="salePrice") | |||||
| @Excel(name="售价(分)",width = 20,orderNum = "3") | |||||
| private Integer salePrice; | |||||
| @io.swagger.annotations.ApiModelProperty(value="原价",name="origPrice") | |||||
| private Integer origPrice; | |||||
| @io.swagger.annotations.ApiModelProperty(value="是否可预览",name="isPreview") | |||||
| private Integer isPreview; | |||||
| @io.swagger.annotations.ApiModelProperty(value="预览时长",name="previewDuration") | |||||
| private Integer previewDuration; | |||||
| @io.swagger.annotations.ApiModelProperty(value="须知",name="detail") | |||||
| private String detail; | |||||
| @io.swagger.annotations.ApiModelProperty(value="虚拟售出数",name="falseSellCount") | |||||
| private Integer falseSellCount; | |||||
| @io.swagger.annotations.ApiModelProperty(value="抖音关联标题",name="dyTitle") | |||||
| private String dyTitle; | |||||
| @io.swagger.annotations.ApiModelProperty(value="总库存",name="inventory") | |||||
| private Integer inventory; | |||||
| @io.swagger.annotations.ApiModelProperty(value="购买须知",name="remark") | |||||
| private String remark; | |||||
| @io.swagger.annotations.ApiModelProperty(value="状态",name="status") | |||||
| private Integer status; | |||||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||||
| private Date createDate; | |||||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||||
| private Date updateDate; | |||||
| @io.swagger.annotations.ApiModelProperty(value="浏览数",name="seeCount") | |||||
| private Integer seeCount; | |||||
| @io.swagger.annotations.ApiModelProperty(value="购买数",name="sellCount") | |||||
| private Integer sellCount; | |||||
| @io.swagger.annotations.ApiModelProperty(value="评价数",name="assessCount") | |||||
| private Integer assessCount; | |||||
| @io.swagger.annotations.ApiModelProperty(value="收藏数",name="collectCount") | |||||
| private Integer collectCount; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "是否删除1是0否", name = "isDel") | |||||
| private Integer isDel; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "专栏id(type=3时本表id)", name = "columnId") | |||||
| private Long columnId; | |||||
| @io.swagger.annotations.ApiModelProperty(value="人气",name="popularity") | |||||
| private Integer popularity; | |||||
| @io.swagger.annotations.ApiModelProperty(value="作者",name="merchantId") | |||||
| private Long merchantId; | |||||
| @io.swagger.annotations.ApiModelProperty(value="",name="merchantName") | |||||
| private String merchantName; | |||||
| @io.swagger.annotations.ApiModelProperty(value="业态",name="businessId") | |||||
| private Long businessId; | |||||
| @io.swagger.annotations.ApiModelProperty(value="",name="businessName") | |||||
| private String businessName; | |||||
| @TableField(exist = false) | |||||
| @io.swagger.annotations.ApiModelProperty(value = "审批流参数", name = "columnCoupons") | |||||
| private List<TtCoupon> columnCoupons; | |||||
| public String getSalePriceStr() { | |||||
| if(salePrice!=null) { | |||||
| salePriceStr = new BigDecimal(salePrice).divide(new BigDecimal(100)).toString(); | |||||
| } | |||||
| return salePriceStr; | |||||
| } | |||||
| public String getOrigPriceStr() { | |||||
| if(origPrice!=null) { | |||||
| origPriceStr = new BigDecimal(origPrice).divide(new BigDecimal(100)).toString(); | |||||
| } | |||||
| return origPriceStr; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,38 @@ | |||||
| package com.iformall.mapper; | |||||
| import com.iformall.common.CommonMapper; | |||||
| import com.iformall.domain.po.TtCoupon; | |||||
| import org.apache.ibatis.annotations.Param; | |||||
| import java.util.List; | |||||
| public interface TtCouponMapper extends CommonMapper<TtCoupon, Long> { | |||||
| List<TtCoupon> findList(TtCoupon coupon); | |||||
| TtCoupon selectById(Long id); | |||||
| int deleteById(Long id); | |||||
| /** | |||||
| * 浏览数+1 | |||||
| * @param id | |||||
| * @return | |||||
| */ | |||||
| int addSeeCount(Long id); | |||||
| /** | |||||
| * 购买数+1 | |||||
| * @param id | |||||
| * @return | |||||
| */ | |||||
| int addSellCount(Long id); | |||||
| /** | |||||
| * 购买数-1 | |||||
| * @param id | |||||
| * @return | |||||
| */ | |||||
| int reduceSellCount(Long id); | |||||
| } | |||||
| @@ -0,0 +1,140 @@ | |||||
| <?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.iformall.mapper.TtCouponMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.TtCoupon"> | |||||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||||
| <result column="type" jdbcType="INTEGER" property="type"/> | |||||
| <result column="cover_img" jdbcType="VARCHAR" property="coverImg"/> | |||||
| <result column="cover_picture" jdbcType="VARCHAR" property="coverPicture"/> | |||||
| <result column="detail_picture" jdbcType="VARCHAR" property="detailPicture"/> | |||||
| <result column="title" jdbcType="VARCHAR" property="title"/> | |||||
| <result column="sub_title" jdbcType="VARCHAR" property="subTitle"/> | |||||
| <result column="video_id" jdbcType="VARCHAR" property="videoId"/> | |||||
| <result column="video_time" jdbcType="INTEGER" property="videoTime"/> | |||||
| <result column="html" jdbcType="VARCHAR" property="html"/> | |||||
| <result column="is_landscape" jdbcType="INTEGER" property="isLandscape"/> | |||||
| <result column="is_payment" jdbcType="INTEGER" property="isPayment"/> | |||||
| <result column="sale_price" jdbcType="INTEGER" property="salePrice"/> | |||||
| <result column="orig_price" jdbcType="INTEGER" property="origPrice"/> | |||||
| <result column="is_preview" jdbcType="INTEGER" property="isPreview"/> | |||||
| <result column="preview_duration" jdbcType="INTEGER" property="previewDuration"/> | |||||
| <result column="detail" jdbcType="VARCHAR" property="detail"/> | |||||
| <result column="false_sell_count" jdbcType="INTEGER" property="falseSellCount"/> | |||||
| <result column="dy_title" jdbcType="VARCHAR" property="dyTitle"/> | |||||
| <result column="inventory" jdbcType="INTEGER" property="inventory"/> | |||||
| <result column="remark" jdbcType="VARCHAR" property="remark"/> | |||||
| <result column="status" jdbcType="INTEGER" property="status"/> | |||||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | |||||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||||
| <result column="see_count" jdbcType="INTEGER" property="seeCount"/> | |||||
| <result column="sell_count" jdbcType="INTEGER" property="sellCount"/> | |||||
| <result column="assess_count" jdbcType="INTEGER" property="assessCount"/> | |||||
| <result column="collect_count" jdbcType="INTEGER" property="collectCount"/> | |||||
| <result column="is_del" jdbcType="INTEGER" property="isDel"/> | |||||
| <result column="column_id" jdbcType="BIGINT" property="columnId"/> | |||||
| <result column="popularity" jdbcType="INTEGER" property="popularity"/> | |||||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId"/> | |||||
| <result column="merchant_name" jdbcType="VARCHAR" property="merchantName"/> | |||||
| <result column="business_id" jdbcType="BIGINT" property="businessId"/> | |||||
| <result column="business_name" jdbcType="VARCHAR" property="businessName"/> | |||||
| </resultMap> | |||||
| <sql id="allColumns"> | |||||
| `id`, `tenant_id`, `parent_tenant_id`, `type`, `cover_img`, `cover_picture`, `detail_picture`, | |||||
| `title`, `sub_title`, `video_id`, `video_time`, `html`, `is_landscape`, `is_payment`, | |||||
| `sale_price`, `orig_price`, `is_preview`, `preview_duration`, `detail`, `false_sell_count`, | |||||
| `dy_title`, `inventory`, `remark`, `status`, `create_date`, `update_date`, | |||||
| `see_count`, `sell_count`, `assess_count`, `collect_count`, `is_del`, | |||||
| `column_id`, `popularity`, `merchant_id`, `merchant_name`, `business_id`, `business_name` | |||||
| </sql> | |||||
| <sql id="dynamicWhereConditions"> | |||||
| where `is_del` = 0 | |||||
| <if test=" null != id "> | |||||
| and `id` = #{id} | |||||
| </if> | |||||
| <if test=" null != tenantId and '' != tenantId"> | |||||
| and `tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||||
| and `parent_tenant_id` = #{parentTenantId} | |||||
| </if> | |||||
| <if test=" null != type "> | |||||
| and `type` = #{type} | |||||
| </if> | |||||
| <if test=" null != title and ''!=title"> | |||||
| and `title` like concat('%', #{title},'%') | |||||
| </if> | |||||
| <if test=" null != isLandscape "> | |||||
| and `is_landscape` = #{isLandscape} | |||||
| </if> | |||||
| <if test=" null != isPayment "> | |||||
| and `is_payment` = #{isPayment} | |||||
| </if> | |||||
| <if test=" null != isPreview "> | |||||
| and `is_preview` = #{isPreview} | |||||
| </if> | |||||
| <if test=" null != status"> | |||||
| and `status` = #{status} | |||||
| </if> | |||||
| <if test=" null != startdate and null!=enddate"> | |||||
| and `create_date` between #{startdate} and #{enddate} | |||||
| </if> | |||||
| <if test=" null != businessId "> | |||||
| and `business_id` = #{businessId} | |||||
| </if> | |||||
| <if test=" null != merchantId "> | |||||
| and `merchant_id` = #{merchantId} | |||||
| </if> | |||||
| <if test=" null != ids "> | |||||
| and id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||||
| </sql> | |||||
| <select id="findList" parameterType="com.iformall.domain.po.TtCoupon" resultMap="BaseResultMap"> | |||||
| select | |||||
| <include refid="allColumns"/> | |||||
| from tt_coupon | |||||
| <include refid="dynamicWhereConditions"/> | |||||
| </select> | |||||
| <select id="selectById" parameterType="Long" resultMap="BaseResultMap"> | |||||
| select <include refid="allColumns"/> from tt_coupon where id = #{id} | |||||
| </select> | |||||
| <delete id="deleteById" parameterType="Long"> | |||||
| update tt_coupon set is_del = 1, update_date=now() where id = #{id} | |||||
| </delete> | |||||
| <update id="addSeeCount" parameterType="Long"> | |||||
| update tt_coupon SET see_count = see_count+1, update_date=now() where id = #{id} | |||||
| </update> | |||||
| <update id="addSellCount" parameterType="Long"> | |||||
| update tt_coupon SET sell_count = sell_count+1, false_sell_count = false_sell_count+1, update_date=now() where id = #{id} | |||||
| </update> | |||||
| <update id="reduceSellCount" parameterType="Long"> | |||||
| update tt_coupon SET sell_count = sell_count-1, update_date=now() where id = #{id} | |||||
| </update> | |||||
| </mapper> | |||||
| @@ -1,5 +1,5 @@ | |||||
| server: | server: | ||||
| port: 9001 | |||||
| port: 9002 | |||||
| servlet: | servlet: | ||||
| context-path: / | context-path: / | ||||