Commit 53c6f62d7be7c539513be7e3e67876ed2b9a7bfd
1 parent
a762a89e
表链接内容--删除字段marketId
Showing
7 changed files
with
19 additions
and
47 deletions
etrade-admin/src/main/java/com/diligrp/etrade/admin/dao/BannerContentMapper.java
... | ... | @@ -18,7 +18,7 @@ public interface BannerContentMapper extends MybatisMapperSupport { |
18 | 18 | |
19 | 19 | int updateByPrimaryKey(BannerContent record); |
20 | 20 | |
21 | - BannerContent getByMarketBannerId(BannerContent bannerContent); | |
21 | + BannerContent getByBannerId(BannerContent bannerContent); | |
22 | 22 | |
23 | 23 | int deleteByPrimaryKey(Long id); |
24 | 24 | } | ... | ... |
etrade-admin/src/main/java/com/diligrp/etrade/admin/model/BannerContent.java
... | ... | @@ -30,11 +30,6 @@ public class BannerContent extends BaseDo implements Serializable { |
30 | 30 | private String picUrl; |
31 | 31 | |
32 | 32 | /** |
33 | - * 市场ID | |
34 | - */ | |
35 | - private Long marketId; | |
36 | - | |
37 | - /** | |
38 | 33 | * 自增ID |
39 | 34 | */ |
40 | 35 | public Long getId() { |
... | ... | @@ -90,19 +85,6 @@ public class BannerContent extends BaseDo implements Serializable { |
90 | 85 | this.picUrl = picUrl; |
91 | 86 | } |
92 | 87 | |
93 | - /** | |
94 | - * 市场ID | |
95 | - */ | |
96 | - public Long getMarketId() { | |
97 | - return marketId; | |
98 | - } | |
99 | - | |
100 | - /** | |
101 | - * 市场ID | |
102 | - */ | |
103 | - public void setMarketId(Long marketId) { | |
104 | - this.marketId = marketId; | |
105 | - } | |
106 | 88 | @Override |
107 | 89 | public String toString() { |
108 | 90 | StringBuilder sb = new StringBuilder(); |
... | ... | @@ -113,7 +95,6 @@ public class BannerContent extends BaseDo implements Serializable { |
113 | 95 | sb.append(", bannerId=").append(bannerId); |
114 | 96 | sb.append(", content=").append(content); |
115 | 97 | sb.append(", picUrl=").append(picUrl); |
116 | - sb.append(", marketId=").append(marketId); | |
117 | 98 | sb.append("]"); |
118 | 99 | return sb.toString(); |
119 | 100 | } | ... | ... |
etrade-admin/src/main/java/com/diligrp/etrade/admin/service/BannerContentService.java
... | ... | @@ -14,7 +14,7 @@ public interface BannerContentService { |
14 | 14 | * @param: [bannerId, content, picUrl, marketId] |
15 | 15 | * @return: int |
16 | 16 | **/ |
17 | - int add(Long bannerId, String content, String picUrl, Long marketId); | |
17 | + int add(Long bannerId, String content, String picUrl); | |
18 | 18 | |
19 | 19 | /** |
20 | 20 | * 修改 |
... | ... | @@ -23,12 +23,12 @@ public interface BannerContentService { |
23 | 23 | */ |
24 | 24 | int updateByPrimaryKey(BannerContent bannerContent); |
25 | 25 | /** |
26 | - * @description: 根据 [bannerId, marketId] 能够查询到唯一一条数据 | |
26 | + * @description: 根据 [bannerId] 能够查询到唯一一条数据 | |
27 | 27 | * @date: 2024/9/14 10:57 |
28 | - * @param: [bannerId, marketId] | |
28 | + * @param: [bannerId] | |
29 | 29 | * @return: com.diligrp.etrade.admin.model.BannerContent |
30 | 30 | **/ |
31 | - BannerContent getByMarketBannerId(Long bannerId, Long marketId); | |
31 | + BannerContent getByBannerId(Long bannerId); | |
32 | 32 | |
33 | 33 | /** |
34 | 34 | * @description: 根据主键删除 | ... | ... |
etrade-admin/src/main/java/com/diligrp/etrade/admin/service/impl/BannerContentServiceImpl.java
... | ... | @@ -22,22 +22,20 @@ public class BannerContentServiceImpl implements BannerContentService{ |
22 | 22 | private BannerContentMapper bannerContentMapper; |
23 | 23 | |
24 | 24 | @Override |
25 | - public int add(Long bannerId, String content, String picUrl, Long marketId) { | |
26 | - this.checkParams(bannerId, picUrl, marketId); | |
25 | + public int add(Long bannerId, String content, String picUrl) { | |
26 | + this.checkParams(bannerId, picUrl); | |
27 | 27 | BannerContent bannerContent = new BannerContent(); |
28 | 28 | bannerContent.setBannerId(bannerId); |
29 | 29 | bannerContent.setContent(content); |
30 | 30 | bannerContent.setPicUrl(picUrl); |
31 | - bannerContent.setMarketId(marketId); | |
32 | 31 | int count = bannerContentMapper.insert(bannerContent); |
33 | 32 | Assert.isTrue(count > 0, "轮播图内容新增失败,请稍后重试!"); |
34 | 33 | return count; |
35 | 34 | } |
36 | 35 | |
37 | - private void checkParams(Long bannerId, String content, Long marketId){ | |
36 | + private void checkParams(Long bannerId, String content){ | |
38 | 37 | Assert.notNull(bannerId, "bannerId不能为空!"); |
39 | 38 | Assert.notNull(content, "content不能为空!"); |
40 | - Assert.notNull(marketId, "marketId不能为空!"); | |
41 | 39 | } |
42 | 40 | @Override |
43 | 41 | public int updateByPrimaryKey(BannerContent bannerContent) { |
... | ... | @@ -45,13 +43,11 @@ public class BannerContentServiceImpl implements BannerContentService{ |
45 | 43 | } |
46 | 44 | |
47 | 45 | @Override |
48 | - public BannerContent getByMarketBannerId(Long bannerId, Long marketId) { | |
46 | + public BannerContent getByBannerId(Long bannerId) { | |
49 | 47 | Assert.notNull(bannerId, "bannerId不能为空!"); |
50 | - Assert.notNull(marketId, "marketId不能为空!"); | |
51 | 48 | BannerContent bannerContent = new BannerContent(); |
52 | 49 | bannerContent.setBannerId(bannerId); |
53 | - bannerContent.setMarketId(marketId); | |
54 | - return bannerContentMapper.getByMarketBannerId(bannerContent); | |
50 | + return bannerContentMapper.getByBannerId(bannerContent); | |
55 | 51 | } |
56 | 52 | |
57 | 53 | @Override | ... | ... |
etrade-admin/src/main/java/com/diligrp/etrade/admin/service/impl/BannerServiceImpl.java
... | ... | @@ -99,7 +99,7 @@ public class BannerServiceImpl implements BannerService { |
99 | 99 | BannerVo bannerVo = new BannerVo(); |
100 | 100 | BeanUtils.copyProperties(banner, bannerVo); |
101 | 101 | //查询组装链接内容数据 |
102 | - BannerContent bannerContent = bannerContentService.getByMarketBannerId(banner.getId(), banner.getMarketId()); | |
102 | + BannerContent bannerContent = bannerContentService.getByBannerId(banner.getId()); | |
103 | 103 | if (bannerContent != null){ |
104 | 104 | bannerVo.setLikPicUrl(bannerContent.getPicUrl()); |
105 | 105 | bannerVo.setContent(bannerContent.getContent()); |
... | ... | @@ -121,7 +121,7 @@ public class BannerServiceImpl implements BannerService { |
121 | 121 | int count = bannerMapper.insert(banner); |
122 | 122 | Assert.isTrue(count > 0, "轮播图新增失败,请稍后重试!"); |
123 | 123 | if (bannerCo.getLinkType() != null){ |
124 | - bannerContentService.add(banner.getId(), bannerCo.getContent(), bannerCo.getLinkPicUrl(), banner.getMarketId()); | |
124 | + bannerContentService.add(banner.getId(), bannerCo.getContent(), bannerCo.getLinkPicUrl()); | |
125 | 125 | } |
126 | 126 | return Message.success(); |
127 | 127 | } |
... | ... | @@ -153,12 +153,12 @@ public class BannerServiceImpl implements BannerService { |
153 | 153 | int count = bannerMapper.updateByPrimaryKey(banner); |
154 | 154 | Assert.isTrue(count > 0, "修改失败,请稍后重试!"); |
155 | 155 | //查询原来的 内容设置,并删除,根据新的参数,新增关联内容数据 |
156 | - BannerContent oldBC = bannerContentService.getByMarketBannerId(banner.getId(), banner.getMarketId()); | |
156 | + BannerContent oldBC = bannerContentService.getByBannerId(banner.getId()); | |
157 | 157 | if (oldBC != null){ |
158 | 158 | bannerContentService.deleteByPrimaryKey(oldBC.getId()); |
159 | 159 | } |
160 | 160 | if (bannerCo.getLinkType() != null){ |
161 | - bannerContentService.add(banner.getId(), bannerCo.getContent(), bannerCo.getLinkPicUrl(), banner.getMarketId()); | |
161 | + bannerContentService.add(banner.getId(), bannerCo.getContent(), bannerCo.getLinkPicUrl()); | |
162 | 162 | } |
163 | 163 | return Message.success(); |
164 | 164 | } | ... | ... |
etrade-admin/src/main/resources/com/diligrp/etrade/dao/mapper/BannerContentMapper.xml
... | ... | @@ -9,19 +9,17 @@ |
9 | 9 | <result property="bannerId" column="banner_id" jdbcType="BIGINT"/> |
10 | 10 | <result property="content" column="content" jdbcType="VARCHAR"/> |
11 | 11 | <result property="picUrl" column="pic_url" jdbcType="VARCHAR"/> |
12 | - <result property="marketId" column="market_id" jdbcType="BIGINT"/> | |
13 | 12 | </resultMap> |
14 | 13 | |
15 | 14 | <sql id="Base_Column_List"> |
16 | - id,banner_id,content, | |
17 | - pic_url,market_id | |
15 | + id,banner_id,content,pic_url | |
18 | 16 | </sql> |
19 | 17 | <!--新增数据--> |
20 | 18 | <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.diligrp.etrade.admin.model.BannerContent" useGeneratedKeys="true"> |
21 | 19 | insert into banner_content (banner_id, |
22 | - content, contentcontent, market_id) | |
20 | + content, contentcontent) | |
23 | 21 | values (#{bannerId,jdbcType=BIGINT}, |
24 | - #{content,jdbcType=VARCHAR}, #{picUrl,jdbcType=VARCHAR}, #{marketId,jdbcType=BIGINT}) | |
22 | + #{content,jdbcType=VARCHAR}, #{picUrl,jdbcType=VARCHAR}) | |
25 | 23 | </insert> |
26 | 24 | <!-- 更新数据 --> |
27 | 25 | <update id="updateByPrimaryKey" parameterType="com.diligrp.etrade.admin.model.BannerContent"> |
... | ... | @@ -30,17 +28,15 @@ |
30 | 28 | banner_id = #{bannerId,jdbcType=BIGINT}, |
31 | 29 | content = #{content,jdbcType=VARCHAR}, |
32 | 30 | pic_url = #{picUrl,jdbcType=VARCHAR}, |
33 | - market_id = #{marketId,jdbcType=BIGINT}, | |
34 | 31 | where id = #{id,jdbcType=BIGINT} |
35 | 32 | </update> |
36 | 33 | |
37 | 34 | <!-- 根据市场查询 --> |
38 | - <select id="getByMarketBannerId" resultType="com.diligrp.etrade.admin.model.BannerContent"> | |
35 | + <select id="getByBannerId" resultType="com.diligrp.etrade.admin.model.BannerContent"> | |
39 | 36 | select <include refid="Base_Column_List"/> |
40 | 37 | from banner_content |
41 | 38 | where 1=1 |
42 | 39 | and banner_id = #{bannerId,jdbcType=BIGINT} |
43 | - and market_id = #{marketId,jdbcType=BIGINT} | |
44 | 40 | </select> |
45 | 41 | |
46 | 42 | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> | ... | ... |
scripts/upgrade/v1.0.25/xtrade-order_v20240913.sql
... | ... | @@ -7,7 +7,6 @@ CREATE TABLE `dili_xtrade`.`banner_content` ( |
7 | 7 | `banner_id` bigint DEFAULT NULL COMMENT '轮播图ID', |
8 | 8 | `content` text COMMENT '内容', |
9 | 9 | `pic_url` varchar(255) DEFAULT NULL COMMENT '图片链接', |
10 | - `market_id` bigint NOT NULL COMMENT '市场ID', | |
11 | 10 | PRIMARY KEY (`id`) USING BTREE, |
12 | - UNIQUE INDEX `unq_banner_id`(`banner_id`, `market_id`) USING BTREE | |
11 | + UNIQUE INDEX `unq_banner_id`(`banner_id`) USING BTREE | |
13 | 12 | ) ENGINE=InnoDB ROW_FORMAT=DYNAMIC COMMENT='内容管理-轮播图'; |
14 | 13 | \ No newline at end of file | ... | ... |