返回页面一直是“2021-07-17 15:15:46.488”
···@Data
public class BaseDomain {
@Column(hump = true)
@JsonField(dataFormat = "yyyy-MM-dd HH:mm")
private LocalDateTime createTime;
@Column(hump = true)
@JsonField(dataFormat = "yyyy-MM-dd HH:mm")
private LocalDateTime updateTime;
}···
···@Table("t_spu")
@Data
public class Spu extends BaseDomain {
@Id
private long id;
@Column
private String name;
@Column(hump = true)
private String shortName;
@Column
private String code;
@Column(hump = true)
private String spuCategory;
@Many(field = "spuId")
private List skuList;
}···
···@Api("product")
@At("/product")
@IocBean
@Ok("json:full")
@Filters(@By(type= CrossOriginFilter.class))
public class ProductModule extends BaseModule{
@ApiOperation(value = "查询商品列表", notes = "可分页", httpMethod="GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNumber", paramType="query", value = "起始页是1", dataType="int", required = false, defaultValue="1"),
@ApiImplicitParam(name = "pageSize", paramType="query", value = "每页数量", dataType="int", required = false, defaultValue="20"),
})
@At
@GET
public NutMap querySpu(@Param("..") Pager pager, @Param("searchParams") Spu spu) {
Criteria cri = Cnd.cri();
System.out.println(spu);
if(spu !=null) {
if (Strings.isNotBlank(spu.getCode())) {
cri.where().andLike("code", spu.getCode());
} else if (Strings.isNotBlank(spu.getName())){
cri.where().andLike("name", spu.getName());
} else if (Strings.isNotBlank(spu.getShortName())){
cri.where().andLike("short_name", spu.getShortName());
} else if (Strings.isNotBlank(spu.getSpuCategory())){
cri.where().andLike("spuCategory", spu.getSpuCategory());
}
}
cri.getOrderBy().desc("id");
List<Spu> spuList = dao.query(Spu.class, cri, pager);
pager.setRecordCount(dao.count(MetaData.class));
return new NutMap("code", 0).setv("data", spuList).setv("count", pager.getRecordCount());
}···