CleaningRecordMapper.xml 1.74 KB
<?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="CleaningRecordV1ServiceDaoImpl">

    <insert id="saveCleaningRecord" parameterType="com.java110.po.property.CleaningRecordPo">
        INSERT INTO cleaning_record(id, user_id, user_name, work_area, work_content, work_time, longitude, latitude, images, remark, store_id, create_time)
        VALUES(#{id}, #{userId}, #{userName}, #{workArea}, #{workContent}, #{workTime}, #{longitude}, #{latitude}, #{images}, #{remark}, #{storeId}, NOW())
    </insert>

    <select id="queryCleaningRecords" parameterType="map" resultType="map">
        SELECT * FROM cleaning_record WHERE 1=1
        <if test="userId != null and userId != ''">AND user_id = #{userId}</if>
        <if test="startTime != null and startTime != ''">AND work_time &gt;= #{startTime}</if>
        <if test="endTime != null and endTime != ''">AND work_time &lt;= #{endTime}</if>
        <if test="storeId != null and storeId != ''">AND store_id = #{storeId}</if>
        ORDER BY work_time DESC
        <if test="page != null and page != '' and row != null and row != ''">
            LIMIT #{page}, #{row}
        </if>
    </select>

    <select id="queryCleaningRecordsCount" parameterType="map" resultType="map">
        SELECT COUNT(1) count FROM cleaning_record WHERE 1=1
        <if test="userId != null and userId != ''">AND user_id = #{userId}</if>
        <if test="startTime != null and startTime != ''">AND work_time &gt;= #{startTime}</if>
        <if test="endTime != null and endTime != ''">AND work_time &lt;= #{endTime}</if>
        <if test="storeId != null and storeId != ''">AND store_id = #{storeId}</if>
    </select>

</mapper>