| @@ -0,0 +1,117 @@ | |||||
| package com.simple.controller; | |||||
| import com.alibaba.fastjson.JSON; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.simple.common.Result; | |||||
| import com.simple.common.ResultData; | |||||
| import com.simple.domain.po.WxCampaign; | |||||
| import com.simple.domain.po.WxCoupon; | |||||
| import com.simple.service.WxCampaignService; | |||||
| import com.simple.service.WxCouponService; | |||||
| import io.swagger.annotations.Api; | |||||
| import io.swagger.annotations.ApiImplicitParam; | |||||
| import io.swagger.annotations.ApiImplicitParams; | |||||
| import io.swagger.annotations.ApiOperation; | |||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.apache.log4j.Logger; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.web.bind.annotation.*; | |||||
| import java.util.List; | |||||
| import static com.simple.domain.po.WxCampaign.Field.SortNum_ASC; | |||||
| @RestController | |||||
| @RequestMapping("wxCampaign") | |||||
| @Api(description="促销和banner接口") | |||||
| public class WxCampaignController extends BaseController | |||||
| { | |||||
| @Autowired | |||||
| private WxCampaignService wxCampaignService; | |||||
| @Autowired | |||||
| private WxCouponService wxCouponService; | |||||
| private Logger logger = Logger.getLogger(WxCampaignController.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 WxCampaign wxCampaign, Integer pageNum, Integer pageSize) { | |||||
| if (null == wxCampaign) wxCampaign = new WxCampaign(); | |||||
| wxCampaign.setTenantId(getTenantId()); | |||||
| wxCampaign.setSortColumns(SortNum_ASC); | |||||
| final PageInfo<WxCampaign> page = wxCampaignService.listAsPage(wxCampaign, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | |||||
| @ApiOperation("新增接口") | |||||
| @PostMapping("add") | |||||
| public ResultData add(@RequestBody WxCampaign wxCampaign) { | |||||
| //Assert.notNull(wxCampaign.getName(), "角色名不能为空"); | |||||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||||
| int sortNum = wxCampaignService.getMaxSortNum(getTenantId()); | |||||
| if(StringUtils.isNotBlank(wxCampaign.getCouponIds())) { | |||||
| String[] arys = wxCampaign.getCouponIds().split(","); | |||||
| wxCampaign.setCouponIds(JSON.toJSONString(arys)); | |||||
| } | |||||
| wxCampaign.setTenantId(getTenantId()); | |||||
| wxCampaign.setSortNum(sortNum+1); | |||||
| wxCampaignService.saveOrUpdate(wxCampaign); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiOperation("根据id更新接口") | |||||
| @PostMapping("update") | |||||
| public ResultData update(@RequestBody WxCampaign wxCampaign) { | |||||
| wxCampaignService.saveOrUpdate(wxCampaign); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiOperation("根据id删除接口") | |||||
| @GetMapping("/del") | |||||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||||
| public ResultData delete(Long id) { | |||||
| wxCampaignService.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) { | |||||
| WxCampaign wxCampaign = wxCampaignService.getById(id); | |||||
| if(wxCampaign!=null) { | |||||
| List<Long> list = JSON.parseArray(wxCampaign.getCouponIds(), Long.class); | |||||
| WxCoupon wxCoupon = new WxCoupon(); | |||||
| wxCoupon.setTenantId(getTenantId()); | |||||
| wxCoupon.setIds(list); | |||||
| wxCoupon.setStatus(1); | |||||
| List<WxCoupon> couponlist = wxCouponService.findList(wxCoupon); | |||||
| wxCampaign.setCoupons(couponlist); | |||||
| } | |||||
| return new ResultData(Result.SUCCESS, "查询成功", wxCampaign); | |||||
| } | |||||
| @ApiOperation("调整顺序") | |||||
| @GetMapping("/move") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name="sourceId",value="",dataType="Long", paramType = "query",required=true), | |||||
| @ApiImplicitParam(name="targetId",value="",dataType="Long", paramType = "query",required=true)}) | |||||
| public ResultData move(Long sourceId,Long targetId) { | |||||
| WxCampaign source = wxCampaignService.getById(sourceId); | |||||
| WxCampaign target = wxCampaignService.getById(targetId); | |||||
| if(source==null||target==null){ | |||||
| return new ResultData(Result.ERROR, "调整顺序失败", null); | |||||
| } | |||||
| int temp =source.getSortNum(); | |||||
| source.setSortNum(target.getSortNum()); | |||||
| target.setSortNum(temp); | |||||
| wxCampaignService.saveOrUpdate(source); | |||||
| wxCampaignService.saveOrUpdate(target); | |||||
| return new ResultData(Result.SUCCESS, "调整顺序成功", null); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,253 @@ | |||||
| package com.simple.domain.po; | |||||
| import javax.persistence.Id; | |||||
| import javax.persistence.Table; | |||||
| import javax.persistence.Transient; | |||||
| import java.io.Serializable; | |||||
| import java.util.ArrayList; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| @Table(name = "wx_campaign") | |||||
| public class WxCampaign implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| @Id | |||||
| protected Long id; | |||||
| @Transient | |||||
| protected List<Long> ids; | |||||
| @Transient | |||||
| protected List<WxCoupon> coupons; | |||||
| public List<WxCoupon> getCoupons() { | |||||
| return coupons; | |||||
| } | |||||
| public void setCoupons(List<WxCoupon> coupons) { | |||||
| this.coupons = coupons; | |||||
| } | |||||
| @Transient | |||||
| protected String sortColumns; | |||||
| public Long getId() { | |||||
| return id; | |||||
| } | |||||
| public void setId(Long id) { | |||||
| this.id = id; | |||||
| } | |||||
| public String getSortColumns() { | |||||
| return sortColumns; | |||||
| } | |||||
| public List<Long> getIds() { | |||||
| return ids; | |||||
| } | |||||
| public void setIds(List<Long> ids) { | |||||
| this.ids = ids; | |||||
| } | |||||
| /***/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="",name="tenantId") | |||||
| private String tenantId; | |||||
| /*封面图**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="封面图",name="coverImg") | |||||
| private String coverImg; | |||||
| /*主标题**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="主标题",name="title") | |||||
| private String title; | |||||
| /*副标题**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="副标题",name="subTitle") | |||||
| private String subTitle; | |||||
| /*满x可用**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="满x可用",name="usePrice") | |||||
| private Integer usePrice; | |||||
| /*折扣**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="折扣",name="discountPrice") | |||||
| private Integer discountPrice; | |||||
| /*活动说明**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="活动说明",name="detail") | |||||
| private String detail; | |||||
| /*有效日期-开始**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="有效日期-开始",name="validStartDate") | |||||
| private Date validStartDate; | |||||
| /*有效日期-结束**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="有效日期-结束",name="validEndDate") | |||||
| private Date validEndDate; | |||||
| /*图文详情**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="图文详情",name="imgDetail") | |||||
| private String imgDetail; | |||||
| /*类型:0:促销 1:宣传页**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="类型:0:促销 1:宣传页",name="type") | |||||
| private Integer type; | |||||
| /*优惠券ids**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="优惠券ids",name="couponIds") | |||||
| private String couponIds; | |||||
| /*门店id**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="门店id",name="mechantId") | |||||
| private Long mechantId; | |||||
| /*排序**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="排序",name="sortNum") | |||||
| private Integer sortNum; | |||||
| public String getTenantId() { | |||||
| return tenantId; | |||||
| } | |||||
| public void setTenantId(String _tenantId) { | |||||
| tenantId = _tenantId; | |||||
| } | |||||
| public String getCoverImg() { | |||||
| return coverImg; | |||||
| } | |||||
| public void setCoverImg(String _coverImg) { | |||||
| coverImg = _coverImg; | |||||
| } | |||||
| public String getTitle() { | |||||
| return title; | |||||
| } | |||||
| public void setTitle(String _title) { | |||||
| title = _title; | |||||
| } | |||||
| public String getSubTitle() { | |||||
| return subTitle; | |||||
| } | |||||
| public void setSubTitle(String _subTitle) { | |||||
| subTitle = _subTitle; | |||||
| } | |||||
| public Integer getUsePrice() { | |||||
| return usePrice; | |||||
| } | |||||
| public void setUsePrice(Integer _usePrice) { | |||||
| usePrice = _usePrice; | |||||
| } | |||||
| public Integer getDiscountPrice() { | |||||
| return discountPrice; | |||||
| } | |||||
| public void setDiscountPrice(Integer _discountPrice) { | |||||
| discountPrice = _discountPrice; | |||||
| } | |||||
| public String getDetail() { | |||||
| return detail; | |||||
| } | |||||
| public void setDetail(String _detail) { | |||||
| detail = _detail; | |||||
| } | |||||
| public Date getValidStartDate() { | |||||
| return validStartDate; | |||||
| } | |||||
| public void setValidStartDate(Date _validStartDate) { | |||||
| validStartDate = _validStartDate; | |||||
| } | |||||
| public Date getValidEndDate() { | |||||
| return validEndDate; | |||||
| } | |||||
| public void setValidEndDate(Date _validEndDate) { | |||||
| validEndDate = _validEndDate; | |||||
| } | |||||
| public String getImgDetail() { | |||||
| return imgDetail; | |||||
| } | |||||
| public void setImgDetail(String _imgDetail) { | |||||
| imgDetail = _imgDetail; | |||||
| } | |||||
| public Integer getType() { | |||||
| return type; | |||||
| } | |||||
| public void setType(Integer _type) { | |||||
| type = _type; | |||||
| } | |||||
| public String getCouponIds() { | |||||
| return couponIds; | |||||
| } | |||||
| public void setCouponIds(String _couponIds) { | |||||
| couponIds = _couponIds; | |||||
| } | |||||
| public Long getMechantId() { | |||||
| return mechantId; | |||||
| } | |||||
| public void setMechantId(Long _mechantId) { | |||||
| mechantId = _mechantId; | |||||
| } | |||||
| public Integer getSortNum() { | |||||
| return sortNum; | |||||
| } | |||||
| public void setSortNum(Integer _sortNum) { | |||||
| sortNum = _sortNum; | |||||
| } | |||||
| public static enum Field | |||||
| { | |||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||||
| ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") | |||||
| ,CoverImg_ASC("`coverImg` ASC"),CoverImg_DESC("`coverImg` DESC") | |||||
| ,Title_ASC("`title` ASC"),Title_DESC("`title` DESC") | |||||
| ,SubTitle_ASC("`subTitle` ASC"),SubTitle_DESC("`subTitle` DESC") | |||||
| ,UsePrice_ASC("`usePrice` ASC"),UsePrice_DESC("`usePrice` DESC") | |||||
| ,DiscountPrice_ASC("`discountPrice` ASC"),DiscountPrice_DESC("`discountPrice` DESC") | |||||
| ,Detail_ASC("`detail` ASC"),Detail_DESC("`detail` DESC") | |||||
| ,ValidStartDate_ASC("`validStartDate` ASC"),ValidStartDate_DESC("`validStartDate` DESC") | |||||
| ,ValidEndDate_ASC("`validEndDate` ASC"),ValidEndDate_DESC("`validEndDate` DESC") | |||||
| ,ImgDetail_ASC("`imgDetail` ASC"),ImgDetail_DESC("`imgDetail` DESC") | |||||
| ,Type_ASC("`type` ASC"),Type_DESC("`type` DESC") | |||||
| ,CouponIds_ASC("`couponIds` ASC"),CouponIds_DESC("`couponIds` DESC") | |||||
| ,MechantId_ASC("`mechantId` ASC"),MechantId_DESC("`mechantId` DESC") | |||||
| ,SortNum_ASC("`sortNum` ASC"),SortNum_DESC("`sortNum` 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(WxCampaign.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<Field> 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)); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,19 @@ | |||||
| package com.simple.mapper; | |||||
| import com.simple.common.CommonMapper; | |||||
| import com.simple.domain.po.WxCampaign; | |||||
| import java.util.List; | |||||
| public interface WxCampaignMapper extends CommonMapper<WxCampaign, Long> { | |||||
| List<WxCampaign> findList(WxCampaign wxCampaign); | |||||
| int getMaxSortNum(String tenantId); | |||||
| } | |||||
| @@ -0,0 +1,48 @@ | |||||
| package com.simple.service; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.simple.domain.po.WxCampaign; | |||||
| public interface WxCampaignService { | |||||
| /** | |||||
| * 根据实体查询分页列表 | |||||
| * | |||||
| * @param record | |||||
| * @param offset | |||||
| * @param limit | |||||
| * @return | |||||
| */ | |||||
| PageInfo<WxCampaign> listAsPage(WxCampaign record, Integer pageIndex, Integer pageSize); | |||||
| /** | |||||
| * 根据Id获得实体 | |||||
| * | |||||
| * @param id | |||||
| * @return | |||||
| */ | |||||
| WxCampaign getById(Long id); | |||||
| /** | |||||
| * 保存或更新实体 | |||||
| * | |||||
| * @param record | |||||
| */ | |||||
| void saveOrUpdate(WxCampaign record); | |||||
| /** | |||||
| * 根据Id删除实体 | |||||
| * | |||||
| * @param id | |||||
| */ | |||||
| void deleteById(Long id); | |||||
| int getMaxSortNum(String tenantId); | |||||
| } | |||||
| @@ -26,6 +26,13 @@ public interface WxCouponService { | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| PageInfo<WxCoupon> findEnableList(WxCoupon record, Integer pageIndex, Integer pageSize); | PageInfo<WxCoupon> findEnableList(WxCoupon record, Integer pageIndex, Integer pageSize); | ||||
| /** | |||||
| * 不分页 | |||||
| * @param record | |||||
| * @return | |||||
| */ | |||||
| List<WxCoupon> findList(WxCoupon record); | |||||
| /** | /** | ||||
| * 根据Id获得实体 | * 根据Id获得实体 | ||||
| @@ -0,0 +1,52 @@ | |||||
| package com.simple.service.impl; | |||||
| import com.github.pagehelper.PageHelper; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.simple.common.IdWorker; | |||||
| import com.simple.domain.po.WxCampaign; | |||||
| import com.simple.mapper.WxCampaignMapper; | |||||
| import com.simple.service.WxCampaignService; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | |||||
| @Service | |||||
| public class WxCampaignServiceImpl implements WxCampaignService { | |||||
| @Autowired | |||||
| WxCampaignMapper wxCampaignMapper; | |||||
| @Override | |||||
| public PageInfo<WxCampaign> listAsPage(WxCampaign record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCampaignMapper.findList(record)); | |||||
| } | |||||
| @Override | |||||
| public WxCampaign getById(Long id) { | |||||
| return wxCampaignMapper.selectByPrimaryKey(id); | |||||
| } | |||||
| @Override | |||||
| public void saveOrUpdate(WxCampaign record) { | |||||
| if (record.getId() == null) { | |||||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||||
| IdWorker idWorker = new IdWorker(0, 0); | |||||
| record.setId(idWorker.nextId()); | |||||
| wxCampaignMapper.insertSelective(record); | |||||
| } else { | |||||
| wxCampaignMapper.updateByPrimaryKeySelective(record); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void deleteById(Long id) { | |||||
| wxCampaignMapper.deleteByPrimaryKey(id); | |||||
| } | |||||
| @Override | |||||
| public int getMaxSortNum(String tenantId) { | |||||
| return wxCampaignMapper.getMaxSortNum(tenantId); | |||||
| } | |||||
| } | |||||
| @@ -28,6 +28,11 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponMapper.findEnableList(record)); | return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponMapper.findEnableList(record)); | ||||
| } | } | ||||
| @Override | |||||
| public List<WxCoupon> findList(WxCoupon record) { | |||||
| return wxCouponMapper.findList(record); | |||||
| } | |||||
| @Override | @Override | ||||
| public WxCoupon getById(Long id) { | public WxCoupon getById(Long id) { | ||||
| return wxCouponMapper.selectByPrimaryKey(id); | return wxCouponMapper.selectByPrimaryKey(id); | ||||
| @@ -0,0 +1,128 @@ | |||||
| <?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.simple.mapper.WxCampaignMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.simple.domain.po.WxCampaign"> | |||||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||||
| <result column="cover_img" jdbcType="VARCHAR" property="coverImg" /> | |||||
| <result column="title" jdbcType="VARCHAR" property="title" /> | |||||
| <result column="sub_title" jdbcType="VARCHAR" property="subTitle" /> | |||||
| <result column="use_price" jdbcType="INTEGER" property="usePrice" /> | |||||
| <result column="discount_price" jdbcType="INTEGER" property="discountPrice" /> | |||||
| <result column="detail" jdbcType="VARCHAR" property="detail" /> | |||||
| <result column="valid_start_date" jdbcType="TIMESTAMP" property="validStartDate" /> | |||||
| <result column="valid_end_date" jdbcType="TIMESTAMP" property="validEndDate" /> | |||||
| <result column="img_detail" jdbcType="VARCHAR" property="imgDetail" /> | |||||
| <result column="type" jdbcType="INTEGER" property="type" /> | |||||
| <result column="coupon_ids" jdbcType="VARCHAR" property="couponIds" /> | |||||
| <result column="mechant_id" jdbcType="BIGINT" property="mechantId" /> | |||||
| <result column="sort_num" jdbcType="INTEGER" property="sortNum" /> | |||||
| </resultMap> | |||||
| <sql id="allColumns"> | |||||
| `id`,`tenant_id`,`cover_img`,`title`,`sub_title`,`use_price`,`discount_price`,`detail`,`valid_start_date`,`valid_end_date`,`img_detail`,`type`,`coupon_ids`,`mechant_id`,`sort_num` | |||||
| </sql> | |||||
| <sql id="dynamicWhereConditions"> | |||||
| where 1 = 1 | |||||
| <if test=" null != id "> | |||||
| and `id` = #{id} | |||||
| </if> | |||||
| <if test=" null != tenantId "> | |||||
| and `tenant_id` like concat('%', #{tenantId},'%') | |||||
| </if> | |||||
| <if test=" null != coverImg "> | |||||
| and `cover_img` like concat('%', #{coverImg},'%') | |||||
| </if> | |||||
| <if test=" null != title "> | |||||
| and `title` like concat('%', #{title},'%') | |||||
| </if> | |||||
| <if test=" null != subTitle "> | |||||
| and `sub_title` like concat('%', #{subTitle},'%') | |||||
| </if> | |||||
| <if test=" null != usePrice "> | |||||
| and `use_price` = #{usePrice} | |||||
| </if> | |||||
| <if test=" null != discountPrice "> | |||||
| and `discount_price` = #{discountPrice} | |||||
| </if> | |||||
| <if test=" null != detail "> | |||||
| and `detail` like concat('%', #{detail},'%') | |||||
| </if> | |||||
| <if test=" null != validStartDate "> | |||||
| and `valid_start_date` = #{validStartDate} | |||||
| </if> | |||||
| <if test=" null != validEndDate "> | |||||
| and `valid_end_date` = #{validEndDate} | |||||
| </if> | |||||
| <if test=" null != imgDetail "> | |||||
| and `img_detail` like concat('%', #{imgDetail},'%') | |||||
| </if> | |||||
| <if test=" null != type "> | |||||
| and `type` = #{type} | |||||
| </if> | |||||
| <if test=" null != couponIds "> | |||||
| and `coupon_ids` like concat('%', #{couponIds},'%') | |||||
| </if> | |||||
| <if test=" null != mechantId "> | |||||
| and `mechant_id` = #{mechantId} | |||||
| </if> | |||||
| <if test=" null != sortNum "> | |||||
| and `sort_num` = #{sortNum} | |||||
| </if> | |||||
| <if test=" null != ids "> | |||||
| and id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||||
| </sql> | |||||
| <select id="findList" parameterType="com.simple.domain.po.WxCampaign" resultMap="BaseResultMap"> | |||||
| select <include refid="allColumns" /> from wx_campaign | |||||
| <include refid="dynamicWhereConditions" /> | |||||
| </select> | |||||
| <select id="getMaxSortNum" parameterType="java.lang.String" resultType="java.lang.Integer"> | |||||
| select max(sort_num) from wx_campaign where `tenant_id` = #{tenantId} | |||||
| </select> | |||||
| </mapper> | |||||