Commit 845f9c995f47aae175298ea2f0558c8565a6b3b8
1 parent
e2b6d288
Exists in
master
1
Showing
6 changed files
with
256 additions
and
0 deletions
Show diff stats
src/main/java/com/sincere/wechatbusiness/controller/ChannelController.java
| ... | ... | @@ -59,6 +59,35 @@ public class ChannelController { |
| 59 | 59 | // private String domain="https://mytest.myjxt.com:51314"; |
| 60 | 60 | private String domain="https://proxy.shunzhi.net:51314"; |
| 61 | 61 | |
| 62 | + @RequestMapping(value = "getBannerNextList",method = RequestMethod.GET) | |
| 63 | + @ApiOperation(value = "获取左右轮播图列表") | |
| 64 | + public BaseDto<List<BannerNext>> getBannerNextList(int channelId){ | |
| 65 | + BaseDto<List<BannerNext>> result = new BaseDto<>(); | |
| 66 | + result.setData(bannerService.getBannerNextList(channelId)); | |
| 67 | + return result ; | |
| 68 | + } | |
| 69 | + | |
| 70 | + @RequestMapping(value = "insertBannerNext",method = RequestMethod.POST) | |
| 71 | + @ApiOperation(value = "新增左右轮播图") | |
| 72 | + public BaseDto insertBannerNext(@RequestBody BannerNext bannerNext){ | |
| 73 | + bannerService.insertBannerNext(bannerNext); | |
| 74 | + return new BaseDto(); | |
| 75 | + } | |
| 76 | + | |
| 77 | + @RequestMapping(value = "updateBannerNext",method = RequestMethod.POST) | |
| 78 | + @ApiOperation(value = "修改左右轮播图") | |
| 79 | + public BaseDto updateBannerNext(@RequestBody BannerNext bannerNext){ | |
| 80 | + bannerService.update(bannerNext); | |
| 81 | + return new BaseDto(); | |
| 82 | + } | |
| 83 | + | |
| 84 | + @RequestMapping(value = "deleteBannerNext",method = RequestMethod.GET) | |
| 85 | + @ApiOperation(value = "删除左右轮播图") | |
| 86 | + public BaseDto deleteBannerNext(int id){ | |
| 87 | + bannerService.deleteBannerNext(id); | |
| 88 | + return new BaseDto(); | |
| 89 | + } | |
| 90 | + | |
| 62 | 91 | @RequestMapping(value = "GetChannelList",method = RequestMethod.POST) |
| 63 | 92 | @ApiOperation(value = "获取渠道商列表") |
| 64 | 93 | public BaseDto<Page<Channel>> GetChannelList(@RequestBody ChannelDto channelDto){ | ... | ... |
src/main/java/com/sincere/wechatbusiness/mapper/BannerNextMapper.java
0 → 100644
| ... | ... | @@ -0,0 +1,24 @@ |
| 1 | +package com.sincere.wechatbusiness.mapper; | |
| 2 | + | |
| 3 | +import com.sincere.wechatbusiness.model.BannerNext; | |
| 4 | + | |
| 5 | +import java.util.List; | |
| 6 | + | |
| 7 | +public interface BannerNextMapper { | |
| 8 | + | |
| 9 | + List<BannerNext> getByChannel(int channelId); | |
| 10 | + | |
| 11 | + int update(BannerNext bannerNext); | |
| 12 | + | |
| 13 | + int deleteByPrimaryKey(Integer id); | |
| 14 | + | |
| 15 | + int insert(BannerNext record); | |
| 16 | + | |
| 17 | + int insertSelective(BannerNext record); | |
| 18 | + | |
| 19 | + BannerNext selectByPrimaryKey(Integer id); | |
| 20 | + | |
| 21 | + int updateByPrimaryKeySelective(BannerNext record); | |
| 22 | + | |
| 23 | + int updateByPrimaryKey(BannerNext record); | |
| 24 | +} | |
| 0 | 25 | \ No newline at end of file | ... | ... |
src/main/java/com/sincere/wechatbusiness/model/BannerNext.java
0 → 100644
| ... | ... | @@ -0,0 +1,55 @@ |
| 1 | +package com.sincere.wechatbusiness.model; | |
| 2 | + | |
| 3 | +import java.util.Date; | |
| 4 | + | |
| 5 | +public class BannerNext { | |
| 6 | + private Integer id; | |
| 7 | + | |
| 8 | + private String imgUrl; | |
| 9 | + | |
| 10 | + private Integer channelId; | |
| 11 | + | |
| 12 | + private Date createTime; | |
| 13 | + | |
| 14 | + private Integer sort; | |
| 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 getImgUrl() { | |
| 25 | + return imgUrl; | |
| 26 | + } | |
| 27 | + | |
| 28 | + public void setImgUrl(String imgUrl) { | |
| 29 | + this.imgUrl = imgUrl; | |
| 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 Date getCreateTime() { | |
| 41 | + return createTime; | |
| 42 | + } | |
| 43 | + | |
| 44 | + public void setCreateTime(Date createTime) { | |
| 45 | + this.createTime = createTime; | |
| 46 | + } | |
| 47 | + | |
| 48 | + public Integer getSort() { | |
| 49 | + return sort; | |
| 50 | + } | |
| 51 | + | |
| 52 | + public void setSort(Integer sort) { | |
| 53 | + this.sort = sort; | |
| 54 | + } | |
| 55 | +} | |
| 0 | 56 | \ No newline at end of file | ... | ... |
src/main/java/com/sincere/wechatbusiness/service/BannerService.java
| 1 | 1 | package com.sincere.wechatbusiness.service; |
| 2 | 2 | |
| 3 | 3 | import com.sincere.wechatbusiness.model.Banner; |
| 4 | +import com.sincere.wechatbusiness.model.BannerNext; | |
| 4 | 5 | |
| 5 | 6 | import java.util.List; |
| 6 | 7 | |
| ... | ... | @@ -12,4 +13,14 @@ public interface BannerService { |
| 12 | 13 | int update(Banner banner); |
| 13 | 14 | |
| 14 | 15 | int deleteBanner(int id); |
| 16 | + | |
| 17 | + | |
| 18 | + List<BannerNext> getBannerNextList(int channelId); | |
| 19 | + | |
| 20 | + int insertBannerNext(BannerNext bannerNext); | |
| 21 | + | |
| 22 | + int deleteBannerNext(int id); | |
| 23 | + | |
| 24 | + int update(BannerNext bannerNext); | |
| 25 | + | |
| 15 | 26 | } | ... | ... |
src/main/java/com/sincere/wechatbusiness/service/impl/BannerServiceImpl.java
| 1 | 1 | package com.sincere.wechatbusiness.service.impl; |
| 2 | 2 | |
| 3 | 3 | import com.sincere.wechatbusiness.mapper.BannerMapper; |
| 4 | +import com.sincere.wechatbusiness.mapper.BannerNextMapper; | |
| 4 | 5 | import com.sincere.wechatbusiness.model.Banner; |
| 6 | +import com.sincere.wechatbusiness.model.BannerNext; | |
| 5 | 7 | import com.sincere.wechatbusiness.service.BannerService; |
| 6 | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | +import org.springframework.scheduling.annotation.Async; | |
| 7 | 10 | import org.springframework.stereotype.Service; |
| 8 | 11 | |
| 9 | 12 | import java.util.List; |
| ... | ... | @@ -13,6 +16,9 @@ public class BannerServiceImpl implements BannerService { |
| 13 | 16 | @Autowired |
| 14 | 17 | BannerMapper bannerMapper; |
| 15 | 18 | |
| 19 | + @Autowired | |
| 20 | + BannerNextMapper bannerNextMapper; | |
| 21 | + | |
| 16 | 22 | @Override |
| 17 | 23 | public List<Banner> getList(int id){return bannerMapper.getList(id);} |
| 18 | 24 | |
| ... | ... | @@ -24,4 +30,24 @@ public class BannerServiceImpl implements BannerService { |
| 24 | 30 | |
| 25 | 31 | @Override |
| 26 | 32 | public int deleteBanner(int id){return bannerMapper.deleteBanner(id);} |
| 33 | + | |
| 34 | + @Override | |
| 35 | + public List<BannerNext> getBannerNextList(int channelId) { | |
| 36 | + return bannerNextMapper.getByChannel(channelId); | |
| 37 | + } | |
| 38 | + | |
| 39 | + @Override | |
| 40 | + public int insertBannerNext(BannerNext bannerNext) { | |
| 41 | + return bannerNextMapper.insert(bannerNext); | |
| 42 | + } | |
| 43 | + | |
| 44 | + @Override | |
| 45 | + public int deleteBannerNext(int id) { | |
| 46 | + return bannerNextMapper.deleteByPrimaryKey(id); | |
| 47 | + } | |
| 48 | + | |
| 49 | + @Override | |
| 50 | + public int update(BannerNext bannerNext) { | |
| 51 | + return bannerNextMapper.update(bannerNext); | |
| 52 | + } | |
| 27 | 53 | } | ... | ... |
| ... | ... | @@ -0,0 +1,111 @@ |
| 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.BannerNextMapper"> | |
| 4 | + <resultMap id="BaseResultMap" type="com.sincere.wechatbusiness.model.BannerNext"> | |
| 5 | + <id column="id" jdbcType="INTEGER" property="id" /> | |
| 6 | + <result column="img_url" jdbcType="VARCHAR" property="imgUrl" /> | |
| 7 | + <result column="channel_id" jdbcType="INTEGER" property="channelId" /> | |
| 8 | + <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | |
| 9 | + <result column="sort" jdbcType="INTEGER" property="sort" /> | |
| 10 | + </resultMap> | |
| 11 | + <sql id="Base_Column_List"> | |
| 12 | + id, img_url, channel_id, create_time, sort | |
| 13 | + </sql> | |
| 14 | + | |
| 15 | + <select id="getByChannel" parameterType="java.lang.Integer" resultMap="BaseResultMap"> | |
| 16 | + select * from banner_next where channel_id = #{channelId} order by sort | |
| 17 | + </select> | |
| 18 | + | |
| 19 | + <update id="update" parameterType="com.sincere.wechatbusiness.model.BannerNext"> | |
| 20 | + update banner_next | |
| 21 | + <trim prefix="set" suffixOverrides=","> | |
| 22 | + <if test="imgUrl!=null and imgUrl!=''"> | |
| 23 | + img_url=#{imgUrl}, | |
| 24 | + </if> | |
| 25 | + <if test="sort!=null and sort!=''"> | |
| 26 | + sort=#{sort}, | |
| 27 | + </if> | |
| 28 | + </trim> | |
| 29 | + where id = #{id} | |
| 30 | + </update> | |
| 31 | + | |
| 32 | + <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> | |
| 33 | + select | |
| 34 | + <include refid="Base_Column_List" /> | |
| 35 | + from banner_next | |
| 36 | + where id = #{id,jdbcType=INTEGER} | |
| 37 | + </select> | |
| 38 | + <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> | |
| 39 | + delete from banner_next | |
| 40 | + where id = #{id,jdbcType=INTEGER} | |
| 41 | + </delete> | |
| 42 | + <insert id="insert" parameterType="com.sincere.wechatbusiness.model.BannerNext"> | |
| 43 | + insert into banner_next ( img_url, channel_id, | |
| 44 | + create_time, sort) | |
| 45 | + values ( #{imgUrl,jdbcType=VARCHAR}, #{channelId,jdbcType=INTEGER}, | |
| 46 | + getdate(), #{sort,jdbcType=INTEGER}) | |
| 47 | + </insert> | |
| 48 | + <insert id="insertSelective" parameterType="com.sincere.wechatbusiness.model.BannerNext"> | |
| 49 | + insert into banner_next | |
| 50 | + <trim prefix="(" suffix=")" suffixOverrides=","> | |
| 51 | + <if test="id != null"> | |
| 52 | + id, | |
| 53 | + </if> | |
| 54 | + <if test="imgUrl != null"> | |
| 55 | + img_url, | |
| 56 | + </if> | |
| 57 | + <if test="channelId != null"> | |
| 58 | + channel_id, | |
| 59 | + </if> | |
| 60 | + <if test="createTime != null"> | |
| 61 | + create_time, | |
| 62 | + </if> | |
| 63 | + <if test="sort != null"> | |
| 64 | + sort, | |
| 65 | + </if> | |
| 66 | + </trim> | |
| 67 | + <trim prefix="values (" suffix=")" suffixOverrides=","> | |
| 68 | + <if test="id != null"> | |
| 69 | + #{id,jdbcType=INTEGER}, | |
| 70 | + </if> | |
| 71 | + <if test="imgUrl != null"> | |
| 72 | + #{imgUrl,jdbcType=VARCHAR}, | |
| 73 | + </if> | |
| 74 | + <if test="channelId != null"> | |
| 75 | + #{channelId,jdbcType=INTEGER}, | |
| 76 | + </if> | |
| 77 | + <if test="createTime != null"> | |
| 78 | + #{createTime,jdbcType=TIMESTAMP}, | |
| 79 | + </if> | |
| 80 | + <if test="sort != null"> | |
| 81 | + #{sort,jdbcType=INTEGER}, | |
| 82 | + </if> | |
| 83 | + </trim> | |
| 84 | + </insert> | |
| 85 | + <update id="updateByPrimaryKeySelective" parameterType="com.sincere.wechatbusiness.model.BannerNext"> | |
| 86 | + update banner_next | |
| 87 | + <set> | |
| 88 | + <if test="imgUrl != null"> | |
| 89 | + img_url = #{imgUrl,jdbcType=VARCHAR}, | |
| 90 | + </if> | |
| 91 | + <if test="channelId != null"> | |
| 92 | + channel_id = #{channelId,jdbcType=INTEGER}, | |
| 93 | + </if> | |
| 94 | + <if test="createTime != null"> | |
| 95 | + create_time = #{createTime,jdbcType=TIMESTAMP}, | |
| 96 | + </if> | |
| 97 | + <if test="sort != null"> | |
| 98 | + sort = #{sort,jdbcType=INTEGER}, | |
| 99 | + </if> | |
| 100 | + </set> | |
| 101 | + where id = #{id,jdbcType=INTEGER} | |
| 102 | + </update> | |
| 103 | + <update id="updateByPrimaryKey" parameterType="com.sincere.wechatbusiness.model.BannerNext"> | |
| 104 | + update banner_next | |
| 105 | + set img_url = #{imgUrl,jdbcType=VARCHAR}, | |
| 106 | + channel_id = #{channelId,jdbcType=INTEGER}, | |
| 107 | + create_time = #{createTime,jdbcType=TIMESTAMP}, | |
| 108 | + sort = #{sort,jdbcType=INTEGER} | |
| 109 | + where id = #{id,jdbcType=INTEGER} | |
| 110 | + </update> | |
| 111 | +</mapper> | |
| 0 | 112 | \ No newline at end of file | ... | ... |