【尚庭公寓SpringBoot + Vue 项目实战】公寓管理(十一)

【尚庭公寓SpringBoot + Vue 项目实战】公寓管理(十一)


文章目录

      • 【尚庭公寓SpringBoot + Vue 项目实战】公寓管理(十一)
        • 1、业务介绍
        • 2、逻辑模型介绍
        • 3、接口开发
          • 3.1、保存或更新公寓信息
          • 3.2、根据条件分页查询详细信息
          • 3.3、根据ID获取公寓详细信息
          • 3.4、 根据ID删除公寓信息
          • 3.5、根据ID修改公寓发布状态
          • 3.6、根据区县ID查询公寓信息列表

1、业务介绍

公寓管理共有六个接口,分别是

  1. 保存或更新公寓信息
  2. 根据条件分页查询详细信息
  3. 根据ID获取公寓详情信息
  4. 根据ID删除公寓信息
  5. 根据ID修改公寓发布状态
  6. 根据区县ID查询公寓信息列表

image-20240615225107206

2、逻辑模型介绍

image-20240615225155083

3、接口开发
3.1、保存或更新公寓信息

查看接口

image-20240615230105118

image-20240615230119810

进行开发

查看web-admin模块中的com.atguigu.lease.web.admin.vo.apartment.ApartmentSubmitVo类,内容如下:

@Schema(description = "公寓信息")
@Data
public class ApartmentSubmitVo extends ApartmentInfo {

    @Schema(description="公寓配套id")
    private List<Long> facilityInfoIds;

    @Schema(description="公寓标签id")
    private List<Long> labelIds;

    @Schema(description="公寓杂费值id")
    private List<Long> feeValueIds;

    @Schema(description="公寓图片id")
    private List<GraphVo> graphVoList;

}

编写Controller层逻辑

@Operation(summary = "保存或更新公寓信息")
@PostMapping("saveOrUpdate")
public Result saveOrUpdate(@RequestBody ApartmentSubmitVo apartmentSubmitVo) {
    service.saveOrUpdateApartment(apartmentSubmitVo);
    return Result.ok();
}

编写Service层逻辑

  • ApartmentInfoService中增加如下内容

    void saveOrUpdateApartment(ApartmentSubmitVo apartmentSubmitVo);
    
  • ApartmentInfoServiceImpl中增加如下内容

    /**
     * @author liubo
     * @description 针对表【apartment_info(公寓信息表)】的数据库操作Service实现
     * @createDate 2023-07-24 15:48:00
     */
    @Service
    public class ApartmentInfoServiceImpl extends ServiceImpl<ApartmentInfoMapper, ApartmentInfo>
            implements ApartmentInfoService {
    
        @Autowired
        private GraphInfoService graphInfoService;
    
        @Autowired
        private ApartmentFacilityService apartmentFacilityService;
    
        @Autowired
        private ApartmentLabelService apartmentLabelService;
    
        @Autowired
        private ApartmentFeeValueService apartmentFeeValueService;
    
        /**
         * 保存或更新公寓信息
         *
         * @param apartmentSubmitVo
         */
        @Override
        @Transactional
        public void apartmentSaveOrUpdate(ApartmentSubmitVo apartmentSubmitVo) {
            //判断是新增方法还是修改方法
            boolean isUpdate = apartmentSubmitVo.getId() != null;
            super.saveOrUpdate(apartmentSubmitVo);
    
            if (isUpdate){
                //进行删除,先删除后再添加
                //删除图片
                LambdaQueryWrapper<GraphInfo> graphInfoQueryWrapper = new LambdaQueryWrapper<>();
                graphInfoQueryWrapper.eq(GraphInfo::getItemType, ItemType.APARTMENT);
                graphInfoQueryWrapper.eq(GraphInfo::getItemId,apartmentSubmitVo.getId());
                graphInfoService.remove(graphInfoQueryWrapper);
    
                //删除配套列表
                LambdaQueryWrapper<ApartmentFacility> apartmentFacilityQueryWrapper = new LambdaQueryWrapper<>();
                apartmentFacilityQueryWrapper.eq(ApartmentFacility::getApartmentId,apartmentSubmitVo.getId());
                apartmentFacilityService.remove(apartmentFacilityQueryWrapper);
    
                //删除标签
                LambdaQueryWrapper<ApartmentLabel> apartmentLabelQueryWrapper = new LambdaQueryWrapper<>();
                apartmentLabelQueryWrapper.eq(ApartmentLabel::getApartmentId,apartmentSubmitVo.getId());
                apartmentLabelService.remove(apartmentLabelQueryWrapper);
    
                //删除杂费
                LambdaQueryWrapper<ApartmentFeeValue> apartmentFeeValueQueryWrapper = new LambdaQueryWrapper<>();
                apartmentFeeValueQueryWrapper.eq(ApartmentFeeValue::getApartmentId,apartmentSubmitVo.getId());
                apartmentFeeValueService.remove(apartmentFeeValueQueryWrapper);
            }
    
            //插入图片
            List<GraphVo> graphVoList = apartmentSubmitVo.getGraphVoList();
            if (!CollectionUtils.isEmpty(graphVoList)){
                List<GraphInfo> graphInfoList = new ArrayList<>();
                //循环添加
                for (GraphVo graphVo : graphVoList) {
                    GraphInfo graphInfo = GraphInfo.builder()
                            .name(graphVo.getName())
                            .url(graphVo.getUrl())
                            .itemId(apartmentSubmitVo.getId())
                            .itemType(ItemType.APARTMENT)
                            .build();
                    graphInfoList.add(graphInfo);
                }
                graphInfoService.saveBatch(graphInfoList);
            }
        }
    }
    
3.2、根据条件分页查询详细信息

查看接口

image-20240615230601651

进行开发

查看请求和响应的数据结构

  • 请求数据结构

    • currentsize为分页相关参数,分别表示当前所处页面每个页面的记录数

    • ApartmentQueryVo为公寓的查询条件,详细结构如下:

@Schema(description = "公寓信息")
@Data
public class ApartmentDetailVo extends ApartmentInfo {

    @Schema(description = "图片列表")
    private List<GraphVo> graphVoList;

    @Schema(description = "标签列表")
    private List<LabelInfo> labelInfoList;

    @Schema(description = "配套列表")
    private List<FacilityInfo> facilityInfoList;

    @Schema(description = "杂费列表")
    private List<FeeValueVo> feeValueVoList;
}

响应数据结构

单个公寓信息记录可查看com.atguigu.lease.web.admin.vo.apartment.ApartmentItemVo,内容如下:

@Data
@Schema(description = "后台管理系统公寓列表实体")
public class ApartmentItemVo extends ApartmentInfo {

    @Schema(description = "房间总数")
    private Long totalRoomCount;

    @Schema(description = "空闲房间数")
    private Long freeRoomCount;

}

配置Mybatis-Plus分页插件

common模块中的com.atguigu.lease.common.mybatisplus.MybatisPlusConfiguration中增加如下内容:

@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
    MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
    interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
    return interceptor;
}

接口实现

  • 编写Controller层逻辑

    ApartmentController中增加如下内容:

@Operation(summary = "根据条件分页查询公寓列表")
@GetMapping("pageItem")
public Result<IPage<ApartmentItemVo>> pageItem(@RequestParam long current, @RequestParam long size, ApartmentQueryVo queryVo) {

    IPage<ApartmentItemVo> page = new Page<>(current, size);
    IPage<ApartmentItemVo> list = service.pageApartmentItemByQuery(page, queryVo);
    return Result.ok(list);
}

编写Service层逻辑

  • ApartmentInfoService中增加如下内容
IPage<ApartmentItemVo> pageApartmentItemByQuery(IPage<ApartmentItemVo> page, ApartmentQueryVo queryVo);

ApartmentInfoServiceImpl中增加如下内容

@Autowired
private ApartmentInfoMapper apartmentInfoMapper;

/**
     * 分页查询
     * @param page
     * @param queryVo
     * @return
     */
@Override
public IPage<ApartmentItemVo> pageItem(IPage<ApartmentItemVo> page, ApartmentQueryVo queryVo) {
    return apartmentInfoMapper.pageItem(page,queryVo);
}

编写Mapper层逻辑

ApartmentInfoMapper中增加如下内容

IPage<ApartmentItemVo> pageApartmentItemByQuery(IPage<ApartmentItemVo> page, ApartmentQueryVo queryVo);

ApartmentInfoMapper.xml中增加如下内容

<select id="pageItem" resultType="com.atguigu.lease.web.admin.vo.apartment.ApartmentItemVo">
    select ai.id,
           ai.name,
           ai.introduction,
           ai.district_id,
           ai.district_name,
           ai.city_id,
           ai.city_name,
           ai.province_id,
           ai.province_name,
           ai.address_detail,
           ai.latitude,
           ai.longitude,
           ai.phone,
           ai.is_release,
           ifnull(tc.cnt,0) total_room_count,
           ifnull(tc.cnt,0) - ifnull(cc.cnt,0) free_room_count
    from (select id,
                 name,
                 introduction,
                 district_id,
                 district_name,
                 city_id,
                 city_name,
                 province_id,
                 province_name,
                 address_detail,
                 latitude,
                 longitude,
                 phone,
                 is_release
          from apartment_info
            <where>
                is_deleted=0
                <if test="queryVo.provinceId != null">
                    and province_id=#{queryVo.provinceId}
                </if>
                <if test="queryVo.cityId != null">
                    and city_id=#{queryVo.cityId}
                </if>
                <if test="queryVo.districtId != null">
                    and district_id=#{queryVo.districtId}
                </if>
            </where>
          ) ai
             left join
         (select apartment_id,
                 count(*) cnt
          from room_info
          where is_deleted = 0
            and is_release = 1
          group by apartment_id) tc
         on ai.id = tc.apartment_id
             left join
         (select apartment_id,
                 count(*) cnt
          from lease_agreement
          where is_deleted = 0
            and status in (2, 5)
          group by apartment_id) cc
         on ai.id = cc.apartment_id

</select>

注意:

默认情况下Knife4j为该接口生成的接口文档如下图所示,其中的queryVo参数不方便调试

可在application.yml文件中增加如下配置,将queryVo做打平处理

image-20240615231518354

springdoc:
  default-flat-param-object: true

spring.default-flat-param-object参数设置为true后,效果如下。

image-20240615231529102

3.3、根据ID获取公寓详细信息

查看接口

image-20240615232418668

image-20240615232446248

查看响应数据结构

查看web-admin下的com.atguigu.lease.web.admin.vo.apartment.ApartmentDetailVo,内容如下

@Schema(description = "公寓信息")
@Data
public class ApartmentDetailVo extends ApartmentInfo {

    @Schema(description = "图片列表")
    private List<GraphVo> graphVoList;

    @Schema(description = "标签列表")
    private List<LabelInfo> labelInfoList;

    @Schema(description = "配套列表")
    private List<FacilityInfo> facilityInfoList;

    @Schema(description = "杂费列表")
    private List<FeeValueVo> feeValueVoList;
}

编写Controller层逻辑

ApartmentController中增加如下内容

@Operation(summary = "根据ID获取公寓详细信息")
@GetMapping("getDetailById")
public Result<ApartmentDetailVo> getDetailById(@RequestParam Long id) {
    ApartmentDetailVo apartmentDetailVo = apartmentInfoService.getDetailById(id);
    return Result.ok(apartmentDetailVo);
}

编写Service层逻辑

ApartmentInfoService中增加如下内容

ApartmentDetailVo getApartmentDetailById(Long id);

ApartmentInfoServiceImpl中增加如下内容

@Autowired
private GraphInfoMapper graphInfoMapper;

@Autowired
private LabelInfoMapper labelInfoMapper;

@Autowired
private FacilityInfoMapper facilityInfoMapper;

@Autowired
private FeeValueMapper feeValueMapper;


/**
     * 根据id获取公寓详细信息
     *
     * @param id
     * @return
     */
@Override
public ApartmentDetailVo getDetailById(Long id) {
    //1、根据id或获取公寓信息
    ApartmentInfo apartmentInfo = this.getById(id);

    if (apartmentInfo == null){
        return null;
    }

    //2、获取图片列表
    List<GraphVo> graphVoList = graphInfoMapper.getByIdGraphList(id,ItemType.APARTMENT);

    //3、获取标签列表
    List<LabelInfo> labelInfoList = labelInfoMapper.selectListByApartmentId(id);

    //4、查询配套列表
    List<FacilityInfo> facilityInfoList =  facilityInfoMapper.selectListByApartmentId(id);

    //5、查询杂费信息列表
    List<FeeValueVo> feeValueVoList = feeValueMapper.selectListByApartmentId(id);

    ApartmentDetailVo apartmentDetailVo = new ApartmentDetailVo();
    //复制属性
    BeanUtils.copyProperties(apartmentInfo,apartmentDetailVo);

    //增加属性
    apartmentDetailVo.setGraphVoList(graphVoList);
    apartmentDetailVo.setLabelInfoList(labelInfoList);
    apartmentDetailVo.setFacilityInfoList(facilityInfoList);
    apartmentDetailVo.setFeeValueVoList(feeValueVoList);

    return apartmentDetailVo;
}

编写Mapper层逻辑

编写公寓图片查询逻辑,在GraphInfoMapper中增加如下内容

/**
* @author liubo
* @description 针对表【graph_info(图片信息表)】的数据库操作Mapper
* @createDate 2023-07-24 15:48:00
* @Entity com.atguigu.lease.model.GraphInfo
*/
public interface GraphInfoMapper extends BaseMapper<GraphInfo> {

    @Select("select name,url from graph_info where is_deleted=0 and item_id = #{id} and item_id = #{itemType}")
    List<GraphVo> getByIdGraphList(Long id,ItemType itemType);
}

编写公寓标签查询逻辑

LabelInfoMapper中增加如下内容

/**
* @author liubo
* @description 针对表【label_info(标签信息表)】的数据库操作Mapper
* @createDate 2023-07-24 15:48:00
* @Entity com.atguigu.lease.model.LabelInfo
*/
public interface LabelInfoMapper extends BaseMapper<LabelInfo> {

    /**
     * 获取标签列表
     * @param id
     * @return
     */
    @Select("select id, type, name from label_info where label_info.is_deleted = 0 and id in " +
            "(select apartment_label.label_id from apartment_label where apartment_label.is_deleted = 0 and  apartment_id = #{id})")
    List<LabelInfo> selectListByApartmentId(Long id);
}

编写公寓配套查询逻辑

FacilityInfoMapper中增加如下内容

/**
* @author liubo
* @description 针对表【facility_info(配套信息表)】的数据库操作Mapper
* @createDate 2023-07-24 15:48:00
* @Entity com.atguigu.lease.model.FacilityInfo
*/
public interface FacilityInfoMapper extends BaseMapper<FacilityInfo> {

    /**
     * 根据id查询配套信息
     * @param id
     * @return
     */
    @Select("select id,type,name,icon from facility_info where " +
            "is_deleted=0 and  id in " +
            "(select facility_id from apartment_facility where is_deleted = 0 and apartment_id = #{id})")
    List<FacilityInfo> selectListByApartmentId(Long id);
}List<FacilityInfo> selectListByApartmentId(Long id);

编写公寓杂费查询逻辑

FeeValueMapper中增加如下内容

/**
* @author liubo
* @description 针对表【fee_value(杂项费用值表)】的数据库操作Mapper
* @createDate 2023-07-24 15:48:00
* @Entity com.atguigu.lease.model.FeeValue
*/
public interface FeeValueMapper extends BaseMapper<FeeValue> {


    List<FeeValueVo> selectListByApartmentId(Long id);
}

FeeValueMapper.xml中增加如下内容

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.atguigu.lease.web.admin.mapper.FeeValueMapper">

    <select id="selectListByApartmentId" resultType="com.atguigu.lease.web.admin.vo.fee.FeeValueVo">
        select
            fv.id,
            fv.name,
            fv.unit,
            fv.fee_key_id,
            fk.name as fee_key_name
        from fee_value fv
            join fee_key fk on fv.fee_key_id = fk.id
        where fv.is_deleted = 0 and fk.is_deleted = 0
         and fv.id in
             (select fee_value_id from apartment_fee_value where is_deleted = 0 and apartment_id = #{id})
    </select>
</mapper>
3.4、 根据ID删除公寓信息

查看接口

image-20240615232524882

编写Controller层逻辑

ApartmentController中增加如下内容

@Operation(summary = "根据id删除公寓信息")
@DeleteMapping("removeById")
public Result removeById(@RequestParam Long id) {
    apartmentInfoService.removeApartmentById(id);
    return Result.ok();
}

编写Service层逻辑

ApartmentInfoService中增加如下内容

/**
     * 根据id删除公寓信息
     * @param id
     */
void removeApartmentById(Long id);

ApartmentInfoServiceImpl中增加如下内容

@Autowired
private RoomInfoMapper roomInfoMapper;

/**
     * 根据id删除公寓信息
     *
     * @param id
     */
@Override
@Transactional
public void removeApartmentById(Long id) {

    //查询公寓内是否有房间
    LambdaQueryWrapper<RoomInfo> queryWrapper = new LambdaQueryWrapper<>();
    queryWrapper.eq(RoomInfo::getApartmentId,id);
    Long count = roomInfoMapper.selectCount(queryWrapper);

    if (count > 0){
        throw new LeaseException(ResultCodeEnum.ADMIN_APARMIN_APARTMENT_DELETE_ERROR);
    }

    //删除公寓
    super.removeById(id);


    //删除图片
    LambdaQueryWrapper<GraphInfo> graphInfoQueryWrapper = new LambdaQueryWrapper<>();
    graphInfoQueryWrapper.eq(GraphInfo::getItemType, ItemType.APARTMENT);
    graphInfoQueryWrapper.eq(GraphInfo::getItemId,id);
    graphInfoService.remove(graphInfoQueryWrapper);

    //删除配套列表
    LambdaQueryWrapper<ApartmentFacility> apartmentFacilityQueryWrapper = new LambdaQueryWrapper<>();
    apartmentFacilityQueryWrapper.eq(ApartmentFacility::getApartmentId,id);
    apartmentFacilityService.remove(apartmentFacilityQueryWrapper);

    //删除标签
    LambdaQueryWrapper<ApartmentLabel> apartmentLabelQueryWrapper = new LambdaQueryWrapper<>();
    apartmentLabelQueryWrapper.eq(ApartmentLabel::getApartmentId,id);
    apartmentLabelService.remove(apartmentLabelQueryWrapper);

    //删除杂费
    LambdaQueryWrapper<ApartmentFeeValue> apartmentFeeValueQueryWrapper = new LambdaQueryWrapper<>();
    apartmentFeeValueQueryWrapper.eq(ApartmentFeeValue::getApartmentId,id);
    apartmentFeeValueService.remove(apartmentFeeValueQueryWrapper);


}

知识点

由于公寓下会包含房间信息,因此在删除公寓时最好先判断一下该公寓下是否存在房间信息,若存在,则提醒用户先删除房间信息后再删除公寓信息,判断逻辑如下

LambdaQueryWrapper<RoomInfo> roomQueryWrapper = new LambdaQueryWrapper<>();
roomQueryWrapper.eq(RoomInfo::getApartmentId, id);
Long count = roomInfoMapper.selectCount(roomQueryWrapper);
if (count > 0) {
    //直接为前端返回如下响应:先删除房间信息再删除公寓信息
}

想要直接为前端返回响应,可利用前边配置的全局异常处理功能(此处直接抛出异常,全局异常处理器捕获到异常后,便会直接为前端返回响应结果)。

为灵活设置响应信息,可自定义异常类,如下

common模块创建com.atguigu.lease.common.exception.LeaseException类,内容如下:

@Data
public class LeaseException extends RuntimeException {

    //异常状态码
    private Integer code;
    /**
     * 通过状态码和错误消息创建异常对象
     * @param message
     * @param code
     */
    public LeaseException(String message, Integer code) {
        super(message);
        this.code = code;
    }

    /**
     * 根据响应结果枚举对象创建异常对象
     * @param resultCodeEnum
     */
    public LeaseException(ResultCodeEnum resultCodeEnum) {
        super(resultCodeEnum.getMessage());
        this.code = resultCodeEnum.getCode();
    }

    @Override
    public String toString() {
        return "LeaseException{" +
                "code=" + code +
                ", message=" + this.getMessage() +
                '}';
    }
}

common模块com.atguigu.lease.common.exception.GlobalExceptionHandler类中,增加自定义异常类的处理逻辑

@ExceptionHandler(LeaseException.class)
@ResponseBody
public Result error(LeaseException e){
    e.printStackTrace();
    return Result.fail(e.getCode(), e.getMessage());
}

为Result新增一个构造方法,如下

public static <T> Result<T> fail(Integer code, String message) {
    Result<T> result = build(null);
    result.setCode(code);
    result.setMessage(message);
    return result;
}
3.5、根据ID修改公寓发布状态

查看接口

image-20240615232925369

进行开发

ApartmentController中增加如下内容:

@Operation(summary = "根据id修改公寓发布状态")
@PostMapping("updateReleaseStatusById")
public Result updateReleaseStatusById(@RequestParam Long id, @RequestParam ReleaseStatus status) {
    LambdaQueryWrapper<ApartmentInfo> apartmentInfoQueryWrapper = new LambdaQueryWrapper<>();
    apartmentInfoQueryWrapper.eq(ApartmentInfo::getId,id);
    apartmentInfoQueryWrapper.eq(ApartmentInfo::getIsRelease,status);
    apartmentInfoService.update(apartmentInfoQueryWrapper);
    return Result.ok();
}
3.6、根据区县ID查询公寓信息列表

查看接口

image-20240615233103039

进行开发

ApartmentController中增加如下内容:

@Operation(summary = "根据区县id查询公寓信息列表")
@GetMapping("listInfoByDistrictId")
public Result<List<ApartmentInfo>> listInfoByDistrictId(@RequestParam Long id) {
    LambdaQueryWrapper<ApartmentInfo> apartmentInfoQueryWrapper = new LambdaQueryWrapper<>();
    apartmentInfoQueryWrapper.eq(ApartmentInfo::getDistrictId,id);
    List<ApartmentInfo> list = apartmentInfoService.list(apartmentInfoQueryWrapper);
    return Result.ok(list);
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/712973.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

Carsim高级开发:VS Connect通讯开发指南

文章目录 前言一、VS Connect 概念引入二、VS Connect 通讯框架三、Carsim 工程配置1、车辆模型配置2、procedure配置3、Run Control配置4、受控车辆名称配置 四、VS Connect Server代码1、打开Sln工程2、代码修改 五、VS Connect Client代码1、函数的调用关系2、carsim_variab…

【JAVA开发笔记】实战演练,如何用EasyExcel导出表格,并且自定义合并单元格

目录 1. 前言 2. EasyExcel简介 3. EasyExcel简单导出案例讲解 3.1 EasyExcel依赖引入 3.2 测试类创建 3.3 Excel导出实现 4. EasyExcel合并单元案例讲解 4.1 实现自定义合并策略 4.2 使用自定义合并策略 5. 总结 1. 前言 项目上&#xff0c;需将一个列表数据导出Ex…

16. 第十六章 类和函数

16. 类和函数 现在我们已经知道如何创建新的类型, 下一步是编写接收用户定义的对象作为参数或者将其当作结果用户定义的函数. 本章我会展示函数式编程风格, 以及两个新的程序开发计划.本章的代码示例可以从↓下载. https://github.com/AllenDowney/ThinkPython2/blob/master/c…

(源码)供应商电子招投标管理系统实现方案和功能说明

采购在线招投标供应商管理系统是一个集成了多个关键功能的综合性系统&#xff0c;旨在优化采购流程、提高效率和确保透明度。以下是关于您提到的五个核心功能的详细解释&#xff1a; 供应商管理 此功能允许企业记录和管理供应商的基本信息&#xff0c;如公司名称、联系方式、主…

了解并解决 Flutter 中的灰屏问题

生产中的 flutter 应用程序中的灰屏是一种通用占位符&#xff0c;当框架遇到问题无法渲染预期用户界面时就会显示。是的&#xff0c;所以基本上是出现问题时的后备指示器。 有趣的是&#xff0c;这只出现在发布模式下。在任何其他模式下运行都会显示红色错误屏幕&#xff0c;并…

apt-get update和apt-get upgrade的区别

apt-get update apt-get update 命令用于更新本地软件包列表。具体来说&#xff0c;做了以下事情&#xff1a; ①从 /etc/apt/sources.list 文件和 /etc/apt/sources.list.d/ 目录下的所有文件中读取软件源配置。 ②连接到这些软件源&#xff0c;并下载最新的软件包列表。 ③将…

前端老古董execCommand——操作 选中文本 样式

文章目录 ⭐前言⭐exe command api用法&#x1f496; example示例&#x1f496; 测试效果 ⭐execommand和getSelection 的联系⭐总结⭐结束 ⭐前言 大家好&#xff0c;我是yma16&#xff0c;本文分享关于 前端老古董execCommand——操作选中文本。 execommand 当一个 HTML 文…

【Linux】进程_4

文章目录 五、进程4. 进程状态5. 进程优先级6. 进程的调度和转换 未完待续 五、进程 4. 进程状态 当进程属于挂起状态时&#xff0c;进程的可执行程序代码和数据均会被从内存中换入到磁盘中&#xff0c;此时进程的PCB并没有消失&#xff0c;只要操作系统还需要管理这个进程&a…

ChatGPT关联技术

ChatGPT关联技术 一、前馈神经网络二、序列到序列模型&#xff08;Seq2Seq&#xff09;三、自注意力机制四、多头自注意力机制五、自监督学习六、Transformer模型七、语言生成技术八、多语种语言模型九、预训练语言模型十、生成式预训练模型&#xff08;GPT&#xff09;十一、近…

【odoo】odoo.conf文件配置

概要 odoo.conf 文件是 Odoo 服务器的配置文件&#xff0c;它用于定义和管理 Odoo 运行时的各种参数。这个文件包含了许多配置选项&#xff0c;可以帮助管理员根据特定的需求和环境来调整 Odoo 服务器的行为。 主要功能 数据库连接设置&#xff1a;定义 Odoo 连接到 PostgreSQL…

使用tkinter创建带有图标的菜单栏

使用tkinter创建带有图标的菜单栏 效果代码代码解析创建主窗口加载图标创建菜单栏添加文件菜单添加带图标的菜单项 Tkinter 的默认菜单外观较为简单&#xff0c;可以通过自定义和添加图标&#xff0c;让菜单显示更好看。 效果 代码 import tkinter as tk from tkinter import …

【SpringBoot】SpringBoot:构建安全的Web应用程序

文章目录 引言为什么需要安全Spring Security概述配置Spring Security添加依赖基本配置 用户认证创建用户实体类创建用户存储库自定义用户服务更新安全配置 用户授权更新用户实体类更新自定义用户服务更新安全配置 防护措施防止SQL注入使用参数化查询 防止跨站脚本&#xff08;…

Java17 --- RabbitMQ之插件使用

目录 一、Federation插件 1.1、运行两个rabbitmq实例 1.2、启用插件 1.3、在下游端点添加上游端点 1.4、创建策略 1.6、测试 二、联邦队列 2.1、创建策略 2.2、创建交换机与队列 2.2.1、创建52000的队列与交换机 2.2.2、创建62000的队列 三、Shovel 3.1、启…

WNR最便捷美观的开源桌面计时器工具

华丽外观&#xff0c;功能全面。工作和休息的完美计时器。跨平台支持&#xff0c;无论是Windows、Mac还是Linux&#xff0c;WNR都能轻松驾驭。 超强全屏专注模式 对于寻找高效工作/休息管理工具却屡屡受挫的用户&#xff0c;WNR的“全屏专注模式”无疑是终极解决方案。它确保在…

Android 蓝牙配对Settings应用里面的简要流程记录

Android 蓝牙配对Settings应用里面的简要流程记录 文章目录 Android 蓝牙配对Settings应用里面的简要流程记录一、前言二、Settings蓝牙配对的关键代码1、接收蓝牙请求的地方 AndroidManifest.xml2、BluetoothPairingRequest3、BluetoothPairingService4、BluetoothPairingDial…

利用机器学习重构视频中的人脸

引言 中国与英国的研究团队携手合作&#xff0c;开创了一种创新的视频面孔重塑技术。这项技术能够以极高的一致性对视频中的面部结构进行逼真的放大和缩小&#xff0c;且避免了常见伪影的产生。 从研究人员选取的YouTube视频样例中可见&#xff0c;经过处理后&#xff0c;女演…

LC1020:飞地的数量

题目 给你一个大小为 m x n 的二进制矩阵 grid &#xff0c;其中 0 表示一个海洋单元格、1 表示一个陆地单元格。 一次 移动 是指从一个陆地单元格走到另一个相邻&#xff08;上、下、左、右&#xff09;的陆地单元格或跨过 grid 的边界。 返回网格中 无法 在任意次数的移动…

在ubuntu中启动docker的mysql8镜像

首先查看docker是否启动&#xff1a; docker ps #出现信息就是启动成功 启动命令&#xff1a; sudo systemctl start docker 设置开机自启&#xff1a; sudo systemctl enable docker 查询下载好的mysql8的镜像文件&#xff1a; docker images 在启动查询好的镜像文件&#…

Oracle--19C在Centos7上的静默安装(rpm版)

一、Oracle 19c Linux安装&#xff08;Centos 7&#xff09; 1.查看磁盘可用空间及配置ip地址 [rootlocalhost /]# df -h 文件系统 容量 已用 可用 已用% 挂载点 devtmpfs 1.4G 0 1.4G 0% /dev tmpfs 1.4G …

【Pytorch】一文向您详细介绍 model.eval() 的作用和用法

【Pytorch】一文向您详细介绍 model.eval() 的作用和用法 下滑查看解决方法 &#x1f308; 欢迎莅临我的个人主页 &#x1f448;这里是我静心耕耘深度学习领域、真诚分享知识与智慧的小天地&#xff01;&#x1f387; &#x1f393; 博主简介&#xff1a;985高校的普通本硕…