Commit a8082d43 by guanchen

添加新增文件--代理商每日邮件

parent 69bc6d9f
package com.lanren.huhu.partner.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lanren.huhu.partner.domain.AgentExpandCityAgentDetail;
import com.lanren.huhu.partner.model.MailContentRow;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface AgentExpandCityAgentDetailMapper extends BaseMapper<AgentExpandCityAgentDetail> {
int updateBatch(List<AgentExpandCityAgentDetail> list);
int batchInsert(@Param("list") List<AgentExpandCityAgentDetail> list);
int insertOrUpdate(AgentExpandCityAgentDetail record);
int insertOrUpdateSelective(AgentExpandCityAgentDetail record);
MailContentRow getPingtuiChildRow(String dat, Integer agentId, String monthBegin, String monthEnd);
}
\ No newline at end of file
package com.lanren.huhu.partner.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lanren.huhu.partner.domain.AgentMailList;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface AgentMailListMapper extends BaseMapper<AgentMailList> {
int batchInsert(@Param("list") List<AgentMailList> list);
int insertOrUpdate(AgentMailList record);
int insertOrUpdateSelective(AgentMailList record);
}
\ No newline at end of file
package com.lanren.huhu.partner.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
@TableName(value = "agent_expand_city_agent_detail")
public class AgentExpandCityAgentDetail implements Serializable {
@TableId(value = "dat", type = IdType.INPUT)
private Date dat;
@TableId(value = "agent_id", type = IdType.INPUT)
private Integer agentId;
@TableId(value = "expand_agent_id", type = IdType.INPUT)
private Integer expandAgentId;
@TableField(value = "user_id")
private Integer userId;
@TableField(value = "expand_user_id")
private Integer expandUserId;
@TableField(value = "expand_agent_time")
private Date expandAgentTime;
@TableField(value = "created_at")
private Integer createdAt;
@TableField(value = "updated_at")
private Integer updatedAt;
private static final long serialVersionUID = 1L;
public static final String COL_USER_ID = "user_id";
public static final String COL_EXPAND_USER_ID = "expand_user_id";
public static final String COL_EXPAND_AGENT_TIME = "expand_agent_time";
public static final String COL_CREATED_AT = "created_at";
public static final String COL_UPDATED_AT = "updated_at";
}
\ No newline at end of file
package com.lanren.huhu.partner.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import lombok.Data;
@Data
@TableName(value = "agent_mail_list")
public class AgentMailList implements Serializable {
@TableField(value = "id")
private Integer id;
/**
* 代理商id
*/
@TableField(value = "agent_id")
private Integer agentId;
/**
* 代理商名字
*/
@TableField(value = "agent_name")
private String agentName;
/**
* 代理商手机号
*/
@TableField(value = "agent_phone")
private String agentPhone;
/**
* 邮箱
*/
@TableField(value = "agent_mail")
private String agentMail;
/**
* 抄送邮箱
*/
@TableField(value = "agent_cc")
private String agentCc;
/**
* 类型
*/
@TableField(value = "mail_type")
private Integer mailType;
private static final long serialVersionUID = 1L;
public static final String COL_ID = "id";
public static final String COL_AGENT_ID = "agent_id";
public static final String COL_AGENT_NAME = "agent_name";
public static final String COL_AGENT_PHONE = "agent_phone";
public static final String COL_AGENT_MAIL = "agent_mail";
public static final String COL_AGENT_CC = "agent_cc";
public static final String COL_MAIL_TYPE = "mail_type";
}
\ No newline at end of file
package com.lanren.huhu.partner.model;
import com.lanren.huhu.partner.model.base.BaseModel;
import lombok.Data;
/**
* @author chen
* @title: MailContentRow
* @projectName partner
* @description: TODO
* @package com.lanren.huhu.partner.model
* @date 2019-09-26 23:50
*/
@Data
public class MailContentRow extends BaseModel {
String c1;
String c2;
String c3;
String c4;
String c5;
String c6;
@Override
public MailContentRow clone() {
MailContentRow mailContentRow = new MailContentRow();
mailContentRow.setC1(this.c1);
mailContentRow.setC2(this.c2);
mailContentRow.setC3(this.c3);
mailContentRow.setC4(this.c4);
mailContentRow.setC5(this.c5);
mailContentRow.setC6(this.c6);
return mailContentRow;
}
}
package com.lanren.huhu.partner.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.lanren.huhu.partner.domain.AgentExpandCityAgentDetail;
import com.lanren.huhu.partner.model.MailContentRow;
import java.util.List;
/**
* @title: ${NAME}
* @projectName partner
* @description: TODO
* @author chen
* @package ${PACKAGE_NAME}
* @date 2019-09-26 15:31
*/
public interface AgentExpandCityAgentDetailService extends IService<AgentExpandCityAgentDetail>{
int updateBatch(List<AgentExpandCityAgentDetail> list);
int batchInsert(List<AgentExpandCityAgentDetail> list);
int insertOrUpdate(AgentExpandCityAgentDetail record);
int insertOrUpdateSelective(AgentExpandCityAgentDetail record);
MailContentRow getPingtuiChildRow(String dat, Integer agentId, String monthBegin, String monthEnd);
}
package com.lanren.huhu.partner.service;
import java.util.List;
import com.lanren.huhu.partner.domain.AgentMailList;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author chen
* @title: ${NAME}
* @projectName partner
* @description: TODO
* @package ${PACKAGE_NAME}
* @date 2019-09-26 15:13
*/
public interface AgentMailListService extends IService<AgentMailList> {
int batchInsert(List<AgentMailList> list);
int insertOrUpdate(AgentMailList record);
int insertOrUpdateSelective(AgentMailList record);
}
package com.lanren.huhu.partner.service;
import javax.mail.MessagingException;
import java.io.File;
/**
* @author chen
* @title: IMailService
* @projectName partner
* @package com.lanren.huhu.partner.service
* @date 2019-09-26 19:58
*/
public interface IMailService {
void sendMail(String subject, String text, File attachment, String[] tos) throws MessagingException;
void sendMailWithCc(String subject, String text, File attachment, String[] tos, String[] cc) throws MessagingException;
}
\ No newline at end of file
package com.lanren.huhu.partner.service;
import com.lanren.huhu.partner.model.MailContentRow;
import java.util.List;
/**
* @author chen
* @title: MailReportService
* @projectName partner
* @package com.lanren.huhu.partner.service
* @date 2019-09-26 23:38
*/
public interface MailReportService {
/**
* 获取代理商拓展 注册并登录用户
*/
MailContentRow getRegRow(String dat, Integer agentId, String monthBegin, String monthEnd);
/**
* 获取代理商拓展 VIP 超V 数据
*/
List<MailContentRow> getVipRows(String yesterdayBegin, String yesterdayEnd, Integer agentId, String monthBegin, String monthEnd);
/**
* 获取代理商拓展 层级下级代理数据
*/
List<MailContentRow> getCengjiChildRows(String yesterdayBegin, String yesterdayEnd, Integer agentId, String monthBegin, String monthEnd);
/**
* 获取代理商拓展 平推下级代理数据
*/
MailContentRow getPingtuiChildRow(String dat, Integer agentId, String monthBegin, String monthEnd);
List<MailContentRow> getsVipRows(String yesterdayBegin, String yesterdayEnd, Integer agentId, String monthBegin, String monthEnd);
}
package com.lanren.huhu.partner.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lanren.huhu.partner.dao.AgentExpandCityAgentDetailMapper;
import com.lanren.huhu.partner.domain.AgentExpandCityAgentDetail;
import com.lanren.huhu.partner.model.MailContentRow;
import com.lanren.huhu.partner.service.AgentExpandCityAgentDetailService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @title: ${NAME}
* @projectName partner
* @description: TODO
* @author chen
* @package ${PACKAGE_NAME}
* @date 2019-09-26 15:31
*/
@Service
public class AgentExpandCityAgentDetailServiceImpl extends ServiceImpl<AgentExpandCityAgentDetailMapper, AgentExpandCityAgentDetail> implements AgentExpandCityAgentDetailService{
@Override
public int updateBatch(List<AgentExpandCityAgentDetail> list) {
return baseMapper.updateBatch(list);
}
@Override
public int batchInsert(List<AgentExpandCityAgentDetail> list) {
return baseMapper.batchInsert(list);
}
@Override
public int insertOrUpdate(AgentExpandCityAgentDetail record) {
return baseMapper.insertOrUpdate(record);
}
@Override
public int insertOrUpdateSelective(AgentExpandCityAgentDetail record) {
return baseMapper.insertOrUpdateSelective(record);
}
@Override
public MailContentRow getPingtuiChildRow(String dat, Integer agentId, String monthBegin, String monthEnd) {
return baseMapper.getPingtuiChildRow(dat, agentId, monthBegin, monthEnd);
}
}
package com.lanren.huhu.partner.service.impl;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;
import com.lanren.huhu.partner.domain.AgentMailList;
import com.lanren.huhu.partner.dao.AgentMailListMapper;
import com.lanren.huhu.partner.service.AgentMailListService;
/**
* @author chen
* @title: ${NAME}
* @projectName partner
* @description: TODO
* @package ${PACKAGE_NAME}
* @date 2019-09-26 15:13
*/
@Service
public class AgentMailListServiceImpl extends ServiceImpl<AgentMailListMapper, AgentMailList> implements AgentMailListService {
@Override
public int batchInsert(List<AgentMailList> list) {
return baseMapper.batchInsert(list);
}
@Override
public int insertOrUpdate(AgentMailList record) {
return baseMapper.insertOrUpdate(record);
}
@Override
public int insertOrUpdateSelective(AgentMailList record) {
return baseMapper.insertOrUpdateSelective(record);
}
}
package com.lanren.huhu.partner.service.impl;
import com.lanren.huhu.partner.service.IMailService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.stereotype.Service;
import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;
import java.io.File;
import java.util.Properties;
/**
* @author chen
* @title: IMailServiceImpl
* @projectName partner
* @package com.lanren.huhu.partner.service.impl
* @date 2019-09-26 19:59
*/
@Service
public class IMailServiceImpl implements IMailService {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
/**
* Spring Boot 提供了一个发送邮件的简单抽象,使用的是下面这个接口,这里直接注入即可使用
*/
@Autowired
private JavaMailSenderImpl mailSender;
/**
* 配置
*/
@Value("${spring.mail.host}")
private String host;
@Value("${spring.mail.username}")
private String username;
@Value("${spring.mail.password}")
private String password;
@Value("${spring.mail.port}")
private String port;
@Value("${spring.mail.from}")
private String from;
@Override
public void sendMail(String subject, String text, File attachment, String[] tos) throws MessagingException {
MimeMessage mailMessage = configMailMessage();
configMessageHelper(mailMessage, subject, text, attachment, tos, new String[]{});
mailSender.send(mailMessage);
}
@Override
public void sendMailWithCc(String subject, String text, File attachment, String[] tos, String[] cc) throws MessagingException {
MimeMessage mailMessage = configMailMessage();
MimeMessageHelper mimeMessageHelper = configMessageHelper(mailMessage, subject, text, attachment, tos, new String[]{});
mimeMessageHelper.setCc(cc);
mailSender.send(mailMessage);
}
private MimeMessage configMailMessage() {
mailSender.setHost(host);
mailSender.setPort(Integer.parseInt(port));
mailSender.setUsername(username);
mailSender.setPassword(password);
mailSender.setDefaultEncoding("UTF-8");
Properties javaMailProperties = new Properties();
javaMailProperties.setProperty("mail.smtp.auth", "true");
javaMailProperties.setProperty("mail.smtp.timeout", "25000");
mailSender.setJavaMailProperties(javaMailProperties);
return mailSender.createMimeMessage();
}
private MimeMessageHelper configMessageHelper(MimeMessage mailMessage, String subject, String text, File attachment, String[] tos, String[] cc)
throws MessagingException {
MimeMessageHelper mimeMessageHelper = new MimeMessageHelper(mailMessage, true, "UTF-8");
mimeMessageHelper.setFrom(from);
mimeMessageHelper.setSubject(subject);
mimeMessageHelper.setText(text, true);
if (attachment != null) {
mimeMessageHelper.addAttachment(attachment.getName(), attachment);
}
mimeMessageHelper.setTo(tos);
return mimeMessageHelper;
}
}
package com.lanren.huhu.partner.service.impl;
import com.lanren.huhu.partner.model.MailContentRow;
import com.lanren.huhu.partner.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author chen
* @title: MailReportServiceImpl
* @projectName partner
* @description: TODO
* @package com.lanren.huhu.partner.service.impl
* @date 2019-09-26 23:41
*/
@Service
public class MailReportServiceImpl implements MailReportService {
@Autowired
AgentExpandDailyService agentExpandDailyService;
@Autowired
AgentRewardService agentRewardService;
@Autowired
AgentExpandDetailService agentExpandDetailService;
@Autowired
AgentExpandCityAgentDetailService agentExpandCityAgentDetailService;
@Override
public MailContentRow getRegRow(String dat, Integer agentId, String monthBegin, String monthEnd) {
return agentExpandDailyService.getRegRow(dat, agentId, monthBegin, monthEnd);
}
@Override
public List<MailContentRow> getVipRows(String yesterdayBegin, String yesterdayEnd, Integer agentId, String monthBegin, String monthEnd) {
return agentExpandDailyService.getVipRows(yesterdayBegin, yesterdayEnd, agentId, monthBegin, monthEnd);
}
@Override
public List<MailContentRow> getCengjiChildRows(String yesterdayBegin, String yesterdayEnd, Integer agentId, String monthBegin, String monthEnd) {
return agentExpandDetailService.getCengjiChildRows(yesterdayBegin, yesterdayEnd, agentId, monthBegin, monthEnd);
}
@Override
public MailContentRow getPingtuiChildRow(String dat, Integer agentId, String monthBegin, String monthEnd) {
return agentExpandCityAgentDetailService.getPingtuiChildRow(dat, agentId, monthBegin, monthEnd);
}
@Override
public List<MailContentRow> getsVipRows(String yesterdayBegin, String yesterdayEnd, Integer agentId, String monthBegin, String monthEnd) {
return agentExpandDetailService.getsVipRows(yesterdayBegin, yesterdayEnd, agentId, monthBegin, monthEnd);
}
}
<?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.lanren.huhu.partner.dao.AgentExpandCityAgentDetailMapper">
<resultMap id="BaseResultMap" type="com.lanren.huhu.partner.domain.AgentExpandCityAgentDetail">
<!--@mbg.generated-->
<id column="dat" jdbcType="DATE" property="dat" />
<id column="agent_id" jdbcType="INTEGER" property="agentId" />
<id column="expand_agent_id" jdbcType="INTEGER" property="expandAgentId" />
<result column="user_id" jdbcType="INTEGER" property="userId" />
<result column="expand_user_id" jdbcType="INTEGER" property="expandUserId" />
<result column="expand_agent_time" jdbcType="TIMESTAMP" property="expandAgentTime" />
<result column="created_at" jdbcType="INTEGER" property="createdAt" />
<result column="updated_at" jdbcType="INTEGER" property="updatedAt" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
dat, agent_id, expand_agent_id, user_id, expand_user_id, expand_agent_time, created_at,
updated_at
</sql>
<update id="updateBatch" parameterType="java.util.List">
<!--@mbg.generated-->
update agent_expand_city_agent_detail
<trim prefix="set" suffixOverrides=",">
<trim prefix="user_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when dat = #{item.dat,jdbcType=DATE} then #{item.userId,jdbcType=INTEGER}
</foreach>
</trim>
<trim prefix="expand_user_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when dat = #{item.dat,jdbcType=DATE} then #{item.expandUserId,jdbcType=INTEGER}
</foreach>
</trim>
<trim prefix="expand_agent_time = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when dat = #{item.dat,jdbcType=DATE} then #{item.expandAgentTime,jdbcType=TIMESTAMP}
</foreach>
</trim>
<trim prefix="created_at = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when dat = #{item.dat,jdbcType=DATE} then #{item.createdAt,jdbcType=INTEGER}
</foreach>
</trim>
<trim prefix="updated_at = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when dat = #{item.dat,jdbcType=DATE} then #{item.updatedAt,jdbcType=INTEGER}
</foreach>
</trim>
</trim>
where dat in
<foreach close=")" collection="list" item="item" open="(" separator=", ">
#{item.dat,jdbcType=DATE}
</foreach>
</update>
<insert id="batchInsert" parameterType="map">
<!--@mbg.generated-->
insert into agent_expand_city_agent_detail
(dat, agent_id, expand_agent_id, user_id, expand_user_id, expand_agent_time, created_at,
updated_at)
values
<foreach collection="list" item="item" separator=",">
(#{item.dat,jdbcType=DATE}, #{item.agentId,jdbcType=INTEGER}, #{item.expandAgentId,jdbcType=INTEGER},
#{item.userId,jdbcType=INTEGER}, #{item.expandUserId,jdbcType=INTEGER}, #{item.expandAgentTime,jdbcType=TIMESTAMP},
#{item.createdAt,jdbcType=INTEGER}, #{item.updatedAt,jdbcType=INTEGER})
</foreach>
</insert>
<insert id="insertOrUpdate" parameterType="com.lanren.huhu.partner.domain.AgentExpandCityAgentDetail">
<!--@mbg.generated-->
insert into agent_expand_city_agent_detail
(dat, agent_id, expand_agent_id, user_id, expand_user_id, expand_agent_time, created_at,
updated_at)
values
(#{dat,jdbcType=DATE}, #{agentId,jdbcType=INTEGER}, #{expandAgentId,jdbcType=INTEGER},
#{userId,jdbcType=INTEGER}, #{expandUserId,jdbcType=INTEGER}, #{expandAgentTime,jdbcType=TIMESTAMP},
#{createdAt,jdbcType=INTEGER}, #{updatedAt,jdbcType=INTEGER})
on duplicate key update
dat = #{dat,jdbcType=DATE},
agent_id = #{agentId,jdbcType=INTEGER},
expand_agent_id = #{expandAgentId,jdbcType=INTEGER},
user_id = #{userId,jdbcType=INTEGER},
expand_user_id = #{expandUserId,jdbcType=INTEGER},
expand_agent_time = #{expandAgentTime,jdbcType=TIMESTAMP},
created_at = #{createdAt,jdbcType=INTEGER},
updated_at = #{updatedAt,jdbcType=INTEGER}
</insert>
<insert id="insertOrUpdateSelective" parameterType="com.lanren.huhu.partner.domain.AgentExpandCityAgentDetail">
<!--@mbg.generated-->
insert into agent_expand_city_agent_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="dat != null">
dat,
</if>
<if test="agentId != null">
agent_id,
</if>
<if test="expandAgentId != null">
expand_agent_id,
</if>
<if test="userId != null">
user_id,
</if>
<if test="expandUserId != null">
expand_user_id,
</if>
<if test="expandAgentTime != null">
expand_agent_time,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="updatedAt != null">
updated_at,
</if>
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="dat != null">
#{dat,jdbcType=DATE},
</if>
<if test="agentId != null">
#{agentId,jdbcType=INTEGER},
</if>
<if test="expandAgentId != null">
#{expandAgentId,jdbcType=INTEGER},
</if>
<if test="userId != null">
#{userId,jdbcType=INTEGER},
</if>
<if test="expandUserId != null">
#{expandUserId,jdbcType=INTEGER},
</if>
<if test="expandAgentTime != null">
#{expandAgentTime,jdbcType=TIMESTAMP},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=INTEGER},
</if>
<if test="updatedAt != null">
#{updatedAt,jdbcType=INTEGER},
</if>
</trim>
on duplicate key update
<trim suffixOverrides=",">
<if test="dat != null">
dat = #{dat,jdbcType=DATE},
</if>
<if test="agentId != null">
agent_id = #{agentId,jdbcType=INTEGER},
</if>
<if test="expandAgentId != null">
expand_agent_id = #{expandAgentId,jdbcType=INTEGER},
</if>
<if test="userId != null">
user_id = #{userId,jdbcType=INTEGER},
</if>
<if test="expandUserId != null">
expand_user_id = #{expandUserId,jdbcType=INTEGER},
</if>
<if test="expandAgentTime != null">
expand_agent_time = #{expandAgentTime,jdbcType=TIMESTAMP},
</if>
<if test="createdAt != null">
created_at = #{createdAt,jdbcType=INTEGER},
</if>
<if test="updatedAt != null">
updated_at = #{updatedAt,jdbcType=INTEGER},
</if>
</trim>
</insert>
<select id="getPingtuiChildRow" resultType="com.lanren.huhu.partner.model.MailContentRow">
SELECT
'城市代理' c1,
'推荐' c2,
COUNT(case when dat=#{dat} then expand_agent_id else 0 end) c3,
COUNT(case when dat>='2019-08-16' then expand_agent_id else 0 end) c4,
COUNT(case when dat between date(#{monthBegin}) and date(#{monthEnd}) then expand_agent_id else 0 end) c5,
COUNT(expand_agent_id) c6
FROM agent_expand_city_agent_detail
WHERE agent_id=#{agentId}
</select>
</mapper>
\ No newline at end of file
<?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.lanren.huhu.partner.dao.AgentMailListMapper">
<resultMap id="BaseResultMap" type="com.lanren.huhu.partner.domain.AgentMailList">
<!--@mbg.generated-->
<result column="id" jdbcType="INTEGER" property="id" />
<result column="agent_id" jdbcType="INTEGER" property="agentId" />
<result column="agent_name" jdbcType="VARCHAR" property="agentName" />
<result column="agent_phone" jdbcType="VARCHAR" property="agentPhone" />
<result column="agent_mail" jdbcType="VARCHAR" property="agentMail" />
<result column="agent_cc" jdbcType="VARCHAR" property="agentCc" />
<result column="mail_type" jdbcType="TINYINT" property="mailType" />
</resultMap>
<insert id="batchInsert" parameterType="map">
<!--@mbg.generated-->
insert into agent_mail_list
(id, agent_id, agent_name, agent_phone, agent_mail, agent_cc, mail_type)
values
<foreach collection="list" item="item" separator=",">
(#{item.id,jdbcType=INTEGER}, #{item.agentId,jdbcType=INTEGER}, #{item.agentName,jdbcType=VARCHAR},
#{item.agentPhone,jdbcType=VARCHAR}, #{item.agentMail,jdbcType=VARCHAR}, #{item.agentCc,jdbcType=VARCHAR},
#{item.mailType,jdbcType=TINYINT})
</foreach>
</insert>
<insert id="insertOrUpdate" parameterType="com.lanren.huhu.partner.domain.AgentMailList">
<!--@mbg.generated-->
insert into agent_mail_list
(id, agent_id, agent_name, agent_phone, agent_mail, agent_cc, mail_type)
values
(#{id,jdbcType=INTEGER}, #{agentId,jdbcType=INTEGER}, #{agentName,jdbcType=VARCHAR},
#{agentPhone,jdbcType=VARCHAR}, #{agentMail,jdbcType=VARCHAR}, #{agentCc,jdbcType=VARCHAR},
#{mailType,jdbcType=TINYINT})
on duplicate key update
id = #{id,jdbcType=INTEGER},
agent_id = #{agentId,jdbcType=INTEGER},
agent_name = #{agentName,jdbcType=VARCHAR},
agent_phone = #{agentPhone,jdbcType=VARCHAR},
agent_mail = #{agentMail,jdbcType=VARCHAR},
agent_cc = #{agentCc,jdbcType=VARCHAR},
mail_type = #{mailType,jdbcType=TINYINT}
</insert>
<insert id="insertOrUpdateSelective" parameterType="com.lanren.huhu.partner.domain.AgentMailList">
<!--@mbg.generated-->
insert into agent_mail_list
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="agentId != null">
agent_id,
</if>
<if test="agentName != null">
agent_name,
</if>
<if test="agentPhone != null">
agent_phone,
</if>
<if test="agentMail != null">
agent_mail,
</if>
<if test="agentCc != null">
agent_cc,
</if>
<if test="mailType != null">
mail_type,
</if>
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="agentId != null">
#{agentId,jdbcType=INTEGER},
</if>
<if test="agentName != null">
#{agentName,jdbcType=VARCHAR},
</if>
<if test="agentPhone != null">
#{agentPhone,jdbcType=VARCHAR},
</if>
<if test="agentMail != null">
#{agentMail,jdbcType=VARCHAR},
</if>
<if test="agentCc != null">
#{agentCc,jdbcType=VARCHAR},
</if>
<if test="mailType != null">
#{mailType,jdbcType=TINYINT},
</if>
</trim>
on duplicate key update
<trim suffixOverrides=",">
<if test="id != null">
id = #{id,jdbcType=INTEGER},
</if>
<if test="agentId != null">
agent_id = #{agentId,jdbcType=INTEGER},
</if>
<if test="agentName != null">
agent_name = #{agentName,jdbcType=VARCHAR},
</if>
<if test="agentPhone != null">
agent_phone = #{agentPhone,jdbcType=VARCHAR},
</if>
<if test="agentMail != null">
agent_mail = #{agentMail,jdbcType=VARCHAR},
</if>
<if test="agentCc != null">
agent_cc = #{agentCc,jdbcType=VARCHAR},
</if>
<if test="mailType != null">
mail_type = #{mailType,jdbcType=TINYINT},
</if>
</trim>
</insert>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment