查询质检项

This commit is contained in:
liuchengqian 2022-03-11 11:55:54 +08:00
parent 1fa0f9cffb
commit 3a6b7aaec4
7 changed files with 45 additions and 10 deletions

View File

@ -26,6 +26,6 @@ public interface QcItemDao extends JpaRepository<QcItemEntity, Integer>, JpaSpec
/**
* 查询质检项
*/
@Query(value = "SELECT id, no, name, type FROM qc_item ORDER BY create_time ASC", nativeQuery = true)
@Query(value = "SELECT id, no, name, type FROM qc_item WHERE no = ?1 AND name = ?2 ORDER BY create_time ASC", nativeQuery = true)
List<Map<String, Object>> queryQcItem(String no, String name);
}

View File

@ -3,8 +3,16 @@ package com.xkrs.newpro.dao;
import com.xkrs.newpro.model.entity.QcSourceEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
@Component
public interface QcSourceDao extends JpaRepository<QcSourceEntity, Integer>, JpaSpecificationExecutor<QcSourceEntity> {
@Query(value = "SELECT id, batch_no AS batchNo, machine_no AS machineNo, material_no AS materialNo, mould_no AS mouldNo, variety_no AS varietyNo, qc_item_no AS qcItemNo, qc_value AS qcValue FROM qc_source WHERE batch_no = ?1 AND machine_no = ?2 AND material_no = ?3 AND mould_no = ?4 AND variety_no = ?5 ORDER BY create_time DESC", nativeQuery = true)
List<Map<String, Object>> queryQcSource(String batchNo, String machineNo, String materialNo, String mouldNo, String varietyNo);
}

View File

@ -7,6 +7,8 @@ import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@Component
@ -21,4 +23,9 @@ public interface QcSpecDao extends JpaRepository<QcSpecEntity, Integer>, JpaSpec
@Query(value = "UPDATE qc_spec SET update_time = ?2, max = ?3, mean = ?4, min = ?5, unit = ?6, method = ?7, standard = ?8, remark = ?9 WHERE id = ?1", nativeQuery = true)
void updateQcSpecById(Integer id, String updateTime, String max, String mean, String min, String unit, String method, String standard, String remark);
/**
* 查询质检规格
*/
@Query(value = "SELECT id, variety_no AS varietyNo, qc_item_no AS qcItemNo, max, mean, min, unit, method, standard, remark FROM qc_spec WHERE variety_no = ? AND qc_item_no = ? ORDER BY create_time ASC", nativeQuery = true)
List<Map<String, Object>> queryQcSpec(String varietyNo, String qcItemNo);
}

View File

@ -7,17 +7,17 @@ import com.xkrs.newpro.model.qo.QcItemQoUpdate;
public interface QcItemService {
/**
* 添加检项
* 添加
*/
String insertQcItem(QcItemQoInsert insertQo);
/**
* 更新检项名称
* 更新名称
*/
String updateQcItem(QcItemQoUpdate updateQo);
/**
* 查询检项
* 查询
*/
String queryQcItem(QcItemQoQuery queryQo);

View File

@ -8,6 +8,7 @@ import com.xkrs.newpro.model.qo.QcItemQoQuery;
import com.xkrs.newpro.model.qo.QcItemQoUpdate;
import com.xkrs.newpro.service.QcItemService;
import com.xkrs.newpro.utils.LocalDateUtils;
import com.xkrs.newpro.utils.LocalStringUtils;
import org.springframework.context.i18n.LocaleContextHolder;
import javax.annotation.Resource;
@ -27,7 +28,7 @@ public class QcItemServiceImpl implements QcItemService {
private QcItemDao qcItemDao;
/**
* 添加检项
* 添加
*/
@Override
public String insertQcItem(QcItemQoInsert insertQo) {
@ -53,7 +54,7 @@ public class QcItemServiceImpl implements QcItemService {
}
/**
* 更新检项名称
* 更新名称
*/
@Transactional(rollbackOn = Exception.class)
@Override
@ -73,16 +74,16 @@ public class QcItemServiceImpl implements QcItemService {
}
/**
* 查询检项
* 查询
*/
@Override
public String queryQcItem(QcItemQoQuery queryQo) {
String no = queryQo.getNo();
String name = queryQo.getName();
List<Map<String, Object>> resultList = qcItemDao.queryQcItem(no, name);
List<Map<String, Object>> resultList = qcItemDao.queryQcItem(LocalStringUtils.formatEmptyValue(no), LocalStringUtils.formatEmptyValue(name));
if (resultList == null || resultList.isEmpty()) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该检项的信息!", locale);
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该的信息!", locale);
}
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, resultList, locale);
}

View File

@ -7,6 +7,7 @@ import com.xkrs.newpro.model.qo.QcSourceQoInsert;
import com.xkrs.newpro.model.qo.QcSourceQoQuery;
import com.xkrs.newpro.service.QcSourceService;
import com.xkrs.newpro.utils.LocalDateUtils;
import com.xkrs.newpro.utils.LocalStringUtils;
import org.springframework.context.i18n.LocaleContextHolder;
import javax.annotation.Resource;
@ -54,6 +55,15 @@ public class QcSourceServiceImpl implements QcSourceService {
*/
@Override
public String queryQcSource(QcSourceQoQuery queryQo) {
String batchNo = queryQo.getBatchNo();
String machineNo = queryQo.getMachineNo();
String materialNo = queryQo.getMaterialNo();
String mouldNo = queryQo.getMouldNo();
String varietyNo = queryQo.getVarietyNo();
qcSourceDao.queryQcSource(LocalStringUtils.formatEmptyValue(batchNo), LocalStringUtils.formatEmptyValue(machineNo), LocalStringUtils.formatEmptyValue(materialNo), LocalStringUtils.formatEmptyValue(mouldNo), LocalStringUtils.formatEmptyValue(varietyNo));
return null;
}
}

View File

@ -14,7 +14,9 @@ import com.xkrs.newpro.utils.LocalStringUtils;
import org.springframework.context.i18n.LocaleContextHolder;
import javax.annotation.Resource;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Optional;
import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject;
@ -109,6 +111,13 @@ public class QcSpecServiceImpl implements QcSpecService {
*/
@Override
public String queryQcSpec(QcSpecQoQuery queryQo) {
return null;
String varietyNo = queryQo.getVarietyNo();
String qcItemNo = queryQo.getQcItemNo();
List<Map<String, Object>> resultList = qcSpecDao.queryQcSpec(LocalStringUtils.formatEmptyValue(varietyNo), LocalStringUtils.formatEmptyValue(qcItemNo));
if (resultList == null || resultList.isEmpty()) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该检验规格的信息!", locale);
}
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, resultList, locale);
}
}