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

三明市住房和城乡建设局网站网站开发时间表

三明市住房和城乡建设局网站,网站开发时间表,手机网站建设报价多少,wordpress移动端设置项目的架构 网关:1路由转发 2.认证鉴权(token)3.统一处理(跨域) Mysql:关系型数据库 ES:搜索数据库 Redis:页面级缓存,会话状态存储 GitLab:私有托管平台 K8S:自动化部署、扩展和管理容器化应用程序的开源系统 Jenkins:自动化部署 1.环境搭建 创建一个父工程…

项目的架构

网关:1路由转发 2.认证鉴权(token)3.统一处理(跨域) 

Mysql:关系型数据库

ES:搜索数据库

Redis:页面级缓存,会话状态存储

GitLab:私有托管平台

K8S:自动化部署、扩展和管理容器化应用程序的开源系统

Jenkins:自动化部署

1.环境搭建

创建一个父工程:依赖管理 版本锁定

                子工程:具体业务实现

 

Controller编写规则:

        1.映射路径

        2.请求方式

        3.请求参数

        4.响应结果-返回值

        

2.专辑模块

2.1专辑管理添加

        

 

 1.统一返回结果

package com.atguigu.tingshu.common.result;import lombok.Data;/*** 全局统一返回结果类**/
@Data
public class Result<T> {//返回码private Integer code;//返回消息private String message;//返回数据private T data;public Result(){}// 返回数据protected static <T> Result<T> build(T data) {Result<T> result = new Result<T>();if (data != null)result.setData(data);return result;}public static <T> Result<T> build(T body, Integer code, String message) {Result<T> result = build(body);result.setCode(code);result.setMessage(message);return result;}public static <T> Result<T> build(T body, ResultCodeEnum resultCodeEnum) {Result<T> result = build(body);result.setCode(resultCodeEnum.getCode());result.setMessage(resultCodeEnum.getMessage());return result;}public static<T> Result<T> ok(){return Result.ok(null);}/*** 操作成功* @param data  baseCategory1List* @param <T>* @return*/public static<T> Result<T> ok(T data){Result<T> result = build(data);return build(data, ResultCodeEnum.SUCCESS);}public static<T> Result<T> fail(){return Result.fail(null);}/*** 操作失败* @param data* @param <T>* @return*/public static<T> Result<T> fail(T data){Result<T> result = build(data);return build(data, ResultCodeEnum.FAIL);}public Result<T> message(String msg){this.setMessage(msg);return this;}public Result<T> code(Integer code){this.setCode(code);return this;}
}

2. 统一结果状态信息类

package com.atguigu.tingshu.common.result;import lombok.Getter;/*** 统一返回结果状态信息类**/
@Getter
public enum ResultCodeEnum {SUCCESS(200,"成功"),FAIL(201, "失败"),SERVICE_ERROR(2012, "服务异常"),DATA_ERROR(204, "数据异常"),ILLEGAL_REQUEST(205, "非法请求"),REPEAT_SUBMIT(206, "重复提交"),ARGUMENT_VALID_ERROR(210, "参数校验异常"),SIGN_ERROR(300, "签名错误"),SIGN_OVERDUE(301, "签名已过期"),LOGIN_AUTH(208, "未登陆"),PERMISSION(209, "没有权限"),ACCOUNT_ERROR(214, "账号不正确"),PASSWORD_ERROR(215, "密码不正确"),PHONE_CODE_ERROR(215, "手机验证码不正确"),LOGIN_MOBLE_ERROR( 216, "账号不正确"),ACCOUNT_STOP( 216, "账号已停用"),NODE_ERROR( 217, "该节点下有子节点,不可以删除"),VOD_FILE_ID_ERROR( 220, "声音媒体id不正确"),XXL_JOB_ERROR(210, "调度操作失败"),ACCOUNT_LESS(220, "账户余额不足"),ACCOUNT_LOCK_ERROR(221, "账户余额锁定失败"),ACCOUNT_UNLOCK_ERROR(221, "账户余额解锁失败"),ACCOUNT_MINUSLOCK_ERROR(221, "账户余额扣减失败"),ACCOUNT_LOCK_REPEAT(221, "重复锁定"),ACCOUNT_LOCK_RESULT_NULL(221, "锁定账号结果对象为空"),ORDER_SUBMIT_REPEAT(221, "超时或重复提交订单"),NO_BUY_NOT_SEE(230, "未购买不能观看"),EXIST_NO_EXPIRE_LIVE(230, "当前存在未过期直播"),REPEAT_BUY_ERROR(231, "已经购买过该专辑"),;private Integer code;private String message;private ResultCodeEnum(Integer code, String message) {this.code = code;this.message = message;}
}

 3.全局异常处理

package com.atguigu.tingshu.common.handler;import com.atguigu.tingshu.common.execption.GuiguException;
import com.atguigu.tingshu.common.result.Result;
import com.atguigu.tingshu.common.result.ResultCodeEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.BindException;
import org.springframework.validation.BindingResult;
import org.springframework.validation.FieldError;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;import java.util.HashMap;
import java.util.List;
import java.util.Map;/*** 全局异常处理类**/
@Slf4j
@ControllerAdvice
public class GlobalExceptionHandler {@ExceptionHandler(Exception.class)@ResponseBodypublic Result error(Exception e){e.printStackTrace();return Result.fail();}/*** 自定义异常处理方法* @param e* @return*/@ExceptionHandler(GuiguException.class)@ResponseBodypublic Result error(GuiguException e){return Result.build(null,e.getCode(), e.getMessage());}@ExceptionHandler({IllegalArgumentException.class})@ResponseBodypublic Result llegalArgumentException(Exception e) {log.error("触发异常拦截: " + e.getMessage(), e);return Result.build(null, ResultCodeEnum.ARGUMENT_VALID_ERROR);}@ExceptionHandler(value = BindException.class)@ResponseBodypublic Result error(BindException exception) {BindingResult result = exception.getBindingResult();Map<String, Object> errorMap = new HashMap<>();List<FieldError> fieldErrors = result.getFieldErrors();fieldErrors.forEach(error -> {log.error("field: " + error.getField() + ", msg:" + error.getDefaultMessage());errorMap.put(error.getField(), error.getDefaultMessage());});return Result.build(errorMap, ResultCodeEnum.ARGUMENT_VALID_ERROR);}@ExceptionHandler(value = MethodArgumentNotValidException.class)@ResponseBodypublic Result error(MethodArgumentNotValidException exception) {BindingResult result = exception.getBindingResult();Map<String, Object> errorMap = new HashMap<>();List<FieldError> fieldErrors = result.getFieldErrors();fieldErrors.forEach(error -> {log.error("field: " + error.getField() + ", msg:" + error.getDefaultMessage());errorMap.put(error.getField(), error.getDefaultMessage());});return Result.build(errorMap, ResultCodeEnum.ARGUMENT_VALID_ERROR);}}

 4.自定义全局异常

package com.atguigu.tingshu.common.execption;import com.atguigu.tingshu.common.result.ResultCodeEnum;
import lombok.Data;/*** 自定义全局异常类**/
@Data
public class GuiguException extends RuntimeException {private Integer code;private String message;/*** 通过状态码和错误消息创建异常对象* @param code* @param message*/public GuiguException(Integer code, String message) {super(message);this.code = code;this.message = message;}/*** 接收枚举类型对象* @param resultCodeEnum*/public GuiguException(ResultCodeEnum resultCodeEnum) {super(resultCodeEnum.getMessage());this.code = resultCodeEnum.getCode();this.message = resultCodeEnum.getMessage();}@Overridepublic String toString() {return "GuliException{" +"code=" + code +", message=" + this.getMessage() +'}';}
}

2.1.1 专辑分类列表(三级分类)

1.controller
package com.atguigu.tingshu.album.api;import com.alibaba.fastjson.JSONObject;
import com.atguigu.tingshu.album.service.BaseCategoryService;
import com.atguigu.tingshu.common.result.Result;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;import java.util.List;
import java.util.Map;
import java.util.Objects;@Tag(name = "分类管理")
@RestController
@RequestMapping(value = "/api/album")
@SuppressWarnings({"all"})
public class BaseCategoryApiController {@Autowiredprivate BaseCategoryService baseCategoryService;/*** @description:* @author: yanhongwei* @date:* @param:  * @param null* @return:**//// api/album/category/getBaseCategoryList@GetMapping(value = "/category/getBaseCategoryList")public Result<List<JSONObject>> getBaseCategoryList() {
//        public Result<List<Map<String, Object>>> getBaseCategoryList()
//        JSONObject jsonObject = new JSONObject();List<JSONObject> categoryList = baseCategoryService.getBaseCategoryList();return Result.ok(categoryList);}}
 2.impl
package com.atguigu.tingshu.album.service.impl;import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSONObject;
import com.atguigu.tingshu.album.mapper.BaseCategory1Mapper;
import com.atguigu.tingshu.album.mapper.BaseCategory2Mapper;
import com.atguigu.tingshu.album.mapper.BaseCategory3Mapper;
import com.atguigu.tingshu.album.mapper.BaseCategoryViewMapper;
import com.atguigu.tingshu.album.service.BaseCategoryService;
import com.atguigu.tingshu.model.album.BaseCategory1;
import com.atguigu.tingshu.model.album.BaseCategoryView;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.http.client.utils.CloneUtils;
import org.apache.kafka.common.utils.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;@Service
@SuppressWarnings({"all"})
public class BaseCategoryServiceImpl extends ServiceImpl<BaseCategory1Mapper, BaseCategory1> implements BaseCategoryService {@Autowiredprivate BaseCategoryViewMapper baseCategoryViewMapper;@Overridepublic List<JSONObject> getBaseCategoryList() {//创建一级集合,收集数据List<JSONObject> allList = new ArrayList<>();//查询所有分类List<BaseCategoryView> baseCategoryViewsList = baseCategoryViewMapper.selectList(null);//封装if (CollectionUtil.isNotEmpty(baseCategoryViewsList)) {//分组一级分类Map<Long, List<BaseCategoryView>> collect1Map = baseCategoryViewsList.stream().collect(Collectors.groupingBy(BaseCategoryView::getCategory1Id));for (Map.Entry<Long, List<BaseCategoryView>> Entry1 : collect1Map.entrySet()) {//创建一级分类封装对象JSONObject obj1 = new JSONObject();//获取1级id 跟nameLong category1Id = Entry1.getKey();List<BaseCategoryView> category2List = Entry1.getValue();String category1Name = category2List.get(0).getCategory1Name();obj1.put("categoryId", category1Id);obj1.put("categoryName", category1Name);//创建二级分类收集集合List<JSONObject> array2 = new ArrayList<>();//分组二级分类Map<Long, List<BaseCategoryView>> collect2Map = category2List.stream().collect(Collectors.groupingBy(BaseCategoryView::getCategory2Id));for (Map.Entry<Long, List<BaseCategoryView>> Entry2 : collect2Map.entrySet()) {//创建二级分类封装对象JSONObject obj2 = new JSONObject();//获取2级分类id nameLong category2Id = Entry2.getKey();List<BaseCategoryView> category3List = Entry2.getValue();String category2Name = category3List.get(0).getCategory2Name();obj2.put("categoryId", category2Id);obj2.put("categoryName", category2Name);List<JSONObject> array3 = category3List.stream().map(baseCategoryView -> {JSONObject obj3 = new JSONObject();obj3.put("categoryId", baseCategoryView.getCategory3Id());obj3.put("categoryName", baseCategoryView.getCategory3Name());return obj3;}).collect(Collectors.toList());obj2.put("categoryChild", array3);//收集二级分类array2.add(obj2);}//封装2级分类obj1.put("categoryChild", array2);//收集一级分类对象allList.add(obj1);}System.out.println("collect = ");}return allList;}
}
3.mapper
package com.atguigu.tingshu.album.mapper;import com.atguigu.tingshu.model.album.BaseCategoryView;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;@Mapper
public interface BaseCategoryViewMapper extends BaseMapper<BaseCategoryView> {}
4. 视图

创建视图封装一些sql语句,不需要再多表查询了

BaseCategoryView

#创建视图
create view view_category01 as
select  c3.id,c1.id category1_id,c1.name category1_name,c2.id category2_id,c2.name category2_name,c3.id category3_id,c3.name category3_name,c3.is_deleted,c3.create_time,c3.update_time
from base_category1 c1inner join base_category2 c2 on c1.id = c2.category1_idinner join base_category3 c3 on c2.id = c3.category2_id

       

//
//
package com.atguigu.tingshu.model.album;import com.atguigu.tingshu.model.base.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;/*** <p>* BaseCategoryView* </p>** @author atguigu*/
@Data
@Schema(description = "分类视图")
@TableName("base_category_view")
public class BaseCategoryView extends BaseEntity {private static final long serialVersionUID = 1L;@Schema(description = "一级分类编号")@TableField("category1_id")private Long category1Id;@Schema(description = "一级分类名称")@TableField("category1_name")private String category1Name;@Schema(description = "二级分类编号")@TableField("category2_id")private Long category2Id;@Schema(description = "二级分类名称")@TableField("category2_name")private String category2Name;@Schema(description = "三级分类编号")@TableField("category3_id")private Long category3Id;@Schema(description = "三级分类名称")@TableField("category3_name")private String category3Name;}


 2.1.2 查询一级分类下面的标签

1.controller
    @GetMapping(value = "category/findAttribute/{category1Id}")public Result<List<BaseAttribute>> findAttribute(@PathVariable Long category1Id) {List<BaseAttribute> attributeList = baseCategoryService.findAttribute(category1Id);return Result.ok(attributeList);}
2.impl
package com.atguigu.tingshu.album.service.impl;import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSONObject;
import com.atguigu.tingshu.album.mapper.*;
import com.atguigu.tingshu.album.service.BaseCategoryService;
import com.atguigu.tingshu.model.album.BaseAttribute;

文章转载自:

http://IkHt4igx.mwpcp.cn
http://tCxEG74o.mwpcp.cn
http://uZ1SpdiN.mwpcp.cn
http://afwqUjrL.mwpcp.cn
http://Vj5jsatQ.mwpcp.cn
http://2LvrkonK.mwpcp.cn
http://DLzKcXRA.mwpcp.cn
http://hbLKj3Fr.mwpcp.cn
http://uYY43u9f.mwpcp.cn
http://lqoHSqlK.mwpcp.cn
http://yM9l0KDw.mwpcp.cn
http://kYaH1jqD.mwpcp.cn
http://goPP4ima.mwpcp.cn
http://2KHHyGYP.mwpcp.cn
http://qkSTvAIB.mwpcp.cn
http://Cu3XJ11a.mwpcp.cn
http://me50d1T2.mwpcp.cn
http://SvjkZ2Bz.mwpcp.cn
http://5KWZIwiK.mwpcp.cn
http://pTp9Zd5u.mwpcp.cn
http://zi3bC5Tg.mwpcp.cn
http://DNF6fRWb.mwpcp.cn
http://YfN7JXxu.mwpcp.cn
http://wbhkcqVi.mwpcp.cn
http://BP9BuVgq.mwpcp.cn
http://XaOMYwbs.mwpcp.cn
http://Qf9EiNua.mwpcp.cn
http://VeDiCp1P.mwpcp.cn
http://kOF9XBJK.mwpcp.cn
http://l6WrTNpk.mwpcp.cn
http://www.dtcms.com/wzjs/757619.html

相关文章:

  • 做模板网站贵阳市网站做的最好的
  • 物流网站首页图片wordpress的slider
  • 进度跟踪网站开发做电商网站的流程
  • 成都免费建网站公司wordpress 翻译函数
  • 怎样建设淘客网站青岛互联网设计公司
  • 简洁的个人网站淘宝提货网站怎么做的
  • 学网站开发哪里好90做网站
  • 嘉兴装修公司做网站郑州小程序制作流程及费用
  • 深圳网站建设建设wordpress 买域名
  • 成都专业做网站的公司做受视频网站
  • 上网出现危险网站整站排名优化公司
  • 专业开发网站企业在北京建设教育协会的网站
  • 桂林网站wordpress 搜索小工具栏
  • 网站制作的重要流程开发公司与城市资产经营公司合作协议
  • 简述网站建设的五类成员网站建设 云计算
  • 建设厅网站企业诚信分值自己做网站需要
  • 荣成市建设局网站是什么wordpress 可视化插件
  • 西安网站建设缑阳建沈阳 建设工程 招标中心网站
  • 团购网站短信平台百度帐号管家
  • 固安建设网站深圳网站优化平台
  • 杭州建设网站设计的公司网站技术的解决方案
  • 可以看的网站都有哪些重庆关键词seo排名
  • 复刻手表网站网站开发与兼容模式
  • 只做dnf的网站用软件什么做网站
  • 确定网站文案网站定制 北京
  • 成都住房和城乡建设厅网站首页博客自定义网站
  • 个人网站备案可以盈利吗网站后台上图片后网页显示不正确
  • 263企业邮箱入口登录找回密码seo综合排名优化
  • 宁波网站设计服务韩国美食做视频网站有哪些
  • 石家庄 科技 公司 网站建设秦皇岛咔咔科技有限公司