| @@ -0,0 +1,100 @@ | |||||
| 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.CouponInject; | |||||
| import com.simple.service.CouponInjectService; | |||||
| import com.simple.service.WxCUserTagsService; | |||||
| 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.ArrayList; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| @Api(description = "精准投放接口") | |||||
| @RestController | |||||
| @RequestMapping("couponInject") | |||||
| public class CouponInjectController extends BaseController | |||||
| { | |||||
| @Autowired | |||||
| private CouponInjectService couponInjectService; | |||||
| @Autowired | |||||
| private WxCUserTagsService wxCUserTagsService; | |||||
| private Logger logger = Logger.getLogger(CouponInjectController.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 CouponInject couponInject, Integer pageNum, Integer pageSize) { | |||||
| if (null == couponInject) couponInject = new CouponInject(); | |||||
| if(couponInject.getStatus()!=null&&couponInject.getStatus()==-1){ | |||||
| couponInject.setStatus(null); | |||||
| } | |||||
| final PageInfo<CouponInject> page = couponInjectService.listAsPage(couponInject, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | |||||
| @ApiOperation("新增接口") | |||||
| @PostMapping("add") | |||||
| public ResultData add(@RequestBody CouponInject couponInject) { | |||||
| couponInject.setTenantId(getUser().getTenantId()); | |||||
| couponInject.setModelId(getUser().getId()); | |||||
| if(couponInject.getSendType()==0){ | |||||
| couponInject.setSendTime(new Date()); | |||||
| } | |||||
| //Assert.notNull(couponInject.getName(), "角色名不能为空"); | |||||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||||
| couponInjectService.add(couponInject); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiOperation("根据id更新接口") | |||||
| @PostMapping("update") | |||||
| public ResultData update(@RequestBody CouponInject couponInject) { | |||||
| String[] arys = couponInject.getTags().split(","); | |||||
| List<Long> tagids = new ArrayList<>(); | |||||
| for (int i = 0; i < arys.length; i++) { | |||||
| tagids.add(Long.parseLong(arys[i])); | |||||
| } | |||||
| couponInject.setTags(JSON.toJSONString(arys)); | |||||
| couponInjectService.saveOrUpdate(couponInject); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiOperation("根据id删除接口") | |||||
| @GetMapping("/del") | |||||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||||
| public ResultData delete(Long id) { | |||||
| couponInjectService.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) { | |||||
| CouponInject couponInject = couponInjectService.getById(id); | |||||
| if(couponInject!=null) { | |||||
| List<Long> tagids = JSON.parseArray(couponInject.getTags(), Long.class); | |||||
| couponInject.setWxChooseTagVo(wxCUserTagsService.findChooseTag(tagids)); | |||||
| } | |||||
| return new ResultData(Result.SUCCESS,"查询成功",couponInject); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,274 @@ | |||||
| package com.simple.domain.po; | |||||
| import com.simple.domain.vo.WxChooseTagVo; | |||||
| 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 = "coupon_inject") | |||||
| public class CouponInject implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| @Id | |||||
| protected Long id; | |||||
| @Transient | |||||
| protected List<Long> ids; | |||||
| @Transient | |||||
| protected String sortColumns; | |||||
| @Transient | |||||
| protected Long modelId; | |||||
| @Transient | |||||
| private WxChooseTagVo wxChooseTagVo; | |||||
| public WxChooseTagVo getWxChooseTagVo() { | |||||
| return wxChooseTagVo; | |||||
| } | |||||
| public void setWxChooseTagVo(WxChooseTagVo wxChooseTagVo) { | |||||
| this.wxChooseTagVo = wxChooseTagVo; | |||||
| } | |||||
| 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="name") | |||||
| private String name; | |||||
| /***/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="",name="mUserId") | |||||
| private String mUserId; | |||||
| /*发送方式0:立即发送 1:定时发送**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="发送方式0:立即发送 1:定时发送",name="sendType") | |||||
| private Integer sendType; | |||||
| /*券id**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="券id",name="couponId") | |||||
| private Long couponId; | |||||
| /*券名称**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="券名称",name="couponName") | |||||
| private String couponName; | |||||
| /*发送时间**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="发送时间",name="sendTime") | |||||
| private Date sendTime; | |||||
| @Transient | |||||
| private Date sendTimeStart; | |||||
| @Transient | |||||
| private Date sendTimeEnd; | |||||
| public Date getSendTimeStart() { | |||||
| return sendTimeStart; | |||||
| } | |||||
| public void setSendTimeStart(Date sendTimeStart) { | |||||
| this.sendTimeStart = sendTimeStart; | |||||
| } | |||||
| public Date getSendTimeEnd() { | |||||
| return sendTimeEnd; | |||||
| } | |||||
| public void setSendTimeEnd(Date sendTimeEnd) { | |||||
| this.sendTimeEnd = sendTimeEnd; | |||||
| } | |||||
| /*实际发送数量**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="实际发送数量",name="sendAmount") | |||||
| private Integer sendAmount; | |||||
| /*0:待发送1:已发送2:发送失败**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="0:待发送1:已发送2:发送失败",name="status") | |||||
| private Integer status; | |||||
| /*发送失败原因**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="发送失败原因",name="errorMsg") | |||||
| private String errorMsg; | |||||
| /*发送人群标签**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="发送人群标签",name="tags") | |||||
| private String tags; | |||||
| /*创建时间**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createTime") | |||||
| private Date createTime; | |||||
| /*修改时间**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="修改时间",name="updateTime") | |||||
| private Date updateTime; | |||||
| public String getTenantId() { | |||||
| return tenantId; | |||||
| } | |||||
| public void setTenantId(String _tenantId) { | |||||
| tenantId = _tenantId; | |||||
| } | |||||
| public String getName() { | |||||
| return name; | |||||
| } | |||||
| public void setName(String _name) { | |||||
| name = _name; | |||||
| } | |||||
| public String getMUserId() { | |||||
| return mUserId; | |||||
| } | |||||
| public void setMUserId(String _mUserId) { | |||||
| mUserId = _mUserId; | |||||
| } | |||||
| public Integer getSendType() { | |||||
| return sendType; | |||||
| } | |||||
| public void setSendType(Integer _sendType) { | |||||
| sendType = _sendType; | |||||
| } | |||||
| public Long getCouponId() { | |||||
| return couponId; | |||||
| } | |||||
| public void setCouponId(Long _couponId) { | |||||
| couponId = _couponId; | |||||
| } | |||||
| public String getCouponName() { | |||||
| return couponName; | |||||
| } | |||||
| public void setCouponName(String _couponName) { | |||||
| couponName = _couponName; | |||||
| } | |||||
| public Date getSendTime() { | |||||
| return sendTime; | |||||
| } | |||||
| public void setSendTime(Date _sendTime) { | |||||
| sendTime = _sendTime; | |||||
| } | |||||
| public Integer getSendAmount() { | |||||
| return sendAmount; | |||||
| } | |||||
| public void setSendAmount(Integer _sendAmount) { | |||||
| sendAmount = _sendAmount; | |||||
| } | |||||
| public Integer getStatus() { | |||||
| return status; | |||||
| } | |||||
| public void setStatus(Integer _status) { | |||||
| status = _status; | |||||
| } | |||||
| public String getErrorMsg() { | |||||
| return errorMsg; | |||||
| } | |||||
| public void setErrorMsg(String _errorMsg) { | |||||
| errorMsg = _errorMsg; | |||||
| } | |||||
| public String getTags() { | |||||
| return tags; | |||||
| } | |||||
| public void setTags(String _tags) { | |||||
| tags = _tags; | |||||
| } | |||||
| public Date getCreateTime() { | |||||
| return createTime; | |||||
| } | |||||
| public void setCreateTime(Date _createTime) { | |||||
| createTime = _createTime; | |||||
| } | |||||
| public Date getUpdateTime() { | |||||
| return updateTime; | |||||
| } | |||||
| public void setUpdateTime(Date _updateTime) { | |||||
| updateTime = _updateTime; | |||||
| } | |||||
| public Long getModelId() { | |||||
| return modelId; | |||||
| } | |||||
| public void setModelId(Long modelId) { | |||||
| this.modelId = modelId; | |||||
| } | |||||
| public static enum Field | |||||
| { | |||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||||
| ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") | |||||
| ,Name_ASC("`name` ASC"),Name_DESC("`name` DESC") | |||||
| ,MUserId_ASC("`mUserId` ASC"),MUserId_DESC("`mUserId` DESC") | |||||
| ,SendType_ASC("`sendType` ASC"),SendType_DESC("`sendType` DESC") | |||||
| ,CouponId_ASC("`couponId` ASC"),CouponId_DESC("`couponId` DESC") | |||||
| ,CouponName_ASC("`couponName` ASC"),CouponName_DESC("`couponName` DESC") | |||||
| ,SendTime_ASC("`sendTime` ASC"),SendTime_DESC("`sendTime` DESC") | |||||
| ,SendAmount_ASC("`sendAmount` ASC"),SendAmount_DESC("`sendAmount` DESC") | |||||
| ,Status_ASC("`status` ASC"),Status_DESC("`status` DESC") | |||||
| ,ErrorMsg_ASC("`errorMsg` ASC"),ErrorMsg_DESC("`errorMsg` DESC") | |||||
| ,Tags_ASC("`tags` ASC"),Tags_DESC("`tags` DESC") | |||||
| ,CreateTime_ASC("`createTime` ASC"),CreateTime_DESC("`createTime` DESC") | |||||
| ,UpdateTime_ASC("`updateTime` ASC"),UpdateTime_DESC("`updateTime` 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(CouponInject.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,17 @@ | |||||
| package com.simple.mapper; | |||||
| import com.simple.common.CommonMapper; | |||||
| import com.simple.domain.po.CouponInject; | |||||
| import java.util.List; | |||||
| public interface CouponInjectMapper extends CommonMapper<CouponInject, Long> { | |||||
| List<CouponInject> findList(CouponInject couponInject); | |||||
| } | |||||
| @@ -0,0 +1,53 @@ | |||||
| package com.simple.service; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.simple.domain.po.CouponInject; | |||||
| public interface CouponInjectService { | |||||
| /** | |||||
| * 根据实体查询分页列表 | |||||
| * | |||||
| * @param record | |||||
| * @param offset | |||||
| * @param limit | |||||
| * @return | |||||
| */ | |||||
| PageInfo<CouponInject> listAsPage(CouponInject record, Integer pageIndex, Integer pageSize); | |||||
| /** | |||||
| * 根据Id获得实体 | |||||
| * | |||||
| * @param id | |||||
| * @return | |||||
| */ | |||||
| CouponInject getById(Long id); | |||||
| /** | |||||
| * 保存或更新实体 | |||||
| * | |||||
| * @param record | |||||
| */ | |||||
| void saveOrUpdate(CouponInject record); | |||||
| /** | |||||
| * 根据Id删除实体 | |||||
| * | |||||
| * @param id | |||||
| */ | |||||
| void deleteById(Long id); | |||||
| /** | |||||
| * 根据Id删除实体 | |||||
| * | |||||
| * @param id | |||||
| */ | |||||
| void add(CouponInject record); | |||||
| } | |||||
| @@ -34,6 +34,13 @@ public interface WxCouponOrderService { | |||||
| */ | */ | ||||
| void saveOrUpdate(WxCouponOrder record); | void saveOrUpdate(WxCouponOrder record); | ||||
| /** | |||||
| * 返回id | |||||
| * @param record | |||||
| * @return | |||||
| */ | |||||
| Long insertOne(WxCouponOrder record); | |||||
| /** | /** | ||||
| * 根据Id删除实体 | * 根据Id删除实体 | ||||
| * | * | ||||
| @@ -0,0 +1,110 @@ | |||||
| package com.simple.service.impl; | |||||
| import com.alibaba.fastjson.JSON; | |||||
| import com.github.pagehelper.PageHelper; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.simple.common.IdWorker; | |||||
| import com.simple.domain.po.*; | |||||
| import com.simple.mapper.CouponInjectMapper; | |||||
| import com.simple.service.CouponInjectService; | |||||
| import com.simple.service.WxCUserTagsService; | |||||
| import com.simple.service.WxCouponOrderService; | |||||
| import com.simple.service.WxCouponService; | |||||
| import org.apache.commons.lang.time.DateUtils; | |||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | |||||
| import java.util.ArrayList; | |||||
| import java.util.Arrays; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| @Service | |||||
| public class CouponInjectServiceImpl implements CouponInjectService { | |||||
| @Autowired | |||||
| CouponInjectMapper couponInjectMapper; | |||||
| @Autowired | |||||
| WxCouponOrderService wxCouponOrderService; | |||||
| @Autowired | |||||
| WxCouponService wxCouponService; | |||||
| @Autowired | |||||
| WxCUserTagsService wxCUserTagsService; | |||||
| @Override | |||||
| public PageInfo<CouponInject> listAsPage(CouponInject record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> couponInjectMapper.findList(record)); | |||||
| } | |||||
| @Override | |||||
| public CouponInject getById(Long id) { | |||||
| return couponInjectMapper.selectByPrimaryKey(id); | |||||
| } | |||||
| @Override | |||||
| public void saveOrUpdate(CouponInject record) { | |||||
| if (record.getId() == null) { | |||||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||||
| final IdWorker idWorker = new IdWorker(0, 0); | |||||
| record.setId(idWorker.nextId()); | |||||
| couponInjectMapper.insertSelective(record); | |||||
| } else { | |||||
| couponInjectMapper.updateByPrimaryKeySelective(record); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void deleteById(Long id) { | |||||
| couponInjectMapper.deleteByPrimaryKey(id); | |||||
| } | |||||
| @Override | |||||
| public void add(CouponInject record) { | |||||
| WxCoupon wxCoupon = wxCouponService.getById(record.getCouponId()); | |||||
| if (wxCoupon.getValidType() == 1) { //时间范围 | |||||
| if (new Date().after(wxCoupon.getValidEndDate())) { | |||||
| return; | |||||
| } | |||||
| } | |||||
| final IdWorker idWorker = new IdWorker(0, 0); | |||||
| record.setId(idWorker.nextId()); | |||||
| record.setStatus(1); | |||||
| couponInjectMapper.insertSelective(record); | |||||
| String[] arys = record.getTags().split(","); | |||||
| List<Long> tagids = new ArrayList<>(); | |||||
| for (int i = 0; i < arys.length; i++) { | |||||
| tagids.add(Long.parseLong(arys[i])); | |||||
| } | |||||
| //查询标签用户 | |||||
| List<WxCUser> cUsers = wxCUserTagsService.findUserByTag(tagids); | |||||
| record.setTags(JSON.toJSONString(arys)); | |||||
| for (WxCUser tempCUser : cUsers) { | |||||
| WxCouponOrder wxCouponOrder = new WxCouponOrder(); | |||||
| wxCouponOrder.setCouponId(record.getCouponId()); | |||||
| wxCouponOrder.setCouponOrderStatus(0); | |||||
| wxCouponOrder.setCUserId(tempCUser.getId()); | |||||
| wxCouponOrder.setCouponPrice(0); | |||||
| wxCouponOrder.setCreateDate(new Date()); | |||||
| if (wxCoupon.getValidType() == 1) { //时间范围区间 | |||||
| wxCouponOrder.setExpiredTime(wxCoupon.getValidEndDate()); | |||||
| } else { | |||||
| Date date = DateUtils.addDays(new Date(), wxCoupon.getValidDays()); | |||||
| wxCouponOrder.setExpiredTime(date); | |||||
| } | |||||
| wxCouponOrder.setTenantId(wxCoupon.getTenantId()); | |||||
| wxCouponOrderService.saveOrUpdate(wxCouponOrder); | |||||
| //短信通知 | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -60,6 +60,14 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| } | } | ||||
| } | } | ||||
| @Override | |||||
| public Long insertOne(WxCouponOrder record) { | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| record.setId(idWorker.nextId()); | |||||
| wxCouponOrderMapper.insertSelective(record); | |||||
| return record.getId(); | |||||
| } | |||||
| @Override | @Override | ||||
| public void deleteById(Long id) { | public void deleteById(Long id) { | ||||
| wxCouponOrderMapper.deleteByPrimaryKey(id); | wxCouponOrderMapper.deleteByPrimaryKey(id); | ||||
| @@ -0,0 +1,120 @@ | |||||
| <?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.CouponInjectMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.simple.domain.po.CouponInject"> | |||||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||||
| <result column="name" jdbcType="VARCHAR" property="name" /> | |||||
| <result column="m_user_id" jdbcType="VARCHAR" property="mUserId" /> | |||||
| <result column="send_type" jdbcType="INTEGER" property="sendType" /> | |||||
| <result column="coupon_id" jdbcType="BIGINT" property="couponId" /> | |||||
| <result column="coupon_name" jdbcType="VARCHAR" property="couponName" /> | |||||
| <result column="send_time" jdbcType="TIMESTAMP" property="sendTime" /> | |||||
| <result column="send_amount" jdbcType="INTEGER" property="sendAmount" /> | |||||
| <result column="status" jdbcType="INTEGER" property="status" /> | |||||
| <result column="error_msg" jdbcType="VARCHAR" property="errorMsg" /> | |||||
| <result column="tags" jdbcType="VARCHAR" property="tags" /> | |||||
| <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | |||||
| <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> | |||||
| </resultMap> | |||||
| <sql id="allColumns"> | |||||
| `id`,`tenant_id`,`name`,`m_user_id`,`send_type`,`coupon_id`,`coupon_name`,`send_time`,`send_amount`,`status`,`error_msg`,`tags`,`create_time`,`update_time` | |||||
| </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 != name "> | |||||
| and `name` like concat('%', #{name},'%') | |||||
| </if> | |||||
| <if test=" null != mUserId "> | |||||
| and `m_user_id` like concat('%', #{mUserId},'%') | |||||
| </if> | |||||
| <if test=" null != sendType "> | |||||
| and `send_type` = #{sendType} | |||||
| </if> | |||||
| <if test=" null != couponId "> | |||||
| and `coupon_id` = #{couponId} | |||||
| </if> | |||||
| <if test=" null != couponName "> | |||||
| and `coupon_name` like concat('%', #{couponName},'%') | |||||
| </if> | |||||
| <if test=" null != sendTime "> | |||||
| and `send_time` = #{sendTime} | |||||
| </if> | |||||
| <if test=" null != sendTimeStart and null!=sendTimeEnd "> | |||||
| and `send_time` >= #{sendTimeStart} and `send_time` <= #{sendTimeEnd} | |||||
| </if> | |||||
| <if test=" null != sendAmount "> | |||||
| and `send_amount` = #{sendAmount} | |||||
| </if> | |||||
| <if test=" null != status "> | |||||
| and `status` = #{status} | |||||
| </if> | |||||
| <if test=" null != errorMsg "> | |||||
| and `error_msg` like concat('%', #{errorMsg},'%') | |||||
| </if> | |||||
| <if test=" null != tags "> | |||||
| and `tags` like concat('%', #{tags},'%') | |||||
| </if> | |||||
| <if test=" null != createTime "> | |||||
| and `create_time` = #{createTime} | |||||
| </if> | |||||
| <if test=" null != updateTime "> | |||||
| and `update_time` = #{updateTime} | |||||
| </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.CouponInject" resultMap="BaseResultMap"> | |||||
| select <include refid="allColumns" /> from coupon_inject | |||||
| <include refid="dynamicWhereConditions" /> | |||||
| </select> | |||||
| </mapper> | |||||