Skip to content

Commit

Permalink
feat(WIP):取引先
Browse files Browse the repository at this point in the history
Add infrastructure and domain layers for partner management

Introduce MyBatis mappers, XML configurations, and domain models for managing partner data. These include CRUD operations, immutable domain representations, and repository integration to ensure scalability and maintainability.
  • Loading branch information
k2works committed Jan 7, 2025
1 parent df7d829 commit 20143a5
Show file tree
Hide file tree
Showing 10 changed files with 122 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.example.sms.domain.model.master.partner;

import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Value;

/**
* 取引先
*/
@Value
@AllArgsConstructor
@NoArgsConstructor(force = true)
public class Partner {
String partnerCode; // 取引先コード
String partnerName; // 取引先名
String partnerNameKana; // 取引先名カナ
Integer supplierType; // 仕入先区分
String postalCode; // 郵便番号
String prefecture; // 都道府県
String address1; // 住所1
String address2; // 住所2
Integer tradeProhibitedFlag; // 取引禁止フラグ
Integer miscellaneousType; // 雑区分
String partnerGroupCode; // 取引先グループコード
Integer creditLimit; // 与信限度額
Integer temporaryCreditIncrease; // 与信一時増加枠
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.example.sms.domain.model.master.partner;

import java.util.Collections;
import java.util.List;

/**
* 取引先一覧
*/
public class PartnerList {
List<Partner> value;

public PartnerList(List<Partner> value) {
this.value = Collections.unmodifiableList(value);
}

public int size() {
return value.size();
}

public PartnerList add(Partner partner) {
List<Partner> newValue = value;
newValue.add(partner);
return new PartnerList(newValue);
}

public List<Partner> asList() {
return value;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**
* 取引先
*/
package com.example.sms.domain.model.master.partner;
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.example.sms.infrastructure.datasource.master.partner;

import com.example.sms.infrastructure.datasource.autogen.model.取引先マスタ;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class PartnerCustomEntity extends 取引先マスタ {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.example.sms.infrastructure.datasource.master.partner;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface PartnerCustomMapper {
PartnerCustomEntity selectByPrimaryKey(String partnerCode);

List<PartnerCustomEntity> selectAll();

@Delete("DELETE FROM public.取引先マスタ")
void deleteAll();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?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.example.sms.infrastructure.datasource.master.partner.PartnerCustomMapper">
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="com.example.sms.infrastructure.datasource.autogen.mapper.取引先マスタMapper.BaseResultMap">
select
<include refid="com.example.sms.infrastructure.datasource.autogen.mapper.取引先マスタMapper.Base_Column_List" />
from public.取引先マスタ
where 取引先コード = #{取引先コード,jdbcType=VARCHAR}
</select>

<select id="selectAll" parameterType="java.lang.String" resultMap="com.example.sms.infrastructure.datasource.autogen.mapper.取引先マスタMapper.BaseResultMap">
select
<include refid="com.example.sms.infrastructure.datasource.autogen.mapper.取引先マスタMapper.Base_Column_List" />
from public.取引先マスタ
</select>
</mapper>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.example.sms.infrastructure.datasource.master.partner;

import com.example.sms.service.master.partner.PartnerRepository;
import org.springframework.stereotype.Repository;

@Repository
public class PartnerDataSource implements PartnerRepository {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.example.sms.infrastructure.datasource.master.partner;

import org.springframework.stereotype.Component;

@Component
public class PartnerEntityMapper {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package com.example.sms.infrastructure.datasource.master.partner;
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.example.sms.service.master.partner;

public interface PartnerRepository {
}

0 comments on commit 20143a5

Please sign in to comment.