|
|
@@ -0,0 +1,203 @@
|
|
|
+<?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.goafanti.common.dao.AdminBusinessCardMapper">
|
|
|
+
|
|
|
+ <resultMap type="com.goafanti.common.model.AdminBusinessCard" id="AdminBusinessCardMap">
|
|
|
+ <result property="id" column="id" jdbcType="INTEGER"/>
|
|
|
+ <result property="aid" column="aid" jdbcType="VARCHAR"/>
|
|
|
+ <result property="name" column="name" jdbcType="VARCHAR"/>
|
|
|
+ <result property="position" column="position" jdbcType="VARCHAR"/>
|
|
|
+ <result property="company" column="company" jdbcType="VARCHAR"/>
|
|
|
+ <result property="phone" column="phone" jdbcType="VARCHAR"/>
|
|
|
+ <result property="landLine" column="land_line" jdbcType="VARCHAR"/>
|
|
|
+ <result property="email" column="email" jdbcType="VARCHAR"/>
|
|
|
+ <result property="area" column="area" jdbcType="VARCHAR"/>
|
|
|
+ <result property="content" column="content" jdbcType="VARCHAR"/>
|
|
|
+ <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="AdminBusinessCardAllSql">
|
|
|
+ id, aid, name, position, company, phone, land_line, email, area, content, create_time
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <!--查询单个-->
|
|
|
+ <select id="selectById" resultMap="AdminBusinessCardMap">
|
|
|
+ select
|
|
|
+ <include refid="AdminBusinessCardAllSql"/>
|
|
|
+ from admin_business_card
|
|
|
+ where id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!--新增所有列-->
|
|
|
+ <insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
|
|
+ insert into admin_business_card(aid, name, position, company, phone, land_line, email, area, content,
|
|
|
+ create_time)
|
|
|
+ values (#{aid}, #{name}, #{position}, #{company}, #{phone}, #{landLine}, #{email}, #{area}, #{content},
|
|
|
+ #{createTime})
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <insert id="insertBatch">
|
|
|
+ insert into admin_business_card(aid, name, position, company, phone, land_line, email, area, content,
|
|
|
+ create_time)
|
|
|
+ values
|
|
|
+ <foreach collection="entities" item="entity" separator=",">
|
|
|
+ (#{entity.aid}, #{entity.name}, #{entity.position}, #{entity.company}, #{entity.phone}, #{entity.landLine},
|
|
|
+ #{entity.email}, #{entity.area}, #{entity.content}, #{entity.createTime})
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
|
|
+ insert into admin_business_card(aid, name, position, company, phone, land_line, email, area, content,
|
|
|
+ create_time)
|
|
|
+ values
|
|
|
+ <foreach collection="entities" item="entity" separator=",">
|
|
|
+ (#{entity.aid}, #{entity.name}, #{entity.position}, #{entity.company}, #{entity.phone}, #{entity.landLine},
|
|
|
+ #{entity.email}, #{entity.area}, #{entity.content}, #{entity.createTime})
|
|
|
+ </foreach>
|
|
|
+ on duplicate key update
|
|
|
+ aid = values(aid),
|
|
|
+ name = values(name),
|
|
|
+ position = values(position),
|
|
|
+ company = values(company),
|
|
|
+ phone = values(phone),
|
|
|
+ land_line = values(land_line),
|
|
|
+ email = values(email),
|
|
|
+ area = values(area),
|
|
|
+ content = values(content),
|
|
|
+ create_time = values(create_time)
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <!--通过主键修改数据-->
|
|
|
+ <update id="update">
|
|
|
+ update admin_business_card
|
|
|
+ <set>
|
|
|
+ <if test="aid != null and aid != ''">
|
|
|
+ aid = #{aid},
|
|
|
+ </if>
|
|
|
+ <if test="name != null and name != ''">
|
|
|
+ name = #{name},
|
|
|
+ </if>
|
|
|
+ <if test="position != null and position != ''">
|
|
|
+ position = #{position},
|
|
|
+ </if>
|
|
|
+ <if test="company != null and company != ''">
|
|
|
+ company = #{company},
|
|
|
+ </if>
|
|
|
+ <if test="phone != null and phone != ''">
|
|
|
+ phone = #{phone},
|
|
|
+ </if>
|
|
|
+ <if test="landLine != null and landLine != ''">
|
|
|
+ land_line = #{landLine},
|
|
|
+ </if>
|
|
|
+ <if test="email != null and email != ''">
|
|
|
+ email = #{email},
|
|
|
+ </if>
|
|
|
+ <if test="area != null and area != ''">
|
|
|
+ area = #{area},
|
|
|
+ </if>
|
|
|
+ <if test="content != null and content != ''">
|
|
|
+ content = #{content},
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">
|
|
|
+ create_time = #{createTime},
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ where id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <!--查询指定行数据-->
|
|
|
+ <select id="findAdminBusinessCardList" resultMap="AdminBusinessCardMap">
|
|
|
+ select
|
|
|
+ <include refid="AdminBusinessCardAllSql"/>
|
|
|
+
|
|
|
+ from admin_business_card
|
|
|
+ <where>
|
|
|
+ <if test="id != null">
|
|
|
+ and id = #{id}
|
|
|
+ </if>
|
|
|
+ <if test="aid != null and aid != ''">
|
|
|
+ and aid = #{aid}
|
|
|
+ </if>
|
|
|
+ <if test="name != null and name != ''">
|
|
|
+ and name = #{name}
|
|
|
+ </if>
|
|
|
+ <if test="position != null and position != ''">
|
|
|
+ and position = #{position}
|
|
|
+ </if>
|
|
|
+ <if test="company != null and company != ''">
|
|
|
+ and company = #{company}
|
|
|
+ </if>
|
|
|
+ <if test="phone != null and phone != ''">
|
|
|
+ and phone = #{phone}
|
|
|
+ </if>
|
|
|
+ <if test="landLine != null and landLine != ''">
|
|
|
+ and land_line = #{landLine}
|
|
|
+ </if>
|
|
|
+ <if test="email != null and email != ''">
|
|
|
+ and email = #{email}
|
|
|
+ </if>
|
|
|
+ <if test="area != null and area != ''">
|
|
|
+ and area = #{area}
|
|
|
+ </if>
|
|
|
+ <if test="content != null and content != ''">
|
|
|
+ and content = #{content}
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">
|
|
|
+ and create_time = #{createTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ <if test="page_sql != null">
|
|
|
+ ${page_sql}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!--统计总行数-->
|
|
|
+ <select id="findAdminBusinessCardCount" resultType="java.lang.Integer">
|
|
|
+ select count(1)
|
|
|
+ from admin_business_card
|
|
|
+ <where>
|
|
|
+ <if test="id != null">
|
|
|
+ and id = #{id}
|
|
|
+ </if>
|
|
|
+ <if test="aid != null and aid != ''">
|
|
|
+ and aid = #{aid}
|
|
|
+ </if>
|
|
|
+ <if test="name != null and name != ''">
|
|
|
+ and name = #{name}
|
|
|
+ </if>
|
|
|
+ <if test="position != null and position != ''">
|
|
|
+ and position = #{position}
|
|
|
+ </if>
|
|
|
+ <if test="company != null and company != ''">
|
|
|
+ and company = #{company}
|
|
|
+ </if>
|
|
|
+ <if test="phone != null and phone != ''">
|
|
|
+ and phone = #{phone}
|
|
|
+ </if>
|
|
|
+ <if test="landLine != null and landLine != ''">
|
|
|
+ and land_line = #{landLine}
|
|
|
+ </if>
|
|
|
+ <if test="email != null and email != ''">
|
|
|
+ and email = #{email}
|
|
|
+ </if>
|
|
|
+ <if test="area != null and area != ''">
|
|
|
+ and area = #{area}
|
|
|
+ </if>
|
|
|
+ <if test="content != null and content != ''">
|
|
|
+ and content = #{content}
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">
|
|
|
+ and create_time = #{createTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!--通过主键删除-->
|
|
|
+ <delete id="deleteById">
|
|
|
+ delete
|
|
|
+ from admin_business_card
|
|
|
+ where id = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+</mapper>
|
|
|
+
|