<?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.alatus.mapper.TClueRemarkMapper">
<resultMap id="BaseResultMap" type="com.alatus.model.TClueRemark">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="clue_id" jdbcType="INTEGER" property="clueId" />
<result column="note_way" jdbcType="INTEGER" property="noteWay" />
<result column="note_content" jdbcType="VARCHAR" property="noteContent" />
<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" />
<result column="deleted" jdbcType="INTEGER" property="deleted" />
</resultMap>
<resultMap id="ClueRemarkResultMap" type="com.alatus.model.TClueRemark">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="clue_id" jdbcType="INTEGER" property="clueId" />
<result column="note_way" jdbcType="INTEGER" property="noteWay" />
<result column="note_content" jdbcType="VARCHAR" property="noteContent" />
<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" />
<result column="deleted" jdbcType="INTEGER" property="deleted" />
<!--一对一关联查询-->
<association property="createByDO" javaType="com.alatus.model.TUser">
<id column="createById" jdbcType="INTEGER" property="id" />
<result column="createByName" jdbcType="INTEGER" property="name" />
</association>
<!--一对一关联查询-->
<association property="editByDO" javaType="com.alatus.model.TUser">
<id column="editById" jdbcType="INTEGER" property="id" />
<result column="editByName" jdbcType="INTEGER" property="name" />
</association>
<!--一对一关联查询-->
<association property="noteWayDO" javaType="com.alatus.model.TDicValue">
<id column="noteWayId" jdbcType="INTEGER" property="id" />
<result column="noteWayName" jdbcType="INTEGER" property="typeValue" />
</association>
</resultMap>
<sql id="Base_Column_List">
id, clue_id, note_way, note_content, create_time, create_by, edit_time, edit_by,
deleted
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_clue_remark
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selectClueRemarkByPage" parameterType="java.lang.Integer" resultMap="ClueRemarkResultMap">
select
tcr.*,
tu1.id createById, tu1.name createByName,
tu2.id editById, tu2.name editByName,
tdv.id noteWayId, tdv.type_value noteWayName
from t_clue_remark tcr left join t_user tu1 on tcr.create_by = tu1.id
left join t_user tu2 on tcr.edit_by = tu2.id
left join t_dic_value tdv on tcr.note_way = tdv.id
<where>
tcr.clue_id = #{clueId, jdbcType=INTEGER} and (tcr.deleted is null or tcr.deleted = 0)
${filterSQL}
</where>
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from t_clue_remark
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.alatus.model.TClueRemark" useGeneratedKeys="true">
insert into t_clue_remark (clue_id, note_way, note_content,
create_time, create_by, edit_time,
edit_by, deleted)
values (#{clueId,jdbcType=INTEGER}, #{noteWay,jdbcType=INTEGER}, #{noteContent,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{createBy,jdbcType=INTEGER}, #{editTime,jdbcType=TIMESTAMP},
#{editBy,jdbcType=INTEGER}, #{deleted,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.alatus.model.TClueRemark" useGeneratedKeys="true">
insert into t_clue_remark
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="clueId != null">
clue_id,
</if>
<if test="noteWay != null">
note_way,
</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="deleted != null">
deleted,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="clueId != null">
#{clueId,jdbcType=INTEGER},
</if>
<if test="noteWay != null">
#{noteWay,jdbcType=INTEGER},
</if>
<if test="noteContent != null">
#{noteContent,jdbcType=VARCHAR},
</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>
<if test="deleted != null">
#{deleted,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.alatus.model.TClueRemark">
update t_clue_remark
<set>
<if test="clueId != null">
clue_id = #{clueId,jdbcType=INTEGER},
</if>
<if test="noteWay != null">
note_way = #{noteWay,jdbcType=INTEGER},
</if>
<if test="noteContent != null">
note_content = #{noteContent,jdbcType=VARCHAR},
</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>
<if test="deleted != null">
deleted = #{deleted,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.alatus.model.TClueRemark">
update t_clue_remark
set clue_id = #{clueId,jdbcType=INTEGER},
note_way = #{noteWay,jdbcType=INTEGER},
note_content = #{noteContent,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
create_by = #{createBy,jdbcType=INTEGER},
edit_time = #{editTime,jdbcType=TIMESTAMP},
edit_by = #{editBy,jdbcType=INTEGER},
deleted = #{deleted,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="com.alatus.mapper.TClueRemarkMapper">
<resultMap id="BaseResultMap" type="com.alatus.model.TClueRemark">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="clue_id" jdbcType="INTEGER" property="clueId" />
<result column="note_way" jdbcType="INTEGER" property="noteWay" />
<result column="note_content" jdbcType="VARCHAR" property="noteContent" />
<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" />
<result column="deleted" jdbcType="INTEGER" property="deleted" />
</resultMap>
<resultMap id="ClueRemarkResultMap" type="com.alatus.model.TClueRemark">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="clue_id" jdbcType="INTEGER" property="clueId" />
<result column="note_way" jdbcType="INTEGER" property="noteWay" />
<result column="note_content" jdbcType="VARCHAR" property="noteContent" />
<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" />
<result column="deleted" jdbcType="INTEGER" property="deleted" />
<!--一对一关联查询-->
<association property="createByDO" javaType="com.alatus.model.TUser">
<id column="createById" jdbcType="INTEGER" property="id" />
<result column="createByName" jdbcType="INTEGER" property="name" />
</association>
<!--一对一关联查询-->
<association property="editByDO" javaType="com.alatus.model.TUser">
<id column="editById" jdbcType="INTEGER" property="id" />
<result column="editByName" jdbcType="INTEGER" property="name" />
</association>
<!--一对一关联查询-->
<association property="noteWayDO" javaType="com.alatus.model.TDicValue">
<id column="noteWayId" jdbcType="INTEGER" property="id" />
<result column="noteWayName" jdbcType="INTEGER" property="typeValue" />
</association>
</resultMap>
<sql id="Base_Column_List">
id, clue_id, note_way, note_content, create_time, create_by, edit_time, edit_by,
deleted
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_clue_remark
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selectClueRemarkByPage" parameterType="java.lang.Integer" resultMap="ClueRemarkResultMap">
select
tcr.*,
tu1.id createById, tu1.name createByName,
tu2.id editById, tu2.name editByName,
tdv.id noteWayId, tdv.type_value noteWayName
from t_clue_remark tcr left join t_user tu1 on tcr.create_by = tu1.id
left join t_user tu2 on tcr.edit_by = tu2.id
left join t_dic_value tdv on tcr.note_way = tdv.id
<where>
tcr.clue_id = #{clueId, jdbcType=INTEGER} and (tcr.deleted is null or tcr.deleted = 0)
${filterSQL}
</where>
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from t_clue_remark
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.alatus.model.TClueRemark" useGeneratedKeys="true">
insert into t_clue_remark (clue_id, note_way, note_content,
create_time, create_by, edit_time,
edit_by, deleted)
values (#{clueId,jdbcType=INTEGER}, #{noteWay,jdbcType=INTEGER}, #{noteContent,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{createBy,jdbcType=INTEGER}, #{editTime,jdbcType=TIMESTAMP},
#{editBy,jdbcType=INTEGER}, #{deleted,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.alatus.model.TClueRemark" useGeneratedKeys="true">
insert into t_clue_remark
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="clueId != null">
clue_id,
</if>
<if test="noteWay != null">
note_way,
</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="deleted != null">
deleted,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="clueId != null">
#{clueId,jdbcType=INTEGER},
</if>
<if test="noteWay != null">
#{noteWay,jdbcType=INTEGER},
</if>
<if test="noteContent != null">
#{noteContent,jdbcType=VARCHAR},
</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>
<if test="deleted != null">
#{deleted,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.alatus.model.TClueRemark">
update t_clue_remark
<set>
<if test="clueId != null">
clue_id = #{clueId,jdbcType=INTEGER},
</if>
<if test="noteWay != null">
note_way = #{noteWay,jdbcType=INTEGER},
</if>
<if test="noteContent != null">
note_content = #{noteContent,jdbcType=VARCHAR},
</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>
<if test="deleted != null">
deleted = #{deleted,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.alatus.model.TClueRemark">
update t_clue_remark
set clue_id = #{clueId,jdbcType=INTEGER},
note_way = #{noteWay,jdbcType=INTEGER},
note_content = #{noteContent,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
create_by = #{createBy,jdbcType=INTEGER},
edit_time = #{editTime,jdbcType=TIMESTAMP},
edit_by = #{editBy,jdbcType=INTEGER},
deleted = #{deleted,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>