From 18f215f4f6ccd9ff022cc38702b77880ce01b559 Mon Sep 17 00:00:00 2001 From: "nik.n" Date: Mon, 22 Apr 2024 15:07:07 +0900 Subject: [PATCH] =?UTF-8?q?SQL=E6=A4=9C=E7=B4=A2=E3=81=AB=E6=8B=85?= =?UTF-8?q?=E5=BD=93=E8=80=85=E7=A8=AE=E5=88=A5=E3=82=B3=E3=83=BC=E3=83=89?= =?UTF-8?q?=E6=A4=9C=E7=B4=A2=E6=9D=A1=E4=BB=B6=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/model/internal/master_mainte_csv.py | 13 ++++++++++--- .../src/repositories/emp_chg_inst_repository.py | 7 ++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/ecs/jskult-webapp/src/model/internal/master_mainte_csv.py b/ecs/jskult-webapp/src/model/internal/master_mainte_csv.py index 57b5c7c7..1ccd862b 100644 --- a/ecs/jskult-webapp/src/model/internal/master_mainte_csv.py +++ b/ecs/jskult-webapp/src/model/internal/master_mainte_csv.py @@ -87,7 +87,7 @@ class MasterMainteCSVItem(metaclass=ABCMeta): return error_list def emp_chg_inst_count(self, start_date: str): - return self.emp_chginst_repository.fetch_count(self.inst_cd, self.ta_cd, start_date, self.table_name) + return self.emp_chginst_repository.fetch_count(self.inst_cd, self.ta_cd, self.emp_chg_type_cd, start_date, self.table_name) def is_exist_emp_cd(self, start_date: str) -> bool: if start_date is None or len(start_date) == 0: @@ -454,6 +454,9 @@ class MasterMainteChangeInstEmpCSVItem(MasterMainteCSVItem): if len(self.ta_cd) == 0: error_list.append(self.make_require_error_message( self.line_num, constants.CHANGE_INST_CSV_LOGICAL_NAMES[constants.CSV_CHANGE_TA_CD_COL_NO])) + if len(self.emp_chg_type_cd) == 0: + error_list.append(self.make_require_error_message( + self.line_num, constants.CHANGE_INST_CSV_LOGICAL_NAMES[constants.CSV_CHANGE_EMP_CHG_TYPE_CD_COL_NO])) if len(self.inst_emp_start_date) == 0: error_list.append(self.make_require_error_message( self.line_num, @@ -469,6 +472,10 @@ class MasterMainteChangeInstEmpCSVItem(MasterMainteCSVItem): if len(self.ta_cd) == 0: error_list.append(self.make_require_error_message( self.line_num, constants.CHANGE_INST_CSV_LOGICAL_NAMES[constants.CSV_CHANGE_TA_CD_COL_NO])) + if len(self.emp_chg_type_cd) == 0: + error_list.append(self.make_require_error_message( + self.line_num, constants.CHANGE_INST_CSV_LOGICAL_NAMES[constants.CSV_CHANGE_EMP_CHG_TYPE_CD_COL_NO])) + if len(self.emp_cd) == 0: error_list.append(self.make_require_error_message( self.line_num, constants.CHANGE_INST_CSV_LOGICAL_NAMES[constants.CSV_CHANGE_EMP_CD_COL_NO])) @@ -572,10 +579,10 @@ class MasterMainteChangeInstEmpCSVItem(MasterMainteCSVItem): error_list = [] emp_chg_inst_count = super().emp_chg_inst_count(self.inst_emp_start_date) if self.comment == '追加' and emp_chg_inst_count > 0: - error_list.append(f'{self.line_num}行目の施設コード、領域コード、施設担当_開始日がすべて同一のデータが既に登録されています。') + error_list.append(f'{self.line_num}行目の施設コード、領域コード、担当者種別コード、施設担当_開始日がすべて同一のデータが既に登録されています。') elif (self.comment == '終了' or self.comment == '担当者修正') and emp_chg_inst_count == 0: - error_list.append(f'{self.line_num}行目の施設コード、領域コード、施設担当_開始日がすべて同一のデータが存在しないため更新できません。') + error_list.append(f'{self.line_num}行目の施設コード、領域コード、担当者種別コード、施設担当_開始日がすべて同一のデータが存在しないため更新できません。') return error_list diff --git a/ecs/jskult-webapp/src/repositories/emp_chg_inst_repository.py b/ecs/jskult-webapp/src/repositories/emp_chg_inst_repository.py index 6019b48c..e7359626 100644 --- a/ecs/jskult-webapp/src/repositories/emp_chg_inst_repository.py +++ b/ecs/jskult-webapp/src/repositories/emp_chg_inst_repository.py @@ -132,7 +132,7 @@ class EmpChgInstRepository(BaseRepository): except Exception as e: logger.exception(f'DB Error : Exception={e.args}') raise e - +# TODO FETCH_COUNT_SQL = """\ SELECT COUNT(*) AS count @@ -142,13 +142,14 @@ class EmpChgInstRepository(BaseRepository): inst_cd = :inst_cd AND ta_cd = :ta_cd AND start_date = :start_date + AND emp_chg_type_cd = :emp_chg_type_cd """ - def fetch_count(self, inst_cd, ta_cd, start_date, table_name) -> MasterMenteCountModel: + def fetch_count(self, inst_cd, ta_cd, emp_chg_type_cd, start_date, table_name) -> MasterMenteCountModel: try: query = self.FETCH_COUNT_SQL.format(table_name=table_name) result = self._database.execute_select(query, {'inst_cd': inst_cd, 'ta_cd': ta_cd, - 'start_date': start_date}) + 'emp_chg_type_cd': emp_chg_type_cd,'start_date': start_date}) models = [MasterMenteCountModel(**r) for r in result] if len(models) == 0: return 0