[BO] 임가현황 작업 중 (10)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package app.module.admin.usecase.household.createHousehold.adapters.persistence;
|
||||
|
||||
import app.module.admin.usecase.household.createHousehold.ports.application.domain.CreateResearcherHasHouseholdCmd;
|
||||
import app.module.core.config.application.annotation.CreateCommand;
|
||||
import app.module.core.config.application.util.AuditUtil;
|
||||
import app.module.admin.usecase.household.createHousehold.ports.application.domain.CreateHouseholdHasRoleCmd;
|
||||
@@ -7,6 +8,7 @@ import app.module.admin.usecase.household.createHousehold.ports.application.doma
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import app.module.admin.usecase.household.createHousehold.ports.CreateHouseholdPortOut;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
@@ -14,13 +16,22 @@ class CreateHouseholdDao implements CreateHouseholdPortOut {
|
||||
private final CreateHouseholdMapper mapper;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
@CreateCommand
|
||||
public void operate(CreateHouseholdOutCmd outCmd) {
|
||||
// 임가 등록
|
||||
mapper.createHousehold(outCmd);
|
||||
|
||||
if(outCmd.getResearcherSeq() != null) {
|
||||
// 임가 역할 등록
|
||||
if(outCmd.getRoleIds() != null && !outCmd.getRoleIds().isEmpty()) {
|
||||
mapper.createHouseholdHasRole(
|
||||
AuditUtil.create(new CreateHouseholdHasRoleCmd(outCmd.getSeq(), outCmd.getRoleIds())));
|
||||
}
|
||||
|
||||
// 임가 담당 조사원 등록
|
||||
if(outCmd.getAdminSeq() != null) {
|
||||
mapper.createResearcherHasHousehold(
|
||||
AuditUtil.create(new CreateResearcherHasHouseholdCmd(outCmd.getSeq(), outCmd.getAdminSeq())));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,12 @@ package app.module.admin.usecase.household.createHousehold.adapters.persistence;
|
||||
|
||||
import app.module.admin.usecase.household.createHousehold.ports.application.domain.CreateHouseholdHasRoleCmd;
|
||||
import app.module.admin.usecase.household.createHousehold.ports.application.domain.CreateHouseholdOutCmd;
|
||||
import app.module.admin.usecase.household.createHousehold.ports.application.domain.CreateResearcherHasHouseholdCmd;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface CreateHouseholdMapper {
|
||||
void createHousehold(CreateHouseholdOutCmd outCmd);
|
||||
void createHouseholdHasRole(CreateHouseholdHasRoleCmd cmd);
|
||||
void createResearcherHasHousehold(CreateResearcherHasHouseholdCmd cmd);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package app.module.admin.usecase.household.createHousehold.adapters.web;
|
||||
|
||||
import app.module.admin.usecase.household.createHousehold.adapters.web.model.CreateHouseholdResVO;
|
||||
import app.module.core.config.application.util.MessageUtil;
|
||||
import app.module.admin.usecase.household.createHousehold.ports.CreateHouseholdPortIn;
|
||||
import app.module.admin.usecase.household.createHousehold.ports.application.domain.CreateHouseholdInCmd;
|
||||
@@ -50,13 +51,13 @@ class CreateHouseholdController {
|
||||
reqVO.getIndustryMiddleCode(),
|
||||
reqVO.getIndustrySubMiddle(),
|
||||
reqVO.getIndustryDetail(),
|
||||
reqVO.getResearcherSeq(),
|
||||
reqVO.getAdminSeq(),
|
||||
reqVO.getIsPanel(),
|
||||
reqVO.getMemo()
|
||||
)
|
||||
);
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(messageUtil.getMessage("operation.common.save.done"));
|
||||
.body(new CreateHouseholdResVO(reqVO.getHouseholdNum()));
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,7 @@ public class CreateHouseholdReqVO {
|
||||
private String industryMiddleCode;
|
||||
private String industrySubMiddle;
|
||||
private String industryDetail;
|
||||
private Long researcherSeq;
|
||||
private Long adminSeq;
|
||||
private Boolean isPanel;
|
||||
private String memo;
|
||||
}
|
||||
|
||||
@@ -10,4 +10,5 @@ import lombok.Setter;
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class CreateHouseholdResVO {
|
||||
private String householdNum;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public class CreateHouseholdOutCmd extends AuditCommand {
|
||||
private String industryMiddleCode;
|
||||
private String industrySubMiddle;
|
||||
private String industryDetail;
|
||||
private Long researcherSeq;
|
||||
private Long adminSeq;
|
||||
private Boolean isPanel;
|
||||
private String memo;
|
||||
private List<String> roleIds;
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package app.module.admin.usecase.household.createHousehold.ports.application.domain;
|
||||
|
||||
import app.module.core.config.adapters.persistence.component.AuditCommand;
|
||||
import java.util.List;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class CreateResearcherHasHouseholdCmd extends AuditCommand {
|
||||
private Long householdSeq;
|
||||
private Long adminSeq;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package app.module.admin.usecase.household.createResearcherMapping.adapters.persistence;
|
||||
|
||||
import app.module.admin.usecase.household.createResearcherMapping.ports.application.domain.DeleteResearcherMappingCmd;
|
||||
import app.module.core.config.application.util.AuditUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import app.module.admin.usecase.household.createResearcherMapping.ports.application.domain.CreateResearcherMappingCmd;
|
||||
import app.module.admin.usecase.household.createResearcherMapping.ports.CreateResearcherMappingPortOut;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
class CreateResearcherMappingDao implements CreateResearcherMappingPortOut {
|
||||
private final CreateResearcherMappingMapper mapper;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void operate(CreateResearcherMappingCmd cmd) {
|
||||
// 조사원 임가 매핑 되어있던 것 delete
|
||||
mapper.deleteResearcherMapping(
|
||||
AuditUtil.delete(new DeleteResearcherMappingCmd(cmd.getHouseholdSeqs())));
|
||||
|
||||
// 조사원 임가 매핑 새로 insert
|
||||
mapper.createResearcherMapping(
|
||||
AuditUtil.create(new CreateResearcherMappingCmd(cmd.getAdminSeq(), cmd.getHouseholdSeqs())));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package app.module.admin.usecase.household.createResearcherMapping.adapters.persistence;
|
||||
|
||||
import app.module.admin.usecase.household.createResearcherMapping.ports.application.domain.CreateResearcherMappingCmd;
|
||||
import app.module.admin.usecase.household.createResearcherMapping.ports.application.domain.DeleteResearcherMappingCmd;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface CreateResearcherMappingMapper {
|
||||
void deleteResearcherMapping(DeleteResearcherMappingCmd cmd);
|
||||
void createResearcherMapping(CreateResearcherMappingCmd cmd);
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package app.module.admin.usecase.household.createResearcherMapping.adapters.web;
|
||||
|
||||
import app.module.admin.usecase.household.createResearcherMapping.ports.CreateResearcherMappingPortIn;
|
||||
import app.module.admin.usecase.household.createResearcherMapping.ports.application.domain.CreateResearcherMappingCmd;
|
||||
import app.module.core.config.application.util.MessageUtil;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import app.module.admin.usecase.household.createResearcherMapping.adapters.web.model.CreateResearcherMappingReqVO;
|
||||
import app.module.admin.usecase.household.createResearcherMapping.adapters.web.model.CreateResearcherMappingResVO;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
class CreateResearcherMappingController {
|
||||
|
||||
private final CreateResearcherMappingPortIn portIn;
|
||||
private final MessageUtil messageUtil;
|
||||
|
||||
@PostMapping(path = "/api/household/researcherMapping/create")
|
||||
ResponseEntity<?> operate(@Valid @RequestBody CreateResearcherMappingReqVO reqVO,
|
||||
BindingResult bindingResult) {
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY).body(bindingResult);
|
||||
}
|
||||
|
||||
// 등록
|
||||
portIn.operate(
|
||||
new CreateResearcherMappingCmd(reqVO.getAdminSeq(), reqVO.getHouseholdSeqs()));
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new CreateResearcherMappingResVO(reqVO.getAdminSeq(), reqVO.getHouseholdSeqs()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package app.module.admin.usecase.household.createResearcherMapping.adapters.web.model;
|
||||
|
||||
import java.util.List;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class CreateResearcherMappingReqVO {
|
||||
private Long adminSeq;
|
||||
private List<Long> householdSeqs;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package app.module.admin.usecase.household.createResearcherMapping.adapters.web.model;
|
||||
|
||||
import java.util.List;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class CreateResearcherMappingResVO {
|
||||
private Long adminSeq;
|
||||
private List<Long> householdSeqs;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package app.module.admin.usecase.household.createResearcherMapping.ports;
|
||||
|
||||
import app.module.admin.usecase.household.createResearcherMapping.ports.application.domain.CreateResearcherMappingCmd;
|
||||
|
||||
public interface CreateResearcherMappingPortIn {
|
||||
void operate(CreateResearcherMappingCmd cmd);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package app.module.admin.usecase.household.createResearcherMapping.ports;
|
||||
|
||||
import app.module.admin.usecase.household.createResearcherMapping.ports.application.domain.CreateResearcherMappingCmd;
|
||||
|
||||
public interface CreateResearcherMappingPortOut {
|
||||
void operate(CreateResearcherMappingCmd cmd);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package app.module.admin.usecase.household.createResearcherMapping.ports.application;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import app.module.admin.usecase.household.createResearcherMapping.ports.application.domain.CreateResearcherMappingCmd;
|
||||
import app.module.admin.usecase.household.createResearcherMapping.ports.CreateResearcherMappingPortIn;
|
||||
import app.module.admin.usecase.household.createResearcherMapping.ports.CreateResearcherMappingPortOut;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
class CreateResearcherMappingService implements CreateResearcherMappingPortIn {
|
||||
private final CreateResearcherMappingPortOut portOut;
|
||||
|
||||
@Override
|
||||
public void operate(CreateResearcherMappingCmd cmd) {
|
||||
portOut.operate(cmd);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package app.module.admin.usecase.household.createResearcherMapping.ports.application.domain;
|
||||
|
||||
import app.module.core.config.adapters.persistence.component.AuditCommand;
|
||||
import java.util.List;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class CreateResearcherMappingCmd extends AuditCommand {
|
||||
private Long adminSeq;
|
||||
private List<Long> householdSeqs;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package app.module.admin.usecase.household.createResearcherMapping.ports.application.domain;
|
||||
|
||||
import app.module.core.config.adapters.persistence.component.AuditCommand;
|
||||
import java.util.List;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class DeleteResearcherMappingCmd extends AuditCommand {
|
||||
private List<Long> householdSeqs;
|
||||
}
|
||||
@@ -12,7 +12,6 @@ import lombok.Setter;
|
||||
public class GetBankAutoTransferExpenseRecords {
|
||||
private Long id;
|
||||
private String categoryText;
|
||||
private String categorySelf;
|
||||
private String sourcePurpose;
|
||||
private Integer count;
|
||||
private String unitText;
|
||||
|
||||
@@ -13,7 +13,7 @@ public class GetBankAutoTransferIncomeRecords {
|
||||
private Long id;
|
||||
private String cropText;
|
||||
private String categoryText;
|
||||
private String categorySelf;
|
||||
private String target;
|
||||
private String sourcePurpose;
|
||||
private Integer count;
|
||||
private String unitText;
|
||||
|
||||
@@ -18,11 +18,11 @@ public class GetForestProductsStatus {
|
||||
private String cropName;
|
||||
private String landArea;
|
||||
private String mainYield;
|
||||
private String mainYieldText;
|
||||
private String mainYieldUnitText;
|
||||
private String mainSaleAmount;
|
||||
private String mainSaleAmountText;
|
||||
private String mainSaleAmountUnitText;
|
||||
private String subYield;
|
||||
private String subYieldText;
|
||||
private String subYieldUnitText;
|
||||
private String subSaleAmount;
|
||||
private String subSaleAmountText;
|
||||
private String subSaleAmountUnitText;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package app.module.admin.usecase.household.getPopupResearchers.adapters.persistence;
|
||||
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import app.module.admin.usecase.household.getPopupResearchers.ports.application.domain.GetPopupResearchers;
|
||||
import app.module.admin.usecase.household.getPopupResearchers.ports.application.domain.GetPopupResearchersCmd;
|
||||
import app.module.admin.usecase.household.getPopupResearchers.ports.GetPopupResearchersPortOut;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
class GetPopupResearchersDao implements GetPopupResearchersPortOut {
|
||||
private final GetPopupResearchersMapper mapper;
|
||||
|
||||
@Override
|
||||
public Page<GetPopupResearchers> operate(Pageable pageable, GetPopupResearchersCmd cmd) {
|
||||
List<GetPopupResearchers> result = mapper.getPopupResearchers(pageable, cmd);
|
||||
|
||||
return new PageImpl<>(result, pageable, result.isEmpty() ? 0 : result.get(0).getTotal());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package app.module.admin.usecase.household.getPopupResearchers.adapters.persistence;
|
||||
|
||||
import app.module.admin.usecase.household.getPopupResearchers.ports.application.domain.GetPopupResearchers;
|
||||
import app.module.admin.usecase.household.getPopupResearchers.ports.application.domain.GetPopupResearchersCmd;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
@Mapper
|
||||
public interface GetPopupResearchersMapper {
|
||||
List<GetPopupResearchers> getPopupResearchers(@Param("pageable") Pageable pageable,
|
||||
@Param("cmd") GetPopupResearchersCmd cmd);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package app.module.admin.usecase.household.getPopupResearchers.adapters.web;
|
||||
|
||||
import app.module.admin.usecase.household.getPopupResearchers.ports.GetPopupResearchersPortIn;
|
||||
import app.module.admin.usecase.household.getPopupResearchers.ports.application.domain.GetPopupResearchersCmd;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.boot.context.properties.bind.DefaultValue;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import app.module.admin.usecase.household.getPopupResearchers.adapters.web.model.GetPopupResearchersReqVO;
|
||||
import app.module.admin.usecase.household.getPopupResearchers.adapters.web.model.GetPopupResearchersResVO;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
class GetPopupResearchersController {
|
||||
|
||||
private final GetPopupResearchersPortIn portIn;
|
||||
|
||||
@GetMapping(path = "/api/popupResearchers")
|
||||
ResponseEntity<?> operate(
|
||||
@PageableDefault(size = 10) Pageable pageable, GetPopupResearchersReqVO reqVO) {
|
||||
return ResponseEntity.status(HttpStatus.OK).body(portIn.operate(pageable,
|
||||
new GetPopupResearchersCmd(reqVO.getSearchField(), reqVO.getSearchValue(),
|
||||
reqVO.getRegionMainCode())));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package app.module.admin.usecase.household.getPopupResearchers.adapters.web.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetPopupResearchersReqVO {
|
||||
private String searchField;
|
||||
private String searchValue;
|
||||
private String regionMainCode;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package app.module.admin.usecase.household.getPopupResearchers.adapters.web.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetPopupResearchersResVO {
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package app.module.admin.usecase.household.getPopupResearchers.ports;
|
||||
|
||||
import app.module.admin.usecase.household.getPopupResearchers.ports.application.domain.GetPopupResearchers;
|
||||
import app.module.admin.usecase.household.getPopupResearchers.ports.application.domain.GetPopupResearchersCmd;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
public interface GetPopupResearchersPortIn {
|
||||
Page<GetPopupResearchers> operate(Pageable pageable, GetPopupResearchersCmd cmd);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package app.module.admin.usecase.household.getPopupResearchers.ports;
|
||||
|
||||
import app.module.admin.usecase.household.getPopupResearchers.ports.application.domain.GetPopupResearchers;
|
||||
import app.module.admin.usecase.household.getPopupResearchers.ports.application.domain.GetPopupResearchersCmd;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
public interface GetPopupResearchersPortOut {
|
||||
Page<GetPopupResearchers> operate(Pageable pageable, GetPopupResearchersCmd cmd);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package app.module.admin.usecase.household.getPopupResearchers.ports.application;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import app.module.admin.usecase.household.getPopupResearchers.ports.application.domain.GetPopupResearchers;
|
||||
import app.module.admin.usecase.household.getPopupResearchers.ports.application.domain.GetPopupResearchersCmd;
|
||||
import app.module.admin.usecase.household.getPopupResearchers.ports.GetPopupResearchersPortIn;
|
||||
import app.module.admin.usecase.household.getPopupResearchers.ports.GetPopupResearchersPortOut;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
class GetPopupResearchersService implements GetPopupResearchersPortIn {
|
||||
private final GetPopupResearchersPortOut portOut;
|
||||
|
||||
@Override
|
||||
public Page<GetPopupResearchers> operate(Pageable pageable, GetPopupResearchersCmd cmd) {
|
||||
return portOut.operate(pageable, cmd);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package app.module.admin.usecase.household.getPopupResearchers.ports.application.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetPopupResearchers {
|
||||
private Long adminSeq;
|
||||
private String name;
|
||||
private String phone;
|
||||
private String regionMainName;
|
||||
private Integer householdCount;
|
||||
private Integer total;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package app.module.admin.usecase.household.getPopupResearchers.ports.application.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetPopupResearchersCmd {
|
||||
private String searchField;
|
||||
private String searchValue;
|
||||
private String regionMainCode;
|
||||
}
|
||||
@@ -5,6 +5,7 @@
|
||||
namespace="app.module.admin.usecase.household.createHousehold.adapters.persistence.CreateHouseholdMapper">
|
||||
|
||||
<insert id="createHousehold">
|
||||
/* createHousehold : 임가 등록 */
|
||||
<selectKey keyProperty="seq" resultType="long" order="BEFORE">
|
||||
SELECT nextval('household_seq')
|
||||
</selectKey>
|
||||
@@ -81,6 +82,7 @@
|
||||
</insert>
|
||||
|
||||
<insert id="createHouseholdHasRole">
|
||||
/* createHouseholdHasRole : 임가 역할 등록 */
|
||||
INSERT INTO household_has_role (id,
|
||||
household_seq,
|
||||
role_id,
|
||||
@@ -95,4 +97,22 @@
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="createResearcherHasHousehold">
|
||||
/* createResearcherHasHousehold : 임가 등록 시 담당 조사원 매핑 */
|
||||
INSERT INTO researcher_has_household
|
||||
(
|
||||
id,
|
||||
household_seq,
|
||||
admin_seq,
|
||||
<include refid="common.fields.CreateUpdateBaseColumns"/>
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
nextval('researcher_has_household_seq'),
|
||||
#{householdSeq},
|
||||
#{adminSeq},
|
||||
<include refid="common.fields.CreateUpdateBaseValues"/>
|
||||
)
|
||||
</insert>
|
||||
</mapper>
|
||||
@@ -0,0 +1,37 @@
|
||||
<?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="app.module.admin.usecase.household.createResearcherMapping.adapters.persistence.CreateResearcherMappingMapper">
|
||||
|
||||
<update id="deleteResearcherMapping">
|
||||
/* deleteResearcherMapping : 조사원 임가 매핑 삭제 */
|
||||
UPDATE researcher_has_household
|
||||
SET <include refid="common.fields.DeleteBaseSet"/>
|
||||
WHERE is_deleted = false
|
||||
AND household_seq IN
|
||||
<foreach collection="householdSeqs" item="householdSeq" open="(" separator="," close=")">
|
||||
#{householdSeq}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<insert id="createResearcherMapping">
|
||||
/* createResearcherMapping : 조사원 임가 매핑 등록 */
|
||||
INSERT INTO researcher_has_household
|
||||
(
|
||||
id,
|
||||
admin_seq,
|
||||
household_seq,
|
||||
<include refid="common.fields.CreateUpdateBaseColumns"/>
|
||||
)
|
||||
VALUES
|
||||
<foreach collection="householdSeqs" item="householdSeq" separator=",">
|
||||
(
|
||||
nextval('researcher_has_household_seq'),
|
||||
#{adminSeq},
|
||||
#{householdSeq},
|
||||
<include refid="common.fields.CreateUpdateBaseValues"/>
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
||||
@@ -6,38 +6,77 @@
|
||||
<select id="getBankAutoTransferIncomeRecords"
|
||||
resultType="app.module.admin.usecase.household.getBankAutoTransferRecords.ports.application.domain.GetBankAutoTransferIncomeRecords">
|
||||
/* getBankAutoTransferIncomeRecords : 은행자동이체 (수입) 내역 목록 조회 */
|
||||
SELECT bat.id, /* 수입 id */
|
||||
ui_crop.code_text AS cropText, /* 재배형태 */
|
||||
ui_category.code_text AS categoryText, /* 수입의 종류 (코드명) */
|
||||
bat.transfer_category AS categorySelf, /* 수입의 종류 (텍스트입력) */
|
||||
bat.source_purpose AS sourcePurpose, /* 수입원 */
|
||||
bat.count, /* 수량 */
|
||||
ui_unit.code_text AS unitText, /* 단위 */
|
||||
bat.price /* 현금(원) */
|
||||
SELECT bat.id, /* 수입 id */
|
||||
ui_crop.code_text AS cropText, /* 재배형태 */
|
||||
-- TODO(ks) : 이게 맞나 싶지만.. 일단 .. case when 으로 ..
|
||||
CASE
|
||||
WHEN ui_category.id = 'code.bank.input.self'
|
||||
THEN bat.transfer_category
|
||||
ELSE ui_category.code_text
|
||||
END AS categoryText, /* 수입의 종류 */
|
||||
CASE
|
||||
WHEN ui_category.id = 'code.bank.input.self'
|
||||
THEN '-'
|
||||
ELSE bat.transfer_category
|
||||
END AS target, /* 대상(수입의 종류 텍스트입력) */
|
||||
bat.source_purpose AS sourcePurpose, /* 수입원 */
|
||||
bat.count, /* 수량 */
|
||||
CASE
|
||||
WHEN ui_unit.id = 'code.record.unit.self'
|
||||
THEN bat.unit
|
||||
ELSE ui_unit.code_text
|
||||
END AS unitText, /* 단위 */
|
||||
bat.price AS price /* 현금(원) */
|
||||
FROM bank_auto_transfer bat
|
||||
LEFT JOIN uicode ui_crop ON ui_crop.parent_id = 'code.record.crop' AND ui_crop.id = bat.crop_code
|
||||
LEFT JOIN uicode ui_unit ON ui_unit.parent_id = 'code.record.unit' AND ui_unit.id = bat.unit_code
|
||||
LEFT JOIN uicode ui_category ON ui_category.parent_id = 'code.bank.input' AND ui_category.id = bat.transfer_category_code
|
||||
LEFT JOIN uicode ui_crop
|
||||
ON ui_crop.parent_id = 'code.record.crop'
|
||||
AND ui_crop.id = bat.crop_code
|
||||
AND ui_crop.is_deleted = false
|
||||
LEFT JOIN uicode ui_unit
|
||||
ON ui_unit.parent_id = 'code.record.unit'
|
||||
AND ui_unit.id = bat.unit_code
|
||||
AND ui_unit.is_deleted = false
|
||||
LEFT JOIN uicode ui_category
|
||||
ON ui_category.parent_id = 'code.bank.input'
|
||||
AND ui_category.id = bat.transfer_category_code
|
||||
AND ui_category.is_deleted = false
|
||||
WHERE bat.transfer_type = 'code.bank.input'
|
||||
AND bat.household_seq = #{householdSeq}
|
||||
AND bat.month = #{recordMonth}
|
||||
AND bat.is_deleted = false
|
||||
</select>
|
||||
|
||||
<select id="getBankAutoTransferExpenseRecords"
|
||||
resultType="app.module.admin.usecase.household.getBankAutoTransferRecords.ports.application.domain.GetBankAutoTransferExpenseRecords">
|
||||
/* getBankAutoTransferExpenseRecords : 은행자동이체 (지출) 내역 목록 조회 */
|
||||
SELECT bat.id, /* 지출 id */
|
||||
ui_category.code_text AS cropText, /* 지출의 종류 (코드명) */
|
||||
bat.transfer_category AS categorySelf, /* 지출의 종류 (텍스트입력) */
|
||||
bat.source_purpose AS sourcePurpose, /* 용도 */
|
||||
bat.count, /* 수량 */
|
||||
ui_unit.code_text AS unitText, /* 단위 */
|
||||
bat.price /* 현금(원) */
|
||||
SELECT bat.id, /* 지출 id */
|
||||
CASE
|
||||
WHEN ui_category.id = 'code.bank.input.self'
|
||||
THEN bat.transfer_category
|
||||
ELSE ui_category.code_text
|
||||
END AS categoryText, /* 지출의 종류 */
|
||||
bat.source_purpose AS sourcePurpose, /* 용도 */
|
||||
bat.count, /* 수량 */
|
||||
CASE
|
||||
WHEN ui_unit.id = 'code.record.unit.self'
|
||||
THEN bat.unit
|
||||
ELSE ui_unit.code_text
|
||||
END AS unitText, /* 단위 */
|
||||
bat.price /* 현금(원) */
|
||||
FROM bank_auto_transfer bat
|
||||
LEFT JOIN uicode ui_unit ON ui_unit.parent_id = 'code.record.unit' AND ui_unit.id = bat.unit_code
|
||||
LEFT JOIN uicode ui_category ON ui_category.parent_id = 'code.bank.input' AND ui_category.id = bat.transfer_category_code
|
||||
LEFT JOIN
|
||||
uicode ui_unit
|
||||
ON ui_unit.parent_id = 'code.record.unit'
|
||||
AND ui_unit.id = bat.unit_code
|
||||
AND ui_unit.is_deleted = false
|
||||
LEFT JOIN
|
||||
uicode ui_category
|
||||
ON ui_category.parent_id = 'code.bank.output'
|
||||
AND ui_category.id = bat.transfer_category_code
|
||||
AND ui_category.is_deleted = false
|
||||
WHERE bat.transfer_type = 'code.bank.output'
|
||||
AND bat.household_seq = #{householdSeq}
|
||||
AND bat.month = #{recordMonth}
|
||||
AND bat.is_deleted = false
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -16,27 +16,55 @@
|
||||
<select id="getForestProductsStatus"
|
||||
resultType="app.module.admin.usecase.household.getForestProductsStatus.ports.application.domain.GetForestProductsStatus">
|
||||
/* getForestProductsStatus : 임가 현황의 임산물 현황 목록 조회 */
|
||||
SELECT df.id, /* 임산물 현황 id */
|
||||
df.street_num, /* 지번 */
|
||||
df.land_type, /* 지목 */
|
||||
df.town, /* 읍면동 */
|
||||
df.available_area, /* 가능면적 */
|
||||
df.crop_name, /* 재배작물명 */
|
||||
df.land_area, /* 면적 */
|
||||
df.main_yield, /* 주생산물 수확량 */
|
||||
ui_main_yield.code_text, /* 주생산물 수확량 단위 */
|
||||
df.main_sale_amount, /* 주생산물 판매량 */
|
||||
ui_main_sale.code_text , /* 주생산물 판매량 단위 */
|
||||
df.sub_yield, /* 부생산물 수확량 */
|
||||
ui_sub_yield.code_text , /* 주생산물 판매량 단위 */
|
||||
df.sub_sale_amount, /* 부생산물 판매량 */
|
||||
ui_sub_sale.code_text /* 부생산물 판매량 단위 */
|
||||
SELECT df.id, /* 임산물 현황 id */
|
||||
df.street_num, /* 지번 */
|
||||
df.land_type, /* 지목 */
|
||||
df.town, /* 읍면동 */
|
||||
df.available_area, /* 가능면적 */
|
||||
df.crop_name, /* 재배작물명 */
|
||||
df.land_area, /* 면적 */
|
||||
df.main_yield, /* 주생산물 수확량 */
|
||||
CASE
|
||||
WHEN ui_main_yield.id = 'code.record.unit.self'
|
||||
THEN df.main_yield_unit
|
||||
ELSE ui_main_yield.code_text
|
||||
END AS main_yield_unit_text, /* 주생산물 수확량 단위 */
|
||||
df.main_sale_amount, /* 주생산물 판매량 */
|
||||
CASE
|
||||
WHEN ui_main_sale.id = 'code.record.unit.self'
|
||||
THEN df.main_sale_unit
|
||||
ELSE ui_main_sale.code_text
|
||||
END AS main_sale_unit_text, /* 주생산물 판매량 단위 */
|
||||
df.sub_yield, /* 부생산물 수확량 */
|
||||
CASE
|
||||
WHEN ui_sub_yield.id = 'code.record.unit.self'
|
||||
THEN df.sub_yield_unit
|
||||
ELSE ui_sub_yield.code_text
|
||||
END AS sub_yield_unit_text, /* 부생산물 수확량 단위 */
|
||||
df.sub_sale_amount, /* 부생산물 판매량 */
|
||||
CASE
|
||||
WHEN ui_sub_sale.id = 'code.record.unit.self'
|
||||
THEN df.sub_sale_unit
|
||||
ELSE ui_sub_sale.code_text
|
||||
END AS sub_sale_unit_text /* 부생산물 판매량 단위 */
|
||||
FROM forest_product df
|
||||
-- TODO(ks) : 일단 전부 join.. 추후에 view 로 만들든지 개선해보기..
|
||||
LEFT JOIN uicode ui_main_yield ON ui_main_yield.parent_id = 'code.record.unit' AND ui_main_yield.id = df.main_yield_unit_code
|
||||
LEFT JOIN uicode ui_main_sale ON ui_main_sale.parent_id = 'code.record.unit' AND ui_main_sale.id = df.main_sale_unit_code
|
||||
LEFT JOIN uicode ui_sub_yield ON ui_sub_yield.parent_id = 'code.record.unit' AND ui_sub_yield.id = df.sub_yield_unit_code
|
||||
LEFT JOIN uicode ui_sub_sale ON ui_sub_sale.parent_id = 'code.record.unit' AND ui_sub_sale.id = df.sub_sale_unit_code
|
||||
LEFT JOIN uicode ui_main_yield
|
||||
ON ui_main_yield.parent_id = 'code.record.unit'
|
||||
AND ui_main_yield.id = df.main_yield_unit_code
|
||||
AND ui_main_yield.is_deleted = false
|
||||
LEFT JOIN uicode ui_main_sale
|
||||
ON ui_main_sale.parent_id = 'code.record.unit'
|
||||
AND ui_main_sale.id = df.main_sale_unit_code
|
||||
AND ui_main_sale.is_deleted = false
|
||||
LEFT JOIN uicode ui_sub_yield
|
||||
ON ui_sub_yield.parent_id = 'code.record.unit'
|
||||
AND ui_sub_yield.id = df.sub_yield_unit_code
|
||||
AND ui_sub_yield.is_deleted = false
|
||||
LEFT JOIN uicode ui_sub_sale
|
||||
ON ui_sub_sale.parent_id = 'code.record.unit'
|
||||
AND ui_sub_sale.id = df.sub_sale_unit_code
|
||||
AND ui_sub_sale.is_deleted = false
|
||||
WHERE df.household_seq = #{householdSeq}
|
||||
AND df.month = #{recordMonth}
|
||||
AND df.is_deleted = false
|
||||
|
||||
@@ -7,57 +7,77 @@
|
||||
<select id="getHouseholdsStatus"
|
||||
resultType="app.module.admin.usecase.household.getHouseholdsStatus.ports.application.domain.GetHouseholdsStatus">
|
||||
/* getHouseholdsStatus : 임가현황 리스트 조회 */
|
||||
WITH record_progress AS (
|
||||
SELECT ROUND(
|
||||
100.0 *
|
||||
(SELECT COUNT(*)
|
||||
FROM daily_record
|
||||
WHERE record_month = #{cmd.recordMonth} AND all_status = 'DONE')
|
||||
/ NULLIF(
|
||||
(SELECT COUNT(*)
|
||||
FROM daily_day_group
|
||||
WHERE end_day <= EXTRACT(DAY FROM CURRENT_DATE)), 0
|
||||
),
|
||||
2
|
||||
) AS progress_percent
|
||||
) /* 일계부 입력 진행 완료 퍼센테이지 (이번달 작성 완료일 수 / 현재날짜 기준 전체 입력 가능 날짜 수) */
|
||||
WITH daily_progress AS (
|
||||
/* 임가별 이번달 완료된 일 수 계산 */
|
||||
SELECT
|
||||
household_seq,
|
||||
COUNT(*) as completed_days
|
||||
FROM daily_record
|
||||
WHERE record_month = #{cmd.recordMonth}
|
||||
AND all_status IN ('DONE', 'TODAY_NONE')
|
||||
GROUP BY household_seq
|
||||
),
|
||||
total_days AS (
|
||||
/* 오늘 날짜 기준 전체 입력 가능 날짜 수 */
|
||||
SELECT COUNT(*) as total_possible_days
|
||||
FROM daily_day_group
|
||||
WHERE end_day <= EXTRACT(DAY FROM CURRENT_DATE)
|
||||
),
|
||||
visit_summary AS (
|
||||
/* 임가별 1차임가방문, 2차임가방문, 답례품전달여부 */
|
||||
SELECT
|
||||
rhh.household_seq,
|
||||
MIN(v.visit_date) AS first_visit_date,
|
||||
MAX(v.visit_date) AS second_visit_date,
|
||||
BOOL_OR(v.is_gift_sent) AS is_gift_sent
|
||||
FROM household_visit v
|
||||
JOIN researcher_has_household rhh ON v.household_seq = rhh.household_seq
|
||||
WHERE rhh.is_deleted = false
|
||||
AND TO_CHAR(v.visit_date, 'YYYYMM') = #{cmd.recordMonth}
|
||||
GROUP BY rhh.household_seq
|
||||
)
|
||||
SELECT
|
||||
hvr.*,
|
||||
COUNT(*) OVER () AS total
|
||||
FROM (
|
||||
SELECT
|
||||
r.admin_seq AS adminSeq,
|
||||
h.seq AS householdSeq,
|
||||
h.household_num AS householdNum,
|
||||
h.owner_name AS householdName,
|
||||
h.phone AS householdPhone,
|
||||
h.region_main_code AS regionMainCode,
|
||||
h.region_main_name AS regionMainName,
|
||||
h.region_sub_code AS regionSubCode,
|
||||
h.region_sub_name AS regionSubName,
|
||||
h.region_detail_code AS regionDetailCode,
|
||||
h.region_detail_name AS regionDetailName,
|
||||
h.industry_large_code as industryLargeCode,
|
||||
h.industry_large_name AS industryLargeName,
|
||||
h.industry_middle_code as industryMiddleCode,
|
||||
h.industry_middle_name AS industryMiddleName,
|
||||
h.is_panel AS isPanel,
|
||||
ps.progress_percent AS progressPercent,
|
||||
v.first_visit_date AS firstVisitDate,
|
||||
v.second_visit_date AS secondVisitDate,
|
||||
COALESCE(v.is_gift_sent, false) AS isGiftSent,
|
||||
r.researcher_name AS researcherName,
|
||||
r.researcher_phone AS researcherPhone
|
||||
r.admin_seq AS adminSeq,
|
||||
h.seq AS householdSeq,
|
||||
h.household_num AS householdNum,
|
||||
h.owner_name AS householdName,
|
||||
h.phone AS householdPhone,
|
||||
h.region_main_code AS regionMainCode,
|
||||
h.region_main_name AS regionMainName,
|
||||
h.region_sub_code AS regionSubCode,
|
||||
h.region_sub_name AS regionSubName,
|
||||
h.region_detail_code AS regionDetailCode,
|
||||
h.region_detail_name AS regionDetailName,
|
||||
h.industry_large_code AS industryLargeCode,
|
||||
h.industry_large_name AS industryLargeName,
|
||||
h.industry_middle_code AS industryMiddleCode,
|
||||
h.industry_middle_name AS industryMiddleName,
|
||||
h.is_panel AS isPanel,
|
||||
/* 일계부 입력 진행 완료 퍼센테이지 (이번달 작성 완료일 수 / 현재날짜 기준 전체 입력 가능 날짜 수) */
|
||||
ROUND(
|
||||
100.0 * COALESCE(dp.completed_days, 0) / NULLIF(td.total_possible_days, 0),
|
||||
2
|
||||
) AS progressPercent,
|
||||
vs.first_visit_date AS firstVisitDate,
|
||||
vs.second_visit_date AS secondVisitDate,
|
||||
COALESCE(vs.is_gift_sent, false) AS isGiftSent,
|
||||
r.researcher_name AS researcherName,
|
||||
r.researcher_phone AS researcherPhone
|
||||
FROM v_household_with_code h
|
||||
LEFT JOIN v_household_visit v ON h.seq = v.household_seq
|
||||
CROSS JOIN total_days td
|
||||
LEFT JOIN daily_progress dp ON h.seq = dp.household_seq
|
||||
LEFT JOIN visit_summary vs ON h.seq = vs.household_seq
|
||||
LEFT JOIN v_household_researcher r ON h.seq = r.household_seq
|
||||
CROSS JOIN record_progress ps
|
||||
) AS hvr
|
||||
|
||||
<where>
|
||||
1=1
|
||||
|
||||
<if test="cmd.ownerField != null and cmd.ownerField != ''">
|
||||
<if test="cmd.ownerField != null and cmd.ownerField != '' and cmd.ownerValue != ''">
|
||||
/* 경영주 검색 */
|
||||
<choose>
|
||||
<when test="cmd.ownerField eq 'name'">
|
||||
@@ -69,7 +89,7 @@
|
||||
</choose>
|
||||
</if>
|
||||
|
||||
<if test="cmd.researcherField != null and cmd.researcherField != ''">
|
||||
<if test="cmd.researcherField != null and cmd.researcherField != '' and cmd.researcherValue != ''">
|
||||
/* 조사원 검색 */
|
||||
<choose>
|
||||
<when test="cmd.researcherField eq 'name'">
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
<?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="app.module.admin.usecase.household.getPopupResearchers.adapters.persistence.GetPopupResearchersMapper">
|
||||
<select id="getPopupResearchers"
|
||||
resultType="app.module.admin.usecase.household.getPopupResearchers.ports.application.domain.GetPopupResearchers">
|
||||
SELECT
|
||||
a.seq AS adminSeq,
|
||||
a.name,
|
||||
a.phone,
|
||||
u.code_text AS regionMainName,
|
||||
COUNT(DISTINCT rhh.household_seq) AS householdCount,
|
||||
COUNT(*) OVER() AS total
|
||||
FROM admin a
|
||||
JOIN admin_has_role ahr
|
||||
ON a.seq = ahr.admin_seq
|
||||
AND ahr.role_id = 'ROLE_RESEARCHER'
|
||||
AND ahr.is_deleted = false
|
||||
LEFT JOIN uicode u
|
||||
ON u.parent_id = 'code.region.main'
|
||||
AND u.id = a.region_main_code
|
||||
LEFT JOIN researcher_has_household rhh
|
||||
ON rhh.admin_seq = a.seq
|
||||
AND rhh.is_deleted = false
|
||||
WHERE a.is_deleted = false AND a.account_disabled = false
|
||||
|
||||
<if test="cmd.searchField != null and cmd.searchField != '' and cmd.searchValue != ''">
|
||||
/* 조사원 검색 */
|
||||
<choose>
|
||||
<when test="cmd.searchField eq 'name'">
|
||||
AND a.name ILIKE '%' || #{cmd.searchValue} || '%'
|
||||
</when>
|
||||
<when test="cmd.searchField eq 'phone'">
|
||||
AND a.phone ILIKE '%' || #{cmd.searchValue} || '%'
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
|
||||
<if test="cmd.regionMainCode != null and cmd.regionMainCode != ''">
|
||||
/* 실사 검색 */
|
||||
AND a.region_main_code = #{cmd.regionMainCode}
|
||||
</if>
|
||||
|
||||
GROUP BY a.seq, a.name, a.phone, u.code_text, a.region_main_code
|
||||
ORDER BY a.region_main_code ASC
|
||||
|
||||
OFFSET #{pageable.offset} ROWS FETCH NEXT #{pageable.pageSize} ROWS ONLY
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -453,7 +453,7 @@ const showAudit = (auditItem, createdBy, createdAt, updatedBy, updatedAt) => {
|
||||
})
|
||||
})();
|
||||
|
||||
const ifNullDash = (value, fallback = '-') => {
|
||||
const ifNullHyphen = (value, fallback = '-') => {
|
||||
return value !== null && value !== undefined && value !== '' ? value : fallback;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
<div class="layer-wrap" th:fragment="modalFragment">
|
||||
<form autocomplete="off" method="get" name="reqResearcherForm">
|
||||
<input name="page" value="0" type="hidden"/>
|
||||
<input name="size" value="10" type="hidden">
|
||||
|
||||
<div class="component-modal mypage-wrap modal01" data-props-dimm-click="true" data-state="close">
|
||||
<div class="modal-dimm"></div>
|
||||
@@ -51,9 +52,7 @@
|
||||
실사
|
||||
</p>
|
||||
</div>
|
||||
<select class="select-list" name="searchArea" id="regionMainCodeSelect" required>
|
||||
<option value="" disabled hidden>선택해주세요.</option>
|
||||
<option value="" selected>전체</option>
|
||||
<select class="select-list" name="regionMainCode" id="regionMainCodeSelect" required>
|
||||
<!-- ajax 호출 -->
|
||||
</select>
|
||||
</div>
|
||||
@@ -64,10 +63,10 @@
|
||||
<!-- 버튼 그룹 -->
|
||||
<div class="component-btns">
|
||||
<div class="btns-row">
|
||||
<button type="button" class="btn">
|
||||
<button type="button" class="btn" onclick="goReset();">
|
||||
<span class="btn-txt">초기화</span>
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary">
|
||||
<button type="button" class="btn btn-primary" onclick="getResearchers(0);">
|
||||
<span class="btn-txt">검색</span>
|
||||
</button>
|
||||
</div>
|
||||
@@ -75,6 +74,7 @@
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<p class="input-label" style="font-size: 16px;">총 <span id="researcherTotal">0</span>건</p>
|
||||
<!-- 테이블 영역 -->
|
||||
<table>
|
||||
<thead>
|
||||
@@ -88,46 +88,8 @@
|
||||
<th>담당임가 수</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="listTBody">
|
||||
<tr>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<label class="radio-inner">
|
||||
<input type="radio" id="temp_radio_0001" name="temp_radio_0001">
|
||||
</label>
|
||||
</div>
|
||||
</td>
|
||||
<td>홍길동</td>
|
||||
<td>010-0000-0000</td>
|
||||
<td>서울</td>
|
||||
<td>40</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<label class="radio-inner">
|
||||
<input type="radio" id="temp_radio_0002" name="temp_radio_0002">
|
||||
</label>
|
||||
</div>
|
||||
</td>
|
||||
<td>홍길동</td>
|
||||
<td>010-0000-0000</td>
|
||||
<td>서울</td>
|
||||
<td>40</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<label class="radio-inner">
|
||||
<input type="radio" id="temp_radio_0003" name="temp_radio_0003">
|
||||
</label>
|
||||
</div>
|
||||
</td>
|
||||
<td>홍길동</td>
|
||||
<td>010-0000-0000</td>
|
||||
<td>서울</td>
|
||||
<td>40</td>
|
||||
</tr>
|
||||
<tbody id="researcherListTbody">
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -136,7 +98,7 @@
|
||||
|
||||
<div class="component-btns bottom-btn-group">
|
||||
<div class="btns-row align-right">
|
||||
<button type="button" class="btn btn-primary">
|
||||
<button type="button" class="btn btn-primary" onclick="setResearcher();">
|
||||
<span class="btn-txt">등록</span>
|
||||
</button>
|
||||
</div>
|
||||
@@ -151,6 +113,8 @@
|
||||
</form>
|
||||
|
||||
<script th:inline="javascript">
|
||||
let researcherList = [];
|
||||
|
||||
const showResearcherModal = () => {
|
||||
document.querySelector(".modal01").ui.open();
|
||||
|
||||
@@ -160,7 +124,7 @@
|
||||
{},
|
||||
(response) => {
|
||||
const select = document.getElementById('regionMainCodeSelect');
|
||||
|
||||
select.innerHTML = '<option value="" selected>전체</option>';
|
||||
response.forEach(item => {
|
||||
const option = document.createElement('option');
|
||||
option.value = item.id;
|
||||
@@ -174,8 +138,11 @@
|
||||
'get',
|
||||
'json'
|
||||
);
|
||||
|
||||
getResearchers(document.reqResearcherForm.page.value);
|
||||
}
|
||||
|
||||
// 조사원 리스트 가져오기
|
||||
const getResearchers = (pageNo) => {
|
||||
const f = document.reqResearcherForm;
|
||||
f.page.value = pageNo;
|
||||
@@ -183,31 +150,33 @@
|
||||
let dataOj = $(f).serializeObject();
|
||||
|
||||
ajaxUtil._ajaxMethod(
|
||||
'/api/mapping/researchers',
|
||||
'/api/popupResearchers',
|
||||
dataOj,
|
||||
function (response) {
|
||||
$('#totalElements').text(response.totalElements);
|
||||
$('#researcherTotal').text(response.totalElements);
|
||||
|
||||
researcherList = response.content;
|
||||
|
||||
// List 구성하기
|
||||
const tbody = $('#listTBody');
|
||||
const tbody = $('#researcherListTbody');
|
||||
tbody.empty();
|
||||
|
||||
$(response.content).each((idx, ct) => {
|
||||
tbody.append(
|
||||
`
|
||||
<!-- <tr>-->
|
||||
<!-- <td>-->
|
||||
<!-- <div class="component-input">-->
|
||||
<!-- <label class="radio-inner">-->
|
||||
<!-- <input type="radio" id="temp_radio_0003" name="temp_radio_0003">-->
|
||||
<!-- </label>-->
|
||||
<!-- </div>-->
|
||||
<!-- </td>-->
|
||||
<!-- <td>홍길동</td>-->
|
||||
<!-- <td>010-0000-0000</td>-->
|
||||
<!-- <td>서울</td>-->
|
||||
<!-- <td>40</td>-->
|
||||
<!-- </tr>-->
|
||||
<tr>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<label class="radio-inner">
|
||||
<input type="radio" id="temp_radio_000${ct.adminSeq}" name="adminSeq" value="${ct.adminSeq}">
|
||||
</label>
|
||||
</div>
|
||||
</td>
|
||||
<td>${ct.name}</td>
|
||||
<td>${ifNullHyphen(ct.phone)}</td>
|
||||
<td>${ct.regionMainName}</td>
|
||||
<td>${ct.householdCount}</td>
|
||||
</tr>
|
||||
`
|
||||
);
|
||||
});
|
||||
@@ -227,7 +196,7 @@
|
||||
uiUtil.getPagingUI(pageNo, f.size.value, response.totalPages,
|
||||
(movePageNo) => {
|
||||
f.page.value = movePageNo;
|
||||
goSearch();
|
||||
getResearchers();
|
||||
}));
|
||||
|
||||
},
|
||||
@@ -240,5 +209,37 @@
|
||||
);
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
const setResearcher = () => {
|
||||
const selectedAdminSeq = $('input[name="adminSeq"]:checked').val();
|
||||
|
||||
if (!selectedAdminSeq) {
|
||||
alert("조사원을 선택해주세요.");
|
||||
return;
|
||||
}
|
||||
|
||||
const selectedResearcher = researcherList.find(r => r.adminSeq == selectedAdminSeq);
|
||||
|
||||
console.log("선택된 조사원 : ", selectedResearcher);
|
||||
|
||||
// import 해준 html 에서 아래 함수를 선언해주면 selectedResearcher 값을 사용할 수 있음.
|
||||
getSelectedResearcher(selectedResearcher, () => {
|
||||
document.querySelector(".modal01").ui.close();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
const goReset = () => {
|
||||
const f = document.reqResearcherForm;
|
||||
|
||||
f.searchField.value = "";
|
||||
f.searchValue.value = "";
|
||||
f.regionMainCode.value = "";
|
||||
|
||||
getResearchers(0);
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
</html>
|
||||
@@ -252,7 +252,7 @@
|
||||
<th>
|
||||
<div class="component-input">
|
||||
<label class="checkbox-inner">
|
||||
<input type="checkbox" id="temp_checkbox_0003" name="temp_checkbox_0001">
|
||||
<input type="checkbox" id="checkedAll" name="checkedAll">
|
||||
</label>
|
||||
</div>
|
||||
</th>
|
||||
@@ -265,8 +265,8 @@
|
||||
<th>업종(대분류)</th>
|
||||
<th>업종(중분류)</th>
|
||||
<th>당월 일계부 현황</th>
|
||||
<th>당월 1차 일가방문</th>
|
||||
<th>당월 2차 일가방문</th>
|
||||
<th>당월 1차 임가방문</th>
|
||||
<th>당월 2차 임가방문</th>
|
||||
<th>답례품 전달</th>
|
||||
<th class="hide-role-researcher">조사원</th>
|
||||
<th class="hide-role-researcher">조사원 휴대전화</th>
|
||||
@@ -292,7 +292,7 @@
|
||||
<span class="btn-txt">임가 등록</span>
|
||||
</button>
|
||||
<!-- 관리자, 지방실사만 노출 -->
|
||||
<button type="button" class="btn" th:if="${userRole != 'ROLE_RESEARCHER'}">
|
||||
<button type="button" class="btn" th:if="${userRole != 'ROLE_RESEARCHER'}" onclick="showResearcherModal();">
|
||||
<span class="btn-txt">조사원 매핑</span>
|
||||
</button>
|
||||
</div>
|
||||
@@ -300,7 +300,7 @@
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
<div th:replace="common/modal-researcher-mapping :: modalFragment"></div>
|
||||
</section>
|
||||
|
||||
<section layout:fragment="script">
|
||||
@@ -330,7 +330,7 @@
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<label class="checkbox-inner">
|
||||
<input type="checkbox" id="temp_checkbox_000${ct.householdSeq}" name="temp_checkbox_000${ct.householdSeq}">
|
||||
<input type="checkbox" id="chkBox_${ct.householdSeq}" name="chkBox" value="${ct.householdSeq}">
|
||||
</label>
|
||||
</div>
|
||||
</td>
|
||||
@@ -340,14 +340,14 @@
|
||||
<td>${ct.regionMainName}</td><!-- 실사 -->
|
||||
<td>${ct.regionSubName}</td><!-- 지역 -->
|
||||
<td>${ct.regionDetailName}</td><!-- 세부지역 -->
|
||||
<td>${ifNullDash(ct.industryLargeName)}</td><!-- 업종 대분류 -->
|
||||
<td>${ifNullDash(ct.industryMiddleName)}</td><!-- 업종 중분류1 -->
|
||||
<td>${ifNullHyphen(ct.industryLargeName)}</td><!-- 업종 대분류 -->
|
||||
<td>${ifNullHyphen(ct.industryMiddleName)}</td><!-- 업종 중분류1 -->
|
||||
<td>${ct.progressPercent}%</td><!-- 임가 진행 상황 -->
|
||||
<td>${ifNullDash(ct.firstVisitDate)}</td><!-- 1차방문날짜 -->
|
||||
<td>${ifNullDash(ct.secondVisitDate)}</td><!-- 2차방문날짜 -->
|
||||
<td>${ifNullHyphen(ct.firstVisitDate)}</td><!-- 1차방문날짜 -->
|
||||
<td>${ifNullHyphen(ct.secondVisitDate)}</td><!-- 2차방문날짜 -->
|
||||
<td>${ct.isGiftSent ? "전달" : "미전달"}</td> <!-- 답례품 -->
|
||||
<td class="hide-role-researcher">${ifNullDash(ct.researcherName)}</td> <!-- 조사원이름 -->
|
||||
<td class="hide-role-researcher">${ifNullDash(ct.researcherPhone)}</td> <!-- 조사원번호 -->
|
||||
<td class="hide-role-researcher">${ifNullHyphen(ct.researcherName)}</td> <!-- 조사원이름 -->
|
||||
<td class="hide-role-researcher">${ifNullHyphen(ct.researcherPhone)}</td> <!-- 조사원번호 -->
|
||||
</tr>
|
||||
`
|
||||
);
|
||||
@@ -398,6 +398,55 @@
|
||||
f.submit();
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
// 조사원 매핑 팝업의 선택된 조사원 가져오기.
|
||||
const getSelectedResearcher = (data, closeModal) => {
|
||||
const checked = document.querySelectorAll('input[name="chkBox"]:checked');
|
||||
const householdSeqs = Array.from(checked).map(el => el.value);
|
||||
|
||||
if(checked.length == 0) {
|
||||
alert("임가를 선택해주세요.");
|
||||
return;
|
||||
}
|
||||
|
||||
ajaxUtil._ajaxMethod(
|
||||
'/api/household/researcherMapping/create',
|
||||
JSON.stringify({
|
||||
adminSeq: data.adminSeq,
|
||||
householdSeqs: householdSeqs
|
||||
}),
|
||||
() => { // 성공
|
||||
alert("등록이 완료되었습니다.");
|
||||
closeModal();
|
||||
|
||||
// 새로고침이 버벅거려서 일단 setTimeout 처리..
|
||||
setTimeout(() => {
|
||||
location.reload();
|
||||
}, 200);
|
||||
},
|
||||
function (code, rstData) {
|
||||
if(code == 422) alert(rstData.responseText);
|
||||
if(code == 400) alert(rstData.responseJSON.message); //임가번호 중복체크
|
||||
},
|
||||
'post',
|
||||
'json',
|
||||
{ handle422Type: 'alert' }
|
||||
);
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
// 체크박스 전체 선택
|
||||
document.getElementById('checkedAll').addEventListener('change', function () {
|
||||
const isChecked = this.checked;
|
||||
const checkboxes = document.querySelectorAll('input[name="chkBox"]');
|
||||
|
||||
checkboxes.forEach(cb => {
|
||||
cb.checked = isChecked;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</section>
|
||||
|
||||
</html>
|
||||
@@ -201,7 +201,7 @@
|
||||
<div class="d-flex">
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input type="text" name="researcherSeq" id="researcherSeq" placeholder="">
|
||||
<input type="text" name="researcherName" id="researcherName" placeholder="">
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" class="btn" onclick="showResearcherModal();">
|
||||
@@ -306,7 +306,8 @@
|
||||
'/api/household/households/create',
|
||||
JSON.stringify(dataOj),
|
||||
function(response) { // 성공
|
||||
console.log("임가저장 결과 : ", response);
|
||||
alert("등록이 완료되었습니다.");
|
||||
location.href = '/household/households';
|
||||
},
|
||||
function (code, rstData) {
|
||||
if(code == 422) alert(rstData.responseText);
|
||||
@@ -319,6 +320,28 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
// 조사원 매핑 팝업의 선택된 조사원 가져오기.
|
||||
const getSelectedResearcher = (data, closeModal) => {
|
||||
document.getElementById('researcherName').value = `${data.name}`;
|
||||
|
||||
const form = document.reqForm;
|
||||
let input = form.querySelector('input[name="adminSeq"]');
|
||||
|
||||
if (!input) {
|
||||
input = document.createElement('input');
|
||||
input.type = 'hidden';
|
||||
input.name = 'adminSeq';
|
||||
form.appendChild(input);
|
||||
}
|
||||
|
||||
// adminSeq 값 세팅
|
||||
input.value = data.adminSeq;
|
||||
|
||||
closeModal();
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
// 휴대폰번호 길이 체크
|
||||
const numberMaxLengthChk = (el, number) => {
|
||||
|
||||
@@ -741,7 +741,6 @@
|
||||
return;
|
||||
}
|
||||
|
||||
const f = document.reqForm;
|
||||
const listArea = $('.tab-content .daily-record-list');
|
||||
const detailArea = $('.tab-content .daily-record-detail');
|
||||
|
||||
@@ -792,11 +791,11 @@
|
||||
</div>
|
||||
</td>
|
||||
<td>${item.isCredit ? "Y" : "N"}</td> <!-- 외상판매 -->
|
||||
<td>${ifNullDash(item.cropText)}</td><!-- 재배형태 -->
|
||||
<td class="underline">${ifNullDash(item.categorySelf)}</td><!-- 수입의 종류 -->
|
||||
<td>${ifNullDash(item.sourcePurpose)}</td><!-- 수입원 -->
|
||||
<td class="align-right">${ifNullDash(item.quantity)}</td><!-- 수량 -->
|
||||
<td>${item.unitSelf != null && item.unitSelf !== '' ? item.unitSelf : ifNullDash(item.unitText)}</td><!-- 단위 -->
|
||||
<td>${ifNullHyphen(item.cropText)}</td><!-- 재배형태 -->
|
||||
<td class="underline">${ifNullHyphen(item.categorySelf)}</td><!-- 수입의 종류 -->
|
||||
<td>${ifNullHyphen(item.sourcePurpose)}</td><!-- 수입원 -->
|
||||
<td class="align-right">${ifNullHyphen(item.quantity)}</td><!-- 수량 -->
|
||||
<td>${item.unitSelf != null && item.unitSelf !== '' ? item.unitSelf : ifNullHyphen(item.unitText)}</td><!-- 단위 -->
|
||||
<td class="align-right">${formatNumberWithComma(item.price)}</td><!-- 현금(원) -->
|
||||
<td class="align-right">${formatNumberWithComma(item.estimatedValue)}</td><!-- 현물평가액 -->
|
||||
<td>
|
||||
@@ -833,21 +832,21 @@
|
||||
</label>
|
||||
</div>
|
||||
</td>
|
||||
<td class="underline">${ifNullDash(item.itemCode)}</td><!-- 품목명 -->
|
||||
<td>${ifNullDash(item.workCode)}</td><!-- 작업명 -->
|
||||
<td class="align-right">${ifNullDash(item.workLandArea)}</td><!-- 작업 면적 -->
|
||||
<td>${ifNullDash(item.harvestQuantity)}</td><!-- 수확량 -->
|
||||
<td>${ifNullDash(item.cropText)}</td><!-- 단위 -->
|
||||
<td>${ifNullDash(item.ownerTime)}</td><!-- 경영주 시간 -->
|
||||
<td>${ifNullDash(item.spouseTime)}</td><!-- 배우자 시간 -->
|
||||
<td>${ifNullDash(item.familyMHours)}</td><!-- 가족노동(남) -->
|
||||
<td>${ifNullDash(item.familyFHours)}</td><!-- 가족노동(여) -->
|
||||
<td>${ifNullDash(item.hiredMHours)}</td><!-- 고용노동(남) -->
|
||||
<td>${ifNullDash(item.hiredFHours)}</td><!-- 고용노동(여) -->
|
||||
<td>${ifNullDash(item.sharedMHours)}</td><!-- 품앗이(남) -->
|
||||
<td>${ifNullDash(item.sharedFHours)}</td><!-- 품앗이(여) -->
|
||||
<td>${ifNullDash(item.volunteerMHours)}</td><!-- 일손돕기(남) -->
|
||||
<td>${ifNullDash(item.volunteerFHours)}</td><!-- 일손돕기(여) -->
|
||||
<td class="underline">${ifNullHyphen(item.itemCode)}</td><!-- 품목명 -->
|
||||
<td>${ifNullHyphen(item.workCode)}</td><!-- 작업명 -->
|
||||
<td class="align-right">${ifNullHyphen(item.workLandArea)}</td><!-- 작업 면적 -->
|
||||
<td>${ifNullHyphen(item.harvestQuantity)}</td><!-- 수확량 -->
|
||||
<td>${ifNullHyphen(item.cropText)}</td><!-- 단위 -->
|
||||
<td>${ifNullHyphen(item.ownerTime)}</td><!-- 경영주 시간 -->
|
||||
<td>${ifNullHyphen(item.spouseTime)}</td><!-- 배우자 시간 -->
|
||||
<td>${ifNullHyphen(item.familyMHours)}</td><!-- 가족노동(남) -->
|
||||
<td>${ifNullHyphen(item.familyFHours)}</td><!-- 가족노동(여) -->
|
||||
<td>${ifNullHyphen(item.hiredMHours)}</td><!-- 고용노동(남) -->
|
||||
<td>${ifNullHyphen(item.hiredFHours)}</td><!-- 고용노동(여) -->
|
||||
<td>${ifNullHyphen(item.sharedMHours)}</td><!-- 품앗이(남) -->
|
||||
<td>${ifNullHyphen(item.sharedFHours)}</td><!-- 품앗이(여) -->
|
||||
<td>${ifNullHyphen(item.volunteerMHours)}</td><!-- 일손돕기(남) -->
|
||||
<td>${ifNullHyphen(item.volunteerFHours)}</td><!-- 일손돕기(여) -->
|
||||
<td>
|
||||
${item.updatedBy}<br>
|
||||
(${item.updatedAt})
|
||||
@@ -883,10 +882,10 @@
|
||||
</div>
|
||||
</td>
|
||||
<td>${item.isCredit ? "Y" : "N"}</td> <!-- 외상 또는 카드구입 -->
|
||||
<td class="underline">${ifNullDash(item.categorySelf)}</td><!-- 지출의 종류 -->
|
||||
<td>${ifNullDash(item.sourcePurpose)}</td><!-- 용도 -->
|
||||
<td>${ifNullDash(item.quantity)}</td><!-- 수량 -->
|
||||
<td>${item.unitSelf != null && item.unitSelf !== '' ? item.unitSelf : ifNullDash(item.unitText)}</td><!-- 단위 -->
|
||||
<td class="underline">${ifNullHyphen(item.categorySelf)}</td><!-- 지출의 종류 -->
|
||||
<td>${ifNullHyphen(item.sourcePurpose)}</td><!-- 용도 -->
|
||||
<td>${ifNullHyphen(item.quantity)}</td><!-- 수량 -->
|
||||
<td>${item.unitSelf != null && item.unitSelf !== '' ? item.unitSelf : ifNullHyphen(item.unitText)}</td><!-- 단위 -->
|
||||
<td class="align-right">${formatNumberWithComma(item.price)}</td><!-- 현금(원) -->
|
||||
<td class="align-right">${formatNumberWithComma(item.estimatedValue)}</td><!-- 현물평가액 -->
|
||||
<td>
|
||||
@@ -923,9 +922,9 @@
|
||||
</label>
|
||||
</div>
|
||||
</td>
|
||||
<td class="underline">${ifNullDash(item.equipmentName)}</td> <!-- 명칭 -->
|
||||
<td>${ifNullDash(item.ownedHours)}</td><!-- 자가 사용시간 -->
|
||||
<td>${ifNullDash(item.leasedHours)}</td><!-- 임가 사용시간 -->
|
||||
<td class="underline">${ifNullHyphen(item.equipmentName)}</td> <!-- 명칭 -->
|
||||
<td>${ifNullHyphen(item.ownedHours)}</td><!-- 자가 사용시간 -->
|
||||
<td>${ifNullHyphen(item.leasedHours)}</td><!-- 임가 사용시간 -->
|
||||
<td>
|
||||
${item.updatedBy}<br>
|
||||
(${item.updatedAt})
|
||||
@@ -960,10 +959,10 @@
|
||||
</label>
|
||||
</div>
|
||||
</td>
|
||||
<td class="underline">${ifNullDash(item.productName)}</td> <!-- 생산물 -->
|
||||
<td>${ifNullDash(item.usage)}</td><!-- 용도 -->
|
||||
<td class="align-right">${ifNullDash(item.quantity)}</td><!-- 수량 -->
|
||||
<td>${ifNullDash(item.unitText)}</td><!-- 단위 -->
|
||||
<td class="underline">${ifNullHyphen(item.productName)}</td> <!-- 생산물 -->
|
||||
<td>${ifNullHyphen(item.usage)}</td><!-- 용도 -->
|
||||
<td class="align-right">${ifNullHyphen(item.quantity)}</td><!-- 수량 -->
|
||||
<td>${ifNullHyphen(item.unitText)}</td><!-- 단위 -->
|
||||
<td class="align-right">${formatNumberWithComma(item.estimatedValue)}</td><!-- 현물평가액 -->
|
||||
<td>
|
||||
${item.updatedBy}<br>
|
||||
@@ -999,10 +998,10 @@
|
||||
</label>
|
||||
</div>
|
||||
</td>
|
||||
<td class="underline">${ifNullDash(item.productName)}</td> <!-- 생산물 -->
|
||||
<td>${ifNullDash(item.usage)}</td><!-- 용도 -->
|
||||
<td class="align-right">${ifNullDash(item.quantity)}</td><!-- 수량 -->
|
||||
<td>${ifNullDash(item.unitText)}</td><!-- 단위 -->
|
||||
<td class="underline">${ifNullHyphen(item.productName)}</td> <!-- 생산물 -->
|
||||
<td>${ifNullHyphen(item.usage)}</td><!-- 용도 -->
|
||||
<td class="align-right">${ifNullHyphen(item.quantity)}</td><!-- 수량 -->
|
||||
<td>${ifNullHyphen(item.unitText)}</td><!-- 단위 -->
|
||||
<td class="align-right">${formatNumberWithComma(item.estimatedValue)}</td><!-- 현물평가액 -->
|
||||
<td>
|
||||
${item.updatedBy}<br>
|
||||
@@ -1050,20 +1049,20 @@
|
||||
</label>
|
||||
</div>
|
||||
</td>
|
||||
<td>${ifNullDash(item.streetNum)}</td> <!-- 지번 -->
|
||||
<td>${ifNullDash(item.landType)}</td><!-- 지목 -->
|
||||
<td>${ifNullDash(item.town)}</td><!-- 읍면동 -->
|
||||
<td>${ifNullDash(item.availableArea)}</td><!-- 가능면적(평) -->
|
||||
<td>${ifNullDash(item.cropName)}</td><!-- 재배작물명 -->
|
||||
<td>${ifNullDash(item.landArea)}</td><!-- 면적(평) -->
|
||||
<td class="align-right">${ifNullDash(item.mainYield)}</td><!-- 주생산물 수확량 -->
|
||||
<td>${ifNullDash(item.mainYieldText)}</td><!-- 주생산물 수확량 단위 -->
|
||||
<td class="align-right">${ifNullDash(item.mainSaleAmount)}</td><!-- 주생산물 판매량 -->
|
||||
<td>${ifNullDash(item.mainSaleAmountText)}</td><!-- 주생산물 판매량 단위 -->
|
||||
<td class="align-right">${ifNullDash(item.subYield)}</td><!-- 부생산물 수확량 -->
|
||||
<td>${ifNullDash(item.subYieldText)}</td><!-- 부생산물 수확량 단위 -->
|
||||
<td class="align-right">${ifNullDash(item.subSaleAmount)}</td><!-- 부생산물 판매량 -->
|
||||
<td>${ifNullDash(item.subSaleAmountText)}</td><!-- 부생산물 판매량 단위 -->
|
||||
<td>${ifNullHyphen(item.streetNum)}</td> <!-- 지번 -->
|
||||
<td>${ifNullHyphen(item.landType)}</td><!-- 지목 -->
|
||||
<td>${ifNullHyphen(item.town)}</td><!-- 읍면동 -->
|
||||
<td>${ifNullHyphen(item.availableArea)}</td><!-- 가능면적(평) -->
|
||||
<td>${ifNullHyphen(item.cropName)}</td><!-- 재배작물명 -->
|
||||
<td>${ifNullHyphen(item.landArea)}</td><!-- 면적(평) -->
|
||||
<td class="align-right">${ifNullHyphen(item.mainYield)}</td><!-- 주생산물 수확량 -->
|
||||
<td>${ifNullHyphen(item.mainYieldUnitText)}</td><!-- 주생산물 수확량 단위 -->
|
||||
<td class="align-right">${ifNullHyphen(item.mainSaleAmount)}</td><!-- 주생산물 판매량 -->
|
||||
<td>${ifNullHyphen(item.mainSaleAmountUnitText)}</td><!-- 주생산물 판매량 단위 -->
|
||||
<td class="align-right">${ifNullHyphen(item.subYield)}</td><!-- 부생산물 수확량 -->
|
||||
<td>${ifNullHyphen(item.subYieldUnitText)}</td><!-- 부생산물 수확량 단위 -->
|
||||
<td class="align-right">${ifNullHyphen(item.subSaleAmount)}</td><!-- 부생산물 판매량 -->
|
||||
<td>${ifNullHyphen(item.subSaleAmountUnitText)}</td><!-- 부생산물 판매량 단위 -->
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
@@ -1097,7 +1096,7 @@
|
||||
tbody.empty();
|
||||
|
||||
if(response.length === 0) {
|
||||
tbody.append(`<tr><td colspan="6" style="text-align: center;">등록된 내용이 없습니다.</td></tr>`);
|
||||
tbody.append(`<tr><td colspan="6" style="text-align: center;">등록이 필요합니다.</td></tr>`);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1113,9 +1112,9 @@
|
||||
</label>
|
||||
</div>
|
||||
</td>
|
||||
<td>${ifNullDash(item.visitDate)}</td> <!-- 방문일 -->
|
||||
<td>${ifNullDash(managementType[item.managementType])}</td> <!-- 관리분야 -->
|
||||
<td>${ifNullDash(item.content)}</td> <!-- 내용 -->
|
||||
<td>${ifNullHyphen(item.visitDate)}</td> <!-- 방문일 -->
|
||||
<td>${ifNullHyphen(managementType[item.managementType])}</td> <!-- 관리분야 -->
|
||||
<td>${ifNullHyphen(item.content)}</td> <!-- 내용 -->
|
||||
<td>
|
||||
${item.updatedBy}<br>
|
||||
(${item.updatedAt})
|
||||
@@ -1182,12 +1181,12 @@
|
||||
</label>
|
||||
</div>
|
||||
</td>
|
||||
<td>${ifNullDash(item.cropText)}</td> <!-- 재배형태 -->
|
||||
<td class="underline">${ifNullDash(item.categoryText)}</td> <!-- 수입의 종류 -->
|
||||
<td>${ifNullDash(item.categorySelf)}</td><!-- 대상 -->
|
||||
<td>${ifNullDash(item.sourcePurpose)}</td><!-- 수입원 -->
|
||||
<td>${ifNullDash(item.count)}</td><!-- 수량 -->
|
||||
<td>${ifNullDash(item.unitText)}</td><!-- 단위 -->
|
||||
<td>${ifNullHyphen(item.cropText)}</td> <!-- 재배형태 -->
|
||||
<td class="underline">${ifNullHyphen(item.categoryText)}</td> <!-- 수입의 종류 -->
|
||||
<td>${ifNullHyphen(item.target)}</td><!-- 대상 -->
|
||||
<td>${ifNullHyphen(item.sourcePurpose)}</td><!-- 수입원 -->
|
||||
<td>${ifNullHyphen(item.count)}</td><!-- 수량 -->
|
||||
<td>${ifNullHyphen(item.unitText)}</td><!-- 단위 -->
|
||||
<td class="align-right">${formatNumberWithComma(item.price)}</td><!-- 현금(원) -->
|
||||
</tr>
|
||||
`;
|
||||
@@ -1218,11 +1217,10 @@
|
||||
</label>
|
||||
</div>
|
||||
</td>
|
||||
<td class="underline">${item.categorySelf != null && item.categorySelf !== '' ?
|
||||
item.categorySelf : ifNullDash(item.categoryText)}</td> <!-- 지출의 종류 -->
|
||||
<td>${ifNullDash(item.sourcePurpose)}</td><!-- 용도 -->
|
||||
<td>${ifNullDash(item.count)}</td><!-- 수량 -->
|
||||
<td>${ifNullDash(item.unitText)}</td><!-- 단위 -->
|
||||
<td class="underline">${ifNullHyphen(item.categoryText)}</td> <!-- 지출의 종류 -->
|
||||
<td>${ifNullHyphen(item.sourcePurpose)}</td><!-- 용도 -->
|
||||
<td>${ifNullHyphen(item.count)}</td><!-- 수량 -->
|
||||
<td>${ifNullHyphen(item.unitText)}</td><!-- 단위 -->
|
||||
<td class="align-right">${formatNumberWithComma(item.price)}</td><!-- 현금(원) -->
|
||||
</tr>
|
||||
`;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
DROP VIEW v_uicode_view_name;
|
||||
DROP VIEW v_household_with_code;
|
||||
DROP VIEW v_household_researcher;
|
||||
DROP VIEW v_household_visit;
|
||||
|
||||
|
||||
-- CREATE VIEW
|
||||
@@ -62,7 +63,7 @@ SELECT
|
||||
MIN(v.visit_date) AS first_visit_date,
|
||||
MAX(v.visit_date) AS second_visit_date,
|
||||
BOOL_OR(v.is_gift_sent) AS is_gift_sent
|
||||
FROM researcher_household_visit v
|
||||
FROM household_visit v
|
||||
JOIN researcher_has_household rhh ON v.household_seq = rhh.household_seq
|
||||
WHERE rhh.is_deleted = false
|
||||
GROUP BY rhh.household_seq;
|
||||
|
||||
Reference in New Issue
Block a user