批量插入
<insert id="saveBatchAll" parameterType="java.util.List">
INSERT INTO obj_ins_tax_data (id,create_time,apply_money,is_storage
,storage_money, tax_code,tax_authority, tax_rate,
funds_type, cancel_date,levy_period,contact,
tel,bill_no,ticket_type,local_org_name,
tax_basis,county, revenue_name, tax_start_date,
tax_end_date,bank_net,bank_account,address,
funds_type_key,funds_type_val,local_org_name_key,
local_org_name_val,
paying_unit_name_key,paying_unit_name_val,is_storage_key,
is_storage_val,county_code,level_name,paying_unit_name,tax_namer,percent,import_record_id,
local_org_org_code,project,register_type, type,industry,budget_rate,belong_date,to_funds_money) VALUES
<foreach collection="list" item="item" separator=",">
(#{item.id},now(),#{item.applyMoney},#{item.isStorage}
,#{item.storageMoney},#{item.taxCode},#{item.taxAuthority},#{item.taxRate}
,#{item.fundsType},#{item.cancelDate},#{item.levyPeriod},#{item.contact}
,#{item.tel},#{item.billNo},#{item.ticketType},#{item.localOrgName}
,#{item.taxBasis},#{item.county},#{item.revenueName},#{item.taxStartDate}
,#{item.taxEndDate},#{item.bankNet},#{item.bankAccount},#{item.address}
,#{item.fundsTypeKey},#{item.fundsTypeVal},#{item.localOrgNameKey},
#{item.localOrgNameVal},
#{item.payingUnitNameKey} ,#{item.payingUnitNameVal},#{item.isStorageKey},
#{item.isStorageVal},#{item.countyCode},#{item.levelName},#{item.payingUnitName},#{item.taxNamer},#{item.percent},#{item.importRecordId}
,#{item.localOrgOrgCode},#{item.project},#{item.registerType},#{item.type},#{item.industry},#{item.budgetRate},#{item.belongDate}
,#{item.toFundsMoney}
)
</foreach>
</insert>
void saveBatchAll(List<ObjInsTaxData> list);
批量查询
<select id="listBatch" resultType="cn.newgrand.gsoft.tax.modular.objinstaxdata.entity.ObjInsTaxData">
SELECT * FROM obj_ins_tax_data
WHERE 1 = 1
<foreach item="objInsTaxDataParam" index="index" collection="paramList" open="AND (" separator="OR " close=")">
tax_code = #{objInsTaxDataParam.taxCode} AND tax_start_date = #{objInsTaxDataParam.taxStartDate} AND tax_end_date = #{objInsTaxDataParam.taxEndDate} AND storage_money = #{objInsTaxDataParam.storageMoney}
</foreach>
</select>
List<ObjInsTaxData> listBatch(@Param("paramList") List<ObjInsTaxDataParam> paramList);
普通查询
List<AccountBalanceVO> countBalance(AccountBalanceParam accountBalanceParam);
<select id="unitFundsTypeCount" resultMap="unitFundsTypeMap" parameterType="cn.newgrand.gsoft.tax.modular.balance.param.AccountBalanceParam" >
SELECT
tax_code as taxCode,
funds_type_val as fundsTypeVal,
SUM(storage_money) AS storageMoney
FROM
obj_ins_tax_data
<where>
<if test="year!=null">
YEAR(cancel_date) = #{year}
</if>
<if test="cancelDateStart!=null and cancelDateStart !=''">
and cancel_date <![CDATA[ >= ]]> #{cancelDateStart}
</if>
<if test="cancelDateEnd!=null and cancelDateEnd !=''" >
and cancel_date <![CDATA[ <= ]]> #{cancelDateEnd}
</if>
<if test="fundsTypeKeyList != null and fundsTypeKeyList.size()>0" >
and funds_type_key in
<foreach collection="fundsTypeKeyList" item="type" open="(" close=")" separator="," >
#{type}
</foreach>
</if>
<if test="taxCodeList!=null and taxCodeList.size()>0">
and tax_code in
<foreach collection="taxCodeList" index="index" item="item" open="(" close=")"
separator=",">
#{item}
</foreach>
</if>
</where>
GROUP BY
tax_code,funds_type_val
</select>