思路分析
1.首先是操作t_cus_dev_plan表的添加修改功能
准备sql;
2.service层分析判断是添加还是修改
3.控制层掉用service层方法,返回结果
功能实现
1.准备添加和修改的sql
CusDevPlanMapper.java
<?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.shsxt.crm.sales.dao.CusDevPlanMapper">
<resultMap id="BaseResultMap" type="com.shsxt.crm.sales.pojo.CusDevPlan">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="sale_chance_id" jdbcType="INTEGER" property="saleChanceId" />
<result column="plan_item" jdbcType="VARCHAR" property="planItem" />
<result column="plan_date" jdbcType="TIMESTAMP" property="planDate" />
<result column="exe_affect" jdbcType="VARCHAR" property="exeAffect" />
<result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
<result column="is_valid" jdbcType="INTEGER" property="isValid" />
</resultMap>
<sql id="Base_Column_List">
id, sale_chance_id, plan_item, plan_date, exe_affect, create_date, update_date, is_valid
</sql>
<select id="selectById" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_cus_dev_plan
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="delete" parameterType="java.lang.Integer">
delete from t_cus_dev_plan
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="save" parameterType="com.shsxt.crm.sales.pojo.CusDevPlan">
<selectKey keyProperty="