mapper sql语句

	<?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="crm.mapper.CustomerMapper">
	
	    <!--根据条件查询分页查用户-->
	    <select id="selectByQueryVo" resultType="crm.pojo.Customer" parameterType="crm.pojo.QueryVo">
	      select * from customer
	      <where>
	            <if test="custName != null and custName != ''  " >
	                cust_name like "%"#{custName}"%"
	            </if>
	            <if test="custSource != '' and custSource != null">
	                and cust_source = #{custSource}
	            </if>
	            <if test="custIndustry != '' and custIndustry != null">
	                and cust_industry = #{custIndustry}
	            </if>
	            <if test="custLevel != '' and custLevel != null">
	                and cust_level = #{custLevel}
	            </if>
	        </where>
	        limit #{begin},#{size}
	    </select>
	
	    <!--总条数-->
	    <select id="countByQueryVo" resultType="Integer" parameterType="crm.pojo.QueryVo">
	        select count(1) from customer
	        <where>
	            <if test="custName != null and custName != ''  " >
	                cust_name like "%"#{custName}"%"
	            </if>
	
	            <if test="custSource != null and custSource != ''">
	                and cust_source = #{custSource}
	            </if>
	
	            <if test="custIndustry != null and custIndustry != ''">
	                and cust_industry = #{custIndustry}
	            </if>
	
	            <if test="custLevel != null and custLevel != ''">
	                and cust_level = #{custLevel}
	            </if>
	        </where>
	    </select>
	    <!--根据用户id查-->
	    <select id="selectCustomerById" resultType="crm.pojo.Customer" parameterType="Integer">
	        select * from customer
	        <where>
	            cust_id = #{id}
	        </where>
	    </select>
	
	    <!--更新用户-->
	    <update id="updateCustomer" parameterType="crm.pojo.Customer">
	        update customer
	        <!--set可以去掉里面最后一句多的,-->
	        <set>
	            <if test="cust_name != null">
	                cust_name = #{cust_name},
	            </if>
	            <if test="cust_linkman != null">
	                cust_linkman = #{cust_linkman}
	            </if>
	        </set>
	        <where>
	            cust_id = #{cust_id}
	        </where>
	
	    </update>
	
	    <!--删除用户-->
	    <delete id="deleteCustomer" parameterType="Integer">
	        delete  from customer where cust_id = #{id}
	    </delete>
	</mapper>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值