提交zh修改问题

yun-zuoyi
wynne1005 5 years ago
parent 6f375edf9a
commit 878acb869f

@ -243,6 +243,9 @@ public interface BaseRepository <T, ID extends Serializable> extends JpaReposito
T getByProperty(String[] propertyNames, Object[] values); T getByProperty(String[] propertyNames, Object[] values);
@Deprecated
T getByPropertyPager(String[] propertyNames, Object[] values,Pager pager);
int listCount(); int listCount();
int findByPropertyCount(String propertyName, Object value); int findByPropertyCount(String propertyName, Object value);

@ -46,6 +46,8 @@ public class BaseRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRep
private Class<T> persistentClass; private Class<T> persistentClass;
private SnowflakeIdMaker snowflakeIdMaker; private SnowflakeIdMaker snowflakeIdMaker;
/* 默认查询数据条数 */
private static final Pager DEFAULT_PAGER = new Pager(10,10);
public BaseRepositoryImpl(Class<T> clz, EntityManager em, SnowflakeIdMaker snowflakeIdMaker) { public BaseRepositoryImpl(Class<T> clz, EntityManager em, SnowflakeIdMaker snowflakeIdMaker) {
super(clz, em); super(clz, em);
@ -506,10 +508,9 @@ public class BaseRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRep
@Override @Override
public T getByProperty(DdlPackBean packBean) { public T getByProperty(DdlPackBean packBean) {
try { try {
List<T> list = findByHqlWhere(packBean); List<T> list = findByHqlWherePage(packBean,DEFAULT_PAGER);
return list.size() != 0 ? list.get(0) : null; return list != null && list.size() != 0 ? list.get(0) : null;
}catch(NoResultException ne){ }catch(NoResultException ne){
LOGGER.error("数据不存在DdlPackBean{}",packBean); LOGGER.error("数据不存在DdlPackBean{}",packBean);
return null; return null;
@ -521,21 +522,18 @@ public class BaseRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRep
@Override @Override
public T getByProperty(String propertyName, Object value) { public T getByProperty(String propertyName, Object value) {
String queryString = "from " + persistentClass.getSimpleName() + " as model where model." + propertyName + "= :" + propertyName; return getByPropertyPager(new String[]{propertyName}, new Object[]{value}, DEFAULT_PAGER);
try {
List<T> list = entityManager.createQuery(queryString).setParameter(propertyName, value).getResultList();
return list.size() != 0 ? list.get(0) : null;
}catch(NoResultException ne){
LOGGER.error("数据不存在prop{},value{}",propertyName,value,ne);
return null;
}catch(NonUniqueResultException ex){
LOGGER.error("查询单条记录但出现多条。prop{},value{}",propertyName,value,ex);
throw new RuntimeException("存在多条记录:" + ex.getMessage());
}
} }
@Override @Override
public T getByProperty(String[] propertyNames, Object[] values) { public T getByProperty(String[] propertyNames, Object[] values) {
return getByPropertyPager(propertyNames, values, DEFAULT_PAGER);
}
@Override
public T getByPropertyPager(String[] propertyNames, Object[] values, Pager pager) {
pager = pager == null ? DEFAULT_PAGER: pager;
if(propertyNames.length != values.length){ if(propertyNames.length != values.length){
throw new IllegalArgumentException("参数名的数量和参数值不匹配!propertyNames:" + propertyNames.length + ",values:" + values.length); throw new IllegalArgumentException("参数名的数量和参数值不匹配!propertyNames:" + propertyNames.length + ",values:" + values.length);
} }
@ -561,7 +559,10 @@ public class BaseRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRep
} }
try{ try{
List<T> list = queryObject.getResultList(); List<T> list = queryObject
.setFirstResult(pager.getStartRow())
.setMaxResults(pager.getPageSize())
.getResultList();
return list.size() != 0 ? list.get(0) : null; return list.size() != 0 ? list.get(0) : null;
}catch(NoResultException ne){ }catch(NoResultException ne){
LOGGER.error("数据不存在",ne); LOGGER.error("数据不存在",ne);

@ -100,9 +100,9 @@ public class IfPackageDetail extends BaseBean implements Serializable {
@ApiParam("容器编号") @ApiParam("容器编号")
private String ctNo; private String ctNo;
@Column(name = "SN_TYPE") @Column(name = "SAMPLE_TYPE")
@ApiParam("条码类型") @ApiParam("条码类型")
private String snType; private String sampleType;
@Column(name = "CUST_DELIVERY_LOCATION") @Column(name = "CUST_DELIVERY_LOCATION")
@ApiParam("客户发往地") @ApiParam("客户发往地")

@ -112,7 +112,7 @@ public class MesPackage extends BaseBean implements Serializable {
@Column(name = "SAMPLE_TYPE") @Column(name = "SAMPLE_TYPE")
@ApiParam("条码类型") @ApiParam("条码类型")
private String sampleType; private String sampleType = "10";
@Transient @Transient
@ApiParam("客户发往地") @ApiParam("客户发往地")

@ -0,0 +1,44 @@
package cn.estsh.i3plus.pojo.mes.bean;
import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
/**
* @Author: Wynne.Lu
* @CreateDate: 2019/7/30 9:30 AM
* @Description:
**/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "MES_PART_SAMPLE")
@Api("产品样本配置")
public class MesPartSample extends BaseBean implements Serializable {
private static final long serialVersionUID = -9190123981329081945L;
@Column(name = "WORK_CENTER_CODE")
@ApiParam("工作中心代码")
private String workCenterCode;
@Column(name = "PART_NO")
@ApiParam("物料号")
private String partNo;
@Column(name = "QTY")
@ApiParam("数量")
private Double qty;
}

@ -24,7 +24,7 @@ import java.io.Serializable;
@DynamicUpdate @DynamicUpdate
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@Table(name = "MES_SUB_PART") @Table(name = "MES_SUB_PART")
@Api("数据同步死信") @Api("替代料")
public class MesSubPart extends BaseBean implements Serializable { public class MesSubPart extends BaseBean implements Serializable {
private static final long serialVersionUID = 4636507477301700549L; private static final long serialVersionUID = 4636507477301700549L;

@ -50,6 +50,13 @@ public class ButtonDynamicModel {
this.paramCode = paramCode; this.paramCode = paramCode;
} }
public ButtonDynamicModel(String buttonCode, String buttonName, String paramCode, String paramValue) {
this.buttonCode = buttonCode;
this.buttonName = buttonName;
this.paramCode = paramCode;
this.paramValue = paramValue;
}
public ButtonDynamicModel(Long id, String buttonCode, String windowNo, String windowModuleBack, String paramCode, String paramValue) { public ButtonDynamicModel(Long id, String buttonCode, String windowNo, String windowModuleBack, String paramCode, String paramValue) {
this.id = id; this.id = id;
this.buttonCode = buttonCode; this.buttonCode = buttonCode;

@ -0,0 +1,49 @@
package cn.estsh.i3plus.pojo.mes.model;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Map;
/**
* @author Wynne.Lu
* @date 2020/6/16 14:21
* @desc
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Api("打包样本")
public class PackageSampleModel {
@ApiParam(name = "已打包数量")
private Double alreadyPackageCount;
@ApiParam(name = "标准打包数量")
private Double standardPackageCount;
@ApiParam(name = "样本类型")
private Map<String, String> sampleTypeMap;
@ApiParam(name = "样本类型代码")
private String lastSampleTypeCode;
@ApiParam(name = "选择的样本类型")
private String chooseSampleTypeCode;
@ApiParam(name = "强制执行工步")
private String forceStepCode;
@ApiParam(name = "强制打包密码")
private String password;
@ApiParam(name = "工厂")
private String organizeCode;
@ApiParam(name = "工单号")
private String workOrderNo;
}

@ -0,0 +1,17 @@
package cn.estsh.i3plus.pojo.mes.repository;
import cn.estsh.i3plus.pojo.base.jpa.dao.BaseRepository;
import cn.estsh.i3plus.pojo.mes.bean.MesPartSample;
import org.springframework.stereotype.Repository;
/**
* @Description :
* @Reference :
* @Author : jack.jia
* @CreateDate : 2019-04-02
* @Modify:
**/
@Repository
public interface MesPartSampleRepository extends BaseRepository<MesPartSample, Long> {
}
Loading…
Cancel
Save