From 993fa37e64912454afaa9ad1f64291a831a07824 Mon Sep 17 00:00:00 2001 From: masterspirit Date: Sat, 11 Aug 2018 17:07:06 +0800 Subject: [PATCH 1/5] =?UTF-8?q?crud=E6=B7=BB=E5=8A=A0=E7=A7=9F=E6=88=B7id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WxCouponChannelController.java | 5 + .../simple/controller/WxCouponController.java | 208 +++++++++--------- 2 files changed, 109 insertions(+), 104 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/simple/controller/WxCouponChannelController.java b/mallinkAdmin/src/main/java/com/simple/controller/WxCouponChannelController.java index 2dcf012fe..c02ab3fe0 100644 --- a/mallinkAdmin/src/main/java/com/simple/controller/WxCouponChannelController.java +++ b/mallinkAdmin/src/main/java/com/simple/controller/WxCouponChannelController.java @@ -2,6 +2,7 @@ package com.simple.controller; import com.simple.domain.dto.WxCouponChannelDto; import com.simple.domain.po.MallUserInfo; +import io.swagger.annotations.Api; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -21,6 +22,7 @@ import java.util.List; @RestController @RequestMapping("wxCouponChannel") +@Api(description="优惠券投放接口") public class WxCouponChannelController extends BaseController { @Autowired @@ -36,6 +38,7 @@ public class WxCouponChannelController extends BaseController @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) public ResultData list(@ModelAttribute WxCouponChannel wxCouponChannel,Integer pageNum, Integer pageSize) { if (null == wxCouponChannel) wxCouponChannel = new WxCouponChannel(); + wxCouponChannel.setTenantId(getUser().getTenantId()); final PageInfo page = wxCouponChannelService.listAsPage(wxCouponChannel, pageNum, pageSize); return new ResultData(page); } @@ -45,6 +48,7 @@ public class WxCouponChannelController extends BaseController public ResultData add(@RequestBody WxCouponChannel wxCouponChannel) { //Assert.notNull(wxCouponChannel.getName(), "角色名不能为空"); //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); + wxCouponChannel.setTenantId(getUser().getTenantId()); wxCouponChannelService.saveOrUpdate(wxCouponChannel); return new ResultData(); } @@ -52,6 +56,7 @@ public class WxCouponChannelController extends BaseController @ApiOperation("根据id更新接口") @PostMapping("update") public ResultData update(@RequestBody WxCouponChannel wxCouponChannel) { + wxCouponChannel.setTenantId(getUser().getTenantId()); wxCouponChannelService.saveOrUpdate(wxCouponChannel); return new ResultData(); } diff --git a/mallinkAdmin/src/main/java/com/simple/controller/WxCouponController.java b/mallinkAdmin/src/main/java/com/simple/controller/WxCouponController.java index 1351fe105..edaa0dfd3 100644 --- a/mallinkAdmin/src/main/java/com/simple/controller/WxCouponController.java +++ b/mallinkAdmin/src/main/java/com/simple/controller/WxCouponController.java @@ -1,104 +1,104 @@ -package com.simple.controller; - -import org.apache.commons.lang3.StringUtils; -import org.apache.log4j.Logger; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import com.alibaba.fastjson.JSON; -import com.github.pagehelper.PageInfo; -import com.simple.common.Result; -import com.simple.common.ResultData; -import com.simple.domain.dto.WxCounponDto; -import com.simple.domain.po.WxCoupon; -import com.simple.domain.po.WxMerchant; -import com.simple.service.WxCouponService; -import com.simple.service.WxMerchantService; - -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; - -@RestController -@RequestMapping("wxCoupon") -@Api(description="优惠券接口") -public class WxCouponController extends BaseController -{ - @Autowired - private WxCouponService wxCouponService; - - @Autowired - private WxMerchantService wxMerchantService; - - private Logger logger = Logger.getLogger(WxCouponController.class); - - @ApiOperation("分页列表接口") - @GetMapping("list") - @ApiImplicitParams({ - @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), - @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) - public ResultData list(@ModelAttribute WxCoupon wxCoupon,Integer pageNum, Integer pageSize) { - if (null == wxCoupon) wxCoupon = new WxCoupon(); - if(wxCoupon.getType()!=null&&wxCoupon.getType()==-1){ - wxCoupon.setType(null); - } - final PageInfo page = wxCouponService.listAsPage(wxCoupon, pageNum, pageSize); - return new ResultData(page); - } - - @ApiOperation("新增接口") - @PostMapping("add") - public ResultData add(@RequestBody WxCoupon wxCoupon) { - //Assert.notNull(wxCoupon.getName(), "角色名不能为空"); - //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); - if(StringUtils.isNotBlank(wxCoupon.getBusiness())) { - String[] arys = wxCoupon.getBusiness().split(","); - wxCoupon.setBusiness(JSON.toJSONString(arys)); - } - Long id = wxCouponService.saveOrUpdate(wxCoupon); - return new ResultData(id); - } - - @ApiOperation("根据id更新接口") - @PostMapping("update") - public ResultData update(@RequestBody WxCoupon wxCoupon) { - if(wxCoupon.getId()==null) { - return new ResultData(ResultData.ERROR,"缺少id"); - } - if(StringUtils.isNotBlank(wxCoupon.getBusiness())) { - String[] arys = wxCoupon.getBusiness().split(","); - wxCoupon.setBusiness(JSON.toJSONString(arys)); - } - Long id = wxCouponService.saveOrUpdate(wxCoupon); - return new ResultData(id); - } - - @ApiOperation("根据id删除接口") - @GetMapping("/del") - @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) - public ResultData delete(Long id) { - wxCouponService.deleteById(id); - return new ResultData(Result.SUCCESS, "删除成功", null); - } - - @ApiOperation("根据id查询接口") - @GetMapping("/findById") - @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) - public ResultData findById(Long id) { - WxCoupon c = wxCouponService.getById(id); - WxCounponDto dto = new WxCounponDto(); - org.springframework.beans.BeanUtils.copyProperties(c, dto); - WxMerchant merchant = wxMerchantService.getById(c.getMerchantId()); - dto.setWxMerchant(merchant); - return new ResultData(Result.SUCCESS,"查询成功",dto); - } - - - -} +package com.simple.controller; + +import org.apache.commons.lang3.StringUtils; +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.alibaba.fastjson.JSON; +import com.github.pagehelper.PageInfo; +import com.simple.common.Result; +import com.simple.common.ResultData; +import com.simple.domain.dto.WxCounponDto; +import com.simple.domain.po.WxCoupon; +import com.simple.domain.po.WxMerchant; +import com.simple.service.WxCouponService; +import com.simple.service.WxMerchantService; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; + +@RestController +@RequestMapping("wxCoupon") +@Api(description="优惠券接口") +public class WxCouponController extends BaseController +{ + @Autowired + private WxCouponService wxCouponService; + + @Autowired + private WxMerchantService wxMerchantService; + + private Logger logger = Logger.getLogger(WxCouponController.class); + + @ApiOperation("分页列表接口") + @GetMapping("list") + @ApiImplicitParams({ + @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), + @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) + public ResultData list(@ModelAttribute WxCoupon wxCoupon,Integer pageNum, Integer pageSize) { + if (null == wxCoupon) wxCoupon = new WxCoupon(); + if(wxCoupon.getType()!=null&&wxCoupon.getType()==-1){ + wxCoupon.setType(null); + } + final PageInfo page = wxCouponService.listAsPage(wxCoupon, pageNum, pageSize); + return new ResultData(page); + } + + @ApiOperation("新增接口") + @PostMapping("add") + public ResultData add(@RequestBody WxCoupon wxCoupon) { + //Assert.notNull(wxCoupon.getName(), "角色名不能为空"); + //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); + if(StringUtils.isNotBlank(wxCoupon.getBusiness())) { + String[] arys = wxCoupon.getBusiness().split(","); + wxCoupon.setBusiness(JSON.toJSONString(arys)); + } + Long id = wxCouponService.saveOrUpdate(wxCoupon); + return new ResultData(id); + } + + @ApiOperation("根据id更新接口") + @PostMapping("update") + public ResultData update(@RequestBody WxCoupon wxCoupon) { + if(wxCoupon.getId()==null) { + return new ResultData(ResultData.ERROR,"缺少id"); + } + if(StringUtils.isNotBlank(wxCoupon.getBusiness())) { + String[] arys = wxCoupon.getBusiness().split(","); + wxCoupon.setBusiness(JSON.toJSONString(arys)); + } + Long id = wxCouponService.saveOrUpdate(wxCoupon); + return new ResultData(id); + } + + @ApiOperation("根据id删除接口") + @GetMapping("/del") + @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) + public ResultData delete(Long id) { + wxCouponService.deleteById(id); + return new ResultData(Result.SUCCESS, "删除成功", null); + } + + @ApiOperation("根据id查询接口") + @GetMapping("/findById") + @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) + public ResultData findById(Long id) { + WxCoupon c = wxCouponService.getById(id); + WxCounponDto dto = new WxCounponDto(); + org.springframework.beans.BeanUtils.copyProperties(c, dto); + WxMerchant merchant = wxMerchantService.getById(c.getMerchantId()); + dto.setWxMerchant(merchant); + return new ResultData(Result.SUCCESS,"查询成功",dto); + } + + + +} From 981201cf14502429f7954a7d5484e376c0a51c1a Mon Sep 17 00:00:00 2001 From: masterspirit Date: Sun, 12 Aug 2018 12:26:57 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E5=8D=A1=E5=88=B8=E6=8E=A8=E5=B9=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WxCouponSpreadController.java | 71 ++++++++ .../com/simple/domain/po/WxCouponSpread.java | 171 ++++++++++++++++++ .../simple/mapper/WxCouponSpreadMapper.java | 17 ++ .../simple/service/WxCouponSpreadService.java | 48 +++++ .../impl/WxCouponSpreadServiceImpl.java | 54 ++++++ .../resources/mapper/WxCouponSpreadMapper.xml | 80 ++++++++ 6 files changed, 441 insertions(+) create mode 100644 mallinkAdmin/src/main/java/com/simple/controller/WxCouponSpreadController.java create mode 100644 mallinkService/src/main/java/com/simple/domain/po/WxCouponSpread.java create mode 100644 mallinkService/src/main/java/com/simple/mapper/WxCouponSpreadMapper.java create mode 100644 mallinkService/src/main/java/com/simple/service/WxCouponSpreadService.java create mode 100644 mallinkService/src/main/java/com/simple/service/impl/WxCouponSpreadServiceImpl.java create mode 100644 mallinkService/src/main/resources/mapper/WxCouponSpreadMapper.xml diff --git a/mallinkAdmin/src/main/java/com/simple/controller/WxCouponSpreadController.java b/mallinkAdmin/src/main/java/com/simple/controller/WxCouponSpreadController.java new file mode 100644 index 000000000..aa55eda13 --- /dev/null +++ b/mallinkAdmin/src/main/java/com/simple/controller/WxCouponSpreadController.java @@ -0,0 +1,71 @@ +package com.simple.controller; + +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.Assert; +import org.springframework.web.bind.annotation.*; + +import com.github.pagehelper.PageInfo; +import com.simple.common.Result; +import com.simple.common.ResultData; + +import com.simple.domain.po.WxCouponSpread; +import com.simple.service.WxCouponSpreadService; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; + +@RestController +@RequestMapping("wxCouponSpread") +public class WxCouponSpreadController extends BaseController +{ + @Autowired + private WxCouponSpreadService wxCouponSpreadService; + + private Logger logger = Logger.getLogger(WxCouponSpreadController.class); + + @ApiOperation("分页列表接口") + @GetMapping("list") + @ApiImplicitParams({ + @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), + @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) + public ResultData list(@ModelAttribute WxCouponSpread wxCouponSpread,Integer pageNum, Integer pageSize) { + if (null == wxCouponSpread) wxCouponSpread = new WxCouponSpread(); + final PageInfo page = wxCouponSpreadService.listAsPage(wxCouponSpread, pageNum, pageSize); + return new ResultData(page); + } + + @ApiOperation("新增接口") + @PostMapping("add") + public ResultData add(@RequestBody WxCouponSpread wxCouponSpread) { + //Assert.notNull(wxCouponSpread.getName(), "角色名不能为空"); + //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); + wxCouponSpreadService.saveOrUpdate(wxCouponSpread); + return new ResultData(); + } + + @ApiOperation("根据id更新接口") + @PostMapping("update") + public ResultData update(@RequestBody WxCouponSpread wxCouponSpread) { + wxCouponSpreadService.saveOrUpdate(wxCouponSpread); + return new ResultData(); + } + + @ApiOperation("根据id删除接口") + @GetMapping("/del") + @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) + public ResultData delete(Long id) { + wxCouponSpreadService.deleteById(id); + return new ResultData(Result.SUCCESS, "删除成功", null); + } + + @ApiOperation("根据id查询接口") + @GetMapping("/findById") + @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) + public ResultData findById(Long id) { + return new ResultData(Result.SUCCESS,"查询成功",wxCouponSpreadService.getById(id)); + } + + + +} diff --git a/mallinkService/src/main/java/com/simple/domain/po/WxCouponSpread.java b/mallinkService/src/main/java/com/simple/domain/po/WxCouponSpread.java new file mode 100644 index 000000000..5a63c951a --- /dev/null +++ b/mallinkService/src/main/java/com/simple/domain/po/WxCouponSpread.java @@ -0,0 +1,171 @@ +package com.simple.domain.po; + +import javax.persistence.*; +import java.util.*; +import java.math.*; +import javax.persistence.Transient; +import java.util.List; +import javax.persistence.Id; +import java.io.Serializable; + +@Table(name = "wx_coupon_spread") +public class WxCouponSpread implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + protected Long id; + + @Transient + protected List ids; + @Transient + protected String sortColumns; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getSortColumns() { + return sortColumns; + } + + public List getIds() { + return ids; + } + public void setIds(List ids) { + this.ids = ids; + } + + + + /*券id**/ + @io.swagger.annotations.ApiModelProperty(value="券id",name="couponId") + private Long couponId; + /*标题**/ + @io.swagger.annotations.ApiModelProperty(value="标题",name="title") + private String title; + /*分享内容**/ + @io.swagger.annotations.ApiModelProperty(value="分享内容",name="content") + private String content; + /*分享图片**/ + @io.swagger.annotations.ApiModelProperty(value="分享图片",name="image") + private String image; + /*链接地址**/ + @io.swagger.annotations.ApiModelProperty(value="链接地址",name="linkUrl") + private String linkUrl; + /*创建时间**/ + @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") + private Date createDate; + /*修改时间**/ + @io.swagger.annotations.ApiModelProperty(value="修改时间",name="updateDate") + private Date updateDate; + public Long getCouponId() { + return couponId; + } + public void setCouponId(Long _couponId) { + couponId = _couponId; + } + public String getTitle() { + return title; + } + public void setTitle(String _title) { + title = _title; + } + public String getContent() { + return content; + } + public void setContent(String _content) { + content = _content; + } + public String getImage() { + return image; + } + public void setImage(String _image) { + image = _image; + } + public String getLinkUrl() { + return linkUrl; + } + public void setLinkUrl(String _linkUrl) { + linkUrl = _linkUrl; + } + public Date getCreateDate() { + return createDate; + } + public void setCreateDate(Date _createDate) { + createDate = _createDate; + } + public Date getUpdateDate() { + return updateDate; + } + public void setUpdateDate(Date _updateDate) { + updateDate = _updateDate; + } + + + + public static enum Field + { + Id_ASC("`id` ASC"),Id_DESC("`id` DESC") + ,CouponId_ASC("`couponId` ASC"),CouponId_DESC("`couponId` DESC") + ,Title_ASC("`title` ASC"),Title_DESC("`title` DESC") + ,Content_ASC("`content` ASC"),Content_DESC("`content` DESC") + ,Image_ASC("`image` ASC"),Image_DESC("`image` DESC") + ,LinkUrl_ASC("`linkUrl` ASC"),LinkUrl_DESC("`linkUrl` DESC") + ,CreateDate_ASC("`createDate` ASC"),CreateDate_DESC("`createDate` DESC") + ,UpdateDate_ASC("`updateDate` ASC"),UpdateDate_DESC("`updateDate` DESC") + ; + private String value; + Field(String value){ + this.value = value; + } + public String getValue() { + return value; + } + public void setCol(String value) { + this.value = value; + } + @Override + public String toString() { + return this.getValue(); + } + } + + public void setSortColumns(Field... fields) + { + if (fields == null || fields.length == 0) { + return; + } + for (int k = 0; k < fields.length; k++) { + if (fields[k] == null) { + return; + } + } + StringBuilder sb = new StringBuilder(fields[0].toString()); + for (int k = 1; k < fields.length; k++) { + sb.append(","); + sb.append(fields[k].toString()); + } + + } + + public void setSortColumns(String sortColumns) + { + if (sortColumns == null || "".equals(sortColumns.trim())) { + return; + } + if (sortColumns.contains(",")) { + String[] cols = sortColumns.split(","); + List fList = new ArrayList(); + for (int k = 0; k < cols.length; k++) { + fList.add(Field.valueOf(cols[k])); + } + this.setSortColumns(fList.toArray(new Field[fList.size()])); + } else { + this.setSortColumns(Field.valueOf(sortColumns)); + } + } +} diff --git a/mallinkService/src/main/java/com/simple/mapper/WxCouponSpreadMapper.java b/mallinkService/src/main/java/com/simple/mapper/WxCouponSpreadMapper.java new file mode 100644 index 000000000..c77547842 --- /dev/null +++ b/mallinkService/src/main/java/com/simple/mapper/WxCouponSpreadMapper.java @@ -0,0 +1,17 @@ +package com.simple.mapper; + +import java.util.*; +import com.simple.common.CommonMapper; +import org.apache.ibatis.annotations.Param; +import com.simple.domain.po.WxCouponSpread; + +public interface WxCouponSpreadMapper extends CommonMapper { + + List findList(WxCouponSpread wxCouponSpread); + + + + + + +} diff --git a/mallinkService/src/main/java/com/simple/service/WxCouponSpreadService.java b/mallinkService/src/main/java/com/simple/service/WxCouponSpreadService.java new file mode 100644 index 000000000..e75dc9867 --- /dev/null +++ b/mallinkService/src/main/java/com/simple/service/WxCouponSpreadService.java @@ -0,0 +1,48 @@ +package com.simple.service; + +import java.util.*; +import com.github.pagehelper.PageInfo; +import com.simple.domain.po.WxCouponSpread; + +public interface WxCouponSpreadService { + + /** + * 根据实体查询分页列表 + * + * @param record + * @param offset + * @param limit + * @return + */ + PageInfo listAsPage(WxCouponSpread record, Integer pageIndex, Integer pageSize); + + /** + * 根据Id获得实体 + * + * @param id + * @return + */ + WxCouponSpread getById(Long id); + + /** + * 保存或更新实体 + * + * @param record + */ + void saveOrUpdate(WxCouponSpread record); + + /** + * 根据Id删除实体 + * + * @param id + */ + void deleteById(Long id); + + + + + + + + +} diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxCouponSpreadServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxCouponSpreadServiceImpl.java new file mode 100644 index 000000000..f665d57f1 --- /dev/null +++ b/mallinkService/src/main/java/com/simple/service/impl/WxCouponSpreadServiceImpl.java @@ -0,0 +1,54 @@ +package com.simple.service.impl; + +import java.util.*; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.simple.domain.po.WxCouponSpread; +import com.simple.mapper.WxCouponSpreadMapper; +import com.simple.service.WxCouponSpreadService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.simple.common.IdWorker; + +@Service +public class WxCouponSpreadServiceImpl implements WxCouponSpreadService { + + @Autowired + WxCouponSpreadMapper wxCouponSpreadMapper; + + + @Override + public PageInfo listAsPage(WxCouponSpread record, Integer pageIndex, Integer pageSize) { + return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponSpreadMapper.findList(record)); + } + + @Override + public WxCouponSpread getById(Long id) { + return wxCouponSpreadMapper.selectByPrimaryKey(id); + } + + @Override + public void saveOrUpdate(WxCouponSpread record) { + if (record.getId() == null) { + //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); + final IdWorker idWorker = IdWorker.get(); + record.setId(idWorker.nextId()); + wxCouponSpreadMapper.insertSelective(record); + } else { + wxCouponSpreadMapper.updateByPrimaryKeySelective(record); + } + } + + @Override + public void deleteById(Long id) { + wxCouponSpreadMapper.deleteByPrimaryKey(id); + } + + + + + + + + +} diff --git a/mallinkService/src/main/resources/mapper/WxCouponSpreadMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponSpreadMapper.xml new file mode 100644 index 000000000..6dd160a90 --- /dev/null +++ b/mallinkService/src/main/resources/mapper/WxCouponSpreadMapper.xml @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + `id`,`coupon_id`,`title`,`content`,`image`,`link_url`,`create_date`,`update_date` + + + + where 1 = 1 + + + and `id` = #{id} + + + + + and `coupon_id` = #{couponId} + + + + + and `title` like concat('%', #{title},'%') + + + + + and `content` like concat('%', #{content},'%') + + + + + and `image` like concat('%', #{image},'%') + + + + + and `link_url` like concat('%', #{linkUrl},'%') + + + + + and `create_date` = #{createDate} + + + + + and `update_date` = #{updateDate} + + + + and id in + + #{idItem} + + + order by ${sortColumns} + + + + + + + + + + From 964ecf5546e12a61f78e20893a63fbba640dcefa Mon Sep 17 00:00:00 2001 From: masterspirit Date: Sun, 12 Aug 2018 12:39:04 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E5=8D=A1=E5=88=B8=E6=8E=A8=E5=B9=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/simple/controller/WxCouponSpreadController.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mallinkAdmin/src/main/java/com/simple/controller/WxCouponSpreadController.java b/mallinkAdmin/src/main/java/com/simple/controller/WxCouponSpreadController.java index aa55eda13..099a0c4d0 100644 --- a/mallinkAdmin/src/main/java/com/simple/controller/WxCouponSpreadController.java +++ b/mallinkAdmin/src/main/java/com/simple/controller/WxCouponSpreadController.java @@ -38,6 +38,9 @@ public class WxCouponSpreadController extends BaseController @ApiOperation("新增接口") @PostMapping("add") public ResultData add(@RequestBody WxCouponSpread wxCouponSpread) { + if(wxCouponSpread.getCouponId()==null){ + return new ResultData(Result.ERROR,"没有找到券id"); + } //Assert.notNull(wxCouponSpread.getName(), "角色名不能为空"); //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); wxCouponSpreadService.saveOrUpdate(wxCouponSpread); From e64633235392cdd3aeb4e298597a65bfdcc74002 Mon Sep 17 00:00:00 2001 From: masterspirit Date: Sun, 12 Aug 2018 12:40:22 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E5=8D=A1=E5=88=B8=E6=8E=A8=E5=B9=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/simple/controller/WxCouponSpreadController.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mallinkAdmin/src/main/java/com/simple/controller/WxCouponSpreadController.java b/mallinkAdmin/src/main/java/com/simple/controller/WxCouponSpreadController.java index 099a0c4d0..77b05871c 100644 --- a/mallinkAdmin/src/main/java/com/simple/controller/WxCouponSpreadController.java +++ b/mallinkAdmin/src/main/java/com/simple/controller/WxCouponSpreadController.java @@ -1,5 +1,6 @@ package com.simple.controller; +import io.swagger.annotations.Api; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.Assert; @@ -17,6 +18,7 @@ import io.swagger.annotations.ApiOperation; @RestController @RequestMapping("wxCouponSpread") +@Api(description="推广接口") public class WxCouponSpreadController extends BaseController { @Autowired From 4c0a246a787161eedba6aad4f4a20ed6beb629a1 Mon Sep 17 00:00:00 2001 From: masterspirit Date: Sun, 12 Aug 2018 14:38:23 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E5=8D=A1=E5=88=B8=E4=BD=9C=E5=BA=9F?= =?UTF-8?q?=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/simple/controller/WxCouponController.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mallinkAdmin/src/main/java/com/simple/controller/WxCouponController.java b/mallinkAdmin/src/main/java/com/simple/controller/WxCouponController.java index edaa0dfd3..3e22ec2b9 100644 --- a/mallinkAdmin/src/main/java/com/simple/controller/WxCouponController.java +++ b/mallinkAdmin/src/main/java/com/simple/controller/WxCouponController.java @@ -71,6 +71,14 @@ public class WxCouponController extends BaseController if(wxCoupon.getId()==null) { return new ResultData(ResultData.ERROR,"缺少id"); } + if(wxCoupon.getStatus()!=null){ + if(wxCoupon.getStatus()==3){ //已作废 + WxCoupon temp = wxCouponService.getById(wxCoupon.getId()); + if(temp.getStatus()==1){ + return new ResultData(Result.ERROR,"生效的卡券,不能修改"); + } + } + } if(StringUtils.isNotBlank(wxCoupon.getBusiness())) { String[] arys = wxCoupon.getBusiness().split(","); wxCoupon.setBusiness(JSON.toJSONString(arys));