Commit ef4da83b by 吴博

1002795

parent 088aa326
......@@ -40,15 +40,21 @@ public class RightsSettingCheck {
checkRightNowItem(rightsSetting);
}
private void checkRightNowItem(RightsSetting rightsSetting){
private void checkRightNowItem(RightsSetting rightsSetting) {
if (rightsSetting == null) {
return;
}
checkRightNowItemApp(rightsSetting.getOnlineCourseNowItems());
checkRightNowItemApp(rightsSetting.getLearningToolNowItems());
checkRightNowItemApp(rightsSetting.getDrawNowItems());
if (!ListUtils.isEmpty(rightsSetting.getGiftCouponPackageNowItems())){
for (RightsNowItem item : rightsSetting.getGiftCouponPackageNowItems()) {
if (null != rightsSetting.getOnlineRightsSettingTitle()) {
checkRightNowItemApp(rightsSetting.getOnlineRightsSettingTitle().getRightsSettingItemList());
}
if (null != rightsSetting.getLearningToolTitle()) {
checkRightNowItemApp(rightsSetting.getLearningToolTitle().getRightsSettingItemList());
}
if (null != rightsSetting.getDrawSettingTitle()) {
checkRightNowItemApp(rightsSetting.getDrawSettingTitle().getRightsSettingItemList());
}
if (null != rightsSetting.getGiftCouponPackageTitle() && !ListUtils.isEmpty(rightsSetting.getGiftCouponPackageTitle().getRightsSettingItemList())) {
for (RightsNowItem item : rightsSetting.getGiftCouponPackageTitle().getRightsSettingItemList()) {
if (item.getGiftCouponPackageId() == null) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "专享礼包券id为空!");
}
......
......@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
import java.util.List;
import lombok.Data;
import lombok.NonNull;
@Data
public class RightsSetting extends BaseTempletClassify {
......@@ -33,18 +34,29 @@ public class RightsSetting extends BaseTempletClassify {
@ApiModelProperty("抽奖是否开启")
private Boolean drawNowOpen;
@NonNull
@ApiModelProperty("线上网课集合")
private List<RightsNowItem> onlineCourseNowItems;
private RightsSettingTitle onlineRightsSettingTitle;
@NonNull
@ApiModelProperty("学习工具集合")
private List<RightsNowItem> learningToolNowItems;
private RightsSettingTitle learningToolTitle;
@NonNull
@ApiModelProperty("抽奖集合")
private List<RightsNowItem> drawNowItems;
private RightsSettingTitle drawSettingTitle;
@NonNull
@ApiModelProperty("专享礼包券集合")
private List<RightsNowItem> giftCouponPackageNowItems;
private RightsSettingTitle giftCouponPackageTitle;
@NonNull
@ApiModelProperty("社群集合")
private RightsSettingTitle groupServiceTitle;
@NonNull
@ApiModelProperty("配套资料集合")
private RightsSettingTitle servesTitle;
@ApiModelProperty("启用专享社群服务")
private Integer enableGroupService = 0;
......@@ -73,4 +85,8 @@ public class RightsSetting extends BaseTempletClassify {
* 长期权益
*/
private List<RightsSettingItem> rightsSettingLongTermItems;
public RightsSetting() {
}
}
\ No newline at end of file
package com.pcloud.book.rightsSetting.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
import java.util.List;
import org.springframework.cloud.netflix.ribbon.RibbonHttpRequest;
/**
* @ClassName com.pcloud.book.rightsSetting.entity.RightsSettingNow
* @Author 吴博
* @Description 即享权益
* @Date 2020/4/22 17:07
* @Version 1.0
**/
public class RightsSettingNow {
private Long id;
/**
* 权益id
*/
private Long rightsSettingId;
/**
* 权益分类
*/
private Long rightsClassifyId;
/**
* 权益描述
*/
private String rightsSettingDesc;
/**
* 创建时间
*/
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "GMT+8"
)
private Date createTime;
/**
* 权益标题
*/
private String rightsSettingTitle;
/**
* 列表
*/
private List<RightsSettingItem> rightsSettingItemList;
private Boolean onlineCourseOpen;
}
\ No newline at end of file
package com.pcloud.book.rightsSetting.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
import java.util.List;
import lombok.Data;
@Data
public class RightsSettingTitle {
private Long id;
private Long rightsSettingId;
private String rightsSettingTitle;
private String rightsSettingDesc;
private Boolean openState;
private Integer rightsSettingNowType;
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "GMT+8"
)
private Date createTime;
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "GMT+8"
)
private Date updateTime;
/**
* 列表
*/
private List<RightsNowItem> rightsSettingItemList;
}
\ No newline at end of file
......@@ -17,10 +17,22 @@ public enum RightsNowItemType {
/**
* 4专享礼包券
*/
GIFT_COUPON_PACKAGE(4);
GIFT_COUPON_PACKAGE(4),
/**
* 5专享礼包券
*/
GROUP_SERVICE(5),
/**
* 6 配套资料
*/
SERVES(6);
/**
* 值
*/
public final Integer value;
RightsNowItemType(Integer value) {
......
package com.pcloud.book.rightsSetting.mapper;
import com.pcloud.book.rightsSetting.entity.RightsSettingTitle;
import java.util.List;
import org.springframework.stereotype.Component;
@Component
public interface RightsSettingTitleMapper {
int insert(RightsSettingTitle record);
int insertSelective(RightsSettingTitle record);
void deleteByRightSettingId(Long rightsSettingId);
void batchInsert(List<RightsSettingTitle> rightsSettingTitles);
void batchUpdate(List<RightsSettingTitle> rightsSettingTitles);
List<RightsSettingTitle> getByRightSettingId(Long rightsSettingId);
}
\ No newline at end of file
......@@ -5,7 +5,7 @@
<generatorConfiguration>
<classPathEntry
location="E:\work\respository\mysql\mysql-connector-java\5.1.44\mysql-connector-java-5.1.44.jar"/>
location="D:\maven\repository\mysql\mysql-connector-java\5.1.47\mysql-connector-java-5.1.47.jar"/>
<context id="my" targetRuntime="MyBatis3">
<commentGenerator>
<property name="suppressDate" value="false"/>
......@@ -38,7 +38,7 @@
selectByExampleQueryId="false">
</table>-->
<table tableName="rights_setting" domainObjectName="RightsSetting"
<table tableName="rights_setting_title" domainObjectName="RightsSettingTitle"
enableCountByExample="false" enableUpdateByExample="false"
enableDeleteByExample="false" enableSelectByExample="false"
selectByExampleQueryId="false">
......
<?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.pcloud.book.rightsSetting.mapper.RightsSettingTitleMapper">
<resultMap id="BaseResultMap" type="com.pcloud.book.rightsSetting.entity.RightsSettingTitle">
<result column="id" jdbcType="BIGINT" property="id" />
<result column="rights_setting_id" jdbcType="BIGINT" property="rightsSettingId" />
<result column="rights_setting_title" jdbcType="VARCHAR" property="rightsSettingTitle" />
<result column="rights_setting_desc" jdbcType="VARCHAR" property="rightsSettingDesc" />
<result column="open_state" jdbcType="TINYINT" property="openState" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="rights_setting_now_type" jdbcType="TINYINT" property="rightsSettingNowType" />
</resultMap>
<sql id="baseSql">
id, rights_setting_id, rights_setting_title,
rights_setting_desc, open_state, create_time,
update_time,rights_setting_now_type
</sql>
<insert id="insert" parameterType="com.pcloud.book.rightsSetting.entity.RightsSettingTitle">
insert into rights_setting_title (id, rights_setting_id, rights_setting_title,
rights_setting_desc, open_state, create_time,
update_time,rights_setting_now_type)
values (#{id,jdbcType=BIGINT}, #{rightsSettingId,jdbcType=BIGINT}, #{rightsSettingTitle,jdbcType=VARCHAR},
#{rightsSettingDesc,jdbcType=VARCHAR}, #{openState,jdbcType=TINYINT}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP},#{rightsSettingNowType})
</insert>
<insert id="insertSelective" parameterType="com.pcloud.book.rightsSetting.entity.RightsSettingTitle">
insert into rights_setting_title
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="rightsSettingId != null">
rights_setting_id,
</if>
<if test="rightsSettingTitle != null">
rights_setting_title,
</if>
<if test="rightsSettingDesc != null">
rights_setting_desc,
</if>
<if test="openState != null">
open_state,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="rightsSettingId != null">
#{rightsSettingId,jdbcType=BIGINT},
</if>
<if test="rightsSettingTitle != null">
#{rightsSettingTitle,jdbcType=VARCHAR},
</if>
<if test="rightsSettingDesc != null">
#{rightsSettingDesc,jdbcType=VARCHAR},
</if>
<if test="openState != null">
#{openState,jdbcType=TINYINT},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<delete id="deleteByRightSettingId" parameterType="long">
delete
from
rights_setting_title
where
rights_setting_id = #{rightsSettingId}
</delete>
<insert id="batchInsert" parameterType="com.pcloud.book.rightsSetting.entity.RightsSettingTitle">
insert into rights_setting_title (id, rights_setting_id, rights_setting_title,
rights_setting_desc, open_state, create_time, update_time,rights_setting_now_type)
values
<foreach collection="list" item="item" index="index" separator=",">
(#{item.id,jdbcType=BIGINT}, #{item.rightsSettingId,jdbcType=BIGINT}, #{item.rightsSettingTitle,jdbcType=VARCHAR},
#{item.rightsSettingDesc,jdbcType=VARCHAR}, #{item.openState,jdbcType=TINYINT}, now(), now(),#{item.rightsSettingNowType})
</foreach>
</insert>
<update id="batchUpdate" parameterType="list">
update rights_setting_title
<trim prefix="set" suffixOverrides=",">
<trim prefix="rights_setting_title =case" suffix="end,">
<foreach collection="list" item="item" index="index">
when id=#{item.id} then #{item.rightsSettingTitle}
</foreach>
</trim>
<trim prefix="rights_setting_desc =case" suffix="end,">
<foreach collection="list" item="item" index="index">
when id=#{item.id} then #{item.rightsSettingDesc}
</foreach>
</trim>
<trim prefix="open_state =case" suffix="end,">
<foreach collection="list" item="item" index="index">
when id=#{item.id} then #{item.openState}
</foreach>
</trim>
</trim>
where id in
<foreach collection="list" index="index" item="item" separator="," open="(" close=")">
#{item.id,jdbcType=BIGINT}
</foreach>
</update>
<select id="getByRightSettingId" resultMap="BaseResultMap" parameterType="long">
select
<include refid="baseSql"/>
from
rights_setting_title
where
rights_setting_id = #{rightsSettingId}
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment