|
@@ -0,0 +1,70 @@
|
|
|
+<!DOCTYPE mapper
|
|
|
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
+
|
|
|
+<mapper namespace="com.bosshand.virgo.core.dao.MgrAgentDao">
|
|
|
+
|
|
|
+ <resultMap type="com.bosshand.virgo.core.model.MgrAgent" id="agentResult">
|
|
|
+ <id column="id" property="id"/>
|
|
|
+ <result column="organizationId" property="organizationId"/>
|
|
|
+ <result column="userId" property="userId"/>
|
|
|
+ <result column="name" property="name"/>
|
|
|
+ <result column="phone" property="phone"/>
|
|
|
+ <result column="primaryArea" property="primaryArea"/>
|
|
|
+ <result column="remark" property="remark"/>
|
|
|
+ <result column="businessCard" property="businessCard"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <insert id="insert" parameterType="com.bosshand.virgo.core.model.MgrAgent" useGeneratedKeys="true" keyProperty="id">
|
|
|
+ INSERT INTO mgr_agent(`organizationId`, `userId`, `name`, `phone`, `primaryArea`, `remark`, `businessCard`)
|
|
|
+ VALUES (#{organizationId}, #{userId}, #{name}, #{phone}, #{primaryArea}, #{remark}, #{businessCard})
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <delete id="delete">
|
|
|
+ DELETE from mgr_agent where id=#{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <update id="update" parameterType="com.bosshand.virgo.core.model.MgrAgent">
|
|
|
+ UPDATE mgr_agent
|
|
|
+ <trim prefix="set" suffixOverrides=",">
|
|
|
+ <if test="name!=null">name=#{name},</if>
|
|
|
+ <if test="phone!=null">phone=#{phone},</if>
|
|
|
+ <if test="primaryArea!=null">primaryArea=#{primaryArea},</if>
|
|
|
+ <if test="remark!=null">remark=#{remark},</if>
|
|
|
+ <if test="businessCard!=null">businessCard=#{businessCard},</if>
|
|
|
+ </trim>
|
|
|
+ WHERE id=#{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <select id="get" resultMap="clientResult">
|
|
|
+ SELECT * FROM mgr_agent where id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getTotalCount" parameterType="com.bosshand.virgo.core.model.MgrAgent" resultType="Integer">
|
|
|
+ SELECT count(*) FROM mgr_agent
|
|
|
+ <where>
|
|
|
+ <if test="organizationId!=0">and organizationId=#{organizationId}</if>
|
|
|
+ <if test="userId!=0">and userId=#{userId}</if>
|
|
|
+ <if test="name!=null">and name=#{name}</if>
|
|
|
+ <if test="phone!=null">and phone=#{phone}</if>
|
|
|
+ <if test="primaryArea!=null">and primaryArea=#{primaryArea}</if>
|
|
|
+ <if test="remark!=null">and remark=#{remark}</if>
|
|
|
+ <if test="businessCard!=null">and businessCard=#{businessCard}</if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getLimit" resultMap="agentResult">
|
|
|
+ SELECT * FROM mgr_agent
|
|
|
+ <where>
|
|
|
+ <if test="p.organizationId!=0">and organizationId=#{p.organizationId}</if>
|
|
|
+ <if test="p.userId!=0">and userId=#{p.userId}</if>
|
|
|
+ <if test="p.name!=null">and name=#{p.name}</if>
|
|
|
+ <if test="p.phone!=null">and phone=#{p.phone}</if>
|
|
|
+ <if test="p.primaryArea!=null">and primaryArea=#{p.primaryArea}</if>
|
|
|
+ <if test="p.remark!=null">and remark=#{p.remark}</if>
|
|
|
+ <if test="p.businessCard!=null">and businessCard=#{p.businessCard}</if>
|
|
|
+ </where>
|
|
|
+ limit #{currIndex} , #{pageSize}
|
|
|
+ </select>
|
|
|
+
|
|
|
+</mapper>
|