Преглед изворни кода

add press batch

release_toaliyun_real
zhengfangyuan пре 3 година
родитељ
комит
29456db7a4
12 измењених фајлова са 616 додато и 2 уклоњено
  1. +140
    -0
      mallinkAdmin/src/main/java/com/iformall/controller/market/WxPressBatchController.java
  2. +25
    -0
      mallinkAdmin/src/main/resources/db/migration/V2022090100001_press_batch.sql
  3. +2
    -2
      mallinkSchedule/src/main/java/com/iformall/schedule/CouponOrderExpiringSchedule.java
  4. +39
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxPressBatch.java
  5. +30
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxPressBatchItem.java
  6. +37
    -0
      mallinkService/src/main/java/com/iformall/enums/EnumPressBatchStatus.java
  7. +21
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxPressBatchItemMapper.java
  8. +19
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxPressBatchMapper.java
  9. +48
    -0
      mallinkService/src/main/java/com/iformall/service/WxPressBatchService.java
  10. +106
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxPressBatchServiceImpl.java
  11. +80
    -0
      mallinkService/src/main/resources/mapper/WxPressBatchItemMapper.xml
  12. +69
    -0
      mallinkService/src/main/resources/mapper/WxPressBatchMapper.xml

+ 140
- 0
mallinkAdmin/src/main/java/com/iformall/controller/market/WxPressBatchController.java Прегледај датотеку

@@ -0,0 +1,140 @@
package com.iformall.controller.market;

import com.github.pagehelper.PageInfo;
import com.iformall.annotation.SystemControllerLog;
import com.iformall.common.ErrorCode;
import com.iformall.common.Result;
import com.iformall.common.ResultData;
import com.iformall.controller.base.BaseController;
import com.iformall.domain.po.AliBusinessCircleOrder;
import com.iformall.domain.po.WxBusinessCircleOrder;
import com.iformall.domain.po.WxCoupon;
import com.iformall.domain.po.WxPressBatch;
import com.iformall.domain.po.WxPressBatchItem;
import com.iformall.domain.po.base.BaseEntity;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.enums.EnumCouponContentType;
import com.iformall.enums.EnumCouponSourceType;
import com.iformall.enums.EnumRentContractAppStatus;
import com.iformall.service.AliBusinessCircleOrderService;
import com.iformall.service.WxPressBatchService;
import com.iformall.utils.Constant;
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.slf4j.Logger;
import org.slf4j.LoggerFactory;
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 javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("pressBatch")
public class WxPressBatchController extends BaseController {
private final Logger logger = LoggerFactory.getLogger(this.getClass());

@Autowired
private WxPressBatchService wxPressBatchService;

@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 WxPressBatch record, Integer pageNum, Integer pageSize) {
if (null == record) {
record = new WxPressBatch();
}
record.updateTenantInfo(getTenantInfo());
record.setSortColumns(BaseEntity.SortField.UpdateDate_DESC);
final PageInfo<WxPressBatch> page = wxPressBatchService.listAsPage(record, pageNum, pageSize);
return new ResultData(page);
}
@ApiOperation("新增&修改接口")
@PostMapping("saveOrUpdate")
public ResultData saveOrUpdate(@RequestBody WxPressBatch record) {
TenantEntity tenantEntity = getTenantInfo();
record.updateTenantInfo(tenantEntity);
wxPressBatchService.saveOrUpdate(record);
return new ResultData();
}
@ApiOperation("详情接口")
@GetMapping("detail")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true)})
public ResultData detail(Long id) {
if (null == id) {
return new ResultData(Result.ERROR,"参数错误");
}
WxPressBatch order = wxPressBatchService.getById(id, getTenantInfo().getTenantId());
return new ResultData(order);
}
@ApiOperation("详情接口")
@GetMapping("itemList")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true)})
public ResultData itemList(Long id) {
if (null == id) {
return new ResultData(Result.ERROR,"参数错误");
}
List<WxPressBatchItem> list = wxPressBatchService.getItemList(id, getTenantInfo().getTenantId());
return new ResultData(list);
}
@ApiOperation("详情接口")
@PostMapping("delete")
public ResultData delete(@RequestBody WxPressBatch record) {
if (null == record.getId()) {
return new ResultData(Result.ERROR,"参数错误");
}
wxPressBatchService.deleteBatch(record.getId(), getTenantInfo().getTenantId());
return new ResultData();
}

@ApiOperation("新增items")
@PostMapping("addItems")
public ResultData addItems(@RequestBody WxPressBatch record) {
TenantEntity tenantEntity = getTenantInfo();
record.updateTenantInfo(tenantEntity);
if (null == record.getId()) {
return new ResultData(Result.ERROR,"参数错误");
}
String cidstr = record.getCouponChannelIds();
if (StringUtils.isBlank(cidstr)) {
return new ResultData(Result.ERROR,"参数错误");
}
String[] cids = cidstr.split(",");
WxPressBatch order = wxPressBatchService.getById(record.getId(), tenantEntity.getTenantId());
wxPressBatchService.saveItems(order, cids);
return new ResultData();
}
@ApiOperation("详情接口")
@PostMapping("deleteItem")
public ResultData deleteItem(@RequestBody WxPressBatchItem record) {
if (null == record.getId()) {
return new ResultData(Result.ERROR,"参数错误");
}
wxPressBatchService.deleteItemById(record.getId(), getTenantInfo().getTenantId());
return new ResultData();
}


}

+ 25
- 0
mallinkAdmin/src/main/resources/db/migration/V2022090100001_press_batch.sql Прегледај датотеку

@@ -0,0 +1,25 @@
CREATE TABLE `wx_press_batch` (
`id` bigint(20) unsigned NOT NULL,
`tenant_id` varchar(5) NOT NULL,
`parent_tenant_id` varchar(5) DEFAULT NULL,
`name` varchar(100) DEFAULT NULL COMMENT '批次名称',
`status` int(1) NOT NULL DEFAULT '0' COMMENT '状态0-草稿 1-进行中 2-已停止',
`create_date` datetime DEFAULT NULL,
`update_date` datetime DEFAULT NULL,
`promoter_allow_count` int(3) NOT NULL DEFAULT '0' COMMENT '发起人允许发起次数',
`bargainer_allow_same` int(1) NOT NULL DEFAULT '0' COMMENT '同一个用户是否可以砍相同商品',
`bargainer_allow_count` int(3) NOT NULL DEFAULT '0' COMMENT '同一个用户可砍价次数',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE `wx_press_batch_item` (
`id` bigint(20) unsigned NOT NULL,
`tenant_id` varchar(5) NOT NULL,
`parent_tenant_id` varchar(5) DEFAULT NULL,
`press_batch_id` bigint(20) NOT NULL COMMENT '批次id',
`coupon_channel_id` bigint(20) NOT NULL COMMENT '砍价券id',
`press_batch_status` int(1) NOT NULL COMMENT '批次状态',
`create_date` datetime DEFAULT NULL,
`update_date` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

+ 2
- 2
mallinkSchedule/src/main/java/com/iformall/schedule/CouponOrderExpiringSchedule.java Прегледај датотеку

@@ -86,8 +86,8 @@ public class CouponOrderExpiringSchedule {

}

//@Scheduled(cron = "0 0 5 * * ?") // 每天凌晨00:05
@Scheduled(cron = "0 */10 * * * ?") // 测试10秒中一次
@Scheduled(cron = "0 0 5 * * ?") // 每天凌晨00:05
//@Scheduled(cron = "0 */10 * * * ?") // 测试10秒中一次
public void couponOrderRefundSchedule() {
CouponOrderExpiringSchedule proxy = (CouponOrderExpiringSchedule) AopContext.currentProxy();
List<WxMall> malls = getMalls();


+ 39
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxPressBatch.java Прегледај датотеку

@@ -0,0 +1,39 @@
package com.iformall.domain.po;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.iformall.domain.po.base.TenantEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.util.Date;

@TableName(value = "wx_press_batch")
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class WxPressBatch extends TenantEntity {

private static final long serialVersionUID = 6722507735075416305L;

protected Long id;

@io.swagger.annotations.ApiModelProperty(value="批次名称",name="name")
private String name;
@io.swagger.annotations.ApiModelProperty(value="EnumPressBatchStatus",name="status")
private Integer status;
@io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate")
private Date createDate;
@io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate")
private Date updateDate;
@io.swagger.annotations.ApiModelProperty(value="发起人允许发起次数",name="promoterAllowCount")
private Integer promoterAllowCount;
@io.swagger.annotations.ApiModelProperty(value="同一个用户是否可以砍相同商品",name="bargainerAllowSame")
private Integer bargainerAllowSame;
@io.swagger.annotations.ApiModelProperty(value="同一个用户可砍价次数",name="bargainerAllowCount")
private Integer bargainerAllowCount;
@TableField(exist = false)
private String couponChannelIds;
}

+ 30
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxPressBatchItem.java Прегледај датотеку

@@ -0,0 +1,30 @@
package com.iformall.domain.po;

import com.baomidou.mybatisplus.annotation.TableName;
import com.iformall.domain.po.base.TenantEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.util.Date;

@TableName(value = "wx_press_batch_item")
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class WxPressBatchItem extends TenantEntity {

private static final long serialVersionUID = 6722507735075416305L;

protected Long id;

@io.swagger.annotations.ApiModelProperty(value="批次id",name="pressBatchId")
private Long pressBatchId;
@io.swagger.annotations.ApiModelProperty(value="砍价券id",name="couponChannelId")
private Long couponChannelId;
@io.swagger.annotations.ApiModelProperty(value="EnumPressBatchStatus",name="pressBatchStatus")
private Integer pressBatchStatus;
@io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate")
private Date createDate;
@io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate")
private Date updateDate;
}

+ 37
- 0
mallinkService/src/main/java/com/iformall/enums/EnumPressBatchStatus.java Прегледај датотеку

@@ -0,0 +1,37 @@
package com.iformall.enums;


/**
* @author gongbiao
*/
public enum EnumPressBatchStatus {

DRAFT(0, "草稿"),
RUNNING(1, "进行中"),
STOPED(2, "已停止");

public static EnumPressBatchStatus getEnum(Integer code) {
for (EnumPressBatchStatus value : values()) {
if (value.getCode().equals(code)) {
return value;
}
}
return null;
}

private Integer code;
private String message;

EnumPressBatchStatus(Integer code, String message) {
this.code = code;
this.message = message;
}

public Integer getCode() {
return code;
}

public String getMessage() {
return message;
}
}

+ 21
- 0
mallinkService/src/main/java/com/iformall/mapper/WxPressBatchItemMapper.java Прегледај датотеку

@@ -0,0 +1,21 @@
package com.iformall.mapper;

import com.iformall.common.CommonMapper;
import com.iformall.domain.po.WxPressBatchItem;

import java.util.List;

import org.apache.ibatis.annotations.Param;

public interface WxPressBatchItemMapper extends CommonMapper<WxPressBatchItem, Long> {
List<WxPressBatchItem> findList(WxPressBatchItem record);

WxPressBatchItem getById(@Param("id")Long id,@Param("tenantId")String tenantId);
void updateWxPressBatchStatus(WxPressBatchItem record);
void deleteItem(WxPressBatchItem record);

void deleteAllItem(WxPressBatchItem record);
}

+ 19
- 0
mallinkService/src/main/java/com/iformall/mapper/WxPressBatchMapper.java Прегледај датотеку

@@ -0,0 +1,19 @@
package com.iformall.mapper;

import com.iformall.common.CommonMapper;
import com.iformall.domain.po.WxPressBatch;
import java.util.List;

import org.apache.ibatis.annotations.Param;

public interface WxPressBatchMapper extends CommonMapper<WxPressBatch, Long> {
List<WxPressBatch> findList(WxPressBatch record);

WxPressBatch getById(@Param("id")Long id,@Param("tenantId")String tenantId);
void updateWxPressBatchStatus(WxPressBatch record);
void deleteById(@Param("id")Long id,@Param("tenantId")String tenantId);

}

+ 48
- 0
mallinkService/src/main/java/com/iformall/service/WxPressBatchService.java Прегледај датотеку

@@ -0,0 +1,48 @@
package com.iformall.service;

import java.util.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.github.pagehelper.PageInfo;
import com.iformall.common.ResultData;
import com.iformall.domain.po.TtCouponChannelPoi;
import com.iformall.domain.po.WxAppinfo;
import com.iformall.domain.po.WxCoupon;
import com.iformall.domain.po.WxPressBatch;
import com.iformall.domain.po.WxPressBatchItem;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.vo.TtCouponVo;
import com.iformall.domain.vo.WxCouponCVo;
import com.iformall.domain.vo.WxCouponStatisVo;
import com.iformall.domain.vo.WxMerchantVo;

public interface WxPressBatchService {


/**
* 根据实体查询分页列表
*
* @param record
* @param pageIndex
* @param pageSize
* @return
*/
PageInfo<WxPressBatch> listAsPage(WxPressBatch record, Integer pageIndex, Integer pageSize);
List<WxPressBatch> list(WxPressBatch wxCoupon);
void saveOrUpdate(WxPressBatch wxCoupon);

WxPressBatch getById(Long id,String tenantId);
List<WxPressBatchItem> getItemList(Long batchId,String tenantId);
void saveItems(WxPressBatch pressBatch,String[] couponChannelIds);
void deleteBatch(Long id,String tenantId);
void deleteItemById(Long itemId,String tenantId);
void deleteItemByBatchId(Long batchId,String tenantId);

}

+ 106
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxPressBatchServiceImpl.java Прегледај датотеку

@@ -0,0 +1,106 @@
package com.iformall.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.iformall.domain.po.*;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.mapper.*;
import com.iformall.service.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.*;

@Service
public class WxPressBatchServiceImpl implements WxPressBatchService {
private final Logger logger = LoggerFactory.getLogger(this.getClass());

@Autowired
WxPressBatchMapper wxPressBatchMapper;
@Autowired
WxPressBatchItemMapper wxPressBatchItemMapper;
@Override
public List<WxPressBatch> list(WxPressBatch record){
return wxPressBatchMapper.findList(record);
}

@Override
public PageInfo<WxPressBatch> listAsPage(WxPressBatch record, Integer pageIndex, Integer pageSize) {
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxPressBatchMapper.findList(record));
}

@Override
public void saveOrUpdate(WxPressBatch record) {
if (null == record.getId()) {
record.setCreateDate(new Date());
record.setUpdateDate(new Date());
wxPressBatchMapper.insert(record);
}else {
record.setUpdateDate(new Date());
wxPressBatchMapper.updateById(record);
}
}
@Override
public WxPressBatch getById(Long id,String tenantId) {
return wxPressBatchMapper.getById(id, tenantId);
}

@Override
public List<WxPressBatchItem> getItemList(Long batchId, String tenantId) {
WxPressBatchItem iteq = new WxPressBatchItem();
iteq.setTenantId(tenantId);
iteq.setPressBatchId(batchId);
return wxPressBatchItemMapper.findList(iteq);
}
@Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class})
public void saveItems(WxPressBatch pressBatch, String[] couponChannelIds) {
for (String cid : couponChannelIds) {
WxPressBatchItem iteq = new WxPressBatchItem();
iteq.updateTenantInfo(pressBatch);
iteq.setPressBatchId(pressBatch.getId());
iteq.setCouponChannelId(Long.parseLong(cid));
iteq.setPressBatchStatus(pressBatch.getStatus());
iteq.setCreateDate(new Date());
iteq.setUpdateDate(new Date());
wxPressBatchItemMapper.insert(iteq);
}
}

@Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class})
public void deleteBatch(Long id, String tenantId) {
wxPressBatchMapper.deleteById(id, tenantId);
deleteItemByBatchId(id, tenantId);
}
@Override
public void deleteItemById(Long itemId, String tenantId) {
WxPressBatchItem iteq = new WxPressBatchItem();
iteq.setTenantId(tenantId);
iteq.setId(itemId);
wxPressBatchItemMapper.deleteItem(iteq);
}

@Override
public void deleteItemByBatchId(Long batchId, String tenantId) {
WxPressBatchItem iteq = new WxPressBatchItem();
iteq.setTenantId(tenantId);
iteq.setPressBatchId(batchId);
wxPressBatchItemMapper.deleteAllItem(iteq);
}





}

+ 80
- 0
mallinkService/src/main/resources/mapper/WxPressBatchItemMapper.xml Прегледај датотеку

@@ -0,0 +1,80 @@
<?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.iformall.mapper.WxPressBatchItemMapper">
<resultMap id="BaseResultMap" type="com.iformall.domain.po.WxPressBatchItem">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
<result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" />
<result column="press_batch_id" jdbcType="BIGINT" property="pressBatchId" />
<result column="coupon_channel_id" jdbcType="BIGINT" property="couponChannelId"/>
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
<result column="press_batch_status" jdbcType="INTEGER" property="pressBatchStatus"/>
</resultMap>


<sql id="allColumns">
`id`, `tenant_id`, `parent_tenant_id`, `press_batch_id`, `coupon_channel_id`, `create_date`,`update_date`,`press_batch_status`
</sql>

<sql id="dynamicWhereConditions">
where `tenant_id` = #{tenantId}

<if test=" null != id ">
and `id` = #{id}
</if>

<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>

<if test=" null != pressBatchId">
and `press_batch_id` = #{pressBatchId}
</if>
<if test=" null != couponChannelId">
and `coupon_channel_id` = #{couponChannelId}
</if>
<if test=" null != pressBatchStatus">
and `press_batch_status` = #{pressBatchStatus}
</if>
<if test=" null != ids ">
and `id` in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
</foreach>
</if>

</sql>

<select id="findList" parameterType="com.iformall.domain.po.WxPressBatchItem" resultMap="BaseResultMap">
select
<include refid="allColumns"/>
from wx_press_batch_item
<include refid="dynamicWhereConditions"/>
<if test=" null != sortColumns">order by ${sortColumns}</if>
</select>

<select id="getById" parameterType="java.util.HashMap" resultMap="BaseResultMap">
select
<include refid="allColumns"/>
from wx_press_batch_item
where `id` = #{id}
and tenant_id=#{tenantId}
</select>
<update id="updateWxPressBatchStatus" parameterType="com.iformall.domain.po.WxPressBatchItem" >
update wx_press_batch_item set press_batch_status = #{status} where `press_batch_id` = #{pressBatchId} and tenant_id=#{tenantId}
</update>
<delete id= "deleteItem" parameterType="com.iformall.domain.po.WxPressBatchItem" >
delete from wx_press_batch_item where `id` = #{id} and tenant_id=#{tenantId} and `press_batch_id` = #{pressBatchId}
</delete>

<delete id= "deleteAllItem" parameterType="com.iformall.domain.po.WxPressBatchItem" >
delete from wx_press_batch_item where `press_batch_id` = #{pressBatchId} and tenant_id=#{tenantId}
</delete>

</mapper>

+ 69
- 0
mallinkService/src/main/resources/mapper/WxPressBatchMapper.xml Прегледај датотеку

@@ -0,0 +1,69 @@
<?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.iformall.mapper.WxPressBatchMapper">
<resultMap id="BaseResultMap" type="com.iformall.domain.po.WxPressBatch">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
<result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="status" jdbcType="INTEGER" property="status"/>
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
<result column="promoter_allow_count" jdbcType="INTEGER" property="promoterAllowCount"/>
<result column="bargainer_allow_same" jdbcType="INTEGER" property="bargainerAllowSame"/>
<result column="bargainer_allow_count" jdbcType="INTEGER" property="bargainerAllowCount"/>
</resultMap>


<sql id="allColumns">
`id`, `tenant_id`, `parent_tenant_id`, `name`, `status`, `create_date`,`update_date`,`promoter_allow_count`, `bargainer_allow_same`, `bargainer_allow_count`
</sql>

<sql id="dynamicWhereConditions">
where `tenant_id` = #{tenantId}

<if test=" null != id ">
and `id` = #{id}
</if>

<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>

<if test=" null != status">
and `status` = #{status}
</if>

<if test=" null != bargainerAllowSame">
and `bargainer_allow_same` = #{bargainerAllowSame}
</if>
<if test=" null != ids ">
and `id` in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
</foreach>
</if>

</sql>

<select id="findList" parameterType="com.iformall.domain.po.WxPressBatch" resultMap="BaseResultMap">
select
<include refid="allColumns"/>
from wx_press_batch
<include refid="dynamicWhereConditions"/>
<if test=" null != sortColumns">order by ${sortColumns}</if>
</select>

<select id="getById" parameterType="java.util.HashMap" resultMap="BaseResultMap">
select <include refid="allColumns"/> from wx_press_batch where `id` = #{id} and tenant_id=#{tenantId}
</select>
<update id="updateWxPressBatchStatus" parameterType="com.iformall.domain.po.WxPressBatch" >
update wx_press_batch set status = #{status} where `id` = #{id} and tenant_id=#{tenantId}
</update>

<delete id="deleteById" parameterType="java.util.HashMap" >
delete from wx_press_batch where `id` = #{id} and tenant_id=#{tenantId}
</delete>
</mapper>

Loading…
Откажи
Сачувај