From af01cf2b89799e128221956b145db23121e11fb8 Mon Sep 17 00:00:00 2001 From: Stormeye Wu Date: Wed, 18 Sep 2019 21:28:32 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=8D=A1][=E4=BF=AE=E6=94=B9]:=E5=8D=A1?= =?UTF-8?q?=E5=AF=86=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iformall/domain/po/WxCardPassword.java | 44 ++++++++++++ .../iformall/mapper/WxCardPasswordMapper.java | 17 +++++ .../service/WxCardPasswordService.java | 48 +++++++++++++ .../impl/WxCardPasswordServiceImpl.java | 54 +++++++++++++++ .../resources/mapper/WxCardPasswordMapper.xml | 68 +++++++++++++++++++ 5 files changed, 231 insertions(+) create mode 100644 mallinkService/src/main/java/com/iformall/domain/po/WxCardPassword.java create mode 100644 mallinkService/src/main/java/com/iformall/mapper/WxCardPasswordMapper.java create mode 100644 mallinkService/src/main/java/com/iformall/service/WxCardPasswordService.java create mode 100644 mallinkService/src/main/java/com/iformall/service/impl/WxCardPasswordServiceImpl.java create mode 100644 mallinkService/src/main/resources/mapper/WxCardPasswordMapper.xml diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxCardPassword.java b/mallinkService/src/main/java/com/iformall/domain/po/WxCardPassword.java new file mode 100644 index 000000000..285e5bf2e --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxCardPassword.java @@ -0,0 +1,44 @@ +package com.iformall.domain.po; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +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_card_password") +@Data +@EqualsAndHashCode(callSuper = true) +public class WxCardPassword extends BaseEntity { + private static final long serialVersionUID = 1L; + + @Id + protected Long id; + + @Transient + protected List ids; + + @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") + private String tenantId; + @io.swagger.annotations.ApiModelProperty(value="卡ID",name="couponId") + private Long couponId; + @io.swagger.annotations.ApiModelProperty(value="商户名称",name="password") + private String password; + @io.swagger.annotations.ApiModelProperty(value="卡密状态: 0初始1信息发出中2信息已发出3已使用",name="status") + private Integer status; + @io.swagger.annotations.ApiModelProperty(value="卡密发送到手机",name="sendedPhone") + private String sendedPhone; + @io.swagger.annotations.ApiModelProperty(value="卡包ID",name="cardId") + private Long cardId; + @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") + private Date createDate; + @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") + private Date updateDate; + + +} diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxCardPasswordMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxCardPasswordMapper.java new file mode 100644 index 000000000..73ebe9c52 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/mapper/WxCardPasswordMapper.java @@ -0,0 +1,17 @@ +package com.iformall.mapper; + +import java.util.*; +import com.iformall.common.CommonMapper; +import org.apache.ibatis.annotations.Param; +import com.iformall.domain.po.WxCardPassword; + +public interface WxCardPasswordMapper extends CommonMapper { + + List findList(WxCardPassword wxCardPassword); + + + + + + +} diff --git a/mallinkService/src/main/java/com/iformall/service/WxCardPasswordService.java b/mallinkService/src/main/java/com/iformall/service/WxCardPasswordService.java new file mode 100644 index 000000000..b20068e40 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/service/WxCardPasswordService.java @@ -0,0 +1,48 @@ +package com.iformall.service; + +import java.util.*; +import com.github.pagehelper.PageInfo; +import com.iformall.domain.po.WxCardPassword; + +public interface WxCardPasswordService { + + /** + * 根据实体查询分页列表 + * + * @param record + * @param pageIndex + * @param pageSize + * @return + */ + PageInfo listAsPage(WxCardPassword record, Integer pageIndex, Integer pageSize); + + /** + * 根据Id获得实体 + * + * @param id + * @return + */ + WxCardPassword getById(Long id); + + /** + * 保存或更新实体 + * + * @param record + */ + void saveOrUpdate(WxCardPassword record); + + /** + * 根据Id删除实体 + * + * @param id + */ + void deleteById(Long id); + + + + + + + + +} diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCardPasswordServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCardPasswordServiceImpl.java new file mode 100644 index 000000000..08d3595f0 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCardPasswordServiceImpl.java @@ -0,0 +1,54 @@ +package com.iformall.service.impl; + +import java.util.*; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.iformall.domain.po.WxCardPassword; +import com.iformall.mapper.WxCardPasswordMapper; +import com.iformall.service.WxCardPasswordService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.iformall.common.IdWorker; + +@Service +public class WxCardPasswordServiceImpl implements WxCardPasswordService { + + @Autowired + WxCardPasswordMapper wxCardPasswordMapper; + + + @Override + public PageInfo listAsPage(WxCardPassword record, Integer pageIndex, Integer pageSize) { + return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCardPasswordMapper.findList(record)); + } + + @Override + public WxCardPassword getById(Long id) { + return wxCardPasswordMapper.selectByPrimaryKey(id); + } + + @Override + public void saveOrUpdate(WxCardPassword record) { + if (record.getId() == null) { + //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); + final IdWorker idWorker = IdWorker.get(); + record.setId(idWorker.nextId()); + wxCardPasswordMapper.insertSelective(record); + } else { + wxCardPasswordMapper.updateByPrimaryKeySelective(record); + } + } + + @Override + public void deleteById(Long id) { + wxCardPasswordMapper.deleteByPrimaryKey(id); + } + + + + + + + + +} diff --git a/mallinkService/src/main/resources/mapper/WxCardPasswordMapper.xml b/mallinkService/src/main/resources/mapper/WxCardPasswordMapper.xml new file mode 100644 index 000000000..518ca8c8e --- /dev/null +++ b/mallinkService/src/main/resources/mapper/WxCardPasswordMapper.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + `id`,`tenant_id`,`coupon_id`,`password`,`status`,`sended_phone`,`card_id`,`create_date`,`update_date` + + + + where 1 = 1 + + and `id` = #{id} + + + and `tenant_id` like concat('%', #{tenantId},'%') + + + and `coupon_id` = #{couponId} + + + and `password` like concat('%', #{password},'%') + + + and `status` = #{status} + + + and `sended_phone` like concat('%', #{sendedPhone},'%') + + + and `card_id` = #{cardId} + + + and `create_date` = #{createDate} + + + and `update_date` = #{updateDate} + + + and id in + + #{idItem} + + + order by ${sortColumns} + + + + + + + + + +