AiAgentAccountInfoMapper.xml
7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<?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="cn.com.glsx.dj.mindworkplate.mapper.AiAgentAccountInfoMapper" >
<resultMap id="BaseResultMap" type="cn.com.glsx.dj.mindworkplate.model.AiAgentAccountInfo" >
<!--
WARNING - @mbg.generated
-->
<id column="id" property="id" jdbcType="INTEGER" />
<result column="account_name" property="accountName" jdbcType="VARCHAR" />
<result column="account_phone" property="accountPhone" jdbcType="VARCHAR" />
<result column="owner_ship_type" property="ownerShipType" jdbcType="INTEGER" />
<result column="owner_post" property="ownerPost" jdbcType="VARCHAR" />
<result column="owner_post_code" property="ownerPostCode" jdbcType="INTEGER" />
<result column="owner_center" property="ownerCenter" jdbcType="VARCHAR" />
<result column="owner_center_code" property="ownerCenterCode" jdbcType="INTEGER" />
<result column="owner_dept" property="ownerDept" jdbcType="VARCHAR" />
<result column="owner_dept_code" property="ownerDeptCode" jdbcType="INTEGER" />
<result column="use_status" property="useStatus" jdbcType="INTEGER" />
<result column="created_by" property="createdBy" jdbcType="VARCHAR" />
<result column="user_id" property="userId" jdbcType="VARCHAR" />
<result column="created_date" property="createdDate" jdbcType="TIMESTAMP" />
<result column="updated_by" property="updatedBy" jdbcType="VARCHAR" />
<result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP" />
<result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" />
</resultMap>
<resultMap id="DTOResult" type="cn.com.glsx.dj.mindworkplate.dto.aiagent.AiAgentAccountInfoDTO" extends="BaseResultMap">
</resultMap>
<resultMap id="AgentInfoMap" type="cn.com.glsx.dj.mindworkplate.dto.aiagent.AiAgentInfoDTO" >
<result column="id" property="id" />
<result column="agent_code" property="agentCode" jdbcType="VARCHAR" />
<result column="agent_name" property="agentName" jdbcType="VARCHAR" />
<result column="entry_name" property="entryName" jdbcType="VARCHAR" />
<result column="entry_logo_url" property="entryLogoUrl" jdbcType="VARCHAR" />
<result column="presupposition_problem" property="presuppositionProblem" jdbcType="VARCHAR" />
<result column="agent_url" property="agentUrl" jdbcType="VARCHAR" />
<result column="pre_entry_name" property="preEntryName" jdbcType="VARCHAR" />
<result column="account_phone" property="accountPhone" />
<result column="owner_post" property="ownerPost" jdbcType="VARCHAR" />
<result column="domain_name" property="domainName" />
<collection property="questionConfigList" ofType="cn.com.glsx.dj.mindworkplate.model.AiAgentSuggestedQuestionConfig">
<result column="question" property="question" jdbcType="VARCHAR" />
</collection>
</resultMap>
<sql id="Base_Column_List" >
<!--
WARNING - @mbg.generated
-->
id, account_name, account_phone, owner_ship_type, owner_post, owner_center, owner_dept,
use_status, created_by, created_date, updated_by, updated_date, deleted_flag,owner_post_code,owner_center_code,owner_dept_code,user_id
</sql>
<select id="listStaffBaseInfo" resultType="cn.com.glsx.dj.mindworkplate.model.AiAgentAccountInfo">
select staff_name as accountName, staff_phone as accountPhone,created_by as createdBy, created_date as createdDate, updated_by as updatedBy
from dj_car_life_staff_base_info where deleted_flag = 'N' and staff_phone is not null and length(staff_phone) > 0
</select>
<update id="batchUpdate">
<foreach collection="list" item="item" close="" open="" separator=";">
update ai_agent_account_info
set account_name = #{item.accountName}, updated_by = #{item.updatedBy}, updated_date = #{item.updatedDate}
where account_phone = #{item.accountPhone} and deleted_flag = 'N' and owner_ship_type = 1
</foreach>
</update>
<select id="listAiAgentEntryList" parameterType="cn.com.glsx.dj.mindworkplate.model.AiAgentAccountInfo" resultMap="AgentInfoMap">
select account.account_phone, ai.domain_name, account.owner_post,ai.id, ai.agent_code, ai.agent_name, ai.entry_name, ai.presupposition_problem, ai.agent_url, ai.pre_entry_name,ai.entry_logo_url, aqc.question
from ai_agent_account_info account
inner join ai_agent_ownership_entry_relation relation on account.owner_ship_type = relation.owner_ship_type and relation.deleted_flag = 'N'
inner join ai_agent_info ai on ai.id = relation.agent_id and ai.deleted_flag = 'N'
left join ai_agent_suggested_question_config aqc on aqc.agent_code = ai.agent_code and aqc.deleted_flag = 'N'
<where>
account.deleted_flag = 'N' and account.use_status = 1 and ai.agent_code != 'AI7'
and account.owner_ship_type = #{ownerShipType}
<if test="accountPhone != null and accountPhone != ''">
and account.account_phone = #{accountPhone}
</if>
<if test="userId != null and userId != ''">
and account.user_id = #{userId}
</if>
</where>
order by ai.id asc
</select>
<select id="findByCondition" resultMap="DTOResult" parameterType="cn.com.glsx.dj.mindworkplate.dto.aiagent.AiAgentAccountInfoDTO">
select *
from ai_agent_account_info
<where>
deleted_flag = 'N'
<if test="accountName != null and accountName != ''">
and account_name like concat('%', #{accountName}, '%')
</if>
<if test="accountPhone != null and accountPhone != ''">
and account_phone like concat('%', #{accountPhone}, '%')
</if>
<if test="ownerPost != null and ownerPost != ''">
and owner_post like concat('%', #{ownerPost}, '%')
</if>
<if test="ownerCenter != null and ownerCenter != ''">
and owner_center like concat('%', #{ownerCenter}, '%')
</if>
<if test="ownerShipType != null">
and owner_ship_type = #{ownerShipType}
</if>
<if test="useStatus != null">
and use_status = #{useStatus}
</if>
</where>
order by created_date desc
</select>
<select id="getSpecialAiAgentList" parameterType= "cn.com.glsx.dj.mindworkplate.dto.aiagent.AiAgentInfoDTO" resultMap="AgentInfoMap">
select account.account_phone, ai.domain_name, account.owner_post,ai.id, ai.agent_code, ai.agent_name, ai.presupposition_problem, ai.agent_url
from ai_agent_account_info account
inner join ai_agent_ownership_entry_relation relation on account.owner_ship_type = relation.owner_ship_type and relation.deleted_flag = 'N'
inner join ai_agent_info ai on ai.id = relation.agent_id and ai.deleted_flag = 'N'
<where>
account.deleted_flag = 'N' and account.use_status = 1
and account.owner_ship_type = #{ownerShipType}
<if test="accountPhone != null and accountPhone != ''">
and account.account_phone = #{accountPhone}
</if>
<if test="agentCode != null and agentCode != ''">
and ai.agent_code = #{agentCode}
</if>
</where>
group by ai.agent_code
</select>
</mapper>