首页公告管理

This commit is contained in:
XaoLi717 2024-09-19 11:48:25 +08:00
parent 8c15c22455
commit 33a7baf58d
13 changed files with 718 additions and 49 deletions

View File

@ -12,4 +12,6 @@ public interface ErrorCodeConstants {
ErrorCode DATA_INFO_NOT_EXISTS = new ErrorCode(1_009_001_000, "首页数据统计不存在"); ErrorCode DATA_INFO_NOT_EXISTS = new ErrorCode(1_009_001_000, "首页数据统计不存在");
// ========== 主要用于首页的项目数据 1_009_002_000 ========== // ========== 主要用于首页的项目数据 1_009_002_000 ==========
ErrorCode PJ_NOT_EXISTS = new ErrorCode(1_009_002_000, "主要用于首页的项目数据不存在"); ErrorCode PJ_NOT_EXISTS = new ErrorCode(1_009_002_000, "主要用于首页的项目数据不存在");
// ========== 公告内容 1_009_003_000 ==========
ErrorCode IMG_NOT_EXISTS = new ErrorCode(1_009_003_000, "公告内容不存在");
} }

View File

@ -0,0 +1,95 @@
package cn.iocoder.yudao.module.home.controller.admin.homeimg;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.home.controller.admin.homeimg.vo.*;
import cn.iocoder.yudao.module.home.dal.dataobject.homeimg.HomeimgDO;
import cn.iocoder.yudao.module.home.service.homeimg.HomeimgService;
@Tag(name = "管理后台 - 公告管理")
@RestController
@RequestMapping("/home/img")
@Validated
public class HomeimgController {
@Resource
private HomeimgService imgService;
@PostMapping("/create")
@Operation(summary = "创建公告管理")
@PreAuthorize("@ss.hasPermission('home:img:create')")
public CommonResult<Long> createimg(@Valid @RequestBody HomeimgSaveReqVO createReqVO) {
return success(imgService.createimg(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新公告管理")
@PreAuthorize("@ss.hasPermission('home:img:update')")
public CommonResult<Boolean> updateimg(@Valid @RequestBody HomeimgSaveReqVO updateReqVO) {
imgService.updateimg(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除公告管理")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('home:img:delete')")
public CommonResult<Boolean> deleteimg(@RequestParam("id") Long id) {
imgService.deleteimg(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得公告管理")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('home:img:query')")
public CommonResult<HomeimgRespVO> getimg(@RequestParam("id") Long id) {
HomeimgDO img = imgService.getimg(id);
return success(BeanUtils.toBean(img, HomeimgRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得公告管理分页")
@PreAuthorize("@ss.hasPermission('home:img:query')")
public CommonResult<PageResult<HomeimgRespVO>> getimgPage(@Valid HomeimgPageReqVO pageReqVO) {
PageResult<HomeimgDO> pageResult = imgService.getimgPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, HomeimgRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出公告管理 Excel")
@PreAuthorize("@ss.hasPermission('home:img:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportimgExcel(@Valid HomeimgPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<HomeimgDO> list = imgService.getimgPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "公告管理.xls", "数据", HomeimgRespVO.class,
BeanUtils.toBean(list, HomeimgRespVO.class));
}
}

View File

@ -0,0 +1,48 @@
package cn.iocoder.yudao.module.home.controller.admin.homeimg.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 公告管理分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class HomeimgPageReqVO extends PageParam {
@Schema(description = "公告id", example = "17311")
private Long imgId;
@Schema(description = "公告名称", example = "李四")
private String imgName;
@Schema(description = "发布时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] imgCreatetime;
@Schema(description = "轮换图片")
// private String[] imgImg;
private String imgImg;
@Schema(description = "发布内容")
private String imgContent;
@Schema(description = "公告分类", example = "2")
private Integer contentType;
@Schema(description = "公告图片状态", example = "1")
private Integer imgStatus;
@Schema(description = "公告状态", example = "1")
private Integer contentStatus;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -0,0 +1,57 @@
package cn.iocoder.yudao.module.home.controller.admin.homeimg.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
@Schema(description = "管理后台 - 公告管理 Response VO")
@Data
@ExcelIgnoreUnannotated
public class HomeimgRespVO {
@Schema(description = "公告id", requiredMode = Schema.RequiredMode.REQUIRED, example = "17311")
@ExcelProperty("公告id")
private Long imgId;
@Schema(description = "公告名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
@ExcelProperty("公告名称")
private String imgName;
@Schema(description = "发布时间")
@ExcelProperty("发布时间")
private LocalDateTime imgCreatetime;
@Schema(description = "轮换图片", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("轮换图片")
// private String[] imgImg;
private String imgImg;
@Schema(description = "发布内容")
@ExcelProperty("发布内容")
private String imgContent;
@Schema(description = "公告分类", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@ExcelProperty(value = "公告分类", converter = DictConvert.class)
@DictFormat("home_content_status") // TODO 代码优化建议设置到对应的 DictTypeConstants 枚举类中
private Integer contentType;
@Schema(description = "公告图片状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty(value = "公告图片状态", converter = DictConvert.class)
@DictFormat("home_img_status") // TODO 代码优化建议设置到对应的 DictTypeConstants 枚举类中
private Integer imgStatus;
@Schema(description = "公告状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty(value = "公告状态", converter = DictConvert.class)
@DictFormat("home_content") // TODO 代码优化建议设置到对应的 DictTypeConstants 枚举类中
private Integer contentStatus;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,44 @@
package cn.iocoder.yudao.module.home.controller.admin.homeimg.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 公告管理新增/修改 Request VO")
@Data
public class HomeimgSaveReqVO {
@Schema(description = "公告id", requiredMode = Schema.RequiredMode.REQUIRED, example = "17311")
private Long imgId;
@Schema(description = "公告名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
@NotEmpty(message = "公告名称不能为空")
private String imgName;
@Schema(description = "发布时间")
private LocalDateTime imgCreatetime;
@Schema(description = "轮换图片", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "轮换图片不能为空")
// private String[] imgImg;
private String imgImg;
@Schema(description = "发布内容")
private String imgContent;
@Schema(description = "公告分类", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@NotNull(message = "公告分类不能为空")
private Integer contentType;
@Schema(description = "公告图片状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "公告图片状态不能为空")
private Integer imgStatus;
@Schema(description = "公告状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "公告状态不能为空")
private Integer contentStatus;
}

View File

@ -0,0 +1,67 @@
package cn.iocoder.yudao.module.home.dal.dataobject.homeimg;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/**
* 公告管理 DO
*
* @author xaol
*/
@TableName("des_homeimg")
@KeySequence("des_homeimg_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class HomeimgDO extends BaseDO {
/**
* 公告id
*/
@TableId
private Long imgId;
/**
* 公告名称
*/
private String imgName;
/**
* 发布时间
*/
private LocalDateTime imgCreatetime;
/**
* 轮换图片
*/
// private String[] imgImg;
private String imgImg;
/**
* 发布内容
*/
private String imgContent;
/**
* 公告分类
*
* 枚举 {@link TODO home_content_status 对应的类}
*/
private Integer contentType;
/**
* 公告图片状态
*
* 枚举 {@link TODO home_img_status 对应的类}
*/
private Integer imgStatus;
/**
* 公告状态
*
* 枚举 {@link TODO home_content 对应的类}
*/
private Integer contentStatus;
}

View File

@ -0,0 +1,34 @@
package cn.iocoder.yudao.module.home.dal.mysql.homeimg;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.home.dal.dataobject.homeimg.HomeimgDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.home.controller.admin.homeimg.vo.*;
/**
* 公告管理 Mapper
*
* @author xaol
*/
@Mapper
public interface HomeimgMapper extends BaseMapperX<HomeimgDO> {
default PageResult<HomeimgDO> selectPage(HomeimgPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<HomeimgDO>()
.eqIfPresent(HomeimgDO::getImgId, reqVO.getImgId())
.likeIfPresent(HomeimgDO::getImgName, reqVO.getImgName())
.betweenIfPresent(HomeimgDO::getImgCreatetime, reqVO.getImgCreatetime())
.eqIfPresent(HomeimgDO::getImgImg, reqVO.getImgImg())
.eqIfPresent(HomeimgDO::getImgContent, reqVO.getImgContent())
.eqIfPresent(HomeimgDO::getContentType, reqVO.getContentType())
.eqIfPresent(HomeimgDO::getImgStatus, reqVO.getImgStatus())
.eqIfPresent(HomeimgDO::getContentStatus, reqVO.getContentStatus())
.betweenIfPresent(HomeimgDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(HomeimgDO::getImgId));
}
}

View File

@ -0,0 +1,55 @@
package cn.iocoder.yudao.module.home.service.homeimg;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.module.home.controller.admin.homeimg.vo.*;
import cn.iocoder.yudao.module.home.dal.dataobject.homeimg.HomeimgDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
/**
* 公告管理 Service 接口
*
* @author xaol
*/
public interface HomeimgService {
/**
* 创建公告管理
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createimg(@Valid HomeimgSaveReqVO createReqVO);
/**
* 更新公告管理
*
* @param updateReqVO 更新信息
*/
void updateimg(@Valid HomeimgSaveReqVO updateReqVO);
/**
* 删除公告管理
*
* @param id 编号
*/
void deleteimg(Long id);
/**
* 获得公告管理
*
* @param id 编号
* @return 公告管理
*/
HomeimgDO getimg(Long id);
/**
* 获得公告管理分页
*
* @param pageReqVO 分页查询
* @return 公告管理分页
*/
PageResult<HomeimgDO> getimgPage(HomeimgPageReqVO pageReqVO);
}

View File

@ -0,0 +1,74 @@
package cn.iocoder.yudao.module.home.service.homeimg;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import cn.iocoder.yudao.module.home.controller.admin.homeimg.vo.*;
import cn.iocoder.yudao.module.home.dal.dataobject.homeimg.HomeimgDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.home.dal.mysql.homeimg.HomeimgMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.home.enums.ErrorCodeConstants.*;
/**
* 公告管理 Service 实现类
*
* @author xaol
*/
@Service
@Validated
public class HomeimgServiceImpl implements HomeimgService {
@Resource
private HomeimgMapper imgMapper;
@Override
public Long createimg(HomeimgSaveReqVO createReqVO) {
// 插入
HomeimgDO img = BeanUtils.toBean(createReqVO, HomeimgDO.class);
imgMapper.insert(img);
// 返回
return img.getImgId();
}
@Override
public void updateimg(HomeimgSaveReqVO updateReqVO) {
// 校验存在
validateimgExists(updateReqVO.getImgId());
// 更新
HomeimgDO updateObj = BeanUtils.toBean(updateReqVO, HomeimgDO.class);
imgMapper.updateById(updateObj);
}
@Override
public void deleteimg(Long id) {
// 校验存在
validateimgExists(id);
// 删除
imgMapper.deleteById(id);
}
private void validateimgExists(Long id) {
if (imgMapper.selectById(id) == null) {
throw exception(IMG_NOT_EXISTS);
}
}
@Override
public HomeimgDO getimg(Long id) {
return imgMapper.selectById(id);
}
@Override
public PageResult<HomeimgDO> getimgPage(HomeimgPageReqVO pageReqVO) {
return imgMapper.selectPage(pageReqVO);
}
}

View File

@ -0,0 +1,12 @@
<?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="cn.iocoder.yudao.module.home.dal.mysql.homeimg.HomeimgMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

View File

@ -0,0 +1,162 @@
package cn.iocoder.yudao.module.home.service.homeimg;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.mock.mockito.MockBean;
import javax.annotation.Resource;
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
import cn.iocoder.yudao.module.home.controller.admin.homeimg.vo.*;
import cn.iocoder.yudao.module.home.dal.dataobject.homeimg.HomeimgDO;
import cn.iocoder.yudao.module.home.dal.mysql.homeimg.HomeimgMapper;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import javax.annotation.Resource;
import org.springframework.context.annotation.Import;
import java.util.*;
import java.time.LocalDateTime;
import static cn.hutool.core.util.RandomUtil.*;
import static cn.iocoder.yudao.module.home.enums.ErrorCodeConstants.*;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*;
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.*;
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Mockito.*;
/**
* {@link HomeimgServiceImpl} 的单元测试类
*
* @author xaol
*/
@Import(HomeimgServiceImpl.class)
public class HomeimgServiceImplTest extends BaseDbUnitTest {
@Resource
private HomeimgServiceImpl imgService;
@Resource
private HomeimgMapper imgMapper;
@Test
public void testCreateimg_success() {
// 准备参数
HomeimgSaveReqVO createReqVO = randomPojo(HomeimgSaveReqVO.class).setImgId(null);
// 调用
Long imgId = imgService.createimg(createReqVO);
// 断言
assertNotNull(imgId);
// 校验记录的属性是否正确
HomeimgDO img = imgMapper.selectById(imgId);
assertPojoEquals(createReqVO, img, "id");
}
@Test
public void testUpdateimg_success() {
// mock 数据
HomeimgDO dbimg = randomPojo(HomeimgDO.class);
imgMapper.insert(dbimg);// @Sql: 先插入出一条存在的数据
// 准备参数
HomeimgSaveReqVO updateReqVO = randomPojo(HomeimgSaveReqVO.class, o -> {
o.setImgId(dbimg.getImgId()); // 设置更新的 ID
});
// 调用
imgService.updateimg(updateReqVO);
// 校验是否更新正确
HomeimgDO img = imgMapper.selectById(updateReqVO.getImgId()); // 获取最新的
assertPojoEquals(updateReqVO, img);
}
@Test
public void testUpdateimg_notExists() {
// 准备参数
HomeimgSaveReqVO updateReqVO = randomPojo(HomeimgSaveReqVO.class);
// 调用, 并断言异常
assertServiceException(() -> imgService.updateimg(updateReqVO), IMG_NOT_EXISTS);
}
@Test
public void testDeleteimg_success() {
// mock 数据
HomeimgDO dbimg = randomPojo(HomeimgDO.class);
imgMapper.insert(dbimg);// @Sql: 先插入出一条存在的数据
// 准备参数
Long id = dbimg.getImgId();
// 调用
imgService.deleteimg(id);
// 校验数据不存在了
assertNull(imgMapper.selectById(id));
}
@Test
public void testDeleteimg_notExists() {
// 准备参数
Long id = randomLongId();
// 调用, 并断言异常
assertServiceException(() -> imgService.deleteimg(id), IMG_NOT_EXISTS);
}
@Test
@Disabled // TODO 请修改 null 为需要的值然后删除 @Disabled 注解
public void testGetimgPage() {
// mock 数据
HomeimgDO dbimg = randomPojo(HomeimgDO.class, o -> { // 等会查询到
o.setImgId(null);
o.setImgName(null);
o.setImgCreatetime(null);
o.setImgImg(null);
o.setImgContent(null);
o.setContentType(null);
o.setImgStatus(null);
o.setContentStatus(null);
o.setCreateTime(null);
});
imgMapper.insert(dbimg);
// 测试 imgId 不匹配
imgMapper.insert(cloneIgnoreId(dbimg, o -> o.setImgId(null)));
// 测试 imgName 不匹配
imgMapper.insert(cloneIgnoreId(dbimg, o -> o.setImgName(null)));
// 测试 imgCreatetime 不匹配
imgMapper.insert(cloneIgnoreId(dbimg, o -> o.setImgCreatetime(null)));
// 测试 imgImg 不匹配
imgMapper.insert(cloneIgnoreId(dbimg, o -> o.setImgImg(null)));
// 测试 imgContent 不匹配
imgMapper.insert(cloneIgnoreId(dbimg, o -> o.setImgContent(null)));
// 测试 contentType 不匹配
imgMapper.insert(cloneIgnoreId(dbimg, o -> o.setContentType(null)));
// 测试 imgStatus 不匹配
imgMapper.insert(cloneIgnoreId(dbimg, o -> o.setImgStatus(null)));
// 测试 contentStatus 不匹配
imgMapper.insert(cloneIgnoreId(dbimg, o -> o.setContentStatus(null)));
// 测试 createTime 不匹配
imgMapper.insert(cloneIgnoreId(dbimg, o -> o.setCreateTime(null)));
// 准备参数
HomeimgPageReqVO reqVO = new HomeimgPageReqVO();
reqVO.setImgId(null);
reqVO.setImgName(null);
reqVO.setImgCreatetime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
reqVO.setImgImg(null);
reqVO.setImgContent(null);
reqVO.setContentType(null);
reqVO.setImgStatus(null);
reqVO.setContentStatus(null);
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
// 调用
PageResult<HomeimgDO> pageResult = imgService.getimgPage(reqVO);
// 断言
assertEquals(1, pageResult.getTotal());
assertEquals(1, pageResult.getList().size());
assertPojoEquals(dbimg, pageResult.getList().get(0));
}
}

View File

@ -1,47 +1,4 @@
CREATE TABLE IF NOT EXISTS "des_datainfo" ( DELETE FROM "des_datainfo";
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY, DELETE FROM "des_homePJ";
"info_year" varchar NOT NULL, DELETE FROM "des_homeimg";
"info_co2e" int NOT NULL,
"info_water" int NOT NULL,
"info_castoff" int,
"info_coai" int,
"info_pollution" int NOT NULL,
"info_ecom" int NOT NULL,
"info_staff" int,
"info_training" int NOT NULL,
"info_rd" int NOT NULL,
"info_probono" int,
"info_insurance" int,
"info_violate" int,
"info_guarantee" int,
"info_money" bigint,
"info_environment" int NOT NULL,
"info_society" int NOT NULL,
"info_govern" int NOT NULL,
"creator" varchar DEFAULT '',
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updater" varchar DEFAULT '',
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
"deleted" bit NOT NULL DEFAULT FALSE,
"tenant_id" bigint NOT NULL,
PRIMARY KEY ("id")
) COMMENT '数据收集';
CREATE TABLE IF NOT EXISTS "des_homepj" (
"pjId" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"pj_name" varchar NOT NULL,
"pj_done" int NOT NULL,
"pj_describe" varchar NOT NULL,
"pj_content" varchar,
"pj_type" int NOT NULL,
"pj_etime" varchar,
"pj_vtime" varchar,
"pj_dept" int NOT NULL,
"pj_number" bigint NOT NULL,
"creator" varchar DEFAULT '',
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updater" varchar DEFAULT '',
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
"deleted" bit NOT NULL DEFAULT FALSE,
"tenant_id" bigint NOT NULL,
PRIMARY KEY ("pj_id")
) COMMENT '主要用于首页的项目数据';

View File

@ -1,2 +1,64 @@
DELETE FROM "des_datainfo"; CREATE TABLE IF NOT EXISTS "des_datainfo" (
DELETE FROM "des_homePJ"; "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"info_year" varchar NOT NULL,
"info_co2e" int NOT NULL,
"info_water" int NOT NULL,
"info_castoff" int,
"info_coai" int,
"info_pollution" int NOT NULL,
"info_ecom" int NOT NULL,
"info_staff" int,
"info_training" int NOT NULL,
"info_rd" int NOT NULL,
"info_probono" int,
"info_insurance" int,
"info_violate" int,
"info_guarantee" int,
"info_money" bigint,
"info_environment" int NOT NULL,
"info_society" int NOT NULL,
"info_govern" int NOT NULL,
"creator" varchar DEFAULT '',
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updater" varchar DEFAULT '',
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
"deleted" bit NOT NULL DEFAULT FALSE,
"tenant_id" bigint NOT NULL,
PRIMARY KEY ("id")
) COMMENT '数据收集';
CREATE TABLE IF NOT EXISTS "des_homepj" (
"pjId" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"pj_name" varchar NOT NULL,
"pj_done" int NOT NULL,
"pj_describe" varchar NOT NULL,
"pj_content" varchar,
"pj_type" int NOT NULL,
"pj_etime" varchar,
"pj_vtime" varchar,
"pj_dept" int NOT NULL,
"pj_number" bigint NOT NULL,
"creator" varchar DEFAULT '',
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updater" varchar DEFAULT '',
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
"deleted" bit NOT NULL DEFAULT FALSE,
"tenant_id" bigint NOT NULL,
PRIMARY KEY ("pj_id")
) COMMENT '主要用于首页的项目数据';
CREATE TABLE IF NOT EXISTS "des_homeimg" (
"imgId" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"img_name" varchar NOT NULL,
"img_createtime" varchar,
"img_img" varchar NOT NULL,
"img_content" varchar,
"content_type" int NOT NULL,
"img_status" int NOT NULL,
"content_status" int NOT NULL,
"creator" varchar DEFAULT '',
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updater" varchar DEFAULT '',
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
"deleted" bit NOT NULL DEFAULT FALSE,
"tenant_id" bigint NOT NULL,
PRIMARY KEY ("img_id")
) COMMENT '公告管理';