Merge remote-tracking branch 'origin/v12-server-sdk-changqing' into v12-server-sdk-changqing

This commit is contained in:
张博 2024-10-18 09:53:08 +08:00
commit c62f70daa9
19 changed files with 1080 additions and 1 deletions

View File

@ -295,6 +295,12 @@
<!-- <classifier>${javacv.platform}</classifier>-->
<!-- </dependency>-->
<dependency>
<groupId>com.pig4cloud.plugin</groupId>
<artifactId>oss-spring-boot-starter</artifactId>
<version>1.0.5</version>
</dependency>
</dependencies>

View File

@ -0,0 +1,184 @@
package net.shapelight.modules.iCq.controller.member;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.minio.MinioClient;
import io.minio.PutObjectOptions;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import net.shapelight.common.config.MinioConfig;
import net.shapelight.common.utils.R;
import net.shapelight.common.utils.SnowflakeIdWorker;
import net.shapelight.common.utils.UUIDUtil;
import net.shapelight.modules.iCq.controller.member.dto.VisitorDto;
import net.shapelight.modules.iCq.controller.member.vo.MemberListVo;
import net.shapelight.modules.iCq.dal.dataobject.member.TenPersonEntity;
import net.shapelight.modules.iCq.dal.mysql.member.CqMemberMapper;
import net.shapelight.modules.iCq.dal.mysql.video.CqSafeVideoMapper;
import net.shapelight.modules.ten.service.TenPersonService;
import org.apache.commons.io.FilenameUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
/**
* 宣传片表
*/
@RestController
@RequestMapping("cq/member")
@Api(value = "人员", tags = {"人员"})
@RequiredArgsConstructor
public class CqMemberController {
private final TenPersonService tenPersonService;
private final CqSafeVideoMapper cqSafeVideoMapper;
private final CqMemberMapper cqMemberMapper;
private final MinioConfig minioConfig;
private final MinioClient minioClient;
@GetMapping("/list")
public R list(@RequestParam(defaultValue = "1") int page,
@RequestParam(defaultValue = "10") int size) {
// 创建分页对象
Page<TenPersonEntity> pageRequest = new Page<>(page, size);
// 使用 MyBatis-Plus 提供的分页查询
IPage<TenPersonEntity> pageResult = cqMemberMapper.selectPage(pageRequest, null);
List<TenPersonEntity> list = pageResult.getRecords();
List<MemberListVo> listVo = new ArrayList<>();
for (TenPersonEntity tenSafeVideoEntity : list) {
MemberListVo memberListVo = new MemberListVo();
memberListVo.setId(tenSafeVideoEntity.getPersonId());
memberListVo.setUnitName(cqMemberMapper.lookUpTheNameBasedOnTheDepartmentId
(tenSafeVideoEntity.getDeptId()));
memberListVo.setName(tenSafeVideoEntity.getName());
memberListVo.setSex(tenSafeVideoEntity.getGender() == 0 ? "" : "");
memberListVo.setPhone(tenSafeVideoEntity.getMobile());
memberListVo.setIdCard(tenSafeVideoEntity.getIdCard());
/* memberListVo.setIsEnterSulfurArea(tenSafeVideoEntity.getIsEnterSulfurArea());*/
if (tenSafeVideoEntity.getIsEnterSulfurArea() == null) {
memberListVo.setIsEnterSulfurArea("");
} else {
memberListVo.setIsEnterSulfurArea("");
}
//memberListVo.setIsProtectDevice(tenSafeVideoEntity.getIsProtectDevice());
if (tenSafeVideoEntity.getIsProtectDevice() == null) {
memberListVo.setIsProtectDevice("");
} else {
memberListVo.setIsProtectDevice("");
}
//memberListVo.setIsWatchSafeVideo(tenSafeVideoEntity.getIsWatchSafeVideo());
if (tenSafeVideoEntity.getIsWatchSafeVideo() == null) {
memberListVo.setIsWatchSafeVideo("");
} else {
memberListVo.setIsWatchSafeVideo("");
}
memberListVo.setEmployeeType(cqMemberMapper.
takeTheNameAccordingToType(tenSafeVideoEntity.getPersonType()));
memberListVo.setIsExtract(tenSafeVideoEntity.getFaceFailure());
listVo.add(memberListVo);
}
return R.ok().put("data", listVo).put("total", pageResult.getTotal());
}
@DeleteMapping("/delete")
public R delete(@RequestParam List<Long> id) {
for (Long l : id) {
if (cqMemberMapper.deleteById(l) != 1) {
return R.error();
}
}
return R.ok();
}
@PostMapping("/gbUpload")
public R gbUpload(MultipartFile file) {
if (file.isEmpty() || file.getSize() == 0) {
System.out.println("文件不能为空");
}
String fileName = null;
try {
String extension = FilenameUtils.getExtension(file.getOriginalFilename()); //后缀名
fileName = "temp/" + "t_" + UUIDUtil.uuid() + "." + extension;
InputStream inputStream = file.getInputStream();
PutObjectOptions putObjectOptions = new PutObjectOptions(inputStream.available(), -1);
putObjectOptions.setContentType(file.getContentType());
minioClient.putObject(
minioConfig.getBucketName(), fileName, inputStream, putObjectOptions);
inputStream.close();
} catch (Exception e) {
System.out.println(e.getMessage());
}
System.out.println("方法结束");
return R.ok().put("data", fileName);
}
//修改
@PostMapping("/newVisitor")
public R newVisitor(@RequestBody VisitorDto visitorDto) {
TenPersonEntity tenPersonEntity = new TenPersonEntity();
long id = new SnowflakeIdWorker().nextId();
tenPersonEntity.setPersonId(id);
tenPersonEntity.setUuid(UUIDUtil.uuid());
tenPersonEntity.setCellId(1255898969448382468L);
tenPersonEntity.setAppFlag(0);
tenPersonEntity.setDeptId(cqSafeVideoMapper.runTheNameById(visitorDto.getUnitName()));
tenPersonEntity.setLabelId(cqMemberMapper.speciallyForVisitors());
tenPersonEntity.setName(visitorDto.getName());
tenPersonEntity.setGender(visitorDto.getSex());
tenPersonEntity.setIc(visitorDto.getIdCard());
tenPersonEntity.setMobile(visitorDto.getPhone());
tenPersonEntity.setOrgImageTemp(visitorDto.getFacePhotoUrl());
tenPersonEntity.setIsProtectDevice(visitorDto.getIsProtectDevice());
tenPersonEntity.setIsEnterSulfurArea(visitorDto.getIsEnterSulfurArea());
tenPersonEntity.setIsWatchSafeVideo(visitorDto.getIsWatchSafeVideo());
net.shapelight.modules.ten.entity.TenPersonEntity tenPersonEntity1 = new net.shapelight.modules.ten.entity.TenPersonEntity();
//把前面的复制到后面
BeanUtils.copyProperties(tenPersonEntity, tenPersonEntity1);
/* int i = tenPersonService.saveTenPerson(tenPersonEntity1);
System.out.println(i);*/
if (tenPersonService.saveTenPerson(tenPersonEntity1) == 0) {
return R.ok();
} else {
return R.error();
}
}
}

View File

@ -0,0 +1,23 @@
package net.shapelight.modules.iCq.controller.member.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import net.shapelight.common.base.BaseEntity;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class VisitorDto extends BaseEntity {
private String unitName;
private String name;
private int sex;
private String idCard;
private String phone;
private String facePhotoUrl;
private int isProtectDevice; //防护设备
private int isEnterSulfurArea; //含硫
private int isWatchSafeVideo; //安全视频是否观看
}

View File

@ -0,0 +1,31 @@
package net.shapelight.modules.iCq.controller.member.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class MemberListVo {
// id 或者 person id 一样的
private Long id;
//单位名称
private String unitName;
//姓名
private String name;
//性别
private String sex;
//手机号
private String phone;
//身份证号
private String idCard;
private String isEnterSulfurArea; //含硫
private String isProtectDevice; //防护设备
private String isWatchSafeVideo; //安全视频是否观看
//员工类型
private String employeeType;
//是否提取成功
private Integer isExtract;
}

View File

@ -0,0 +1,189 @@
package net.shapelight.modules.iCq.controller.video;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pig4cloud.plugin.oss.service.OssTemplate;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import net.shapelight.common.config.MinioConfig;
import net.shapelight.common.utils.R;
import net.shapelight.modules.iCq.controller.video.dto.UpdateVideoDto;
import net.shapelight.modules.iCq.controller.video.dto.UploadVideoDto;
import net.shapelight.modules.iCq.controller.video.vo.Unit;
import net.shapelight.modules.iCq.dal.dataobject.video.File;
import net.shapelight.modules.iCq.dal.dataobject.video.TenSafeVideoEntity;
import net.shapelight.modules.iCq.dal.mysql.video.CqFileMapper;
import net.shapelight.modules.iCq.dal.mysql.video.CqSafeVideoMapper;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.Date;
import java.util.List;
import java.util.UUID;
/**
* 宣传片表
*/
@RestController
@RequestMapping("cq/video")
@Api(value = "宣传片", tags = {"宣传片"})
@RequiredArgsConstructor
public class CqSafeVideoController {
private static String BUCKET_NAME = "cqyt";
private final OssTemplate template;
private final MinioConfig minioConfig;
private final CqSafeVideoMapper cqSafeVideoMapper;
private final CqFileMapper cqFileMapper;
@GetMapping("/getTopUnits")
@ApiOperation(value = "获取单位列表")
public R getTopUnits() {
List<Unit> queryUnit = cqSafeVideoMapper.queryUnit();
return R.ok().put("data", queryUnit);
}
@GetMapping("/getChildUnits")
public R getChildUnits(String name) {
//查询子级
List<String> queryUnit = cqSafeVideoMapper.queryChildUnit(name);
return R.ok().put("data", queryUnit);
}
@PostMapping("/upload")
public R upload(@RequestParam("file")MultipartFile file){
/* String contentType = file.getContentType(); // 获取文件的 MIME 类型
UUID uuid = UUID.randomUUID();
String fileName = uuid.toString().replace("-", "") +
file.getOriginalFilename();
return;*/
File file1 = new File();
file1.setFileName(file.getOriginalFilename());
UUID uuid = UUID.randomUUID();
String replace = uuid.toString().replace("-", "");
file1.setFileId(replace);
//TODO:生成URL
file1.setFileUrl("测试的URL");
cqFileMapper.insert(file1);
return R.ok().put("data",file1);
}
@PostMapping("/insert")
public R insert(@ModelAttribute UploadVideoDto uploadVideoDto) throws IOException {
TenSafeVideoEntity tenSafeVideoEntity = new TenSafeVideoEntity();
tenSafeVideoEntity.setName(cqFileMapper.selectByFileId(uploadVideoDto.getFileId()).getFileName());
tenSafeVideoEntity.setCellId(cqSafeVideoMapper.runTheNameById(uploadVideoDto.getUnitName()));
tenSafeVideoEntity.setCellName(uploadVideoDto.getUnitName());
tenSafeVideoEntity.setUploadId(uploadVideoDto.getUploaderId());
tenSafeVideoEntity.setUploadName(uploadVideoDto.getUploader());
tenSafeVideoEntity.setUploadTime(new Date());
tenSafeVideoEntity.setUrl(cqFileMapper.selectByFileId(uploadVideoDto.getFileId()).getFileUrl());
tenSafeVideoEntity.setPlayCount(0);
if (cqSafeVideoMapper.insert(tenSafeVideoEntity) == 1) {
return R.ok();
} else {
return R.error();
}
}
@GetMapping("/list")
public R list(@RequestParam(defaultValue = "1") int page,
@RequestParam(defaultValue = "10") int size) {
// 创建分页对象
Page<TenSafeVideoEntity> pageRequest = new Page<>(page, size);
// 使用 MyBatis-Plus 提供的分页查询
IPage<TenSafeVideoEntity> pageResult = cqSafeVideoMapper.selectPage(pageRequest, null);
List<TenSafeVideoEntity> list = pageResult.getRecords();
/* for (TenSafeVideoEntity tenSafeVideoEntity : list) {
tenSafeVideoEntity.setCellName(cqSafeVideoMapper.findsTheParentId(tenSafeVideoEntity.getCellId()) + "/" +
tenSafeVideoEntity.getCellName());
}*/
return R.ok().put("data", list).put("total", pageResult.getTotal());
}
@DeleteMapping("/delete/{id}")
public R delete(@PathVariable Long id) {
if (cqSafeVideoMapper.deleteById(id) == 1) {
return R.ok();
} else {
return R.error();
}
}
//修改
@PostMapping("/update")
public R update(@ModelAttribute UpdateVideoDto updateVideoDto) {
TenSafeVideoEntity tenSafeVideoEntity = new TenSafeVideoEntity();
tenSafeVideoEntity.setName(cqFileMapper.selectByFileId(updateVideoDto.getFileId()).getFileName());
tenSafeVideoEntity.setId(updateVideoDto.getVideoId());
tenSafeVideoEntity.setCellId(cqSafeVideoMapper.runTheNameById(updateVideoDto.getUnitName()));
tenSafeVideoEntity.setCellName(updateVideoDto.getUnitName());
tenSafeVideoEntity.setUploadTime(new Date());
tenSafeVideoEntity.setUrl(cqFileMapper.selectByFileId(updateVideoDto.getFileId()).getFileUrl());
if (cqSafeVideoMapper.updateById(tenSafeVideoEntity) == 1) {
return R.ok();
} else {
return R.error();
}
}
@GetMapping("/show")
public R show(@RequestParam(defaultValue = "1") int page,
@RequestParam(defaultValue = "10") int size) {
// 创建分页对象
Page<File> pageRequest = new Page<>(page, size);
// 使用 MyBatis-Plus 提供的分页查询
IPage<File> pageResult = cqFileMapper.selectPage(pageRequest, null);
List<File> list = pageResult.getRecords();
return R.ok().put("data", list);
}
@GetMapping("/inquireVideo")
public R inquireVideo(String unitName, String videoName, String uploader){
List<TenSafeVideoEntity> list = cqSafeVideoMapper.relatedQuery(unitName, videoName, uploader);
return R.ok();
}
}

View File

@ -0,0 +1,10 @@
package net.shapelight.modules.iCq.controller.video.dto;
import lombok.Data;
@Data
public class UpdateVideoDto {
private String fileId;
private Long videoId;
private String unitName;
}

View File

@ -0,0 +1,12 @@
package net.shapelight.modules.iCq.controller.video.dto;
import lombok.Data;
import org.springframework.web.multipart.MultipartFile;
@Data
public class UploadVideoDto {
private String fileId;
private String uploader;
private Long uploaderId;
private String unitName;
}

View File

@ -0,0 +1,14 @@
package net.shapelight.modules.iCq.controller.video.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
//单位返回Vo
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Unit {
private Long deptId;
private String name;
}

View File

@ -0,0 +1,357 @@
package net.shapelight.modules.iCq.dal.dataobject.member;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import net.shapelight.common.base.BaseEntity;
import net.shapelight.modules.ten.entity.TenDoorCardEntity;
import net.shapelight.modules.ten.entity.TenPersonExtractEntity;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 人员表
*/
@Data
@TableName("ten_person")
public class TenPersonEntity extends BaseEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* ID
*/
@TableId
@ApiModelProperty("人员ID")
private Integer memberId;
/**
* ID
*/
@TableId(type = IdType.INPUT)
@JsonSerialize(using = ToStringSerializer.class)
@ApiModelProperty("人员ID")
private Long personId;
/**
* 用户名
*/
@ApiModelProperty("账号用户名")
private String username;
/**
* 密码
*/
@ApiModelProperty("密码")
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
private String password;
/**
*
*/
@ApiModelProperty("")
private String salt;
/**
* 姓名
*/
@ApiModelProperty("姓名")
private String name;
/**
* 性别0女1男
*/
@ApiModelProperty("性别0女1男")
private Integer gender;
/**
* 民族1汉2蒙古
*/
@ApiModelProperty("民族")
private Integer nation;
/**
* 手机号
*/
@ApiModelProperty("手机号")
private String mobile;
/**
* 小区ID
*/
@ApiModelProperty("小区ID")
@JsonSerialize(using = ToStringSerializer.class)
private Long cellId;
/**
* 楼栋ID
*/
@ApiModelProperty("楼栋ID")
@JsonSerialize(using = ToStringSerializer.class)
private Long buildId;
/**
* 房间ID
*/
@ApiModelProperty("房间ID")
@JsonSerialize(using = ToStringSerializer.class)
private Long roomId;
/**
* 类型业主家属物业访客白名单黑名单
*/
@ApiModelProperty("类型:业主,家属,物业,访客,白名单,黑名单")
private Integer personType;
/**
* 原始照片
*/
@ApiModelProperty("原始照片")
private String orgImage;
/**
* 人脸照片
*/
@ApiModelProperty("人脸照片")
private String faceImage;
/**
* 标签
*/
@ApiModelProperty("标签Id")
private Integer labelId;
/**
* 备注
*/
@ApiModelProperty("备注")
private String remark;
/**
* 是否app登录1是0否
*/
@ApiModelProperty("app登录1是0否")
private Integer appFlag;
/**
* 身份证号码
*/
@ApiModelProperty("身份证号码")
private String idCard;
/**
* 1身份证
*/
@ApiModelProperty("身份证类型")
private Integer idType;
/**
* 身份证正面照片
*/
@ApiModelProperty("身份证正面照片")
private String idFrontImage;
/**
* 身份证反面照片
*/
@ApiModelProperty("身份证反面照片")
private String idBackImage;
/**
* 生效开始
*/
@ApiModelProperty("生效开始")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date liveStart;
/**
* 生效结束
*/
@ApiModelProperty("生效结束")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date liveEnd;
/**
* 邮箱地址
*/
@ApiModelProperty("邮箱地址")
private String email;
/**
* 工作单位职业
*/
@ApiModelProperty("工作单位职业")
private String work;
/**
* 0正常1禁用2待审核3审核不通过
*/
@ApiModelProperty("0正常1禁用2待审核3审核不通过")
private Integer status;
/**
* 审核内容
*/
@ApiModelProperty("审核内容")
private String note;
/**
* 最后登录时间
*/
@ApiModelProperty("最后登录时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date loginTime;
/**
* 第三方登录id
*/
@ApiModelProperty("第三方登录id")
private String openId;
/**
* 第三方id
*/
@ApiModelProperty("ryid")
private String ryid;
/**
* uuid
*/
@ApiModelProperty("ryid")
private String uuid;
/**
* 0未删除1删除
*/
@ApiModelProperty("0未删除1删除")
private Integer deleteFlag;
/**
* 1.app 2.后台添加 3.导入
*/
@ApiModelProperty("1.app 2.后台添加 3.导入")
private Integer registerType;
/**
* 运营商ID
*/
@ApiModelProperty("运营商ID")
@JsonSerialize(using = ToStringSerializer.class)
private Long tenantId;
/**
* 人脸提起失败标志0正常1失败
*/
@ApiModelProperty("人脸提起失败标志0正常1失败")
private Integer faceFailure;
@TableField(exist = false)
@ApiModelProperty("小区名称")
private String cellName;
@TableField(exist = false)
@ApiModelProperty("楼栋名称")
private String buildName;
@TableField(exist = false)
@ApiModelProperty("楼栋单元")
private String buildUnit;
@TableField(exist = false)
@ApiModelProperty("户室名称")
private String roomName;
@TableField(exist = false)
@ApiModelProperty("楼层")
private Integer layer;
@TableField(exist = false)
@ApiModelProperty("区域名称")
private String areaName;
@TableField(exist = false)
@ApiModelProperty("标签名称")
private String labelName;
@TableField(exist = false)
@ApiModelProperty("AppUserId")
private Long appUserId;
/**
* 临时原始照片
*/
@ApiModelProperty("临时原始照片")
@TableField(exist = false)
private String orgImageTemp;
@ApiModelProperty("门禁卡号")
@TableField(exist = false)
private TenDoorCardEntity doorCardEntity;
@ApiModelProperty("最后记录时间")
@TableField(exist = false)
private String lastRecordTime;
@ApiModelProperty("最后登录时间")
@TableField(exist = false)
private String lastLoginTime;
@ApiModelProperty("所属运营商")
@TableField(exist = false)
private String tenantName;
@ApiModelProperty("门牌号")
@TableField(exist = false)
private String doorNumber;
@ApiModelProperty("提取失败log个数")
@TableField(exist = false)
private Integer extractCount;
@ApiModelProperty("提取失败log个数")
@TableField(exist = false)
private List<TenPersonExtractEntity> extractList;
@ApiModelProperty("")
private Integer xaSync;
@ApiModelProperty("")
private Integer xaSyncCard;
@ApiModelProperty("")
private Integer xaSyncImage;
// "rgb":"url"
// "depth":"url"
// "faceModel": ""
// "souceFile": "url"
// "cameraParam": "65464313212"
private String depth;
private String faceModel;
private String sourceFile;
private String cameraParam;
//-----------------v5http-----
private String thdFeature;
@JsonSerialize(using = ToStringSerializer.class)
@ApiModelProperty("部门ID")
private Long deptId;
@ApiModelProperty("部门名称")
@TableField(exist = false)
private String deptName;
@ApiModelProperty("部门长名称")
@TableField(exist = false)
private String deptAllName;
private String orgId;
//--------v10掌静脉---------------
private String pvLeft;
private String pvRight;
private Integer featureType;
//-----------------后台识别保存特征
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
private String feature;
private String ic;
private String householder;
private String relation;
//-----------------长庆新增字段
private Integer isEnterSulfurArea; //含硫
private Integer isProtectDevice; //防护设备
private Integer isWatchSafeVideo; //安全视频是否观看
private String belongContractorName; //所属承包商
}

View File

@ -0,0 +1,16 @@
package net.shapelight.modules.iCq.dal.dataobject.video;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
@Data
@TableName("ten_file")
public class File implements Serializable {
private static final long serialVersionUID = 1L;
private String fileId;
private String fileName;
private String fileUrl;
}

View File

@ -0,0 +1,71 @@
package net.shapelight.modules.iCq.dal.dataobject.video;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 宣传片表
*/
@Data
@TableName("ten_safe_video")
public class TenSafeVideoEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId
private Long id;
/**
* 视频名称
*/
private String name;
/**
* 单位ID
*/
private Long cellId;
/**
* 单位名称
*/
private String cellName;
/**
* 上传人ID
*/
private Long uploadId;
/**
* 上传人姓名
*/
private String uploadName;
/**
* 上传时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date uploadTime;
/**
* 视频地址
*/
private String url;
/**
* 上次播放时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date playTime;
/**
* 播放次数
*/
private Integer playCount;
}

View File

@ -0,0 +1,19 @@
package net.shapelight.modules.iCq.dal.mysql.member;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.shapelight.modules.iCq.dal.dataobject.member.TenPersonEntity;
import net.shapelight.modules.iCq.dal.dataobject.video.TenSafeVideoEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface CqMemberMapper extends BaseMapper<TenPersonEntity> {
String lookUpTheNameBasedOnTheDepartmentId(Long deptId);
String takeTheNameAccordingToType(Integer personType);
Integer speciallyForVisitors();
}

View File

@ -0,0 +1,20 @@
package net.shapelight.modules.iCq.dal.mysql.video;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.shapelight.modules.iCq.dal.dataobject.video.File;
import net.shapelight.modules.iCq.dal.dataobject.video.TenSafeVideoEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface CqFileMapper extends BaseMapper<File> {
/**
* 根据文件id获取文件信息
* @param fileId
* @return
*/
File selectByFileId(String fileId);
}

View File

@ -0,0 +1,40 @@
package net.shapelight.modules.iCq.dal.mysql.video;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.shapelight.modules.iCq.controller.video.vo.Unit;
import net.shapelight.modules.iCq.dal.dataobject.video.TenSafeVideoEntity;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
@Mapper
public interface CqSafeVideoMapper extends BaseMapper<TenSafeVideoEntity> {
/**
* 查询 单位 信息(名称 id)
* @return
*/
List<Unit> queryUnit();
/**
* 根据单位id查询单位名称
* @param unitName 单位名称
* @return
*/
Long runTheNameById(String unitName);
//目前没用 明天测试 待删除
String findsTheParentId(Long id);
//目前没用 明天测试 待删除
List<Long> queryHighestLevelUnit();
//目前没用 明天测试 待删除
List<String> queryChildUnit(String name);
List<TenSafeVideoEntity> relatedQuery(String unitName, String videoName, String uploader);
}

View File

@ -0,0 +1,4 @@
package net.shapelight.modules.iCq.service.video;
public interface CqSafeVideoService {
}

View File

@ -1,7 +1,7 @@
<?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="net.shapelight.modules.ten.dao.TenSafeVideoDao">
<mapper namespace="net.shapelight.modules.changqing.dao.TenSafeVideoDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="net.shapelight.modules.changqing.entity.TenSafeVideoEntity" id="tenSafeVideoMap">

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="net.shapelight.modules.iCq.dal.mysql.video.CqFileMapper">
<select id="selectByFileId" resultType="net.shapelight.modules.iCq.dal.dataobject.video.File">
SELECT file_id, file_name, file_url
FROM ten_file
WHERE file_id = #{fileId}
</select>
</mapper>

View File

@ -0,0 +1,16 @@
<?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="net.shapelight.modules.iCq.dal.mysql.member.CqMemberMapper">
<select id="lookUpTheNameBasedOnTheDepartmentId" resultType="java.lang.String">
SELECT name FROM ten_cell_dept WHERE dept_id = #{deptId}
</select>
<select id="takeTheNameAccordingToType" resultType="java.lang.String">
SELECT DISTINCT(name) from ten_label WHERE type = #{personType}
</select>
<select id="speciallyForVisitors" resultType="java.lang.Integer">
SELECT label_id FROM ten_label WHERE name = '访客'
</select>
</mapper>

View File

@ -0,0 +1,55 @@
<?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="net.shapelight.modules.iCq.dal.mysql.video.CqSafeVideoMapper">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="net.shapelight.modules.changqing.entity.TenSafeVideoEntity" id="tenSafeVideoMap">
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="cellId" column="cell_id"/>
<result property="cellName" column="cell_name"/>
<result property="uploadId" column="upload_id"/>
<result property="uploadName" column="upload_name"/>
<result property="uploadTime" column="upload_time"/>
<result property="url" column="url"/>
<result property="playTime" column="play_time"/>
<result property="playCount" column="play_count"/>
</resultMap>
<select id="queryHighestLevelUnit" resultType="java.lang.Long">
SELECT cell_id from ten_cell WHERE delete_flag = 0
</select>
<select id="queryUnit" resultType="net.shapelight.modules.iCq.controller.video.vo.Unit">
SELECT dept_id, name
FROM ten_cell_dept
WHERE delete_flag = 0
</select>
<select id="queryChildUnit" resultType="java.lang.String">
SELECT name FROM ten_cell_dept WHERE
parent_id = (SELECT dept_id FROM ten_cell_dept WHERE name = #{name})
and delete_flag = 0
</select>
<select id="runTheNameById" resultType="java.lang.Long">
SELECT dept_id FROM ten_cell_dept WHERE name = #{name} and delete_flag = 0
</select>
<select id="findsTheParentId" resultType="java.lang.String">
SELECT name
FROM ten_cell_dept d1
WHERE EXISTS (
SELECT 1
FROM ten_cell_dept d2
WHERE d2.dept_id = #{id} AND d2.parent_id = d1.dept_id
) AND d1.delete_flag = 0;
</select>
<select id="relatedQuery" resultType="net.shapelight.modules.iCq.dal.dataobject.video.TenSafeVideoEntity">
SELECT *
FROM video_table
WHERE
(:unitName IS NULL OR :unitName = '' OR unitName = :unitName) AND
(:videoName IS NULL OR :videoName = '' OR videoName = :videoName) AND
(:uploader IS NULL OR :uploader = '' OR uploader = :uploader);
</select>
</mapper>