jimmy 7 years ago
commit e95c145bc5

@ -26,69 +26,70 @@ import java.io.Serializable;
@JsonInclude(value = JsonInclude.Include.NON_EMPTY) //""或null属性不参加序列转换
public abstract class BaseBean implements Serializable {
private static final long serialVersionUID = 1L;
//此处使用hibernate的主键策略方式
//手动设置,使用iplus-platform-common中的idtool生成
@Id
@GeneratedValue(generator = "IDGenerator")
@GenericGenerator(name = "IDGenerator", strategy = "assigned")
@Column(name="id")
@ApiParam(value = "主键",example = "0")
//将Long类型系列化成String避免精度丢失
@JsonSerialize(using = ToStringSerializer.class)
public Long id;
//get单独处理
public Long getId() {
if(id != null) {
return id.longValue();
}else{
return id;
}
private static final long serialVersionUID = 1L;
//此处使用hibernate的主键策略方式
//手动设置,使用iplus-platform-common中的idtool生成
//将Long类型系列化成String避免精度丢失
@Id
@GeneratedValue(generator = "IDGenerator")
@GenericGenerator(name = "IDGenerator", strategy = "assigned")
@Column(name="id")
@ApiParam(value = "主键",example = "0")
@JsonSerialize(using = ToStringSerializer.class)
public Long id;
//get单独处理
public Long getId() {
if(id != null) {
return id.longValue();
}else{
return id;
}
}
@Column(name="factory_code")
@ApiParam(value = "工厂代码")
public String factoryCode;
@Column(name="factory_code")
@ApiParam(value = "工厂代码")
public String factoryCode;
@Column(name="is_valid")
@ApiParam(value = "有效性",example = "1")
public Integer isValid; //EnumUtil.isValid;
@Column(name="is_valid")
@ApiParam(value = "有效性",example = "1")
public Integer isValid; //EnumUtil.isValid;
@Column(name="create_user")
@ApiParam(value = "创建日期")
public String createUser;
@Column(name="create_user")
@ApiParam(value = "创建日期")
public String createUser;
@Column(name="create_date")
@ApiParam(value = "创建日期")
public String createDatetime;
@Column(name="create_date")
@ApiParam(value = "创建日期")
public String createDatetime;
@Column(name="modify_user")
@ApiParam(value = "修改人")
public String modifyUser;
@Column(name="modify_user")
@ApiParam(value = "修改人")
public String modifyUser;
@Column(name="modify_date")
@ApiParam(value = "修改日期")
public String modifyDatetime;
@Column(name="modify_date")
@ApiParam(value = "修改日期")
public String modifyDatetime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiParam(value="创建日期查询用,查询起始日期",example = "2000-01-01 01:00:00")
public transient String createDateTimeStart;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiParam(value="创建日期查询用,查询起始日期",example = "2000-01-01 01:00:00")
public transient String createDateTimeStart;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiParam(value="创建日期查询用,查询结束日期",example = "2000-01-01 01:00:00")
public transient String createDateTimeEnd;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiParam(value="创建日期查询用,查询结束日期",example = "2000-01-01 01:00:00")
public transient String createDateTimeEnd;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiParam(value="修改日期查询用,查询起始日期",example = "用于前台查询")
public transient String modifyDateTimeStart;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiParam(value="修改日期查询用,查询起始日期",example = "用于前台查询")
public transient String modifyDateTimeStart;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiParam(value = "修改日期查询用,查询结束日期",example = "用于前台查询")
public transient String modifyDateTimeEnd;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiParam(value = "修改日期查询用,查询结束日期",example = "用于前台查询")
public transient String modifyDateTimeEnd;
@ApiParam(value = "排序属性")
public transient String orderByParam;
@ApiParam(value = "排序属性")
public transient String orderByParam;
@ApiParam(value = "排序属性",example = "1")
//CommonEnumUtil.ASC_OR_DESC 1 asc,2 desc

@ -80,7 +80,7 @@ public interface BaseRepository <T, ID extends Serializable> extends JpaReposito
* in
* @param ids
*/
public void deleteByIdIn(long[] ids);
public void deleteByIds(long[] ids);
/**
*

@ -65,12 +65,12 @@ public class BaseRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRep
if (((value instanceof Object[])) || ((value instanceof Collection))) {
Object[] arraySerializable = (Object[]) value;
if ((arraySerializable != null) && (arraySerializable.length > 0)) {
sb.append(" and o." + name + " in (:" + name.replace(".", "") + ")");
sb.append(" and model." + name + " in (:" + name.replace(".", "") + ")");
}
} else if (value == null) {
sb.append(" and o." + name + " is null ");
sb.append(" and model." + name + " is null ");
} else {
sb.append(" and o." + name + "=:" + name.replace(".", ""));
sb.append(" and model." + name + "=:" + name.replace(".", ""));
}
}
}
@ -132,7 +132,7 @@ public class BaseRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRep
@Override
public void deleteByProperties(String[] propName, Object[] propValue) {
if ((propName != null) && (propName.length > 0) && (propValue != null) && (propValue.length > 0) && (propValue.length == propName.length)) {
StringBuffer sb = new StringBuffer("delete from " + persistentClass.getName() + " o where 1=1 ");
StringBuffer sb = new StringBuffer("delete from " + persistentClass.getName() + " model where 1=1 ");
appendQL(sb,propName,propValue);
Query query = entityManager.createQuery(sb.toString());
setParameter(query,propName,propValue);
@ -144,9 +144,9 @@ public class BaseRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRep
}
@Override
public void deleteByIdIn(long[] ids) {
public void deleteByIds(long[] ids) {
if(ids != null && ids.length > 0){
String hql = "delete from " + persistentClass.getName() + " o where o.id in(:ids) ";
String hql = "delete from " + persistentClass.getName() + " model where model.id in(:ids) ";
Query query = entityManager.createQuery(hql);
query.setParameter("ids", Arrays.asList(ids));
@ -178,7 +178,7 @@ public class BaseRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRep
&& (conditionValue != null) && (conditionValue.length > 0)) {
StringBuffer sb = new StringBuffer();
sb.append("update " + persistentClass.getName() + " o set ");
sb.append("update " + persistentClass.getName() + " model set ");
for (int i = 0; i < propertyName.length; i++) {
sb.append(propertyName[i] + " = :p_" + propertyName[i] + ",");
}
@ -210,7 +210,7 @@ public class BaseRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRep
&& (propertyValue.length > 0) && (propertyName.length == propertyValue.length)) {
StringBuffer sb = new StringBuffer();
sb.append("update " + persistentClass.getName() + " o set ");
sb.append("update " + persistentClass.getName() + " model set ");
for (int i = 0; i < propertyName.length; i++) {
sb.append(propertyName[i] + " = :p_" + propertyName[i] + ",");
}

@ -30,9 +30,6 @@ public class HqlPack {
* @param isShowTime
*/
public static void timeBuilder( String startDate,String endDate, String columnName, StringBuffer result, boolean isShowTime) {
startDate = getSafeParam(startDate);
endDate = getSafeParam(endDate);
if (startDate == null || startDate.trim().length() == 0) {
startDate = "1900-01-01";
} else {
@ -49,6 +46,9 @@ public class HqlPack {
if (isShowTime&& endDate.trim().length()<=11) {
endDate+= " 23:59:59";
}
startDate = getSafeParam(startDate);
endDate = getSafeParam(endDate);
result.append(" and model." + columnName + " between '" + startDate + "' and '" + endDate + "'");
}
@ -61,14 +61,15 @@ public class HqlPack {
* @param isShowTime
*/
public static void timeBuilder( String date, String columnName, StringBuffer result, Boolean showTaday,boolean isShowTime) {
date = getSafeParam(date);
String today = (new SimpleDateFormat("yyyy-MM-dd")).format(new Date());
if(date != null && date.trim().length() > 0 && (date.length() == 1 || ",".equals(date))){
//只有一个逗号
date = "";
}
if(date != null && date.trim().length() > 0){
date = getSafeParam(date);
String today = (new SimpleDateFormat("yyyy-MM-dd")).format(new Date());
if(date != null && date.trim().length() > 0 && (date.length() == 1 || ",".equals(date))){
//只有一个逗号
date = "";
}
String[] time = date.split(",");
if(time.length == 1){
//只有开始日期,没有结束日期
@ -410,4 +411,56 @@ public class HqlPack {
result.append(" and dbo.CheckStrInArr('"+data+"',model."+columnName+")>0 ");
}
}
/**
* longintlike
* @param data
* @param columnName
* @param result
*/
public static void getNumLikerPack(Object data,String columnName, StringBuffer result) {
if (data != null) {
data = getSafeParam(data);
result.append(" and model."+columnName+" like '%" + data + "%'");
}
}
/**
* Stringlike
* @param data
* @param columnName
* @param result
*/
public static void getNumLikerPackOr(Object data,String columnName, StringBuffer result) {
if (data != null) {
data = getSafeParam(data);
result.append(" or model."+columnName+" like '%" + data + "%'");
}
}
/**
* Stringlike()
* @param data
* @param columnName
* @param result
*/
public static void getNumRightLikerPack(Object data,String columnName, StringBuffer result) {
if (data != null) {
data = getSafeParam(data);
result.append(" and model."+columnName+" like '" + data + "%'");
}
}
/**
* Stringlike()
* @param data
* @param columnName
* @param result
*/
public static void getNumLeftLikerPack(Object data,String columnName, StringBuffer result) {
if (data != null) {
data = getSafeParam(data);
result.append(" and model."+columnName+" like '%" + data + "'");
}
}
}

@ -82,7 +82,7 @@ public class SysMenu extends BaseBean {
@Column(name="MENU_STATUS")
@ApiParam(value ="功能状态1.正常2.禁用)" , example ="1" , access ="功能状态1.正常2.禁用)",defaultValue="1")
private Integer menuStatus = 1;
private Integer menuStatus;
@ApiParam(value ="子集列表")
private transient List<SysMenu> childList;

@ -203,9 +203,31 @@ public class CoreHqlPack {
HqlPack.getStringLikerPack(tool.getName(),"name",result);
HqlPack.getNumEqualPack(tool.getToolTypeId(),"toolTypeId",result);
HqlPack.getNumEqualPack(tool.getToolStatusId(),"toolStatusId",result);
HqlPack.getStringLikerPack(tool.getName(),"name",result);
HqlPack.getStringLikerPack(tool.getName(),"name",result);
HqlPack.getNumEqualPack(tool.getToolDataTypeId(),"toolDataTypeId",result);
HqlPack.getNumEqualPack(tool.getToolConnTypeId(),"toolConnTypeId",result);
HqlPack.getStringLikerPack(tool.getToolIp(),"toolIp",result);
HqlPack.getNumLikerPack(tool.getToolPort(),"toolPort",result);
return result.toString();
}
}
/**
*
* @param sysMessage
* @return
*/
public static String packHqlSysMessage(SysMessage sysMessage){
StringBuffer result = new StringBuffer();
// hql拼接
HqlPack.getStringLikerPack(sysMessage.getMessageTitle(),"messageTitle",result);
HqlPack.getStringLikerPack(sysMessage.getMessageContent(),"messageContent",result);
HqlPack.getNumLikerPack(sysMessage.getMessageStatusId(),"messageStatusId",result);
HqlPack.getNumLikerPack(sysMessage.getMessageTypeId(),"messageTypeId",result);
HqlPack.getNumEqualPack(sysMessage.getMessageRecipientId(),"messageRecipientId",result);
HqlPack.getNumEqualPack(sysMessage.getMessageSendId(),"messageSendId",result);
HqlPack.timeBuilder(sysMessage.getCreateDatetime(),"createDatetime", result, false,false);
return result.toString();
}
}

@ -0,0 +1,52 @@
package cn.estsh.i3plus.pojo.wms.bean;
import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
* @Description :
* @Reference :
* @Author : alwaysfrin
* @CreateDate : 2018-09-04 15:58
* @Modify:
**/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@Table(name="T_WMS_CUSTOMER_SENDTO")
@Api("客户发往地信息")
public class CustomerSendTo extends BaseBean {
@Column(name="CUSTOMER_ID")
@ApiParam("客户端编号")
public String customerId;
@Column(name="PART_ID")
@ApiParam("零件编号")
public String partId;
@Column(name="CUSTOMER_PARTNO")
@ApiParam("客户零件号")
public String customerPartNo;
@Column(name="ERP_PARTNO")
@ApiParam("ERP零件号")
public String ERPPartNo;
@Column(name="CUSTOMER_SENDTO_CODE")
@ApiParam("客户发往地代码")
public String customerSendToCode;
@Column(name="CUSTOMER_SENDTO_NAME")
@ApiParam("客户发往地名称")
public String customerSendToName;
}

@ -26,7 +26,7 @@ import javax.persistence.Table;
@Api("工厂仓库")
public class FactoryStore extends BaseBean {
@Column(name="store_coded")
@Column(name="store_code")
@ApiParam("仓库代码")
public String storeCode;

@ -0,0 +1,36 @@
package cn.estsh.i3plus.pojo.wms.bean;
import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
* @Description :
* @Reference :
* @Author : silliter.yuan
* @CreateDate : 2018-10-31 15:18
* @Modify:
**/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@Table(name="T_WMS_ORG_WAREHOUSE")
@Api("工厂仓库组织关系表")
public class RefOrgWareHouse extends BaseBean {
@Column(name="ORG_ID")
@ApiParam("组织编号")
public String orgId;
@Column(name="WAREHOUSE_ID")
@ApiParam("仓库编号")
public String storeId;
}

@ -0,0 +1,36 @@
package cn.estsh.i3plus.pojo.wms.bean;
import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
* @Description :
* @Reference :
* @Author : silliter.yuan
* @CreateDate : 2018-10-31 15:18
* @Modify:
**/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@Table(name="T_WMS_USER_WAREHOUSE")
@Api("用户仓库关系表")
public class RefUserWareHouse extends BaseBean {
@Column(name="USER_ID")
@ApiParam("用户编号")
public String userId;
@Column(name="WAREHOUSE_ID")
@ApiParam("仓库编号")
public String storeId;
}

@ -0,0 +1,52 @@
package cn.estsh.i3plus.pojo.wms.bean;
import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
* @Description :
* @Reference :
* @Author : alwaysfrin
* @CreateDate : 2018-09-04 15:58
* @Modify:
**/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@Table(name="T_WMS_WAREHOUSE")
@Api("工厂仓库信息")
public class WareHouse extends BaseBean {
@Column(name="code")
@ApiParam("仓库代码")
public String code;
@Column(name="name")
@ApiParam("仓库名称")
public String name;
@Column(name="address")
@ApiParam("仓库地址")
public String address;
@Column(name="telephone")
@ApiParam("仓库电话号码")
public String telephone;
@Column(name="fax")
@ApiParam("仓库传真号码")
public String fax;
@Column(name="contact")
@ApiParam("联系人")
public String contact;
}

@ -2,6 +2,7 @@ package cn.estsh.i3plus.pojo.wms.repository;
import cn.estsh.i3plus.pojo.base.jpa.dao.BaseRepository;
import cn.estsh.i3plus.pojo.wms.bean.FactoryStore;
import cn.estsh.i3plus.pojo.wms.bean.WareHouse;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
@ -15,13 +16,5 @@ import java.util.List;
* @Modify:
**/
@Repository
public interface FactoryStoreRepository extends BaseRepository<FactoryStore,Long> {
@Query(value="from FactoryStore fs where fs.isValid=1")
List<FactoryStore> listAll();
@Query(value="from FactoryStore fs where fs.isValid=2")
int countAll();
List<FactoryStore> findByStoreName(String storeName);
public interface FactoryStoreRepository extends BaseRepository<FactoryStore, Long> {
}

@ -0,0 +1,16 @@
package cn.estsh.i3plus.pojo.wms.repository;
import cn.estsh.i3plus.pojo.base.jpa.dao.BaseRepository;
import cn.estsh.i3plus.pojo.wms.bean.WareHouse;
import org.springframework.stereotype.Repository;
/**
* @Description :
* @Reference :
* @Author : alwaysfrin
* @CreateDate : 2018-09-13 9:47
* @Modify:
**/
@Repository
public interface WareHouseRepository extends BaseRepository<WareHouse, Long> {
}

@ -1,11 +1,7 @@
package cn.estsh.i3plus.pojo.wms.sqlpack;
import cn.estsh.i3plus.pojo.base.tool.HqlPack;
import cn.estsh.i3plus.pojo.platform.bean.Department;
import cn.estsh.i3plus.pojo.platform.bean.Position;
import cn.estsh.i3plus.pojo.platform.bean.SysLocaleLanguage;
import cn.estsh.i3plus.pojo.platform.bean.SysLocaleResource;
import cn.estsh.i3plus.pojo.wms.bean.FactoryStore;
import cn.estsh.i3plus.pojo.wms.bean.WareHouse;
/**
* @Description :
@ -18,16 +14,16 @@ public class WmsHqlPack {
/**
*
* @param factoryStore
* @param wareHouse
* @return
*/
public static String packHqlFactoryStore(FactoryStore factoryStore) {
public static String packHqlFactoryStore(WareHouse wareHouse) {
StringBuffer result = new StringBuffer();
// 部门名称
HqlPack.getStringLikerPack(factoryStore.getStoreCode(),"storeCode", result);
HqlPack.getStringLikerPack(wareHouse.getCode(),"code", result);
// 部门代码
HqlPack.getStringLikerPack(factoryStore.getStoreName(),"storeName", result);
HqlPack.getStringLikerPack(wareHouse.getName(),"name", result);
return result.toString();
}

Loading…
Cancel
Save