Commit f318719c3134c36ede45c1efba6c57ad7b49109c
1 parent
ec7f8a5d
Exists in
master
渠道商后台
Showing
38 changed files
with
1736 additions
and
3 deletions
Show diff stats
src/main/java/com/sincere/wechatbusiness/WechatBusinessApplication.java
@@ -7,7 +7,7 @@ import org.springframework.cache.annotation.EnableCaching; | @@ -7,7 +7,7 @@ import org.springframework.cache.annotation.EnableCaching; | ||
7 | 7 | ||
8 | @EnableCaching | 8 | @EnableCaching |
9 | @SpringBootApplication | 9 | @SpringBootApplication |
10 | -@MapperScan("com.sincere.report.mapper") | 10 | +@MapperScan("com.sincere.wechatbusiness.mapper") |
11 | public class WechatBusinessApplication { | 11 | public class WechatBusinessApplication { |
12 | 12 | ||
13 | public static void main(String[] args) { | 13 | public static void main(String[] args) { |
src/main/java/com/sincere/wechatbusiness/controller/ChannelController.java
0 → 100644
@@ -0,0 +1,263 @@ | @@ -0,0 +1,263 @@ | ||
1 | +package com.sincere.wechatbusiness.controller; | ||
2 | + | ||
3 | +import com.alibaba.fastjson.JSON; | ||
4 | +import com.alibaba.fastjson.JSONObject; | ||
5 | +import com.alibaba.fastjson.TypeReference; | ||
6 | +import com.sincere.wechatbusiness.dto.BaseDto; | ||
7 | +import com.sincere.wechatbusiness.dto.ChannelDto; | ||
8 | +import com.sincere.wechatbusiness.model.*; | ||
9 | +import com.sincere.wechatbusiness.service.*; | ||
10 | +import com.sincere.wechatbusiness.utils.Page; | ||
11 | +import io.swagger.annotations.ApiOperation; | ||
12 | +import org.bouncycastle.jcajce.provider.symmetric.util.BaseWrapCipher; | ||
13 | +import org.springframework.beans.factory.annotation.Autowired; | ||
14 | +import org.springframework.web.bind.annotation.RequestBody; | ||
15 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
16 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
17 | +import org.springframework.web.bind.annotation.RestController; | ||
18 | + | ||
19 | +import java.io.BufferedReader; | ||
20 | +import java.io.InputStreamReader; | ||
21 | +import java.net.URL; | ||
22 | +import java.net.URLConnection; | ||
23 | +import java.util.List; | ||
24 | +import java.util.Map; | ||
25 | + | ||
26 | +@RestController | ||
27 | +public class ChannelController { | ||
28 | + @Autowired | ||
29 | + ChannelService channelService; | ||
30 | + | ||
31 | + @Autowired | ||
32 | + ChannelProductService channelProductService; | ||
33 | + | ||
34 | + @Autowired | ||
35 | + BannerService bannerService; | ||
36 | + | ||
37 | + @Autowired | ||
38 | + AttentionService attentionService; | ||
39 | + | ||
40 | + @Autowired | ||
41 | + CatalogService catalogService; | ||
42 | + | ||
43 | + @Autowired | ||
44 | + CatalogContentService catalogContentService; | ||
45 | + | ||
46 | + @RequestMapping(value = "GetChannelList",method = RequestMethod.POST) | ||
47 | + @ApiOperation(value = "获取渠道商列表") | ||
48 | + public BaseDto<Page<Channel>> GetChannelList(@RequestBody ChannelDto channelDto){ | ||
49 | + BaseDto<Page<Channel>> result=new BaseDto<>(); | ||
50 | + Channel channel=new Channel(); | ||
51 | + channel.setName(channelDto.getName()); | ||
52 | + channel.setState(1); | ||
53 | + result.setData(channelService.getList(channel,channelDto.getPage(),channelDto.getPageSize())); | ||
54 | + return result; | ||
55 | + } | ||
56 | + | ||
57 | + @RequestMapping(value = "GetPackageList",method = RequestMethod.POST) | ||
58 | + @ApiOperation(value = "获取代理商品列表") | ||
59 | + public BaseDto<List<DiscountPackage>> GetPackageList(){ | ||
60 | + BaseDto<List<DiscountPackage>> result=new BaseDto<>(); | ||
61 | + String r=Get("https://mytest.myjxt.com:51314/University/getPackageList",""); | ||
62 | + JSONObject jsonObject= JSONObject.parseObject(r); | ||
63 | + String data = jsonObject.getString("data"); | ||
64 | + List<DiscountPackage> list=JSON.parseObject(data,new TypeReference<List<DiscountPackage>>(){}); | ||
65 | + result.setData(list); | ||
66 | + return result; | ||
67 | + } | ||
68 | + | ||
69 | + @RequestMapping(value = "AddChannel",method = RequestMethod.POST) | ||
70 | + @ApiOperation(value = "新增渠道商") | ||
71 | + public BaseDto AddChannel(@RequestBody Channel channel){ | ||
72 | + channelService.insert(channel); | ||
73 | + if(channel.getChannelProductList()!=null&&channel.getChannelProductList().size()>0) { | ||
74 | + for(ChannelProduct channelProduct:channel.getChannelProductList()){ | ||
75 | + channelProduct.setChannelId(channel.getId()); | ||
76 | + channelProductService.insert(channelProduct); | ||
77 | + } | ||
78 | + } | ||
79 | + return new BaseDto(); | ||
80 | + } | ||
81 | + | ||
82 | + @RequestMapping(value = "GetChannelDetail",method = RequestMethod.GET) | ||
83 | + @ApiOperation(value = "获取渠道商详情") | ||
84 | + public BaseDto<Channel> GetChannelDetail(int id){ | ||
85 | + BaseDto<Channel> result=new BaseDto<>(); | ||
86 | + Channel channel=channelService.getDetail(id); | ||
87 | + channel.setChannelProductList(channelProductService.getList(id)); | ||
88 | + result.setData(channel); | ||
89 | + return result; | ||
90 | + } | ||
91 | + | ||
92 | + @RequestMapping(value = "UpdateChannel",method = RequestMethod.POST) | ||
93 | + @ApiOperation(value = "编辑渠道商") | ||
94 | + public BaseDto UpdateChannel(@RequestBody Channel channel){ | ||
95 | + channelService.update(channel); | ||
96 | + if(channel.getChannelProductList()!=null&&channel.getChannelProductList().size()>0){ | ||
97 | + channelProductService.deleteChannelProduct(channel.getId()); | ||
98 | + for (ChannelProduct channelProduct:channel.getChannelProductList()){ | ||
99 | + channelProduct.setChannelId(channel.getId()); | ||
100 | + channelProductService.insert(channelProduct); | ||
101 | + } | ||
102 | + } | ||
103 | + return new BaseDto(); | ||
104 | + } | ||
105 | + | ||
106 | + @RequestMapping(value = "DeleteChannel",method = RequestMethod.GET) | ||
107 | + @ApiOperation(value = "删除渠道商") | ||
108 | + public BaseDto DeleteChannel(int id){ | ||
109 | + channelService.deleteChannel(id); | ||
110 | + return new BaseDto(); | ||
111 | + } | ||
112 | + | ||
113 | + @RequestMapping(value = "UpdateChannelProduct",method = RequestMethod.POST) | ||
114 | + @ApiOperation(value = "编辑代理商品") | ||
115 | + public BaseDto UpdateChannelProduct(@RequestBody ChannelProduct channelProduct){ | ||
116 | + channelProductService.update(channelProduct); | ||
117 | + return new BaseDto(); | ||
118 | + } | ||
119 | + | ||
120 | + @RequestMapping(value = "GetBannerList",method = RequestMethod.GET) | ||
121 | + @ApiOperation(value = "获取Banner轮播图列表") | ||
122 | + public BaseDto<List<Banner>> GetBannerList(int id){ | ||
123 | + BaseDto<List<Banner>> result=new BaseDto<>(); | ||
124 | + result.setData(bannerService.getList(id)); | ||
125 | + return result; | ||
126 | + } | ||
127 | + | ||
128 | + @RequestMapping(value = "AddBanner",method = RequestMethod.POST) | ||
129 | + @ApiOperation(value = "添加Banner轮播图") | ||
130 | + public BaseDto AddBanner(@RequestBody Banner banner){ | ||
131 | + bannerService.insert(banner); | ||
132 | + return new BaseDto(); | ||
133 | + } | ||
134 | + | ||
135 | + @RequestMapping(value = "UpdateBanner",method = RequestMethod.POST) | ||
136 | + @ApiOperation(value = "编辑Banner轮播图") | ||
137 | + public BaseDto UpdateBanner(@RequestBody Banner banner){ | ||
138 | + bannerService.update(banner); | ||
139 | + return new BaseDto(); | ||
140 | + } | ||
141 | + | ||
142 | + @RequestMapping(value = "DeleteBanner",method = RequestMethod.GET) | ||
143 | + @ApiOperation(value = "删除Banner轮播图") | ||
144 | + public BaseDto DeleteBanner(int id){ | ||
145 | + bannerService.deleteBanner(id); | ||
146 | + return new BaseDto(); | ||
147 | + } | ||
148 | + | ||
149 | + @RequestMapping(value = "GetAttention",method = RequestMethod.GET) | ||
150 | + @ApiOperation(value = "获取关注配置") | ||
151 | + public BaseDto<Attention> GetAttention(int id){ | ||
152 | + BaseDto<Attention> result=new BaseDto<>(); | ||
153 | + result.setData(attentionService.getDetail(id)); | ||
154 | + return result; | ||
155 | + } | ||
156 | + | ||
157 | + @RequestMapping(value = "AddAttention",method = RequestMethod.POST) | ||
158 | + @ApiOperation(value = "添加关注配置") | ||
159 | + public BaseDto AddAttention(@RequestBody Attention attention){ | ||
160 | + attentionService.insert(attention); | ||
161 | + return new BaseDto(); | ||
162 | + } | ||
163 | + | ||
164 | + @RequestMapping(value = "UpdateAttention",method = RequestMethod.POST) | ||
165 | + @ApiOperation(value = "编辑关注配置") | ||
166 | + public BaseDto UpdateAttention(@RequestBody Attention attention){ | ||
167 | + attentionService.update(attention); | ||
168 | + return new BaseDto(); | ||
169 | + } | ||
170 | + | ||
171 | + @RequestMapping(value = "GetCatalog",method = RequestMethod.GET) | ||
172 | + @ApiOperation(value = "获取栏目") | ||
173 | + public BaseDto<Catalog> GetCatalog(int channelId,int sort){ | ||
174 | + BaseDto<Catalog> result=new BaseDto<>(); | ||
175 | + Catalog catalog=new Catalog(); | ||
176 | + catalog.setChannelId(channelId); | ||
177 | + catalog.setSort(sort); | ||
178 | + catalog=catalogService.getDetail(catalog); | ||
179 | + catalog.setCatalogContentList(catalogContentService.getList(catalog.getId())); | ||
180 | + result.setData(catalog); | ||
181 | + return result; | ||
182 | + } | ||
183 | + | ||
184 | + @RequestMapping(value = "AddCatalog",method = RequestMethod.POST) | ||
185 | + @ApiOperation(value = "新增栏目") | ||
186 | + public BaseDto AddCatalog(@RequestBody Catalog catalog){ | ||
187 | + catalogService.insert(catalog); | ||
188 | + return new BaseDto(); | ||
189 | + } | ||
190 | + | ||
191 | + @RequestMapping(value = "UpdateCatalog",method = RequestMethod.POST) | ||
192 | + @ApiOperation(value = "编辑栏目") | ||
193 | + public BaseDto UpdateCatalog(@RequestBody Catalog catalog){ | ||
194 | + catalogService.update(catalog); | ||
195 | + return new BaseDto(); | ||
196 | + } | ||
197 | + | ||
198 | + @RequestMapping(value = "AddCatalogContent",method = RequestMethod.POST) | ||
199 | + @ApiOperation(value = "新增栏目内容") | ||
200 | + public BaseDto AddCatalogContent(@RequestBody CatalogContent catalogContent){ | ||
201 | + catalogContentService.insert(catalogContent); | ||
202 | + return new BaseDto(); | ||
203 | + } | ||
204 | + | ||
205 | + @RequestMapping(value = "UpdateCatalogContent",method = RequestMethod.POST) | ||
206 | + @ApiOperation(value = "编辑栏目内容") | ||
207 | + public BaseDto UpdateCatalogContent(@RequestBody CatalogContent catalogContent){ | ||
208 | + catalogContentService.update(catalogContent); | ||
209 | + return new BaseDto(); | ||
210 | + } | ||
211 | + | ||
212 | + @RequestMapping(value = "DeleteCatalogContent",method = RequestMethod.GET) | ||
213 | + @ApiOperation(value = "删除栏目内容") | ||
214 | + public BaseDto DeleteCatalogContent(int id){ | ||
215 | + catalogContentService.deleteCatalogContent(id); | ||
216 | + return new BaseDto(); | ||
217 | + } | ||
218 | + | ||
219 | + public String Get(String url, String param) { | ||
220 | + String result = ""; | ||
221 | + BufferedReader in = null; | ||
222 | + try { | ||
223 | + String urlNameString = url + "?" + param; | ||
224 | + URL realUrl = new URL(urlNameString); | ||
225 | + // 打开和URL之间的连接 | ||
226 | + URLConnection connection = realUrl.openConnection(); | ||
227 | + // 设置通用的请求属性 | ||
228 | + connection.setRequestProperty("accept", "*/*"); | ||
229 | + connection.setRequestProperty("connection", "Keep-Alive"); | ||
230 | + connection.setRequestProperty("user-agent", | ||
231 | + "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); | ||
232 | + // 建立实际的连接 | ||
233 | + connection.connect(); | ||
234 | + // 获取所有响应头字段 | ||
235 | + Map<String, List<String>> map = connection.getHeaderFields(); | ||
236 | + // 遍历所有的响应头字段 | ||
237 | + for (String key : map.keySet()) { | ||
238 | + System.out.println(key + "--->" + map.get(key)); | ||
239 | + } | ||
240 | + // 定义 BufferedReader输入流来读取URL的响应 | ||
241 | + in = new BufferedReader(new InputStreamReader( | ||
242 | + connection.getInputStream())); | ||
243 | + String line; | ||
244 | + while ((line = in.readLine()) != null) { | ||
245 | + result += line; | ||
246 | + } | ||
247 | + } catch (Exception e) { | ||
248 | + System.out.println("发送GET请求出现异常!" + e); | ||
249 | + e.printStackTrace(); | ||
250 | + } | ||
251 | + // 使用finally块来关闭输入流 | ||
252 | + finally { | ||
253 | + try { | ||
254 | + if (in != null) { | ||
255 | + in.close(); | ||
256 | + } | ||
257 | + } catch (Exception e2) { | ||
258 | + e2.printStackTrace(); | ||
259 | + } | ||
260 | + } | ||
261 | + return result; | ||
262 | + } | ||
263 | +} |
src/main/java/com/sincere/wechatbusiness/dto/BaseDto.java
0 → 100644
@@ -0,0 +1,43 @@ | @@ -0,0 +1,43 @@ | ||
1 | +package com.sincere.wechatbusiness.dto; | ||
2 | + | ||
3 | +import io.swagger.annotations.ApiModel; | ||
4 | +import io.swagger.annotations.ApiModelProperty; | ||
5 | + | ||
6 | +@ApiModel | ||
7 | +public class BaseDto<T> { | ||
8 | + | ||
9 | + @ApiModelProperty(value = "接口成功与否") | ||
10 | + private boolean success ; | ||
11 | + @ApiModelProperty(value = "错误信息") | ||
12 | + private String message ; | ||
13 | + @ApiModelProperty(value = "数据") | ||
14 | + private T data ; | ||
15 | + | ||
16 | + public boolean isSuccess() { | ||
17 | + return success; | ||
18 | + } | ||
19 | + | ||
20 | + public void setSuccess(boolean success) { | ||
21 | + this.success = success; | ||
22 | + } | ||
23 | + | ||
24 | + public String getMessage() { | ||
25 | + return message; | ||
26 | + } | ||
27 | + | ||
28 | + public void setMessage(String message) { | ||
29 | + this.message = message; | ||
30 | + } | ||
31 | + | ||
32 | + public T getData() { | ||
33 | + return data; | ||
34 | + } | ||
35 | + | ||
36 | + public void setData(T data) { | ||
37 | + this.data = data; | ||
38 | + } | ||
39 | + | ||
40 | + public BaseDto() { | ||
41 | + this.success = true ; | ||
42 | + } | ||
43 | +} |
src/main/java/com/sincere/wechatbusiness/dto/ChannelDto.java
0 → 100644
@@ -0,0 +1,33 @@ | @@ -0,0 +1,33 @@ | ||
1 | +package com.sincere.wechatbusiness.dto; | ||
2 | + | ||
3 | +public class ChannelDto { | ||
4 | + private String name; | ||
5 | + | ||
6 | + private Integer page; | ||
7 | + | ||
8 | + private Integer pageSize; | ||
9 | + | ||
10 | + public String getName() { | ||
11 | + return name; | ||
12 | + } | ||
13 | + | ||
14 | + public void setName(String name) { | ||
15 | + this.name = name; | ||
16 | + } | ||
17 | + | ||
18 | + public Integer getPage() { | ||
19 | + return page; | ||
20 | + } | ||
21 | + | ||
22 | + public void setPage(Integer page) { | ||
23 | + this.page = page; | ||
24 | + } | ||
25 | + | ||
26 | + public Integer getPageSize() { | ||
27 | + return pageSize; | ||
28 | + } | ||
29 | + | ||
30 | + public void setPageSize(Integer pageSize) { | ||
31 | + this.pageSize = pageSize; | ||
32 | + } | ||
33 | +} |
src/main/java/com/sincere/wechatbusiness/mapper/AttentionMapper.java
0 → 100644
@@ -0,0 +1,11 @@ | @@ -0,0 +1,11 @@ | ||
1 | +package com.sincere.wechatbusiness.mapper; | ||
2 | + | ||
3 | +import com.sincere.wechatbusiness.model.Attention; | ||
4 | + | ||
5 | +public interface AttentionMapper { | ||
6 | + Attention getDetail(int id); | ||
7 | + | ||
8 | + int insert(Attention attention); | ||
9 | + | ||
10 | + int update(Attention attention); | ||
11 | +} |
src/main/java/com/sincere/wechatbusiness/mapper/BannerMapper.java
0 → 100644
@@ -0,0 +1,15 @@ | @@ -0,0 +1,15 @@ | ||
1 | +package com.sincere.wechatbusiness.mapper; | ||
2 | + | ||
3 | +import com.sincere.wechatbusiness.model.Banner; | ||
4 | + | ||
5 | +import java.util.List; | ||
6 | + | ||
7 | +public interface BannerMapper { | ||
8 | + List<Banner> getList(int id); | ||
9 | + | ||
10 | + int insert(Banner banner); | ||
11 | + | ||
12 | + int update(Banner banner); | ||
13 | + | ||
14 | + int deleteBanner(int id); | ||
15 | +} |
src/main/java/com/sincere/wechatbusiness/mapper/CatalogContentMapper.java
0 → 100644
@@ -0,0 +1,15 @@ | @@ -0,0 +1,15 @@ | ||
1 | +package com.sincere.wechatbusiness.mapper; | ||
2 | + | ||
3 | +import com.sincere.wechatbusiness.model.CatalogContent; | ||
4 | + | ||
5 | +import java.util.List; | ||
6 | + | ||
7 | +public interface CatalogContentMapper { | ||
8 | + List<CatalogContent> getList(int id); | ||
9 | + | ||
10 | + int insert(CatalogContent catalogContent); | ||
11 | + | ||
12 | + int update(CatalogContent catalogContent); | ||
13 | + | ||
14 | + int deleteCatalogContent(int id); | ||
15 | +} |
src/main/java/com/sincere/wechatbusiness/mapper/CatalogMapper.java
0 → 100644
src/main/java/com/sincere/wechatbusiness/mapper/ChannelMapper.java
0 → 100644
@@ -0,0 +1,19 @@ | @@ -0,0 +1,19 @@ | ||
1 | +package com.sincere.wechatbusiness.mapper; | ||
2 | + | ||
3 | +import com.sincere.wechatbusiness.model.Channel; | ||
4 | + | ||
5 | +import java.util.List; | ||
6 | + | ||
7 | +public interface ChannelMapper { | ||
8 | + List<Channel> getList(Channel channel); | ||
9 | + | ||
10 | + int getListCount(Channel channel); | ||
11 | + | ||
12 | + Channel getDetail(int id); | ||
13 | + | ||
14 | + int insert(Channel channel); | ||
15 | + | ||
16 | + int update(Channel channel); | ||
17 | + | ||
18 | + int deleteChannel(int id); | ||
19 | +} |
src/main/java/com/sincere/wechatbusiness/mapper/ChannelProductMapper.java
0 → 100644
@@ -0,0 +1,15 @@ | @@ -0,0 +1,15 @@ | ||
1 | +package com.sincere.wechatbusiness.mapper; | ||
2 | + | ||
3 | +import com.sincere.wechatbusiness.model.ChannelProduct; | ||
4 | + | ||
5 | +import java.util.List; | ||
6 | + | ||
7 | +public interface ChannelProductMapper { | ||
8 | + List<ChannelProduct> getList(int id); | ||
9 | + | ||
10 | + int insert(ChannelProduct channelProduct); | ||
11 | + | ||
12 | + int update(ChannelProduct channelProduct); | ||
13 | + | ||
14 | + int deleteChannelProduct(int id); | ||
15 | +} |
src/main/java/com/sincere/wechatbusiness/model/Attention.java
0 → 100644
@@ -0,0 +1,92 @@ | @@ -0,0 +1,92 @@ | ||
1 | +package com.sincere.wechatbusiness.model; | ||
2 | + | ||
3 | +import io.swagger.annotations.ApiModelProperty; | ||
4 | + | ||
5 | +import java.util.Date; | ||
6 | + | ||
7 | +public class Attention { | ||
8 | + private Integer id; | ||
9 | + | ||
10 | + @ApiModelProperty(value = "渠道商id") | ||
11 | + private Integer channelId; | ||
12 | + | ||
13 | + @ApiModelProperty(value = "关注logo") | ||
14 | + private String logo; | ||
15 | + | ||
16 | + @ApiModelProperty(value = "公众号或小程序名称") | ||
17 | + private String name; | ||
18 | + | ||
19 | + @ApiModelProperty(value = "关注说明内容") | ||
20 | + private String content; | ||
21 | + | ||
22 | + @ApiModelProperty(value = "关注图片") | ||
23 | + private String imgUrl; | ||
24 | + | ||
25 | + private Integer state; | ||
26 | + | ||
27 | + private Date createTime; | ||
28 | + | ||
29 | + public Integer getId() { | ||
30 | + return id; | ||
31 | + } | ||
32 | + | ||
33 | + public void setId(Integer id) { | ||
34 | + this.id = id; | ||
35 | + } | ||
36 | + | ||
37 | + public Integer getChannelId() { | ||
38 | + return channelId; | ||
39 | + } | ||
40 | + | ||
41 | + public void setChannelId(Integer channelId) { | ||
42 | + this.channelId = channelId; | ||
43 | + } | ||
44 | + | ||
45 | + public String getLogo() { | ||
46 | + return logo; | ||
47 | + } | ||
48 | + | ||
49 | + public void setLogo(String logo) { | ||
50 | + this.logo = logo; | ||
51 | + } | ||
52 | + | ||
53 | + public String getName() { | ||
54 | + return name; | ||
55 | + } | ||
56 | + | ||
57 | + public void setName(String name) { | ||
58 | + this.name = name; | ||
59 | + } | ||
60 | + | ||
61 | + public String getContent() { | ||
62 | + return content; | ||
63 | + } | ||
64 | + | ||
65 | + public void setContent(String content) { | ||
66 | + this.content = content; | ||
67 | + } | ||
68 | + | ||
69 | + public String getImgUrl() { | ||
70 | + return imgUrl; | ||
71 | + } | ||
72 | + | ||
73 | + public void setImgUrl(String imgUrl) { | ||
74 | + this.imgUrl = imgUrl; | ||
75 | + } | ||
76 | + | ||
77 | + public Integer getState() { | ||
78 | + return state; | ||
79 | + } | ||
80 | + | ||
81 | + public void setState(Integer state) { | ||
82 | + this.state = state; | ||
83 | + } | ||
84 | + | ||
85 | + public Date getCreateTime() { | ||
86 | + return createTime; | ||
87 | + } | ||
88 | + | ||
89 | + public void setCreateTime(Date createTime) { | ||
90 | + this.createTime = createTime; | ||
91 | + } | ||
92 | +} |
src/main/java/com/sincere/wechatbusiness/model/Banner.java
0 → 100644
@@ -0,0 +1,65 @@ | @@ -0,0 +1,65 @@ | ||
1 | +package com.sincere.wechatbusiness.model; | ||
2 | + | ||
3 | +import java.util.Date; | ||
4 | + | ||
5 | +public class Banner { | ||
6 | + private Integer id; | ||
7 | + | ||
8 | + private Integer channelId; | ||
9 | + | ||
10 | + private String imgUrl; | ||
11 | + | ||
12 | + private String linkUrl; | ||
13 | + | ||
14 | + private Integer state; | ||
15 | + | ||
16 | + private Date createTime; | ||
17 | + | ||
18 | + public Integer getId() { | ||
19 | + return id; | ||
20 | + } | ||
21 | + | ||
22 | + public void setId(Integer id) { | ||
23 | + this.id = id; | ||
24 | + } | ||
25 | + | ||
26 | + public Integer getChannelId() { | ||
27 | + return channelId; | ||
28 | + } | ||
29 | + | ||
30 | + public void setChannelId(Integer channelId) { | ||
31 | + this.channelId = channelId; | ||
32 | + } | ||
33 | + | ||
34 | + public String getImgUrl() { | ||
35 | + return imgUrl; | ||
36 | + } | ||
37 | + | ||
38 | + public void setImgUrl(String imgUrl) { | ||
39 | + this.imgUrl = imgUrl; | ||
40 | + } | ||
41 | + | ||
42 | + public String getLinkUrl() { | ||
43 | + return linkUrl; | ||
44 | + } | ||
45 | + | ||
46 | + public void setLinkUrl(String linkUrl) { | ||
47 | + this.linkUrl = linkUrl; | ||
48 | + } | ||
49 | + | ||
50 | + public Integer getState() { | ||
51 | + return state; | ||
52 | + } | ||
53 | + | ||
54 | + public void setState(Integer state) { | ||
55 | + this.state = state; | ||
56 | + } | ||
57 | + | ||
58 | + public Date getCreateTime() { | ||
59 | + return createTime; | ||
60 | + } | ||
61 | + | ||
62 | + public void setCreateTime(Date createTime) { | ||
63 | + this.createTime = createTime; | ||
64 | + } | ||
65 | +} |
src/main/java/com/sincere/wechatbusiness/model/Catalog.java
0 → 100644
@@ -0,0 +1,79 @@ | @@ -0,0 +1,79 @@ | ||
1 | +package com.sincere.wechatbusiness.model; | ||
2 | + | ||
3 | +import io.swagger.annotations.ApiModelProperty; | ||
4 | + | ||
5 | +import java.util.Date; | ||
6 | +import java.util.List; | ||
7 | + | ||
8 | +public class Catalog { | ||
9 | + private Integer id; | ||
10 | + | ||
11 | + private Integer channelId; | ||
12 | + | ||
13 | + @ApiModelProperty(value = "栏目名称") | ||
14 | + private String name; | ||
15 | + | ||
16 | + private Integer sort; | ||
17 | + | ||
18 | + private Integer state; | ||
19 | + | ||
20 | + private Date createTime; | ||
21 | + | ||
22 | + private List<CatalogContent> catalogContentList; | ||
23 | + | ||
24 | + public Integer getId() { | ||
25 | + return id; | ||
26 | + } | ||
27 | + | ||
28 | + public void setId(Integer id) { | ||
29 | + this.id = id; | ||
30 | + } | ||
31 | + | ||
32 | + public Integer getChannelId() { | ||
33 | + return channelId; | ||
34 | + } | ||
35 | + | ||
36 | + public void setChannelId(Integer channelId) { | ||
37 | + this.channelId = channelId; | ||
38 | + } | ||
39 | + | ||
40 | + public String getName() { | ||
41 | + return name; | ||
42 | + } | ||
43 | + | ||
44 | + public void setName(String name) { | ||
45 | + this.name = name; | ||
46 | + } | ||
47 | + | ||
48 | + public Integer getSort() { | ||
49 | + return sort; | ||
50 | + } | ||
51 | + | ||
52 | + public void setSort(Integer sort) { | ||
53 | + this.sort = sort; | ||
54 | + } | ||
55 | + | ||
56 | + public Integer getState() { | ||
57 | + return state; | ||
58 | + } | ||
59 | + | ||
60 | + public void setState(Integer state) { | ||
61 | + this.state = state; | ||
62 | + } | ||
63 | + | ||
64 | + public Date getCreateTime() { | ||
65 | + return createTime; | ||
66 | + } | ||
67 | + | ||
68 | + public void setCreateTime(Date createTime) { | ||
69 | + this.createTime = createTime; | ||
70 | + } | ||
71 | + | ||
72 | + public List<CatalogContent> getCatalogContentList() { | ||
73 | + return catalogContentList; | ||
74 | + } | ||
75 | + | ||
76 | + public void setCatalogContentList(List<CatalogContent> catalogContentList) { | ||
77 | + this.catalogContentList = catalogContentList; | ||
78 | + } | ||
79 | +} |
src/main/java/com/sincere/wechatbusiness/model/CatalogContent.java
0 → 100644
@@ -0,0 +1,109 @@ | @@ -0,0 +1,109 @@ | ||
1 | +package com.sincere.wechatbusiness.model; | ||
2 | + | ||
3 | +import io.swagger.annotations.ApiModelProperty; | ||
4 | + | ||
5 | +import java.util.Date; | ||
6 | + | ||
7 | +public class CatalogContent { | ||
8 | + private Integer id; | ||
9 | + | ||
10 | + private Integer catalogId; | ||
11 | + | ||
12 | + @ApiModelProperty(value = "主标题") | ||
13 | + private String title; | ||
14 | + | ||
15 | + @ApiModelProperty(value = "副标题") | ||
16 | + private String subtitle; | ||
17 | + | ||
18 | + private String startTime; | ||
19 | + | ||
20 | + private String endTime; | ||
21 | + | ||
22 | + private String imgUrl; | ||
23 | + | ||
24 | + private String linkUrl; | ||
25 | + | ||
26 | + private Integer state; | ||
27 | + | ||
28 | + private Date createTime; | ||
29 | + | ||
30 | + public Integer getId() { | ||
31 | + return id; | ||
32 | + } | ||
33 | + | ||
34 | + public void setId(Integer id) { | ||
35 | + this.id = id; | ||
36 | + } | ||
37 | + | ||
38 | + public Integer getCatalogId() { | ||
39 | + return catalogId; | ||
40 | + } | ||
41 | + | ||
42 | + public void setCatalogId(Integer catalogId) { | ||
43 | + this.catalogId = catalogId; | ||
44 | + } | ||
45 | + | ||
46 | + public String getTitle() { | ||
47 | + return title; | ||
48 | + } | ||
49 | + | ||
50 | + public void setTitle(String title) { | ||
51 | + this.title = title; | ||
52 | + } | ||
53 | + | ||
54 | + public String getSubtitle() { | ||
55 | + return subtitle; | ||
56 | + } | ||
57 | + | ||
58 | + public void setSubtitle(String subtitle) { | ||
59 | + this.subtitle = subtitle; | ||
60 | + } | ||
61 | + | ||
62 | + public String getStartTime() { | ||
63 | + return startTime; | ||
64 | + } | ||
65 | + | ||
66 | + public void setStartTime(String startTime) { | ||
67 | + this.startTime = startTime; | ||
68 | + } | ||
69 | + | ||
70 | + public String getEndTime() { | ||
71 | + return endTime; | ||
72 | + } | ||
73 | + | ||
74 | + public void setEndTime(String endTime) { | ||
75 | + this.endTime = endTime; | ||
76 | + } | ||
77 | + | ||
78 | + public String getImgUrl() { | ||
79 | + return imgUrl; | ||
80 | + } | ||
81 | + | ||
82 | + public void setImgUrl(String imgUrl) { | ||
83 | + this.imgUrl = imgUrl; | ||
84 | + } | ||
85 | + | ||
86 | + public String getLinkUrl() { | ||
87 | + return linkUrl; | ||
88 | + } | ||
89 | + | ||
90 | + public void setLinkUrl(String linkUrl) { | ||
91 | + this.linkUrl = linkUrl; | ||
92 | + } | ||
93 | + | ||
94 | + public Integer getState() { | ||
95 | + return state; | ||
96 | + } | ||
97 | + | ||
98 | + public void setState(Integer state) { | ||
99 | + this.state = state; | ||
100 | + } | ||
101 | + | ||
102 | + public Date getCreateTime() { | ||
103 | + return createTime; | ||
104 | + } | ||
105 | + | ||
106 | + public void setCreateTime(Date createTime) { | ||
107 | + this.createTime = createTime; | ||
108 | + } | ||
109 | +} |
src/main/java/com/sincere/wechatbusiness/model/Channel.java
0 → 100644
@@ -0,0 +1,136 @@ | @@ -0,0 +1,136 @@ | ||
1 | +package com.sincere.wechatbusiness.model; | ||
2 | + | ||
3 | +import java.util.Date; | ||
4 | +import java.util.List; | ||
5 | + | ||
6 | +public class Channel { | ||
7 | + private Integer id; | ||
8 | + | ||
9 | + private String name; | ||
10 | + | ||
11 | + private String mobile; | ||
12 | + | ||
13 | + private String province; | ||
14 | + | ||
15 | + private String city; | ||
16 | + | ||
17 | + private Integer templateId; | ||
18 | + | ||
19 | + private Integer state; | ||
20 | + | ||
21 | + private Date createTime; | ||
22 | + | ||
23 | + private Integer productCount; | ||
24 | + | ||
25 | + private String templateName; | ||
26 | + | ||
27 | + private String provinceCode; | ||
28 | + | ||
29 | + private String cityCode; | ||
30 | + | ||
31 | + private List<ChannelProduct> channelProductList; | ||
32 | + | ||
33 | + public Integer getId() { | ||
34 | + return id; | ||
35 | + } | ||
36 | + | ||
37 | + public void setId(Integer id) { | ||
38 | + this.id = id; | ||
39 | + } | ||
40 | + | ||
41 | + public String getName() { | ||
42 | + return name; | ||
43 | + } | ||
44 | + | ||
45 | + public void setName(String name) { | ||
46 | + this.name = name; | ||
47 | + } | ||
48 | + | ||
49 | + public String getMobile() { | ||
50 | + return mobile; | ||
51 | + } | ||
52 | + | ||
53 | + public void setMobile(String mobile) { | ||
54 | + this.mobile = mobile; | ||
55 | + } | ||
56 | + | ||
57 | + public String getProvince() { | ||
58 | + return province; | ||
59 | + } | ||
60 | + | ||
61 | + public void setProvince(String province) { | ||
62 | + this.province = province; | ||
63 | + } | ||
64 | + | ||
65 | + public String getCity() { | ||
66 | + return city; | ||
67 | + } | ||
68 | + | ||
69 | + public void setCity(String city) { | ||
70 | + this.city = city; | ||
71 | + } | ||
72 | + | ||
73 | + public Integer getTemplateId() { | ||
74 | + return templateId; | ||
75 | + } | ||
76 | + | ||
77 | + public void setTemplateId(Integer templateId) { | ||
78 | + this.templateId = templateId; | ||
79 | + } | ||
80 | + | ||
81 | + public Integer getState() { | ||
82 | + return state; | ||
83 | + } | ||
84 | + | ||
85 | + public void setState(Integer state) { | ||
86 | + this.state = state; | ||
87 | + } | ||
88 | + | ||
89 | + public Date getCreateTime() { | ||
90 | + return createTime; | ||
91 | + } | ||
92 | + | ||
93 | + public void setCreateTime(Date createTime) { | ||
94 | + this.createTime = createTime; | ||
95 | + } | ||
96 | + | ||
97 | + public Integer getProductCount() { | ||
98 | + return productCount; | ||
99 | + } | ||
100 | + | ||
101 | + public void setProductCount(Integer productCount) { | ||
102 | + this.productCount = productCount; | ||
103 | + } | ||
104 | + | ||
105 | + public String getTemplateName() { | ||
106 | + return templateName; | ||
107 | + } | ||
108 | + | ||
109 | + public void setTemplateName(String templateName) { | ||
110 | + this.templateName = templateName; | ||
111 | + } | ||
112 | + | ||
113 | + public String getProvinceCode() { | ||
114 | + return provinceCode; | ||
115 | + } | ||
116 | + | ||
117 | + public void setProvinceCode(String provinceCode) { | ||
118 | + this.provinceCode = provinceCode; | ||
119 | + } | ||
120 | + | ||
121 | + public String getCityCode() { | ||
122 | + return cityCode; | ||
123 | + } | ||
124 | + | ||
125 | + public void setCityCode(String cityCode) { | ||
126 | + this.cityCode = cityCode; | ||
127 | + } | ||
128 | + | ||
129 | + public List<ChannelProduct> getChannelProductList() { | ||
130 | + return channelProductList; | ||
131 | + } | ||
132 | + | ||
133 | + public void setChannelProductList(List<ChannelProduct> channelProductList) { | ||
134 | + this.channelProductList = channelProductList; | ||
135 | + } | ||
136 | +} |
src/main/java/com/sincere/wechatbusiness/model/ChannelProduct.java
0 → 100644
@@ -0,0 +1,85 @@ | @@ -0,0 +1,85 @@ | ||
1 | +package com.sincere.wechatbusiness.model; | ||
2 | + | ||
3 | +import java.util.Date; | ||
4 | + | ||
5 | +public class ChannelProduct { | ||
6 | + private Integer id; | ||
7 | + | ||
8 | + private Integer channelId; | ||
9 | + | ||
10 | + private String productName; | ||
11 | + | ||
12 | + private String price; | ||
13 | + | ||
14 | + private String ChannelPrice; | ||
15 | + | ||
16 | + private String caption; | ||
17 | + | ||
18 | + private Integer state; | ||
19 | + | ||
20 | + private Date createTime; | ||
21 | + | ||
22 | + public Integer getId() { | ||
23 | + return id; | ||
24 | + } | ||
25 | + | ||
26 | + public void setId(Integer id) { | ||
27 | + this.id = id; | ||
28 | + } | ||
29 | + | ||
30 | + public Integer getChannelId() { | ||
31 | + return channelId; | ||
32 | + } | ||
33 | + | ||
34 | + public void setChannelId(Integer channelId) { | ||
35 | + this.channelId = channelId; | ||
36 | + } | ||
37 | + | ||
38 | + public String getProductName() { | ||
39 | + return productName; | ||
40 | + } | ||
41 | + | ||
42 | + public void setProductName(String productName) { | ||
43 | + this.productName = productName; | ||
44 | + } | ||
45 | + | ||
46 | + public String getPrice() { | ||
47 | + return price; | ||
48 | + } | ||
49 | + | ||
50 | + public void setPrice(String price) { | ||
51 | + this.price = price; | ||
52 | + } | ||
53 | + | ||
54 | + public String getChannelPrice() { | ||
55 | + return ChannelPrice; | ||
56 | + } | ||
57 | + | ||
58 | + public void setChannelPrice(String channelPrice) { | ||
59 | + ChannelPrice = channelPrice; | ||
60 | + } | ||
61 | + | ||
62 | + public String getCaption() { | ||
63 | + return caption; | ||
64 | + } | ||
65 | + | ||
66 | + public void setCaption(String caption) { | ||
67 | + this.caption = caption; | ||
68 | + } | ||
69 | + | ||
70 | + public Integer getState() { | ||
71 | + return state; | ||
72 | + } | ||
73 | + | ||
74 | + public void setState(Integer state) { | ||
75 | + this.state = state; | ||
76 | + } | ||
77 | + | ||
78 | + public Date getCreateTime() { | ||
79 | + return createTime; | ||
80 | + } | ||
81 | + | ||
82 | + public void setCreateTime(Date createTime) { | ||
83 | + this.createTime = createTime; | ||
84 | + } | ||
85 | +} |
src/main/java/com/sincere/wechatbusiness/model/DiscountPackage.java
0 → 100644
@@ -0,0 +1,88 @@ | @@ -0,0 +1,88 @@ | ||
1 | +package com.sincere.wechatbusiness.model; | ||
2 | + | ||
3 | +import java.util.Date; | ||
4 | + | ||
5 | +public class DiscountPackage { | ||
6 | + private Integer id; | ||
7 | + private String package_name; | ||
8 | + private String describe; | ||
9 | + private String photo; | ||
10 | + private String package_ids; | ||
11 | + private String price; | ||
12 | + private String require; | ||
13 | + private Date create_time; | ||
14 | + | ||
15 | + private String isSelect; | ||
16 | + | ||
17 | + public Integer getId() { | ||
18 | + return id; | ||
19 | + } | ||
20 | + | ||
21 | + public void setId(Integer id) { | ||
22 | + this.id = id; | ||
23 | + } | ||
24 | + | ||
25 | + public String getPackage_name() { | ||
26 | + return package_name; | ||
27 | + } | ||
28 | + | ||
29 | + public void setPackage_name(String package_name) { | ||
30 | + this.package_name = package_name; | ||
31 | + } | ||
32 | + | ||
33 | + public String getDescribe() { | ||
34 | + return describe; | ||
35 | + } | ||
36 | + | ||
37 | + public void setDescribe(String describe) { | ||
38 | + this.describe = describe; | ||
39 | + } | ||
40 | + | ||
41 | + public String getPhoto() { | ||
42 | + return photo; | ||
43 | + } | ||
44 | + | ||
45 | + public void setPhoto(String photo) { | ||
46 | + this.photo = photo; | ||
47 | + } | ||
48 | + | ||
49 | + public String getPackage_ids() { | ||
50 | + return package_ids; | ||
51 | + } | ||
52 | + | ||
53 | + public void setPackage_ids(String package_ids) { | ||
54 | + this.package_ids = package_ids; | ||
55 | + } | ||
56 | + | ||
57 | + public String getPrice() { | ||
58 | + return price; | ||
59 | + } | ||
60 | + | ||
61 | + public void setPrice(String price) { | ||
62 | + this.price = price; | ||
63 | + } | ||
64 | + | ||
65 | + public String getRequire() { | ||
66 | + return require; | ||
67 | + } | ||
68 | + | ||
69 | + public void setRequire(String require) { | ||
70 | + this.require = require; | ||
71 | + } | ||
72 | + | ||
73 | + public Date getCreate_time() { | ||
74 | + return create_time; | ||
75 | + } | ||
76 | + | ||
77 | + public void setCreate_time(Date create_time) { | ||
78 | + this.create_time = create_time; | ||
79 | + } | ||
80 | + | ||
81 | + public String getIsSelect() { | ||
82 | + return isSelect; | ||
83 | + } | ||
84 | + | ||
85 | + public void setIsSelect(String isSelect) { | ||
86 | + this.isSelect = isSelect; | ||
87 | + } | ||
88 | +} |
src/main/java/com/sincere/wechatbusiness/model/Template.java
0 → 100644
@@ -0,0 +1,55 @@ | @@ -0,0 +1,55 @@ | ||
1 | +package com.sincere.wechatbusiness.model; | ||
2 | + | ||
3 | +import java.util.Date; | ||
4 | + | ||
5 | +public class Template { | ||
6 | + private Integer id; | ||
7 | + | ||
8 | + private String title; | ||
9 | + | ||
10 | + private String imgUrl; | ||
11 | + | ||
12 | + private Integer state; | ||
13 | + | ||
14 | + private Date createTime; | ||
15 | + | ||
16 | + public Integer getId() { | ||
17 | + return id; | ||
18 | + } | ||
19 | + | ||
20 | + public void setId(Integer id) { | ||
21 | + this.id = id; | ||
22 | + } | ||
23 | + | ||
24 | + public String getTitle() { | ||
25 | + return title; | ||
26 | + } | ||
27 | + | ||
28 | + public void setTitle(String title) { | ||
29 | + this.title = title; | ||
30 | + } | ||
31 | + | ||
32 | + public String getImgUrl() { | ||
33 | + return imgUrl; | ||
34 | + } | ||
35 | + | ||
36 | + public void setImgUrl(String imgUrl) { | ||
37 | + this.imgUrl = imgUrl; | ||
38 | + } | ||
39 | + | ||
40 | + public Integer getState() { | ||
41 | + return state; | ||
42 | + } | ||
43 | + | ||
44 | + public void setState(Integer state) { | ||
45 | + this.state = state; | ||
46 | + } | ||
47 | + | ||
48 | + public Date getCreateTime() { | ||
49 | + return createTime; | ||
50 | + } | ||
51 | + | ||
52 | + public void setCreateTime(Date createTime) { | ||
53 | + this.createTime = createTime; | ||
54 | + } | ||
55 | +} |
src/main/java/com/sincere/wechatbusiness/service/AttentionService.java
0 → 100644
@@ -0,0 +1,11 @@ | @@ -0,0 +1,11 @@ | ||
1 | +package com.sincere.wechatbusiness.service; | ||
2 | + | ||
3 | +import com.sincere.wechatbusiness.model.Attention; | ||
4 | + | ||
5 | +public interface AttentionService { | ||
6 | + Attention getDetail(int id); | ||
7 | + | ||
8 | + int insert(Attention attention); | ||
9 | + | ||
10 | + int update(Attention attention); | ||
11 | +} |
src/main/java/com/sincere/wechatbusiness/service/BannerService.java
0 → 100644
@@ -0,0 +1,15 @@ | @@ -0,0 +1,15 @@ | ||
1 | +package com.sincere.wechatbusiness.service; | ||
2 | + | ||
3 | +import com.sincere.wechatbusiness.model.Banner; | ||
4 | + | ||
5 | +import java.util.List; | ||
6 | + | ||
7 | +public interface BannerService { | ||
8 | + List<Banner> getList(int id); | ||
9 | + | ||
10 | + int insert(Banner banner); | ||
11 | + | ||
12 | + int update(Banner banner); | ||
13 | + | ||
14 | + int deleteBanner(int id); | ||
15 | +} |
src/main/java/com/sincere/wechatbusiness/service/CatalogContentService.java
0 → 100644
@@ -0,0 +1,15 @@ | @@ -0,0 +1,15 @@ | ||
1 | +package com.sincere.wechatbusiness.service; | ||
2 | + | ||
3 | +import com.sincere.wechatbusiness.model.CatalogContent; | ||
4 | + | ||
5 | +import java.util.List; | ||
6 | + | ||
7 | +public interface CatalogContentService { | ||
8 | + List<CatalogContent> getList(int id); | ||
9 | + | ||
10 | + int insert(CatalogContent catalogContent); | ||
11 | + | ||
12 | + int update(CatalogContent catalogContent); | ||
13 | + | ||
14 | + int deleteCatalogContent(int id); | ||
15 | +} |
src/main/java/com/sincere/wechatbusiness/service/CatalogService.java
0 → 100644
src/main/java/com/sincere/wechatbusiness/service/ChannelProductService.java
0 → 100644
@@ -0,0 +1,15 @@ | @@ -0,0 +1,15 @@ | ||
1 | +package com.sincere.wechatbusiness.service; | ||
2 | + | ||
3 | +import com.sincere.wechatbusiness.model.ChannelProduct; | ||
4 | + | ||
5 | +import java.util.List; | ||
6 | + | ||
7 | +public interface ChannelProductService { | ||
8 | + List<ChannelProduct> getList(int id); | ||
9 | + | ||
10 | + int insert(ChannelProduct channelProduct); | ||
11 | + | ||
12 | + int update(ChannelProduct channelProduct); | ||
13 | + | ||
14 | + int deleteChannelProduct(int id); | ||
15 | +} |
src/main/java/com/sincere/wechatbusiness/service/ChannelService.java
0 → 100644
@@ -0,0 +1,16 @@ | @@ -0,0 +1,16 @@ | ||
1 | +package com.sincere.wechatbusiness.service; | ||
2 | + | ||
3 | +import com.sincere.wechatbusiness.model.Channel; | ||
4 | +import com.sincere.wechatbusiness.utils.Page; | ||
5 | + | ||
6 | +public interface ChannelService { | ||
7 | + Page<Channel> getList(Channel channel, int page, int pageSize); | ||
8 | + | ||
9 | + Channel getDetail(int id); | ||
10 | + | ||
11 | + int insert(Channel channel); | ||
12 | + | ||
13 | + int update(Channel channel); | ||
14 | + | ||
15 | + int deleteChannel(int id); | ||
16 | +} |
src/main/java/com/sincere/wechatbusiness/service/impl/AttentionServiceImpl.java
0 → 100644
@@ -0,0 +1,22 @@ | @@ -0,0 +1,22 @@ | ||
1 | +package com.sincere.wechatbusiness.service.impl; | ||
2 | + | ||
3 | +import com.sincere.wechatbusiness.mapper.AttentionMapper; | ||
4 | +import com.sincere.wechatbusiness.model.Attention; | ||
5 | +import com.sincere.wechatbusiness.service.AttentionService; | ||
6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
7 | +import org.springframework.stereotype.Service; | ||
8 | + | ||
9 | +@Service | ||
10 | +public class AttentionServiceImpl implements AttentionService { | ||
11 | + @Autowired | ||
12 | + AttentionMapper attentionMapper; | ||
13 | + | ||
14 | + @Override | ||
15 | + public Attention getDetail(int id){return attentionMapper.getDetail(id);} | ||
16 | + | ||
17 | + @Override | ||
18 | + public int insert(Attention attention){return attentionMapper.insert(attention);} | ||
19 | + | ||
20 | + @Override | ||
21 | + public int update(Attention attention){return attentionMapper.update(attention);} | ||
22 | +} |
src/main/java/com/sincere/wechatbusiness/service/impl/BannerServiceImpl.java
0 → 100644
@@ -0,0 +1,27 @@ | @@ -0,0 +1,27 @@ | ||
1 | +package com.sincere.wechatbusiness.service.impl; | ||
2 | + | ||
3 | +import com.sincere.wechatbusiness.mapper.BannerMapper; | ||
4 | +import com.sincere.wechatbusiness.model.Banner; | ||
5 | +import com.sincere.wechatbusiness.service.BannerService; | ||
6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
7 | +import org.springframework.stereotype.Service; | ||
8 | + | ||
9 | +import java.util.List; | ||
10 | + | ||
11 | +@Service | ||
12 | +public class BannerServiceImpl implements BannerService { | ||
13 | + @Autowired | ||
14 | + BannerMapper bannerMapper; | ||
15 | + | ||
16 | + @Override | ||
17 | + public List<Banner> getList(int id){return bannerMapper.getList(id);} | ||
18 | + | ||
19 | + @Override | ||
20 | + public int insert(Banner banner){return bannerMapper.insert(banner);} | ||
21 | + | ||
22 | + @Override | ||
23 | + public int update(Banner banner){return bannerMapper.update(banner);} | ||
24 | + | ||
25 | + @Override | ||
26 | + public int deleteBanner(int id){return bannerMapper.deleteBanner(id);} | ||
27 | +} |
src/main/java/com/sincere/wechatbusiness/service/impl/CatalogContentServiceImpl.java
0 → 100644
@@ -0,0 +1,28 @@ | @@ -0,0 +1,28 @@ | ||
1 | +package com.sincere.wechatbusiness.service.impl; | ||
2 | + | ||
3 | +import com.sincere.wechatbusiness.mapper.CatalogContentMapper; | ||
4 | +import com.sincere.wechatbusiness.model.Catalog; | ||
5 | +import com.sincere.wechatbusiness.model.CatalogContent; | ||
6 | +import com.sincere.wechatbusiness.service.CatalogContentService; | ||
7 | +import org.springframework.beans.factory.annotation.Autowired; | ||
8 | +import org.springframework.stereotype.Service; | ||
9 | + | ||
10 | +import java.util.List; | ||
11 | + | ||
12 | +@Service | ||
13 | +public class CatalogContentServiceImpl implements CatalogContentService { | ||
14 | + @Autowired | ||
15 | + CatalogContentMapper catalogContentMapper; | ||
16 | + | ||
17 | + @Override | ||
18 | + public List<CatalogContent> getList(int id){return catalogContentMapper.getList(id);} | ||
19 | + | ||
20 | + @Override | ||
21 | + public int insert(CatalogContent catalogContent){return catalogContentMapper.insert(catalogContent);} | ||
22 | + | ||
23 | + @Override | ||
24 | + public int update(CatalogContent catalogContent){return catalogContentMapper.update(catalogContent);} | ||
25 | + | ||
26 | + @Override | ||
27 | + public int deleteCatalogContent(int id){return catalogContentMapper.deleteCatalogContent(id);} | ||
28 | +} |
src/main/java/com/sincere/wechatbusiness/service/impl/CatalogServiceImpl.java
0 → 100644
@@ -0,0 +1,22 @@ | @@ -0,0 +1,22 @@ | ||
1 | +package com.sincere.wechatbusiness.service.impl; | ||
2 | + | ||
3 | +import com.sincere.wechatbusiness.mapper.CatalogMapper; | ||
4 | +import com.sincere.wechatbusiness.model.Catalog; | ||
5 | +import com.sincere.wechatbusiness.service.CatalogService; | ||
6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
7 | +import org.springframework.stereotype.Service; | ||
8 | + | ||
9 | +@Service | ||
10 | +public class CatalogServiceImpl implements CatalogService { | ||
11 | + @Autowired | ||
12 | + CatalogMapper catalogMapper; | ||
13 | + | ||
14 | + @Override | ||
15 | + public Catalog getDetail(Catalog catalog){return catalogMapper.getDetail(catalog);} | ||
16 | + | ||
17 | + @Override | ||
18 | + public int insert(Catalog catalog){return catalogMapper.insert(catalog);} | ||
19 | + | ||
20 | + @Override | ||
21 | + public int update(Catalog catalog){return catalogMapper.update(catalog);} | ||
22 | +} |
src/main/java/com/sincere/wechatbusiness/service/impl/ChannelProductServiceImpl.java
0 → 100644
@@ -0,0 +1,27 @@ | @@ -0,0 +1,27 @@ | ||
1 | +package com.sincere.wechatbusiness.service.impl; | ||
2 | + | ||
3 | +import com.sincere.wechatbusiness.mapper.ChannelProductMapper; | ||
4 | +import com.sincere.wechatbusiness.model.ChannelProduct; | ||
5 | +import com.sincere.wechatbusiness.service.ChannelProductService; | ||
6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
7 | +import org.springframework.stereotype.Service; | ||
8 | + | ||
9 | +import java.util.List; | ||
10 | + | ||
11 | +@Service | ||
12 | +public class ChannelProductServiceImpl implements ChannelProductService { | ||
13 | + @Autowired | ||
14 | + ChannelProductMapper channelProductMapper; | ||
15 | + | ||
16 | + @Override | ||
17 | + public List<ChannelProduct> getList(int id){return channelProductMapper.getList(id);} | ||
18 | + | ||
19 | + @Override | ||
20 | + public int insert(ChannelProduct channelProduct){return channelProductMapper.insert(channelProduct);} | ||
21 | + | ||
22 | + @Override | ||
23 | + public int update(ChannelProduct channelProduct){return channelProductMapper.update(channelProduct);} | ||
24 | + | ||
25 | + @Override | ||
26 | + public int deleteChannelProduct(int id){return channelProductMapper.deleteChannelProduct(id);} | ||
27 | +} |
src/main/java/com/sincere/wechatbusiness/service/impl/ChannelServiceImpl.java
0 → 100644
@@ -0,0 +1,44 @@ | @@ -0,0 +1,44 @@ | ||
1 | +package com.sincere.wechatbusiness.service.impl; | ||
2 | + | ||
3 | +import com.github.pagehelper.PageHelper; | ||
4 | +import com.sincere.wechatbusiness.mapper.ChannelMapper; | ||
5 | +import com.sincere.wechatbusiness.model.Channel; | ||
6 | +import com.sincere.wechatbusiness.service.ChannelService; | ||
7 | +import com.sincere.wechatbusiness.utils.Page; | ||
8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
9 | +import org.springframework.stereotype.Service; | ||
10 | + | ||
11 | +import java.util.ArrayList; | ||
12 | +import java.util.List; | ||
13 | + | ||
14 | +@Service | ||
15 | +public class ChannelServiceImpl implements ChannelService { | ||
16 | + @Autowired | ||
17 | + ChannelMapper channelMapper; | ||
18 | + | ||
19 | + @Override | ||
20 | + public Page<Channel> getList(Channel channel,int page, int pageSize){ | ||
21 | + Page<Channel> result=new Page<>(page,pageSize); | ||
22 | + PageHelper.startPage(page,pageSize); | ||
23 | + result.setList(channelMapper.getList(channel)); | ||
24 | + result.setCount(channelMapper.getListCount(channel)); | ||
25 | + return result; | ||
26 | + } | ||
27 | + | ||
28 | + @Override | ||
29 | + public Channel getDetail(int id){ | ||
30 | + Channel channel=new Channel(); | ||
31 | + channel=channelMapper.getDetail(id); | ||
32 | + return channel; | ||
33 | + } | ||
34 | + | ||
35 | + @Override | ||
36 | + public int insert(Channel channel){return channelMapper.insert(channel);} | ||
37 | + | ||
38 | + @Override | ||
39 | + public int update(Channel channel){return channelMapper.update(channel);} | ||
40 | + | ||
41 | + @Override | ||
42 | + public int deleteChannel(int id){return channelMapper.deleteChannel(id);} | ||
43 | +} | ||
44 | + |
src/main/java/com/sincere/wechatbusiness/utils/Page.java
0 → 100644
@@ -0,0 +1,55 @@ | @@ -0,0 +1,55 @@ | ||
1 | +package com.sincere.wechatbusiness.utils; | ||
2 | + | ||
3 | +import io.swagger.annotations.ApiModel; | ||
4 | +import io.swagger.annotations.ApiModelProperty; | ||
5 | + | ||
6 | +import java.util.List; | ||
7 | + | ||
8 | +@ApiModel | ||
9 | +public class Page<T> { | ||
10 | + | ||
11 | + @ApiModelProperty(value = "页码") | ||
12 | + private int page ; | ||
13 | + @ApiModelProperty(value = "每页数量") | ||
14 | + private int pageSize ; | ||
15 | + @ApiModelProperty(value = "总数") | ||
16 | + private int count ; | ||
17 | + private List<T> list ; | ||
18 | + | ||
19 | + public int getCount() { | ||
20 | + return count; | ||
21 | + } | ||
22 | + | ||
23 | + public void setCount(int count) { | ||
24 | + this.count = count; | ||
25 | + } | ||
26 | + | ||
27 | + public Page(int page, int pageSize) { | ||
28 | + this.page = page; | ||
29 | + this.pageSize = pageSize; | ||
30 | + } | ||
31 | + | ||
32 | + public int getPage() { | ||
33 | + return page; | ||
34 | + } | ||
35 | + | ||
36 | + public void setPage(int page) { | ||
37 | + this.page = page; | ||
38 | + } | ||
39 | + | ||
40 | + public int getPageSize() { | ||
41 | + return pageSize; | ||
42 | + } | ||
43 | + | ||
44 | + public void setPageSize(int pageSize) { | ||
45 | + this.pageSize = pageSize; | ||
46 | + } | ||
47 | + | ||
48 | + public List<T> getList() { | ||
49 | + return list; | ||
50 | + } | ||
51 | + | ||
52 | + public void setList(List<T> list) { | ||
53 | + this.list = list; | ||
54 | + } | ||
55 | +} |
src/main/resources/application.yaml
@@ -26,8 +26,8 @@ spring: | @@ -26,8 +26,8 @@ spring: | ||
26 | ##mybatis | 26 | ##mybatis |
27 | mybatis: | 27 | mybatis: |
28 | mapper-locations: classpath:mapper/*.xml | 28 | mapper-locations: classpath:mapper/*.xml |
29 | - type-aliases-package: com.sincere.report.model | 29 | + type-aliases-package: com.sincere.wechatBusiness.model |
30 | 30 | ||
31 | logging: | 31 | logging: |
32 | level: | 32 | level: |
33 | - com.sincere.report.mapper: debug | ||
34 | \ No newline at end of file | 33 | \ No newline at end of file |
34 | + com.sincere.wechatBusiness.mapper: debug | ||
35 | \ No newline at end of file | 35 | \ No newline at end of file |
@@ -0,0 +1,42 @@ | @@ -0,0 +1,42 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
3 | +<mapper namespace="com.sincere.wechatbusiness.mapper.AttentionMapper"> | ||
4 | + <resultMap id="AttentionMap" type="com.sincere.wechatbusiness.model.Attention"> | ||
5 | + <id column="id" jdbcType="INTEGER" property="id" /> | ||
6 | + <result column="channelId" jdbcType="INTEGER" property="channelId" /> | ||
7 | + <result column="logo" jdbcType="VARCHAR" property="logo" /> | ||
8 | + <result column="name" jdbcType="VARCHAR" property="name" /> | ||
9 | + <result column="content" jdbcType="VARCHAR" property="content" /> | ||
10 | + <result column="img_url" jdbcType="VARCHAR" property="imgUrl" /> | ||
11 | + <result column="state" jdbcType="INTEGER" property="state"/> | ||
12 | + <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | ||
13 | + </resultMap> | ||
14 | + | ||
15 | + <select id="getDetail" parameterType="java.lang.Integer" resultMap="AttentionMap"> | ||
16 | + select * from attention where channelId=#{id} and state=1 | ||
17 | + </select> | ||
18 | + | ||
19 | + <insert id="insert" parameterType="com.sincere.wechatbusiness.model.Attention"> | ||
20 | + insert into attention (channelId, logo,name,content,img_url) | ||
21 | + values (#{channelId,jdbcType=INTEGER}, #{logo,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR}, #{imgUrl,jdbcType=VARCHAR}) | ||
22 | + </insert> | ||
23 | + | ||
24 | + <update id="update" parameterType="com.sincere.wechatbusiness.model.Attention"> | ||
25 | + update attention | ||
26 | + <trim prefix="set" suffixOverrides=","> | ||
27 | + <if test="logo!=null and logo!=''"> | ||
28 | + logo=#{logo}, | ||
29 | + </if> | ||
30 | + <if test="name!=null and name!=''"> | ||
31 | + name=#{name}, | ||
32 | + </if> | ||
33 | + <if test="content!=null and content!=''"> | ||
34 | + content=#{content}, | ||
35 | + </if> | ||
36 | + <if test="imgUrl!=null and imgUrl!=''"> | ||
37 | + img_url=#{imgUrl}, | ||
38 | + </if> | ||
39 | + </trim> | ||
40 | + where id = #{id} | ||
41 | + </update> | ||
42 | +</mapper> | ||
0 | \ No newline at end of file | 43 | \ No newline at end of file |
@@ -0,0 +1,39 @@ | @@ -0,0 +1,39 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
3 | +<mapper namespace="com.sincere.wechatbusiness.mapper.BannerMapper"> | ||
4 | + <resultMap id="BannerMap" type="com.sincere.wechatbusiness.model.Banner"> | ||
5 | + <id column="id" jdbcType="INTEGER" property="id" /> | ||
6 | + <result column="channelId" jdbcType="INTEGER" property="channelId" /> | ||
7 | + <result column="img_url" jdbcType="VARCHAR" property="imgUrl" /> | ||
8 | + <result column="link_url" jdbcType="VARCHAR" property="linkUrl" /> | ||
9 | + <result column="state" jdbcType="INTEGER" property="state"/> | ||
10 | + <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | ||
11 | + </resultMap> | ||
12 | + | ||
13 | + <select id="getList" parameterType="java.lang.Integer" resultMap="BannerMap"> | ||
14 | + select * from banner where channelId=#{id} and state=1 order by create_time | ||
15 | + </select> | ||
16 | + | ||
17 | + <insert id="insert" parameterType="com.sincere.wechatbusiness.model.Banner"> | ||
18 | + insert into banner (channelId, img_url,link_url) | ||
19 | + values (#{channelId,jdbcType=INTEGER}, #{imgUrl,jdbcType=VARCHAR}, #{linkUrl,jdbcType=VARCHAR} | ||
20 | + ) | ||
21 | + </insert> | ||
22 | + | ||
23 | + <update id="update" parameterType="com.sincere.wechatbusiness.model.Banner"> | ||
24 | + update banner | ||
25 | + <trim prefix="set" suffixOverrides=","> | ||
26 | + <if test="imgUrl!=null and imgUrl!=''"> | ||
27 | + img_url=#{imgUrl}, | ||
28 | + </if> | ||
29 | + <if test="linkUrl!=null and linkUrl!=''"> | ||
30 | + link_url=#{linkUrl}, | ||
31 | + </if> | ||
32 | + </trim> | ||
33 | + where id = #{id} | ||
34 | + </update> | ||
35 | + | ||
36 | + <update id="deleteBanner" parameterType="java.lang.Integer"> | ||
37 | + update banner set state=0 where id = #{id} | ||
38 | + </update> | ||
39 | +</mapper> | ||
0 | \ No newline at end of file | 40 | \ No newline at end of file |
@@ -0,0 +1,55 @@ | @@ -0,0 +1,55 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
3 | +<mapper namespace="com.sincere.wechatbusiness.mapper.CatalogContentMapper"> | ||
4 | + <resultMap id="CatalogContentMap" type="com.sincere.wechatbusiness.model.CatalogContent"> | ||
5 | + <id column="id" jdbcType="INTEGER" property="id" /> | ||
6 | + <result column="catalogId" jdbcType="INTEGER" property="catalogId" /> | ||
7 | + <result column="title" jdbcType="VARCHAR" property="title" /> | ||
8 | + <result column="subtitle" jdbcType="VARCHAR" property="subtitle" /> | ||
9 | + <result column="start_time" jdbcType="VARCHAR" property="startTime" /> | ||
10 | + <result column="end_time" jdbcType="VARCHAR" property="endTime" /> | ||
11 | + <result column="img_url" jdbcType="VARCHAR" property="imgUrl" /> | ||
12 | + <result column="link_url" jdbcType="VARCHAR" property="linkUrl" /> | ||
13 | + <result column="state" jdbcType="INTEGER" property="state"/> | ||
14 | + <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | ||
15 | + </resultMap> | ||
16 | + | ||
17 | + <select id="getList" parameterType="java.lang.Integer" resultMap="CatalogContentMap"> | ||
18 | + select * from catalog_content where catalogId=#{id} and state=1 order by create_time | ||
19 | + </select> | ||
20 | + | ||
21 | + <insert id="insert" parameterType="com.sincere.wechatbusiness.model.CatalogContent"> | ||
22 | + insert into catalog_content (catalogId, title,subtitle,start_time,end_time,img_url,link_url) | ||
23 | + values (#{catalogId,jdbcType=INTEGER}, #{title,jdbcType=VARCHAR}, #{subtitle,jdbcType=VARCHAR}, | ||
24 | + #{startTime,jdbcType=VARCHAR}, #{endTime,jdbcType=VARCHAR}, #{imgUrl,jdbcType=VARCHAR}, #{linkUrl,jdbcType=VARCHAR}) | ||
25 | + </insert> | ||
26 | + | ||
27 | + <update id="update" parameterType="com.sincere.wechatbusiness.model.CatalogContent"> | ||
28 | + update catalog_content | ||
29 | + <trim prefix="set" suffixOverrides=","> | ||
30 | + <if test="title!=null and title!=''"> | ||
31 | + title=#{title}, | ||
32 | + </if> | ||
33 | + <if test="subtitle!=null and subtitle!=''"> | ||
34 | + subtitle=#{subtitle}, | ||
35 | + </if> | ||
36 | + <if test="startTime!=null and startTime!=''"> | ||
37 | + start_time=#{startTime}, | ||
38 | + </if> | ||
39 | + <if test="endTime!=null and endTime!=''"> | ||
40 | + end_time=#{endTime}, | ||
41 | + </if> | ||
42 | + <if test="imgUrl!=null and imgUrl!=''"> | ||
43 | + img_url=#{imgUrl}, | ||
44 | + </if> | ||
45 | + <if test="linkUrl!=null and linkUrl!=''"> | ||
46 | + link_url=#{linkUrl}, | ||
47 | + </if> | ||
48 | + </trim> | ||
49 | + where id = #{id} | ||
50 | + </update> | ||
51 | + | ||
52 | + <update id="deleteCatalogContent" parameterType="java.lang.Integer"> | ||
53 | + update catalog_content set state=0 where id = #{id} | ||
54 | + </update> | ||
55 | +</mapper> | ||
0 | \ No newline at end of file | 56 | \ No newline at end of file |
@@ -0,0 +1,32 @@ | @@ -0,0 +1,32 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
3 | +<mapper namespace="com.sincere.wechatbusiness.mapper.CatalogMapper"> | ||
4 | + <resultMap id="CatalogMap" type="com.sincere.wechatbusiness.model.Catalog"> | ||
5 | + <id column="id" jdbcType="INTEGER" property="id" /> | ||
6 | + <result column="channelId" jdbcType="INTEGER" property="channelId" /> | ||
7 | + <result column="name" jdbcType="VARCHAR" property="name" /> | ||
8 | + <result column="sort" jdbcType="INTEGER" property="sort" /> | ||
9 | + <result column="state" jdbcType="INTEGER" property="state"/> | ||
10 | + <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | ||
11 | + </resultMap> | ||
12 | + | ||
13 | + <select id="getDetail" parameterType="com.sincere.wechatbusiness.model.Catalog" resultMap="CatalogMap"> | ||
14 | + select * from catalog where channelId=#{channelId} and sort=#{sort} and state=1 | ||
15 | + </select> | ||
16 | + | ||
17 | + <insert id="insert" parameterType="com.sincere.wechatbusiness.model.Catalog"> | ||
18 | + insert into catalog (channelId, name,sort) | ||
19 | + values (#{channelId,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{sort,jdbcType=INTEGER} | ||
20 | + ) | ||
21 | + </insert> | ||
22 | + | ||
23 | + <update id="update" parameterType="com.sincere.wechatbusiness.model.Catalog"> | ||
24 | + update catalog | ||
25 | + <trim prefix="set" suffixOverrides=","> | ||
26 | + <if test="name!=null and name!=''"> | ||
27 | + name=#{name}, | ||
28 | + </if> | ||
29 | + </trim> | ||
30 | + where id = #{id} | ||
31 | + </update> | ||
32 | +</mapper> | ||
0 | \ No newline at end of file | 33 | \ No newline at end of file |
@@ -0,0 +1,82 @@ | @@ -0,0 +1,82 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
3 | +<mapper namespace="com.sincere.wechatbusiness.mapper.ChannelMapper"> | ||
4 | + <resultMap id="ChannelMap" type="com.sincere.wechatbusiness.model.Channel"> | ||
5 | + <id column="id" jdbcType="INTEGER" property="id" /> | ||
6 | + <result column="name" jdbcType="VARCHAR" property="name" /> | ||
7 | + <result column="mobile" jdbcType="VARCHAR" property="mobile" /> | ||
8 | + <result column="province" jdbcType="VARCHAR" property="province" /> | ||
9 | + <result column="city" jdbcType="VARCHAR" property="city" /> | ||
10 | + <result column="templateId" jdbcType="INTEGER" property="templateId" /> | ||
11 | + <result column="state" jdbcType="INTEGER" property="state"/> | ||
12 | + <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | ||
13 | + <result column="product_count" jdbcType="INTEGER" property="productCount" /> | ||
14 | + <result column="template_name" jdbcType="VARCHAR" property="templateName" /> | ||
15 | + <result column="province_code" jdbcType="VARCHAR" property="provinceCode" /> | ||
16 | + <result column="city_code" jdbcType="VARCHAR" property="cityCode" /> | ||
17 | + </resultMap> | ||
18 | + | ||
19 | + <select id="getList" parameterType="com.sincere.wechatbusiness.model.Channel" resultMap="ChannelMap"> | ||
20 | + select *,(select count(0) from channel_product where channelId=c.id and state=1) as product_count, | ||
21 | + (select title from template where id=c.templateId) as template_name from channel c | ||
22 | + <where> | ||
23 | + <if test="state != 0"> | ||
24 | + and state=1 | ||
25 | + </if> | ||
26 | + <if test="name!='' and name!=null"> | ||
27 | + and name like '%${name}%' | ||
28 | + </if> | ||
29 | + </where> | ||
30 | + order by create_time | ||
31 | + </select> | ||
32 | + | ||
33 | + <select id="getListCount" parameterType="com.sincere.wechatbusiness.model.Channel" resultType="java.lang.Integer"> | ||
34 | + select count(0) from channel | ||
35 | + <where> | ||
36 | + <if test="state != 0"> | ||
37 | + and state=1 | ||
38 | + </if> | ||
39 | + <if test="name!='' and name!=null"> | ||
40 | + and name like '%${name}%' | ||
41 | + </if> | ||
42 | + </where> | ||
43 | + </select> | ||
44 | + | ||
45 | + <select id="getDetail" parameterType="java.lang.Integer" resultMap="ChannelMap"> | ||
46 | + select *,(select top 1 area_code from sys_area where c.province=area_name) as province_code, | ||
47 | + (select top 1 area_code from sys_area where c.city=area_name) as city_code from channel c where id=#{id} | ||
48 | + </select> | ||
49 | + | ||
50 | + <insert id="insert" parameterType="com.sincere.wechatbusiness.model.Channel" useGeneratedKeys="true" keyProperty="id"> | ||
51 | + insert into channel (name, mobile,province,city,templateId) | ||
52 | + values (#{name,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, #{province,jdbcType=VARCHAR}, #{city,jdbcType=VARCHAR}, #{templateId,jdbcType=INTEGER} | ||
53 | + ) | ||
54 | + </insert> | ||
55 | + | ||
56 | + <update id="update" parameterType="com.sincere.wechatbusiness.model.Channel"> | ||
57 | + update channel | ||
58 | + <trim prefix="set" suffixOverrides=","> | ||
59 | + <if test="name!=null and name!=''"> | ||
60 | + name=#{name}, | ||
61 | + </if> | ||
62 | + <if test="mobile!=null and mobile!=''"> | ||
63 | + mobile=#{mobile}, | ||
64 | + </if> | ||
65 | + <if test="province!=null and province!=''"> | ||
66 | + province=#{province}, | ||
67 | + </if> | ||
68 | + <if test="city!=null and city!=''"> | ||
69 | + city=#{city}, | ||
70 | + </if> | ||
71 | + <if test="templateId!=0"> | ||
72 | + templateId=#{templateId}, | ||
73 | + </if> | ||
74 | + </trim> | ||
75 | + where id = #{id} | ||
76 | + </update> | ||
77 | + | ||
78 | + <update id="deleteChannel" parameterType="java.lang.Integer"> | ||
79 | + update channel set state=0 where id = #{id} | ||
80 | + update channel_product set state=0 where channelId = #{id} | ||
81 | + </update> | ||
82 | +</mapper> | ||
0 | \ No newline at end of file | 83 | \ No newline at end of file |
@@ -0,0 +1,41 @@ | @@ -0,0 +1,41 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
3 | +<mapper namespace="com.sincere.wechatbusiness.mapper.ChannelProductMapper"> | ||
4 | + <resultMap id="ChannelProductMap" type="com.sincere.wechatbusiness.model.ChannelProduct"> | ||
5 | + <id column="id" jdbcType="INTEGER" property="id" /> | ||
6 | + <result column="channelId" jdbcType="INTEGER" property="channelId" /> | ||
7 | + <result column="product_name" jdbcType="VARCHAR" property="productName" /> | ||
8 | + <result column="price" jdbcType="VARCHAR" property="price" /> | ||
9 | + <result column="channel_price" jdbcType="VARCHAR" property="channelPrice" /> | ||
10 | + <result column="caption" jdbcType="VARCHAR" property="caption" /> | ||
11 | + <result column="state" jdbcType="INTEGER" property="state"/> | ||
12 | + <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | ||
13 | + </resultMap> | ||
14 | + | ||
15 | + <select id="getList" parameterType="java.lang.Integer" resultMap="ChannelProductMap"> | ||
16 | + select * from channel_product where state=1 and channelId=#{id} order by create_time | ||
17 | + </select> | ||
18 | + | ||
19 | + <insert id="insert" parameterType="com.sincere.wechatbusiness.model.ChannelProduct"> | ||
20 | + insert into channel_product (channelId, product_name,price) | ||
21 | + values (#{channelId,jdbcType=INTEGER}, #{productName,jdbcType=VARCHAR}, #{price,jdbcType=VARCHAR} | ||
22 | + ) | ||
23 | + </insert> | ||
24 | + | ||
25 | + <update id="update" parameterType="com.sincere.wechatbusiness.model.ChannelProduct"> | ||
26 | + update channel_product | ||
27 | + <trim prefix="set" suffixOverrides=","> | ||
28 | + <if test="channelPrice!=null and channelPrice!=''"> | ||
29 | + channel_price=#{channelPrice}, | ||
30 | + </if> | ||
31 | + <if test="caption!=null and caption!=''"> | ||
32 | + caption=#{caption}, | ||
33 | + </if> | ||
34 | + </trim> | ||
35 | + where id = #{id} | ||
36 | + </update> | ||
37 | + | ||
38 | + <update id="deleteChannelProduct" parameterType="java.lang.Integer"> | ||
39 | + update channel_product set state=0 where channelId=#{id} | ||
40 | + </update> | ||
41 | +</mapper> | ||
0 | \ No newline at end of file | 42 | \ No newline at end of file |