Merge remote-tracking branch 'origin/master'

master
wayn 4 years ago
commit 3e1b1b3ab5

@ -1,9 +1,13 @@
package com.wayn.admin.api.controller.shop;
import com.wayn.admin.api.domain.shop.ShopBanner;
import com.wayn.admin.api.domain.shop.ShopChannel;
import com.wayn.admin.api.service.shop.IBannerService;
import com.wayn.admin.api.service.shop.IChannelService;
import com.wayn.common.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("shop/banner")
@ -11,4 +15,30 @@ public class BannerController {
@Autowired
private IBannerService iBannerService;
@GetMapping("/list")
public R list(ShopBanner banner) {
return R.success().add("channelList", iBannerService.list(banner));
}
@PostMapping("/list")
public R addChannel(@Validated @RequestBody ShopBanner banner) {
return R.result(iBannerService.save(banner));
}
@PutMapping("/list")
public R updateChannel(@Validated @RequestBody ShopBanner banner) {
return R.result(iBannerService.updateById(banner));
}
@GetMapping("{bannerId}")
public R getChannel(@PathVariable Long bannerId) {
return R.success().add("data", iBannerService.getById(bannerId));
}
@DeleteMapping("{bannerId}")
public R deleteChannel(@PathVariable Long bannerId) {
return R.success().add("data", iBannerService.removeById(bannerId));
}
}

@ -5,9 +5,8 @@ import com.wayn.admin.api.service.shop.IChannelService;
import com.wayn.common.base.BaseController;
import com.wayn.common.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("shop/channel")
@ -16,10 +15,28 @@ public class ChannelController extends BaseController {
@Autowired
private IChannelService iChannelService;
// @PreAuthorize("@ss.hasPermi('system:role:list')")
@GetMapping("/list")
public R list(ShopChannel channel) {
return R.success().add("channelList", iChannelService.list(channel));
}
@PostMapping("/list")
public R addChannel(@Validated @RequestBody ShopChannel channel) {
return R.result(iChannelService.save(channel));
}
@PutMapping("/list")
public R updateChannel(@Validated @RequestBody ShopChannel channel) {
return R.result(iChannelService.updateById(channel));
}
@GetMapping("{channelId}")
public R getChannel(@PathVariable Long channelId) {
return R.success().add("data", iChannelService.getById(channelId));
}
@DeleteMapping("{channelId}")
public R deleteChannel(@PathVariable Long channelId) {
return R.success().add("data", iChannelService.removeById(channelId));
}
}

@ -2,6 +2,11 @@ package com.wayn.admin.api.mapper.shop;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wayn.admin.api.domain.shop.ShopBanner;
import com.wayn.admin.api.domain.shop.ShopChannel;
import java.util.List;
public interface BannerMapper extends BaseMapper<ShopBanner> {
List<ShopBanner> selectBannerList(ShopBanner banner);
}

@ -2,6 +2,16 @@ package com.wayn.admin.api.service.shop;
import com.baomidou.mybatisplus.extension.service.IService;
import com.wayn.admin.api.domain.shop.ShopBanner;
import com.wayn.admin.api.domain.shop.ShopChannel;
import java.util.List;
public interface IBannerService extends IService<ShopBanner> {
/**
* banner
*
* @param banner
* @return banner
*/
List<ShopBanner> list(ShopBanner banner);
}

@ -4,8 +4,21 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wayn.admin.api.domain.shop.ShopBanner;
import com.wayn.admin.api.mapper.shop.BannerMapper;
import com.wayn.admin.api.service.shop.IBannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.Banner;
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class BannerServiceImpl extends ServiceImpl<BannerMapper, ShopBanner> implements IBannerService {
@Autowired
private BannerMapper bannerMapper;
@Override
public List<ShopBanner> list(ShopBanner banner) {
return bannerMapper.selectBannerList(banner);
}
}

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.wayn.admin.api.mapper.shop.BannerMapper">
<resultMap type="com.wayn.admin.api.domain.shop.ShopBanner" id="ShopBannerResult">
<result property="id" column="id" />
<result property="title" column="title" />
<result property="page" column="page" />
<result property="jumpUrl" column="jump_url" />
<result property="imgUrl" column="img_url" />
<result property="sort" column="sort" />
<result property="delFlag" column="del_flag" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectBannerVo">
select b.id, b.title, b.page, b.jump_url, b.img_url, b.sort,
b.del_flag, b.create_time, b.update_by, b.update_time, b.remark
from shop_banner b
</sql>
<select id="selectBannerList" parameterType="com.wayn.admin.api.domain.shop.ShopBanner" resultMap="ShopBannerResult">
<include refid="selectBannerVo"/>
<where>
<if test="title != null and title != ''">
AND title like concat('%', #{title}, '%')
</if>
</where>
</select>
</mapper>

@ -1,11 +1,13 @@
package com.wayn.common.exception;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
*
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class BusinessException extends RuntimeException {
private Integer code;

Loading…
Cancel
Save