Просмотр исходного кода

[卡][修改]:卡密添加

release_toaliyun_real
Stormeye Wu 6 лет назад
Родитель
Сommit
af01cf2b89
5 измененных файлов: 231 добавлений и 0 удалений
  1. +44
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxCardPassword.java
  2. +17
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxCardPasswordMapper.java
  3. +48
    -0
      mallinkService/src/main/java/com/iformall/service/WxCardPasswordService.java
  4. +54
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxCardPasswordServiceImpl.java
  5. +68
    -0
      mallinkService/src/main/resources/mapper/WxCardPasswordMapper.xml

+ 44
- 0
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<Long> 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;


}

+ 17
- 0
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<WxCardPassword, Long> {

List<WxCardPassword> findList(WxCardPassword wxCardPassword);

}

+ 48
- 0
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<WxCardPassword> 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);

}

+ 54
- 0
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<WxCardPassword> 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);
}
}

+ 68
- 0
mallinkService/src/main/resources/mapper/WxCardPasswordMapper.xml Просмотреть файл

@@ -0,0 +1,68 @@
<?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.WxCardPasswordMapper">
<resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCardPassword">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
<result column="coupon_id" jdbcType="BIGINT" property="couponId" />
<result column="password" jdbcType="VARCHAR" property="password" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="sended_phone" jdbcType="VARCHAR" property="sendedPhone" />
<result column="card_id" jdbcType="BIGINT" property="cardId" />
<result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
</resultMap>
<sql id="allColumns">
`id`,`tenant_id`,`coupon_id`,`password`,`status`,`sended_phone`,`card_id`,`create_date`,`update_date`
</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 != couponId ">
and `coupon_id` = #{couponId}
</if>
<if test=" null != password ">
and `password` like concat('%', #{password},'%')
</if>
<if test=" null != status ">
and `status` = #{status}
</if>
<if test=" null != sendedPhone ">
and `sended_phone` like concat('%', #{sendedPhone},'%')
</if>
<if test=" null != cardId ">
and `card_id` = #{cardId}
</if>
<if test=" null != createDate ">
and `create_date` = #{createDate}
</if>
<if test=" null != updateDate ">
and `update_date` = #{updateDate}
</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.iformall.domain.po.WxCardPassword" resultMap="BaseResultMap">
select <include refid="allColumns" /> from wx_card_password
<include refid="dynamicWhereConditions" />
</select>
</mapper>

Загрузка…
Отмена
Сохранить