linwe
2024-01-27 86433cc96873653f1b3581608bf6b6bb58ebc216
隐患记录
9 files added
538 ■■■■■ changed files
src/main/java/org/springblade/modules/hiddenDangerRecord/controller/HiddenDangerRecordController.java 137 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/hiddenDangerRecord/dto/HiddenDangerRecordDTO.java 34 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/hiddenDangerRecord/entity/HiddenDangerRecordEntity.java 126 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/hiddenDangerRecord/mapper/HiddenDangerRecordMapper.java 43 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/hiddenDangerRecord/mapper/HiddenDangerRecordMapper.xml 15 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/hiddenDangerRecord/service/IHiddenDangerRecordService.java 44 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/hiddenDangerRecord/service/impl/HiddenDangerRecordServiceImpl.java 54 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/hiddenDangerRecord/vo/HiddenDangerRecordVO.java 35 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/hiddenDangerRecord/wrapper/HiddenDangerRecordWrapper.java 50 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/hiddenDangerRecord/controller/HiddenDangerRecordController.java
New file
@@ -0,0 +1,137 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.hiddenDangerRecord.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import javax.validation.Valid;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.hiddenDangerRecord.entity.HiddenDangerRecordEntity;
import org.springblade.modules.hiddenDangerRecord.vo.HiddenDangerRecordVO;
import org.springblade.modules.hiddenDangerRecord.wrapper.HiddenDangerRecordWrapper;
import org.springblade.modules.hiddenDangerRecord.service.IHiddenDangerRecordService;
import org.springblade.core.boot.ctrl.BladeController;
/**
 * 隐患记录表 控制器
 *
 * @author BladeX
 * @since 2024-01-27
 */
@RestController
@AllArgsConstructor
@RequestMapping("blade-hiddenDangerRecord/hiddenDangerRecord")
@Api(value = "隐患记录表", tags = "隐患记录表接口")
public class HiddenDangerRecordController extends BladeController {
    private final IHiddenDangerRecordService hiddenDangerRecordService;
    /**
     * 隐患记录表 详情
     */
    @GetMapping("/detail")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "详情", notes = "传入hiddenDangerRecord")
    public R<HiddenDangerRecordVO> detail(HiddenDangerRecordEntity hiddenDangerRecord) {
        HiddenDangerRecordEntity detail = hiddenDangerRecordService.getOne(Condition.getQueryWrapper(hiddenDangerRecord));
        return R.data(HiddenDangerRecordWrapper.build().entityVO(detail));
    }
    /**
     * 隐患记录表 分页
     */
    @GetMapping("/list")
    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "分页", notes = "传入hiddenDangerRecord")
    public R<IPage<HiddenDangerRecordVO>> list(HiddenDangerRecordEntity hiddenDangerRecord, Query query) {
        IPage<HiddenDangerRecordEntity> pages = hiddenDangerRecordService.page(Condition.getPage(query), Condition.getQueryWrapper(hiddenDangerRecord));
        return R.data(HiddenDangerRecordWrapper.build().pageVO(pages));
    }
    /**
     * 隐患记录表 自定义分页
     */
    @GetMapping("/page")
    @ApiOperationSupport(order = 3)
    @ApiOperation(value = "分页", notes = "传入hiddenDangerRecord")
    public R<IPage<HiddenDangerRecordVO>> page(HiddenDangerRecordVO hiddenDangerRecord, Query query) {
        IPage<HiddenDangerRecordVO> pages = hiddenDangerRecordService.selectHiddenDangerRecordPage(Condition.getPage(query), hiddenDangerRecord);
        return R.data(pages);
    }
    /**
     * 隐患记录表 新增
     */
    @PostMapping("/save")
    @ApiOperationSupport(order = 4)
    @ApiOperation(value = "新增", notes = "传入hiddenDangerRecord")
    public R save(@Valid @RequestBody HiddenDangerRecordEntity hiddenDangerRecord) {
        return R.status(hiddenDangerRecordService.save(hiddenDangerRecord));
    }
    /**
     * 隐患记录表 修改
     */
    @PostMapping("/update")
    @ApiOperationSupport(order = 5)
    @ApiOperation(value = "修改", notes = "传入hiddenDangerRecord")
    public R update(@Valid @RequestBody HiddenDangerRecordEntity hiddenDangerRecord) {
        return R.status(hiddenDangerRecordService.updateById(hiddenDangerRecord));
    }
    /**
     * 隐患记录表 新增或修改
     */
    @PostMapping("/submit")
    @ApiOperationSupport(order = 6)
    @ApiOperation(value = "新增或修改", notes = "传入hiddenDangerRecord")
    public R submit(@Valid @RequestBody HiddenDangerRecordEntity hiddenDangerRecord) {
        return R.status(hiddenDangerRecordService.saveOrUpdate(hiddenDangerRecord));
    }
    /**
     * 隐患记录表 删除
     */
    @PostMapping("/remove")
    @ApiOperationSupport(order = 7)
    @ApiOperation(value = "逻辑删除", notes = "传入ids")
    public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
        return R.status(hiddenDangerRecordService.removeBatchByIds(Func.toLongList(ids)));
    }
    /**
     * 隐患记录表 新增
     */
    @PostMapping("/add")
    @ApiOperationSupport(order = 8)
    @ApiOperation(value = "扫码新增", notes = "传入hiddenDangerRecord")
    public R add(@Valid @RequestBody HiddenDangerRecordEntity hiddenDangerRecord) {
        return R.status(hiddenDangerRecordService.add(hiddenDangerRecord));
    }
}
src/main/java/org/springblade/modules/hiddenDangerRecord/dto/HiddenDangerRecordDTO.java
New file
@@ -0,0 +1,34 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.hiddenDangerRecord.dto;
import org.springblade.modules.hiddenDangerRecord.entity.HiddenDangerRecordEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
 * 隐患记录表 数据传输对象实体类
 *
 * @author BladeX
 * @since 2024-01-27
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class HiddenDangerRecordDTO extends HiddenDangerRecordEntity {
    private static final long serialVersionUID = 1L;
}
src/main/java/org/springblade/modules/hiddenDangerRecord/entity/HiddenDangerRecordEntity.java
New file
@@ -0,0 +1,126 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.hiddenDangerRecord.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
 * 隐患记录表 实体类
 *
 * @author BladeX
 * @since 2024-01-27
 */
@Data
@TableName("jczz_hidden_danger_record")
@ApiModel(value = "HiddenDangerRecord对象", description = "隐患记录表")
public class HiddenDangerRecordEntity {
    private static final long serialVersionUID = 1L;
    /**
     * id
     */
    @ApiModelProperty(value = "主键ID", example = "")
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private Long id;
    /**
     * 警务网格编码
     */
    @ApiModelProperty(value = "警务网格编码", example = "")
    @TableField("jwwg_code")
    private String jwwgCode;
    /**
     * 社区编码
     */
    @ApiModelProperty(value = "社区编码", example = "")
    @TableField("nei_code")
    private String neiCode;
    /**
     * 房屋编码
     */
    @ApiModelProperty(value = "房屋编码", example = "")
    @TableField("house_code")
    private String houseCode;
    /**
     * 名称
     */
    @ApiModelProperty(value = "名称", example = "")
    @TableField("name")
    private String name;
    /**
     * 手机号
     */
    @ApiModelProperty(value = "手机号", example = "")
    @TableField("phone")
    private String phone;
    /**
     * 描述
     */
    @ApiModelProperty(value = "描述", example = "")
    @TableField("remark")
    private String remark;
    /**
     * 图片
     */
    @ApiModelProperty(value = "图片", example = "")
    @TableField("img_url")
    private String imgUrl;
    /**
     * 0:否 1:是
     */
    @ApiModelProperty(value = "0:否 1:是", example = "")
    @TableField("delete_flag")
    private Integer deleteFlag;
    /**
     * 创建时间
     */
    @ApiModelProperty(value = "创建时间", example = "")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField(value = "create_time",fill = FieldFill.INSERT)
    private Date createTime;
    /**
     * 更新时间
     */
    @ApiModelProperty(value = "更新时间", example = "")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField(value = "update_time",fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;
    /**
     * 状态:
     */
    @ApiModelProperty(value = "状态:", example = "")
    @TableField("status")
    private Integer status;
}
src/main/java/org/springblade/modules/hiddenDangerRecord/mapper/HiddenDangerRecordMapper.java
New file
@@ -0,0 +1,43 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.hiddenDangerRecord.mapper;
import org.springblade.modules.hiddenDangerRecord.entity.HiddenDangerRecordEntity;
import org.springblade.modules.hiddenDangerRecord.vo.HiddenDangerRecordVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
/**
 * 隐患记录表 Mapper 接口
 *
 * @author BladeX
 * @since 2024-01-27
 */
public interface HiddenDangerRecordMapper extends BaseMapper<HiddenDangerRecordEntity> {
    /**
     * 自定义分页
     *
     * @param page
     * @param hiddenDangerRecord
     * @return
     */
    List<HiddenDangerRecordVO> selectHiddenDangerRecordPage(IPage page, HiddenDangerRecordVO hiddenDangerRecord);
}
src/main/java/org/springblade/modules/hiddenDangerRecord/mapper/HiddenDangerRecordMapper.xml
New file
@@ -0,0 +1,15 @@
<?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="org.springblade.modules.hiddenDangerRecord.mapper.HiddenDangerRecordMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="hiddenDangerRecordResultMap" type="org.springblade.modules.hiddenDangerRecord.entity.HiddenDangerRecordEntity">
    </resultMap>
    <select id="selectHiddenDangerRecordPage" resultMap="hiddenDangerRecordResultMap">
        select * from jczz_hidden_danger_record where is_deleted = 0
    </select>
</mapper>
src/main/java/org/springblade/modules/hiddenDangerRecord/service/IHiddenDangerRecordService.java
New file
@@ -0,0 +1,44 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.hiddenDangerRecord.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springblade.modules.hiddenDangerRecord.entity.HiddenDangerRecordEntity;
import org.springblade.modules.hiddenDangerRecord.vo.HiddenDangerRecordVO;
import org.springblade.core.mp.base.BaseService;
import com.baomidou.mybatisplus.core.metadata.IPage;
/**
 * 隐患记录表 服务类
 *
 * @author BladeX
 * @since 2024-01-27
 */
public interface IHiddenDangerRecordService extends IService<HiddenDangerRecordEntity> {
    /**
     * 自定义分页
     *
     * @param page
     * @param hiddenDangerRecord
     * @return
     */
    IPage<HiddenDangerRecordVO> selectHiddenDangerRecordPage(IPage<HiddenDangerRecordVO> page, HiddenDangerRecordVO hiddenDangerRecord);
    Boolean add(HiddenDangerRecordEntity hiddenDangerRecord);
}
src/main/java/org/springblade/modules/hiddenDangerRecord/service/impl/HiddenDangerRecordServiceImpl.java
New file
@@ -0,0 +1,54 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.hiddenDangerRecord.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springblade.common.utils.SpringUtils;
import org.springblade.modules.doorplateAddress.entity.DoorplateAddressEntity;
import org.springblade.modules.doorplateAddress.service.IDoorplateAddressService;
import org.springblade.modules.hiddenDangerRecord.entity.HiddenDangerRecordEntity;
import org.springblade.modules.hiddenDangerRecord.mapper.HiddenDangerRecordMapper;
import org.springblade.modules.hiddenDangerRecord.service.IHiddenDangerRecordService;
import org.springblade.modules.hiddenDangerRecord.vo.HiddenDangerRecordVO;
import org.springframework.stereotype.Service;
/**
 * 隐患记录表 服务实现类
 *
 * @author BladeX
 * @since 2024-01-27
 */
@Service
public class HiddenDangerRecordServiceImpl extends ServiceImpl<HiddenDangerRecordMapper, HiddenDangerRecordEntity> implements IHiddenDangerRecordService {
    @Override
    public IPage<HiddenDangerRecordVO> selectHiddenDangerRecordPage(IPage<HiddenDangerRecordVO> page, HiddenDangerRecordVO hiddenDangerRecord) {
        return page.setRecords(baseMapper.selectHiddenDangerRecordPage(page, hiddenDangerRecord));
    }
    @Override
    public Boolean add(HiddenDangerRecordEntity hiddenDangerRecord) {
        IDoorplateAddressService bean = SpringUtils.getBean(IDoorplateAddressService.class);
        DoorplateAddressEntity one = bean.getOne(Wrappers.<DoorplateAddressEntity>lambdaQuery()
            .eq(DoorplateAddressEntity::getAddressCode, hiddenDangerRecord.getHouseCode()));
        hiddenDangerRecord.setJwwgCode(one.getJwwgCode());
        hiddenDangerRecord.setNeiCode(one.getNeiCode());
        return save(hiddenDangerRecord);
    }
}
src/main/java/org/springblade/modules/hiddenDangerRecord/vo/HiddenDangerRecordVO.java
New file
@@ -0,0 +1,35 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.hiddenDangerRecord.vo;
import org.springblade.modules.hiddenDangerRecord.entity.HiddenDangerRecordEntity;
import org.springblade.core.tool.node.INode;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
 * 隐患记录表 视图实体类
 *
 * @author BladeX
 * @since 2024-01-27
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class HiddenDangerRecordVO extends HiddenDangerRecordEntity {
    private static final long serialVersionUID = 1L;
}
src/main/java/org/springblade/modules/hiddenDangerRecord/wrapper/HiddenDangerRecordWrapper.java
New file
@@ -0,0 +1,50 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.hiddenDangerRecord.wrapper;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.modules.hiddenDangerRecord.entity.HiddenDangerRecordEntity;
import org.springblade.modules.hiddenDangerRecord.vo.HiddenDangerRecordVO;
import java.util.Objects;
/**
 * 隐患记录表 包装类,返回视图层所需的字段
 *
 * @author BladeX
 * @since 2024-01-27
 */
public class HiddenDangerRecordWrapper extends BaseEntityWrapper<HiddenDangerRecordEntity, HiddenDangerRecordVO>  {
    public static HiddenDangerRecordWrapper build() {
        return new HiddenDangerRecordWrapper();
     }
    @Override
    public HiddenDangerRecordVO entityVO(HiddenDangerRecordEntity hiddenDangerRecord) {
        HiddenDangerRecordVO hiddenDangerRecordVO = Objects.requireNonNull(BeanUtil.copy(hiddenDangerRecord, HiddenDangerRecordVO.class));
        //User createUser = UserCache.getUser(hiddenDangerRecord.getCreateUser());
        //User updateUser = UserCache.getUser(hiddenDangerRecord.getUpdateUser());
        //hiddenDangerRecordVO.setCreateUserName(createUser.getName());
        //hiddenDangerRecordVO.setUpdateUserName(updateUser.getName());
        return hiddenDangerRecordVO;
    }
}