当前位置: 首页 > news >正文

做视频网站需要哪些技术指标福州网seo

做视频网站需要哪些技术指标,福州网seo,什么是域名系统 网站建设教程,重庆专业网站建设公司排名灵感来自于一项重复的工作,下图中,这类禁用启用、审核通过不通过、设计成是什么状态否什么状态的场景很多。每一个都需要单独提供接口。重复工作还蛮大的。于是,基于该组件类捕获组件跳转写了这款通用接口。省时省力。 代码如下:…

灵感来自于一项重复的工作,下图中,这类禁用启用、审核通过不通过、设计成是什么状态否什么状态的场景很多。每一个都需要单独提供接口。重复工作还蛮大的。于是,基于该组件类捕获组件跳转写了这款通用接口。省时省力。
在这里插入图片描述
代码如下:

/** 文件名称: 类UnifyBatchUpdateEndpoint* 文件描述:* 创建人: simple_zeng* 创建时间: 2024/6/8*/
@RestController
public class UnifyBatchUpdateEndpoint implements InterestedClassAware {@Autowiredprivate SqlScriptExecutor sqlScriptExecutor;// 实体类名对应tableIdprivate static Map<String, UnifyBatch> BUCKET = new HashMap<>();@RequestMapping("/unify/status")public JsonResult unifyBatchUpdate(@RequestBody UnifyBatchUpdate unifyBatchUpdate) {List<String> ids = unifyBatchUpdate.getIds();if (ZYListUtils.isEmptyList(ids)) {throw new LocalException("请至少选择一条数据");}Integer status = unifyBatchUpdate.getStatus();if (null == status) {throw new LocalException("请选择数据状态");}String entityName = unifyBatchUpdate.getEntityName();if (null == entityName) {throw new LocalException("请选择目标对象");}String prop = unifyBatchUpdate.getProp();if (null == prop) {throw new LocalException("请选择目标对象属性");}UnifyBatch unifyBatch = BUCKET.get(entityName.toLowerCase());if (null == unifyBatch) {throw new LocalException("不能识别的状态类型");}String tableName = unifyBatch.getTableName(); // 表名String keyColumnName = unifyBatch.getKeyColumnName(); // 主键字段名String column = unifyBatch.getColumn(prop); // 状态字段名String idInWhere = ZYWrapperHelper.toIn(ids); // id条件String sqlTemplate = "update %s set %s=%s where %s in %s";  // update sys_user set is_using=1 where id in ('1')String sql = String.format(sqlTemplate, tableName, column, status, keyColumnName, idInWhere);sqlScriptExecutor.executeUpdateScript(sql);return JsonResult.success();}public boolean match(AnnotationMetadata annotationMetadata) {return annotationMetadata.hasAnnotation(TableName.class.getName());}@Overridepublic void setClasses(Set<Class<?>> classes) {for (Class<?> aClass : classes) {TableName tableName = aClass.getAnnotation(TableName.class);if (null == tableName) {continue;}String simpleName = aClass.getSimpleName();// 实体与表的关系UnifyBatch unifyBatch = new UnifyBatch();unifyBatch.setTableName(tableName.value());Field[] fields = ZYReflectUtils.getFields(aClass);Map<String, String> propMapColumn = new HashMap<>();for (Field field : fields) {field.setAccessible(true);Class<?> type = field.getType();// 主键TableId tableId = field.getAnnotation(TableId.class);if (null != tableId) {unifyBatch.setKeyColumnName(tableId.value());}// 只处理int类型的状态值修改if (!Integer.class.isAssignableFrom(type)) {continue;}// 字段TableField tableField = field.getAnnotation(TableField.class);if (null != tableField) {propMapColumn.put(field.getName().toLowerCase(), tableField.value());}}unifyBatch.setPropMapColumn(propMapColumn);if (!unifyBatch.empty()) {BUCKET.put(simpleName.toLowerCase(), unifyBatch);}}}
}@Data
public class UnifyBatchUpdate implements Serializable {private List<String> ids;private String entityName;private String prop;private Integer status;
}@Data
public class UnifyBatch {private String tableName;private String keyColumnName;private Map<String, String> propMapColumn;public String getColumn(String prop) {return null != propMapColumn ? propMapColumn.get(prop.toLowerCase()) : null;}public boolean empty() {if (ZYStrUtils.isNull(tableName)) {return true;}if (ZYStrUtils.isNull(keyColumnName)) {return true;}if (null == propMapColumn || propMapColumn.isEmpty()) {return true;}return false;}
}

调用示例,后端不用写任何代码,只需要告诉前端调哪个实体类和某个属性即可。岂不美哉。

POST http://localhost:{{port}}/unify/status
Content-Type: application/json
Authorization: {{auth_token}}
u-login-areaId: {{areaId}}{"entityName": "User","prop": "isUsing","status": 1,"ids": ["1","1790218983664807938","1790219261998821377"]
}
http://www.khdw.cn/news/41284.html

相关文章:

  • WordPress在线留言插件seo网络推广技术员招聘
  • 营销型网站建设价格贵吗谁有恶意点击软件
  • 软件公司都是帮别人做网站么蚁百杭州网站seo优化
  • 用ipv6地址做网站访问郑州网站优化公司
  • 做企业网站接单成人电脑培训班附近有吗
  • 铜川做网站的公司必应搜索引擎入口官网
  • 方案网站有哪些seo案例分析及解析
  • 做网站自己全国新闻媒体发稿平台
  • wordpress做自建站百度竞价点击价格公式
  • 常德网站seosem培训机构
  • 企业网站建设排名百度平台营销宝典
  • 探测器 东莞网站建设重庆网页优化seo
  • 为什么建立网站百度关键词排名代做
  • 房产律师在线咨询电话免费网络排名优化软件
  • 网页设计公司简介模板seo外链建设的方法有
  • 软件开发就业前景如何百度seo是什么
  • 做兼职什么网站好个人网站备案
  • 太原做网站排名最新足球消息
  • 做网站都有什么功能网络营销项目
  • 高科技展厅效果图设计免费seo课程
  • 防止访问网站文件夹2022最火营销方案
  • wordpress 鲜果seo企业推广案例
  • 天津河北做网站的公司排名山东关键词快速排名
  • 哪个网站可以免费做国外网站外贸seo推广公司
  • 百度网网站建设的目标免费游戏推广平台
  • wordpress收费主题破解版长春百度快速优化
  • 广州做网站比较有名的公司网页设计软件有哪些
  • 公司有网站域名后如何建网站昆明seo
  • 东营市住房和建设委员会网站2023年8月新闻热点事件
  • 做物流网站注意什么北京搜索优化推广公司