<?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.lzbi.draft.mapper.DcBusiParamBillMasterMapper" >
<resultMap type= "com.lzbi.draft.domain.DcBusiParamBillMasterDao" id= "DcBusiParamBillMasterDaoResult" >
<result property= "tenantId" column= "TENANT_ID" />
<result property= "REVISION" column= "REVISION" />
<result property= "createdBy" column= "CREATED_BY" />
<result property= "createdTime" column= "CREATED_TIME" />
<result property= "updatedBy" column= "UPDATED_BY" />
<result property= "updatedTime" column= "UPDATED_TIME" />
<result property= "deleteBy" column= "DELETE_BY" />
<result property= "deleteTime" column= "DELETE_TIME" />
<result property= "id" column= "id" />
<result property= "billNo" column= "bill_no" />
<result property= "billIncomeDate" column= "bill_income_date" />
<result property= "billType" column= "bill_type" />
<result property= "checkType" column= "check_type" />
<result property= "checkStatus" column= "check_status" />
</resultMap>
<resultMap id= "DcBusiParamBillMasterDaoDcBusiParamBillSubDaoResult" type= "DcBusiParamBillMasterDao" extends= "DcBusiParamBillMasterDaoResult" >
<collection property= "dcBusiParamBillSubDaoList" notNullColumn= "sub_id" javaType= "java.util.List" resultMap= "DcBusiParamBillSubDaoResult" />
</resultMap>
<resultMap type= "DcBusiParamBillSubDao" id= "DcBusiParamBillSubDaoResult" >
<result property= "tenantId" column= "sub_TENANT_ID" />
<result property= "createdBy" column= "sub_CREATED_BY" />
<result property= "createdTime" column= "sub_CREATED_TIME" />
<result property= "updatedBy" column= "sub_UPDATED_BY" />
<result property= "updatedTime" column= "sub_UPDATED_TIME" />
<result property= "deleteBy" column= "sub_DELETE_BY" />
<result property= "deleteTime" column= "sub_DELETE_TIME" />
<result property= "id" column= "sub_id" />
<result property= "billNo" column= "sub_bill_no" />
<result property= "assetCode" column= "sub_asset_code" />
<result property= "fieldType" column= "sub_field_type" />
<result property= "counDate" column= "count_date" />
<result property= "paramCode" column= "sub_param_code" />
<result property= "paramUint" column= "sub_param_uint" />
<result property= "paramValue" column= "sub_param_value" />
</resultMap>
<sql id= "selectDcBusiParamBillMasterVo" >
select TENANT_ID, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME, DELETE_BY, DELETE_TIME, id, bill_no, bill_income_date, bill_type, check_type, check_status from dc_busi_param_bill_master
</sql>
<select id= "selectDcBusiParamBillMasterDaoList" parameterType= "DcBusiParamBillMasterDao" resultMap= "DcBusiParamBillMasterDaoResult" >
<include refid= "selectDcBusiParamBillMasterVo" />
<where >
<if test= "billNo != null and billNo != ''" > and bill_no = #{billNo}</if>
<if test= "billIncomeDate != null and billIncomeDate != ''" > and bill_income_date = #{billIncomeDate}</if>
<if test= "billType != null and billType != ''" > and bill_type = #{billType}</if>
<if test= "checkType != null and checkType != ''" > and check_type = #{checkType}</if>
<if test= "checkStatus != null and checkStatus != ''" > and check_status = #{checkStatus}</if>
</where>
</select>
<select id= "selectDcBusiParamBillMasterDaoById" parameterType= "Long" resultMap= "DcBusiParamBillMasterDaoDcBusiParamBillSubDaoResult" >
select a.TENANT_ID, a.REVISION, a.CREATED_BY, a.CREATED_TIME, a.UPDATED_BY, a.UPDATED_TIME, a.DELETE_BY, a.DELETE_TIME, a.id, a.bill_no, a.bill_income_date, a.bill_type, a.check_type, a.check_status,
b.TENANT_ID as sub_TENANT_ID, b.CREATED_BY as sub_CREATED_BY, b.CREATED_TIME as sub_CREATED_TIME, b.UPDATED_BY as sub_UPDATED_BY, b.UPDATED_TIME as sub_UPDATED_TIME, b.DELETE_BY as sub_DELETE_BY, b.DELETE_TIME as sub_DELETE_TIME, b.id as sub_id, b.bill_no as sub_bill_no,b.asset_code as sub_asset_code, b.field_type as sub_field_type, b.param_code as sub_param_code, b.param_value as sub_param_value
from dc_busi_param_bill_master a
left join dc_busi_param_bill_sub b on b.bill_no = a.bill_no
where a.id = #{id}
</select>
<insert id= "insertDcBusiParamBillMasterDao" parameterType= "DcBusiParamBillMasterDao" useGeneratedKeys= "true" keyProperty= "id" >
insert into dc_busi_param_bill_master
<trim prefix= "(" suffix= ")" suffixOverrides= "," >
<if test= "tenantId != null" > TENANT_ID,</if>
<if test= "REVISION != null" > REVISION,</if>
<if test= "createdBy != null" > CREATED_BY,</if>
<if test= "createdTime != null" > CREATED_TIME,</if>
<if test= "updatedBy != null" > UPDATED_BY,</if>
<if test= "updatedTime != null" > UPDATED_TIME,</if>
<if test= "deleteBy != null" > DELETE_BY,</if>
<if test= "deleteTime != null" > DELETE_TIME,</if>
<if test= "billNo != null" > bill_no,</if>
<if test= "billIncomeDate != null" > bill_income_date,</if>
<if test= "billType != null" > bill_type,</if>
<if test= "checkType != null" > check_type,</if>
<if test= "checkStatus != null" > check_status,</if>
</trim>
<trim prefix= "values (" suffix= ")" suffixOverrides= "," >
<if test= "tenantId != null" > #{tenantId},</if>
<if test= "REVISION != null" > #{REVISION},</if>
<if test= "createdBy != null" > #{createdBy},</if>
<if test= "createdTime != null" > #{createdTime},</if>
<if test= "updatedBy != null" > #{updatedBy},</if>
<if test= "updatedTime != null" > #{updatedTime},</if>
<if test= "deleteBy != null" > #{deleteBy},</if>
<if test= "deleteTime != null" > #{deleteTime},</if>
<if test= "billNo != null" > #{billNo},</if>
<if test= "billIncomeDate != null" > #{billIncomeDate},</if>
<if test= "billType != null" > #{billType},</if>
<if test= "checkType != null" > #{checkType},</if>
<if test= "checkStatus != null" > #{checkStatus},</if>
</trim>
</insert>
<update id= "updateDcBusiParamBillMasterDao" parameterType= "DcBusiParamBillMasterDao" >
update dc_busi_param_bill_master
<trim prefix= "SET" suffixOverrides= "," >
<if test= "tenantId != null" > TENANT_ID = #{tenantId},</if>
<if test= "REVISION != null" > REVISION = #{REVISION},</if>
<if test= "createdBy != null" > CREATED_BY = #{createdBy},</if>
<if test= "createdTime != null" > CREATED_TIME = #{createdTime},</if>
<if test= "updatedBy != null" > UPDATED_BY = #{updatedBy},</if>
<if test= "updatedTime != null" > UPDATED_TIME = #{updatedTime},</if>
<if test= "deleteBy != null" > DELETE_BY = #{deleteBy},</if>
<if test= "deleteTime != null" > DELETE_TIME = #{deleteTime},</if>
<if test= "billNo != null" > bill_no = #{billNo},</if>
<if test= "billIncomeDate != null" > bill_income_date = #{billIncomeDate},</if>
<if test= "billType != null" > bill_type = #{billType},</if>
<if test= "checkType != null" > check_type = #{checkType},</if>
<if test= "checkStatus != null" > check_status = #{checkStatus},</if>
</trim>
where id = #{id}
</update>
<delete id= "deleteDcBusiParamBillMasterDaoById" parameterType= "Long" >
delete from dc_busi_param_bill_master where id = #{id}
</delete>
<delete id= "deleteDcBusiParamBillMasterDaoByIds" parameterType= "String" >
delete from dc_busi_param_bill_master where id in
<foreach item= "id" collection= "array" open= "(" separator= "," close= ")" >
#{id}
</foreach>
</delete>
<delete id= "deleteDcBusiParamBillSubDaoByBillNos" parameterType= "String" >
delete from dc_busi_param_bill_sub where bill_no in
<foreach item= "billNo" collection= "array" open= "(" separator= "," close= ")" >
#{billNo}
</foreach>
</delete>
<delete id= "deleteDcBusiParamBillSubDaoByBillNo" parameterType= "Long" >
delete from dc_busi_param_bill_sub where bill_no = #{billNo}
</delete>
<insert id= "batchDcBusiParamBillSubDao" >
insert into dc_busi_param_bill_sub( TENANT_ID, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME, DELETE_BY, DELETE_TIME, id, bill_no, asset_code, field_type, param_code, param_value) values
<foreach item= "item" index= "index" collection= "list" separator= "," >
( #{item.tenantId}, #{item.createdBy}, #{item.createdTime}, #{item.updatedBy}, #{item.updatedTime}, #{item.deleteBy}, #{item.deleteTime}, #{item.id}, #{item.billNo}, #{item.assetCode}, #{item.fieldType}, #{item.paramCode}, #{item.paramValue})
</foreach>
</insert>
</mapper>