<?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.ruoyi.project.patrol.commonuse.mapper.TCommonuseBicycleMapper">

    <resultMap type="TCommonuseBicycle" id="TCommonuseBicycleResult">
        <result property="id"    column="id"    />
        <result property="devNo"    column="dev_no"    />
        <result property="appearance"    column="appearance"    />
        <result property="normobaria"    column="normobaria"    />
        <result property="pedalCondition"    column="pedal_condition"    />
        <result property="handbrakeIntact"    column="handbrake_intact"    />
        <result property="bellIntact"    column="bell_intact"    />
        <result property="checkStatus"    column="check_status"    />
        <result property="checkDate"    column="check_date"    />
        <result property="confirmed"    column="confirmed"    />
        <result property="updaterCode"    column="updater_code"    />
        <result property="updatedate"    column="updatedate"    />
        <result property="month"    column="month"    />
        <result property="year"    column="year"    />
        <result property="remarks"    column="remarks"    />
        <result property="createdate"    column="createdate"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="createrCode"    column="creater_code"    />
        <result property="deptId"    column="dept_id"    />
        <result property="planId"    column="plan_id"    />
        <result property="problemFileUrl"    column="problem_file_url"    />
        <result property="fileUrl"    column="file_url"    />
        <result property="issuesStatus"    column="issues_status"    />
        <result property="issuesFlag"    column="issues_flag"    />
        <result property="repairFile"    column="repair_file"    />
        <result property="hingeIntact"    column="hinge_intact"    />
        <result property="normalReflector"    column="normal_reflector"    />
        <result property="supportIntact"    column="support_intact"    />
        <result property="cushionIntact"    column="cushion_intact"    />
        <result property="fenderIntact"    column="fender_intact"    />
        <result property="spokeStripIntact"    column="spoke_strip_intact"    />
        <result property="steelRingIntact"    column="steel_ring_intact"    />
        <result property="lockIntact"    column="lock_intact"    />
        <result property="clearlyNumbered"    column="clearly_numbered"    />
        <result property="supportNoLoose"    column="support_no_loose"    />
    </resultMap>

    <sql id="selectTCommonuseBicycleVo">
        select id, dev_no, appearance, normobaria, pedal_condition, handbrake_intact, bell_intact, check_status, check_date, confirmed, updater_code, updatedate, month, year, remarks, createdate, del_flag, creater_code, dept_id, plan_id, problem_file_url, file_url, issues_status, issues_flag, repair_file, hinge_intact, normal_reflector, support_intact, cushion_intact, fender_intact, spoke_strip_intact, steel_ring_intact, lock_intact, clearly_numbered, support_no_loose from t_commonuse_bicycle
    </sql>

    <select id="selectTCommonuseBicycleList" parameterType="TCommonuseBicycle" resultMap="TCommonuseBicycleResult">
        <include refid="selectTCommonuseBicycleVo"/>
        <where>
            <if test="id != null "> and id = #{id}</if>
            <if test="precision != null  and precision != ''"> and dev_no =#{precision}</if>
            <if test="devNo != null  and devNo != ''"> and dev_no like concat(concat('%', #{devNo}), '%')</if>
            <if test="appearance != null  and appearance != ''"> and appearance = #{appearance}</if>
            <if test="normobaria != null  and normobaria != ''"> and normobaria = #{normobaria}</if>
            <if test="pedalCondition != null  and pedalCondition != ''"> and pedal_condition = #{pedalCondition}</if>
            <if test="handbrakeIntact != null  and handbrakeIntact != ''"> and handbrake_intact = #{handbrakeIntact}</if>
            <if test="bellIntact != null  and bellIntact != ''"> and bell_intact = #{bellIntact}</if>
            <if test="checkStatus != null  and checkStatus != ''"> and check_status = #{checkStatus}</if>
            <if test="checkDate != null "> and check_date = #{checkDate}</if>
            <if test="confirmed != null  and confirmed != ''"> and confirmed = #{confirmed}</if>
            <if test="updaterCode != null  and updaterCode != ''"> and updater_code = #{updaterCode}</if>
            <if test="updatedate != null "> and updatedate = #{updatedate}</if>
            <if test="month != null "> and month = #{month}</if>
            <if test="year != null "> and year = #{year}</if>
            <if test="remarks != null  and remarks != ''"> and remarks = #{remarks}</if>
            <if test="createdate != null "> and createdate = #{createdate}</if>
            <if test="createrCode != null  and createrCode != ''"> and creater_code = #{createrCode}</if>
            <if test="deptId != null "> and dept_id = #{deptId}</if>
            <if test="planId != null "> and plan_id = #{planId}</if>
            <if test="problemFileUrl != null  and problemFileUrl != ''"> and problem_file_url = #{problemFileUrl}</if>
            <if test="fileUrl != null  and fileUrl != ''"> and file_url = #{fileUrl}</if>
            <if test="issuesStatus != null  and issuesStatus != ''"> and issues_status = #{issuesStatus}</if>
            <if test="issuesFlag != null  and issuesFlag != ''"> and issues_flag = #{issuesFlag}</if>
            <if test="repairFile != null  and repairFile != ''"> and repair_file = #{repairFile}</if>
            <if test="hingeIntact != null  and hingeIntact != ''"> and hinge_intact = #{hingeIntact}</if>
            <if test="normalReflector != null  and normalReflector != ''"> and normal_reflector = #{normalReflector}</if>
            <if test="supportIntact != null  and supportIntact != ''"> and support_intact = #{supportIntact}</if>
            <if test="cushionIntact != null  and cushionIntact != ''"> and cushion_intact = #{cushionIntact}</if>
            <if test="fenderIntact != null  and fenderIntact != ''"> and fender_intact = #{fenderIntact}</if>
            <if test="spokeStripIntact != null  and spokeStripIntact != ''"> and spoke_strip_intact = #{spokeStripIntact}</if>
            <if test="steelRingIntact != null  and steelRingIntact != ''"> and steel_ring_intact = #{steelRingIntact}</if>
            <if test="lockIntact != null  and lockIntact != ''"> and lock_intact = #{lockIntact}</if>
            <if test="clearlyNumbered != null  and clearlyNumbered != ''"> and clearly_numbered = #{clearlyNumbered}</if>
            <if test="supportNoLoose != null  and supportNoLoose != ''"> and support_no_loose = #{supportNoLoose}</if>
            and del_flag=0
        </where>
    </select>

    <select id="selectTCommonuseBicycleById" parameterType="Long" resultMap="TCommonuseBicycleResult">
        <include refid="selectTCommonuseBicycleVo"/>
        where id = #{id}
    </select>

    <insert id="insertTCommonuseBicycle" parameterType="TCommonuseBicycle">
        <selectKey keyProperty="id" resultType="long" order="BEFORE">
            SELECT seq_t_commonuse_bicycle.NEXTVAL as id FROM DUAL
        </selectKey>
        insert into t_commonuse_bicycle
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="devNo != null and devNo != ''">dev_no,</if>
            <if test="appearance != null">appearance,</if>
            <if test="normobaria != null">normobaria,</if>
            <if test="pedalCondition != null">pedal_condition,</if>
            <if test="handbrakeIntact != null">handbrake_intact,</if>
            <if test="bellIntact != null">bell_intact,</if>
            <if test="checkStatus != null">check_status,</if>
            <if test="checkDate != null">check_date,</if>
            <if test="confirmed != null">confirmed,</if>
            <if test="updaterCode != null">updater_code,</if>
            <if test="updatedate != null">updatedate,</if>
            <if test="month != null">month,</if>
            <if test="year != null">year,</if>
            <if test="remarks != null">remarks,</if>
            <if test="createdate != null">createdate,</if>
            <if test="delFlag != null">del_flag,</if>
            <if test="createrCode != null">creater_code,</if>
            <if test="deptId != null">dept_id,</if>
            <if test="planId != null">plan_id,</if>
            <if test="problemFileUrl != null">problem_file_url,</if>
            <if test="fileUrl != null">file_url,</if>
            <if test="issuesStatus != null">issues_status,</if>
            <if test="issuesFlag != null">issues_flag,</if>
            <if test="repairFile != null">repair_file,</if>
            <if test="hingeIntact != null">hinge_intact,</if>
            <if test="normalReflector != null">normal_reflector,</if>
            <if test="supportIntact != null">support_intact,</if>
            <if test="cushionIntact != null">cushion_intact,</if>
            <if test="fenderIntact != null">fender_intact,</if>
            <if test="spokeStripIntact != null">spoke_strip_intact,</if>
            <if test="steelRingIntact != null">steel_ring_intact,</if>
            <if test="lockIntact != null">lock_intact,</if>
            <if test="clearlyNumbered != null">clearly_numbered,</if>
            <if test="supportNoLoose != null">support_no_loose,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="devNo != null and devNo != ''">#{devNo},</if>
            <if test="appearance != null">#{appearance},</if>
            <if test="normobaria != null">#{normobaria},</if>
            <if test="pedalCondition != null">#{pedalCondition},</if>
            <if test="handbrakeIntact != null">#{handbrakeIntact},</if>
            <if test="bellIntact != null">#{bellIntact},</if>
            <if test="checkStatus != null">#{checkStatus},</if>
            <if test="checkDate != null">#{checkDate},</if>
            <if test="confirmed != null">#{confirmed},</if>
            <if test="updaterCode != null">#{updaterCode},</if>
            <if test="updatedate != null">#{updatedate},</if>
            <if test="month != null">#{month},</if>
            <if test="year != null">#{year},</if>
            <if test="remarks != null">#{remarks},</if>
            <if test="createdate != null">#{createdate},</if>
            <if test="delFlag != null">#{delFlag},</if>
            <if test="createrCode != null">#{createrCode},</if>
            <if test="deptId != null">#{deptId},</if>
            <if test="planId != null">#{planId},</if>
            <if test="problemFileUrl != null">#{problemFileUrl},</if>
            <if test="fileUrl != null">#{fileUrl},</if>
            <if test="issuesStatus != null">#{issuesStatus},</if>
            <if test="issuesFlag != null">#{issuesFlag},</if>
            <if test="repairFile != null">#{repairFile},</if>
            <if test="hingeIntact != null">#{hingeIntact},</if>
            <if test="normalReflector != null">#{normalReflector},</if>
            <if test="supportIntact != null">#{supportIntact},</if>
            <if test="cushionIntact != null">#{cushionIntact},</if>
            <if test="fenderIntact != null">#{fenderIntact},</if>
            <if test="spokeStripIntact != null">#{spokeStripIntact},</if>
            <if test="steelRingIntact != null">#{steelRingIntact},</if>
            <if test="lockIntact != null">#{lockIntact},</if>
            <if test="clearlyNumbered != null">#{clearlyNumbered},</if>
            <if test="supportNoLoose != null">#{supportNoLoose},</if>
         </trim>
    </insert>

    <update id="updateTCommonuseBicycle" parameterType="TCommonuseBicycle">
        update t_commonuse_bicycle
        <trim prefix="SET" suffixOverrides=",">
            <if test="devNo != null and devNo != ''">dev_no = #{devNo},</if>
            <if test="appearance != null">appearance = #{appearance},</if>
            <if test="normobaria != null">normobaria = #{normobaria},</if>
            <if test="pedalCondition != null">pedal_condition = #{pedalCondition},</if>
            <if test="handbrakeIntact != null">handbrake_intact = #{handbrakeIntact},</if>
            <if test="bellIntact != null">bell_intact = #{bellIntact},</if>
            <if test="checkStatus != null">check_status = #{checkStatus},</if>
            <if test="checkDate != null">check_date = #{checkDate},</if>
            <if test="confirmed != null">confirmed = #{confirmed},</if>
            <if test="updaterCode != null">updater_code = #{updaterCode},</if>
            <if test="updatedate != null">updatedate = #{updatedate},</if>
            <if test="month != null">month = #{month},</if>
            <if test="year != null">year = #{year},</if>
            <if test="remarks != null">remarks = #{remarks},</if>
            <if test="createdate != null">createdate = #{createdate},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="createrCode != null">creater_code = #{createrCode},</if>
            <if test="deptId != null">dept_id = #{deptId},</if>
            <if test="planId != null">plan_id = #{planId},</if>
            <if test="problemFileUrl != null">problem_file_url = #{problemFileUrl},</if>
            <if test="fileUrl != null">file_url = #{fileUrl},</if>
            <if test="issuesStatus != null">issues_status = #{issuesStatus},</if>
            <if test="issuesFlag != null">issues_flag = #{issuesFlag},</if>
            <if test="repairFile != null">repair_file = #{repairFile},</if>
            <if test="hingeIntact != null">hinge_intact = #{hingeIntact},</if>
            <if test="normalReflector != null">normal_reflector = #{normalReflector},</if>
            <if test="supportIntact != null">support_intact = #{supportIntact},</if>
            <if test="cushionIntact != null">cushion_intact = #{cushionIntact},</if>
            <if test="fenderIntact != null">fender_intact = #{fenderIntact},</if>
            <if test="spokeStripIntact != null">spoke_strip_intact = #{spokeStripIntact},</if>
            <if test="steelRingIntact != null">steel_ring_intact = #{steelRingIntact},</if>
            <if test="lockIntact != null">lock_intact = #{lockIntact},</if>
            <if test="clearlyNumbered != null">clearly_numbered = #{clearlyNumbered},</if>
            <if test="supportNoLoose != null">support_no_loose = #{supportNoLoose},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTCommonuseBicycleById" parameterType="Long">
        delete from t_commonuse_bicycle where id = #{id}
    </delete>

    <delete id="deleteTCommonuseBicycleByIds" parameterType="String">
        delete from t_commonuse_bicycle where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>
