提交 8a9aa630 作者: 张小凤 提交者: 余乾开

Banner(update)

上级 b8f775fb
...@@ -33,18 +33,10 @@ public class BannerInfoDO implements Serializable { ...@@ -33,18 +33,10 @@ public class BannerInfoDO implements Serializable {
*/ */
private String bannerImg; private String bannerImg;
/** /**
* banner类型(0无,1海报,2页面 * banner类型(0无,1海报,3 路由 路由(需要授权)等
*/ */
private Integer bannerType; private Integer bannerType;
/** /**
* 商品id
*/
/* private Integer goodsId;*/
/**
* 海报图片url
*/
private String bannerPoster;
/**
* 页面url * 页面url
*/ */
private String bannerUrl; private String bannerUrl;
...@@ -53,10 +45,7 @@ public class BannerInfoDO implements Serializable { ...@@ -53,10 +45,7 @@ public class BannerInfoDO implements Serializable {
*/ */
private String detailInfo; private String detailInfo;
private Integer sort; private Integer sort;
/**
* 富文本内容
*/
private String textContent;
/** /**
* 有效开始时间 * 有效开始时间
*/ */
...@@ -78,25 +67,41 @@ public class BannerInfoDO implements Serializable { ...@@ -78,25 +67,41 @@ public class BannerInfoDO implements Serializable {
public BannerInfoDTO buildBannerInfoDTO(){ public BannerInfoDTO buildBannerInfoDTO(){
Date now = new Date(); Date now = new Date();
return BannerInfoDTO.builder().id(this.id).moduleId(this.moduleId).bannerName(this.bannerName).bannerImg(this.bannerImg) Integer bannerType = this.bannerType;
.bannerPoster(this.bannerPoster).sort(this.sort).using(this.endTime != null ? ( now.before(this.endTime) ? (this.using == 1 ? 1 : 0) : 0 ) : (this.using == 1 ? 1 : 0)) String bannerPoster=null;
.deleted(this.deleted).createTime(this.createTime).bannerType(this.bannerType).bannerUrl(this.bannerUrl).textContent(this.textContent) String textContent=null;
String bannerUrls=null;
if ("1".equals(bannerType.toString())){
bannerPoster = this.bannerUrl;
}else if("11".equals(bannerType.toString())){
textContent=this.bannerUrl;
}else if(!"1".equals(bannerType.toString()) && !"11".equals(bannerType.toString())){
bannerUrls=this.bannerUrl;
}
return BannerInfoDTO.builder()
.id(this.id).moduleId(this.moduleId).bannerName(this.bannerName).bannerImg(this.bannerImg)
.bannerPoster(bannerPoster).sort(this.sort).using(this.endTime != null ? ( now.before(this.endTime) ? (this.using == 1 ? 1 : 0) : 0 ) : (this.using == 1 ? 1 : 0))
.deleted(this.deleted).createTime(this.createTime).bannerType(this.bannerType).bannerUrl(bannerUrls).textContent(textContent)
.detailInfo(this.detailInfo).startTime(this.startTime).endTime(this.endTime).build(); .detailInfo(this.detailInfo).startTime(this.startTime).endTime(this.endTime).build();
} }
public BannerInfoDO(BannerInfoVO bannerInfoVO){ public BannerInfoDO(BannerInfoVO bannerInfoVO){
if ("1".equals(bannerInfoVO.getBannerType().toString())){
this.bannerUrl = bannerInfoVO.getBannerPoster();
}else if("11".equals(bannerInfoVO.getBannerType().toString())){
this.bannerUrl = bannerInfoVO.getTextContent();
}else if(!"1".equals(bannerInfoVO.getBannerType().toString()) && !"11".equals(bannerInfoVO.getBannerType().toString())){
this.bannerUrl = bannerInfoVO.getBannerUrl();
}
this.id = bannerInfoVO.getId(); this.id = bannerInfoVO.getId();
this.moduleId = bannerInfoVO.getModuleId(); this.moduleId = bannerInfoVO.getModuleId();
this.bannerName = bannerInfoVO.getBannerName(); this.bannerName = bannerInfoVO.getBannerName();
this.bannerImg = bannerInfoVO.getBannerImg(); this.bannerImg = bannerInfoVO.getBannerImg();
this.bannerType = bannerInfoVO.getBannerType(); this.bannerType = bannerInfoVO.getBannerType();
this.bannerPoster = bannerInfoVO.getBannerPoster();
this.bannerUrl = bannerInfoVO.getBannerUrl();
this.sort = bannerInfoVO.getSort(); this.sort = bannerInfoVO.getSort();
this.using = bannerInfoVO.getUsing(); this.using = bannerInfoVO.getUsing();
this.detailInfo = bannerInfoVO.getDetailInfo(); this.detailInfo = bannerInfoVO.getDetailInfo();
this.startTime = bannerInfoVO.getStartTime(); this.startTime = bannerInfoVO.getStartTime();
this.endTime = bannerInfoVO.getEndTime(); this.endTime = bannerInfoVO.getEndTime();
this.textContent = bannerInfoVO.getTextContent();
} }
} }
...@@ -128,14 +128,6 @@ public class ModuleInfoServiceImpl implements ModuleInfoService { ...@@ -128,14 +128,6 @@ public class ModuleInfoServiceImpl implements ModuleInfoService {
return ResultBody.error(ResultEnum.EXIST_SAME_NAME_OF_BANNER_ERROR); return ResultBody.error(ResultEnum.EXIST_SAME_NAME_OF_BANNER_ERROR);
} }
BannerInfoDO bannerInfoDO = new BannerInfoDO(bannerInfoVO); BannerInfoDO bannerInfoDO = new BannerInfoDO(bannerInfoVO);
if("0".equals(bannerInfoVO.getBannerType().toString())){
bannerInfoDO.setBannerUrl("");
bannerInfoDO.setBannerPoster("");
}else if("1".equals(bannerInfoVO.getBannerType().toString())){
bannerInfoDO.setBannerUrl("");
}else if("2".equals(bannerInfoVO.getBannerType().toString())){
bannerInfoDO.setBannerPoster("");
}
moduleInfoDao.updateBannerInfo(bannerInfoDO); moduleInfoDao.updateBannerInfo(bannerInfoDO);
return ResultBody.success(); return ResultBody.success();
} }
......
...@@ -19,13 +19,10 @@ ...@@ -19,13 +19,10 @@
<result column="module_id" property="moduleId"/> <result column="module_id" property="moduleId"/>
<result column="banner_name" property="bannerName"/> <result column="banner_name" property="bannerName"/>
<result column="banner_img" property="bannerImg"/> <result column="banner_img" property="bannerImg"/>
<result column="banner_poster" property="bannerPoster"/>
<result column="banner_type" property="bannerType"/> <result column="banner_type" property="bannerType"/>
<result column="goods_id" property="goodsId"/>
<result column="detail_info" property="detailInfo"/> <result column="detail_info" property="detailInfo"/>
<result column="banner_url" property="bannerUrl"/> <result column="banner_url" property="bannerUrl"/>
<result column="sort" property="sort"/> <result column="sort" property="sort"/>
<result column="text_content" property="textContent"/>
<result column="start_time" property="startTime"/> <result column="start_time" property="startTime"/>
<result column="end_time" property="endTime"/> <result column="end_time" property="endTime"/>
<result column="is_using" property="using"/> <result column="is_using" property="using"/>
...@@ -111,8 +108,8 @@ ...@@ -111,8 +108,8 @@
</select> </select>
<select id="listBannerInfoPage" resultMap="bannerInfoResultMap" parameterType="com.mmc.csf.infomation.qo.BannerInfoQO"> <select id="listBannerInfoPage" resultMap="bannerInfoResultMap" parameterType="com.mmc.csf.infomation.qo.BannerInfoQO">
select bi.id,bi.module_id,bi.banner_name,bi.banner_img,bi.banner_poster,bi.banner_type,bi.goods_id,bi.banner_url,bi.sort, select bi.id,bi.module_id,bi.banner_name,bi.banner_img,bi.banner_type,bi.goods_id,bi.banner_url,bi.sort,
bi.start_time,bi.end_time,bi.is_using,bi.is_deleted,bi.create_time,bi.update_time,mi.module_name,bi.detail_info,bi.text_content bi.start_time,bi.end_time,bi.is_using,bi.is_deleted,bi.create_time,bi.update_time,mi.module_name,bi.detail_info
from banner_info bi INNER JOIN module_info mi ON bi.module_id = mi.id from banner_info bi INNER JOIN module_info mi ON bi.module_id = mi.id
where bi.is_deleted = 0 where bi.is_deleted = 0
<if test=" keyword != null and keyword != '' "> <if test=" keyword != null and keyword != '' ">
...@@ -147,8 +144,8 @@ ...@@ -147,8 +144,8 @@
<insert id="insertBannerInfo" useGeneratedKeys="true" <insert id="insertBannerInfo" useGeneratedKeys="true"
keyProperty="id" parameterType="com.mmc.csf.release.entity.module.BannerInfoDO"> keyProperty="id" parameterType="com.mmc.csf.release.entity.module.BannerInfoDO">
insert into banner_info(module_id,banner_name,banner_img,banner_type,goods_id,detail_info,banner_poster,banner_url,start_time,end_time,text_content,sort,is_using,create_time) insert into banner_info(module_id,banner_name,banner_img,banner_type,detail_info,banner_url,start_time,end_time,sort,is_using,create_time)
values(#{moduleId},#{bannerName},#{bannerImg},#{bannerType},#{goodsId},#{detailInfo},#{bannerPoster},#{bannerUrl},#{startTime},#{endTime},#{textContent},#{sort},#{using},NOW()) values(#{moduleId},#{bannerName},#{bannerImg},#{bannerType},#{detailInfo},#{bannerUrl},#{startTime},#{endTime},#{sort},#{using},NOW())
</insert> </insert>
<update id="updateBannerInfo" parameterType="com.mmc.csf.release.entity.module.BannerInfoDO"> <update id="updateBannerInfo" parameterType="com.mmc.csf.release.entity.module.BannerInfoDO">
...@@ -163,27 +160,19 @@ ...@@ -163,27 +160,19 @@
<if test=" bannerImg != null "> <if test=" bannerImg != null ">
banner_img = #{bannerImg}, banner_img = #{bannerImg},
</if> </if>
<if test=" bannerPoster != null ">
banner_poster = #{bannerPoster},
</if>
<if test=" bannerUrl != null "> <if test=" bannerUrl != null ">
banner_url = #{bannerUrl}, banner_url = #{bannerUrl},
</if> </if>
<if test=" bannerType != null "> <if test=" bannerType != null ">
banner_type = #{bannerType}, banner_type = #{bannerType},
</if> </if>
<if test=" goodsId != null ">
goods_id = #{goodsId},
</if>
<if test=" detailInfo != null "> <if test=" detailInfo != null ">
detail_info = #{detailInfo}, detail_info = #{detailInfo},
</if> </if>
<if test=" sort != null "> <if test=" sort != null ">
sort = #{sort}, sort = #{sort},
</if> </if>
<if test=" textContent != null ">
text_content = #{textContent},
</if>
<if test=" using != null "> <if test=" using != null ">
is_using = #{using}, is_using = #{using},
</if> </if>
...@@ -211,8 +200,8 @@ ...@@ -211,8 +200,8 @@
</select> </select>
<select id="listBannerImg" resultMap="bannerInfoResultMap" > <select id="listBannerImg" resultMap="bannerInfoResultMap" >
select bi.id,bi.module_id,bi.banner_name,bi.banner_img,bi.banner_poster,bi.banner_type,bi.goods_id,bi.detail_info, select bi.id,bi.module_id,bi.banner_name,bi.banner_img,bi.banner_type,bi.goods_id,bi.detail_info,
bi.banner_url,bi.start_time,bi.end_time,bi.sort,bi.start_time,bi.end_time,bi.is_using,bi.is_deleted,bi.create_time,bi.update_time,bi.text_content bi.banner_url,bi.start_time,bi.end_time,bi.sort,bi.start_time,bi.end_time,bi.is_using,bi.is_deleted,bi.create_time,bi.update_time
from banner_info bi INNER JOIN module_info mi ON bi.module_id = mi.id from banner_info bi INNER JOIN module_info mi ON bi.module_id = mi.id
where bi.is_deleted = 0 and bi.is_using = 1 where bi.is_deleted = 0 and bi.is_using = 1
and (bi.end_time is null and (bi.end_time is null
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论