| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269 |
- <?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.bz.smart_city.dao.CustomerMapper">
- <!--auto generated Code-->
- <resultMap id="BaseResultMap" type="com.bz.smart_city.entity.Customer">
- <result column="id" property="id" jdbcType="INTEGER"/>
- <result column="site_id" property="siteId" jdbcType="INTEGER"/>
- <result column="customer_name" property="customerName" jdbcType="VARCHAR"/>
- <result column="customer_phone" property="customerPhone" jdbcType="VARCHAR"/>
- <result column="customer_contact_person" property="customerContactPerson" jdbcType="VARCHAR"/>
- <result column="push_url" property="pushUrl" jdbcType="VARCHAR"/>
- <result column="customer_no" property="customerNo" jdbcType="VARCHAR"/>
- <result column="token" property="token" jdbcType="VARCHAR"/>
- <result column="remark" property="remark" jdbcType="VARCHAR"/>
- <result column="status" property="status" jdbcType="INTEGER"/>
- <result column="customer_org_id" property="customerOrgId" jdbcType="INTEGER"/>
- <result column="date_create" property="dateCreate" jdbcType="TIMESTAMP"/>
- <result column="date_update" property="dateUpdate" jdbcType="TIMESTAMP"/>
- <result column="create_by" property="createBy" jdbcType="VARCHAR"/>
- <result column="update_by" property="updateBy" jdbcType="VARCHAR"/>
- <result column="parent_id" property="parentId" jdbcType="INTEGER"/>
- <result column="children_num" property="childrenNum" jdbcType="INTEGER"/>
- </resultMap>
- <!--auto generated Code-->
- <sql id="Base_Column_List">
- id,
- site_id,
- customer_name,
- customer_phone,
- customer_contact_person,
- push_url,
- customer_no,
- token,
- remark,
- `status`,
- customer_org_id,
- date_create,
- date_update,
- create_by,
- update_by,
- parent_id,
- children_num
- </sql>
- <!--auto generated Code-->
- <insert id="insert" useGeneratedKeys="true" keyProperty="customer.id">
- INSERT INTO sc_customer (
- id,
- site_id,
- customer_name,
- customer_phone,
- customer_contact_person,
- push_url,
- customer_no,
- token,
- remark,
- `status`,
- customer_org_id,
- date_create,
- date_update,
- create_by,
- update_by,
- parent_id,
- children_num
- ) VALUES (
- #{customer.id,jdbcType=INTEGER},
- #{customer.siteId,jdbcType=INTEGER},
- #{customer.customerName,jdbcType=VARCHAR},
- #{customer.customerPhone,jdbcType=VARCHAR},
- #{customer.customerContactPerson,jdbcType=VARCHAR},
- #{customer.pushUrl,jdbcType=VARCHAR},
- #{customer.customerNo,jdbcType=VARCHAR}
- #{customer.token,jdbcType=VARCHAR}
- #{customer.remark,jdbcType=VARCHAR},
- #{customer.status,jdbcType=INTEGER},
- #{customer.customerOrgId,jdbcType=INTEGER},
- #{customer.dateCreate,jdbcType=TIMESTAMP},
- #{customer.dateUpdate,jdbcType=TIMESTAMP},
- #{customer.createBy,jdbcType=VARCHAR},
- #{customer.updateBy,jdbcType=VARCHAR},
- #{customer.parentId,jdbcType=INTEGER},
- #{customer.childrenNum,jdbcType=INTEGER}
- )
- </insert>
- <!--auto generated Code-->
- <insert id="insertSelective" useGeneratedKeys="true" keyProperty="customer.id">
- INSERT INTO sc_customer
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="customer.id!=null"> id,</if>
- <if test="customer.siteId!=null"> site_id,</if>
- <if test="customer.customerName!=null"> customer_name,</if>
- <if test="customer.customerPhone!=null"> customer_phone,</if>
- <if test="customer.customerContactPerson!=null"> customer_contact_person,</if>
- <if test="customer.pushUrl!=null"> push_url,</if>
- <if test="customer.customerNo!=null"> customer_no,</if>
- <if test="customer.token!=null"> token,</if>
- <if test="customer.remark!=null"> remark,</if>
- <if test="customer.status!=null"> `status`,</if>
- <if test="customer.customerOrgId!=null"> customer_org_id,</if>
- <if test="customer.dateCreate!=null"> date_create,</if>
- <if test="customer.dateUpdate!=null"> date_update,</if>
- <if test="customer.createBy!=null"> create_by,</if>
- <if test="customer.updateBy!=null"> update_by,</if>
- <if test="customer.parentId!=null"> parent_id,</if>
- <if test="customer.childrenNum!=null"> children_num,</if>
- </trim>
- VALUES
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="customer.id!=null">#{customer.id,jdbcType=INTEGER},
- </if>
- <if test="customer.siteId!=null">#{customer.siteId,jdbcType=INTEGER},
- </if>
- <if test="customer.customerName!=null">#{customer.customerName,jdbcType=VARCHAR},
- </if>
- <if test="customer.customerPhone!=null">#{customer.customerPhone,jdbcType=VARCHAR},
- </if>
- <if test="customer.customerContactPerson!=null">#{customer.customerContactPerson,jdbcType=VARCHAR},
- </if>
- <if test="customer.pushUrl!=null">#{customer.pushUrl,jdbcType=VARCHAR},
- </if>
- <if test="customer.customerNo!=null">#{customer.customerNo,jdbcType=VARCHAR},
- </if>
- <if test="customer.token!=null">#{customer.token,jdbcType=VARCHAR},
- </if>
- <if test="customer.remark!=null">#{customer.remark,jdbcType=VARCHAR},
- </if>
- <if test="customer.status!=null">#{customer.status,jdbcType=INTEGER},
- </if>
- <if test="customer.customerOrgId!=null">#{customer.customerOrgId,jdbcType=INTEGER},
- </if>
- <if test="customer.dateCreate!=null">#{customer.dateCreate,jdbcType=TIMESTAMP},
- </if>
- <if test="customer.dateUpdate!=null">#{customer.dateUpdate,jdbcType=TIMESTAMP},
- </if>
- <if test="customer.createBy!=null">#{customer.createBy,jdbcType=VARCHAR},
- </if>
- <if test="customer.updateBy!=null">#{customer.updateBy,jdbcType=VARCHAR},
- </if>
- <if test="customer.parentId!=null">#{customer.parentId,jdbcType=INTEGER},
- </if>
- <if test="customer.childrenNum!=null">#{customer.childrenNum,jdbcType=INTEGER},
- </if>
- </trim>
- </insert>
- <!--auto generated Code-->
- <insert id="insertList">
- INSERT INTO sc_customer (
- id,
- site_id,
- customer_name,
- customer_phone,
- customer_contact_person,
- push_url,
- customer_no,
- token,
- remark,
- `status`,
- customer_org_id,
- date_create,
- date_update,
- create_by,
- update_by,
- parent_id,
- children_num
- )VALUES
- <foreach collection="customers" item="customer" index="index" separator=",">
- (
- #{customer.id,jdbcType=INTEGER},
- #{customer.siteId,jdbcType=INTEGER},
- #{customer.customerName,jdbcType=VARCHAR},
- #{customer.customerPhone,jdbcType=VARCHAR},
- #{customer.customerContactPerson,jdbcType=VARCHAR},
- #{customer.pushUrl,jdbcType=VARCHAR},
- #{customer.customerNo,jdbcType=VARCHAR},
- #{customer.token,jdbcType=VARCHAR},
- #{customer.remark,jdbcType=VARCHAR},
- #{customer.status,jdbcType=INTEGER},
- #{customer.customerOrgId,jdbcType=INTEGER},
- #{customer.dateCreate,jdbcType=TIMESTAMP},
- #{customer.dateUpdate,jdbcType=TIMESTAMP},
- #{customer.createBy,jdbcType=VARCHAR},
- #{customer.updateBy,jdbcType=VARCHAR},
- #{customer.parentId,jdbcType=INTEGER},
- #{customer.childrenNum,jdbcType=INTEGER}
- )
- </foreach>
- </insert>
- <!--auto generated Code-->
- <update id="updateByPrimaryKeySelective">
- UPDATE sc_customer
- <set>
- <if test="customer.siteId != null"> site_id= #{customer.siteId,jdbcType=INTEGER},</if>
- <if test="customer.customerName != null"> customer_name= #{customer.customerName,jdbcType=VARCHAR},</if>
- <if test="customer.customerPhone != null"> customer_phone= #{customer.customerPhone,jdbcType=VARCHAR},</if>
- <if test="customer.customerContactPerson != null"> customer_contact_person= #{customer.customerContactPerson,jdbcType=VARCHAR},</if>
- <if test="customer.pushUrl != null"> push_url= #{customer.pushUrl,jdbcType=VARCHAR},</if>
- <if test="customer.customerNo != null"> customer_no= #{customer.customerNo,jdbcType=VARCHAR},</if>
- <if test="customer.token != null"> token= #{customer.token,jdbcType=VARCHAR},</if>
- <if test="customer.remark != null"> remark= #{customer.remark,jdbcType=VARCHAR},</if>
- <if test="customer.status != null"> `status`= #{customer.status,jdbcType=INTEGER},</if>
- <if test="customer.customerOrgId != null"> customer_org_id= #{customer.customerOrgId,jdbcType=INTEGER},</if>
- <if test="customer.dateCreate != null"> date_create= #{customer.dateCreate,jdbcType=TIMESTAMP},</if>
- <if test="customer.dateUpdate != null"> date_update= #{customer.dateUpdate,jdbcType=TIMESTAMP},</if>
- <if test="customer.createBy != null"> create_by= #{customer.createBy,jdbcType=VARCHAR},</if>
- <if test="customer.updateBy != null"> update_by= #{customer.updateBy,jdbcType=VARCHAR},</if>
- <if test="customer.parentId != null"> parent_id= #{customer.parentId,jdbcType=INTEGER},</if>
- <if test="customer.childrenNum != null"> children_num= #{customer.childrenNum,jdbcType=INTEGER}</if>
- </set>
- WHERE id = #{customer.id,jdbcType=INTEGER}
- </update>
- <select id="getList" resultMap="BaseResultMap">
- select id,customer_name from sc_customer where status = 1
- <if test="siteId != null and siteId != 0 "> and site_id = #{siteId,jdbcType=INTEGER}</if>
- </select>
- <select id="getCustomerList" resultType="com.bz.smart_city.dto.CustomerDto">
- select <include refid="Base_Column_List"></include> from sc_customer
- where status = 1
- <if test="siteId != null"> and site_id = #{siteId} </if>
- <if test="customerName != null and customerName != ''"> and customer_name like concat('%',#{customerName} ,'%')</if>
- order by date_create desc
- </select>
- <select id="findByNameUnique" resultType="int">
- select count(1) from sc_customer where status = 1 and customer_name = #{customerName}
- <if test="siteId != null"> and site_id = #{siteId} </if>
- <if test="id != null"> and id != #{id}</if>
- </select>
- <select id="findByNoUnique" resultType="int">
- select count(1) from sc_customer where status = 1 and customer_no = #{customerNo}
- </select>
- <select id="findById" resultMap="BaseResultMap">
- select <include refid="Base_Column_List"/> from sc_customer where status = 1 and id = #{customerId}
- </select>
- <select id="findByIds" resultType="com.bz.smart_city.entity.Customer">
- select <include refid="Base_Column_List"></include> from sc_customer where 1 = 1
- <if test="ids != null">
- and id in <foreach collection="ids" item="item" open="(" separator="," close=")">#{item}</foreach>
- </if>
- </select>
- <select id="getListById" resultMap="BaseResultMap">
- select id,customer_name,customer_no from sc_customer where status = 1
- and id = #{customerId}
- </select>
- <select id="getCustomerTree" resultType="com.bz.smart_city.dto.CustomerDto">
- select <include refid="Base_Column_List"></include> from sc_customer
- where status = 1
- <if test="siteId != null"> and site_id = #{siteId} </if>
- <if test="customerName != null and customerName != ''"> and customer_name like concat('%',#{customerName} ,'%')</if>
- order by date_create desc
- </select>
- <select id="countChildrenNum" resultType="java.lang.Integer">
- select count(1) from sc_customer where status = 1 and parent_id = #{customerId}
- </select>
- <select id="getCustomerByCustomerno" resultType="com.bz.smart_city.dto.CustomerDto">
- select <include refid="Base_Column_List"></include> from sc_customer
- where status = 1 and customer_no = #{customerNo}
- order by date_create desc
- </select>
- </mapper>
|