Commit 8e45e3a6 by 裴大威

Merge branch 'feat-1002817' into 'master'

1002817本书配套资料包内资源分类,支持配置分类资源录入

See merge request rays/pcloud-book!680
parents bc129ede 30cc5e69
......@@ -596,16 +596,16 @@ public class AppletHomeFacade {
@GetMapping("getGroupActivity4Applet")
public ResponseDto<?> getGroupActivity4Applet(
@CookieValue("userInfo") String userInfo,
@RequestParam(value = "firstClassify", required = true) Long firstClassify,
@RequestParam(value = "secondClassify", required = false) Long secondClassify,
@RequestParam(value = "gradeLabelId", required = false) Long gradeLabelId,
@RequestParam(value = "subjectLabelId", required = false) Long subjectLabelId
) throws PermissionException {
@RequestParam(value = "adviserId") Long adviserId,
@RequestParam(value = "bookId") Long bookId,
@RequestParam(value = "rightsSettingId") Long rightsSettingId,
@RequestParam(value = "channelId") Long channelId
) {
Long wechatUserId = Cookie.getId(userInfo,Cookie._WECHAT_USER_ID);
if (null == wechatUserId){
throw new BookBizException(BookBizException.PARAM_IS_NULL,"缺少参数");
}
return new ResponseDto<>(pcloudGroupActivityBiz.getGroupActivity4Applet(firstClassify, secondClassify, gradeLabelId, subjectLabelId));
return new ResponseDto<>(pcloudGroupActivityBiz.getGroupActivity4Applet(rightsSettingId, adviserId ,bookId, channelId));
}
}
......
......@@ -752,7 +752,7 @@ public class WechatGroupConsr {
}
}
public void sendMessageToMiniUser(SendMessageDTO sendMessageDTO) {
public void sendMessageToMiniUser( SendMessageDTO sendMessageDTO) {
try {
selfRobotService.sendMessageToMiniUser(sendMessageDTO);
} catch (Exception e) {
......
......@@ -3,6 +3,7 @@ package com.pcloud.book.rightsSetting.biz;
import com.pcloud.book.rightsSetting.dto.FillRightsSettingAppletsDTO;
import com.pcloud.book.rightsSetting.dto.RightsSettingDto;
import com.pcloud.book.rightsSetting.entity.BaseTempletClassify;
import com.pcloud.book.rightsSetting.entity.RightsItemGroup;
import com.pcloud.book.rightsSetting.entity.RightsSetting;
import com.pcloud.book.rightsSetting.entity.RightsSettingClassify;
import com.pcloud.book.rightsSetting.entity.RightsSettingItem;
......@@ -77,9 +78,29 @@ public interface RightsSettingBiz {
*/
List<RightsSettingClassify>getAllRightsClassify(String rightsType);
/**
* @Author David
* @Description 该方法没有补充咨询且会查询所有类型的即可权益,不利于扩展,请使用新方法getRightsSettingRightsNowItemsByType
* @Date 2020/4/25 11:44
* @Param [rightsSettingId, wechatUserId]
* @return com.pcloud.book.rightsSetting.entity.RightsSetting
**/
@Deprecated
RightsSetting getRightsSettingRightsNowItems(Long rightsSettingId, Long wechatUserId);
/**
* @Author David
* @Description 根据权益id和类型获取权益内容
* @Date 2020/4/25 11:44
* @Param [rightsSettingId, wechatUserId, type]
* @return com.pcloud.book.rightsSetting.entity.RightsSetting
**/
RightsSetting getRightsSettingRightsNowItemsByType(Long rightsSettingId, Long wechatUserId, Integer type);
RightsSetting getRightsSettingGiftCoupons(Long rightsSettingId, Long wechatUserId);
FillRightsSettingAppletsDTO getFillRightsSettingApplets(Long rightsSettingId, Long wechatUserId);
FillRightsSettingAppletsDTO getFillRightsSettingApplets(Long rightsSettingId, Long wechatUserId, Long rightsClassifyId,
Integer top);
List<RightsItemGroup> getRightsItemGroups(Long rightsSettingId, Long adviserId, Long bookId, Long channelId, Boolean removeCanNotBuy);
}
package com.pcloud.book.rightsSetting.dao.check;
package com.pcloud.book.rightsSetting.check;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.rightsSetting.entity.RightsItemGroup;
import com.pcloud.book.rightsSetting.entity.RightsNowItem;
import com.pcloud.book.rightsSetting.entity.RightsSetting;
import com.pcloud.common.utils.ListUtils;
......@@ -38,6 +39,27 @@ public class RightsSettingCheck {
throw new BookBizException(BookBizException.PARAM_IS_NULL,"分类为空!");
}
checkRightNowItem(rightsSetting);
checkRightItemGroups(rightsSetting);
}
private void checkRightItemGroups(RightsSetting rightsSetting) {
if (rightsSetting==null||ListUtils.isEmpty(rightsSetting.getRightsItemGroups())){
return;
}
for (RightsItemGroup group: rightsSetting.getRightsItemGroups()){
if (group.getShowState()==null){
throw new BookBizException(BookBizException.PARAM_IS_NULL, "分组是否显示为空!");
}
if (group.getType()==null){
throw new BookBizException(BookBizException.PARAM_IS_NULL, "分组类型为空为空!");
}
if (StringUtil.isEmpty(group.getName())){
throw new BookBizException(BookBizException.PARAM_IS_NULL, "分组名称为空!");
}
if (!ListUtils.isEmpty(group.getRightsNowItems())){
checkRightNowItemApp(group.getRightsNowItems());
}
}
}
private void checkRightNowItem(RightsSetting rightsSetting) {
......@@ -62,11 +84,11 @@ public class RightsSettingCheck {
}
}
private void checkRightNowItemApp(List<RightsNowItem> onlineCourseNowItems) {
if (ListUtils.isEmpty(onlineCourseNowItems)){
private void checkRightNowItemApp(List<RightsNowItem> items) {
if (ListUtils.isEmpty(items)){
return;
}
for (RightsNowItem item : onlineCourseNowItems) {
for (RightsNowItem item : items) {
if (item.getServeId() == null) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "作品或应用id为空!");
}
......
package com.pcloud.book.rightsSetting.constants;
import com.pcloud.common.core.constant.ProductTypeConstant;
import com.pcloud.common.enums.AppTypeEnum;
public class RightsSettingConstant {
/**
......@@ -14,4 +17,16 @@ public class RightsSettingConstant {
* 医疗保健编辑书刊分类id
*/
public static final Long[] MEDICAL_INSURANCE_TEMPLET_ID = {63L};
/**
*小程序不支持展示的应用类型
*/
public static final String[] APPLET_APP_NOT_SUPPORT = {AppTypeEnum.WISH.value, AppTypeEnum.KK.value,
AppTypeEnum.INTERACT.value, AppTypeEnum.MEMBER.value, AppTypeEnum.ENROLL.value};
/**
*小程序不支持展示的商品类型
*/
public static final String[] APPLET_PRODUCT_NOT_SUPPORT = {ProductTypeConstant.QA,ProductTypeConstant.TOOL,
ProductTypeConstant.TUTORIAL,ProductTypeConstant.ATTENDANCE_TASK, ProductTypeConstant.MEMBER,
ProductTypeConstant.THIRDPARTY,ProductTypeConstant.LINK};
}
package com.pcloud.book.rightsSetting.dao;
import com.pcloud.book.rightsSetting.entity.RightsItemGroup;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
/**
* @ClassName com.pcloud.book.rightsSetting.dao.RightsItemGroupDao
* @Author ruansiyuan
* @Description 权益配套资料分组数据层
* @Date 2020/4/26 16:26
* @Version 1.0
**/
public interface RightsItemGroupDao extends BaseDao<RightsItemGroup> {
Integer batchInsert(List<RightsItemGroup> list);
void deleteByRightsSettingId(Long rightsSettingId);
List<RightsItemGroup> getListByRightSettingId(Long rightsSettingId);
}
\ No newline at end of file
......@@ -19,4 +19,6 @@ public interface RightsNowItemDao extends BaseDao<RightsNowItem> {
List<RightsNowItem> getListByRightsSettingId(Long rightsSettingId,List<Integer> types);
List<RightsNowItem> getGiftCouponListByRightsSettingId(Long id);
List<RightsNowItem> getListByGroupIds(List<Long> groupIds);
}
package com.pcloud.book.rightsSetting.dao.impl;
import com.pcloud.book.rightsSetting.dao.RightsItemGroupDao;
import com.pcloud.book.rightsSetting.entity.RightsItemGroup;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @ClassName com.pcloud.book.rightsSetting.dao.impl.RightsItemGroupDaoImpl
* @Author ruansiyuan
* @Description 权益配套资料分组数据实现层
* @Date 2020/4/26 16:27
* @Version 1.0
**/
@Component("rightsItemGroupDao")
public class RightsItemGroupDaoImpl extends BaseDaoImpl<RightsItemGroup> implements RightsItemGroupDao {
@Override
public Integer batchInsert(List<RightsItemGroup> list) {
return super.getSqlSession().insert(getStatement("batchInsert"),list);
}
@Override
public void deleteByRightsSettingId(Long rightsSettingId) {
super.getSqlSession().delete(getStatement("deleteByRightsSettingId"),rightsSettingId);
}
@Override
public List<RightsItemGroup> getListByRightSettingId(Long rightsSettingId) {
return super.getSqlSession().selectList(getStatement("getListByRightSettingId"),rightsSettingId);
}
}
\ No newline at end of file
......@@ -40,4 +40,11 @@ public class RightsNowItemDaoImpl extends BaseDaoImpl<RightsNowItem> implements
map.put("rightsSettingId",rightsSettingId);
return super.getSqlSession().selectList(getStatement("getGiftCouponListByRightsSettingId"),map);
}
@Override
public List<RightsNowItem> getListByGroupIds(List<Long> groupIds) {
Map<String,Object> map=new HashMap<>();
map.put("groupIds",groupIds);
return super.getSqlSession().selectList(getStatement("getListByGroupIds"),map);
}
}
......@@ -32,4 +32,11 @@ public class FillRightsSettingAppletsDTO {
@ApiModelProperty("补充社群共读")
private List<AppletNews> fillGroups;
/**
* @Author David
* @Description 当不需要全部时只获取对应资讯
* @Date 2020/4/24 16:08
**/
private List<AppletNews> designatedNews;
}
package com.pcloud.book.rightsSetting.entity;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @ClassName com.pcloud.book.rightsSetting.entity.RightsItemGroup
* @Author ruansiyuan
* @Description 权益配套资料分组
* @Date 2020/4/26 16:22
* @Version 1.0
**/
@ApiModel("权益配套资料分组")
@Data
public class RightsItemGroup extends BaseEntity {
@ApiModelProperty("权益id")
private Long rightsSettingId;
@ApiModelProperty("分组名称")
private String name;
@ApiModelProperty("是否展示")
private Boolean showState;
@ApiModelProperty("类型:1本书原版资料,2自定义")
private Integer type;
@ApiModelProperty("图片")
private String pic;
@ApiModelProperty("描述1")
private String desc1;
@ApiModelProperty("描述2")
private String desc2;
@ApiModelProperty("描述3")
private String desc3;
@ApiModelProperty("描述集合")
private List<String> descList;
@ApiModelProperty("应用或作品集合")
private List<RightsNowItem> rightsNowItems;
}
\ No newline at end of file
......@@ -2,35 +2,43 @@ package com.pcloud.book.rightsSetting.entity;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* @Description
* @Author ruansiyuan
* @Date 2020/4/19 17:41
**/
@EqualsAndHashCode(callSuper = true)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class RightsNowItem extends BaseEntity {
@ApiModelProperty("权益id")
private Long rightsSettingId;
@ApiModelProperty("应用作品id")
@ApiModelProperty("应用/资讯/作品id")
private Long serveId;
@ApiModelProperty("应用作品类型")
@ApiModelProperty("应用/资讯/作品类型")
private String serveType;
@ApiModelProperty("链接url")
private String linkUrl;
@ApiModelProperty("类型(1线上网课,2学习工具,3抽奖,4专享礼包券)")
@ApiModelProperty("类型(0咨询,1线上网课,2学习工具,3抽奖,4专享礼包券,6配套资料)")
private Integer type;
@ApiModelProperty("专享礼包券id")
private Long giftCouponPackageId;
@ApiModelProperty("应用作品图片")
@ApiModelProperty("应用/资讯/作品图片")
private String servePic;
@ApiModelProperty("应用作品名称")
@ApiModelProperty("应用/资讯/作品名称")
private String serveName;
@ApiModelProperty("应用作品类型名称")
@ApiModelProperty("应用/资讯/作品类型名称")
private String serveTypeName;
@ApiModelProperty("应用作品类型编码")
@ApiModelProperty("应用/资讯/作品类型编码")
private String serveTypeCode;
@ApiModelProperty("结果链接")
private String resultUrl;
......@@ -46,6 +54,16 @@ public class RightsNowItem extends BaseEntity {
private String giftCouponCoverPic;
@ApiModelProperty("专享礼包券领取状态")
private Boolean userGiftReceive;
@ApiModelProperty("权益配套资料分组id")
private Long rightsItemGroupId;
@ApiModelProperty("券类型(2-书币券,1-课程券)")
private Integer couponType;
@ApiModelProperty("使用说明")
private String instructions;
@ApiModelProperty("课程券使用方式(1-链接兑取,2-复制码)")
private Integer useType;
@ApiModelProperty("兑换地址")
private String exchangeAddress;
}
......@@ -86,6 +86,9 @@ public class RightsSetting extends BaseTempletClassify {
*/
private List<RightsSettingItem> rightsSettingLongTermItems;
@ApiModelProperty("权益配套资料分组集合")
private List<RightsItemGroup> rightsItemGroups;
public RightsSetting() {
}
......
package com.pcloud.book.rightsSetting.enums;
public enum RightsItemGroupType {
/**
* 1本书原配套
*/
ORIGINAL(1),
/**
* 2自定义
*/
USER_DEFINED(2);
/**
* 值
*/
public final Integer value;
RightsItemGroupType(Integer value) {
this.value = value;
}
}
......@@ -20,11 +20,10 @@ public enum RightsNowItemType {
GIFT_COUPON_PACKAGE(4),
/**
* 5专享礼包券
* 5社群服务
*/
GROUP_SERVICE(5),
/**
* 6 配套资料
*/
......
......@@ -41,11 +41,7 @@ public interface PcloudGroupActivityBiz {
/**
* 根据分类获取社群共读
* @param firstClassify
* @param secondClassify
* @param gradeLabelId
* @param subjectLabelId
* @return
*/
GroupActivity4AppletDTO getGroupActivity4Applet(Long firstClassify, Long secondClassify, Long gradeLabelId, Long subjectLabelId);
GroupActivity4AppletDTO getGroupActivity4Applet(Long rightSettingId, Long adviserId, Long bookId, Long channelId);
}
......@@ -6,7 +6,9 @@ import com.google.common.collect.Maps;
import com.pcloud.appcenter.assist.dto.AssistTempletDTO;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.book.biz.BookBiz;
import com.pcloud.book.book.dao.BookLabelDao;
import com.pcloud.book.book.dto.BookDto;
import com.pcloud.book.book.entity.BookLabel;
import com.pcloud.book.consumer.app.AssistTempletConsr;
import com.pcloud.book.consumer.label.LabelConsr;
......@@ -18,6 +20,9 @@ import com.pcloud.book.reading.biz.ReadingActivityBiz;
import com.pcloud.book.rightsSetting.biz.RightsSettingBiz;
import com.pcloud.book.rightsSetting.dto.RightsSettingDto;
import com.pcloud.book.rightsSetting.entity.BaseTempletClassify;
import com.pcloud.book.rightsSetting.entity.RightsSettingTitle;
import com.pcloud.book.rightsSetting.enums.RightsNowItemType;
import com.pcloud.book.rightsSetting.mapper.RightsSettingTitleMapper;
import com.pcloud.book.skill.biz.PcloudGroupActivityBiz;
import com.pcloud.book.skill.dao.PcloudGroupActivityDao;
import com.pcloud.book.skill.dao.PcloudSkillDao;
......@@ -46,6 +51,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.UUID;
import org.apache.commons.collections.MapUtils;
......@@ -83,6 +89,10 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
private BookLabelDao bookLabelDao;
@Autowired
private AssistTempletConsr assistTempletConsr;
@Autowired
private BookBiz bookBiz;
@Autowired
private RightsSettingTitleMapper rightsSettingTitleMapper;
@ParamLog("保存共读活动")
@Override
......@@ -276,17 +286,31 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
}
@Override
public GroupActivity4AppletDTO getGroupActivity4Applet(Long firstClassify, Long secondClassify,
Long gradeLabelId, Long subjectLabelId) {
public GroupActivity4AppletDTO getGroupActivity4Applet(Long rightSettingId, Long adviserId, Long bookId, Long channelId) {
BookDto adviserBook = bookBiz.getAdviserBook(bookId, adviserId, channelId);
BookDto dto = Optional.ofNullable(adviserBook).orElseThrow(() -> new BookBizException(BookBizException.ID_NOT_EXIST, "未找到相关书刊"));
// 处理分类和标签
BaseTempletClassify baseTempletClassify = new BaseTempletClassify();
baseTempletClassify.setFirstClassify(dto.getTempletId());
baseTempletClassify.setSecondClassify(dto.getSecondTempletId());
baseTempletClassify.setGradeLabelId(dto.getGraLabelId());
baseTempletClassify.setSubjectLabelId(dto.getSubLabelId());
rightsSettingBiz.setClassifyAndLabel(baseTempletClassify);
Map<String, Object> map = new HashMap<>();
map.put("firstClassify", firstClassify);
map.put("secondClassify", secondClassify);
map.put("gradeLabelId", gradeLabelId);
map.put("subjectLabelId", subjectLabelId);
map.put("firstClassify", baseTempletClassify.getFirstClassify());
map.put("secondClassify", baseTempletClassify.getSecondClassify());
map.put("gradeLabelId", baseTempletClassify.getGradeLabelId());
map.put("subjectLabelId", baseTempletClassify.getSubjectLabelId());
GroupActivity4AppletDTO groupActivity4AppletDTO = pcloudGroupActivityDao.getGroupActivity4Applet(map);
if(groupActivity4AppletDTO == null){
return new GroupActivity4AppletDTO();
}
// 是否开启社群服务开关
RightsSettingTitle right = rightsSettingTitleMapper.getByRightSettingIdAndType(rightSettingId, RightsNowItemType.GROUP_SERVICE.value);
groupActivity4AppletDTO.setOpenStatus(Objects.isNull(right) ? false : right.getOpenState());
groupActivity4AppletDTO.setRightsSettingTitle(right.getRightsSettingTitle());
groupActivity4AppletDTO.setRightsSettingDesc(right.getRightsSettingDesc());
String filterStr = StringUtilParent.replaceHtml(groupActivity4AppletDTO.getDesc());
String subStr = filterStr.length() > 60 ? filterStr.substring(0, 60) + "..." : filterStr;
groupActivity4AppletDTO.setCutDesc(subStr);
......
......@@ -2,6 +2,7 @@ package com.pcloud.book.skill.dto;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.List;
......@@ -17,6 +18,8 @@ public class GroupActivity4AppletDTO implements Serializable {
private Long id;
private Boolean openStatus;
@ApiModelProperty("共读活动id")
private Long groupActivityId;
......@@ -50,4 +53,10 @@ public class GroupActivity4AppletDTO implements Serializable {
@ApiModelProperty("头像列表")
private List<String> headUrlList;
@ApiModelProperty("权益标题")
private String rightsSettingTitle;
@ApiModelProperty("权益描述")
private String rightsSettingDesc;
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<mapper namespace="com.pcloud.book.rightsSetting.dao.impl.RightsItemGroupDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.rightsSetting.entity.RightsItemGroup">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="rightsSettingId" column="rights_setting_id" jdbcType="BIGINT"/>
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="showState" column="show_state" jdbcType="TINYINT"/>
<result property="type" column="type" jdbcType="TINYINT"/>
<result property="pic" column="pic" jdbcType="VARCHAR"/>
<result property="desc1" column="desc1" jdbcType="VARCHAR"/>
<result property="desc2" column="desc2" jdbcType="VARCHAR"/>
<result property="desc3" column="desc3" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id, rights_setting_id, name, show_state, type, pic, desc1, desc2, desc3, create_time
</sql>
<select id="getById" resultMap="BaseResultMap" parameterType="java.lang.Long">
select
<include refid="Base_Column_List"/>
from rights_item_group
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteById" parameterType="long">
delete from rights_item_group
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" parameterType="com.pcloud.book.rightsSetting.entity.RightsItemGroup" useGeneratedKeys="true" keyProperty="id">
insert into rights_item_group
<trim prefix="(" suffix=")" suffixOverrides=",">
rights_setting_id, name, show_state, type, pic, desc1, desc2, desc3, create_time
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{rightsSettingId,jdbcType=BIGINT},
#{name,jdbcType=VARCHAR},
#{showState,jdbcType=TINYINT},
#{type,jdbcType=TINYINT},
#{pic,jdbcType=VARCHAR},
#{desc1,jdbcType=VARCHAR},
#{desc2,jdbcType=VARCHAR},
#{desc3,jdbcType=VARCHAR},
NOW()
</trim>
</insert>
<insert id="batchInsert" parameterType="com.pcloud.book.rightsSetting.entity.RightsItemGroup" useGeneratedKeys="true" keyProperty="id">
insert into rights_item_group (
rights_setting_id, name, show_state, type, pic, desc1, desc2, desc3, create_time
) values
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.rightsSettingId,jdbcType=BIGINT},
#{item.name,jdbcType=VARCHAR},
#{item.showState,jdbcType=TINYINT},
#{item.type,jdbcType=TINYINT},
#{item.pic,jdbcType=VARCHAR},
#{item.desc1,jdbcType=VARCHAR},
#{item.desc2,jdbcType=VARCHAR},
#{item.desc3,jdbcType=VARCHAR},
NOW()
)
</foreach>
</insert>
<delete id="deleteByRightsSettingId" parameterType="long">
delete from rights_item_group
where rights_setting_id=#{rightsSettingId}
</delete>
<select id="getListByRightSettingId" parameterType="long" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from rights_item_group
where rights_setting_id=#{rightsSettingId}
</select>
</mapper>
\ No newline at end of file
......@@ -11,10 +11,11 @@
<result property="type" column="type" jdbcType="BIGINT"/>
<result property="giftCouponPackageId" column="gift_coupon_package_id" jdbcType="BIGINT"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="rightsItemGroupId" column="rights_item_group_id" jdbcType="BIGINT"/>
</resultMap>
<sql id="Base_Column_List">
id, rights_setting_id, serve_id, serve_type, link_url, type, gift_coupon_package_id, create_time
id, rights_setting_id, serve_id, serve_type, link_url, type, gift_coupon_package_id, create_time, rights_item_group_id
</sql>
<select id="getById" resultMap="BaseResultMap" parameterType="java.lang.Long">
......@@ -32,7 +33,7 @@
<insert id="insert" parameterType="com.pcloud.book.rightsSetting.entity.RightsNowItem" useGeneratedKeys="true" keyProperty="id">
insert into rights_now_item
<trim prefix="(" suffix=")" suffixOverrides=",">
rights_setting_id, serve_id, serve_type, link_url, type, gift_coupon_package_id, create_time
rights_setting_id, serve_id, serve_type, link_url, type, gift_coupon_package_id, create_time, rights_item_group_id
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{rightsSettingId,jdbcType=BIGINT},
......@@ -41,13 +42,14 @@
#{linkUrl,jdbcType=VARCHAR},
#{type,jdbcType=INTEGER},
#{giftCouponPackageId,jdbcType=BIGINT},
NOW()
NOW(),
#{rightsItemGroupId,jdbcType=BIGINT}
</trim>
</insert>
<insert id="batchInsert" parameterType="com.pcloud.book.rightsSetting.entity.RightsNowItem" useGeneratedKeys="true" keyProperty="id">
insert into rights_now_item (
rights_setting_id, serve_id, serve_type, link_url, type, gift_coupon_package_id, create_time
rights_setting_id, serve_id, serve_type, link_url, type, gift_coupon_package_id, create_time, rights_item_group_id
) values
<foreach collection="list" item="item" index="index" separator=",">
(
......@@ -57,7 +59,8 @@
#{item.linkUrl,jdbcType=VARCHAR},
#{item.type,jdbcType=INTEGER},
#{item.giftCouponPackageId,jdbcType=BIGINT},
NOW()
NOW(),
#{item.rightsItemGroupId,jdbcType=BIGINT}
)
</foreach>
</insert>
......@@ -94,7 +97,11 @@
t1.cover_pic giftCouponCoverPic,
t1.denomination giftCouponDenomination,
t1.valid_date_begin giftCouponValidDateBegin,
t1.valid_date_end giftCouponValidDateEnd
t1.valid_date_end giftCouponValidDateEnd,
t1.coupon_type couponType,
t1.instructions instructions,
t1.use_type useType,
t1.exchange_address exchangeAddress
FROM
rights_now_item t
INNER JOIN gift_coupon_package t1 ON t.gift_coupon_package_id = t1.id
......@@ -104,4 +111,13 @@
and now() <![CDATA[ <= ]]> t1.valid_date_end
</select>
<select id="getListByGroupIds" parameterType="map" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"/>
from rights_now_item t
where rights_item_group_id in
<foreach collection="groupIds" item="item" open="(" separator="," close=")">
${item}
</foreach>
</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