This commit is contained in:
苏竹红
2023-06-21 15:56:14 +08:00
parent bbf3d47de5
commit 72a3bcc850
8 changed files with 124 additions and 2 deletions

View File

@@ -2,10 +2,13 @@ package com.cool.store.dao;
import com.cool.store.entity.HyPartnerBaseInfoDO;
import com.cool.store.mapper.HyPartnerBaseInfoMapper;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
* @Author suzhuhong
@@ -25,6 +28,13 @@ public class HyPartnerBaseInfoDAO {
return hyPartnerBaseInfoMapper.insertSelective(record);
}
public int batchInsert( List<HyPartnerBaseInfoDO> records){
if (CollectionUtils.isEmpty(records)){
return 0;
}
return hyPartnerBaseInfoMapper.batchInsert(records);
}
/**
*
* 默认更新方法根据主键更新不会把null值更新到数据库避免覆盖之前有值的
@@ -57,6 +67,13 @@ public class HyPartnerBaseInfoDAO {
return hyPartnerBaseInfoMapper.getByPartnerLineId(partnerLineId);
}
public List<HyPartnerBaseInfoDO> getByPartnerLineIds(List<Long> partnerLineId){
if (CollectionUtils.isEmpty(partnerLineId)){
return new ArrayList<>();
}
return hyPartnerBaseInfoMapper.getByPartnerLineIds(partnerLineId);
}
public Long getLineIdByIdCard(String idCard){
if (StringUtils.isEmpty(idCard)){
return null;

View File

@@ -3,6 +3,8 @@ package com.cool.store.mapper;
import com.cool.store.entity.HyPartnerBaseInfoDO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author zhangchenbiao
* @date 2023-05-29 03:51
@@ -16,6 +18,8 @@ public interface HyPartnerBaseInfoMapper {
*/
int insertSelective(@Param("record") HyPartnerBaseInfoDO record);
int batchInsert(@Param("records") List<HyPartnerBaseInfoDO> records);
/**
*
* 默认更新方法根据主键更新不会把null值更新到数据库避免覆盖之前有值的
@@ -38,6 +42,9 @@ public interface HyPartnerBaseInfoMapper {
HyPartnerBaseInfoDO getByPartnerLineId(@Param("partnerLineId") Long partnerLineId);
List<HyPartnerBaseInfoDO> getByPartnerLineIds(@Param("partnerLineId") List<Long> partnerLineIds);
Long getLineIdByIdCard(@Param("idCard") String idCard);
int cleanIdCardInfoByPartnerLineId(@Param("idCard") String idCard,

View File

@@ -27,6 +27,21 @@
id_card_photo_front, id_card_photo_black, live_address, user_portrait, status, latest_log_message,
pass_reason, certify_file, create_time, update_time
</sql>
<insert id="batchInsert">
insert into
hy_partner_base_info
(
partner_id,
partner_line_id
)
values
<foreach collection="records" item="record" separator=",">
(#{record.partnerId},
#{record.partnerLineId}
</foreach>
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="record.id" useGeneratedKeys="true">
insert into hy_partner_base_info
<trim prefix="(" suffix=")" suffixOverrides=",">
@@ -142,6 +157,9 @@
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective">
update hy_partner_base_info
<set>
@@ -231,6 +249,19 @@
where partner_line_id = #{partnerLineId}
</select>
<select id="getByPartnerLineIds" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List"></include>
from hy_partner_base_info
<where>
<if test="partnerLineIds !=null and partnerLineIds.size>0">
<foreach collection="partnerLineIds" item="lineId" open="and partner_line_id in (" close=")" separator=",">
#{lineId}
</foreach>
</if>
</where>
</select>
<select id="getLineIdByIdCard" resultType="java.lang.Long">
select
partner_line_id

View File

@@ -36,7 +36,7 @@
</select>
<insert id="batchInsert">
<insert id="batchInsert" keyColumn="id" keyProperty="record.id" useGeneratedKeys="true">
insert into
hy_partner_line_info
(