Merge remote-tracking branch 'origin/iipbs/as/dev' into iipbs/as/dev
# Conflicts: # apps/as/src/pages/instl-sncn/ui/cnfm-regist-page.tsx
This commit is contained in:
@@ -1,15 +1,52 @@
|
||||
import { client } from "@/shared/api";
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
import type { PageResponse } from "@/shared/model";
|
||||
|
||||
import type { AcntgSeMngTreeDto, AcntgService } from "../model/acntg-interface";
|
||||
import type {
|
||||
AcntgSeMngResponseDto,
|
||||
AcntgSeMngSaveRequestDto,
|
||||
AcntgSeMngSearchDto,
|
||||
AcntgSeMngService,
|
||||
AcntgSeMngTreeDto,
|
||||
} from "../model/acntg-interface";
|
||||
|
||||
async function findTree(): Promise<AcntgSeMngTreeDto[]> {
|
||||
const response = await client.get<AcntgSeMngTreeDto[]>(
|
||||
`${ENDPOINT.AS_COMMON_SERVICE.ACNTG_SE}/list/tree`,
|
||||
);
|
||||
const BASE = ENDPOINT.AS_COMMON_SERVICE.ACNTG_SE;
|
||||
|
||||
async function findAll(params: AcntgSeMngSearchDto): Promise<PageResponse<AcntgSeMngResponseDto>> {
|
||||
const response = await client.get<PageResponse<AcntgSeMngResponseDto>>(BASE, { params });
|
||||
return response.data;
|
||||
}
|
||||
|
||||
export const acntgService = {
|
||||
async function findTree(): Promise<AcntgSeMngTreeDto[]> {
|
||||
const response = await client.get<AcntgSeMngTreeDto[]>(`${BASE}/list/tree`);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function findById(acntgSeCd: string): Promise<AcntgSeMngResponseDto> {
|
||||
const response = await client.get<AcntgSeMngResponseDto>(`${BASE}/${acntgSeCd}`);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function save(body: AcntgSeMngSaveRequestDto): Promise<string> {
|
||||
const response = await client.post<string>(BASE, body);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function update(acntgSeCd: string, body: AcntgSeMngSaveRequestDto): Promise<string> {
|
||||
const response = await client.put<string>(`${BASE}/${acntgSeCd}`, body);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function deleteAcntgSeCd(acntgSeCd: string): Promise<string> {
|
||||
const response = await client.delete<string>(`${BASE}/${acntgSeCd}`);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
export const acntgSeMngService = {
|
||||
findAll,
|
||||
findTree,
|
||||
} satisfies AcntgService;
|
||||
findById,
|
||||
save,
|
||||
update,
|
||||
delete: deleteAcntgSeCd,
|
||||
} satisfies AcntgSeMngService;
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
|
||||
import type { AcntgSeMngSaveRequestDto, AcntgSeMngSearchDto } from "../model/acntg-interface";
|
||||
|
||||
import { acntgSeMngService } from "./acntg-service";
|
||||
|
||||
const acntgSeMngBaseKey = [ENDPOINT.AS_COMMON_SERVICE.ACNTG_SE] as const;
|
||||
|
||||
export function useAcntgSeMngPage(params: AcntgSeMngSearchDto) {
|
||||
return useQuery({
|
||||
queryKey: [...acntgSeMngBaseKey, "findAll", params],
|
||||
queryFn: () => acntgSeMngService.findAll(params),
|
||||
});
|
||||
}
|
||||
|
||||
export function useAcntgSeMngTree() {
|
||||
return useQuery({
|
||||
queryKey: [...acntgSeMngBaseKey, "findTree"],
|
||||
queryFn: () => acntgSeMngService.findTree(),
|
||||
staleTime: Infinity,
|
||||
});
|
||||
}
|
||||
|
||||
export function useAcntgSeMng(acntgSeCd: string | null | undefined) {
|
||||
return useQuery({
|
||||
queryKey: [...acntgSeMngBaseKey, "findById", acntgSeCd],
|
||||
queryFn: () => acntgSeMngService.findById(acntgSeCd!),
|
||||
enabled: Boolean(acntgSeCd),
|
||||
});
|
||||
}
|
||||
|
||||
export function useSaveAcntgSeMng() {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: (body: AcntgSeMngSaveRequestDto) => acntgSeMngService.save(body),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: acntgSeMngBaseKey });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function useUpdateAcntgSeMng() {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: ({ acntgSeCd, body }: { acntgSeCd: string; body: AcntgSeMngSaveRequestDto }) =>
|
||||
acntgSeMngService.update(acntgSeCd, body),
|
||||
onSuccess: (_data, { acntgSeCd }) => {
|
||||
queryClient.invalidateQueries({ queryKey: acntgSeMngBaseKey });
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [...acntgSeMngBaseKey, "findById", acntgSeCd],
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function useDeleteAcntgSeMng() {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: (acntgSeCd: string) => acntgSeMngService.delete(acntgSeCd),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: acntgSeMngBaseKey });
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -1,2 +1,17 @@
|
||||
export type { AcntgSeMngTreeDto, AcntgService } from "./model/acntg-interface";
|
||||
export { acntgService } from "./api/acntg-service";
|
||||
export { acntgSeMngService } from "./api/acntg-service";
|
||||
export {
|
||||
useAcntgSeMng,
|
||||
useAcntgSeMngPage,
|
||||
useAcntgSeMngTree,
|
||||
useDeleteAcntgSeMng,
|
||||
useSaveAcntgSeMng,
|
||||
useUpdateAcntgSeMng,
|
||||
} from "./api/queries";
|
||||
export type {
|
||||
AcntgSeMngResponseDto,
|
||||
AcntgSeMngSaveRequestDto,
|
||||
AcntgSeMngSearchDto,
|
||||
AcntgSeMngService,
|
||||
AcntgSeMngTreeDto,
|
||||
BizCstTreeDto,
|
||||
} from "./model/acntg-interface";
|
||||
|
||||
@@ -1,23 +1,67 @@
|
||||
/** 회계구분 트리 노드 DTO */
|
||||
export interface AcntgSeMngTreeDto {
|
||||
/** 들여쓰기 포함 표시명 (앞 공백 수 = 레벨 인디케이터) */
|
||||
indAcntgSeCdNm: string;
|
||||
/** 회계구분코드 */
|
||||
import type { PageableParams, PageResponse } from "@/shared/model";
|
||||
|
||||
/** 백엔드 AcntgSeMngResponseDto */
|
||||
export interface AcntgSeMngResponseDto {
|
||||
acntgSeCd: string;
|
||||
/** 회계구분코드명 */
|
||||
acntgSeCdNm: string;
|
||||
/** 상위 회계구분코드 (null = 최상위) */
|
||||
upAcntgSeCd: string | null;
|
||||
/** 사용여부 */
|
||||
upAcntgSeCd?: string;
|
||||
cdLvNo: number;
|
||||
useYn: string;
|
||||
expln?: string;
|
||||
rgtr?: string;
|
||||
rgtrNm?: string;
|
||||
mdfr?: string;
|
||||
regDt?: string;
|
||||
mdfcnDt?: string;
|
||||
}
|
||||
|
||||
/** 백엔드 AcntgSeMngSearchDto + Pageable */
|
||||
export interface AcntgSeMngSearchDto extends PageableParams {
|
||||
acntgSeCd?: string;
|
||||
acntgSeCdNm?: string;
|
||||
useYn?: string;
|
||||
}
|
||||
|
||||
/** 백엔드 AcntgSeMngSaveRequestDto */
|
||||
export interface AcntgSeMngSaveRequestDto {
|
||||
acntgSeCd: string;
|
||||
acntgSeCdNm: string;
|
||||
upAcntgSeCd?: string;
|
||||
cdLvNo: number;
|
||||
useYn?: string;
|
||||
expln?: string;
|
||||
}
|
||||
|
||||
/** 백엔드 AcntgSeMngTreeDto */
|
||||
export interface AcntgSeMngTreeDto {
|
||||
indAcntgSeCdNm: string;
|
||||
acntgSeCd: string;
|
||||
acntgSeCdNm: string;
|
||||
upAcntgSeCd?: string;
|
||||
useYn: string;
|
||||
/** 트리 레벨 (1 = 총사업비, 2 = 1.공사비/2.보상비/3.부대경비, …) */
|
||||
treeLevel: number;
|
||||
/** 최상위~현재 노드까지 "|" 구분 경로 */
|
||||
treePath: string;
|
||||
}
|
||||
|
||||
/** 회계구분 서비스 인터페이스 */
|
||||
export interface AcntgService {
|
||||
/** 회계구분 트리 전체 조회 */
|
||||
findTree(): Promise<AcntgSeMngTreeDto[]>;
|
||||
/** 백엔드 BizCstTreeDto (InstlSncnMngDetResponseDto 등에서 참조) */
|
||||
export interface BizCstTreeDto {
|
||||
indAcntgSeCdNm: string;
|
||||
acntgSeCd: string;
|
||||
acntgSeCdNm: string;
|
||||
useYn: string;
|
||||
treeLevel: number;
|
||||
treePath: string;
|
||||
bscPlanAmt?: number;
|
||||
bgtRfltAmt?: number;
|
||||
tstmDesignAmt?: number;
|
||||
}
|
||||
|
||||
/** Controller public 메서드명·시그니처와 동일 */
|
||||
export interface AcntgSeMngService {
|
||||
findAll(params: AcntgSeMngSearchDto): Promise<PageResponse<AcntgSeMngResponseDto>>;
|
||||
findTree(): Promise<AcntgSeMngTreeDto[]>;
|
||||
findById(acntgSeCd: string): Promise<AcntgSeMngResponseDto>;
|
||||
save(body: AcntgSeMngSaveRequestDto): Promise<string>;
|
||||
update(acntgSeCd: string, body: AcntgSeMngSaveRequestDto): Promise<string>;
|
||||
delete(acntgSeCd: string): Promise<string>;
|
||||
}
|
||||
|
||||
@@ -1,15 +1,52 @@
|
||||
import { client } from "@/shared/api";
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
import type { PageResponse } from "@/shared/model";
|
||||
|
||||
import type { CnstpSeMngTreeDto, CnstpService } from "../model/cnstp-interface";
|
||||
import type {
|
||||
CnstpSeMngResponseDto,
|
||||
CnstpSeMngSaveRequestDto,
|
||||
CnstpSeMngSearchDto,
|
||||
CnstpSeMngService,
|
||||
CnstpSeMngTreeDto,
|
||||
} from "../model/cnstp-interface";
|
||||
|
||||
async function findTree(): Promise<CnstpSeMngTreeDto[]> {
|
||||
const response = await client.get<CnstpSeMngTreeDto[]>(
|
||||
`${ENDPOINT.AS_COMMON_SERVICE.CNSTP_SE}/list/tree`,
|
||||
);
|
||||
const BASE = ENDPOINT.AS_COMMON_SERVICE.CNSTP_SE;
|
||||
|
||||
async function findAll(params: CnstpSeMngSearchDto): Promise<PageResponse<CnstpSeMngResponseDto>> {
|
||||
const response = await client.get<PageResponse<CnstpSeMngResponseDto>>(BASE, { params });
|
||||
return response.data;
|
||||
}
|
||||
|
||||
export const cnstpService = {
|
||||
async function findTree(): Promise<CnstpSeMngTreeDto[]> {
|
||||
const response = await client.get<CnstpSeMngTreeDto[]>(`${BASE}/list/tree`);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function findById(cnstpSeCd: string): Promise<CnstpSeMngResponseDto> {
|
||||
const response = await client.get<CnstpSeMngResponseDto>(`${BASE}/${cnstpSeCd}`);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function save(body: CnstpSeMngSaveRequestDto): Promise<string> {
|
||||
const response = await client.post<string>(BASE, body);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function update(cnstpSeCd: string, body: CnstpSeMngSaveRequestDto): Promise<string> {
|
||||
const response = await client.put<string>(`${BASE}/${cnstpSeCd}`, body);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function deleteCnstpSeCd(cnstpSeCd: string): Promise<string> {
|
||||
const response = await client.delete<string>(`${BASE}/${cnstpSeCd}`);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
export const cnstpSeMngService = {
|
||||
findAll,
|
||||
findTree,
|
||||
} satisfies CnstpService;
|
||||
findById,
|
||||
save,
|
||||
update,
|
||||
delete: deleteCnstpSeCd,
|
||||
} satisfies CnstpSeMngService;
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
|
||||
import type { CnstpSeMngSaveRequestDto, CnstpSeMngSearchDto } from "../model/cnstp-interface";
|
||||
|
||||
import { cnstpSeMngService } from "./cnstp-service";
|
||||
|
||||
const cnstpSeMngBaseKey = [ENDPOINT.AS_COMMON_SERVICE.CNSTP_SE] as const;
|
||||
|
||||
export function useCnstpSeMngPage(params: CnstpSeMngSearchDto) {
|
||||
return useQuery({
|
||||
queryKey: [...cnstpSeMngBaseKey, "findAll", params],
|
||||
queryFn: () => cnstpSeMngService.findAll(params),
|
||||
});
|
||||
}
|
||||
|
||||
export function useCnstpSeMngTree() {
|
||||
return useQuery({
|
||||
queryKey: [...cnstpSeMngBaseKey, "findTree"],
|
||||
queryFn: () => cnstpSeMngService.findTree(),
|
||||
staleTime: Infinity,
|
||||
});
|
||||
}
|
||||
|
||||
export function useCnstpSeMng(cnstpSeCd: string | null | undefined) {
|
||||
return useQuery({
|
||||
queryKey: [...cnstpSeMngBaseKey, "findById", cnstpSeCd],
|
||||
queryFn: () => cnstpSeMngService.findById(cnstpSeCd!),
|
||||
enabled: Boolean(cnstpSeCd),
|
||||
});
|
||||
}
|
||||
|
||||
export function useSaveCnstpSeMng() {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: (body: CnstpSeMngSaveRequestDto) => cnstpSeMngService.save(body),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: cnstpSeMngBaseKey });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function useUpdateCnstpSeMng() {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: ({ cnstpSeCd, body }: { cnstpSeCd: string; body: CnstpSeMngSaveRequestDto }) =>
|
||||
cnstpSeMngService.update(cnstpSeCd, body),
|
||||
onSuccess: (_data, { cnstpSeCd }) => {
|
||||
queryClient.invalidateQueries({ queryKey: cnstpSeMngBaseKey });
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [...cnstpSeMngBaseKey, "findById", cnstpSeCd],
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function useDeleteCnstpSeMng() {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: (cnstpSeCd: string) => cnstpSeMngService.delete(cnstpSeCd),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: cnstpSeMngBaseKey });
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -1,2 +1,17 @@
|
||||
export type { CnstpSeMngTreeDto, CnstpService } from "./model/cnstp-interface";
|
||||
export { cnstpService } from "./api/cnstp-service";
|
||||
export { cnstpSeMngService } from "./api/cnstp-service";
|
||||
export {
|
||||
useCnstpSeMng,
|
||||
useCnstpSeMngPage,
|
||||
useCnstpSeMngTree,
|
||||
useDeleteCnstpSeMng,
|
||||
useSaveCnstpSeMng,
|
||||
useUpdateCnstpSeMng,
|
||||
} from "./api/queries";
|
||||
export type {
|
||||
BizSclTreeDto,
|
||||
CnstpSeMngResponseDto,
|
||||
CnstpSeMngSaveRequestDto,
|
||||
CnstpSeMngSearchDto,
|
||||
CnstpSeMngService,
|
||||
CnstpSeMngTreeDto,
|
||||
} from "./model/cnstp-interface";
|
||||
|
||||
@@ -1,23 +1,67 @@
|
||||
/** 공종구분 트리 노드 DTO */
|
||||
export interface CnstpSeMngTreeDto {
|
||||
/** 들여쓰기 포함 표시명 */
|
||||
indCnstpSeCdNm: string;
|
||||
/** 공종구분코드 */
|
||||
import type { PageableParams, PageResponse } from "@/shared/model";
|
||||
|
||||
/** 백엔드 CnstpSeMngResponseDto */
|
||||
export interface CnstpSeMngResponseDto {
|
||||
cnstpSeCd: string;
|
||||
/** 공종구분코드명 */
|
||||
cnstpSeCdNm: string;
|
||||
/** 상위 공종구분코드 (null = 최상위) */
|
||||
upCnstpCd: string | null;
|
||||
/** 사용여부 */
|
||||
upCnstpCd?: string;
|
||||
cdLvNo: number;
|
||||
useYn: string;
|
||||
expln?: string;
|
||||
rgtr?: string;
|
||||
rgtrNm?: string;
|
||||
mdfr?: string;
|
||||
regDt?: string;
|
||||
mdfcnDt?: string;
|
||||
}
|
||||
|
||||
/** 백엔드 CnstpSeMngSearchDto + Pageable */
|
||||
export interface CnstpSeMngSearchDto extends PageableParams {
|
||||
cnstpSeCd?: string;
|
||||
cnstpSeCdNm?: string;
|
||||
useYn?: string;
|
||||
}
|
||||
|
||||
/** 백엔드 CnstpSeMngSaveRequestDto */
|
||||
export interface CnstpSeMngSaveRequestDto {
|
||||
cnstpSeCd: string;
|
||||
cnstpSeCdNm?: string;
|
||||
upCnstpCd?: string;
|
||||
cdLvNo?: number;
|
||||
useYn?: string;
|
||||
expln?: string;
|
||||
}
|
||||
|
||||
/** 백엔드 CnstpSeMngTreeDto */
|
||||
export interface CnstpSeMngTreeDto {
|
||||
indCnstpSeCdNm: string;
|
||||
cnstpSeCd: string;
|
||||
cnstpSeCdNm: string;
|
||||
upCnstpCd?: string;
|
||||
useYn: string;
|
||||
/** 트리 레벨 */
|
||||
treeLevel: number;
|
||||
/** 최상위~현재 노드까지 "|" 구분 경로 */
|
||||
treePath: string;
|
||||
}
|
||||
|
||||
/** 공종구분 서비스 인터페이스 */
|
||||
export interface CnstpService {
|
||||
/** 공종구분 트리 전체 조회 */
|
||||
findTree(): Promise<CnstpSeMngTreeDto[]>;
|
||||
/** 백엔드 BizSclTreeDto */
|
||||
export interface BizSclTreeDto {
|
||||
indCnstpSeCdNm: string;
|
||||
cnstpSeCd: string;
|
||||
cnstpSeCdNm: string;
|
||||
useYn: string;
|
||||
treeLevel: number;
|
||||
treePath: string;
|
||||
bscPlanQty?: number;
|
||||
bgtRfltQty?: number;
|
||||
tstmDesignQty?: number;
|
||||
}
|
||||
|
||||
/** Controller public 메서드명·시그니처와 동일 */
|
||||
export interface CnstpSeMngService {
|
||||
findAll(params: CnstpSeMngSearchDto): Promise<PageResponse<CnstpSeMngResponseDto>>;
|
||||
findTree(): Promise<CnstpSeMngTreeDto[]>;
|
||||
findById(cnstpSeCd: string): Promise<CnstpSeMngResponseDto>;
|
||||
save(body: CnstpSeMngSaveRequestDto): Promise<string>;
|
||||
update(cnstpSeCd: string, body: CnstpSeMngSaveRequestDto): Promise<string>;
|
||||
delete(cnstpSeCd: string): Promise<string>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user