ZpglRcxxMaterialMapper.xml 5.03 KB
Newer Older
翁国栋 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
<?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="cn.timer.api.dao.zpgl.ZpglRcxxMaterialMapper">

    <!-- 可根据自己的需求,是否要使用 -->
    <resultMap type="cn.timer.api.bean.zpgl.ZpglRcxxMaterial" id="zpglRcxxMaterialMap">
        <result property="id" column="id"/>
        <result property="numId" column="num_id"/>
        <result property="url" column="url"/>
        <result property="type" column="type"/>
        <result property="createTime" column="create_time"/>
        <result property="orgCode" column="org_code"/>
        <result property="zpglRcxxId" column="zpgl_rcxx_id"/>
    </resultMap>

    <select id="queryObject" resultType="cn.timer.api.bean.zpgl.ZpglRcxxMaterial">
        select *
        from zpgl_rcxx_material
        where id = #{value}
    </select>

    <select id="queryList" resultType="cn.timer.api.bean.zpgl.ZpglRcxxMaterial">
        select * from zpgl_rcxx_material
        <where>
            <if test="id != null and id != ''">AND `id` = #{id}</if>
            <if test="numId != null and numId != ''">AND `num_id` = #{numId}</if>
            <if test="url != null and url != ''">AND `url` = #{url}</if>
            <if test="type != null and type != ''">AND `type` = #{type}</if>
            <if test="createTime != null and createTime != ''">AND `create_time` = #{createTime}</if>
            <if test="orgCode != null and orgCode != ''">AND `org_code` = #{orgCode}</if>
        </where>
        <choose>
            <when test="sidx != null and sidx.trim() != ''">
                order by ${sidx} ${order}
            </when>
            <otherwise>
                order by id desc
            </otherwise>
        </choose>
        <if test="offset != null and limit != null">
            limit #{offset}, #{limit}
        </if>
    </select>

    <select id="queryTotal" resultType="int">
        select count(*) from zpgl_rcxx_material
        <where>
            <if test="id != null and id != ''">AND `id` = #{id}</if>
            <if test="numId != null and numId != ''">AND `num_id` = #{numId}</if>
            <if test="url != null and url != ''">AND `url` = #{url}</if>
            <if test="type != null and type != ''">AND `type` = #{type}</if>
            <if test="createTime != null and createTime != ''">AND `create_time` = #{createTime}</if>
            <if test="orgCode != null and orgCode != ''">AND `org_code` = #{orgCode}</if>
        </where>
    </select>

    <insert id="save" parameterType="cn.timer.api.bean.zpgl.ZpglRcxxMaterial">
        insert into zpgl_rcxx_material
        (`id`,
         `num_id`,
         `url`,
         `type`,
         `create_time`,
         `org_code`)
        values (#{id},
                #{numId},
                #{url},
                #{type},
                #{createTime},
                #{orgCode})
    </insert>

    <insert id="saveSelective" parameterType="cn.timer.api.bean.zpgl.ZpglRcxxMaterial">
        insert into zpgl_rcxx_material
        (
        <if test="id != null">`id`</if>
        <if test="numId != null">,`num_id`</if>
        <if test="url != null">,`url`</if>
        <if test="type != null">,`type`</if>
        <if test="createTime != null">,`create_time`</if>
        <if test="orgCode != null">,`org_code`</if>
        )
        values
        (
        <if test="id != null">#{id}</if>
        <if test="numId != null">,#{numId}</if>
        <if test="url != null">,#{url}</if>
        <if test="type != null">,#{type}</if>
        <if test="createTime != null">,#{createTime}</if>
        <if test="orgCode != null">,#{orgCode}</if>
        )
    </insert>


    <insert id="saveList" parameterType="cn.timer.api.bean.zpgl.ZpglRcxxMaterial">
        insert into zpgl_rcxx_material
        (
        `id`,
        `num_id`,
        `url`,
        `type`,
        `create_time`,
        `org_code`
        )
        values
        <foreach collection="list" item="item" index="index" separator=",">
            (
            #{item.id},
            #{item.numId},
            #{item.url},
            #{item.type},
            #{item.createTime},
            #{item.orgCode}
            )
        </foreach>
    </insert>


    <update id="update" parameterType="cn.timer.api.bean.zpgl.ZpglRcxxMaterial">
        update zpgl_rcxx_material
        <set>
            <if test="numId != null">`num_id` = #{numId},</if>
            <if test="url != null">`url` = #{url},</if>
            <if test="type != null">`type` = #{type},</if>
            <if test="createTime != null">`create_time` = #{createTime},</if>
            <if test="orgCode != null">`org_code` = #{orgCode}</if>
        </set>
        where id = #{id}
    </update>

    <delete id="delete">
        delete
        from zpgl_rcxx_material
        where id = #{value}
    </delete>

    <delete id="deleteBatch">
        delete from zpgl_rcxx_material where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>

</mapper>