AiAgentAccountInfoMapper.xml 7 KB
<?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>