CRM(Mapper层)详细代码

news2024/11/26 18:27:10

Mapper详细代码:

 

DicValueMapper:

package com.bjpowernode.crm.settings.mapper;

import com.bjpowernode.crm.settings.domain.DicValue;

import java.util.List;

public interface DicValueMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_dic_value
     *
     * @mbggenerated Tue Nov 03 17:09:33 CST 2020
     */
    int deleteByPrimaryKey(String id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_dic_value
     *
     * @mbggenerated Tue Nov 03 17:09:33 CST 2020
     */
    int insert(DicValue record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_dic_value
     *
     * @mbggenerated Tue Nov 03 17:09:33 CST 2020
     */
    int insertSelective(DicValue record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_dic_value
     *
     * @mbggenerated Tue Nov 03 17:09:33 CST 2020
     */
    DicValue selectByPrimaryKey(String id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_dic_value
     *
     * @mbggenerated Tue Nov 03 17:09:33 CST 2020
     */
    int updateByPrimaryKeySelective(DicValue record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_dic_value
     *
     * @mbggenerated Tue Nov 03 17:09:33 CST 2020
     */
    int updateByPrimaryKey(DicValue record);

    /**
     * 根据typeCode查询数据字典值
     * @param typeCode
     * @return
     */
    List<DicValue> selectDicValueByTypeCode(String typeCode);

    /**
     * 通过id查询对应的字典表数据
     * @param id 字典数据id
     * @return 字典表数据
     */
    DicValue selectDicValueById(String id);
}

DicValueMapper.xml:

<?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.bjpowernode.crm.settings.mapper.DicValueMapper" >
  <resultMap id="BaseResultMap" type="com.bjpowernode.crm.settings.domain.DicValue" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Nov 03 17:09:33 CST 2020.
    -->
    <id column="id" property="id" jdbcType="CHAR" />
    <result column="value" property="value" jdbcType="VARCHAR" />
    <result column="text" property="text" jdbcType="VARCHAR" />
    <result column="order_no" property="orderNo" jdbcType="VARCHAR" />
    <result column="type_code" property="typeCode" jdbcType="VARCHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Nov 03 17:09:33 CST 2020.
    -->
    id, value, text, order_no, type_code
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Nov 03 17:09:33 CST 2020.
    -->
    select 
    <include refid="Base_Column_List" />
    from tbl_dic_value
    where id = #{id,jdbcType=CHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Nov 03 17:09:33 CST 2020.
    -->
    delete from tbl_dic_value
    where id = #{id,jdbcType=CHAR}
  </delete>
  <insert id="insert" parameterType="com.bjpowernode.crm.settings.domain.DicValue" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Nov 03 17:09:33 CST 2020.
    -->
    insert into tbl_dic_value (id, value, text, 
      order_no, type_code)
    values (#{id,jdbcType=CHAR}, #{value,jdbcType=VARCHAR}, #{text,jdbcType=VARCHAR}, 
      #{orderNo,jdbcType=VARCHAR}, #{typeCode,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.bjpowernode.crm.settings.domain.DicValue" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Nov 03 17:09:33 CST 2020.
    -->
    insert into tbl_dic_value
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="value != null" >
        value,
      </if>
      <if test="text != null" >
        text,
      </if>
      <if test="orderNo != null" >
        order_no,
      </if>
      <if test="typeCode != null" >
        type_code,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=CHAR},
      </if>
      <if test="value != null" >
        #{value,jdbcType=VARCHAR},
      </if>
      <if test="text != null" >
        #{text,jdbcType=VARCHAR},
      </if>
      <if test="orderNo != null" >
        #{orderNo,jdbcType=VARCHAR},
      </if>
      <if test="typeCode != null" >
        #{typeCode,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.bjpowernode.crm.settings.domain.DicValue" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Nov 03 17:09:33 CST 2020.
    -->
    update tbl_dic_value
    <set >
      <if test="value != null" >
        value = #{value,jdbcType=VARCHAR},
      </if>
      <if test="text != null" >
        text = #{text,jdbcType=VARCHAR},
      </if>
      <if test="orderNo != null" >
        order_no = #{orderNo,jdbcType=VARCHAR},
      </if>
      <if test="typeCode != null" >
        type_code = #{typeCode,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=CHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.bjpowernode.crm.settings.domain.DicValue" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Nov 03 17:09:33 CST 2020.
    -->
    update tbl_dic_value
    set value = #{value,jdbcType=VARCHAR},
      text = #{text,jdbcType=VARCHAR},
      order_no = #{orderNo,jdbcType=VARCHAR},
      type_code = #{typeCode,jdbcType=VARCHAR}
    where id = #{id,jdbcType=CHAR}
  </update>

  <!--根据typeCode查询数据字典值 <include refid="Base_Column_List"/>:使用sql语句片段-->
  <select id="selectDicValueByTypeCode" parameterType="string" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List"/>
    from tbl_dic_value
    where type_code=#{typeCode}
    order by order_no asc
  </select>

  <select id="selectDicValueById" parameterType="string" resultMap="BaseResultMap">
    select <include refid="Base_Column_List" />
    from tbl_dic_value
    where id = #{id}
  </select>
</mapper>

UserMapper:

package com.bjpowernode.crm.settings.mapper;

import com.bjpowernode.crm.settings.domain.User;

import java.util.List;
import java.util.Map;

public interface UserMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_user
     *
     * @mbggenerated Wed Sep 21 15:29:08 CST 2022
     */
    int deleteByPrimaryKey(String id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_user
     *
     * @mbggenerated Wed Sep 21 15:29:08 CST 2022
     */
    int insert(User record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_user
     *
     * @mbggenerated Wed Sep 21 15:29:08 CST 2022
     */
    int insertSelective(User record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_user
     *
     * @mbggenerated Wed Sep 21 15:29:08 CST 2022
     */
    User selectByPrimaryKey(String id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_user
     *
     * @mbggenerated Wed Sep 21 15:29:08 CST 2022
     */
    int updateByPrimaryKeySelective(User record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_user
     *
     * @mbggenerated Wed Sep 21 15:29:08 CST 2022
     */
    int updateByPrimaryKey(User record);

    //登录查询:根据账号和密码查询用户
    User selectUserByLoginActAndPwd(Map<String,Object> map);

    /**
     * 查询所有的用户
     * @return
     */
    List<User> selectAllUsers();
}

 UserMapper.xml:

<?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.bjpowernode.crm.settings.mapper.UserMapper" >
  <resultMap id="BaseResultMap" type="com.bjpowernode.crm.settings.domain.User" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Sep 21 15:29:08 CST 2022.
    -->
    <id column="id" property="id" jdbcType="CHAR" />
    <result column="login_act" property="loginAct" jdbcType="VARCHAR" />
    <result column="name" property="name" jdbcType="VARCHAR" />
    <result column="login_pwd" property="loginPwd" jdbcType="VARCHAR" />
    <result column="email" property="email" jdbcType="VARCHAR" />
    <result column="expire_time" property="expireTime" jdbcType="CHAR" />
    <result column="lock_state" property="lockState" jdbcType="CHAR" />
    <result column="deptno" property="deptno" jdbcType="CHAR" />
    <result column="allow_ips" property="allowIps" jdbcType="VARCHAR" />
    <result column="createTime" property="createtime" jdbcType="CHAR" />
    <result column="create_by" property="createBy" jdbcType="VARCHAR" />
    <result column="edit_time" property="editTime" jdbcType="CHAR" />
    <result column="edit_by" property="editBy" jdbcType="VARCHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Sep 21 15:29:08 CST 2022.
    -->
    id, login_act, name, login_pwd, email, expire_time, lock_state, deptno, allow_ips, 
    createTime, create_by, edit_time, edit_by
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Sep 21 15:29:08 CST 2022.
    -->
    select 
    <include refid="Base_Column_List" />
    from tbl_user
    where id = #{id,jdbcType=CHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Sep 21 15:29:08 CST 2022.
    -->
    delete from tbl_user
    where id = #{id,jdbcType=CHAR}
  </delete>
  <insert id="insert" parameterType="com.bjpowernode.crm.settings.domain.User" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Sep 21 15:29:08 CST 2022.
    -->
    insert into tbl_user (id, login_act, name, 
      login_pwd, email, expire_time, 
      lock_state, deptno, allow_ips, 
      createTime, create_by, edit_time, 
      edit_by)
    values (#{id,jdbcType=CHAR}, #{loginAct,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, 
      #{loginPwd,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{expireTime,jdbcType=CHAR}, 
      #{lockState,jdbcType=CHAR}, #{deptno,jdbcType=CHAR}, #{allowIps,jdbcType=VARCHAR}, 
      #{createtime,jdbcType=CHAR}, #{createBy,jdbcType=VARCHAR}, #{editTime,jdbcType=CHAR}, 
      #{editBy,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.bjpowernode.crm.settings.domain.User" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Sep 21 15:29:08 CST 2022.
    -->
    insert into tbl_user
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="loginAct != null" >
        login_act,
      </if>
      <if test="name != null" >
        name,
      </if>
      <if test="loginPwd != null" >
        login_pwd,
      </if>
      <if test="email != null" >
        email,
      </if>
      <if test="expireTime != null" >
        expire_time,
      </if>
      <if test="lockState != null" >
        lock_state,
      </if>
      <if test="deptno != null" >
        deptno,
      </if>
      <if test="allowIps != null" >
        allow_ips,
      </if>
      <if test="createtime != null" >
        createTime,
      </if>
      <if test="createBy != null" >
        create_by,
      </if>
      <if test="editTime != null" >
        edit_time,
      </if>
      <if test="editBy != null" >
        edit_by,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=CHAR},
      </if>
      <if test="loginAct != null" >
        #{loginAct,jdbcType=VARCHAR},
      </if>
      <if test="name != null" >
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="loginPwd != null" >
        #{loginPwd,jdbcType=VARCHAR},
      </if>
      <if test="email != null" >
        #{email,jdbcType=VARCHAR},
      </if>
      <if test="expireTime != null" >
        #{expireTime,jdbcType=CHAR},
      </if>
      <if test="lockState != null" >
        #{lockState,jdbcType=CHAR},
      </if>
      <if test="deptno != null" >
        #{deptno,jdbcType=CHAR},
      </if>
      <if test="allowIps != null" >
        #{allowIps,jdbcType=VARCHAR},
      </if>
      <if test="createtime != null" >
        #{createtime,jdbcType=CHAR},
      </if>
      <if test="createBy != null" >
        #{createBy,jdbcType=VARCHAR},
      </if>
      <if test="editTime != null" >
        #{editTime,jdbcType=CHAR},
      </if>
      <if test="editBy != null" >
        #{editBy,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.bjpowernode.crm.settings.domain.User" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Sep 21 15:29:08 CST 2022.
    -->
    update tbl_user
    <set >
      <if test="loginAct != null" >
        login_act = #{loginAct,jdbcType=VARCHAR},
      </if>
      <if test="name != null" >
        name = #{name,jdbcType=VARCHAR},
      </if>
      <if test="loginPwd != null" >
        login_pwd = #{loginPwd,jdbcType=VARCHAR},
      </if>
      <if test="email != null" >
        email = #{email,jdbcType=VARCHAR},
      </if>
      <if test="expireTime != null" >
        expire_time = #{expireTime,jdbcType=CHAR},
      </if>
      <if test="lockState != null" >
        lock_state = #{lockState,jdbcType=CHAR},
      </if>
      <if test="deptno != null" >
        deptno = #{deptno,jdbcType=CHAR},
      </if>
      <if test="allowIps != null" >
        allow_ips = #{allowIps,jdbcType=VARCHAR},
      </if>
      <if test="createtime != null" >
        createTime = #{createtime,jdbcType=CHAR},
      </if>
      <if test="createBy != null" >
        create_by = #{createBy,jdbcType=VARCHAR},
      </if>
      <if test="editTime != null" >
        edit_time = #{editTime,jdbcType=CHAR},
      </if>
      <if test="editBy != null" >
        edit_by = #{editBy,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=CHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.bjpowernode.crm.settings.domain.User" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Sep 21 15:29:08 CST 2022.
    -->
    update tbl_user
    set login_act = #{loginAct,jdbcType=VARCHAR},
      name = #{name,jdbcType=VARCHAR},
      login_pwd = #{loginPwd,jdbcType=VARCHAR},
      email = #{email,jdbcType=VARCHAR},
      expire_time = #{expireTime,jdbcType=CHAR},
      lock_state = #{lockState,jdbcType=CHAR},
      deptno = #{deptno,jdbcType=CHAR},
      allow_ips = #{allowIps,jdbcType=VARCHAR},
      createTime = #{createtime,jdbcType=CHAR},
      create_by = #{createBy,jdbcType=VARCHAR},
      edit_time = #{editTime,jdbcType=CHAR},
      edit_by = #{editBy,jdbcType=VARCHAR}
    where id = #{id,jdbcType=CHAR}
  </update>

  <!--查询登录sql  <include refid="Base_Column_List"/> 复用上面所有字段-->
  <select id="selectUserByLoginActAndPwd" parameterType="map" resultMap="BaseResultMap">
     select
       <include refid="Base_Column_List"/>
     from tbl_user
     where login_act=#{loginAct} and login_pwd=#{loginPwd}
  </select>

  <!--查询所有用户  <include refid="Base_Column_List"/> 复用上面所有字段 -->
  <select id="selectAllUsers" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List"/>
    from tbl_user
    where lock_state='1'
  </select>
</mapper>

 

ActivityMapper:

package com.bjpowernode.crm.workbench.mapper;

import com.bjpowernode.crm.workbench.domain.Activity;
import com.bjpowernode.crm.workbench.domain.FunnelVO;

import java.util.List;
import java.util.Map;

public interface ActivityMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_activity
     *
     * @mbggenerated Fri Sep 23 16:59:16 CST 2022
     */
    int deleteByPrimaryKey(String id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_activity
     *
     * @mbggenerated Fri Sep 23 16:59:16 CST 2022
     */
    int insert(Activity record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_activity
     *
     * @mbggenerated Fri Sep 23 16:59:16 CST 2022
     */
    int insertSelective(Activity record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_activity
     *
     * @mbggenerated Fri Sep 23 16:59:16 CST 2022
     */
    Activity selectByPrimaryKey(String id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_activity
     *
     * @mbggenerated Fri Sep 23 16:59:16 CST 2022
     */
    int updateByPrimaryKeySelective(Activity record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_activity
     *
     * @mbggenerated Fri Sep 23 16:59:16 CST 2022
     */
    int updateByPrimaryKey(Activity record);

    //保存创建的市场活动
    int insertActivity(Activity record);

    /**
     * 根据条件分页查询市场活动的列表
     * @param map
     * @return
     */
    List<Activity> selectActivityByConditionForPage(Map<String,Object> map);

    /**
     * 根据条件查询市场活动的总条数
     * @param map
     * @return
     */
    int selectCountOfActivityByCondition(Map<String,Object> map);

    /**
     * 根据ids数组批量删除市场活动
     * @param ids
     * @return
     */
    int deleteActivityByIds(String[] ids);

    /**
     * 根据id查询市场活动的信息
     * @param id
     * @return
     */
    Activity selectActivityById(String id);

    /**
     * 保存修改的市场活动
     * @param activity
     * @return
     */
    int updateActivity(Activity activity);

    /**
     * 查询所有的市场活动进行导出
     * @return
     */
    List<Activity> selectAllActivitys();

    /**
     * 批量保存创建的市场活动
     * @param activityList
     * @return
     */
    int insertActivityByList(List<Activity> activityList);

    /**
     * 根据id查询市场活动的明细信息
     * @param id
     * @return
     */
    Activity selectActivityForDetailById(String id);



    /**
     * 根据clueId查询该线索相关联的市场活动的明细信息
     * @param clueId
     * @return
     */
    List<Activity> selectActivityForDetailByClueId(String clueId);

    /**
     * 根据name模糊查询市场活动,并且把已经跟clueId关联过的市场活动排除
     * @param map
     * @return
     */
    List<Activity> selectActivityForDetailByNameClueId(Map<String,Object> map);

    /**
     * 根据name模糊查询市场活动,并且查询那些跟clueId关联过的市场活动
     * @param map
     * @return
     */
    List<Activity> selectActivityForConvertByNameClueId(Map<String,Object> map);







    /**
     * 通过市场活动id数组查询所有市场活动
     * @param ids 市场活动id数组
     * @return 市场活动集合
     */
    List<Activity> selectActivityForDetailByIds(String[] ids);

    /**
     * 通过市场活动模糊查询市场活动,并且查询那些跟clueId关联过的市场活动
     * @param map 封装的线索id和市场活动名参数
     * @return 市场活动集合
     */
    List<Activity> selectActivityForConvertByNameAndClueId(Map<String, Object> map);

    /**
     * 通过联系人id查询该联系人绑定的所有市场活动
     * @param contactsId 联系人id
     * @return 市场活动集合
     */
    List<Activity> selectActivityForDetailByContactsId(String contactsId);

    /**
     * 通过市场活动名和联系人id模糊查询市场活动
     * @param map 封装的联系人id和市场活动名参数
     * @return 市场活动集合
     */
    List<Activity> selectActivityForDetailByNameAndContactsId(Map<String, Object> map);

    /**
     * 通过市场活动名称进行模糊查询
     * @param activityName 市场活动模糊名称
     * @return 查询到的对应的市场活动
     */
    List<Activity> selectActivityByFuzzyName(String activityName);

    /**
     * 查询市场活动表中各个所有者的数据量
     * @return 数据集合
     */
    List<FunnelVO> selectCountOfActivityGroupByOwner();
}

 ActivityMappe.xmlr:

<?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.bjpowernode.crm.workbench.mapper.ActivityMapper" >
  <resultMap id="BaseResultMap" type="com.bjpowernode.crm.workbench.domain.Activity" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Sep 23 16:59:16 CST 2022.
    -->
    <id column="id" property="id" jdbcType="CHAR" />
    <result column="owner" property="owner" jdbcType="CHAR" />
    <result column="name" property="name" jdbcType="VARCHAR" />
    <result column="start_date" property="startDate" jdbcType="CHAR" />
    <result column="end_date" property="endDate" jdbcType="CHAR" />
    <result column="cost" property="cost" jdbcType="VARCHAR" />
    <result column="description" property="description" jdbcType="VARCHAR" />
    <result column="create_time" property="createTime" jdbcType="CHAR" />
    <result column="create_by" property="createBy" jdbcType="VARCHAR" />
    <result column="edit_time" property="editTime" jdbcType="CHAR" />
    <result column="edit_by" property="editBy" jdbcType="VARCHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Sep 23 16:59:16 CST 2022.
    -->
    id, owner, name, start_date, end_date, cost, description, create_time, create_by, 
    edit_time, edit_by
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Sep 23 16:59:16 CST 2022.
    -->
    select 
    <include refid="Base_Column_List" />
    from tbl_activity
    where id = #{id,jdbcType=CHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Sep 23 16:59:16 CST 2022.
    -->
    delete from tbl_activity
    where id = #{id,jdbcType=CHAR}
  </delete>

  <insert id="insertSelective" parameterType="com.bjpowernode.crm.workbench.domain.Activity" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Sep 23 16:59:16 CST 2022.
    -->
    insert into tbl_activity
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="owner != null" >
        owner,
      </if>
      <if test="name != null" >
        name,
      </if>
      <if test="startDate != null" >
        start_date,
      </if>
      <if test="endDate != null" >
        end_date,
      </if>
      <if test="cost != null" >
        cost,
      </if>
      <if test="description != null" >
        description,
      </if>
      <if test="createTime != null" >
        create_time,
      </if>
      <if test="createBy != null" >
        create_by,
      </if>
      <if test="editTime != null" >
        edit_time,
      </if>
      <if test="editBy != null" >
        edit_by,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=CHAR},
      </if>
      <if test="owner != null" >
        #{owner,jdbcType=CHAR},
      </if>
      <if test="name != null" >
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="startDate != null" >
        #{startDate,jdbcType=CHAR},
      </if>
      <if test="endDate != null" >
        #{endDate,jdbcType=CHAR},
      </if>
      <if test="cost != null" >
        #{cost,jdbcType=VARCHAR},
      </if>
      <if test="description != null" >
        #{description,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null" >
        #{createTime,jdbcType=CHAR},
      </if>
      <if test="createBy != null" >
        #{createBy,jdbcType=VARCHAR},
      </if>
      <if test="editTime != null" >
        #{editTime,jdbcType=CHAR},
      </if>
      <if test="editBy != null" >
        #{editBy,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.bjpowernode.crm.workbench.domain.Activity" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Sep 23 16:59:16 CST 2022.
    -->
    update tbl_activity
    <set >
      <if test="owner != null" >
        owner = #{owner,jdbcType=CHAR},
      </if>
      <if test="name != null" >
        name = #{name,jdbcType=VARCHAR},
      </if>
      <if test="startDate != null" >
        start_date = #{startDate,jdbcType=CHAR},
      </if>
      <if test="endDate != null" >
        end_date = #{endDate,jdbcType=CHAR},
      </if>
      <if test="cost != null" >
        cost = #{cost,jdbcType=VARCHAR},
      </if>
      <if test="description != null" >
        description = #{description,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null" >
        create_time = #{createTime,jdbcType=CHAR},
      </if>
      <if test="createBy != null" >
        create_by = #{createBy,jdbcType=VARCHAR},
      </if>
      <if test="editTime != null" >
        edit_time = #{editTime,jdbcType=CHAR},
      </if>
      <if test="editBy != null" >
        edit_by = #{editBy,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=CHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.bjpowernode.crm.workbench.domain.Activity" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Sep 23 16:59:16 CST 2022.
    -->
    update tbl_activity
    set owner = #{owner,jdbcType=CHAR},
      name = #{name,jdbcType=VARCHAR},
      start_date = #{startDate,jdbcType=CHAR},
      end_date = #{endDate,jdbcType=CHAR},
      cost = #{cost,jdbcType=VARCHAR},
      description = #{description,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=CHAR},
      create_by = #{createBy,jdbcType=VARCHAR},
      edit_time = #{editTime,jdbcType=CHAR},
      edit_by = #{editBy,jdbcType=VARCHAR}
    where id = #{id,jdbcType=CHAR}
  </update>

  <!--添加市场活动-->
  <insert id="insertActivity" parameterType="com.bjpowernode.crm.workbench.domain.Activity" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Oct 22 08:57:21 CST 2020.
    -->
    insert into tbl_activity (id, owner, name, start_date,
    end_date, cost, description,
    create_time, create_by)
    values (#{id,jdbcType=CHAR}, #{owner,jdbcType=CHAR}, #{name,jdbcType=VARCHAR}, #{startDate,jdbcType=CHAR},
    #{endDate,jdbcType=CHAR}, #{cost,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
    #{createTime,jdbcType=CHAR}, #{createBy,jdbcType=VARCHAR})
  </insert>

  <!--条件分页查询市场活动的列表-->
  <select id="selectActivityByConditionForPage" parameterType="map" resultMap="BaseResultMap">
    select a.id,u1.name as owner,a.name,a.start_date,a.end_date,a.cost,a.description,a.create_time,
    u2.name as create_by,a.edit_time,u3.name as edit_by
    from tbl_activity a
    join tbl_user u1 on a.owner=u1.id
    join tbl_user u2 on a.create_by=u2.id
    left join tbl_user u3 on a.edit_by=u3.id
    <where>
      <if test="name!=null and name!=''">
        and a.name like '%' #{name} '%'
      </if>
      <if test="owner!=null and owner!=''">
        and u1.name like '%' #{owner} '%'
      </if>
      <if test="startDate!=null and startDate!=''">
        and a.start_date&gt;=#{startDate}
      </if>
      <if test="endDate!=null and endDate!=''">
        and a.end_date&lt;=#{endDate}
      </if>
    </where>
    order by a.create_time desc
    limit #{beginNo},#{pageSize}
  </select>

  <!--根据条件查询市场活动的总条数-->
  <select id="selectCountOfActivityByCondition" parameterType="map" resultType="int">
    select count(*)
    from tbl_activity a
    join tbl_user u1 on a.owner=u1.id
    join tbl_user u2 on a.create_by=u2.id
    left join tbl_user u3 on a.edit_by=u3.id
    <where>
      <if test="name!=null and name!=''">
        and a.name like '%' #{name} '%'
      </if>
      <if test="owner!=null and owner!=''">
        and u1.name like '%' #{owner} '%'
      </if>
      <if test="startDate!=null and startDate!=''">
        and a.start_date&gt;=#{startDate}
      </if>
      <if test="endDate!=null and endDate!=''">
        and a.end_date&lt;=#{endDate}
      </if>
    </where>
  </select>

  <!--根据ids数组批量删除市场活动-->
  <delete id="deleteActivityByIds" parameterType="string">
    delete from tbl_activity where id in
    <foreach collection="array" item="id" separator="," open="(" close=")">
      #{id}
    </foreach>
  </delete>

  <!--根据id查询市场活动的信息  引用sql语句片段-->
  <select id="selectActivityById" parameterType="string" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List"/>
    from tbl_activity
    where id=#{id}
  </select>

  <!--保存修改的市场活动-->
  <update id="updateActivity" parameterType="com.bjpowernode.crm.workbench.domain.Activity">
       update tbl_activity
       set owner=#{owner},name=#{name},start_date=#{startDate},end_date=#{endDate},cost=#{cost},description=#{description},
           edit_time=#{editTime},edit_by=#{editBy}
      where id=#{id}
    </update>

  <!--查询所有的市场活动进行导出-->
  <select id="selectAllActivitys" resultMap="BaseResultMap">
    select a.id,u1.name as owner,a.name,a.start_date,a.end_date,a.cost,a.description,a.create_time,
          u2.name as create_by,a.edit_time,u3.name as edit_by
    from tbl_activity a
    join tbl_user u1 on a.owner=u1.id
    join tbl_user u2 on a.create_by=u2.id
    left join tbl_user u3 on a.edit_by=u3.id
    order by a.create_time desc
  </select>

  <!--批量保存创建的市场活动-->
  <insert id="insertActivityByList" parameterType="com.bjpowernode.crm.workbench.domain.Activity">
    insert into tbl_activity(id, owner, name, start_date, end_date, cost, description, create_time, create_by)
    values
    <foreach collection="list" item="obj" separator=",">
      (#{obj.id},#{obj.owner},#{obj.name},#{obj.startDate},#{obj.endDate},#{obj.cost},#{obj.description},#{obj.createTime},#{obj.createBy})
    </foreach>
  </insert>

    <!--根据id查询市场活动的明细信息-->
  <select id="selectActivityForDetailById" parameterType="string" resultMap="BaseResultMap">
      select a.id,u1.name as owner,a.name,a.start_date,a.end_date,a.cost,a.description,a.create_time,u2.name as create_by,
          a.edit_time,u3.name as edit_by
      from tbl_activity a
      join tbl_user u1 on a.owner=u1.id
      join tbl_user u2 on a.create_by=u2.id
      left join tbl_user u3 on a.edit_by=u3.id
      where a.id=#{id}
  </select>

  <!--根据clueId查询该线索相关联的市场活动的明细信息-->
  <select id="selectActivityForDetailByClueId" parameterType="string" resultMap="BaseResultMap">
    select a.id,a.name,a.start_date,a.end_date,u.name as owner
    from tbl_activity a
    join tbl_user u on a.owner=u.id
    join tbl_clue_activity_relation car on car.activity_id=a.id
    where car.clue_id=#{clueId}
  </select>

    <!--根据name模糊查询市场活动,并且把已经跟clueId关联过的市场活动排除-->
  <select id="selectActivityForDetailByNameClueId" parameterType="map" resultMap="BaseResultMap">
    select a.id,a.name,a.start_date,a.end_date,u.name as owner
    from tbl_activity a
    join tbl_user u on a.owner=u.id
    where a.name like '%' #{activityName} '%' and a.id not in (
        select activity_id
        from tbl_clue_activity_relation
        where clue_id=#{clueId}
      )
  </select>

    <!--通过市场活动id数组查询所有市场活动-->
  <select id="selectActivityForDetailByIds" parameterType="string" resultMap="BaseResultMap">
    select a.id,a.name,a.start_date,a.end_date,u.name as owner
    from tbl_activity a
    join tbl_user u on a.owner=u.id
    where a.id in
    <foreach collection="array" item="id" separator="," open="(" close=")">
      #{id, jdbcType=VARCHAR}
    </foreach>
  </select>

  <!--通过市场活动模糊查询市场活动,并且查询那些跟clueId关联过的市场活动-->
  <select id="selectActivityForConvertByNameAndClueId" parameterType="map" resultMap="BaseResultMap">
    select a.id,a.name,a.start_date,a.end_date,u.name as owner
    from tbl_activity a
    join tbl_user u on a.owner=u.id
    where a.name like '%' #{activityName} '%' and a.id in (
      select activity_id
      from tbl_clue_activity_relation
      where clue_id=#{clueId}
    )
  </select>

  <select id="selectActivityForDetailByContactsId" parameterType="string" resultMap="BaseResultMap">
    select a.id,a.name,a.start_date,a.end_date,u.name as owner
    from tbl_activity a
    join tbl_user u on a.owner=u.id
    join tbl_contacts_activity_relation car on car.activity_id=a.id
    where car.contacts_id=#{contactsId}
  </select>

  <select id="selectActivityForDetailByNameAndContactsId" parameterType="map" resultMap="BaseResultMap">
    select a.id,a.name,a.start_date,a.end_date,u.name as owner
    from tbl_activity a
    join tbl_user u on a.owner=u.id
    where a.name like '%' #{activityName} '%' and a.id not in (
        select activity_id
        from tbl_contacts_activity_relation
        where contacts_id=#{contactsId}
      )
  </select>

  <select id="selectActivityByFuzzyName" parameterType="string" resultMap="BaseResultMap">
    select a.id,a.name,a.start_date,a.end_date,u.name as owner
    from tbl_activity a
    join tbl_user u on a.owner=u.id
    where a.name like '%' #{activityName} '%';
  </select>

  <select id="selectCountOfActivityGroupByOwner" resultType="com.bjpowernode.crm.workbench.domain.FunnelVO">
    select count(*) as value,u.name as name
    from tbl_activity a
      join tbl_user u on a.owner=u.id
    group by u.name
  </select>


</mapper>

ActivityRemarkMapper:

package com.bjpowernode.crm.workbench.mapper;

import com.bjpowernode.crm.workbench.domain.ActivityRemark;

import java.util.List;

public interface ActivityRemarkMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_activity_remark
     *
     * @mbggenerated Sat Oct 31 14:13:10 CST 2020
     */
    int deleteByPrimaryKey(String id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_activity_remark
     *
     * @mbggenerated Sat Oct 31 14:13:10 CST 2020
     */
    int insert(ActivityRemark record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_activity_remark
     *
     * @mbggenerated Sat Oct 31 14:13:10 CST 2020
     */
    int insertSelective(ActivityRemark record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_activity_remark
     *
     * @mbggenerated Sat Oct 31 14:13:10 CST 2020
     */
    ActivityRemark selectByPrimaryKey(String id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_activity_remark
     *
     * @mbggenerated Sat Oct 31 14:13:10 CST 2020
     */
    int updateByPrimaryKeySelective(ActivityRemark record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_activity_remark
     *
     * @mbggenerated Sat Oct 31 14:13:10 CST 2020
     */
    int updateByPrimaryKey(ActivityRemark record);

    /**
     * 根据activityId查询该市场活动下所有备注的明细信息
     * @param activityId
     * @return
     */
    List<ActivityRemark> selectActivityRemarkForDetailByActivityId(String activityId);

    /**
     * 保存创建的市场活动备注
     * @param remark
     * @return
     */
    int insertActivityRemark(ActivityRemark remark);

    /**
     * 根据id删除市场活动备注
     * @param id
     * @return
     */
    int deleteActivityRemarkById(String id);

    /**
     * 保存修改的市场活动备注
     * @param remark
     * @return
     */
    int updateActivityRemark(ActivityRemark remark);
}

ActivityRemarkMapper.xml:

<?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.bjpowernode.crm.workbench.mapper.ActivityRemarkMapper" >
  <resultMap id="BaseResultMap" type="com.bjpowernode.crm.workbench.domain.ActivityRemark" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sat Oct 31 14:13:10 CST 2020.
    -->
    <id column="id" property="id" jdbcType="CHAR" />
    <result column="note_content" property="noteContent" jdbcType="VARCHAR" />
    <result column="create_time" property="createTime" jdbcType="CHAR" />
    <result column="create_by" property="createBy" jdbcType="VARCHAR" />
    <result column="edit_time" property="editTime" jdbcType="CHAR" />
    <result column="edit_by" property="editBy" jdbcType="VARCHAR" />
    <result column="edit_flag" property="editFlag" jdbcType="CHAR" />
    <result column="activity_id" property="activityId" jdbcType="CHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sat Oct 31 14:13:10 CST 2020.
    -->
    id, note_content, create_time, create_by, edit_time, edit_by, edit_flag, activity_id
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sat Oct 31 14:13:10 CST 2020.
    -->
    select 
    <include refid="Base_Column_List" />
    from tbl_activity_remark
    where id = #{id,jdbcType=CHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sat Oct 31 14:13:10 CST 2020.
    -->
    delete from tbl_activity_remark
    where id = #{id,jdbcType=CHAR}
  </delete>
  <insert id="insert" parameterType="com.bjpowernode.crm.workbench.domain.ActivityRemark" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sat Oct 31 14:13:10 CST 2020.
    -->
    insert into tbl_activity_remark (id, note_content, create_time, 
      create_by, edit_time, edit_by, 
      edit_flag, activity_id)
    values (#{id,jdbcType=CHAR}, #{noteContent,jdbcType=VARCHAR}, #{createTime,jdbcType=CHAR}, 
      #{createBy,jdbcType=VARCHAR}, #{editTime,jdbcType=CHAR}, #{editBy,jdbcType=VARCHAR}, 
      #{editFlag,jdbcType=CHAR}, #{activityId,jdbcType=CHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.bjpowernode.crm.workbench.domain.ActivityRemark" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sat Oct 31 14:13:10 CST 2020.
    -->
    insert into tbl_activity_remark
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="noteContent != null" >
        note_content,
      </if>
      <if test="createTime != null" >
        create_time,
      </if>
      <if test="createBy != null" >
        create_by,
      </if>
      <if test="editTime != null" >
        edit_time,
      </if>
      <if test="editBy != null" >
        edit_by,
      </if>
      <if test="editFlag != null" >
        edit_flag,
      </if>
      <if test="activityId != null" >
        activity_id,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=CHAR},
      </if>
      <if test="noteContent != null" >
        #{noteContent,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null" >
        #{createTime,jdbcType=CHAR},
      </if>
      <if test="createBy != null" >
        #{createBy,jdbcType=VARCHAR},
      </if>
      <if test="editTime != null" >
        #{editTime,jdbcType=CHAR},
      </if>
      <if test="editBy != null" >
        #{editBy,jdbcType=VARCHAR},
      </if>
      <if test="editFlag != null" >
        #{editFlag,jdbcType=CHAR},
      </if>
      <if test="activityId != null" >
        #{activityId,jdbcType=CHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.bjpowernode.crm.workbench.domain.ActivityRemark" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sat Oct 31 14:13:10 CST 2020.
    -->
    update tbl_activity_remark
    <set >
      <if test="noteContent != null" >
        note_content = #{noteContent,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null" >
        create_time = #{createTime,jdbcType=CHAR},
      </if>
      <if test="createBy != null" >
        create_by = #{createBy,jdbcType=VARCHAR},
      </if>
      <if test="editTime != null" >
        edit_time = #{editTime,jdbcType=CHAR},
      </if>
      <if test="editBy != null" >
        edit_by = #{editBy,jdbcType=VARCHAR},
      </if>
      <if test="editFlag != null" >
        edit_flag = #{editFlag,jdbcType=CHAR},
      </if>
      <if test="activityId != null" >
        activity_id = #{activityId,jdbcType=CHAR},
      </if>
    </set>
    where id = #{id,jdbcType=CHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.bjpowernode.crm.workbench.domain.ActivityRemark" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sat Oct 31 14:13:10 CST 2020.
    -->
    update tbl_activity_remark
    set note_content = #{noteContent,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=CHAR},
      create_by = #{createBy,jdbcType=VARCHAR},
      edit_time = #{editTime,jdbcType=CHAR},
      edit_by = #{editBy,jdbcType=VARCHAR},
      edit_flag = #{editFlag,jdbcType=CHAR},
      activity_id = #{activityId,jdbcType=CHAR}
    where id = #{id,jdbcType=CHAR}
  </update>

  <!--根据activityId查询该市场活动下所有备注的明细信息-->
  <select id="selectActivityRemarkForDetailByActivityId" parameterType="string" resultMap="BaseResultMap">
    select ar.id,ar.note_content,ar.create_time,u1.name as create_by,ar.edit_time,u2.name as edit_by,ar.edit_flag
    from tbl_activity_remark ar
    join tbl_user u1 on ar.create_by=u1.id
    left join tbl_user u2 on ar.edit_by=u2.id
    where ar.activity_id=#{activityId}
    order by ar.create_time asc
  </select>

    <!--保存创建的市场活动备注-->
  <insert id="insertActivityRemark" parameterType="com.bjpowernode.crm.workbench.domain.ActivityRemark">
    insert into tbl_activity_remark(id, note_content, create_time, create_by, edit_flag, activity_id)
    values(#{id},#{ noteContent},#{ createTime},#{ createBy},#{ editFlag},#{ activityId})
  </insert>

  <!--根据id删除市场活动备注-->
  <delete id="deleteActivityRemarkById" parameterType="string">
    delete from tbl_activity_remark where id=#{id}
  </delete>

    <!--保存修改的市场活动备注-->
    <update id="updateActivityRemark" parameterType="com.bjpowernode.crm.workbench.domain.ActivityRemark">
      update tbl_activity_remark
      set note_content=#{noteContent},edit_time=#{editTime},edit_by=#{editBy},edit_flag=#{editFlag}
      where id=#{id}
    </update>
</mapper>

ClueActivityRelationMapper:

package com.bjpowernode.crm.workbench.mapper;



import com.bjpowernode.crm.workbench.domain.ClueActivityRelation;

import java.util.List;

public interface ClueActivityRelationMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_clue_activity_relation
     *
     * @mbggenerated Sun Mar 20 16:47:36 CST 2022
     */
    int deleteByPrimaryKey(String id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_clue_activity_relation
     *
     * @mbggenerated Sun Mar 20 16:47:36 CST 2022
     */
    int insert(ClueActivityRelation record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_clue_activity_relation
     *
     * @mbggenerated Sun Mar 20 16:47:36 CST 2022
     */
    int insertSelective(ClueActivityRelation record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_clue_activity_relation
     *
     * @mbggenerated Sun Mar 20 16:47:36 CST 2022
     */
    ClueActivityRelation selectByPrimaryKey(String id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_clue_activity_relation
     *
     * @mbggenerated Sun Mar 20 16:47:36 CST 2022
     */
    int updateByPrimaryKeySelective(ClueActivityRelation record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_clue_activity_relation
     *
     * @mbggenerated Sun Mar 20 16:47:36 CST 2022
     */
    int updateByPrimaryKey(ClueActivityRelation record);

    /**
     * 批量保存线索新增关联的市场活动
     * @param clueActivityRelationList 线索和市场活动的关联关系集合
     * @return 新增条数
     */
    int insertCreateClueActivityRelationByList(List<ClueActivityRelation> clueActivityRelationList);

    /**
     * 通过市场活动id和线索id删除两者间的关系(绑定的市场活动)
     * @param clueActivityRelation 线索和市场活动的关联关系
     * @return 删除条数
     */
    int deleteClueActivityRelationByClueIdAndActivityId(ClueActivityRelation clueActivityRelation);

    /**
     * 通过线索id数组(因为可能删除多个线索和市场活动对应的关联关系)
     * @param clueIds 线索id数组
     * @return 删除的条数
     */
    int deleteClueActivityRelationByClueIds(String[] clueIds);

    /**
     * 通过线索id查询所有对应线索和市场活动关联关系
     * @param clueId 线索id
     * @return 关联关系集合
     */
    List<ClueActivityRelation> selectClueActivityRelationByClueId(String clueId);
}

 ClueActivityRelationMapper.xml:

<?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.bjpowernode.crm.workbench.mapper.ClueActivityRelationMapper" >
  <resultMap id="BaseResultMap" type="com.bjpowernode.crm.workbench.domain.ClueActivityRelation" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sun Mar 20 16:47:36 CST 2022.
    -->
    <id column="id" property="id" jdbcType="CHAR" />
    <result column="clue_id" property="clueId" jdbcType="CHAR" />
    <result column="activity_id" property="activityId" jdbcType="CHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sun Mar 20 16:47:36 CST 2022.
    -->
    id, clue_id, activity_id
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sun Mar 20 16:47:36 CST 2022.
    -->
    select 
    <include refid="Base_Column_List" />
    from tbl_clue_activity_relation
    where id = #{id,jdbcType=CHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sun Mar 20 16:47:36 CST 2022.
    -->
    delete from tbl_clue_activity_relation
    where id = #{id,jdbcType=CHAR}
  </delete>
  <insert id="insert" parameterType="com.bjpowernode.crm.workbench.domain.ClueActivityRelation" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sun Mar 20 16:47:36 CST 2022.
    -->
    insert into tbl_clue_activity_relation (id, clue_id, activity_id
      )
    values (#{id,jdbcType=CHAR}, #{clueId,jdbcType=CHAR}, #{activityId,jdbcType=CHAR}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.bjpowernode.crm.workbench.domain.ClueActivityRelation" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sun Mar 20 16:47:36 CST 2022.
    -->
    insert into tbl_clue_activity_relation
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="clueId != null" >
        clue_id,
      </if>
      <if test="activityId != null" >
        activity_id,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=CHAR},
      </if>
      <if test="clueId != null" >
        #{clueId,jdbcType=CHAR},
      </if>
      <if test="activityId != null" >
        #{activityId,jdbcType=CHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.bjpowernode.crm.workbench.domain.ClueActivityRelation" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sun Mar 20 16:47:36 CST 2022.
    -->
    update tbl_clue_activity_relation
    <set >
      <if test="clueId != null" >
        clue_id = #{clueId,jdbcType=CHAR},
      </if>
      <if test="activityId != null" >
        activity_id = #{activityId,jdbcType=CHAR},
      </if>
    </set>
    where id = #{id,jdbcType=CHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.bjpowernode.crm.workbench.domain.ClueActivityRelation" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sun Mar 20 16:47:36 CST 2022.
    -->
    update tbl_clue_activity_relation
    set clue_id = #{clueId,jdbcType=CHAR},
      activity_id = #{activityId,jdbcType=CHAR}
    where id = #{id,jdbcType=CHAR}
  </update>

  <!--批量保存线索新增关联的市场活动-->
  <insert id="insertCreateClueActivityRelationByList" parameterType="com.bjpowernode.crm.workbench.domain.ClueActivityRelation">
    insert into tbl_clue_activity_relation(id, clue_id, activity_id)
    values
    <foreach collection="list" item="obj" separator=",">
      (#{obj.id},#{obj.clueId},#{obj.activityId})
    </foreach>
  </insert>

  <!--通过市场活动id和线索id删除两者间的关系(绑定的市场活动)-->
  <delete id="deleteClueActivityRelationByClueIdAndActivityId" parameterType="com.bjpowernode.crm.workbench.domain.ClueActivityRelation">
    delete from tbl_clue_activity_relation
    where clue_id=#{clueId} and activity_id=#{activityId}
  </delete>

  <!--通过线索id数组(因为可能删除多个线索和市场活动对应的关联关系)-->
  <delete id="deleteClueActivityRelationByClueIds" parameterType="string">
    delete from tbl_clue_activity_relation
    where clue_id in
    <foreach collection="array" item="id" separator="," open="(" close=")">
      #{id}
    </foreach>
  </delete>

  <!--通过线索id查询所有对应线索和市场活动关联关系-->
  <select id="selectClueActivityRelationByClueId" parameterType="string" resultMap="BaseResultMap">
    select id,clue_id,activity_id
    from tbl_clue_activity_relation
    where clue_id=#{clueId}
  </select>
</mapper>

ClueMapper:

package com.bjpowernode.crm.workbench.mapper;



import com.bjpowernode.crm.workbench.domain.Clue;

import java.util.List;
import java.util.Map;

public interface ClueMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_clue
     *
     * @mbggenerated Thu Mar 17 15:29:56 CST 2022
     */
    int deleteByPrimaryKey(String id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_clue
     *
     * @mbggenerated Thu Mar 17 15:29:56 CST 2022
     */
    int insert(Clue record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_clue
     *
     * @mbggenerated Thu Mar 17 15:29:56 CST 2022
     */
    int insertSelective(Clue record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_clue
     *
     * @mbggenerated Thu Mar 17 15:29:56 CST 2022
     */
    Clue selectByPrimaryKey(String id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_clue
     *
     * @mbggenerated Thu Mar 17 15:29:56 CST 2022
     */
    int updateByPrimaryKeySelective(Clue record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_clue
     *
     * @mbggenerated Thu Mar 17 15:29:56 CST 2022
     */
    int updateByPrimaryKey(Clue record);

    /**
     * 新增线索
     * @param clue 新增的线索
     * @return 新增条数
     */
    int insertClue(Clue clue);

    /**
     * 根据条件分页查询线索列表
     * @param map 查询条件
     * @return 查询到的线索
     */
    List<Clue> selectClueByConditionForPage(Map<String, Object> map);

    /**
     * 根据条件查询线索总条数
     * @param map 查询条件
     * @return 线索总条数
     */
    int selectCountOfClueByCondition(Map<String, Object> map);

    /**
     * 通过id删除选则的线索
     * @param clueIds 线索id数组
     * @return 删除的条数
     */
    int deleteClueByIds(String[] clueIds);

    /**
     * 通过id查询线索
     * @param id 线索id
     * @return 对应id的线索
     */
    Clue selectClueById(String id);

    /**
     * 更新对应线索的数据
     * @param clue 更新的线索
     * @return 更新条数
     */
    int updateClue(Clue clue);

    /**
     * 通过id查询线索详情
     * @param id 线索id
     * @return 对应id的线索
     */
    Clue selectClueForDetailById(String id);

    List<String> selectClueStageOfClueGroupByClueStage();

    List<Integer> selectCountOfClueGroupByClueStage();
}

ClueMapper.xml:

<?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.bjpowernode.crm.workbench.mapper.ClueMapper" >
  <resultMap id="BaseResultMap" type="com.bjpowernode.crm.workbench.domain.Clue" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Nov 03 17:43:22 CST 2020.
    -->
    <id column="id" property="id" jdbcType="CHAR" />
    <result column="fullname" property="fullname" jdbcType="VARCHAR" />
    <result column="appellation" property="appellation" jdbcType="VARCHAR" />
    <result column="owner" property="owner" jdbcType="CHAR" />
    <result column="company" property="company" jdbcType="VARCHAR" />
    <result column="job" property="job" jdbcType="VARCHAR" />
    <result column="email" property="email" jdbcType="VARCHAR" />
    <result column="phone" property="phone" jdbcType="VARCHAR" />
    <result column="website" property="website" jdbcType="VARCHAR" />
    <result column="mphone" property="mphone" jdbcType="VARCHAR" />
    <result column="state" property="state" jdbcType="VARCHAR" />
    <result column="source" property="source" jdbcType="VARCHAR" />
    <result column="create_by" property="createBy" jdbcType="VARCHAR" />
    <result column="create_time" property="createTime" jdbcType="CHAR" />
    <result column="edit_by" property="editBy" jdbcType="VARCHAR" />
    <result column="edit_time" property="editTime" jdbcType="CHAR" />
    <result column="description" property="description" jdbcType="VARCHAR" />
    <result column="contact_summary" property="contactSummary" jdbcType="VARCHAR" />
    <result column="next_contact_time" property="nextContactTime" jdbcType="CHAR" />
    <result column="address" property="address" jdbcType="VARCHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Nov 03 17:43:22 CST 2020.
    -->
    id, fullname, appellation, owner, company, job, email, phone, website, mphone, state, 
    source, create_by, create_time, edit_by, edit_time, description, contact_summary, 
    next_contact_time, address
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Nov 03 17:43:22 CST 2020.
    -->
    select 
    <include refid="Base_Column_List" />
    from tbl_clue
    where id = #{id,jdbcType=CHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Nov 03 17:43:22 CST 2020.
    -->
    delete from tbl_clue
    where id = #{id,jdbcType=CHAR}
  </delete>
  <insert id="insert" parameterType="com.bjpowernode.crm.workbench.domain.Clue" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Nov 03 17:43:22 CST 2020.
    -->
    insert into tbl_clue (id, fullname, appellation, 
      owner, company, job, email, 
      phone, website, mphone, 
      state, source, create_by, 
      create_time, edit_by, edit_time, 
      description, contact_summary, next_contact_time, 
      address)
    values (#{id,jdbcType=CHAR}, #{fullname,jdbcType=VARCHAR}, #{appellation,jdbcType=VARCHAR}, 
      #{owner,jdbcType=CHAR}, #{company,jdbcType=VARCHAR}, #{job,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, 
      #{phone,jdbcType=VARCHAR}, #{website,jdbcType=VARCHAR}, #{mphone,jdbcType=VARCHAR}, 
      #{state,jdbcType=VARCHAR}, #{source,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, 
      #{createTime,jdbcType=CHAR}, #{editBy,jdbcType=VARCHAR}, #{editTime,jdbcType=CHAR}, 
      #{description,jdbcType=VARCHAR}, #{contactSummary,jdbcType=VARCHAR}, #{nextContactTime,jdbcType=CHAR}, 
      #{address,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.bjpowernode.crm.workbench.domain.Clue" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Nov 03 17:43:22 CST 2020.
    -->
    insert into tbl_clue
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="fullname != null" >
        fullname,
      </if>
      <if test="appellation != null" >
        appellation,
      </if>
      <if test="owner != null" >
        owner,
      </if>
      <if test="company != null" >
        company,
      </if>
      <if test="job != null" >
        job,
      </if>
      <if test="email != null" >
        email,
      </if>
      <if test="phone != null" >
        phone,
      </if>
      <if test="website != null" >
        website,
      </if>
      <if test="mphone != null" >
        mphone,
      </if>
      <if test="state != null" >
        state,
      </if>
      <if test="source != null" >
        source,
      </if>
      <if test="createBy != null" >
        create_by,
      </if>
      <if test="createTime != null" >
        create_time,
      </if>
      <if test="editBy != null" >
        edit_by,
      </if>
      <if test="editTime != null" >
        edit_time,
      </if>
      <if test="description != null" >
        description,
      </if>
      <if test="contactSummary != null" >
        contact_summary,
      </if>
      <if test="nextContactTime != null" >
        next_contact_time,
      </if>
      <if test="address != null" >
        address,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=CHAR},
      </if>
      <if test="fullname != null" >
        #{fullname,jdbcType=VARCHAR},
      </if>
      <if test="appellation != null" >
        #{appellation,jdbcType=VARCHAR},
      </if>
      <if test="owner != null" >
        #{owner,jdbcType=CHAR},
      </if>
      <if test="company != null" >
        #{company,jdbcType=VARCHAR},
      </if>
      <if test="job != null" >
        #{job,jdbcType=VARCHAR},
      </if>
      <if test="email != null" >
        #{email,jdbcType=VARCHAR},
      </if>
      <if test="phone != null" >
        #{phone,jdbcType=VARCHAR},
      </if>
      <if test="website != null" >
        #{website,jdbcType=VARCHAR},
      </if>
      <if test="mphone != null" >
        #{mphone,jdbcType=VARCHAR},
      </if>
      <if test="state != null" >
        #{state,jdbcType=VARCHAR},
      </if>
      <if test="source != null" >
        #{source,jdbcType=VARCHAR},
      </if>
      <if test="createBy != null" >
        #{createBy,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null" >
        #{createTime,jdbcType=CHAR},
      </if>
      <if test="editBy != null" >
        #{editBy,jdbcType=VARCHAR},
      </if>
      <if test="editTime != null" >
        #{editTime,jdbcType=CHAR},
      </if>
      <if test="description != null" >
        #{description,jdbcType=VARCHAR},
      </if>
      <if test="contactSummary != null" >
        #{contactSummary,jdbcType=VARCHAR},
      </if>
      <if test="nextContactTime != null" >
        #{nextContactTime,jdbcType=CHAR},
      </if>
      <if test="address != null" >
        #{address,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.bjpowernode.crm.workbench.domain.Clue" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Nov 03 17:43:22 CST 2020.
    -->
    update tbl_clue
    <set >
      <if test="fullname != null" >
        fullname = #{fullname,jdbcType=VARCHAR},
      </if>
      <if test="appellation != null" >
        appellation = #{appellation,jdbcType=VARCHAR},
      </if>
      <if test="owner != null" >
        owner = #{owner,jdbcType=CHAR},
      </if>
      <if test="company != null" >
        company = #{company,jdbcType=VARCHAR},
      </if>
      <if test="job != null" >
        job = #{job,jdbcType=VARCHAR},
      </if>
      <if test="email != null" >
        email = #{email,jdbcType=VARCHAR},
      </if>
      <if test="phone != null" >
        phone = #{phone,jdbcType=VARCHAR},
      </if>
      <if test="website != null" >
        website = #{website,jdbcType=VARCHAR},
      </if>
      <if test="mphone != null" >
        mphone = #{mphone,jdbcType=VARCHAR},
      </if>
      <if test="state != null" >
        state = #{state,jdbcType=VARCHAR},
      </if>
      <if test="source != null" >
        source = #{source,jdbcType=VARCHAR},
      </if>
      <if test="createBy != null" >
        create_by = #{createBy,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null" >
        create_time = #{createTime,jdbcType=CHAR},
      </if>
      <if test="editBy != null" >
        edit_by = #{editBy,jdbcType=VARCHAR},
      </if>
      <if test="editTime != null" >
        edit_time = #{editTime,jdbcType=CHAR},
      </if>
      <if test="description != null" >
        description = #{description,jdbcType=VARCHAR},
      </if>
      <if test="contactSummary != null" >
        contact_summary = #{contactSummary,jdbcType=VARCHAR},
      </if>
      <if test="nextContactTime != null" >
        next_contact_time = #{nextContactTime,jdbcType=CHAR},
      </if>
      <if test="address != null" >
        address = #{address,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=CHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.bjpowernode.crm.workbench.domain.Clue" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Nov 03 17:43:22 CST 2020.
    -->
    update tbl_clue
    set fullname = #{fullname,jdbcType=VARCHAR},
      appellation = #{appellation,jdbcType=VARCHAR},
      owner = #{owner,jdbcType=CHAR},
      company = #{company,jdbcType=VARCHAR},
      job = #{job,jdbcType=VARCHAR},
      email = #{email,jdbcType=VARCHAR},
      phone = #{phone,jdbcType=VARCHAR},
      website = #{website,jdbcType=VARCHAR},
      mphone = #{mphone,jdbcType=VARCHAR},
      state = #{state,jdbcType=VARCHAR},
      source = #{source,jdbcType=VARCHAR},
      create_by = #{createBy,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=CHAR},
      edit_by = #{editBy,jdbcType=VARCHAR},
      edit_time = #{editTime,jdbcType=CHAR},
      description = #{description,jdbcType=VARCHAR},
      contact_summary = #{contactSummary,jdbcType=VARCHAR},
      next_contact_time = #{nextContactTime,jdbcType=CHAR},
      address = #{address,jdbcType=VARCHAR}
    where id = #{id,jdbcType=CHAR}
  </update>

  <!--保存创建的线索:新增线索-->
  <insert id="insertClue" parameterType="com.bjpowernode.crm.workbench.domain.Clue">
    insert into tbl_clue(id, fullname, appellation, owner, company, job, email, phone, website, mphone, state,source, create_by, create_time, description, contact_summary,next_contact_time, address)
    values (#{id},#{ fullname},#{ appellation},#{ owner},#{ company},#{ job},#{ email},#{ phone},#{ website},#{ mphone},#{ state},#{source},#{ createBy},#{ createTime},#{ description},#{ contactSummary},#{nextContactTime},#{ address})
  </insert>

  <select id="selectClueByConditionForPage" parameterType="map" resultMap="BaseResultMap">
    select cl.id,cl.fullname,dicv1.value as appellation,u1.name as owner,cl.company,cl.job,cl.email,cl.phone,
    cl.website,cl.mphone,ifnull(dicv2.value, ' ') as state,ifnull(dicv3.value, ' ') as source,u2.name as create_by,cl.create_time,
    u3.name as edit_by,cl.edit_time,cl.description,cl.contact_summary,cl.next_contact_time,cl.address
    from tbl_clue cl
    left join tbl_dic_value dicv1 on cl.appellation=dicv1.id
    left join tbl_dic_value dicv2 on cl.state=dicv2.id
    left join tbl_dic_value dicv3 on cl.source=dicv3.id
    join tbl_user u1 on cl.owner=u1.id
    join tbl_user u2 on cl.create_by=u2.id
    left join tbl_user u3 on cl.edit_by=u3.id
    <where>
      <if test="fullname!=null and fullname!=''">
        and cl.fullname like '%' #{fullname} '%'
      </if>
      <if test="company!=null and company!=''">
        and cl.company like '%' #{company} '%'
      </if>
      <if test="phone!=null and phone!=''">
        and cl.phone like '%' #{phone} '%'
      </if>
      <if test="source!=null and source!=''">
        and dicv3.value like '%' #{source} '%'
      </if>
      <if test="owner!=null and owner!=''">
        and u1.name like '%' #{owner} '%'
      </if>
      <if test="mphone!=null and mphone!=''">
        and cl.mphone like '%' #{mphone} '%'
      </if>
      <if test="state!=null and state!=''">
        and dicv2.value like '%' #{state} '%'
      </if>
    </where>
    order by cl.create_time desc
    limit #{beginNo},#{pageSize}
  </select>

  <select id="selectCountOfClueByCondition" resultType="int" parameterType="map">
    select count(*)
    from tbl_clue cl
    left join tbl_dic_value dicv1 on cl.appellation=dicv1.id
    left join tbl_dic_value dicv2 on cl.state=dicv2.id
    left join tbl_dic_value dicv3 on cl.source=dicv3.id
    join tbl_user u1 on cl.owner=u1.id
    join tbl_user u2 on cl.create_by=u2.id
    left join tbl_user u3 on cl.edit_by=u3.id
    <where>
      <if test="fullname!=null and fullname!=''">
        and cl.fullname like '%' #{fullname} '%'
      </if>
      <if test="company!=null and company!=''">
        and cl.company like '%' #{company} '%'
      </if>
      <if test="phone!=null and phone!=''">
        and cl.phone like '%' #{phone} '%'
      </if>
      <if test="source!=null and source!=''">
        and dicv3.value like '%' #{source} '%'
      </if>
      <if test="owner!=null and owner!=''">
        and u1.name like '%' #{owner} '%'
      </if>
      <if test="mphone!=null and mphone!=''">
        and cl.mphone like '%' #{mphone} '%'
      </if>
      <if test="state!=null and state!=''">
        and dicv2.value like '%' #{state} '%'
      </if>
    </where>
  </select>

  <!--通过id删除选则的线索-->
  <delete id="deleteClueByIds" parameterType="string">
    delete from tbl_clue
    where id in
    <foreach collection="array" item="id" separator="," open="(" close=")">
      #{id, jdbcType=VARCHAR}
    </foreach>
  </delete>

  <!--通过id查询线索-->
  <select id="selectClueById" parameterType="string" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from tbl_clue
    where id = #{id,jdbcType=CHAR}
  </select>

  <update id="updateClue" parameterType="com.bjpowernode.crm.workbench.domain.Clue">
    update tbl_clue
    set fullname=#{fullname}, appellation=#{appellation}, owner=#{owner}, company=#{company}, job=#{job}, email=#{email},
        phone=#{phone}, website=#{website}, mphone=#{mphone}, state=#{state}, source=#{source}, edit_by=#{editBy},
        edit_time=#{editTime}, description=#{description}, contact_summary=#{contactSummary},
        next_contact_time=#{nextContactTime}, address=#{address}
    where id=#{id}
  </update>

  <!--通过id查询线索详情-->
  <select id="selectClueForDetailById" parameterType="string" resultMap="BaseResultMap">
    select cl.id,cl.fullname,dicv1.value as appellation,u1.name as owner,cl.company,cl.job,cl.email,cl.phone,
           cl.website,cl.mphone,dicv2.value as state,dicv3.value as source,u2.name as create_by,cl.create_time,
           u3.name as edit_by,cl.edit_time,cl.description,cl.contact_summary,cl.next_contact_time,cl.address
    from tbl_clue cl
    left join tbl_dic_value dicv1 on cl.appellation=dicv1.id
    left join tbl_dic_value dicv2 on cl.state=dicv2.id
    left join tbl_dic_value dicv3 on cl.source=dicv3.id
    join tbl_user u1 on cl.owner=u1.id
    join tbl_user u2 on cl.create_by=u2.id
    left join tbl_user u3 on cl.edit_by=u3.id
    where cl.id = #{id,jdbcType=CHAR}
  </select>

  <select id="selectClueStageOfClueGroupByClueStage" resultType="string">
    select d.value as clueStage
    from tbl_clue c
    join tbl_dic_value d on c.state = d.id
    group by c.state
  </select>

  <select id="selectCountOfClueGroupByClueStage" resultType="java.lang.Integer">
    select count(*) as value
    from tbl_clue c
           join tbl_dic_value d on c.state = d.id
    group by c.state
  </select>
</mapper>

ClueRemarkMapper:

package com.bjpowernode.crm.workbench.mapper;



import com.bjpowernode.crm.workbench.domain.ClueRemark;

import java.util.List;

public interface ClueRemarkMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_clue_remark
     *
     * @mbggenerated Fri Mar 18 20:26:12 CST 2022
     */
    int deleteByPrimaryKey(String id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_clue_remark
     *
     * @mbggenerated Fri Mar 18 20:26:12 CST 2022
     */
    int insert(ClueRemark record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_clue_remark
     *
     * @mbggenerated Fri Mar 18 20:26:12 CST 2022
     */
    int insertSelective(ClueRemark record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_clue_remark
     *
     * @mbggenerated Fri Mar 18 20:26:12 CST 2022
     */
    ClueRemark selectByPrimaryKey(String id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_clue_remark
     *
     * @mbggenerated Fri Mar 18 20:26:12 CST 2022
     */
    int updateByPrimaryKeySelective(ClueRemark record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_clue_remark
     *
     * @mbggenerated Fri Mar 18 20:26:12 CST 2022
     */
    int updateByPrimaryKey(ClueRemark record);

    /**
     * 根据线索id查询该线索的所有备注详细信息
     * @param clueId 线索id
     * @return 备注列表
     */
    List<ClueRemark> selectClueRemarkForDetailByClueId(String clueId);

    /**
     * 添加线索备注
     * @param clueRemark 线索备注
     * @return 添加的条数
     */
    int insertClueRemark(ClueRemark clueRemark);

    /**
     * 通过线索id删除备注(用于删除线索时同时删除该线索备注;因为可能一次性会删除多个线索,所以传入的id是线索id数组)
     * @param clueIds 线索id
     * @return 删除的条数
     */
    int deleteClueRemarkByClueId(String[] clueIds);

    /**
     * 通过线索备注的id删除线索备注
     * @param id 线索备注的id
     * @return 删除的条数
     */
    int deleteClueRemarkById(String id);

    /**
     * 更新线索备注
     * @param clueRemark 更新的线索备注
     * @return 更新的条数
     */
    int updateClueRemark(ClueRemark clueRemark);

    /**
     * 通过线索id查询市场活动备注
     * @param clueId 线索id
     * @return 该线索的所有备注集合
     */
    List<ClueRemark> selectClueRemarkByClueId(String clueId);
}

ClueRemarkMapper.xml:

<?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.bjpowernode.crm.workbench.mapper.ClueRemarkMapper" >
  <resultMap id="BaseResultMap" type="com.bjpowernode.crm.workbench.domain.ClueRemark" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Mar 18 20:26:12 CST 2022.
    -->
    <id column="id" property="id" jdbcType="CHAR" />
    <result column="note_content" property="noteContent" jdbcType="VARCHAR" />
    <result column="create_by" property="createBy" jdbcType="VARCHAR" />
    <result column="create_time" property="createTime" jdbcType="CHAR" />
    <result column="edit_by" property="editBy" jdbcType="VARCHAR" />
    <result column="edit_time" property="editTime" jdbcType="CHAR" />
    <result column="edit_flag" property="editFlag" jdbcType="CHAR" />
    <result column="clue_id" property="clueId" jdbcType="CHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Mar 18 20:26:12 CST 2022.
    -->
    id, note_content, create_by, create_time, edit_by, edit_time, edit_flag, clue_id
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Mar 18 20:26:12 CST 2022.
    -->
    select 
    <include refid="Base_Column_List" />
    from tbl_clue_remark
    where id = #{id,jdbcType=CHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Mar 18 20:26:12 CST 2022.
    -->
    delete from tbl_clue_remark
    where id = #{id,jdbcType=CHAR}
  </delete>
  <insert id="insert" parameterType="com.bjpowernode.crm.workbench.domain.ClueRemark" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Mar 18 20:26:12 CST 2022.
    -->
    insert into tbl_clue_remark (id, note_content, create_by, 
      create_time, edit_by, edit_time, 
      edit_flag, clue_id)
    values (#{id,jdbcType=CHAR}, #{noteContent,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, 
      #{createTime,jdbcType=CHAR}, #{editBy,jdbcType=VARCHAR}, #{editTime,jdbcType=CHAR}, 
      #{editFlag,jdbcType=CHAR}, #{clueId,jdbcType=CHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.bjpowernode.crm.workbench.domain.ClueRemark" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Mar 18 20:26:12 CST 2022.
    -->
    insert into tbl_clue_remark
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="noteContent != null" >
        note_content,
      </if>
      <if test="createBy != null" >
        create_by,
      </if>
      <if test="createTime != null" >
        create_time,
      </if>
      <if test="editBy != null" >
        edit_by,
      </if>
      <if test="editTime != null" >
        edit_time,
      </if>
      <if test="editFlag != null" >
        edit_flag,
      </if>
      <if test="clueId != null" >
        clue_id,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=CHAR},
      </if>
      <if test="noteContent != null" >
        #{noteContent,jdbcType=VARCHAR},
      </if>
      <if test="createBy != null" >
        #{createBy,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null" >
        #{createTime,jdbcType=CHAR},
      </if>
      <if test="editBy != null" >
        #{editBy,jdbcType=VARCHAR},
      </if>
      <if test="editTime != null" >
        #{editTime,jdbcType=CHAR},
      </if>
      <if test="editFlag != null" >
        #{editFlag,jdbcType=CHAR},
      </if>
      <if test="clueId != null" >
        #{clueId,jdbcType=CHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.bjpowernode.crm.workbench.domain.ClueRemark" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Mar 18 20:26:12 CST 2022.
    -->
    update tbl_clue_remark
    <set >
      <if test="noteContent != null" >
        note_content = #{noteContent,jdbcType=VARCHAR},
      </if>
      <if test="createBy != null" >
        create_by = #{createBy,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null" >
        create_time = #{createTime,jdbcType=CHAR},
      </if>
      <if test="editBy != null" >
        edit_by = #{editBy,jdbcType=VARCHAR},
      </if>
      <if test="editTime != null" >
        edit_time = #{editTime,jdbcType=CHAR},
      </if>
      <if test="editFlag != null" >
        edit_flag = #{editFlag,jdbcType=CHAR},
      </if>
      <if test="clueId != null" >
        clue_id = #{clueId,jdbcType=CHAR},
      </if>
    </set>
    where id = #{id,jdbcType=CHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.bjpowernode.crm.workbench.domain.ClueRemark" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Mar 18 20:26:12 CST 2022.
    -->
    update tbl_clue_remark
    set note_content = #{noteContent,jdbcType=VARCHAR},
      create_by = #{createBy,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=CHAR},
      edit_by = #{editBy,jdbcType=VARCHAR},
      edit_time = #{editTime,jdbcType=CHAR},
      edit_flag = #{editFlag,jdbcType=CHAR},
      clue_id = #{clueId,jdbcType=CHAR}
    where id = #{id,jdbcType=CHAR}
  </update>

  <!--根据线索id查询该线索的所有备注详细信息-->
  <select id="selectClueRemarkForDetailByClueId" parameterType="string" resultMap="BaseResultMap">
    select cr.id,cr.note_content,u1.name as create_by,cr.create_time,u2.name as edit_by,cr.edit_time,cr.edit_flag
    from tbl_clue_remark cr
    join tbl_user u1 on cr.create_by=u1.id
    left join tbl_user u2 on cr.edit_by=u2.id
    where cr.clue_id=#{clueId}
  </select>

  <insert id="insertClueRemark" parameterType="com.bjpowernode.crm.workbench.domain.ClueRemark">
    insert into
    tbl_clue_remark(id, note_content, create_time, create_by, edit_flag, clue_id)
    values(#{id},#{noteContent},#{createTime},#{createBy},#{editFlag},#{clueId})
  </insert>

  <!--通过线索id删除备注(用于删除线索时同时删除该线索备注;因为可能一次性会删除多个线索,所以传入的id是线索id数组)-->
  <delete id="deleteClueRemarkByClueId" parameterType="string">
    delete from tbl_clue_remark
    where clue_id in
    <foreach collection="array" item="id" separator="," open="(" close=")">
      #{id, jdbcType=VARCHAR}
    </foreach>
  </delete>

  <delete id="deleteClueRemarkById" parameterType="string">
    delete from tbl_clue_remark
    where id=#{id}
  </delete>

  <update id="updateClueRemark" parameterType="com.bjpowernode.crm.workbench.domain.ClueRemark">
    update tbl_clue_remark
    set note_content=#{noteContent},edit_time=#{editTime},edit_by=#{editBy},edit_flag=#{editFlag}
    where id=#{id}
  </update>

  <!--通过线索id查询市场活动备注-->
  <select id="selectClueRemarkByClueId" parameterType="string" resultMap="BaseResultMap">
    select
        <include refid="Base_Column_List" />
    from tbl_clue_remark
    where clue_id=#{clueId}
  </select>
</mapper>

ContactsActivityRelationMapper :

package com.bjpowernode.crm.workbench.mapper;



import com.bjpowernode.crm.workbench.domain.ContactsActivityRelation;

import java.util.List;

public interface ContactsActivityRelationMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_contacts_activity_relation
     *
     * @mbggenerated Sun Mar 27 09:53:44 CST 2022
     */
    int deleteByPrimaryKey(String id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_contacts_activity_relation
     *
     * @mbggenerated Sun Mar 27 09:53:44 CST 2022
     */
    int insert(ContactsActivityRelation record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_contacts_activity_relation
     *
     * @mbggenerated Sun Mar 27 09:53:44 CST 2022
     */
    int insertSelective(ContactsActivityRelation record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_contacts_activity_relation
     *
     * @mbggenerated Sun Mar 27 09:53:44 CST 2022
     */
    ContactsActivityRelation selectByPrimaryKey(String id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_contacts_activity_relation
     *
     * @mbggenerated Sun Mar 27 09:53:44 CST 2022
     */
    int updateByPrimaryKeySelective(ContactsActivityRelation record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_contacts_activity_relation
     *
     * @mbggenerated Sun Mar 27 09:53:44 CST 2022
     */
    int updateByPrimaryKey(ContactsActivityRelation record);

    /**
     * 通过集合插入联系人和市场活动关系的数据
     * @param contactsActivityRelationList 联系人和市场活动关系数据集合
     * @return 插入的条数
     */
    int insertContactsActivityRelationByList(List<ContactsActivityRelation> contactsActivityRelationList);

    int deleteContactsActivityRelationByContactsIdAndActivityId(ContactsActivityRelation contactsActivityRelation);

    int deleteContactsActivityRelationByContactsIds(String[] contactsIds);
}

ContactsActivityRelationMapper .xml:

<?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.bjpowernode.crm.workbench.mapper.ContactsActivityRelationMapper" >
  <resultMap id="BaseResultMap" type="com.bjpowernode.crm.workbench.domain.ContactsActivityRelation" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sun Mar 27 09:53:44 CST 2022.
    -->
    <id column="id" property="id" jdbcType="CHAR" />
    <result column="contacts_id" property="contactsId" jdbcType="CHAR" />
    <result column="activity_id" property="activityId" jdbcType="CHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sun Mar 27 09:53:44 CST 2022.
    -->
    id, contacts_id, activity_id
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sun Mar 27 09:53:44 CST 2022.
    -->
    select 
    <include refid="Base_Column_List" />
    from tbl_contacts_activity_relation
    where id = #{id,jdbcType=CHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sun Mar 27 09:53:44 CST 2022.
    -->
    delete from tbl_contacts_activity_relation
    where id = #{id,jdbcType=CHAR}
  </delete>
  <insert id="insert" parameterType="com.bjpowernode.crm.workbench.domain.ContactsActivityRelation" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sun Mar 27 09:53:44 CST 2022.
    -->
    insert into tbl_contacts_activity_relation (id, contacts_id, activity_id
      )
    values (#{id,jdbcType=CHAR}, #{contactsId,jdbcType=CHAR}, #{activityId,jdbcType=CHAR}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.bjpowernode.crm.workbench.domain.ContactsActivityRelation" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sun Mar 27 09:53:44 CST 2022.
    -->
    insert into tbl_contacts_activity_relation
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="contactsId != null" >
        contacts_id,
      </if>
      <if test="activityId != null" >
        activity_id,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=CHAR},
      </if>
      <if test="contactsId != null" >
        #{contactsId,jdbcType=CHAR},
      </if>
      <if test="activityId != null" >
        #{activityId,jdbcType=CHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.bjpowernode.crm.workbench.domain.ContactsActivityRelation" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sun Mar 27 09:53:44 CST 2022.
    -->
    update tbl_contacts_activity_relation
    <set >
      <if test="contactsId != null" >
        contacts_id = #{contactsId,jdbcType=CHAR},
      </if>
      <if test="activityId != null" >
        activity_id = #{activityId,jdbcType=CHAR},
      </if>
    </set>
    where id = #{id,jdbcType=CHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.bjpowernode.crm.workbench.domain.ContactsActivityRelation" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sun Mar 27 09:53:44 CST 2022.
    -->
    update tbl_contacts_activity_relation
    set contacts_id = #{contactsId,jdbcType=CHAR},
      activity_id = #{activityId,jdbcType=CHAR}
    where id = #{id,jdbcType=CHAR}
  </update>

  <!--通过集合插入联系人和市场活动关系的数据-->
  <insert id="insertContactsActivityRelationByList" parameterType="com.bjpowernode.crm.workbench.domain.ContactsActivityRelation">
    insert into tbl_contacts_activity_relation(id, contacts_id, activity_id)
    values
    <foreach collection="list" item="obj" separator=",">
      (#{obj.id}, #{obj.contactsId}, #{obj.activityId})
    </foreach>
  </insert>

  <delete id="deleteContactsActivityRelationByContactsIdAndActivityId" parameterType="com.bjpowernode.crm.workbench.domain.ContactsActivityRelation">
    delete from tbl_contacts_activity_relation
    where contacts_id=#{contactsId} and activity_id=#{activityId}
  </delete>

  <delete id="deleteContactsActivityRelationByContactsIds" parameterType="string">
    delete from tbl_contacts_activity_relation
    where contacts_id in
    <foreach collection="array" item="id" separator="," open="(" close=")">
      #{id}
    </foreach>
  </delete>

</mapper>

ContactsMapper:

package com.bjpowernode.crm.workbench.mapper;



import com.bjpowernode.crm.workbench.domain.Contacts;
import com.bjpowernode.crm.workbench.domain.FunnelVO;

import java.util.List;
import java.util.Map;

public interface ContactsMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_contacts
     *
     * @mbggenerated Thu Mar 24 21:35:58 CST 2022
     */
    int deleteByPrimaryKey(String id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_contacts
     *
     * @mbggenerated Thu Mar 24 21:35:58 CST 2022
     */
    int insert(Contacts record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_contacts
     *
     * @mbggenerated Thu Mar 24 21:35:58 CST 2022
     */
    int insertSelective(Contacts record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_contacts
     *
     * @mbggenerated Thu Mar 24 21:35:58 CST 2022
     */
    Contacts selectByPrimaryKey(String id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_contacts
     *
     * @mbggenerated Thu Mar 24 21:35:58 CST 2022
     */
    int updateByPrimaryKeySelective(Contacts record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_contacts
     *
     * @mbggenerated Thu Mar 24 21:35:58 CST 2022
     */
    int updateByPrimaryKey(Contacts record);

    /**
     * 保存新增联系
     * @param contacts 联系对象封装的参数
     * @return 新增条数
     */
    int insertContacts(Contacts contacts);

    /**
     * 根据条件分页查询联系人列表
     * @param map 查询条件
     * @return 查询到的联系人
     */
    List<Contacts> selectContactsByConditionForPage(Map<String, Object> map);

    /**
     * 根据条件查询联系人总条数
     * @param map 查询条件
     * @return 联系人总条数
     */
    int selectCountOfContactsByCondition(Map<String, Object> map);

    /**
     * 通过id查询联系人
     * @param id 联系人id
     * @return 对应id的联系人
     */
    Contacts selectContactsById(String id);

    /**
     * 更新对应联系人的数据
     * @param contacts 更新的联系人
     * @return 更新条数
     */
    int updateContacts(Contacts contacts);

    /**
     * 通过id删除选则的联系人
     * @param contactsIds 联系人id数组
     * @return 删除的条数
     */
    int deleteContactsByIds(String[] contactsIds);

    /**
     * 通过联系人id查询联系人的详细信息
     * @param id 联系人id
     * @return 查询的联系人详细信息
     */
    Contacts selectContactsForDetailById(String id);

    /**
     * 通过姓名模糊查询联系人
     * @param contactsName 模糊姓名
     * @return 查询到的线索
     */
    List<Contacts> selectContactsByFuzzyName(String contactsName);

    List<FunnelVO> selectCountOfCustomerAndContactsGroupByCustomer();
}

ContactsMapper.xml:

<?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.bjpowernode.crm.workbench.mapper.ContactsMapper" >
  <resultMap id="BaseResultMap" type="com.bjpowernode.crm.workbench.domain.Contacts" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Mar 24 21:35:58 CST 2022.
    -->
    <id column="id" property="id" jdbcType="CHAR" />
    <result column="owner" property="owner" jdbcType="CHAR" />
    <result column="source" property="source" jdbcType="VARCHAR" />
    <result column="customer_id" property="customerId" jdbcType="CHAR" />
    <result column="fullname" property="fullname" jdbcType="VARCHAR" />
    <result column="appellation" property="appellation" jdbcType="VARCHAR" />
    <result column="email" property="email" jdbcType="VARCHAR" />
    <result column="mphone" property="mphone" jdbcType="VARCHAR" />
    <result column="job" property="job" jdbcType="VARCHAR" />
    <result column="create_by" property="createBy" jdbcType="VARCHAR" />
    <result column="create_time" property="createTime" jdbcType="CHAR" />
    <result column="edit_by" property="editBy" jdbcType="VARCHAR" />
    <result column="edit_time" property="editTime" jdbcType="CHAR" />
    <result column="description" property="description" jdbcType="VARCHAR" />
    <result column="contact_summary" property="contactSummary" jdbcType="VARCHAR" />
    <result column="next_contact_time" property="nextContactTime" jdbcType="CHAR" />
    <result column="address" property="address" jdbcType="VARCHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Mar 24 21:35:58 CST 2022.
    -->
    id, owner, source, customer_id, fullname, appellation, email, mphone, job, create_by, 
    create_time, edit_by, edit_time, description, contact_summary, next_contact_time, 
    address
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Mar 24 21:35:58 CST 2022.
    -->
    select 
    <include refid="Base_Column_List" />
    from tbl_contacts
    where id = #{id,jdbcType=CHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Mar 24 21:35:58 CST 2022.
    -->
    delete from tbl_contacts
    where id = #{id,jdbcType=CHAR}
  </delete>
  <insert id="insert" parameterType="com.bjpowernode.crm.workbench.domain.Contacts" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Mar 24 21:35:58 CST 2022.
    -->
    insert into tbl_contacts (id, owner, source,
      customer_id, fullname, appellation,
      email, mphone, job,
      create_by, create_time, edit_by,
      edit_time, description, contact_summary,
      next_contact_time, address)
    values (#{id,jdbcType=CHAR}, #{owner,jdbcType=CHAR}, #{source,jdbcType=VARCHAR},
      #{customerId,jdbcType=CHAR}, #{fullname,jdbcType=VARCHAR}, #{appellation,jdbcType=VARCHAR},
      #{email,jdbcType=VARCHAR}, #{mphone,jdbcType=VARCHAR}, #{job,jdbcType=VARCHAR},
      #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=CHAR}, #{editBy,jdbcType=VARCHAR},
      #{editTime,jdbcType=CHAR}, #{description,jdbcType=VARCHAR}, #{contactSummary,jdbcType=VARCHAR},
      #{nextContactTime,jdbcType=CHAR}, #{address,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.bjpowernode.crm.workbench.domain.Contacts" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Mar 24 21:35:58 CST 2022.
    -->
    insert into tbl_contacts
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="owner != null" >
        owner,
      </if>
      <if test="source != null" >
        source,
      </if>
      <if test="customerId != null" >
        customer_id,
      </if>
      <if test="fullname != null" >
        fullname,
      </if>
      <if test="appellation != null" >
        appellation,
      </if>
      <if test="email != null" >
        email,
      </if>
      <if test="mphone != null" >
        mphone,
      </if>
      <if test="job != null" >
        job,
      </if>
      <if test="createBy != null" >
        create_by,
      </if>
      <if test="createTime != null" >
        create_time,
      </if>
      <if test="editBy != null" >
        edit_by,
      </if>
      <if test="editTime != null" >
        edit_time,
      </if>
      <if test="description != null" >
        description,
      </if>
      <if test="contactSummary != null" >
        contact_summary,
      </if>
      <if test="nextContactTime != null" >
        next_contact_time,
      </if>
      <if test="address != null" >
        address,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=CHAR},
      </if>
      <if test="owner != null" >
        #{owner,jdbcType=CHAR},
      </if>
      <if test="source != null" >
        #{source,jdbcType=VARCHAR},
      </if>
      <if test="customerId != null" >
        #{customerId,jdbcType=CHAR},
      </if>
      <if test="fullname != null" >
        #{fullname,jdbcType=VARCHAR},
      </if>
      <if test="appellation != null" >
        #{appellation,jdbcType=VARCHAR},
      </if>
      <if test="email != null" >
        #{email,jdbcType=VARCHAR},
      </if>
      <if test="mphone != null" >
        #{mphone,jdbcType=VARCHAR},
      </if>
      <if test="job != null" >
        #{job,jdbcType=VARCHAR},
      </if>
      <if test="createBy != null" >
        #{createBy,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null" >
        #{createTime,jdbcType=CHAR},
      </if>
      <if test="editBy != null" >
        #{editBy,jdbcType=VARCHAR},
      </if>
      <if test="editTime != null" >
        #{editTime,jdbcType=CHAR},
      </if>
      <if test="description != null" >
        #{description,jdbcType=VARCHAR},
      </if>
      <if test="contactSummary != null" >
        #{contactSummary,jdbcType=VARCHAR},
      </if>
      <if test="nextContactTime != null" >
        #{nextContactTime,jdbcType=CHAR},
      </if>
      <if test="address != null" >
        #{address,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.bjpowernode.crm.workbench.domain.Contacts" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Mar 24 21:35:58 CST 2022.
    -->
    update tbl_contacts
    <set >
      <if test="owner != null" >
        owner = #{owner,jdbcType=CHAR},
      </if>
      <if test="source != null" >
        source = #{source,jdbcType=VARCHAR},
      </if>
      <if test="customerId != null" >
        customer_id = #{customerId,jdbcType=CHAR},
      </if>
      <if test="fullname != null" >
        fullname = #{fullname,jdbcType=VARCHAR},
      </if>
      <if test="appellation != null" >
        appellation = #{appellation,jdbcType=VARCHAR},
      </if>
      <if test="email != null" >
        email = #{email,jdbcType=VARCHAR},
      </if>
      <if test="mphone != null" >
        mphone = #{mphone,jdbcType=VARCHAR},
      </if>
      <if test="job != null" >
        job = #{job,jdbcType=VARCHAR},
      </if>
      <if test="createBy != null" >
        create_by = #{createBy,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null" >
        create_time = #{createTime,jdbcType=CHAR},
      </if>
      <if test="editBy != null" >
        edit_by = #{editBy,jdbcType=VARCHAR},
      </if>
      <if test="editTime != null" >
        edit_time = #{editTime,jdbcType=CHAR},
      </if>
      <if test="description != null" >
        description = #{description,jdbcType=VARCHAR},
      </if>
      <if test="contactSummary != null" >
        contact_summary = #{contactSummary,jdbcType=VARCHAR},
      </if>
      <if test="nextContactTime != null" >
        next_contact_time = #{nextContactTime,jdbcType=CHAR},
      </if>
      <if test="address != null" >
        address = #{address,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=CHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.bjpowernode.crm.workbench.domain.Contacts" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Mar 24 21:35:58 CST 2022.
    -->
    update tbl_contacts
    set owner = #{owner,jdbcType=CHAR},
      source = #{source,jdbcType=VARCHAR},
      customer_id = #{customerId,jdbcType=CHAR},
      fullname = #{fullname,jdbcType=VARCHAR},
      appellation = #{appellation,jdbcType=VARCHAR},
      email = #{email,jdbcType=VARCHAR},
      mphone = #{mphone,jdbcType=VARCHAR},
      job = #{job,jdbcType=VARCHAR},
      create_by = #{createBy,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=CHAR},
      edit_by = #{editBy,jdbcType=VARCHAR},
      edit_time = #{editTime,jdbcType=CHAR},
      description = #{description,jdbcType=VARCHAR},
      contact_summary = #{contactSummary,jdbcType=VARCHAR},
      next_contact_time = #{nextContactTime,jdbcType=CHAR},
      address = #{address,jdbcType=VARCHAR}
    where id = #{id,jdbcType=CHAR}
  </update>

  <!--保存新增联系-->
  <insert id="insertContacts" parameterType="com.bjpowernode.crm.workbench.domain.Contacts">
    insert into tbl_contacts(id, owner, source, customer_id, fullname, appellation, email, mphone, job, create_by,
                             create_time, description, contact_summary, next_contact_time, address)
    values (#{id}, #{owner}, #{source}, #{customerId}, #{fullname}, #{appellation}, #{email}, #{mphone}, #{job}, #{createBy},
            #{createTime}, #{description}, #{contactSummary}, #{nextContactTime}, #{address})
  </insert>

  <select id="selectContactsByConditionForPage" parameterType="map" resultMap="BaseResultMap">
    select co.id,co.fullname,dicv1.value as appellation,u1.name as owner,ifnull(co.job, ' ') as job,co.email,co.mphone,ifnull(dicv2.value, ' ') as source,
    ifnull(cu.name, ' ') as customer_id,u2.name as create_by,co.create_time,u3.name as edit_by,co.edit_time,co.description,
    co.contact_summary,co.next_contact_time,co.address
    from tbl_contacts co
    left join tbl_dic_value dicv1 on co.appellation=dicv1.id
    left join tbl_dic_value dicv2 on co.source=dicv2.id
    left join tbl_customer cu on co.customer_id=cu.id
    join tbl_user u1 on co.owner=u1.id
    join tbl_user u2 on co.create_by=u2.id
    left join tbl_user u3 on co.edit_by=u3.id
    <where>
      <if test="owner!=null and owner!=''">
        and u1.name like '%' #{owner} '%'
      </if>
      <if test="fullname!=null and fullname!=''">
        and co.fullname like '%' #{fullname} '%'
      </if>
      <if test="customerId!=null and customerId!=''">
        and cu.name like '%' #{customerId} '%'
      </if>
      <if test="source!=null and source!=''">
        and dicv2.value like '%' #{source} '%'
      </if>
      <if test="job!=null and job!=''">
        and co.job like '%' #{job} '%'
      </if>
    </where>
    order by co.create_time desc
    limit #{beginNo},#{pageSize}
  </select>

  <select id="selectCountOfContactsByCondition" parameterType="map" resultType="int">
    select count(*)
    from tbl_contacts co
    left join tbl_dic_value dicv1 on co.appellation=dicv1.id
    left join tbl_dic_value dicv2 on co.source=dicv2.id
    left join tbl_customer cu on co.customer_id=cu.id
    join tbl_user u1 on co.owner=u1.id
    join tbl_user u2 on co.create_by=u2.id
    left join tbl_user u3 on co.edit_by=u3.id
    <where>
      <if test="owner!=null and owner!=''">
        and u1.name like '%' #{owner} '%'
      </if>
      <if test="fullname!=null and fullname!=''">
        and co.fullname like '%' #{fullname} '%'
      </if>
      <if test="customerId!=null and customerId!=''">
        and cu.name like '%' #{customerId} '%'
      </if>
      <if test="source!=null and source!=''">
        and dicv2.value like '%' #{source} '%'
      </if>
      <if test="job!=null and job!=''">
        and co.job like '%' #{job} '%'
      </if>
    </where>
  </select>

  <select id="selectContactsById" resultMap="BaseResultMap" parameterType="string">
    select
    <include refid="Base_Column_List" />
    from tbl_contacts
    where id=#{id}
  </select>

  <update id="updateContacts" parameterType="com.bjpowernode.crm.workbench.domain.Contacts">
    update tbl_contacts
    set owner=#{owner}, source=#{source}, customer_id=#{customerId}, fullname=#{fullname}, appellation=#{appellation},
        email=#{email}, mphone=#{mphone}, job=#{job}, edit_by=#{editBy}, edit_time=#{editTime}, description=#{description},
        contact_summary=#{contactSummary}, next_contact_time=#{nextContactTime},address=#{address}
    where id=#{id}
  </update>

  <delete id="deleteContactsByIds" parameterType="string">
    delete from tbl_contacts
    where id in
    <foreach collection="array" item="id" separator="," open="(" close=")">
      #{id, jdbcType=VARCHAR}
    </foreach>
  </delete>

  <select id="selectContactsForDetailById" parameterType="string" resultMap="BaseResultMap">
    select co.id,co.fullname,dicv1.value as appellation,u1.name as owner,co.job,co.email,co.mphone,dicv2.value as source,
           cu.name as customer_id,u2.name as create_by,co.create_time,u3.name as edit_by,co.edit_time,co.description,
           co.contact_summary,co.next_contact_time,co.address
    from tbl_contacts co
           left join tbl_dic_value dicv1 on co.appellation=dicv1.id
           left join tbl_dic_value dicv2 on co.source=dicv2.id
           left join tbl_customer cu on co.customer_id=cu.id
           join tbl_user u1 on co.owner=u1.id
           join tbl_user u2 on co.create_by=u2.id
           left join tbl_user u3 on co.edit_by=u3.id
    where co.id=#{id}
  </select>

  <select id="selectContactsByFuzzyName" parameterType="string" resultMap="BaseResultMap">
    select co.id,co.fullname,dicv1.value as appellation,u1.name as owner,co.job,co.email,co.mphone,dicv2.value as source,
           cu.name as customer_id,u2.name as create_by,co.create_time,u3.name as edit_by,co.edit_time,co.description,
           co.contact_summary,co.next_contact_time,co.address
    from tbl_contacts co
           left join tbl_dic_value dicv1 on co.appellation=dicv1.id
           left join tbl_dic_value dicv2 on co.source=dicv2.id
           left join tbl_customer cu on co.customer_id=cu.id
           join tbl_user u1 on co.owner=u1.id
           join tbl_user u2 on co.create_by=u2.id
           left join tbl_user u3 on co.edit_by=u3.id
    where co.fullname like '%' #{contactsName} '%'
  </select>

  <select id="selectCountOfCustomerAndContactsGroupByCustomer" resultType="com.bjpowernode.crm.workbench.domain.FunnelVO">
    select count(*) as value,cu.name as name
    from tbl_contacts co
           join tbl_customer cu on co.customer_id=cu.id
    group by cu.name
  </select>
</mapper>

ContactsRemarkMapper 

package com.bjpowernode.crm.workbench.mapper;



import com.bjpowernode.crm.workbench.domain.ContactsRemark;

import java.util.List;

public interface ContactsRemarkMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_contacts_remark
     *
     * @mbggenerated Thu Mar 24 22:56:19 CST 2022
     */
    int deleteByPrimaryKey(String id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_contacts_remark
     *
     * @mbggenerated Thu Mar 24 22:56:19 CST 2022
     */
    int insert(ContactsRemark record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_contacts_remark
     *
     * @mbggenerated Thu Mar 24 22:56:19 CST 2022
     */
    int insertSelective(ContactsRemark record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_contacts_remark
     *
     * @mbggenerated Thu Mar 24 22:56:19 CST 2022
     */
    ContactsRemark selectByPrimaryKey(String id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_contacts_remark
     *
     * @mbggenerated Thu Mar 24 22:56:19 CST 2022
     */
    int updateByPrimaryKeySelective(ContactsRemark record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_contacts_remark
     *
     * @mbggenerated Thu Mar 24 22:56:19 CST 2022
     */
    int updateByPrimaryKey(ContactsRemark record);

    /**
     * 批量插入联系人备注
     * @param contactsRemarkList 联系人备注集合
     * @return 插入条数
     */
    int insertContactsRemarkByList(List<ContactsRemark> contactsRemarkList);

    /**
     * 通过联系人id查询对应联系人的所有备注
     * @param contactsId 联系人id
     * @return 对应联系人备注集合
     */
    List<ContactsRemark> selectContactsRemarkForDetailByContactsId(String contactsId);

    /**
     * 新增一条联系人备注
     * @param contactsRemark 联系人备注
     * @return 新增条数
     */
    int insertContactsRemark(ContactsRemark contactsRemark);

    /**
     * 通过联系人id删除备注(用于删除联系人时同时删除该联系人备注;因为可能一次性会删除多个联系人,所以传入的id是联系人id数组)
     * @param contactsIds 联系人id
     * @return 删除的条数
     */
    int deleteContactsRemarkByContactsId(String[] contactsIds);

    /**
     * 通过联系人备注的id删除联系人备注
     * @param id 联系人备注的id
     * @return 删除的条数
     */
    int deleteContactsRemarkById(String id);

    /**
     * 更新联系人备注
     * @param contactsRemark 更新的联系人备注
     * @return 更新的条数
     */
    int updateContactsRemark(ContactsRemark contactsRemark);
}

ContactsRemarkMapper .xml:

<?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.bjpowernode.crm.workbench.mapper.ContactsRemarkMapper" >
  <resultMap id="BaseResultMap" type="com.bjpowernode.crm.workbench.domain.ContactsRemark" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Mar 24 22:56:19 CST 2022.
    -->
    <id column="id" property="id" jdbcType="CHAR" />
    <result column="note_content" property="noteContent" jdbcType="VARCHAR" />
    <result column="create_by" property="createBy" jdbcType="VARCHAR" />
    <result column="create_time" property="createTime" jdbcType="CHAR" />
    <result column="edit_by" property="editBy" jdbcType="VARCHAR" />
    <result column="edit_time" property="editTime" jdbcType="CHAR" />
    <result column="edit_flag" property="editFlag" jdbcType="CHAR" />
    <result column="contacts_id" property="contactsId" jdbcType="CHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Mar 24 22:56:19 CST 2022.
    -->
    id, note_content, create_by, create_time, edit_by, edit_time, edit_flag, contacts_id
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Mar 24 22:56:19 CST 2022.
    -->
    select 
    <include refid="Base_Column_List" />
    from tbl_contacts_remark
    where id = #{id,jdbcType=CHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Mar 24 22:56:19 CST 2022.
    -->
    delete from tbl_contacts_remark
    where id = #{id,jdbcType=CHAR}
  </delete>
  <insert id="insert" parameterType="com.bjpowernode.crm.workbench.domain.ContactsRemark" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Mar 24 22:56:19 CST 2022.
    -->
    insert into tbl_contacts_remark (id, note_content, create_by, 
      create_time, edit_by, edit_time, 
      edit_flag, contacts_id)
    values (#{id,jdbcType=CHAR}, #{noteContent,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, 
      #{createTime,jdbcType=CHAR}, #{editBy,jdbcType=VARCHAR}, #{editTime,jdbcType=CHAR}, 
      #{editFlag,jdbcType=CHAR}, #{contactsId,jdbcType=CHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.bjpowernode.crm.workbench.domain.ContactsRemark" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Mar 24 22:56:19 CST 2022.
    -->
    insert into tbl_contacts_remark
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="noteContent != null" >
        note_content,
      </if>
      <if test="createBy != null" >
        create_by,
      </if>
      <if test="createTime != null" >
        create_time,
      </if>
      <if test="editBy != null" >
        edit_by,
      </if>
      <if test="editTime != null" >
        edit_time,
      </if>
      <if test="editFlag != null" >
        edit_flag,
      </if>
      <if test="contactsId != null" >
        contacts_id,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=CHAR},
      </if>
      <if test="noteContent != null" >
        #{noteContent,jdbcType=VARCHAR},
      </if>
      <if test="createBy != null" >
        #{createBy,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null" >
        #{createTime,jdbcType=CHAR},
      </if>
      <if test="editBy != null" >
        #{editBy,jdbcType=VARCHAR},
      </if>
      <if test="editTime != null" >
        #{editTime,jdbcType=CHAR},
      </if>
      <if test="editFlag != null" >
        #{editFlag,jdbcType=CHAR},
      </if>
      <if test="contactsId != null" >
        #{contactsId,jdbcType=CHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.bjpowernode.crm.workbench.domain.ContactsRemark" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Mar 24 22:56:19 CST 2022.
    -->
    update tbl_contacts_remark
    <set >
      <if test="noteContent != null" >
        note_content = #{noteContent,jdbcType=VARCHAR},
      </if>
      <if test="createBy != null" >
        create_by = #{createBy,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null" >
        create_time = #{createTime,jdbcType=CHAR},
      </if>
      <if test="editBy != null" >
        edit_by = #{editBy,jdbcType=VARCHAR},
      </if>
      <if test="editTime != null" >
        edit_time = #{editTime,jdbcType=CHAR},
      </if>
      <if test="editFlag != null" >
        edit_flag = #{editFlag,jdbcType=CHAR},
      </if>
      <if test="contactsId != null" >
        contacts_id = #{contactsId,jdbcType=CHAR},
      </if>
    </set>
    where id = #{id,jdbcType=CHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.bjpowernode.crm.workbench.domain.ContactsRemark" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Mar 24 22:56:19 CST 2022.
    -->
    update tbl_contacts_remark
    set note_content = #{noteContent,jdbcType=VARCHAR},
      create_by = #{createBy,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=CHAR},
      edit_by = #{editBy,jdbcType=VARCHAR},
      edit_time = #{editTime,jdbcType=CHAR},
      edit_flag = #{editFlag,jdbcType=CHAR},
      contacts_id = #{contactsId,jdbcType=CHAR}
    where id = #{id,jdbcType=CHAR}
  </update>

  <!--批量插入联系人备注-->
  <insert id="insertContactsRemarkByList" parameterType="com.bjpowernode.crm.workbench.domain.ContactsRemark">
    insert into tbl_contacts_remark(id, note_content, create_by, create_time, edit_by, edit_time, edit_flag, contacts_id)
    values
    <foreach collection="list" item="obj" separator=",">
      (#{obj.id},#{obj.noteContent},#{obj.createBy},#{obj.createTime},#{obj.editBy},#{obj.editTime},#{obj.editFlag},#{obj.contactsId})
    </foreach>
  </insert>

  <select id="selectContactsRemarkForDetailByContactsId" resultMap="BaseResultMap" parameterType="string">
    select co.id,co.note_content,u1.name as create_by,co.create_time,u2.name as edit_by,co.edit_time,co.edit_flag
    from tbl_contacts_remark co
           join tbl_user u1 on co.create_by=u1.id
           left join tbl_user u2 on co.edit_by=u2.id
    where co.contacts_id=#{contactsId}
  </select>

  <insert id="insertContactsRemark" parameterType="com.bjpowernode.crm.workbench.domain.ContactsRemark">
    insert into
      tbl_contacts_remark(id, note_content, create_time, create_by, edit_flag, contacts_id)
    values(#{id},#{noteContent},#{createTime},#{createBy},#{editFlag},#{contactsId})
  </insert>

  <delete id="deleteContactsRemarkByContactsId" parameterType="string">
    delete from tbl_contacts_remark
    where contacts_id in
    <foreach collection="array" item="id" separator="," open="(" close=")">
      #{id, jdbcType=VARCHAR}
    </foreach>
  </delete>

  <delete id="deleteContactsRemarkById" parameterType="string">
    delete from tbl_contacts_remark
    where id=#{id}
  </delete>

  <update id="updateContactsRemark" parameterType="com.bjpowernode.crm.workbench.domain.ContactsRemark">
    update tbl_contacts_remark
    set note_content=#{noteContent},edit_time=#{editTime},edit_by=#{editBy},edit_flag=#{editFlag}
    where id=#{id}
  </update>
</mapper>

CustomerMapper

package com.bjpowernode.crm.workbench.mapper;

import com.bjpowernode.crm.workbench.domain.Customer;


import java.util.List;
import java.util.Map;

public interface CustomerMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_customer
     *
     * @mbggenerated Wed Mar 23 20:58:10 CST 2022
     */
    int deleteByPrimaryKey(String id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_customer
     *
     * @mbggenerated Wed Mar 23 20:58:10 CST 2022
     */
    int insert(Customer record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_customer
     *
     * @mbggenerated Wed Mar 23 20:58:10 CST 2022
     */
    int insertSelective(Customer record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_customer
     *
     * @mbggenerated Wed Mar 23 20:58:10 CST 2022
     */
    Customer selectByPrimaryKey(String id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_customer
     *
     * @mbggenerated Wed Mar 23 20:58:10 CST 2022
     */
    int updateByPrimaryKeySelective(Customer record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_customer
     *
     * @mbggenerated Wed Mar 23 20:58:10 CST 2022
     */
    int updateByPrimaryKey(Customer record);

    /**
     * 插入新用户
     * @param customer 用户信息
     * @return 插入条数
     */
    int insertCustomer(Customer customer);

    /**
     * 根据条件分页查询客户列表
     * @param map 查询条件
     * @return 查询到的客户
     */
    List<Customer> selectCustomerByConditionForPage(Map<String, Object> map);

    /**
     * 根据条件查询客户总条数
     * @param map 查询条件
     * @return 客户总条数
     */
    int selectCountOfCustomerByCondition(Map<String, Object> map);

    /**
     * 通过id查询客户信息
     * @param id 客户id
     * @return 查询到的客户
     */
    Customer selectCustomerById(String id);

    /**
     * 修改客户
     * @param customer 客户信息
     * @return 修改条数
     */
    int updateCustomer(Customer customer);

    /**
     * 通过客户id数组删除对应的客户
     * @param ids 客户id数组
     * @return 删除的条数
     */
    int deleteCustomerByIds(String[] ids);

    /**
     * 通过客户id查询客户的详细信息
     * @param id 客户id
     * @return 查询到的客户
     */
    Customer selectCustomerForDetailById(String id);

    /**
     * 通过客户姓名模糊查询客户全名
     * @param customerName 模糊查询客户姓名
     * @return 匹配的客户全名
     */
    List<String> selectCustomerNameByFuzzyName(String customerName);

    /**
     * 通过客户姓名查询客户详细信息
     * @param customerName 客户姓名
     * @return 客户
     */
    Customer selectCustomerByName(String customerName);

    /**
     * 通过客户姓名查询客户id
     * @param customerName 客户姓名
     * @return 客户姓名
     */
    String selectCustomerIdByName(String customerName);
}

CustomerMapper.xml: 

<?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.bjpowernode.crm.workbench.mapper.CustomerMapper" >
  <resultMap id="BaseResultMap" type="com.bjpowernode.crm.workbench.domain.Customer" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Mar 23 20:58:10 CST 2022.
    -->
    <id column="id" property="id" jdbcType="CHAR" />
    <result column="owner" property="owner" jdbcType="CHAR" />
    <result column="name" property="name" jdbcType="VARCHAR" />
    <result column="website" property="website" jdbcType="VARCHAR" />
    <result column="phone" property="phone" jdbcType="VARCHAR" />
    <result column="create_by" property="createBy" jdbcType="VARCHAR" />
    <result column="create_time" property="createTime" jdbcType="CHAR" />
    <result column="edit_by" property="editBy" jdbcType="VARCHAR" />
    <result column="edit_time" property="editTime" jdbcType="CHAR" />
    <result column="contact_summary" property="contactSummary" jdbcType="VARCHAR" />
    <result column="next_contact_time" property="nextContactTime" jdbcType="CHAR" />
    <result column="description" property="description" jdbcType="VARCHAR" />
    <result column="address" property="address" jdbcType="VARCHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Mar 23 20:58:10 CST 2022.
    -->
    id, owner, name, website, phone, create_by, create_time, edit_by, edit_time, contact_summary, 
    next_contact_time, description, address
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Mar 23 20:58:10 CST 2022.
    -->
    select 
    <include refid="Base_Column_List" />
    from tbl_customer
    where id = #{id,jdbcType=CHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Mar 23 20:58:10 CST 2022.
    -->
    delete from tbl_customer
    where id = #{id,jdbcType=CHAR}
  </delete>
  <insert id="insert" parameterType="com.bjpowernode.crm.workbench.domain.Customer" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Mar 23 20:58:10 CST 2022.
    -->
    insert into tbl_customer (id, owner, name, website, 
      phone, create_by, create_time, 
      edit_by, edit_time, contact_summary, 
      next_contact_time, description, address
      )
    values (#{id,jdbcType=CHAR}, #{owner,jdbcType=CHAR}, #{name,jdbcType=VARCHAR}, #{website,jdbcType=VARCHAR}, 
      #{phone,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=CHAR}, 
      #{editBy,jdbcType=VARCHAR}, #{editTime,jdbcType=CHAR}, #{contactSummary,jdbcType=VARCHAR}, 
      #{nextContactTime,jdbcType=CHAR}, #{description,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.bjpowernode.crm.workbench.domain.Customer" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Mar 23 20:58:10 CST 2022.
    -->
    insert into tbl_customer
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="owner != null" >
        owner,
      </if>
      <if test="name != null" >
        name,
      </if>
      <if test="website != null" >
        website,
      </if>
      <if test="phone != null" >
        phone,
      </if>
      <if test="createBy != null" >
        create_by,
      </if>
      <if test="createTime != null" >
        create_time,
      </if>
      <if test="editBy != null" >
        edit_by,
      </if>
      <if test="editTime != null" >
        edit_time,
      </if>
      <if test="contactSummary != null" >
        contact_summary,
      </if>
      <if test="nextContactTime != null" >
        next_contact_time,
      </if>
      <if test="description != null" >
        description,
      </if>
      <if test="address != null" >
        address,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=CHAR},
      </if>
      <if test="owner != null" >
        #{owner,jdbcType=CHAR},
      </if>
      <if test="name != null" >
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="website != null" >
        #{website,jdbcType=VARCHAR},
      </if>
      <if test="phone != null" >
        #{phone,jdbcType=VARCHAR},
      </if>
      <if test="createBy != null" >
        #{createBy,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null" >
        #{createTime,jdbcType=CHAR},
      </if>
      <if test="editBy != null" >
        #{editBy,jdbcType=VARCHAR},
      </if>
      <if test="editTime != null" >
        #{editTime,jdbcType=CHAR},
      </if>
      <if test="contactSummary != null" >
        #{contactSummary,jdbcType=VARCHAR},
      </if>
      <if test="nextContactTime != null" >
        #{nextContactTime,jdbcType=CHAR},
      </if>
      <if test="description != null" >
        #{description,jdbcType=VARCHAR},
      </if>
      <if test="address != null" >
        #{address,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.bjpowernode.crm.workbench.domain.Customer" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Mar 23 20:58:10 CST 2022.
    -->
    update tbl_customer
    <set >
      <if test="owner != null" >
        owner = #{owner,jdbcType=CHAR},
      </if>
      <if test="name != null" >
        name = #{name,jdbcType=VARCHAR},
      </if>
      <if test="website != null" >
        website = #{website,jdbcType=VARCHAR},
      </if>
      <if test="phone != null" >
        phone = #{phone,jdbcType=VARCHAR},
      </if>
      <if test="createBy != null" >
        create_by = #{createBy,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null" >
        create_time = #{createTime,jdbcType=CHAR},
      </if>
      <if test="editBy != null" >
        edit_by = #{editBy,jdbcType=VARCHAR},
      </if>
      <if test="editTime != null" >
        edit_time = #{editTime,jdbcType=CHAR},
      </if>
      <if test="contactSummary != null" >
        contact_summary = #{contactSummary,jdbcType=VARCHAR},
      </if>
      <if test="nextContactTime != null" >
        next_contact_time = #{nextContactTime,jdbcType=CHAR},
      </if>
      <if test="description != null" >
        description = #{description,jdbcType=VARCHAR},
      </if>
      <if test="address != null" >
        address = #{address,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=CHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.bjpowernode.crm.workbench.domain.Customer" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Mar 23 20:58:10 CST 2022.
    -->
    update tbl_customer
    set owner = #{owner,jdbcType=CHAR},
      name = #{name,jdbcType=VARCHAR},
      website = #{website,jdbcType=VARCHAR},
      phone = #{phone,jdbcType=VARCHAR},
      create_by = #{createBy,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=CHAR},
      edit_by = #{editBy,jdbcType=VARCHAR},
      edit_time = #{editTime,jdbcType=CHAR},
      contact_summary = #{contactSummary,jdbcType=VARCHAR},
      next_contact_time = #{nextContactTime,jdbcType=CHAR},
      description = #{description,jdbcType=VARCHAR},
      address = #{address,jdbcType=VARCHAR}
    where id = #{id,jdbcType=CHAR}
  </update>

  <!--插入新用户-->
  <insert id="insertCustomer" parameterType="com.bjpowernode.crm.workbench.domain.Customer">
    insert into tbl_customer(id, owner, name, website, phone, create_by, create_time, contact_summary,next_contact_time, description, address)
    values (#{id}, #{owner}, #{name}, #{website}, #{phone}, #{createBy},#{createTime},
            #{contactSummary},#{nextContactTime},#{description}, #{address})
  </insert>

  <select id="selectCustomerByConditionForPage" parameterType="map" resultMap="BaseResultMap">
    select c.id, u1.name as owner, c.name, ifnull(c.website, ' ') as website, ifnull(c.phone, ' ') as phone, u2.name as create_by,
           c.create_time,u3.name as edit_by, c.edit_time, c.contact_summary, c.next_contact_time, c.description, c.address
    from tbl_customer c
    join tbl_user u1 on c.owner=u1.id
    join tbl_user u2 on c.create_by=u2.id
    left join tbl_user u3 on c.edit_by=u3.id
    <where>
      <if test="name!=null and name!=''">
        and c.name like '%' #{name} '%'
      </if>
      <if test="owner!=null and owner!=''">
        and u1.name like '%' #{owner} '%'
      </if>
      <if test="phone!=null and phone!=''">
        and c.phone like '%' #{phone} '%'
      </if>
      <if test="website!=null and website!=''">
        and c.website like '%' #{website} '%'
      </if>
    </where>
    order by c.create_time desc
    limit #{beginNo},#{pageSize}
  </select>

  <select id="selectCountOfCustomerByCondition" parameterType="map" resultType="int">
    select count(*)
    from tbl_customer c
    join tbl_user u1 on c.owner=u1.id
    join tbl_user u2 on c.create_by=u2.id
    left join tbl_user u3 on c.edit_by=u3.id
    <where>
      <if test="name!=null and name!=''">
        and c.name like '%' #{name} '%'
      </if>
      <if test="owner!=null and owner!=''">
        and u1.name like '%' #{owner} '%'
      </if>
      <if test="phone!=null and phone!=''">
        and c.phone like '%' #{phone} '%'
      </if>
      <if test="website!=null and website!=''">
        and c.website like '%' #{website} '%'
      </if>
    </where>
  </select>

  <select id="selectCustomerById" parameterType="string" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from tbl_customer
    where id = #{id,jdbcType=CHAR}
  </select>

  <update id="updateCustomer" parameterType="com.bjpowernode.crm.workbench.domain.Customer">
    update tbl_customer
    set owner=#{owner}, name=#{name}, website=#{website}, phone=#{phone},edit_by=#{editBy},edit_time=#{editTime},
        contact_summary=#{contactSummary},next_contact_time=#{nextContactTime}, description=#{description}, address=#{address}
    where id=#{id}
  </update>

  <delete id="deleteCustomerByIds" parameterType="string">
    delete from tbl_customer
    where id in
    <foreach collection="array" item="id" separator="," open="(" close=")">
      #{id}
    </foreach>
  </delete>

  <select id="selectCustomerForDetailById" parameterType="string" resultMap="BaseResultMap">
    select c.id, u1.name as owner, c.name, c.website, c.phone, u2.name as create_by, c.create_time,
           u3.name as edit_by, c.edit_time, c.contact_summary, c.next_contact_time, c.description, c.address
    from tbl_customer c
           join tbl_user u1 on c.owner=u1.id
           join tbl_user u2 on c.create_by=u2.id
           left join tbl_user u3 on c.edit_by=u3.id
    where c.id=#{id}
  </select>

  <!--通过客户姓名模糊查询客户全名-->
  <select id="selectCustomerNameByFuzzyName" parameterType="string" resultType="string">
    select name
    from tbl_customer
    where name like '%' #{customerName} '%'
  </select>

  <!--过客户姓名查询客户详细信息-->
  <select id="selectCustomerByName" resultMap="BaseResultMap" parameterType="string">
    select
    <include refid="Base_Column_List"/>
    from tbl_customer
    where name=#{customerName}
  </select>

  <!--通过客户姓名查询客户id-->
  <select id="selectCustomerIdByName" resultType="string" parameterType="string">
    select id
    from tbl_customer
    where name=#{customerName}
  </select>

</mapper>

CustomerRemarkMapper 

package com.bjpowernode.crm.workbench.mapper;



import com.bjpowernode.crm.workbench.domain.CustomerRemark;

import java.util.List;

public interface CustomerRemarkMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_customer_remark
     *
     * @mbggenerated Thu Mar 24 22:29:16 CST 2022
     */
    int deleteByPrimaryKey(String id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_customer_remark
     *
     * @mbggenerated Thu Mar 24 22:29:16 CST 2022
     */
    int insert(CustomerRemark record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_customer_remark
     *
     * @mbggenerated Thu Mar 24 22:29:16 CST 2022
     */
    int insertSelective(CustomerRemark record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_customer_remark
     *
     * @mbggenerated Thu Mar 24 22:29:16 CST 2022
     */
    CustomerRemark selectByPrimaryKey(String id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_customer_remark
     *
     * @mbggenerated Thu Mar 24 22:29:16 CST 2022
     */
    int updateByPrimaryKeySelective(CustomerRemark record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_customer_remark
     *
     * @mbggenerated Thu Mar 24 22:29:16 CST 2022
     */
    int updateByPrimaryKey(CustomerRemark record);

    /**
     * 通过客户备注集合插入客户备注
     * @param customerRemarkList 客户备注集合
     * @return 插入条数
     */
    int insertCustomerRemarkByList(List<CustomerRemark> customerRemarkList);

    /**
     * 通过客户id查询该客户备注详细信息
     * @param customerId
     * @return
     */
    List<CustomerRemark> selectCustomerRemarkForDetailByCustomerId(String customerId);

    /**
     * 通过客户id数组删除备注(用于删除客户时同时删除该客户备注;因为可能一次性会删除多个客户,所以传入的id是客户id数组)
     * @param customerIds 客户id数组
     * @return 删除的条数
     */
    int deleteCustomerRemarkByCustomerIds(String[] customerIds);

    /**
     * 新增客户备注
     * @param customerRemark 客户备注
     * @return 新增条数
     */
    int insertCustomerRemark(CustomerRemark customerRemark);

    /**
     * 通过客户备注id删除备注
     * @param id 客户id
     * @return 删除的条数
     */
    int deleteCustomerRemarkById(String id);

    /**
     * 更新客户备注
     * @param customerRemark 客户备注信息
     * @return 更新条数
     */
    int updateCustomerRemark(CustomerRemark customerRemark);
}

CustomerRemarkMapper.xml:

<?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.bjpowernode.crm.workbench.mapper.CustomerRemarkMapper" >
  <resultMap id="BaseResultMap" type="com.bjpowernode.crm.workbench.domain.CustomerRemark" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Mar 24 22:29:16 CST 2022.
    -->
    <id column="id" property="id" jdbcType="CHAR" />
    <result column="note_content" property="noteContent" jdbcType="VARCHAR" />
    <result column="create_by" property="createBy" jdbcType="VARCHAR" />
    <result column="create_time" property="createTime" jdbcType="CHAR" />
    <result column="edit_by" property="editBy" jdbcType="VARCHAR" />
    <result column="edit_time" property="editTime" jdbcType="CHAR" />
    <result column="edit_flag" property="editFlag" jdbcType="CHAR" />
    <result column="customer_id" property="customerId" jdbcType="CHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Mar 24 22:29:16 CST 2022.
    -->
    id, note_content, create_by, create_time, edit_by, edit_time, edit_flag, customer_id
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Mar 24 22:29:16 CST 2022.
    -->
    select 
    <include refid="Base_Column_List" />
    from tbl_customer_remark
    where id = #{id,jdbcType=CHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Mar 24 22:29:16 CST 2022.
    -->
    delete from tbl_customer_remark
    where id = #{id,jdbcType=CHAR}
  </delete>
  <insert id="insert" parameterType="com.bjpowernode.crm.workbench.domain.CustomerRemark" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Mar 24 22:29:16 CST 2022.
    -->
    insert into tbl_customer_remark (id, note_content, create_by, 
      create_time, edit_by, edit_time, 
      edit_flag, customer_id)
    values (#{id,jdbcType=CHAR}, #{noteContent,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, 
      #{createTime,jdbcType=CHAR}, #{editBy,jdbcType=VARCHAR}, #{editTime,jdbcType=CHAR}, 
      #{editFlag,jdbcType=CHAR}, #{customerId,jdbcType=CHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.bjpowernode.crm.workbench.domain.CustomerRemark" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Mar 24 22:29:16 CST 2022.
    -->
    insert into tbl_customer_remark
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="noteContent != null" >
        note_content,
      </if>
      <if test="createBy != null" >
        create_by,
      </if>
      <if test="createTime != null" >
        create_time,
      </if>
      <if test="editBy != null" >
        edit_by,
      </if>
      <if test="editTime != null" >
        edit_time,
      </if>
      <if test="editFlag != null" >
        edit_flag,
      </if>
      <if test="customerId != null" >
        customer_id,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=CHAR},
      </if>
      <if test="noteContent != null" >
        #{noteContent,jdbcType=VARCHAR},
      </if>
      <if test="createBy != null" >
        #{createBy,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null" >
        #{createTime,jdbcType=CHAR},
      </if>
      <if test="editBy != null" >
        #{editBy,jdbcType=VARCHAR},
      </if>
      <if test="editTime != null" >
        #{editTime,jdbcType=CHAR},
      </if>
      <if test="editFlag != null" >
        #{editFlag,jdbcType=CHAR},
      </if>
      <if test="customerId != null" >
        #{customerId,jdbcType=CHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.bjpowernode.crm.workbench.domain.CustomerRemark" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Mar 24 22:29:16 CST 2022.
    -->
    update tbl_customer_remark
    <set >
      <if test="noteContent != null" >
        note_content = #{noteContent,jdbcType=VARCHAR},
      </if>
      <if test="createBy != null" >
        create_by = #{createBy,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null" >
        create_time = #{createTime,jdbcType=CHAR},
      </if>
      <if test="editBy != null" >
        edit_by = #{editBy,jdbcType=VARCHAR},
      </if>
      <if test="editTime != null" >
        edit_time = #{editTime,jdbcType=CHAR},
      </if>
      <if test="editFlag != null" >
        edit_flag = #{editFlag,jdbcType=CHAR},
      </if>
      <if test="customerId != null" >
        customer_id = #{customerId,jdbcType=CHAR},
      </if>
    </set>
    where id = #{id,jdbcType=CHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.bjpowernode.crm.workbench.domain.CustomerRemark" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Mar 24 22:29:16 CST 2022.
    -->
    update tbl_customer_remark
    set note_content = #{noteContent,jdbcType=VARCHAR},
      create_by = #{createBy,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=CHAR},
      edit_by = #{editBy,jdbcType=VARCHAR},
      edit_time = #{editTime,jdbcType=CHAR},
      edit_flag = #{editFlag,jdbcType=CHAR},
      customer_id = #{customerId,jdbcType=CHAR}
    where id = #{id,jdbcType=CHAR}
  </update>

  <!--通过客户备注集合插入客户备注-->
  <insert id="insertCustomerRemarkByList" parameterType="com.bjpowernode.crm.workbench.domain.CustomerRemark">
    insert into tbl_customer_remark(id, note_content, create_by, create_time, edit_by, edit_time, edit_flag, customer_id)
    values
    <foreach collection="list" item="obj" separator=",">
      (#{obj.id},#{obj.noteContent},#{obj.createBy},#{obj.createTime},#{obj.editBy},#{obj.editTime},#{obj.editFlag},#{obj.customerId})
    </foreach>
  </insert>

  <select id="selectCustomerRemarkForDetailByCustomerId" resultMap="BaseResultMap" parameterType="string">
    select cr.id,cr.note_content,cr.create_time,u1.name as create_by,cr.edit_time,u2.name as edit_by,cr.edit_flag
    from tbl_customer_remark cr
    join tbl_user u1 on cr.create_by=u1.id
    left join tbl_user u2 on cr.edit_by=u2.id
    where cr.customer_id=#{customerId}
  </select>

  <delete id="deleteCustomerRemarkByCustomerIds" parameterType="string">
    delete from tbl_customer_remark
    where customer_id in
    <foreach collection="array" item="id" separator="," open="(" close=")">
      #{id}
    </foreach>
  </delete>

  <insert id="insertCustomerRemark" parameterType="com.bjpowernode.crm.workbench.domain.CustomerRemark">
    insert into tbl_customer_remark(id, note_content, create_by, create_time, edit_by, edit_time, edit_flag, customer_id)
    values
    (#{id},#{noteContent},#{createBy},#{createTime},#{editBy},#{editTime},#{editFlag},#{customerId})
  </insert>

  <delete id="deleteCustomerRemarkById" parameterType="string">
    delete from tbl_customer_remark
    where id=#{id}
  </delete>

  <update id="updateCustomerRemark" parameterType="com.bjpowernode.crm.workbench.domain.CustomerRemark">
    update tbl_customer_remark
    set note_content=#{noteContent},edit_time=#{editTime},edit_by=#{editBy},edit_flag=#{editFlag}
    where id=#{id}
  </update>
</mapper>

TranHistoryMapper

package com.bjpowernode.crm.workbench.mapper;

import com.bjpowernode.crm.workbench.domain.TranHistory;

import java.util.List;

public interface TranHistoryMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_tran_history
     *
     * @mbggenerated Sat Apr 16 16:10:10 CST 2022
     */
    int deleteByPrimaryKey(String id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_tran_history
     *
     * @mbggenerated Sat Apr 16 16:10:10 CST 2022
     */
    int insert(TranHistory record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_tran_history
     *
     * @mbggenerated Sat Apr 16 16:10:10 CST 2022
     */
    int insertSelective(TranHistory record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_tran_history
     *
     * @mbggenerated Sat Apr 16 16:10:10 CST 2022
     */
    TranHistory selectByPrimaryKey(String id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_tran_history
     *
     * @mbggenerated Sat Apr 16 16:10:10 CST 2022
     */
    int updateByPrimaryKeySelective(TranHistory record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_tran_history
     *
     * @mbggenerated Sat Apr 16 16:10:10 CST 2022
     */
    int updateByPrimaryKey(TranHistory record);

    /**
     * 新增交易历史记录
     * @param tranHistory 交易历史记录
     * @return 新增条数
     */
    int insertTransactionHistory(TranHistory tranHistory);

    //根据交易的id查询交易历史的详细信息
    List<TranHistory> selectTranHistoryForDetailByTranId(String id);

    int deleteTranHistoryByTranIds(String[] tranId);
}

TranHistoryMapper.xml: 

<?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.bjpowernode.crm.workbench.mapper.TranHistoryMapper" >
  <resultMap id="BaseResultMap" type="com.bjpowernode.crm.workbench.domain.TranHistory" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sat Apr 16 16:10:10 CST 2022.
    -->
    <id column="id" property="id" jdbcType="CHAR" />
    <result column="stage" property="stage" jdbcType="VARCHAR" />
    <result column="money" property="money" jdbcType="VARCHAR" />
    <result column="expected_date" property="expectedDate" jdbcType="CHAR" />
    <result column="create_time" property="createTime" jdbcType="CHAR" />
    <result column="create_by" property="createBy" jdbcType="VARCHAR" />
    <result column="tran_id" property="tranId" jdbcType="CHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sat Apr 16 16:10:10 CST 2022.
    -->
    id, stage, money, expected_date, create_time, create_by, tran_id
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sat Apr 16 16:10:10 CST 2022.
    -->
    select 
    <include refid="Base_Column_List" />
    from tbl_tran_history
    where id = #{id,jdbcType=CHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sat Apr 16 16:10:10 CST 2022.
    -->
    delete from tbl_tran_history
    where id = #{id,jdbcType=CHAR}
  </delete>
  <insert id="insert" parameterType="com.bjpowernode.crm.workbench.domain.TranHistory" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sat Apr 16 16:10:10 CST 2022.
    -->
    insert into tbl_tran_history (id, stage, money, 
      expected_date, create_time, create_by, 
      tran_id)
    values (#{id,jdbcType=CHAR}, #{stage,jdbcType=VARCHAR}, #{money,jdbcType=VARCHAR}, 
      #{expectedDate,jdbcType=CHAR}, #{createTime,jdbcType=CHAR}, #{createBy,jdbcType=VARCHAR}, 
      #{tranId,jdbcType=CHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.bjpowernode.crm.workbench.domain.TranHistory" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sat Apr 16 16:10:10 CST 2022.
    -->
    insert into tbl_tran_history
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="stage != null" >
        stage,
      </if>
      <if test="money != null" >
        money,
      </if>
      <if test="expectedDate != null" >
        expected_date,
      </if>
      <if test="createTime != null" >
        create_time,
      </if>
      <if test="createBy != null" >
        create_by,
      </if>
      <if test="tranId != null" >
        tran_id,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=CHAR},
      </if>
      <if test="stage != null" >
        #{stage,jdbcType=VARCHAR},
      </if>
      <if test="money != null" >
        #{money,jdbcType=VARCHAR},
      </if>
      <if test="expectedDate != null" >
        #{expectedDate,jdbcType=CHAR},
      </if>
      <if test="createTime != null" >
        #{createTime,jdbcType=CHAR},
      </if>
      <if test="createBy != null" >
        #{createBy,jdbcType=VARCHAR},
      </if>
      <if test="tranId != null" >
        #{tranId,jdbcType=CHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.bjpowernode.crm.workbench.domain.TranHistory" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sat Apr 16 16:10:10 CST 2022.
    -->
    update tbl_tran_history
    <set >
      <if test="stage != null" >
        stage = #{stage,jdbcType=VARCHAR},
      </if>
      <if test="money != null" >
        money = #{money,jdbcType=VARCHAR},
      </if>
      <if test="expectedDate != null" >
        expected_date = #{expectedDate,jdbcType=CHAR},
      </if>
      <if test="createTime != null" >
        create_time = #{createTime,jdbcType=CHAR},
      </if>
      <if test="createBy != null" >
        create_by = #{createBy,jdbcType=VARCHAR},
      </if>
      <if test="tranId != null" >
        tran_id = #{tranId,jdbcType=CHAR},
      </if>
    </set>
    where id = #{id,jdbcType=CHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.bjpowernode.crm.workbench.domain.TranHistory" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sat Apr 16 16:10:10 CST 2022.
    -->
    update tbl_tran_history
    set stage = #{stage,jdbcType=VARCHAR},
      money = #{money,jdbcType=VARCHAR},
      expected_date = #{expectedDate,jdbcType=CHAR},
      create_time = #{createTime,jdbcType=CHAR},
      create_by = #{createBy,jdbcType=VARCHAR},
      tran_id = #{tranId,jdbcType=CHAR}
    where id = #{id,jdbcType=CHAR}
  </update>

  <!--新增交易历史记录-->
  <insert id="insertTransactionHistory" parameterType="com.bjpowernode.crm.workbench.domain.TranHistory">
    insert into tbl_tran_history (id, stage, money, expected_date, create_time, create_by, tran_id)
    values (#{id,jdbcType=CHAR}, #{stage,jdbcType=VARCHAR}, #{money,jdbcType=VARCHAR},
            #{expectedDate,jdbcType=CHAR}, #{createTime,jdbcType=CHAR}, #{createBy,jdbcType=VARCHAR},
            #{tranId,jdbcType=CHAR})
  </insert>

  <!--//根据交易的id查询交易历史的详细信息-->
  <select id="selectTranHistoryForDetailByTranId" parameterType="string" resultMap="BaseResultMap">
    select dv.value as stage,th.money,th.expected_date,th.create_time,u.name as create_by
    from tbl_tran_history th
           join tbl_dic_value dv on th.stage=dv.id
           join tbl_user u on th.create_by=u.id
    where th.tran_id=#{id}
    order by th.create_time asc
  </select>

  <delete id="deleteTranHistoryByTranIds" parameterType="string">
    delete from tbl_tran_history
    where tran_id in
    <foreach collection="array" separator="," item="id" open="(" close=")">
      #{id}
    </foreach>
  </delete>
</mapper>

TranMapper 

package com.bjpowernode.crm.workbench.mapper;


import com.bjpowernode.crm.workbench.domain.FunnelVO;
import com.bjpowernode.crm.workbench.domain.Tran;

import java.util.List;
import java.util.Map;

public interface TranMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_tran
     *
     * @mbggenerated Sun Mar 27 10:41:50 CST 2022
     */
    int deleteByPrimaryKey(String id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_tran
     *
     * @mbggenerated Sun Mar 27 10:41:50 CST 2022
     */
    int insert(Tran record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_tran
     *
     * @mbggenerated Sun Mar 27 10:41:50 CST 2022
     */
    int insertSelective(Tran record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_tran
     *
     * @mbggenerated Sun Mar 27 10:41:50 CST 2022
     */
    Tran selectByPrimaryKey(String id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_tran
     *
     * @mbggenerated Sun Mar 27 10:41:50 CST 2022
     */
    int updateByPrimaryKeySelective(Tran record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_tran
     *
     * @mbggenerated Sun Mar 27 10:41:50 CST 2022
     */
    int updateByPrimaryKey(Tran record);

    /**
     * 新增一条交易记录
     * @param tran 交易信息
     * @return 新增条数
     */
    int insertTran(Tran tran);

    List<Tran> selectTransactionByConditionForPage(Map<String, Object> map);

    int selectCountOfTransactionByCondition(Map<String, Object> map);

    Tran selectTransactionById(String id);

    int updateTran(Tran tran);

    int deleteTranByIds(String[] ids);

    //查看交易的详细信息
    Tran selectTranForDetailById(String id);

    /**
     * 查询交易表中各个阶段的数据量
     * @return 数据集合
     */
    List<FunnelVO> selectCountOfTranGroupByStage();
}

TranMapper.xml:

<?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.bjpowernode.crm.workbench.mapper.TranMapper" >
  <resultMap id="BaseResultMap" type="com.bjpowernode.crm.workbench.domain.Tran" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sun Mar 27 10:41:50 CST 2022.
    -->
    <id column="id" property="id" jdbcType="CHAR" />
    <result column="owner" property="owner" jdbcType="CHAR" />
    <result column="money" property="money" jdbcType="VARCHAR" />
    <result column="name" property="name" jdbcType="VARCHAR" />
    <result column="expected_date" property="expectedDate" jdbcType="CHAR" />
    <result column="customer_id" property="customerId" jdbcType="CHAR" />
    <result column="stage" property="stage" jdbcType="VARCHAR" />
    <result column="type" property="type" jdbcType="VARCHAR" />
    <result column="source" property="source" jdbcType="VARCHAR" />
    <result column="activity_id" property="activityId" jdbcType="CHAR" />
    <result column="contacts_id" property="contactsId" jdbcType="CHAR" />
    <result column="create_by" property="createBy" jdbcType="VARCHAR" />
    <result column="create_time" property="createTime" jdbcType="CHAR" />
    <result column="edit_by" property="editBy" jdbcType="VARCHAR" />
    <result column="edit_time" property="editTime" jdbcType="CHAR" />
    <result column="description" property="description" jdbcType="VARCHAR" />
    <result column="contact_summary" property="contactSummary" jdbcType="VARCHAR" />
    <result column="next_contact_time" property="nextContactTime" jdbcType="CHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sun Mar 27 10:41:50 CST 2022.
    -->
    id, owner, money, name, expected_date, customer_id, stage, type, source, activity_id, 
    contacts_id, create_by, create_time, edit_by, edit_time, description, contact_summary, 
    next_contact_time
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sun Mar 27 10:41:50 CST 2022.
    -->
    select 
    <include refid="Base_Column_List" />
    from tbl_tran
    where id = #{id,jdbcType=CHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sun Mar 27 10:41:50 CST 2022.
    -->
    delete from tbl_tran
    where id = #{id,jdbcType=CHAR}
  </delete>
  <insert id="insert" parameterType="com.bjpowernode.crm.workbench.domain.Tran" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sun Mar 27 10:41:50 CST 2022.
    -->
    insert into tbl_tran (id, owner, money, name, 
      expected_date, customer_id, stage, 
      type, source, activity_id, 
      contacts_id, create_by, create_time, 
      edit_by, edit_time, description, 
      contact_summary, next_contact_time)
    values (#{id,jdbcType=CHAR}, #{owner,jdbcType=CHAR}, #{money,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, 
      #{expectedDate,jdbcType=CHAR}, #{customerId,jdbcType=CHAR}, #{stage,jdbcType=VARCHAR}, 
      #{type,jdbcType=VARCHAR}, #{source,jdbcType=VARCHAR}, #{activityId,jdbcType=CHAR}, 
      #{contactsId,jdbcType=CHAR}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=CHAR}, 
      #{editBy,jdbcType=VARCHAR}, #{editTime,jdbcType=CHAR}, #{description,jdbcType=VARCHAR}, 
      #{contactSummary,jdbcType=VARCHAR}, #{nextContactTime,jdbcType=CHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.bjpowernode.crm.workbench.domain.Tran" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sun Mar 27 10:41:50 CST 2022.
    -->
    insert into tbl_tran
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="owner != null" >
        owner,
      </if>
      <if test="money != null" >
        money,
      </if>
      <if test="name != null" >
        name,
      </if>
      <if test="expectedDate != null" >
        expected_date,
      </if>
      <if test="customerId != null" >
        customer_id,
      </if>
      <if test="stage != null" >
        stage,
      </if>
      <if test="type != null" >
        type,
      </if>
      <if test="source != null" >
        source,
      </if>
      <if test="activityId != null" >
        activity_id,
      </if>
      <if test="contactsId != null" >
        contacts_id,
      </if>
      <if test="createBy != null" >
        create_by,
      </if>
      <if test="createTime != null" >
        create_time,
      </if>
      <if test="editBy != null" >
        edit_by,
      </if>
      <if test="editTime != null" >
        edit_time,
      </if>
      <if test="description != null" >
        description,
      </if>
      <if test="contactSummary != null" >
        contact_summary,
      </if>
      <if test="nextContactTime != null" >
        next_contact_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=CHAR},
      </if>
      <if test="owner != null" >
        #{owner,jdbcType=CHAR},
      </if>
      <if test="money != null" >
        #{money,jdbcType=VARCHAR},
      </if>
      <if test="name != null" >
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="expectedDate != null" >
        #{expectedDate,jdbcType=CHAR},
      </if>
      <if test="customerId != null" >
        #{customerId,jdbcType=CHAR},
      </if>
      <if test="stage != null" >
        #{stage,jdbcType=VARCHAR},
      </if>
      <if test="type != null" >
        #{type,jdbcType=VARCHAR},
      </if>
      <if test="source != null" >
        #{source,jdbcType=VARCHAR},
      </if>
      <if test="activityId != null" >
        #{activityId,jdbcType=CHAR},
      </if>
      <if test="contactsId != null" >
        #{contactsId,jdbcType=CHAR},
      </if>
      <if test="createBy != null" >
        #{createBy,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null" >
        #{createTime,jdbcType=CHAR},
      </if>
      <if test="editBy != null" >
        #{editBy,jdbcType=VARCHAR},
      </if>
      <if test="editTime != null" >
        #{editTime,jdbcType=CHAR},
      </if>
      <if test="description != null" >
        #{description,jdbcType=VARCHAR},
      </if>
      <if test="contactSummary != null" >
        #{contactSummary,jdbcType=VARCHAR},
      </if>
      <if test="nextContactTime != null" >
        #{nextContactTime,jdbcType=CHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.bjpowernode.crm.workbench.domain.Tran" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sun Mar 27 10:41:50 CST 2022.
    -->
    update tbl_tran
    <set >
      <if test="owner != null" >
        owner = #{owner,jdbcType=CHAR},
      </if>
      <if test="money != null" >
        money = #{money,jdbcType=VARCHAR},
      </if>
      <if test="name != null" >
        name = #{name,jdbcType=VARCHAR},
      </if>
      <if test="expectedDate != null" >
        expected_date = #{expectedDate,jdbcType=CHAR},
      </if>
      <if test="customerId != null" >
        customer_id = #{customerId,jdbcType=CHAR},
      </if>
      <if test="stage != null" >
        stage = #{stage,jdbcType=VARCHAR},
      </if>
      <if test="type != null" >
        type = #{type,jdbcType=VARCHAR},
      </if>
      <if test="source != null" >
        source = #{source,jdbcType=VARCHAR},
      </if>
      <if test="activityId != null" >
        activity_id = #{activityId,jdbcType=CHAR},
      </if>
      <if test="contactsId != null" >
        contacts_id = #{contactsId,jdbcType=CHAR},
      </if>
      <if test="createBy != null" >
        create_by = #{createBy,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null" >
        create_time = #{createTime,jdbcType=CHAR},
      </if>
      <if test="editBy != null" >
        edit_by = #{editBy,jdbcType=VARCHAR},
      </if>
      <if test="editTime != null" >
        edit_time = #{editTime,jdbcType=CHAR},
      </if>
      <if test="description != null" >
        description = #{description,jdbcType=VARCHAR},
      </if>
      <if test="contactSummary != null" >
        contact_summary = #{contactSummary,jdbcType=VARCHAR},
      </if>
      <if test="nextContactTime != null" >
        next_contact_time = #{nextContactTime,jdbcType=CHAR},
      </if>
    </set>
    where id = #{id,jdbcType=CHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.bjpowernode.crm.workbench.domain.Tran" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sun Mar 27 10:41:50 CST 2022.
    -->
    update tbl_tran
    set owner = #{owner,jdbcType=CHAR},
      money = #{money,jdbcType=VARCHAR},
      name = #{name,jdbcType=VARCHAR},
      expected_date = #{expectedDate,jdbcType=CHAR},
      customer_id = #{customerId,jdbcType=CHAR},
      stage = #{stage,jdbcType=VARCHAR},
      type = #{type,jdbcType=VARCHAR},
      source = #{source,jdbcType=VARCHAR},
      activity_id = #{activityId,jdbcType=CHAR},
      contacts_id = #{contactsId,jdbcType=CHAR},
      create_by = #{createBy,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=CHAR},
      edit_by = #{editBy,jdbcType=VARCHAR},
      edit_time = #{editTime,jdbcType=CHAR},
      description = #{description,jdbcType=VARCHAR},
      contact_summary = #{contactSummary,jdbcType=VARCHAR},
      next_contact_time = #{nextContactTime,jdbcType=CHAR}
    where id = #{id,jdbcType=CHAR}
  </update>

  <!--新增一条交易记录-->
  <insert id="insertTran" parameterType="com.bjpowernode.crm.workbench.domain.Tran">
    insert into tbl_tran(id, owner, money, name, expected_date, customer_id, stage, type, source, activity_id,
                         contacts_id, create_by, create_time, description, contact_summary,next_contact_time)
    values (#{id}, #{owner}, #{money}, #{name}, #{expectedDate}, #{customerId}, #{stage}, #{type}, #{source}, #{activityId},
            #{contactsId}, #{createBy}, #{createTime}, #{description}, #{contactSummary}, #{nextContactTime})
  </insert>

  <select id="selectTransactionByConditionForPage" parameterType="map" resultMap="BaseResultMap">
    select tr.id, u1.name as owner, tr.money, tr.name, tr.expected_date, cu.name as customer_id,
           dicv1.value as stage, ifnull(dicv2.value, '')  as type, ifnull(dicv3.value, '')  as source, ac.name as activity_id,
           ifnull(co.fullname, ' ') as contacts_id, u2.name as create_by, tr.create_time, u3.name as edit_by, tr.edit_time,
           tr.description, tr.contact_summary, tr.next_contact_time
    from tbl_tran tr
    join tbl_user u1 on tr.owner = u1.id
    join tbl_user u2 on tr.create_by = u2.id
    left join tbl_user u3 on tr.edit_by = u3.id
    left join tbl_activity ac on tr.activity_id = ac.id
    left join tbl_contacts co on tr.contacts_id = co.id
    join tbl_customer cu on tr.customer_id = cu.id
    join tbl_dic_value dicv1 on tr.stage = dicv1.id
    left join tbl_dic_value dicv2 on tr.type = dicv2.id
    left join tbl_dic_value dicv3 on tr.source = dicv3.id
    <where>
      <if test="owner!=null and owner!=''">
        and u1.name like '%' #{owner} '%'
      </if>
      <if test="name!=null and name!=''">
        and tr.name like '%' #{name} '%'
      </if>
      <if test="customerId!=null and customerId!=''">
        and cu.name like '%' #{customerId} '%'
      </if>
      <if test="stage!=null and stage!=''">
        and dicv1.value like '%' #{stage} '%'
      </if>
      <if test="type!=null and type!=''">
        and dicv2.value like '%' #{type} '%'
      </if>
      <if test="source!=null and source!=''">
        and dicv3.value like '%' #{source} '%'
      </if>
      <if test="contactsId!=null and contactsId!=''">
        and co.fullname like '%' #{contactsId} '%'
      </if>
    </where>
    order by tr.create_time desc
    limit #{beginNo},#{pageSize};
  </select>

  <select id="selectCountOfTransactionByCondition" parameterType="map" resultType="int">
    select count(*)
    from tbl_tran tr
    join tbl_user u1 on tr.owner = u1.id
    join tbl_user u2 on tr.create_by = u2.id
    left join tbl_user u3 on tr.edit_by = u3.id
    left join tbl_activity ac on tr.activity_id = ac.id
    left join tbl_contacts co on tr.contacts_id = co.id
    left join tbl_customer cu on tr.customer_id = cu.id
    left join tbl_dic_value dicv1 on tr.stage = dicv1.id
    left join tbl_dic_value dicv2 on tr.type = dicv2.id
    left join tbl_dic_value dicv3 on tr.source = dicv3.id
    <where>
      <if test="owner!=null and owner!=''">
        and u1.name like '%' #{owner} '%'
      </if>
      <if test="name!=null and name!=''">
        and tr.name like '%' #{name} '%'
      </if>
      <if test="customerId!=null and customerId!=''">
        and cu.name like '%' #{customerId} '%'
      </if>
      <if test="stage!=null and stage!=''">
        and dicv1.value like '%' #{stage} '%'
      </if>
      <if test="type!=null and type!=''">
        and dicv2.value like '%' #{type} '%'
      </if>
      <if test="source!=null and source!=''">
        and dicv3.value like '%' #{source} '%'
      </if>
      <if test="contactsId!=null and contactsId!=''">
        and co.fullname like '%' #{contactsId} '%'
      </if>
    </where>
  </select>

  <select id="selectTransactionById" resultMap="BaseResultMap" parameterType="string">
    select
      tr.id, tr.owner, tr.money, tr.name, tr.expected_date, cu.name as customer_id,
      tr.stage, tr.type, tr.source, ac.name as activity_id, co.fullname as contacts_id,
      tr.create_by, tr.create_time, tr.edit_by, tr.edit_time,tr.description, tr.contact_summary, tr.next_contact_time
    from tbl_tran tr
           left join tbl_activity ac on tr.activity_id = ac.id
           left join tbl_contacts co on tr.contacts_id = co.id
           join tbl_customer cu on tr.customer_id = cu.id
    where tr.id = #{id}
  </select>

  <update id="updateTran" parameterType="com.bjpowernode.crm.workbench.domain.Tran">
    update tbl_tran
    set owner=#{owner}, money=#{money}, name=#{name}, expected_date=#{expectedDate}, customer_id=#{customerId}, stage=#{stage},
        type=#{type}, source=#{source},
        <if test="activityId!=null and activityId!=''">
          activity_id=#{activityId},
        </if>
        <if test="contactsId!=null and contactsId!=''">
          contacts_id=#{contactsId},
        </if>
        edit_by=#{editBy}, edit_time=#{editTime},
        description=#{description}, contact_summary=#{contactSummary},next_contact_time=#{nextContactTime}
    where id = #{id}
  </update>

  <delete id="deleteTranByIds" parameterType="string">
    delete from tbl_tran
    where id in
    <foreach collection="array" item="id" separator="," open="(" close=")">
      #{id, jdbcType=VARCHAR}
    </foreach>
  </delete>

  <!--查看交易的详细信息-->
  <select id="selectTranForDetailById" parameterType="string" resultMap="BaseResultMap">
    select t.id,u1.name as owner,t.money,t.name,t.expected_date,c.name as customer_id,dv1.value as stage,dv1.order_no,dv2.value as type,
           dv3.value as source,a.name as activity_id,co.fullname as contacts_id,u2.name as create_by,t.create_time,
           u3.name as edit_by,t.edit_time,t.description,t.contact_summary,t.next_contact_time
    from tbl_tran t
           join tbl_user u1 on t.owner=u1.id
           join tbl_customer c on t.customer_id=c.id
           join tbl_dic_value dv1 on t.stage=dv1.id
           left join tbl_dic_value dv2 on t.type=dv2.id
           left join tbl_dic_value dv3 on t.source=dv3.id
           left join tbl_activity a on t.activity_id=a.id
           left join tbl_contacts co on t.contacts_id=co.id
           join tbl_user u2 on t.create_by=u2.id
           left join tbl_user u3 on t.edit_by=u3.id
    where t.id=#{id}
  </select>

  <!--查询交易表中各个阶段的数据量-->
  <select id="selectCountOfTranGroupByStage" resultType="com.bjpowernode.crm.workbench.domain.FunnelVO">
    select count(*) as value,dv.value as name
    from tbl_tran t
           join tbl_dic_value dv on t.stage=dv.id
    group by t.stage
  </select>
</mapper>

TranRemarkMapper

package com.bjpowernode.crm.workbench.mapper;



import com.bjpowernode.crm.workbench.domain.TranRemark;

import java.util.List;

public interface TranRemarkMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_tran_remark
     *
     * @mbggenerated Sun Mar 27 10:57:44 CST 2022
     */
    int deleteByPrimaryKey(String id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_tran_remark
     *
     * @mbggenerated Sun Mar 27 10:57:44 CST 2022
     */
    int insert(TranRemark record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_tran_remark
     *
     * @mbggenerated Sun Mar 27 10:57:44 CST 2022
     */
    int insertSelective(TranRemark record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_tran_remark
     *
     * @mbggenerated Sun Mar 27 10:57:44 CST 2022
     */
    TranRemark selectByPrimaryKey(String id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_tran_remark
     *
     * @mbggenerated Sun Mar 27 10:57:44 CST 2022
     */
    int updateByPrimaryKeySelective(TranRemark record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tbl_tran_remark
     *
     * @mbggenerated Sun Mar 27 10:57:44 CST 2022
     */
    int updateByPrimaryKey(TranRemark record);

    /**
     * 通过交易备注集合插入交易备注
     * @param tranRemarkList 交易备注集合
     * @return 插入条数
     */
    int insertTranRemarkByList(List<TranRemark> tranRemarkList);

    //查看交易备注详细信息
    List<TranRemark> selectTranRemarkForDetailByTranId(String id);

    int insertTranRemark(TranRemark tranRemark);

    int deleteTranRemarkById(String id);

    int updateTranRemark(TranRemark tranRemark);

    int deleteTranRemarkByTranIds(String[] tranId);
}

TranRemarkMapper.xml: 

<?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.bjpowernode.crm.workbench.mapper.TranRemarkMapper" >
  <resultMap id="BaseResultMap" type="com.bjpowernode.crm.workbench.domain.TranRemark" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sun Mar 27 10:57:44 CST 2022.
    -->
    <id column="id" property="id" jdbcType="CHAR" />
    <result column="note_content" property="noteContent" jdbcType="VARCHAR" />
    <result column="create_by" property="createBy" jdbcType="VARCHAR" />
    <result column="create_time" property="createTime" jdbcType="CHAR" />
    <result column="edit_by" property="editBy" jdbcType="VARCHAR" />
    <result column="edit_time" property="editTime" jdbcType="CHAR" />
    <result column="edit_flag" property="editFlag" jdbcType="CHAR" />
    <result column="tran_id" property="tranId" jdbcType="CHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sun Mar 27 10:57:44 CST 2022.
    -->
    id, note_content, create_by, create_time, edit_by, edit_time, edit_flag, tran_id
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sun Mar 27 10:57:44 CST 2022.
    -->
    select 
    <include refid="Base_Column_List" />
    from tbl_tran_remark
    where id = #{id,jdbcType=CHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sun Mar 27 10:57:44 CST 2022.
    -->
    delete from tbl_tran_remark
    where id = #{id,jdbcType=CHAR}
  </delete>
  <insert id="insert" parameterType="com.bjpowernode.crm.workbench.domain.TranRemark" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sun Mar 27 10:57:44 CST 2022.
    -->
    insert into tbl_tran_remark (id, note_content, create_by, 
      create_time, edit_by, edit_time, 
      edit_flag, tran_id)
    values (#{id,jdbcType=CHAR}, #{noteContent,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, 
      #{createTime,jdbcType=CHAR}, #{editBy,jdbcType=VARCHAR}, #{editTime,jdbcType=CHAR}, 
      #{editFlag,jdbcType=CHAR}, #{tranId,jdbcType=CHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.bjpowernode.crm.workbench.domain.TranRemark" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sun Mar 27 10:57:44 CST 2022.
    -->
    insert into tbl_tran_remark
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="noteContent != null" >
        note_content,
      </if>
      <if test="createBy != null" >
        create_by,
      </if>
      <if test="createTime != null" >
        create_time,
      </if>
      <if test="editBy != null" >
        edit_by,
      </if>
      <if test="editTime != null" >
        edit_time,
      </if>
      <if test="editFlag != null" >
        edit_flag,
      </if>
      <if test="tranId != null" >
        tran_id,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=CHAR},
      </if>
      <if test="noteContent != null" >
        #{noteContent,jdbcType=VARCHAR},
      </if>
      <if test="createBy != null" >
        #{createBy,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null" >
        #{createTime,jdbcType=CHAR},
      </if>
      <if test="editBy != null" >
        #{editBy,jdbcType=VARCHAR},
      </if>
      <if test="editTime != null" >
        #{editTime,jdbcType=CHAR},
      </if>
      <if test="editFlag != null" >
        #{editFlag,jdbcType=CHAR},
      </if>
      <if test="tranId != null" >
        #{tranId,jdbcType=CHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.bjpowernode.crm.workbench.domain.TranRemark" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sun Mar 27 10:57:44 CST 2022.
    -->
    update tbl_tran_remark
    <set >
      <if test="noteContent != null" >
        note_content = #{noteContent,jdbcType=VARCHAR},
      </if>
      <if test="createBy != null" >
        create_by = #{createBy,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null" >
        create_time = #{createTime,jdbcType=CHAR},
      </if>
      <if test="editBy != null" >
        edit_by = #{editBy,jdbcType=VARCHAR},
      </if>
      <if test="editTime != null" >
        edit_time = #{editTime,jdbcType=CHAR},
      </if>
      <if test="editFlag != null" >
        edit_flag = #{editFlag,jdbcType=CHAR},
      </if>
      <if test="tranId != null" >
        tran_id = #{tranId,jdbcType=CHAR},
      </if>
    </set>
    where id = #{id,jdbcType=CHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.bjpowernode.crm.workbench.domain.TranRemark" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sun Mar 27 10:57:44 CST 2022.
    -->
    update tbl_tran_remark
    set note_content = #{noteContent,jdbcType=VARCHAR},
      create_by = #{createBy,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=CHAR},
      edit_by = #{editBy,jdbcType=VARCHAR},
      edit_time = #{editTime,jdbcType=CHAR},
      edit_flag = #{editFlag,jdbcType=CHAR},
      tran_id = #{tranId,jdbcType=CHAR}
    where id = #{id,jdbcType=CHAR}
  </update>

  <!--通过交易备注集合插入交易备注-->
  <insert id="insertTranRemarkByList" parameterType="com.bjpowernode.crm.workbench.domain.TranRemark">
    insert into tbl_tran_remark(id, note_content, create_by, create_time, edit_by, edit_time, edit_flag, tran_id)
    values
    <foreach collection="list" item="obj" separator=",">
      (#{obj.id}, #{obj.noteContent}, #{obj.createBy}, #{obj.createTime}, #{obj.editBy}, #{obj.editTime}, #{obj.editFlag}, #{obj.tranId})
    </foreach>
  </insert>

  <!--查看交易备注详细信息-->
  <select id="selectTranRemarkForDetailByTranId" parameterType="string" resultMap="BaseResultMap">
    select tr.id,tr.note_content,u1.name as create_by,tr.create_time,u2.name as edit_by,tr.edit_time,tr.edit_flag
    from tbl_tran_remark tr
           join tbl_user u1 on tr.create_by=u1.id
           left join tbl_user u2 on tr.edit_by=u2.id
    where tr.tran_id=#{id}
  </select>

  <insert id="insertTranRemark" parameterType="com.bjpowernode.crm.workbench.domain.TranRemark">
    insert into tbl_tran_remark(id, note_content, create_by, create_time, edit_by, edit_time, edit_flag, tran_id)
    values
      (#{id},#{noteContent},#{createBy},#{createTime},#{editBy},#{editTime},#{editFlag},#{tranId})
  </insert>

  <delete id="deleteTranRemarkById" parameterType="string">
    delete from tbl_tran_remark
    where id=#{id}
  </delete>

  <update id="updateTranRemark" parameterType="com.bjpowernode.crm.workbench.domain.TranRemark">
    update tbl_tran_remark
    set note_content=#{noteContent},edit_time=#{editTime},edit_by=#{editBy},edit_flag=#{editFlag}
    where id=#{id}
  </update>

  <delete id="deleteTranRemarkByTranIds" parameterType="string">
    delete from tbl_tran_remark
    where tran_id in
    <foreach collection="array" separator="," item="id" open="(" close=")">
      #{id}
    </foreach>
  </delete>
</mapper>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/42519.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

制作覆盖手绘图的导游地图,非常简单,你也可以

目录 1 前言 2 手绘地图的准备 3 下载软件 4 切图软件基本设置 5 配准设置 6 从平台取得上传切片所需要的3个参数 7 程序切片 8 增加位置点 1 前言 上一篇介绍了制作“简版导游地图”的步骤&#xff0c;真的是特别简单&#xff0c;如果提前准备好了文字材料&#xff0c…

PHP转Go,框架选什么?

文章目录内功心法PHP转Go&#xff0c;优选哪个框架&#xff1f;为什么&#xff1f;为什么不火&#xff1f;GoFrame特点优势&#xff1a;劣势&#xff1a;框架选型谁适合用GoFrame谁不适合用GoFrameGoFrame框架设计思想开发流程从0到1核心步骤总结视频一起学习这是一期会引起广泛…

即时通讯赛道开打信创牌,WorkPlus为何独树一帜?

近期&#xff0c;信创火了。 随着近期国家相关政策文件的推出&#xff0c;未来三年&#xff0c;党政信创、行业信创以及央国企信创的建设&#xff0c;将迎来全面加速。业内人士认为&#xff1a;“大信创”时代或已来临&#xff01; 信创是什么&#xff1f; 信创&#xff0c;…

加载用户数据至用户维度表

目录 1.创建转换 2.配置表输入 3.配置表输入2 4.创建新转换 5.配置映射输入规范 6.配置数据库查询 7.配置数据库查询2 8.配置数据库查询3 9.配置过滤记录 10配置JavaScript代码 11.配置字段选择 12.配置映射输出规范 13.配置映射&#xff08;子转换&#xff09; 1…

JS进阶第一篇:手写call apply bind

文章目录手写call apply bind深入理解 call 方法手写call手写apply手写bind手写call apply bind 深入理解 call 方法 call 理解了&#xff0c;apply和bind就都迎刃而解了&#xff0c;他们都是大同小异。在此对call和apply不做过多的定义性解释&#xff0c;先来看下调用了call…

opencv阈值图像Threshold方法

图像阈值 固定阈值&#xff0c;自适应阈值&#xff0c;Otsu 二值化等 全局阈值和局部阈值 一、图像二值化 定义&#xff1a;图像的二值化&#xff0c;就是将图像上的像素点的灰度值设置为0或255&#xff0c;也就是将整个图像呈现出明显的只有黑和白的视觉效果。 灰度值0&…

热门Java开发工具IDEA入门指南——导出项目到Eclipse

IntelliJ IDEA&#xff0c;是java编程语言开发的集成环境。IntelliJ在业界被公认为最好的java开发工具&#xff0c;尤其在智能代码助手、代码自动提示、重构、JavaEE支持、各类版本工具(git、svn等)、JUnit、CVS整合、代码分析、 创新的GUI设计等方面的功能是非常强大的。 上文…

打工人,这里有一份述职技巧,请查收

大家好&#xff0c;马上到年底了&#xff0c;有多少小伙伴正在期待着述职邮件&#xff0c;毕竟收到述职邮件&#xff0c;也就意味着有机会升职加薪。有没有跟糖糖一样&#xff0c;没收到邮件的&#xff1f; 工作要善于总结&#xff0c;也要善于表达&#xff0c;如何在限时内将…

跨平台应用开发进阶(四十)自定义插件及引用

文章目录一、前言二、插件制作三、离线插件集成应用示例四、拓展阅读一、前言 正如将可复用功能封装为自定义组件以供他人使用一样&#xff0c;在uni-app开发框架中提供了另一种形式的自定义插件&#xff0c;并可将该插件提交至uni-app插件市场。 二、插件制作 制作插件前&a…

前端 单元测试介绍 - 以及在项目中使用 (史上最全)

前言 我们前端开发过程中&#xff0c;编写测试代码&#xff0c;有以下这些好处&#xff1a; 更快的发现bug&#xff0c;让绝大多数bug在开发阶段发现解决&#xff0c;提高产品质量 比起写注释&#xff0c;单元测试可能是更好的选择&#xff0c;通过运行测试代码&#xff0c;观…

ARM 异常处理方式简单介绍

一、什么是异常 正常工作之外的流程都叫异常&#xff1b; 也就是说&#xff0c;除了用户模式和系统模式外&#xff0c;其他情况都是异常&#xff0c;见下图&#xff1a; 异常会打断正在执行的工作&#xff0c;并且一般我们希望异常处理完成后继续回来执行原来的工作&#xff…

3-azido-1-Propanamine,88192-19-2,3-叠氮基丙胺 性质特点有哪些?

●中文名&#xff1a;3-叠氮基丙胺&#xff0c;3-叠氮基-丙胺 ●英文名&#xff1a;3-azido-1-Propanamine ●外观以及性质&#xff1a; 西安凯新生物科技有限公司供应的&#xff1a;​3-azido-1-Propanamine为淡黄色或无色油状&#xff0c;含有叠氮基团&#xff0c;叠氮基可以…

Node.js 入门教程 23 使用 npm 的语义版本控制 24 卸载 npm 软件包 25 npm 全局或本地的软件包

Node.js 入门教程 Node.js官方入门教程 Node.js中文网 本文仅用于学习记录&#xff0c;不存在任何商业用途&#xff0c;如侵删 文章目录Node.js 入门教程23 使用 npm 的语义版本控制24 卸载 npm 软件包25 npm 全局或本地的软件包23 使用 npm 的语义版本控制 如果 Node.js 软件…

第147篇 笔记-预言机(Oracle)

定义&#xff1a;区块链预言机是将区块链连接到外部系统的实体&#xff0c;从而使智能合约能够基于现实世界的输入和输出执行。 预言机为分散的 Web3 生态系统提供了一种访问现有数据源、遗留系统和高级计算的方式。去中心化预言机网络&#xff08;DON&#xff09;支持创建混合…

[附源码]计算机毕业设计springboot“小世界”私人空间

项目运行 环境配置&#xff1a; Jdk1.8 Tomcat7.0 Mysql HBuilderX&#xff08;Webstorm也行&#xff09; Eclispe&#xff08;IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持&#xff09;。 项目技术&#xff1a; SSM mybatis Maven Vue 等等组成&#xff0c;B/S模式 M…

Java学历、技术哪个更重要?学历不好还能进大厂吗?

Java程序员的入行门槛并不高&#xff0c;并不看重你的学历和其他各方面&#xff0c;唯一看重的就是你技术是否过硬&#xff0c;能否独立参与到企业级开发的项目中去&#xff0c;说简单点入行只看技术。但是你如果想要长远发展服日后走上管理岗位&#xff0c;最好还是自考个本科…

使用 SwiftUI 构建可搜索列表,为您的 iOS 应用程序创建具有自动完成功能的可搜索列表(教程含源码)

设计新应用程序时面临的一大挑战是确保您的用户可以轻松浏览内容。如果体验太难或花费太多时间,无论您的内容有多好,很多用户都会转向另一个应用程序选项或放弃。 期望用户滚动浏览一长串选项是不切实际的,添加搜索功能可以极大地改善用户体验。更进一步,在用户键入时让列…

2.RabbitMQ安装

2.RabbitMQ安装 注意&#xff1a;安装时使用的系统是CentOS-7,MQ基本概念和RabbitMQ的相关知识请查看写的文章。 1、安装依赖环境 在线安装依赖环境&#xff1a; yum install build-essential openssl openssl-devel unixODBC unixODBC-devel make gcc gcc-c kernel-devel…

17、Health Check 健康检查

强大的自愈能力是kubernetes容器编排引擎的重要特性。自愈的默认实现方式是自动重启发生故障的容器。除此之外&#xff0c;还可通过Liveness和Readiness探测机制设置更精细的健康检查&#xff0c;进而实现如下要求&#xff1a;零停机部署避免部署无效的镜像更加安全的滚动升级一…

有没有免费的视频剪辑软件?快来看看这些视频裁剪软件

我们有时候将视频拍好后&#xff0c;会觉得视频中有些画面的边缘出现了瑕疵&#xff0c;就想要将那些边缘裁剪掉&#xff0c;但是却不知道要怎么操作才能裁剪视频的画面。其实想要裁剪视频的画面很简单&#xff0c;我们只需要借助一些视频处理工具就可以实现裁剪视频画面的操作…