|
@@ -13,6 +13,9 @@
|
|
<result column="userPortrait" property="userPortrait"/>
|
|
<result column="userPortrait" property="userPortrait"/>
|
|
</resultMap>
|
|
</resultMap>
|
|
|
|
|
|
|
|
+ <select id="getOrganizationId" resultMap="result">
|
|
|
|
+ select * from customer where organizationId = #{organizationId} and userId = #{userId}
|
|
|
|
+ </select>
|
|
|
|
|
|
<sql id="query">
|
|
<sql id="query">
|
|
select a.*, b.name as userName, b.portrait as userPortrait from customer a left join mgr_user b on a.userId = b.id
|
|
select a.*, b.name as userName, b.portrait as userPortrait from customer a left join mgr_user b on a.userId = b.id
|
|
@@ -20,7 +23,7 @@
|
|
|
|
|
|
<select id="get" resultMap="result">
|
|
<select id="get" resultMap="result">
|
|
<include refid="query"/>
|
|
<include refid="query"/>
|
|
- where a.id = #{id}
|
|
|
|
|
|
+ where a.id = #{id} and isDelete != 1
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="getList" resultMap="result">
|
|
<select id="getList" resultMap="result">
|
|
@@ -28,6 +31,7 @@
|
|
<where>
|
|
<where>
|
|
<if test="organizationId!=0">and a.organizationId=#{organizationId}</if>
|
|
<if test="organizationId!=0">and a.organizationId=#{organizationId}</if>
|
|
<if test="userId!=0">and a.userId=#{userId}</if>
|
|
<if test="userId!=0">and a.userId=#{userId}</if>
|
|
|
|
+ and isDelete != 1
|
|
</where>
|
|
</where>
|
|
</select>
|
|
</select>
|
|
|
|
|
|
@@ -36,11 +40,18 @@
|
|
</insert>
|
|
</insert>
|
|
|
|
|
|
<delete id="delete">
|
|
<delete id="delete">
|
|
- DELETE FROM customer WHERE id = #{id}
|
|
|
|
|
|
+ UPDATE customer SET isDelete = 1 WHERE id = #{id}
|
|
</delete>
|
|
</delete>
|
|
|
|
|
|
<update id="update" parameterType="com.bosshand.virgo.core.model.Customer">
|
|
<update id="update" parameterType="com.bosshand.virgo.core.model.Customer">
|
|
- UPDATE customer SET userId = #{userId} WHERE id = #{id}
|
|
|
|
|
|
+ UPDATE customer
|
|
|
|
+ <trim prefix="set" suffixOverrides=",">
|
|
|
|
+ <if test="nickName!=null">nickName=#{nickName},</if>
|
|
|
|
+ <if test="avatarUrl!=null">avatarUrl=#{avatarUrl},</if>
|
|
|
|
+ <if test="organizationId!=0">organizationId=#{organizationId},</if>
|
|
|
|
+ <if test="userId!=0">userId=#{userId},</if>
|
|
|
|
+ </trim>
|
|
|
|
+ WHERE id = #{id}
|
|
</update>
|
|
</update>
|
|
|
|
|
|
<select id="getTotalCount" parameterType="com.bosshand.virgo.core.model.Customer" resultType="Integer">
|
|
<select id="getTotalCount" parameterType="com.bosshand.virgo.core.model.Customer" resultType="Integer">
|
|
@@ -49,6 +60,7 @@
|
|
<if test="customerId!=null">and customerId=#{customerId}</if>
|
|
<if test="customerId!=null">and customerId=#{customerId}</if>
|
|
<if test="organizationId!=0">and organizationId=#{organizationId}</if>
|
|
<if test="organizationId!=0">and organizationId=#{organizationId}</if>
|
|
<if test="userId!=0">and userId=#{userId}</if>
|
|
<if test="userId!=0">and userId=#{userId}</if>
|
|
|
|
+ and isDelete != 1
|
|
</where>
|
|
</where>
|
|
</select>
|
|
</select>
|
|
|
|
|
|
@@ -58,6 +70,7 @@
|
|
<if test="p.customerId!=null">and a.customerId=#{p.customerId}</if>
|
|
<if test="p.customerId!=null">and a.customerId=#{p.customerId}</if>
|
|
<if test="p.organizationId!=0">and a.organizationId=#{p.organizationId}</if>
|
|
<if test="p.organizationId!=0">and a.organizationId=#{p.organizationId}</if>
|
|
<if test="p.userId!=0">and a.userId=#{p.userId}</if>
|
|
<if test="p.userId!=0">and a.userId=#{p.userId}</if>
|
|
|
|
+ and a.isDelete != 1
|
|
</where>
|
|
</where>
|
|
limit #{currIndex} , #{pageSize}
|
|
limit #{currIndex} , #{pageSize}
|
|
</select>
|
|
</select>
|