mongodb整合,功能优化调整

yun-zuoyi
alwaysfrin 7 years ago
parent 1d106c9e59
commit 3b0d13dca2

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

@ -1,17 +0,0 @@
package cn.estsh.i3plus.pojo.base.jpa;
import cn.estsh.i3plus.pojo.base.jpa.factory.BaseRepositoryFactoryBean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
/**
* @Description : jps
* @Reference :
* @Author : alwaysfrin
* @CreateDate : 2018-09-13 14:55
* @Modify:
**/
//@Configuration
//@EnableJpaRepositories(basePackages = {"cn.estsh.**"}, repositoryFactoryBeanClass = BaseRepositoryFactoryBean.class)//指定自己的工厂类
public class JpaConfig {
}

@ -182,7 +182,7 @@ public class BaseRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRep
@Override @Override
public T getById(long id) { public T getById(long id) {
return this.getOne(id); return entityManager.find(persistentClass,id);
} }
@Override @Override

@ -2,13 +2,14 @@ package cn.estsh.i3plus.pojo.platform.repository;
import cn.estsh.i3plus.pojo.base.jpa.dao.BaseRepository; import cn.estsh.i3plus.pojo.base.jpa.dao.BaseRepository;
import cn.estsh.i3plus.pojo.platform.bean.LogOperate; import cn.estsh.i3plus.pojo.platform.bean.LogOperate;
import org.springframework.data.mongodb.repository.MongoRepository;
/** /**
* @Description : * @Description : (使Mongodb)
* @Reference : * @Reference :
* @Author : wei.peng * @Author : wei.peng
* @Date : 2018-10-22 12:03:00.118 * @Date : 2018-10-22 12:03:00.118
* @Modify : * @Modify :
**/ **/
public interface LogOperateRepository extends BaseRepository<LogOperate, Long> { public interface LogOperateRepository extends MongoRepository<LogOperate, Long> {
} }

@ -2,6 +2,7 @@ package cn.estsh.i3plus.pojo.platform.repository;
import cn.estsh.i3plus.pojo.base.jpa.dao.BaseRepository; import cn.estsh.i3plus.pojo.base.jpa.dao.BaseRepository;
import cn.estsh.i3plus.pojo.platform.bean.LogSystem; import cn.estsh.i3plus.pojo.platform.bean.LogSystem;
import org.springframework.data.mongodb.repository.MongoRepository;
/** /**
* @Description : * @Description :
@ -10,5 +11,5 @@ import cn.estsh.i3plus.pojo.platform.bean.LogSystem;
* @Date : 2018-10-22 12:03:00.158 * @Date : 2018-10-22 12:03:00.158
* @Modify : * @Modify :
**/ **/
public interface LogSystemRepository extends BaseRepository<LogSystem, Long> { public interface LogSystemRepository extends MongoRepository<LogSystem, Long> {
} }

@ -37,6 +37,11 @@
</exclusions> </exclusions>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<!-- swagger --> <!-- swagger -->
<dependency> <dependency>
<groupId>io.springfox</groupId> <groupId>io.springfox</groupId>

Loading…
Cancel
Save