<?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.hzya.frame.sysnew.application.dao.impl.SysApplicationDaoImpl">

    <resultMap id="get-SysApplicationEntity-result" type="com.hzya.frame.sysnew.application.entity.SysApplicationEntity" >
       <result property="id" column="id" jdbcType="VARCHAR"/>
           <result property="appLogo" column="app_logo" jdbcType="VARCHAR"/>
           <result property="appStatus" column="app_status" jdbcType="VARCHAR"/>
           <result property="name" column="name" jdbcType="VARCHAR"/>
           <result property="versionNumber" column="version_number" jdbcType="VARCHAR"/>
           <result property="appId" column="app_id" jdbcType="INTEGER"/>
           <result property="systemAddress" column="system_address" jdbcType="VARCHAR"/>
           <result property="accessMode" column="access_mode" jdbcType="VARCHAR"/>
           <result property="affiliationField" column="affiliation_field" jdbcType="VARCHAR"/>
           <result property="manufacturer" column="manufacturer" jdbcType="VARCHAR"/>
           <result property="appIntroduction" column="app_introduction" jdbcType="VARCHAR"/>
           <result property="clientPath" column="client_path" jdbcType="VARCHAR"/>
           <result property="webPath" column="web_path" jdbcType="VARCHAR"/>
           <result property="programPath" column="program_path" jdbcType="VARCHAR"/>
           <result property="publicKey" column="public_key" jdbcType="VARCHAR"/>
           <result property="secretKey" column="secret_key" jdbcType="VARCHAR"/>
           <result property="interfaceAddress" column="interface_address" jdbcType="VARCHAR"/>
           <result property="interfaceStatus" column="interface_status" jdbcType="VARCHAR"/>
           <result property="dbStatus" column="db_status" jdbcType="VARCHAR"/>
           <result property="sorts" column="sorts" jdbcType="INTEGER"/>
           <result property="org_id" column="org_id" jdbcType="VARCHAR"/>
           <result property="sts" column="sts" jdbcType="VARCHAR"/>
           <result property="create_time" column="create_time" jdbcType="TIMESTAMP"/>
           <result property="create_user_id" column="create_user_id" jdbcType="VARCHAR"/>
           <result property="modify_time" column="modify_time" jdbcType="TIMESTAMP"/>
           <result property="modify_user_id" column="modify_user_id" jdbcType="VARCHAR"/>
        </resultMap>
    <!-- 查询的字段-->
    <sql id = "SysApplicationEntity_Base_Column_List">
        id
       ,app_logo 
        ,app_status 
        ,name 
        ,version_number 
        ,app_id
        ,system_address
        ,access_mode
        ,affiliation_field 
        ,manufacturer 
        ,app_introduction 
        ,client_path 
        ,web_path 
        ,program_path 
        ,public_key 
        ,secret_key 
        ,interface_address 
        ,interface_status 
        ,db_status 
        ,sorts 
        ,org_id 
        ,sts 
        ,create_time 
        ,create_user_id 
        ,modify_time 
        ,modify_user_id 
     </sql>
    <!--通过ID获取数据 -->
    <select id="entity_get" resultMap="get-SysApplicationEntity-result">
        select
        <include refid="SysApplicationEntity_Base_Column_List" />
        from sys_application where sts = 'Y' and  id = #{id}
    </select>
 <!-- 查询 采用==查询 -->
 <select id="entity_list_base" resultMap="get-SysApplicationEntity-result" parameterType = "com.hzya.frame.sysnew.application.entity.SysApplicationEntity">
    select
    <include refid="SysApplicationEntity_Base_Column_List" />
    from sys_application
    <trim prefix="where" prefixOverrides="and"> 
        <if test="id != null and id != ''"> and id = #{id} </if>
            <if test="appLogo != null and appLogo != ''"> and app_logo = #{appLogo} </if>
            <if test="appStatus != null and appStatus != ''"> and app_status = #{appStatus} </if>
            <if test="name != null and name != ''"> and name = #{name} </if>
            <if test="versionNumber != null and versionNumber != ''"> and version_number = #{versionNumber} </if>
            <if test="appId != null "> and app_id = #{appId} </if>
            <if test="systemAddress != null and systemAddress != ''"> and system_address = #{systemAddress} </if>
            <if test="accessMode != null and accessMode != ''"> and access_mode = #{accessMode} </if>
            <if test="affiliationField != null and affiliationField != ''"> and affiliation_field = #{affiliationField} </if>
            <if test="manufacturer != null and manufacturer != ''"> and manufacturer = #{manufacturer} </if>
            <if test="appIntroduction != null and appIntroduction != ''"> and app_introduction = #{appIntroduction} </if>
            <if test="clientPath != null and clientPath != ''"> and client_path = #{clientPath} </if>
            <if test="webPath != null and webPath != ''"> and web_path = #{webPath} </if>
            <if test="programPath != null and programPath != ''"> and program_path = #{programPath} </if>
            <if test="publicKey != null and publicKey != ''"> and public_key = #{publicKey} </if>
            <if test="secretKey != null and secretKey != ''"> and secret_key = #{secretKey} </if>
            <if test="interfaceAddress != null and interfaceAddress != ''"> and interface_address = #{interfaceAddress} </if>
            <if test="interfaceStatus != null and interfaceStatus != ''"> and interface_status = #{interfaceStatus} </if>
            <if test="dbStatus != null and dbStatus != ''"> and db_status = #{dbStatus} </if>
            <if test="sorts != null"> and sorts = #{sorts} </if>
            <if test="org_id != null and org_id != ''"> and org_id = #{org_id} </if>
            <if test="sts != null and sts != ''"> and sts = #{sts} </if>
            <if test="create_time != null"> and create_time = #{create_time} </if>
            <if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if>
            <if test="modify_time != null"> and modify_time = #{modify_time} </if>
            <if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id = #{modify_user_id} </if>
            and sts='Y'
    </trim>
    <if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
    <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>
    
<!-- 查询符合条件的数量 -->
<select id="entity_count" resultType="Integer" parameterType = "com.hzya.frame.sysnew.application.entity.SysApplicationEntity">
        select  count(1)   from sys_application
    <trim prefix="where" prefixOverrides="and"> 
        <if test="id != null and id != ''"> and id = #{id} </if>
            <if test="appLogo != null and appLogo != ''"> and app_logo = #{appLogo} </if>
            <if test="appStatus != null and appStatus != ''"> and app_status = #{appStatus} </if>
            <if test="name != null and name != ''"> and name = #{name} </if>
            <if test="versionNumber != null and versionNumber != ''"> and version_number = #{versionNumber} </if>
            <if test="appId != null "> and app_id = #{appId} </if>
            <if test="systemAddress != null and systemAddress != ''"> and system_address = #{systemAddress} </if>
            <if test="accessMode != null and accessMode != ''"> and access_mode = #{accessMode} </if>
            <if test="affiliationField != null and affiliationField != ''"> and affiliation_field = #{affiliationField} </if>
            <if test="manufacturer != null and manufacturer != ''"> and manufacturer = #{manufacturer} </if>
            <if test="appIntroduction != null and appIntroduction != ''"> and app_introduction = #{appIntroduction} </if>
            <if test="clientPath != null and clientPath != ''"> and client_path = #{clientPath} </if>
            <if test="webPath != null and webPath != ''"> and web_path = #{webPath} </if>
            <if test="programPath != null and programPath != ''"> and program_path = #{programPath} </if>
            <if test="publicKey != null and publicKey != ''"> and public_key = #{publicKey} </if>
            <if test="secretKey != null and secretKey != ''"> and secret_key = #{secretKey} </if>
            <if test="interfaceAddress != null and interfaceAddress != ''"> and interface_address = #{interfaceAddress} </if>
            <if test="interfaceStatus != null and interfaceStatus != ''"> and interface_status = #{interfaceStatus} </if>
            <if test="dbStatus != null and dbStatus != ''"> and db_status = #{dbStatus} </if>
            <if test="sorts != null"> and sorts = #{sorts} </if>
            <if test="org_id != null and org_id != ''"> and org_id = #{org_id} </if>
            <if test="sts != null and sts != ''"> and sts = #{sts} </if>
            <if test="create_time != null"> and create_time = #{create_time} </if>
            <if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if>
            <if test="modify_time != null"> and modify_time = #{modify_time} </if>
            <if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id = #{modify_user_id} </if>
            and sts='Y'
    </trim>
    <if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
    <if test=" sort !='' and sort!=null and order !='' and order!=null "> order by ${sort} ${order}</if>
    </select>

    <!-- 分页查询列表 采用like格式 -->
<select id="entity_list_like" resultMap="get-SysApplicationEntity-result" parameterType = "com.hzya.frame.sysnew.application.entity.SysApplicationEntity">
    select
    <include refid="SysApplicationEntity_Base_Column_List" />
    from sys_application
    <trim prefix="where" prefixOverrides="and"> 
        <if test="id != null and id != ''"> and id like concat('%',#{id},'%') </if>
            <if test="appLogo != null and appLogo != ''"> and app_logo like concat('%',#{appLogo},'%') </if>
            <if test="appStatus != null and appStatus != ''"> and app_status like concat('%',#{appStatus},'%') </if>
            <if test="name != null and name != ''"> and name like concat('%',#{name},'%') </if>
            <if test="versionNumber != null and versionNumber != ''"> and version_number like concat('%',#{versionNumber},'%') </if>
            <if test="appId != null "> and app_id like concat('%',#{appId},'%') </if>
            <if test="systemAddress != null and systemAddress != ''"> and system_address like concat('%',#{systemAddress},'%') </if>
            <if test="accessMode != null and accessMode != ''"> and access_mode like concat('%',#{accessMode},'%') </if>
            <if test="affiliationField != null and affiliationField != ''"> and affiliation_field like concat('%',#{affiliationField},'%') </if>
            <if test="manufacturer != null and manufacturer != ''"> and manufacturer like concat('%',#{manufacturer},'%') </if>
            <if test="appIntroduction != null and appIntroduction != ''"> and app_introduction like concat('%',#{appIntroduction},'%') </if>
            <if test="clientPath != null and clientPath != ''"> and client_path like concat('%',#{clientPath},'%') </if>
            <if test="webPath != null and webPath != ''"> and web_path like concat('%',#{webPath},'%') </if>
            <if test="programPath != null and programPath != ''"> and program_path like concat('%',#{programPath},'%') </if>
            <if test="publicKey != null and publicKey != ''"> and public_key like concat('%',#{publicKey},'%') </if>
            <if test="secretKey != null and secretKey != ''"> and secret_key like concat('%',#{secretKey},'%') </if>
            <if test="interfaceAddress != null and interfaceAddress != ''"> and interface_address like concat('%',#{interfaceAddress},'%') </if>
            <if test="interfaceStatus != null and interfaceStatus != ''"> and interface_status like concat('%',#{interfaceStatus},'%') </if>
            <if test="dbStatus != null and dbStatus != ''"> and db_status like concat('%',#{dbStatus},'%') </if>
            <if test="sorts != null"> and sorts like concat('%',#{sorts},'%') </if>
            <if test="org_id != null and org_id != ''"> and org_id like concat('%',#{org_id},'%') </if>
            <if test="sts != null and sts != ''"> and sts like concat('%',#{sts},'%') </if>
            <if test="create_time != null"> and create_time like concat('%',#{create_time},'%') </if>
            <if test="create_user_id != null and create_user_id != ''"> and create_user_id like concat('%',#{create_user_id},'%') </if>
            <if test="modify_time != null"> and modify_time like concat('%',#{modify_time},'%') </if>
            <if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id like concat('%',#{modify_user_id},'%') </if>
            and sts='Y'
    </trim>
    <if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
    <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>

<!-- 查询列表 字段采用or格式 -->
<select id="SysApplicationentity_list_or" resultMap="get-SysApplicationEntity-result" parameterType = "com.hzya.frame.sysnew.application.entity.SysApplicationEntity">
    select
    <include refid="SysApplicationEntity_Base_Column_List" />
    from sys_application
    <trim prefix="where" prefixOverrides="and"> 
         <if test="id != null and id != ''"> or id = #{id} </if>
             <if test="appLogo != null and appLogo != ''"> or app_logo = #{appLogo} </if>
             <if test="appStatus != null and appStatus != ''"> or app_status = #{appStatus} </if>
             <if test="name != null and name != ''"> or name = #{name} </if>
             <if test="versionNumber != null and versionNumber != ''"> or version_number = #{versionNumber} </if>
             <if test="appId != null "> or app_id = #{appId} </if>
             <if test="systemAddress != null and systemAddress != ''"> or system_address = #{systemAddress} </if>
             <if test="accessMode != null and accessMode != ''"> or access_mode = #{accessMode} </if>
             <if test="affiliationField != null and affiliationField != ''"> or affiliation_field = #{affiliationField} </if>
             <if test="manufacturer != null and manufacturer != ''"> or manufacturer = #{manufacturer} </if>
             <if test="appIntroduction != null and appIntroduction != ''"> or app_introduction = #{appIntroduction} </if>
             <if test="clientPath != null and clientPath != ''"> or client_path = #{clientPath} </if>
             <if test="webPath != null and webPath != ''"> or web_path = #{webPath} </if>
             <if test="programPath != null and programPath != ''"> or program_path = #{programPath} </if>
             <if test="publicKey != null and publicKey != ''"> or public_key = #{publicKey} </if>
             <if test="secretKey != null and secretKey != ''"> or secret_key = #{secretKey} </if>
             <if test="interfaceAddress != null and interfaceAddress != ''"> or interface_address = #{interfaceAddress} </if>
             <if test="interfaceStatus != null and interfaceStatus != ''"> or interface_status = #{interfaceStatus} </if>
             <if test="dbStatus != null and dbStatus != ''"> or db_status = #{dbStatus} </if>
             <if test="sorts != null"> or sorts = #{sorts} </if>
             <if test="org_id != null and org_id != ''"> or org_id = #{org_id} </if>
              <if test="sts != null and sts != ''"> or sts = #{sts} </if>
             <if test="create_time != null"> or create_time = #{create_time} </if>
              <if test="create_user_id != null and create_user_id != ''"> or create_user_id = #{create_user_id} </if>
              <if test="modify_time != null"> or modify_time = #{modify_time} </if>
              <if test="modify_user_id != null and modify_user_id != ''"> or modify_user_id = #{modify_user_id} </if>
             and sts='Y'
    </trim>
    <if test=" sort == null or sort == ''.toString()  "> order by sorts asc</if>
    <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>

<!--新增所有列-->
<insert id="entity_insert" parameterType = "com.hzya.frame.sysnew.application.entity.SysApplicationEntity" keyProperty="id" useGeneratedKeys="true">
    insert into sys_application(
  <trim suffix="" suffixOverrides=",">
       <if test="id != null and id != ''"> id , </if>
            <if test="appLogo != null and appLogo != ''"> app_logo , </if>
            <if test="appStatus != null and appStatus != ''"> app_status , </if>
            <if test="name != null and name != ''"> name , </if>
            <if test="versionNumber != null and versionNumber != ''"> version_number , </if>
            <if test="appId != null "> app_id , </if>
            <if test="appId == null "> app_id , </if>
            <if test="systemAddress != null and systemAddress != ''"> system_address , </if>
            <if test="accessMode != null and accessMode != ''"> access_mode , </if>
            <if test="affiliationField != null and affiliationField != ''"> affiliation_field , </if>
            <if test="manufacturer != null and manufacturer != ''"> manufacturer , </if>
            <if test="appIntroduction != null and appIntroduction != ''"> app_introduction , </if>
            <if test="clientPath != null and clientPath != ''"> client_path , </if>
            <if test="webPath != null and webPath != ''"> web_path , </if>
            <if test="programPath != null and programPath != ''"> program_path , </if>
            <if test="publicKey != null and publicKey != ''"> public_key , </if>
            <if test="secretKey != null and secretKey != ''"> secret_key , </if>
            <if test="interfaceAddress != null and interfaceAddress != ''"> interface_address , </if>
            <if test="interfaceStatus != null and interfaceStatus != ''"> interface_status , </if>
            <if test="dbStatus != null and dbStatus != ''"> db_status , </if>
            <if test="sorts != null"> sorts , </if>
            <if test="org_id != null and org_id != ''"> org_id , </if>
            <if test="sts != null and sts != ''"> sts , </if>
            <if test="create_time != null"> create_time , </if>
            <if test="create_user_id != null and create_user_id != ''"> create_user_id , </if>
            <if test="modify_time != null"> modify_time , </if>
            <if test="modify_user_id != null and modify_user_id != ''"> modify_user_id , </if>
            <if test="sorts == null ">sorts,</if>
    <if test="sts == null ">sts,</if>
  </trim>
  )values(
 <trim suffix="" suffixOverrides=",">
       <if test="id != null and id != ''"> #{id} ,</if>
            <if test="appLogo != null and appLogo != ''"> #{appLogo} ,</if>
            <if test="appStatus != null and appStatus != ''"> #{appStatus} ,</if>
            <if test="name != null and name != ''"> #{name} ,</if>
            <if test="versionNumber != null and versionNumber != ''"> #{versionNumber} ,</if>
            <if test="appId != null "> #{appId} ,</if>
            <if test="appId == null ">(SELECT IFNULL(MAX(b.app_id)+1,800000) AS appId FROM sys_application b ),</if>
            <if test="systemAddress != null and systemAddress != ''"> #{systemAddress} ,</if>
            <if test="accessMode != null and accessMode != ''"> #{accessMode} ,</if>
            <if test="affiliationField != null and affiliationField != ''"> #{affiliationField} ,</if>
            <if test="manufacturer != null and manufacturer != ''"> #{manufacturer} ,</if>
            <if test="appIntroduction != null and appIntroduction != ''"> #{appIntroduction} ,</if>
            <if test="clientPath != null and clientPath != ''"> #{clientPath} ,</if>
            <if test="webPath != null and webPath != ''"> #{webPath} ,</if>
            <if test="programPath != null and programPath != ''"> #{programPath} ,</if>
            <if test="publicKey != null and publicKey != ''"> #{publicKey} ,</if>
            <if test="secretKey != null and secretKey != ''"> #{secretKey} ,</if>
            <if test="interfaceAddress != null and interfaceAddress != ''"> #{interfaceAddress} ,</if>
            <if test="interfaceStatus != null and interfaceStatus != ''"> #{interfaceStatus} ,</if>
            <if test="dbStatus != null and dbStatus != ''"> #{dbStatus} ,</if>
            <if test="sorts != null"> #{sorts} ,</if>
            <if test="org_id != null and org_id != ''"> #{org_id} ,</if>
            <if test="sts != null and sts != ''"> #{sts} ,</if>
            <if test="create_time != null"> #{create_time} ,</if>
            <if test="create_user_id != null and create_user_id != ''"> #{create_user_id} ,</if>
            <if test="modify_time != null"> #{modify_time} ,</if>
            <if test="modify_user_id != null and modify_user_id != ''"> #{modify_user_id} ,</if>
            <if test="sorts == null ">(select (max(IFNULL( a.sorts, 0 )) + 1) as sort from sys_application a WHERE a.sts = 'Y' ),</if>
    <if test="sts == null ">'Y',</if>
  </trim>
  )  
</insert>
<!-- 批量新增 -->
<insert id="entityInsertBatch" keyProperty="id" useGeneratedKeys="true">
  insert into sys_application(app_logo, app_status, name, version_number, app_id, system_address, access_mode, affiliation_field, manufacturer, app_introduction, client_path, web_path, program_path, public_key, secret_key, interface_address, interface_status, db_status, sorts, org_id, sts, create_time, create_user_id, modify_time, modify_user_id,  sts)
    values
    <foreach collection="entities" item="entity" separator=",">
    (#{entity.appLogo},#{entity.appStatus},#{entity.name},#{entity.versionNumber},#{entity.appId},#{entity.systemAddress},#{entity.accessMode},#{entity.affiliationField},#{entity.manufacturer},#{entity.appIntroduction},#{entity.clientPath},#{entity.webPath},#{entity.programPath},#{entity.publicKey},#{entity.secretKey},#{entity.interfaceAddress},#{entity.interfaceStatus},#{entity.dbStatus},#{entity.sorts},#{entity.org_id},#{entity.sts},#{entity.create_time},#{entity.create_user_id},#{entity.modify_time},#{entity.modify_user_id}, 'Y')
    </foreach>
</insert>
<!-- 批量新增或者修改-->
<insert id="entityInsertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
    insert into sys_application(app_logo, app_status, name, version_number,app_id,system_address, access_mode, affiliation_field, manufacturer, app_introduction, client_path, web_path, program_path, public_key, secret_key, interface_address, interface_status, db_status, sorts, org_id, sts, create_time, create_user_id, modify_time, modify_user_id)
    values
    <foreach collection="entities" item="entity" separator=",">
    (#{entity.appLogo},#{entity.appStatus},#{entity.name},#{entity.versionNumber},#{entity.appId},#{entity.systemAddress},#{entity.accessMode},#{entity.affiliationField},#{entity.manufacturer},#{entity.appIntroduction},#{entity.clientPath},#{entity.webPath},#{entity.programPath},#{entity.publicKey},#{entity.secretKey},#{entity.interfaceAddress},#{entity.interfaceStatus},#{entity.dbStatus},#{entity.sorts},#{entity.org_id},#{entity.sts},#{entity.create_time},#{entity.create_user_id},#{entity.modify_time},#{entity.modify_user_id})
    </foreach>
    on duplicate key update
    app_logo = values(app_logo),
    app_status = values(app_status),
    name = values(name),
    version_number = values(version_number),
    app_id = values(app_id),
    system_address = values(system_address),
    access_mode = values(access_mode),
    affiliation_field = values(affiliation_field),
    manufacturer = values(manufacturer),
    app_introduction = values(app_introduction),
    client_path = values(client_path),
    web_path = values(web_path),
    program_path = values(program_path),
    public_key = values(public_key),
    secret_key = values(secret_key),
    interface_address = values(interface_address),
    interface_status = values(interface_status),
    db_status = values(db_status),
    sorts = values(sorts),
    org_id = values(org_id),
    sts = values(sts),
    create_time = values(create_time),
    create_user_id = values(create_user_id),
    modify_time = values(modify_time),
    modify_user_id = values(modify_user_id)</insert>
<!--通过主键修改方法-->
<update id="entity_update" parameterType = "com.hzya.frame.sysnew.application.entity.SysApplicationEntity" >
update sys_application  set
<trim suffix="" suffixOverrides=",">
  <if test="appLogo != null and appLogo != ''"> app_logo = #{appLogo},</if>
  <if test="appStatus != null and appStatus != ''"> app_status = #{appStatus},</if>
  <if test="name != null and name != ''"> name = #{name},</if>
  <if test="versionNumber != null and versionNumber != ''"> version_number = #{versionNumber},</if>
  <if test="appId != null "> app_id = #{appId},</if>
  <if test="systemAddress != null and systemAddress != ''"> system_address = #{systemAddress},</if>
  <if test="accessMode != null and accessMode != ''"> access_mode = #{accessMode},</if>
  <if test="affiliationField != null and affiliationField != ''"> affiliation_field = #{affiliationField},</if>
  <if test="manufacturer != null and manufacturer != ''"> manufacturer = #{manufacturer},</if>
  <if test="appIntroduction != null and appIntroduction != ''"> app_introduction = #{appIntroduction},</if>
  <if test="clientPath != null and clientPath != ''"> client_path = #{clientPath},</if>
  <if test="webPath != null and webPath != ''"> web_path = #{webPath},</if>
  <if test="programPath != null and programPath != ''"> program_path = #{programPath},</if>
  <if test="publicKey != null and publicKey != ''"> public_key = #{publicKey},</if>
  <if test="secretKey != null and secretKey != ''"> secret_key = #{secretKey},</if>
  <if test="interfaceAddress != null and interfaceAddress != ''"> interface_address = #{interfaceAddress},</if>
  <if test="interfaceStatus != null and interfaceStatus != ''"> interface_status = #{interfaceStatus},</if>
  <if test="dbStatus != null and dbStatus != ''"> db_status = #{dbStatus},</if>
  <if test="sorts != null"> sorts = #{sorts},</if>
  <if test="org_id != null and org_id != ''"> org_id = #{org_id},</if>
    <if test="sts != null and sts != ''"> sts = #{sts},</if>
  <if test="create_time != null"> create_time = #{create_time},</if>
    <if test="create_user_id != null and create_user_id != ''"> create_user_id = #{create_user_id},</if>
    <if test="modify_time != null"> modify_time = #{modify_time},</if>
    <if test="modify_user_id != null and modify_user_id != ''"> modify_user_id = #{modify_user_id},</if>
  </trim>
where id = #{id}
</update>
<!-- 逻辑删除 -->
<update id="entity_logicDelete" parameterType = "com.hzya.frame.sysnew.application.entity.SysApplicationEntity" >
update sys_application  set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
where id = #{id}
</update>
<!-- 多条件逻辑删除 -->
<update id="entity_logicDelete_Multi_Condition" parameterType = "com.hzya.frame.sysnew.application.entity.SysApplicationEntity" >
update sys_application  set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
 <trim prefix="where" prefixOverrides="and"> 
        <if test="id != null and id != ''"> and id = #{id} </if>
            <if test="appLogo != null and appLogo != ''"> and app_logo = #{appLogo} </if>
            <if test="appStatus != null and appStatus != ''"> and app_status = #{appStatus} </if>
            <if test="name != null and name != ''"> and name = #{name} </if>
            <if test="versionNumber != null and versionNumber != ''"> and version_number = #{versionNumber} </if>
            <if test="appId != null "> and app_id = #{appId} </if>
            <if test="systemAddress != null and systemAddress != ''"> and system_address = #{systemAddress} </if>
            <if test="accessMode != null and accessMode != ''"> and access_mode = #{accessMode} </if>
            <if test="affiliationField != null and affiliationField != ''"> and affiliation_field = #{affiliationField} </if>
            <if test="manufacturer != null and manufacturer != ''"> and manufacturer = #{manufacturer} </if>
            <if test="appIntroduction != null and appIntroduction != ''"> and app_introduction = #{appIntroduction} </if>
            <if test="clientPath != null and clientPath != ''"> and client_path = #{clientPath} </if>
            <if test="webPath != null and webPath != ''"> and web_path = #{webPath} </if>
            <if test="programPath != null and programPath != ''"> and program_path = #{programPath} </if>
            <if test="publicKey != null and publicKey != ''"> and public_key = #{publicKey} </if>
            <if test="secretKey != null and secretKey != ''"> and secret_key = #{secretKey} </if>
            <if test="interfaceAddress != null and interfaceAddress != ''"> and interface_address = #{interfaceAddress} </if>
            <if test="interfaceStatus != null and interfaceStatus != ''"> and interface_status = #{interfaceStatus} </if>
            <if test="dbStatus != null and dbStatus != ''"> and db_status = #{dbStatus} </if>
            <if test="sorts != null"> and sorts = #{sorts} </if>
                         <if test="sts != null and sts != ''"> and sts = #{sts} </if>
                                                                and sts='Y'
    </trim>
</update>
<!--通过主键删除-->
<delete id="entity_delete">
    delete from sys_application where id = #{id}
</delete>
    <!-- 分页查询列表 采用like格式 -->
    <select id="queryApp" resultType="com.hzya.frame.sysnew.application.entity.SysApplicationVo" parameterType = "com.hzya.frame.sysnew.application.entity.SysApplicationDto">
        select
        a.id as id
        ,a.app_logo as appLogo
        ,a.app_status  as appStatus
        ,a.app_id  as appId
        ,a.system_address  as systemAddress
        ,a.name  as name
        ,a.version_number  as versionNumber
        ,a.access_mode  as accessMode
        ,a.affiliation_field  as affiliationField
        ,(SELECT b.column_content from
        sys_dictionaryshop_new b WHERE b.tab_name = 'sys_product' and b.column_name = 'classify' and b.column_num_value = a.affiliation_field ) as affiliationFieldName
        ,a.manufacturer  as manufacturer
        ,a.app_introduction  as appIntroduction
        ,a.interface_status  as interfaceStatus
        ,a.db_status  as dbStatus
        from sys_application  a
        <trim prefix="where" prefixOverrides="and">
            <if test="affiliationField != null and affiliationField != ''"> and a.affiliation_field  = #{affiliationField}  </if>
            <if test="appStatus != null and appStatus != ''"> and a.app_status = #{appStatus}  </if>
            <if test="nameOrManufacturer != null and nameOrManufacturer != ''"> and (a.name like concat('%',#{nameOrManufacturer},'%') or a.manufacturer like concat('%',#{nameOrManufacturer},'%') )</if>
            <if test="name != null and name != ''"> and name like concat('%',#{name},'%') </if>
            and a.sts='Y'
        </trim>
        order by a.sorts asc
    </select>
</mapper>

