123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- <?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.liang.dao.PrjResponsibleDao">
- <resultMap type="com.liang.entity.PrjResponsible" id="PrjResponsibleMap">
- <result property="id" column="ID" jdbcType="INTEGER"/>
- <result property="xh" column="XH" jdbcType="VARCHAR"/>
- <result property="fzr" column="FZR" jdbcType="INTEGER"/>
- <result property="xm" column="XM" jdbcType="VARCHAR"/>
- <result property="zb" column="ZB" jdbcType="INTEGER"/>
- </resultMap>
- <!--查询单个-->
- <select id="queryById" resultMap="PrjResponsibleMap">
- select
- ID, XH, FZR, XM, ZB
- from prj_Responsible
- where ID = #{id}
- </select>
- <!--查询指定行数据-->
- <select id="queryAllByLimit" resultMap="PrjResponsibleMap">
- select
- ID, XH, FZR, XM, ZB
- from prj_Responsible
- <where>
- <if test="id != null">
- and ID = #{id}
- </if>
- <if test="xh != null and xh != ''">
- and XH = #{xh}
- </if>
- <if test="fzr != null">
- and FZR = #{fzr}
- </if>
- <if test="xm != null and xm != ''">
- and XM = #{xm}
- </if>
- <if test="zb != null">
- and ZB = #{zb}
- </if>
- </where>
- limit #{pageable.offset}, #{pageable.pageSize}
- </select>
- <!--统计总行数-->
- <select id="count" resultType="java.lang.Long">
- select count(1)
- from prj_Responsible
- <where>
- <if test="id != null">
- and ID = #{id}
- </if>
- <if test="xh != null and xh != ''">
- and XH = #{xh}
- </if>
- <if test="fzr != null">
- and FZR = #{fzr}
- </if>
- <if test="xm != null and xm != ''">
- and XM = #{xm}
- </if>
- <if test="zb != null">
- and ZB = #{zb}
- </if>
- </where>
- </select>
- <!--新增所有列-->
- <insert id="insert" keyProperty="id" useGeneratedKeys="true">
- insert into prj_Responsible(XH, FZR, XM, ZB)
- values (#{xh}, #{fzr}, #{xm}, #{zb})
- </insert>
- <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
- insert into prj_Responsible(XH, FZR, XM, ZB)
- values
- <foreach collection="entities" item="entity" separator=",">
- (#{entity.xh}, #{entity.fzr}, #{entity.xm}, #{entity.zb})
- </foreach>
- </insert>
- <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
- insert into prj_Responsible(XH, FZR, XM, ZB)
- values
- <foreach collection="entities" item="entity" separator=",">
- (#{entity.xh}, #{entity.fzr}, #{entity.xm}, #{entity.zb})
- </foreach>
- on duplicate key update
- XH = values(XH),
- FZR = values(FZR),
- XM = values(XM),
- ZB = values(ZB)
- </insert>
- <!--通过主键修改数据-->
- <update id="update">
- update prj_Responsible
- <set>
- <if test="xh != null and xh != ''">
- XH = #{xh},
- </if>
- <if test="fzr != null">
- FZR = #{fzr},
- </if>
- <if test="xm != null and xm != ''">
- XM = #{xm},
- </if>
- <if test="zb != null">
- ZB = #{zb},
- </if>
- </set>
- where ID = #{id}
- </update>
- <!--通过主键删除-->
- <delete id="deleteById">
- delete from prj_Responsible where ID = #{id}
- </delete>
- </mapper>
|