diff --git a/src/main/java/com/ycwl/basic/mapper/pc/FaceMapper.java b/src/main/java/com/ycwl/basic/mapper/pc/FaceMapper.java new file mode 100644 index 0000000..1b61c20 --- /dev/null +++ b/src/main/java/com/ycwl/basic/mapper/pc/FaceMapper.java @@ -0,0 +1,24 @@ +package com.ycwl.basic.mapper.pc; + +import com.ycwl.basic.model.pc.device.entity.DeviceEntity; +import com.ycwl.basic.model.pc.device.req.DeviceReqQuery; +import com.ycwl.basic.model.pc.device.resp.DeviceRespVO; +import com.ycwl.basic.model.pc.face.entity.FaceEntity; +import com.ycwl.basic.model.pc.face.req.FaceReqQuery; +import com.ycwl.basic.model.pc.face.resp.FaceRespVO; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @Author:longbinbin + * @Date:2024/11/29 15:09 + */ +public interface FaceMapper { + List<FaceRespVO> list(FaceReqQuery faceReqQuery); + FaceRespVO getById(Long id); + int add(FaceEntity device); + int deleteById(Long id); + int deleteByIds(@Param("list") Long ids); + int update(DeviceEntity device); +} diff --git a/src/main/java/com/ycwl/basic/model/pc/face/entity/FaceEntity.java b/src/main/java/com/ycwl/basic/model/pc/face/entity/FaceEntity.java new file mode 100644 index 0000000..f428caa --- /dev/null +++ b/src/main/java/com/ycwl/basic/model/pc/face/entity/FaceEntity.java @@ -0,0 +1,41 @@ +package com.ycwl.basic.model.pc.face.entity; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * @Author:longbinbin + * @Date:2024/11/29 15:11 + */ +@Data +@TableName("face") +public class FaceEntity { + @TableId + private Long id; + /** + * 会员id + */ + private Long memberId; + /** + * 用户上传的人脸照片 + */ + private String faceUrl; + /** + * 与样本匹配的ID,逗号隔开 + */ + private String matchSampleIds; + /** + * 匹配率 + */ + private BigDecimal firstMatchRate; + /** + * 匹配的结果,JSON字符串 + */ + private String matchResult; + private Date createAt; + private Date updateAt; +} diff --git a/src/main/java/com/ycwl/basic/model/pc/face/req/FaceReqQuery.java b/src/main/java/com/ycwl/basic/model/pc/face/req/FaceReqQuery.java new file mode 100644 index 0000000..0af86f9 --- /dev/null +++ b/src/main/java/com/ycwl/basic/model/pc/face/req/FaceReqQuery.java @@ -0,0 +1,32 @@ +package com.ycwl.basic.model.pc.face.req; + +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * @Author:longbinbin + * @Date:2024/11/29 15:16 + */ +@Data +@ApiModel("人脸查询参数") +public class FaceReqQuery { + @ApiModelProperty("会员id") + private Long memberId; + @ApiModelProperty("用户上传的人脸照片") + private String faceUrl; + @ApiModelProperty("与样本匹配的ID,逗号隔开") + private String matchSampleIds; + @ApiModelProperty("匹配率") + private BigDecimal startMatchRate; + @ApiModelProperty("匹配率") + private BigDecimal endMatchRate; + @ApiModelProperty("匹配的结果,JSON字符串") + private String matchResult; + private Date startTime; + private Date endTime; +} diff --git a/src/main/java/com/ycwl/basic/model/pc/face/resp/FaceRespVO.java b/src/main/java/com/ycwl/basic/model/pc/face/resp/FaceRespVO.java new file mode 100644 index 0000000..52f83e0 --- /dev/null +++ b/src/main/java/com/ycwl/basic/model/pc/face/resp/FaceRespVO.java @@ -0,0 +1,29 @@ +package com.ycwl.basic.model.pc.face.resp; + +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * @Author:longbinbin + * @Date:2024/11/29 15:18 + */ +@ApiModel("人脸查询响应参数") +public class FaceRespVO { + private Long id; + @ApiModelProperty("会员id") + private Long memberId; + @ApiModelProperty("用户上传的人脸照片") + private String faceUrl; + @ApiModelProperty("与样本匹配的ID,逗号隔开") + private String matchSampleIds; + @ApiModelProperty("匹配率") + private BigDecimal firstMatchRate; + @ApiModelProperty("匹配的结果,JSON字符串") + private String matchResult; + private Date createAt; + private Date updateAt; +} diff --git a/src/main/resources/mapper/pc/BrokerMapper.xml b/src/main/resources/mapper/pc/BrokerMapper.xml index b70e9be..a498c76 100644 --- a/src/main/resources/mapper/pc/BrokerMapper.xml +++ b/src/main/resources/mapper/pc/BrokerMapper.xml @@ -35,6 +35,12 @@ <if test="status!= null"> and `status` = #{status} </if> + <if test="startTime!=null"> + and d.create_at >= #{startTime} + </if> + <if test="endTime!=null"> + and d.create_at <= #{endTime} + </if> </where> </select> <select id="getById" resultType="com.ycwl.basic.model.pc.broker.entity.BrokerEntity"> diff --git a/src/main/resources/mapper/pc/DeviceMapper.xml b/src/main/resources/mapper/pc/DeviceMapper.xml index e22795d..f0ffd5d 100644 --- a/src/main/resources/mapper/pc/DeviceMapper.xml +++ b/src/main/resources/mapper/pc/DeviceMapper.xml @@ -39,6 +39,12 @@ <if test="scenicId!= null and scenicId!= ''"> and scenic_id = #{scenicId} </if> + <if test="startTime!=null"> + and d.create_at >= #{startTime} + </if> + <if test="endTime!=null"> + and d.create_at <= #{endTime} + </if> </where> </select> <select id="getById" resultType="com.ycwl.basic.model.pc.device.resp.DeviceRespVO"> diff --git a/src/main/resources/mapper/pc/FaceMapper.xml b/src/main/resources/mapper/pc/FaceMapper.xml new file mode 100644 index 0000000..3e273d4 --- /dev/null +++ b/src/main/resources/mapper/pc/FaceMapper.xml @@ -0,0 +1,70 @@ +<?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.ycwl.basic.mapper.pc.FaceMapper"> + <insert id="add"> + insert into face(id, member_id, face_url, match_sample_ids, first_match_rate, match_result) + values (#{id}, #{memberId}, #{faceUrl}, #{matchSampleIds}, #{firstMatchRate}, #{matchResult}) + </insert> + <update id="update"> + update face + <set> + <if test="memberId!= null "> + member_id = #{memberId}, + </if> + <if test="faceUrl!= null and faceUrl!= ''"> + face_url = #{faceUrl}, + </if> + <if test="matchSampleIds!= null and matchSampleIds!= ''"> + match_sample_ids = #{matchSampleIds}, + </if> + <if test="firstMatchRate!= null "> + first_match_rate = #{firstMatchRate}, + </if> + <if test="matchResult!= null and matchResult!= ''"> + match_result = #{matchResult}, + </if> + </set> + where id = #{id} + </update> + <delete id="deleteById"> + delete from face where id = #{id} + </delete> + <delete id="deleteByIds"> + <if test="list!= null and list.size() > 0"> + delete from face where id in ( + <foreach collection="list" item="id" separator=","> + #{id} + </foreach> + ) + </if> + </delete> + <select id="list" resultType="com.ycwl.basic.model.pc.face.resp.FaceRespVO"> + select id, member_id, face_url, match_sample_ids, first_match_rate, match_result + from face + <where> + <if test="memberId!= null and memberId!= ''"> + and member_id = #{memberId} + </if> + <if test="matchSampleIds!= null and matchSampleIds!= ''"> + and match_sample_ids like concat('%', #{matchSampleIds}, '%') + </if> + <if test="startMatchRate!= null "> + and first_match_rate >= #{startMatchRate} + </if> + <if test="endMatchRate!= null "> + and first_match_rate <= #{endMatchRate} + </if> + <if test="startTime!=null"> + and create_at >= #{startTime} + </if> + <if test="endTime!=null"> + and create_at <= #{endTime} + </if> + </where> + </select> + <select id="getById" resultType="com.ycwl.basic.model.pc.face.resp.FaceRespVO"> + select id, member_id, face_url, match_sample_ids, first_match_rate, match_result + from face + where id = #{id} + </select> +</mapper> \ No newline at end of file