TdClCompanyAccInfoMapper.xml 14.3 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="com.zteits.pay.mapper.TdClCompanyAccInfoMapper">
  <resultMap id="BaseResultMap" type="com.zteits.pay.domain.TdClCompanyAccInfo">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="acc_code" jdbcType="VARCHAR" property="accCode" />
    <result column="customer_no" jdbcType="VARCHAR" property="customerNo" />
    <result column="acct_balance" jdbcType="BIGINT" property="acctBalance" />
    <result column="max_arrear" jdbcType="BIGINT" property="maxArrear" />
    <result column="acc_status" jdbcType="CHAR" property="accStatus" />
    <result column="create_empid" jdbcType="VARCHAR" property="createEmpid" />
    <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
    <result column="modfiy_empid" jdbcType="VARCHAR" property="modfiyEmpid" />
    <result column="modfiy_date" jdbcType="TIMESTAMP" property="modfiyDate" />
    <result column="num" jdbcType="VARCHAR" property="plNo" />
    <result column="customer_name" jdbcType="VARCHAR" property="customerName" />
      <collection property="parkRelationList"
                  select="com.zteits.pay.mapper.TdClCompanyAccInfoMapper.viewParkRelation"
                  column="{accCode=acc_code}">
      </collection>
  </resultMap>
  <sql id="Example_Where_Clause">
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause">
    <where>
      <foreach collection="example.oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    id, acc_code, customer_no, acct_balance, max_arrear, acc_status, create_empid, create_date, 
    modfiy_empid, modfiy_date
  </sql>
  <select id="selectByExample" parameterType="com.zteits.pay.domain.TdClCompanyAccInfoExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    'true' as QUERYID,
    <include refid="Base_Column_List" />
    from td_cl_company_acc_info
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>

    <select id="selectByDataExample" parameterType="com.zteits.clouds.api.dto.pay.param.QueryCompanyAccountRequest" resultMap="BaseResultMap">
        select * from ( SELECT
        a.acc_code,
        a.customer_no,
        a.acct_balance,
        GROUP_CONCAT( p.pl_no ) as num,
        m.customer_name,
        a.acc_status
        FROM
        td_cl_company_acc_info a
        LEFT JOIN td_cl_company_acc_park_relation p ON a.acc_code = p.acc_code
        LEFT JOIN td_cl_customer_management m ON a.customer_no = m.customer_no
        GROUP BY
        a.acc_code
        ) h
        where 1=1
        <if test="plNo != null and plNo != ''">
           and h.num like CONCAT('%',#{plNo},'%')
        </if>
        <if test="customerNo != null and customerNo != ''">
            and h.customer_no = #{customerNo}
        </if>
        <if test="accStatus != null and accStatus != ''">
            and h.acc_status = #{accStatus}
        </if>

    </select>


    <select id="selectByDataDtoExample" parameterType="com.zteits.clouds.api.dto.pay.param.QueryCompanyAccountRequest"
            resultMap="BaseResultMap">
        select * from ( SELECT
        a.id,
        a.acc_code,
        a.customer_no,
        a.acct_balance,
        a.max_arrear,
        GROUP_CONCAT( p.pl_no ) as num,
        m.customer_name,
        a.acc_status
        FROM
        td_cl_company_acc_info a
        LEFT JOIN td_cl_company_acc_park_relation p ON a.acc_code = p.acc_code
        LEFT JOIN td_cl_customer_management m ON a.customer_no = m.customer_no
        GROUP BY
        a.acc_code
        ) h
        where 1=1
        <if test="plNo != null and plNo != ''">
            and h.num like CONCAT('%',#{plNo},'%')
        </if>
        <if test="customerNo != null and customerNo != ''">
            and h.customer_no = #{customerNo}
        </if>
        <if test="accStatus != null and accStatus != ''">
            and h.acc_status = #{accStatus}
        </if>

    </select>

    <select id="viewCompanyAccount" parameterType="com.zteits.clouds.api.dto.pay.param.ViewCompanyAccountRequest"  resultMap="BaseResultMap">
        SELECT
        a.id,
        a.acc_code,
        a.customer_no,
        c.customer_name,
        a.max_arrear
        FROM
        td_cl_company_acc_info a
        LEFT JOIN td_cl_customer_management c on a.customer_no = c.customer_no
        where 1=1
        <if test="accCode != null and accCode != ''">
            and a.acc_code = #{accCode}
        </if>

    </select>

    <select id="viewParkRelation" parameterType="com.zteits.clouds.api.dto.pay.param.ViewCompanyAccountRequest"
            resultType="com.zteits.pay.domain.TdClCompanyAccParkRelation">
        SELECT
        p.id,
        p.acc_code accCode ,
        p.pl_no plNo
        FROM
        td_cl_company_acc_park_relation p
        where 1=1
        <if test="accCode != null and accCode != ''">
            and p.acc_code = #{accCode}
        </if>

    </select>

  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from td_cl_company_acc_info
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from td_cl_company_acc_info
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="com.zteits.pay.domain.TdClCompanyAccInfoExample">
    delete from td_cl_company_acc_info
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.zteits.pay.domain.TdClCompanyAccInfo">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into td_cl_company_acc_info (acc_code, customer_no, acct_balance, 
      max_arrear, acc_status, create_empid, 
      create_date, modfiy_empid, modfiy_date
      )
    values (#{accCode,jdbcType=VARCHAR}, #{customerNo,jdbcType=VARCHAR}, #{acctBalance,jdbcType=BIGINT}, 
      #{maxArrear,jdbcType=BIGINT}, #{accStatus,jdbcType=CHAR}, #{createEmpid,jdbcType=VARCHAR}, 
      #{createDate,jdbcType=TIMESTAMP}, #{modfiyEmpid,jdbcType=VARCHAR}, #{modfiyDate,jdbcType=TIMESTAMP}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.zteits.pay.domain.TdClCompanyAccInfo">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into td_cl_company_acc_info
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="accCode != null">
        acc_code,
      </if>
      <if test="customerNo != null">
        customer_no,
      </if>
      <if test="acctBalance != null">
        acct_balance,
      </if>
      <if test="maxArrear != null">
        max_arrear,
      </if>
      <if test="accStatus != null">
        acc_status,
      </if>
      <if test="createEmpid != null">
        create_empid,
      </if>
      <if test="createDate != null">
        create_date,
      </if>
      <if test="modfiyEmpid != null">
        modfiy_empid,
      </if>
      <if test="modfiyDate != null">
        modfiy_date,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="accCode != null">
        #{accCode,jdbcType=VARCHAR},
      </if>
      <if test="customerNo != null">
        #{customerNo,jdbcType=VARCHAR},
      </if>
      <if test="acctBalance != null">
        #{acctBalance,jdbcType=BIGINT},
      </if>
      <if test="maxArrear != null">
        #{maxArrear,jdbcType=BIGINT},
      </if>
      <if test="accStatus != null">
        #{accStatus,jdbcType=CHAR},
      </if>
      <if test="createEmpid != null">
        #{createEmpid,jdbcType=VARCHAR},
      </if>
      <if test="createDate != null">
        #{createDate,jdbcType=TIMESTAMP},
      </if>
      <if test="modfiyEmpid != null">
        #{modfiyEmpid,jdbcType=VARCHAR},
      </if>
      <if test="modfiyDate != null">
        #{modfiyDate,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.zteits.pay.domain.TdClCompanyAccInfoExample" resultType="java.lang.Long">
    select count(*) from td_cl_company_acc_info
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update td_cl_company_acc_info
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.accCode != null">
        acc_code = #{record.accCode,jdbcType=VARCHAR},
      </if>
      <if test="record.customerNo != null">
        customer_no = #{record.customerNo,jdbcType=VARCHAR},
      </if>
      <if test="record.acctBalance != null">
        acct_balance = #{record.acctBalance,jdbcType=BIGINT},
      </if>
      <if test="record.maxArrear != null">
        max_arrear = #{record.maxArrear,jdbcType=BIGINT},
      </if>
      <if test="record.accStatus != null">
        acc_status = #{record.accStatus,jdbcType=CHAR},
      </if>
      <if test="record.createEmpid != null">
        create_empid = #{record.createEmpid,jdbcType=VARCHAR},
      </if>
      <if test="record.createDate != null">
        create_date = #{record.createDate,jdbcType=TIMESTAMP},
      </if>
      <if test="record.modfiyEmpid != null">
        modfiy_empid = #{record.modfiyEmpid,jdbcType=VARCHAR},
      </if>
      <if test="record.modfiyDate != null">
        modfiy_date = #{record.modfiyDate,jdbcType=TIMESTAMP},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update td_cl_company_acc_info
    set id = #{record.id,jdbcType=BIGINT},
      acc_code = #{record.accCode,jdbcType=VARCHAR},
      customer_no = #{record.customerNo,jdbcType=VARCHAR},
      acct_balance = #{record.acctBalance,jdbcType=BIGINT},
      max_arrear = #{record.maxArrear,jdbcType=BIGINT},
      acc_status = #{record.accStatus,jdbcType=CHAR},
      create_empid = #{record.createEmpid,jdbcType=VARCHAR},
      create_date = #{record.createDate,jdbcType=TIMESTAMP},
      modfiy_empid = #{record.modfiyEmpid,jdbcType=VARCHAR},
      modfiy_date = #{record.modfiyDate,jdbcType=TIMESTAMP}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.zteits.pay.domain.TdClCompanyAccInfo">
    update td_cl_company_acc_info
    <set>
      <if test="accCode != null">
        acc_code = #{accCode,jdbcType=VARCHAR},
      </if>
      <if test="customerNo != null">
        customer_no = #{customerNo,jdbcType=VARCHAR},
      </if>
      <if test="acctBalance != null">
        acct_balance = #{acctBalance,jdbcType=BIGINT},
      </if>
      <if test="maxArrear != null">
        max_arrear = #{maxArrear,jdbcType=BIGINT},
      </if>
      <if test="accStatus != null">
        acc_status = #{accStatus,jdbcType=CHAR},
      </if>
      <if test="createEmpid != null">
        create_empid = #{createEmpid,jdbcType=VARCHAR},
      </if>
      <if test="createDate != null">
        create_date = #{createDate,jdbcType=TIMESTAMP},
      </if>
      <if test="modfiyEmpid != null">
        modfiy_empid = #{modfiyEmpid,jdbcType=VARCHAR},
      </if>
      <if test="modfiyDate != null">
        modfiy_date = #{modfiyDate,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.zteits.pay.domain.TdClCompanyAccInfo">
    update td_cl_company_acc_info
    set acc_code = #{accCode,jdbcType=VARCHAR},
      customer_no = #{customerNo,jdbcType=VARCHAR},
      acct_balance = #{acctBalance,jdbcType=BIGINT},
      max_arrear = #{maxArrear,jdbcType=BIGINT},
      acc_status = #{accStatus,jdbcType=CHAR},
      create_empid = #{createEmpid,jdbcType=VARCHAR},
      create_date = #{createDate,jdbcType=TIMESTAMP},
      modfiy_empid = #{modfiyEmpid,jdbcType=VARCHAR},
      modfiy_date = #{modfiyDate,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>