本文整理汇总了Java中com.baidu.unbiz.fluentvalidator.FluentValidator类的典型用法代码示例。如果您正苦于以下问题:Java FluentValidator类的具体用法?Java FluentValidator怎么用?Java FluentValidator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FluentValidator类属于com.baidu.unbiz.fluentvalidator包,在下文中一共展示了FluentValidator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: create
import com.baidu.unbiz.fluentvalidator.FluentValidator; //导入依赖的package包/类
@ApiOperation(value = "新增类目")
@RequiresPermissions("cms:category:create")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public Object create(CmsCategory cmsCategory) {
ComplexResult result = FluentValidator.checkAll()
.on(cmsCategory.getName(), new LengthValidator(1, 20, "名称"))
.doValidate()
.result(ResultCollectors.toComplex());
if (!result.isSuccess()) {
return new CmsResult(CmsResultConstant.INVALID_LENGTH, result.getErrors());
}
long time = System.currentTimeMillis();
cmsCategory.setCtime(time);
cmsCategory.setOrders(time);
int count = cmsCategoryService.insertSelective(cmsCategory);
return new CmsResult(CmsResultConstant.SUCCESS, count);
}
示例2: update
import com.baidu.unbiz.fluentvalidator.FluentValidator; //导入依赖的package包/类
@ApiOperation(value = "修改类目")
@RequiresPermissions("cms:category:update")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public Object update(@PathVariable("id") int id, CmsCategory cmsCategory) {
ComplexResult result = FluentValidator.checkAll()
.on(cmsCategory.getName(), new LengthValidator(1, 20, "名称"))
.doValidate()
.result(ResultCollectors.toComplex());
if (!result.isSuccess()) {
return new CmsResult(CmsResultConstant.INVALID_LENGTH, result.getErrors());
}
cmsCategory.setCategoryId(id);
int count = cmsCategoryService.updateByPrimaryKeySelective(cmsCategory);
return new CmsResult(CmsResultConstant.SUCCESS, count);
}
示例3: create
import com.baidu.unbiz.fluentvalidator.FluentValidator; //导入依赖的package包/类
@ApiOperation(value = "新增文章")
@RequiresPermissions("cms:article:create")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public Object create(CmsArticle cmsArticle) {
ComplexResult result = FluentValidator.checkAll()
.on(cmsArticle.getTitle(), new LengthValidator(1, 200, "标题"))
.doValidate()
.result(ResultCollectors.toComplex());
if (!result.isSuccess()) {
return new CmsResult(CmsResultConstant.INVALID_LENGTH, result.getErrors());
}
long time = System.currentTimeMillis();
cmsArticle.setCtime(time);
cmsArticle.setOrders(time);
cmsArticle.setReadnumber(0);
int count = cmsArticleService.insertSelective(cmsArticle);
return new CmsResult(CmsResultConstant.SUCCESS, count);
}
示例4: update
import com.baidu.unbiz.fluentvalidator.FluentValidator; //导入依赖的package包/类
@ApiOperation(value = "修改文章")
@RequiresPermissions("cms:article:update")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public Object update(@PathVariable("id") int id, CmsArticle cmsArticle) {
ComplexResult result = FluentValidator.checkAll()
.on(cmsArticle.getTitle(), new LengthValidator(1, 200, "标题"))
.doValidate()
.result(ResultCollectors.toComplex());
if (!result.isSuccess()) {
return new CmsResult(CmsResultConstant.INVALID_LENGTH, result.getErrors());
}
cmsArticle.setArticleId(id);
int count = cmsArticleService.updateByPrimaryKeySelective(cmsArticle);
return new CmsResult(CmsResultConstant.SUCCESS, count);
}
示例5: create
import com.baidu.unbiz.fluentvalidator.FluentValidator; //导入依赖的package包/类
@ApiOperation(value = "新增单页")
@RequiresPermissions("cms:page:create")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public Object create(CmsPage cmsPage) {
ComplexResult result = FluentValidator.checkAll()
.on(cmsPage.getTitle(), new LengthValidator(1, 20, "标题"))
.doValidate()
.result(ResultCollectors.toComplex());
if (!result.isSuccess()) {
return new CmsResult(CmsResultConstant.INVALID_LENGTH, result.getErrors());
}
long time = System.currentTimeMillis();
cmsPage.setCtime(time);
cmsPage.setOrders(time);
int count = cmsPageService.insertSelective(cmsPage);
return new CmsResult(CmsResultConstant.SUCCESS, count);
}
示例6: update
import com.baidu.unbiz.fluentvalidator.FluentValidator; //导入依赖的package包/类
@ApiOperation(value = "修改单页")
@RequiresPermissions("cms:page:update")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public Object update(@PathVariable("id") int id, CmsPage cmsPage) {
ComplexResult result = FluentValidator.checkAll()
.on(cmsPage.getTitle(), new LengthValidator(1, 20, "标题"))
.doValidate()
.result(ResultCollectors.toComplex());
if (!result.isSuccess()) {
return new CmsResult(CmsResultConstant.INVALID_LENGTH, result.getErrors());
}
cmsPage.setPageId(id);
int count = cmsPageService.updateByPrimaryKeySelective(cmsPage);
return new CmsResult(CmsResultConstant.SUCCESS, count);
}
示例7: create
import com.baidu.unbiz.fluentvalidator.FluentValidator; //导入依赖的package包/类
@ApiOperation(value = "新增专题")
@RequiresPermissions("cms:topic:create")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public Object create(CmsTopic cmsTopic) {
ComplexResult result = FluentValidator.checkAll()
.on(cmsTopic.getTitle(), new LengthValidator(1, 100, "标题"))
.doValidate()
.result(ResultCollectors.toComplex());
if (!result.isSuccess()) {
return new CmsResult(CmsResultConstant.INVALID_LENGTH, result.getErrors());
}
long time = System.currentTimeMillis();
cmsTopic.setCtime(time);
int count = cmsTopicService.insertSelective(cmsTopic);
return new CmsResult(CmsResultConstant.SUCCESS, count);
}
示例8: update
import com.baidu.unbiz.fluentvalidator.FluentValidator; //导入依赖的package包/类
@ApiOperation(value = "修改专题")
@RequiresPermissions("cms:topic:update")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public Object update(@PathVariable("id") int id, CmsTopic cmsTopic) {
ComplexResult result = FluentValidator.checkAll()
.on(cmsTopic.getTitle(), new LengthValidator(1, 100, "标题"))
.doValidate()
.result(ResultCollectors.toComplex());
if (!result.isSuccess()) {
return new CmsResult(CmsResultConstant.INVALID_LENGTH, result.getErrors());
}
cmsTopic.setTopicId(id);
int count = cmsTopicService.updateByPrimaryKeySelective(cmsTopic);
return new CmsResult(CmsResultConstant.SUCCESS, count);
}
示例9: create
import com.baidu.unbiz.fluentvalidator.FluentValidator; //导入依赖的package包/类
@ApiOperation(value = "新增标签")
@RequiresPermissions("cms:tag:create")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public Object create(CmsTag cmsTag) {
ComplexResult result = FluentValidator.checkAll()
.on(cmsTag.getName(), new LengthValidator(1, 20, "名称"))
.doValidate()
.result(ResultCollectors.toComplex());
if (!result.isSuccess()) {
return new CmsResult(CmsResultConstant.INVALID_LENGTH, result.getErrors());
}
long time = System.currentTimeMillis();
cmsTag.setCtime(time);
cmsTag.setOrders(time);
int count = cmsTagService.insertSelective(cmsTag);
return new CmsResult(CmsResultConstant.SUCCESS, count);
}
示例10: update
import com.baidu.unbiz.fluentvalidator.FluentValidator; //导入依赖的package包/类
@ApiOperation(value = "修改标签")
@RequiresPermissions("cms:tag:update")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public Object update(@PathVariable("id") int id, CmsTag cmsTag) {
ComplexResult result = FluentValidator.checkAll()
.on(cmsTag.getName(), new LengthValidator(1, 20, "名称"))
.doValidate()
.result(ResultCollectors.toComplex());
if (!result.isSuccess()) {
return new CmsResult(CmsResultConstant.INVALID_LENGTH, result.getErrors());
}
cmsTag.setTagId(id);
int count = cmsTagService.updateByPrimaryKeySelective(cmsTag);
return new CmsResult(CmsResultConstant.SUCCESS, count);
}
示例11: update
import com.baidu.unbiz.fluentvalidator.FluentValidator; //导入依赖的package包/类
@ApiOperation(value = "修改设置")
@RequiresPermissions("cms:setting:update")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public Object update(@PathVariable("id") int id, CmsSetting cmsSetting) {
ComplexResult result = FluentValidator.checkAll()
.on(cmsSetting.getSettingKey(), new LengthValidator(1, 20, "键"))
.doValidate()
.result(ResultCollectors.toComplex());
if (!result.isSuccess()) {
return new CmsResult(CmsResultConstant.INVALID_LENGTH, result.getErrors());
}
cmsSetting.setSettingId(id);
int count = cmsSettingService.updateByPrimaryKeySelective(cmsSetting);
return new CmsResult(CmsResultConstant.SUCCESS, count);
}
示例12: create
import com.baidu.unbiz.fluentvalidator.FluentValidator; //导入依赖的package包/类
@ApiOperation(value = "新增菜单")
@RequiresPermissions("cms:menu:create")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public Object create(CmsMenu cmsMenu) {
ComplexResult result = FluentValidator.checkAll()
.on(cmsMenu.getName(), new LengthValidator(1, 20, "名称"))
.doValidate()
.result(ResultCollectors.toComplex());
if (!result.isSuccess()) {
return new CmsResult(CmsResultConstant.INVALID_LENGTH, result.getErrors());
}
long time = System.currentTimeMillis();
cmsMenu.setOrders(time);
int count = cmsMenuService.insertSelective(cmsMenu);
return new CmsResult(CmsResultConstant.SUCCESS, count);
}
示例13: update
import com.baidu.unbiz.fluentvalidator.FluentValidator; //导入依赖的package包/类
@ApiOperation(value = "修改菜单")
@RequiresPermissions("cms:menu:update")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public Object update(@PathVariable("id") int id, CmsMenu cmsMenu) {
ComplexResult result = FluentValidator.checkAll()
.on(cmsMenu.getName(), new LengthValidator(1, 20, "名称"))
.doValidate()
.result(ResultCollectors.toComplex());
if (!result.isSuccess()) {
return new CmsResult(CmsResultConstant.INVALID_LENGTH, result.getErrors());
}
cmsMenu.setMenuId(id);
int count = cmsMenuService.updateByPrimaryKeySelective(cmsMenu);
return new CmsResult(CmsResultConstant.SUCCESS, count);
}
示例14: create
import com.baidu.unbiz.fluentvalidator.FluentValidator; //导入依赖的package包/类
@ApiOperation(value = "新增角色")
@RequiresPermissions("upms:role:create")
@ResponseBody
@RequestMapping(value = "/create", method = RequestMethod.POST)
public Object create(UpmsRole upmsRole) {
ComplexResult result = FluentValidator.checkAll()
.on(upmsRole.getName(), new LengthValidator(1, 20, "名称"))
.on(upmsRole.getTitle(), new LengthValidator(1, 20, "标题"))
.doValidate()
.result(ResultCollectors.toComplex());
if (!result.isSuccess()) {
return new UpmsResult(UpmsResultConstant.INVALID_LENGTH, result.getErrors());
}
long time = System.currentTimeMillis();
upmsRole.setCtime(time);
upmsRole.setOrders(time);
int count = upmsRoleService.insertSelective(upmsRole);
return new UpmsResult(UpmsResultConstant.SUCCESS, count);
}
示例15: update
import com.baidu.unbiz.fluentvalidator.FluentValidator; //导入依赖的package包/类
@ApiOperation(value = "修改角色")
@RequiresPermissions("upms:role:update")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public Object update(@PathVariable("id") int id, UpmsRole upmsRole) {
ComplexResult result = FluentValidator.checkAll()
.on(upmsRole.getName(), new LengthValidator(1, 20, "名称"))
.on(upmsRole.getTitle(), new LengthValidator(1, 20, "标题"))
.doValidate()
.result(ResultCollectors.toComplex());
if (!result.isSuccess()) {
return new UpmsResult(UpmsResultConstant.INVALID_LENGTH, result.getErrors());
}
upmsRole.setRoleId(id);
int count = upmsRoleService.updateByPrimaryKeySelective(upmsRole);
return new UpmsResult(UpmsResultConstant.SUCCESS, count);
}