<?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="***.alatus.mapper.TTranMapper">
<resultMap id="BaseResultMap" type="***.alatus.model.TTran">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="tran_no" jdbcType="VARCHAR" property="tranNo" />
<result column="customer_id" jdbcType="INTEGER" property="customerId" />
<result column="money" jdbcType="DECIMAL" property="money" />
<result column="expected_date" jdbcType="TIMESTAMP" property="expectedDate" />
<result column="stage" jdbcType="INTEGER" property="stage" />
<result column="description" jdbcType="VARCHAR" property="description" />
<result column="next_contact_time" jdbcType="TIMESTAMP" property="nextContactTime" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="create_by" jdbcType="INTEGER" property="createBy" />
<result column="edit_time" jdbcType="TIMESTAMP" property="editTime" />
<result column="edit_by" jdbcType="INTEGER" property="editBy" />
</resultMap>
<sql id="Base_Column_List">
id, tran_no, customer_id, money, expected_date, stage, description, next_contact_time,
create_time, create_by, edit_time, edit_by
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_tran
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selectAllTranAmount" resultType="java.math.BigDecimal">
select
sum(money)
from t_tran
</select>
<select id="selectTranSu***essAmount" resultType="java.math.BigDecimal">
select
sum(money)
from t_tran
where stage = 42
</select>
<select id="selectTranAmount" resultType="java.lang.Integer">
select
count(0)
from (select distinct customer_id from t_tran) t
</select>
<select id="selectTranSu***essNum" resultType="java.lang.Integer">
select
count(0)
from (select distinct customer_id from t_tran where stage = 42) t
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from t_tran
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="***.alatus.model.TTran" useGeneratedKeys="true">
insert into t_tran (tran_no, customer_id, money,
expected_date, stage, description,
next_contact_time, create_time, create_by,
edit_time, edit_by)
values (#{tranNo,jdbcType=VARCHAR}, #{customerId,jdbcType=INTEGER}, #{money,jdbcType=DECIMAL},
#{expectedDate,jdbcType=TIMESTAMP}, #{stage,jdbcType=INTEGER}, #{description,jdbcType=VARCHAR},
#{nextContactTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}, #{createBy,jdbcType=INTEGER},
#{editTime,jdbcType=TIMESTAMP}, #{editBy,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="***.alatus.model.TTran" useGeneratedKeys="true">
insert into t_tran
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="tranNo != null">
tran_no,
</if>
<if test="customerId != null">
customer_id,
</if>
<if test="money != null">
money,
</if>
<if test="expectedDate != null">
expected_date,
</if>
<if test="stage != null">
stage,
</if>
<if test="description != null">
description,
</if>
<if test="nextContactTime != null">
next_contact_time,
</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="tranNo != null">
#{tranNo,jdbcType=VARCHAR},
</if>
<if test="customerId != null">
#{customerId,jdbcType=INTEGER},
</if>
<if test="money != null">
#{money,jdbcType=DECIMAL},
</if>
<if test="expectedDate != null">
#{expectedDate,jdbcType=TIMESTAMP},
</if>
<if test="stage != null">
#{stage,jdbcType=INTEGER},
</if>
<if test="description != null">
#{description,jdbcType=VARCHAR},
</if>
<if test="nextContactTime != null">
#{nextContactTime,jdbcType=TIMESTAMP},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="createBy != null">
#{createBy,jdbcType=INTEGER},
</if>
<if test="editTime != null">
#{editTime,jdbcType=TIMESTAMP},
</if>
<if test="editBy != null">
#{editBy,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="***.alatus.model.TTran">
update t_tran
<set>
<if test="tranNo != null">
tran_no = #{tranNo,jdbcType=VARCHAR},
</if>
<if test="customerId != null">
customer_id = #{customerId,jdbcType=INTEGER},
</if>
<if test="money != null">
money = #{money,jdbcType=DECIMAL},
</if>
<if test="expectedDate != null">
expected_date = #{expectedDate,jdbcType=TIMESTAMP},
</if>
<if test="stage != null">
stage = #{stage,jdbcType=INTEGER},
</if>
<if test="description != null">
description = #{description,jdbcType=VARCHAR},
</if>
<if test="nextContactTime != null">
next_contact_time = #{nextContactTime,jdbcType=TIMESTAMP},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="createBy != null">
create_by = #{createBy,jdbcType=INTEGER},
</if>
<if test="editTime != null">
edit_time = #{editTime,jdbcType=TIMESTAMP},
</if>
<if test="editBy != null">
edit_by = #{editBy,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="***.alatus.model.TTran">
update t_tran
set tran_no = #{tranNo,jdbcType=VARCHAR},
customer_id = #{customerId,jdbcType=INTEGER},
money = #{money,jdbcType=DECIMAL},
expected_date = #{expectedDate,jdbcType=TIMESTAMP},
stage = #{stage,jdbcType=INTEGER},
description = #{description,jdbcType=VARCHAR},
next_contact_time = #{nextContactTime,jdbcType=TIMESTAMP},
create_time = #{createTime,jdbcType=TIMESTAMP},
create_by = #{createBy,jdbcType=INTEGER},
edit_time = #{editTime,jdbcType=TIMESTAMP},
edit_by = #{editBy,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
<?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="***.alatus.mapper.TTranMapper">
<resultMap id="BaseResultMap" type="***.alatus.model.TTran">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="tran_no" jdbcType="VARCHAR" property="tranNo" />
<result column="customer_id" jdbcType="INTEGER" property="customerId" />
<result column="money" jdbcType="DECIMAL" property="money" />
<result column="expected_date" jdbcType="TIMESTAMP" property="expectedDate" />
<result column="stage" jdbcType="INTEGER" property="stage" />
<result column="description" jdbcType="VARCHAR" property="description" />
<result column="next_contact_time" jdbcType="TIMESTAMP" property="nextContactTime" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="create_by" jdbcType="INTEGER" property="createBy" />
<result column="edit_time" jdbcType="TIMESTAMP" property="editTime" />
<result column="edit_by" jdbcType="INTEGER" property="editBy" />
</resultMap>
<sql id="Base_Column_List">
id, tran_no, customer_id, money, expected_date, stage, description, next_contact_time,
create_time, create_by, edit_time, edit_by
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_tran
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selectAllTranAmount" resultType="java.math.BigDecimal">
select
sum(money)
from t_tran
</select>
<select id="selectTranSu***essAmount" resultType="java.math.BigDecimal">
select
sum(money)
from t_tran
where stage = 42
</select>
<select id="selectTranAmount" resultType="java.lang.Integer">
select
count(0)
from (select distinct customer_id from t_tran) t
</select>
<select id="selectTranSu***essNum" resultType="java.lang.Integer">
select
count(0)
from (select distinct customer_id from t_tran where stage = 42) t
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from t_tran
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="***.alatus.model.TTran" useGeneratedKeys="true">
insert into t_tran (tran_no, customer_id, money,
expected_date, stage, description,
next_contact_time, create_time, create_by,
edit_time, edit_by)
values (#{tranNo,jdbcType=VARCHAR}, #{customerId,jdbcType=INTEGER}, #{money,jdbcType=DECIMAL},
#{expectedDate,jdbcType=TIMESTAMP}, #{stage,jdbcType=INTEGER}, #{description,jdbcType=VARCHAR},
#{nextContactTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}, #{createBy,jdbcType=INTEGER},
#{editTime,jdbcType=TIMESTAMP}, #{editBy,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="***.alatus.model.TTran" useGeneratedKeys="true">
insert into t_tran
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="tranNo != null">
tran_no,
</if>
<if test="customerId != null">
customer_id,
</if>
<if test="money != null">
money,
</if>
<if test="expectedDate != null">
expected_date,
</if>
<if test="stage != null">
stage,
</if>
<if test="description != null">
description,
</if>
<if test="nextContactTime != null">
next_contact_time,
</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="tranNo != null">
#{tranNo,jdbcType=VARCHAR},
</if>
<if test="customerId != null">
#{customerId,jdbcType=INTEGER},
</if>
<if test="money != null">
#{money,jdbcType=DECIMAL},
</if>
<if test="expectedDate != null">
#{expectedDate,jdbcType=TIMESTAMP},
</if>
<if test="stage != null">
#{stage,jdbcType=INTEGER},
</if>
<if test="description != null">
#{description,jdbcType=VARCHAR},
</if>
<if test="nextContactTime != null">
#{nextContactTime,jdbcType=TIMESTAMP},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="createBy != null">
#{createBy,jdbcType=INTEGER},
</if>
<if test="editTime != null">
#{editTime,jdbcType=TIMESTAMP},
</if>
<if test="editBy != null">
#{editBy,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="***.alatus.model.TTran">
update t_tran
<set>
<if test="tranNo != null">
tran_no = #{tranNo,jdbcType=VARCHAR},
</if>
<if test="customerId != null">
customer_id = #{customerId,jdbcType=INTEGER},
</if>
<if test="money != null">
money = #{money,jdbcType=DECIMAL},
</if>
<if test="expectedDate != null">
expected_date = #{expectedDate,jdbcType=TIMESTAMP},
</if>
<if test="stage != null">
stage = #{stage,jdbcType=INTEGER},
</if>
<if test="description != null">
description = #{description,jdbcType=VARCHAR},
</if>
<if test="nextContactTime != null">
next_contact_time = #{nextContactTime,jdbcType=TIMESTAMP},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="createBy != null">
create_by = #{createBy,jdbcType=INTEGER},
</if>
<if test="editTime != null">
edit_time = #{editTime,jdbcType=TIMESTAMP},
</if>
<if test="editBy != null">
edit_by = #{editBy,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="***.alatus.model.TTran">
update t_tran
set tran_no = #{tranNo,jdbcType=VARCHAR},
customer_id = #{customerId,jdbcType=INTEGER},
money = #{money,jdbcType=DECIMAL},
expected_date = #{expectedDate,jdbcType=TIMESTAMP},
stage = #{stage,jdbcType=INTEGER},
description = #{description,jdbcType=VARCHAR},
next_contact_time = #{nextContactTime,jdbcType=TIMESTAMP},
create_time = #{createTime,jdbcType=TIMESTAMP},
create_by = #{createBy,jdbcType=INTEGER},
edit_time = #{editTime,jdbcType=TIMESTAMP},
edit_by = #{editBy,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>