<?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.dg.core.db.gen.mapper.GuideEvolveMapper">
|
|
<resultMap type="com.dg.core.db.gen.entity.GuideEvolveEntity" id="GuideEvolveResult">
|
<id property="id" column="id" />
|
<id property="departmentalId" column="departmental_id" />
|
<id property="toUserId" column="to_user_id" />
|
<id property="fromUserId" column="from_user_id" />
|
<id property="state" column="state" />
|
<id property="remark" column="remark" />
|
<id property="guideId" column="guide_id" />
|
<id property="transactionId" column="transaction_id" />
|
<id property="accessoryId" column="accessory_id" />
|
<id property="accessoryName" column="accessory_name" />
|
<id property="accessoryUrl" column="accessory_url" />
|
<id property="createTime" column="create_time" />
|
<id property="updateTime" column="update_time" />
|
<id property="fromDepartmentalId" column="from_departmental_id" />
|
<id property="videoUrl" column="video_url" />
|
<id property="pictureUrl" column="picture_url" />
|
<id property="guideOrderNum" column="guide_order_num" />
|
<id property="isTimeout" column="is_timeout" />
|
|
</resultMap>
|
|
<sql id="selectGuideEvolveVo">
|
SELECT
|
id,
|
departmental_id,
|
(select user_name from automessage_sys_user where a.to_user_id=user_id)toUserName,
|
(select user_name from automessage_sys_user where a.from_user_id=user_id)fromUserName,
|
to_user_id,
|
from_user_id,
|
state,
|
remark,
|
guide_id,
|
transaction_id,
|
accessory_id,
|
accessory_name,
|
accessory_url,
|
from_departmental_id,
|
video_url,
|
picture_url,
|
create_time,
|
update_time,
|
guide_order_num,
|
is_timeout
|
FROM
|
automessage_guide_evolve a
|
</sql>
|
|
<select id="selectConfigList" resultMap="GuideEvolveResult">
|
<include refid="selectGuideEvolveVo"/>
|
<where>
|
<if test="guideId != null and guideId != ''">
|
AND guide_id=#{guideId}
|
</if>
|
</where>
|
order by create_time desc
|
</select>
|
|
<select id="selectHideList" resultMap="GuideEvolveResult">
|
SELECT
|
id,
|
departmental_id,
|
IFNULL(
|
(select concat(substring(user_name,1,1),'老师') from automessage_sys_user where a.to_user_id=user_id and (user_type in (1,2) or is_division_head=1)),
|
(select user_name from automessage_sys_user where a.to_user_id=user_id))toUserName,
|
IFNULL(
|
(select concat(substring(user_name,1,1),'老师') from automessage_sys_user where a.from_user_id=user_id and (user_type in (1,2) or is_division_head=1)),
|
(select user_name from automessage_sys_user where a.from_user_id=user_id))fromUserName,
|
to_user_id,
|
from_user_id,
|
state,
|
remark,
|
guide_id,
|
transaction_id,
|
accessory_id,
|
accessory_name,
|
accessory_url,
|
from_departmental_id,
|
video_url,
|
picture_url,
|
create_time,
|
update_time,
|
guide_order_num,
|
is_timeout
|
FROM
|
automessage_guide_evolve a
|
<where>
|
<if test="guideId != null and guideId != ''">
|
AND guide_id=#{guideId}
|
</if>
|
</where>
|
order by create_time desc
|
</select>
|
|
|
<insert id="insertConfig" parameterType="com.dg.core.db.gen.entity.GuideEvolveEntity">
|
insert into automessage_guide_evolve (
|
<if test="departmentalId != null and departmentalId != '' ">departmental_id,</if>
|
<if test="toUserId != null and toUserId != '' ">to_user_id,</if>
|
<if test="fromUserId != null and fromUserId != '' ">from_user_id,</if>
|
<if test="state != null and state != '' ">state,</if>
|
<if test="remark != null and remark != '' ">remark,</if>
|
<if test="guideId != null and guideId != '' ">guide_id,</if>
|
<if test="transactionId != null and transactionId != '' ">transaction_id,</if>
|
<if test="accessoryId != null and accessoryId != '' ">accessory_id,</if>
|
<if test="accessoryName != null and accessoryName != '' ">accessory_name,</if>
|
<if test="accessoryUrl != null and accessoryUrl != '' ">accessory_url,</if>
|
<if test="fromDepartmentalId != null and fromDepartmentalId != '' ">from_departmental_id,</if>
|
<if test="videoUrl != null and videoUrl != '' ">video_url,</if>
|
<if test="pictureUrl != null and pictureUrl != '' ">picture_url,</if>
|
<if test="guidOrderNum != null and guidOrderNum != '' ">guide_order_num,</if>
|
<if test="isTimeout != null and isTimeout != '' ">is_timeout,</if>
|
update_time,
|
create_time
|
)values(
|
<if test="departmentalId != null and departmentalId != '' ">#{departmentalId},</if>
|
<if test="toUserId != null and toUserId != '' ">#{toUserId},</if>
|
<if test="fromUserId != null and fromUserId != '' ">#{fromUserId},</if>
|
<if test="state != null and state != '' ">#{state},</if>
|
<if test="remark != null and remark != '' ">#{remark},</if>
|
<if test="guideId != null and guideId != '' ">#{guideId},</if>
|
<if test="transactionId != null and transactionId != '' ">#{transactionId},</if>
|
<if test="accessoryId != null and accessoryId != '' ">#{accessoryId},</if>
|
<if test="accessoryName != null and accessoryName != '' ">#{accessoryName},</if>
|
<if test="accessoryUrl != null and accessoryUrl != '' ">#{accessoryUrl},</if>
|
<if test="fromDepartmentalId != null and fromDepartmentalId != '' ">#{fromDepartmentalId},</if>
|
<if test="videoUrl != null and videoUrl != '' ">#{videoUrl},</if>
|
<if test="pictureUrl != null and pictureUrl != '' ">#{pictureUrl},</if>
|
<if test="guidOrderNum != null and guidOrderNum != '' ">#{guidOrderNum},</if>
|
<if test="isTimeout != null and isTimeout != '' ">#{isTimeout},</if>
|
sysdate(),
|
sysdate()
|
)
|
</insert>
|
|
<update id="updateConfig" parameterType="com.dg.core.db.gen.entity.GuideEvolveEntity">
|
update automessage_guide_evolve
|
<set>
|
<if test="departmentalId != null and departmentalId != '' ">departmental_id=#{departmentalId},</if>
|
<if test="toUserId != null and toUserId != '' ">to_user_id=#{toUserId},</if>
|
<if test="fromUserId != null and fromUserId != '' ">from_user_id=#{fromUserId},</if>
|
<if test="state != null and state != '' ">state=#{state},</if>
|
<if test="remark != null and remark != '' ">remark=#{remark},</if>
|
<if test="guideId != null and guideId != '' ">guide_id=#{guideId},</if>
|
<if test="transactionId != null and transactionId != '' ">transaction_id=#{transactionId},</if>
|
<if test="accessoryId != null and accessoryId != '' ">accessory_id=#{accessoryId},</if>
|
<if test="accessoryName != null and accessoryName != '' ">accessory_name=#{accessoryName},</if>
|
<if test="accessoryUrl != null and accessoryUrl != '' ">accessory_url=#{accessoryUrl},</if>
|
<if test="fromDepartmentalId != null and fromDepartmentalId != '' ">from_departmental_id=#{fromDepartmentalId},</if>
|
<if test="videoUrl != null and videoUrl != '' ">video_url=#{videoUrl},</if>
|
<if test="pictureUrl != null and pictureUrl != '' ">picture_url=#{pictureUrl},</if>
|
<if test="isTimeout != null and isTimeout != '' ">is_timeout=#{isTimeout},</if>
|
update_time=sysdate()
|
</set>
|
where id= #{Id}
|
</update>
|
|
<update id="updateGuid" parameterType="com.dg.core.db.gen.entity.GuideEvolveEntity">
|
UPDATE automessage_guide_evolve
|
SET guide_id = (SELECT id from automessage_guide_repair_order where order_num=automessage_guide_evolve.guide_order_num )
|
WHERE guide_id IS NULL
|
</update>
|
|
<delete id="deleteConfigById" parameterType="string">
|
delete from automessage_guide_evolve where id= #{Id}
|
</delete>
|
|
<select id="countNum" resultType="integer">
|
select count(id) from automessage_guide_evolve
|
</select>
|
|
</mapper>
|