yj
2020-03-06 207dc8655711cddac2653e18b51e58a88dba2084
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?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.yeshi.fanli.dao.mybatis.CustomerNameMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.system.CustomerName">
    <id column="id" property="id" jdbcType="BIGINT"/>
    <result column="name" property="name" jdbcType="VARCHAR"/>
    <result column="createTime" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="type" property="type" jdbcType="INTEGER"/>
  </resultMap>
  <sql id="Base_Column_List">id,`name`,createTime,`type`</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_customer_name where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_customer_name where id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.system.CustomerName" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_customer_name (id,`name`,createTime,`type`) values (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{type,jdbcType=INTEGER})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.system.CustomerName" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_customer_name
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">id,</if>
      <if test="name != null">`name`,</if>
      <if test="createTime != null">createTime,</if>
      <if test="type != null">`type`,</if>
    </trim>values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">#{id,jdbcType=BIGINT},</if>
      <if test="name != null">#{name,jdbcType=VARCHAR},</if>
      <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="type != null">#{type,jdbcType=INTEGER},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.system.CustomerName">update yeshi_ec_customer_name set `name` = #{name,jdbcType=VARCHAR},createTime = #{createTime,jdbcType=TIMESTAMP},`type` = #{type,jdbcType=INTEGER} where id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.system.CustomerName">update yeshi_ec_customer_name
    <set>
      <if test="name != null">`name`=#{name,jdbcType=VARCHAR},</if>
      <if test="createTime != null">createTime=#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="type != null">`type`=#{type,jdbcType=INTEGER},</if>
    </set> where id = #{id,jdbcType=BIGINT}
  </update>
  
  <select id="listByTypeAndName" resultMap="BaseResultMap">
      SELECT * FROM  yeshi_ec_customer_name cn
    WHERE cn.`type` = #{type} AND cn.`name` LIKE '%${key}%'
    ORDER BY cn.`createtime` ASC
    LIMIT #{start},#{count}
  </select>
  
  
</mapper>