zhwl/zhwl-business/zhwl-check-point/target/classes/mapper/check/point/ZdyCheckPointLogMapper.xml
2025-07-01 17:54:58 +08:00

90 lines
3.2 KiB
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.zhwl.check.point.mapper.ZdyCheckPointLogMapper">
<resultMap type="ZdyCheckPointLog" id="ZdyCheckPointLogResult">
<result property="id" column="id"/>
<result property="checkPointId" column="check_point_id"/>
<result property="idCard" column="id_card"/>
<result property="createTime" column="create_time"/>
</resultMap>
<sql id="selectZdyCheckPointLogVo">
select id, check_point_id, id_card, create_time
from zdy_check_point_log
</sql>
<select id="selectZdyCheckPointLogList" parameterType="ZdyCheckPointLog" resultMap="ZdyCheckPointLogResult">
<include refid="selectZdyCheckPointLogVo"/>
<where>
<if test="checkPointId != null ">
and check_point_id = #{checkPointId}
</if>
<if test="idCard != null and idCard != ''">
and id_card = #{idCard}
</if>
</where>
</select>
<select id="selectZdyCheckPointLogById" parameterType="Long"
resultMap="ZdyCheckPointLogResult">
<include refid="selectZdyCheckPointLogVo"/>
where id = #{id}
</select>
<insert id="insertZdyCheckPointLog" parameterType="ZdyCheckPointLog" useGeneratedKeys="true"
keyProperty="id">
insert into zdy_check_point_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="checkPointId != null">check_point_id,
</if>
<if test="idCard != null and idCard != ''">id_card,
</if>
create_time,
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="checkPointId != null">#{checkPointId},
</if>
<if test="idCard != null and idCard != ''">#{idCard},
</if>
sysdate(),
</trim>
</insert>
<update id="updateZdyCheckPointLog" parameterType="ZdyCheckPointLog">
update zdy_check_point_log
<trim prefix="SET" suffixOverrides=",">
<if test="checkPointId != null">check_point_id =
#{checkPointId},
</if>
<if test="idCard != null and idCard != ''">id_card =
#{idCard},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZdyCheckPointLogById" parameterType="Long">
delete from zdy_check_point_log where id = #{id}
</delete>
<delete id="deleteZdyCheckPointLogByIds" parameterType="String">
delete from zdy_check_point_log where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="countTodayByCheckPointIdAndIdCard" resultType="java.lang.Integer">
select count(*)
from zdy_check_point_log
where check_point_id = #{checkPointId}
and id_card = #{idCard}
and DATE(create_time) = DATE(NOW())
</select>
</mapper>