<?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.dhcc.finance.main.dao.CwBdRecordBatchMapper"> <resultMap id="BaseResultMap" type="com.dhcc.finance.main.domain.CwBdRecordBatch"> <id column="ID" jdbcType="VARCHAR" property="id" /> <result column="INITIATE_USE" jdbcType="VARCHAR" property="initiateUse" /> <result column="INITIATE_TIME" jdbcType="TIMESTAMP" property="initiateTime" /> <result column="PROJECT_CODE" jdbcType="VARCHAR" property="projectCode" /> <result column="PROJECT_NAME" jdbcType="VARCHAR" property="projectName" /> <result column="BATCH_NO" jdbcType="VARCHAR" property="batchNo" /> <result column="TRADECODE" jdbcType="VARCHAR" property="tradecode" /> <result column="PREPAREDATE" jdbcType="TIMESTAMP" property="preparedate" /> <result column="INST_ID" jdbcType="VARCHAR" property="instId" /> <result column="SIGN_TYPE" jdbcType="VARCHAR" property="signType" /> <result column="FAIL_REASON" jdbcType="VARCHAR" property="failReason" /> <result column="USE_STATE" jdbcType="VARCHAR" property="useState" /> <result column="CREATE_USER" jdbcType="VARCHAR" property="createUser" /> <result column="CREATE_TIME" jdbcType="TIMESTAMP" property="createTime" /> <result column="UPDATE_USER" jdbcType="VARCHAR" property="updateUser" /> <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime" /> <result column="REMARK" jdbcType="VARCHAR" property="remark" /> </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, INITIATE_USE, INITIATE_TIME, PROJECT_CODE, PROJECT_NAME, BATCH_NO, TRADECODE, PREPAREDATE, INST_ID, SIGN_TYPE, FAIL_REASON, USE_STATE, CREATE_USER, CREATE_TIME, UPDATE_USER, UPDATE_TIME, REMARK </sql> <select id="selectByExample" parameterType="com.dhcc.finance.main.domain.CwBdRecordBatchExample" resultMap="BaseResultMap"> select <if test="distinct"> distinct </if> <include refid="Base_Column_List" /> from cw_bd_record_batch <if test="_parameter != null"> <include refid="Example_Where_Clause" /> </if> <if test="orderByClause != null"> order by ${orderByClause} </if> </select> <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap"> select <include refid="Base_Column_List" /> from cw_bd_record_batch where ID = #{id,jdbcType=VARCHAR} </select> <delete id="deleteByPrimaryKey" parameterType="java.lang.String"> delete from cw_bd_record_batch where ID = #{id,jdbcType=VARCHAR} </delete> <delete id="deleteByExample" parameterType="com.dhcc.finance.main.domain.CwBdRecordBatchExample"> delete from cw_bd_record_batch <if test="_parameter != null"> <include refid="Example_Where_Clause" /> </if> </delete> <insert id="insert" parameterType="com.dhcc.finance.main.domain.CwBdRecordBatch"> insert into cw_bd_record_batch (ID, INITIATE_USE, INITIATE_TIME, PROJECT_CODE, PROJECT_NAME, BATCH_NO, TRADECODE, PREPAREDATE, INST_ID, SIGN_TYPE, FAIL_REASON, USE_STATE, CREATE_USER, CREATE_TIME, UPDATE_USER, UPDATE_TIME, REMARK) values (#{id,jdbcType=VARCHAR}, #{initiateUse,jdbcType=VARCHAR}, #{initiateTime,jdbcType=TIMESTAMP}, #{projectCode,jdbcType=VARCHAR}, #{projectName,jdbcType=VARCHAR}, #{batchNo,jdbcType=VARCHAR}, #{tradecode,jdbcType=VARCHAR}, #{preparedate,jdbcType=TIMESTAMP}, #{instId,jdbcType=VARCHAR}, #{signType,jdbcType=VARCHAR}, #{failReason,jdbcType=VARCHAR}, #{useState,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateUser,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{remark,jdbcType=VARCHAR}) </insert> <insert id="insertSelective" parameterType="com.dhcc.finance.main.domain.CwBdRecordBatch"> insert into cw_bd_record_batch <trim prefix="(" suffix=")" suffixOverrides=","> <if test="id != null"> ID, </if> <if test="initiateUse != null"> INITIATE_USE, </if> <if test="initiateTime != null"> INITIATE_TIME, </if> <if test="projectCode != null"> PROJECT_CODE, </if> <if test="projectName != null"> PROJECT_NAME, </if> <if test="batchNo != null"> BATCH_NO, </if> <if test="tradecode != null"> TRADECODE, </if> <if test="preparedate != null"> PREPAREDATE, </if> <if test="instId != null"> INST_ID, </if> <if test="signType != null"> SIGN_TYPE, </if> <if test="failReason != null"> FAIL_REASON, </if> <if test="useState != null"> USE_STATE, </if> <if test="createUser != null"> CREATE_USER, </if> <if test="createTime != null"> CREATE_TIME, </if> <if test="updateUser != null"> UPDATE_USER, </if> <if test="updateTime != null"> UPDATE_TIME, </if> <if test="remark != null"> REMARK, </if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="id != null"> #{id,jdbcType=VARCHAR}, </if> <if test="initiateUse != null"> #{initiateUse,jdbcType=VARCHAR}, </if> <if test="initiateTime != null"> #{initiateTime,jdbcType=TIMESTAMP}, </if> <if test="projectCode != null"> #{projectCode,jdbcType=VARCHAR}, </if> <if test="projectName != null"> #{projectName,jdbcType=VARCHAR}, </if> <if test="batchNo != null"> #{batchNo,jdbcType=VARCHAR}, </if> <if test="tradecode != null"> #{tradecode,jdbcType=VARCHAR}, </if> <if test="preparedate != null"> #{preparedate,jdbcType=TIMESTAMP}, </if> <if test="instId != null"> #{instId,jdbcType=VARCHAR}, </if> <if test="signType != null"> #{signType,jdbcType=VARCHAR}, </if> <if test="failReason != null"> #{failReason,jdbcType=VARCHAR}, </if> <if test="useState != null"> #{useState,jdbcType=VARCHAR}, </if> <if test="createUser != null"> #{createUser,jdbcType=VARCHAR}, </if> <if test="createTime != null"> #{createTime,jdbcType=TIMESTAMP}, </if> <if test="updateUser != null"> #{updateUser,jdbcType=VARCHAR}, </if> <if test="updateTime != null"> #{updateTime,jdbcType=TIMESTAMP}, </if> <if test="remark != null"> #{remark,jdbcType=VARCHAR}, </if> </trim> </insert> <select id="countByExample" parameterType="com.dhcc.finance.main.domain.CwBdRecordBatchExample" resultType="java.lang.Long"> select count(*) from cw_bd_record_batch <if test="_parameter != null"> <include refid="Example_Where_Clause" /> </if> </select> <update id="updateByExampleSelective" parameterType="map"> update cw_bd_record_batch <set> <if test="record.id != null"> ID = #{record.id,jdbcType=VARCHAR}, </if> <if test="record.initiateUse != null"> INITIATE_USE = #{record.initiateUse,jdbcType=VARCHAR}, </if> <if test="record.initiateTime != null"> INITIATE_TIME = #{record.initiateTime,jdbcType=TIMESTAMP}, </if> <if test="record.projectCode != null"> PROJECT_CODE = #{record.projectCode,jdbcType=VARCHAR}, </if> <if test="record.projectName != null"> PROJECT_NAME = #{record.projectName,jdbcType=VARCHAR}, </if> <if test="record.batchNo != null"> BATCH_NO = #{record.batchNo,jdbcType=VARCHAR}, </if> <if test="record.tradecode != null"> TRADECODE = #{record.tradecode,jdbcType=VARCHAR}, </if> <if test="record.preparedate != null"> PREPAREDATE = #{record.preparedate,jdbcType=TIMESTAMP}, </if> <if test="record.instId != null"> INST_ID = #{record.instId,jdbcType=VARCHAR}, </if> <if test="record.signType != null"> SIGN_TYPE = #{record.signType,jdbcType=VARCHAR}, </if> <if test="record.failReason != null"> FAIL_REASON = #{record.failReason,jdbcType=VARCHAR}, </if> <if test="record.useState != null"> USE_STATE = #{record.useState,jdbcType=VARCHAR}, </if> <if test="record.createUser != null"> CREATE_USER = #{record.createUser,jdbcType=VARCHAR}, </if> <if test="record.createTime != null"> CREATE_TIME = #{record.createTime,jdbcType=TIMESTAMP}, </if> <if test="record.updateUser != null"> UPDATE_USER = #{record.updateUser,jdbcType=VARCHAR}, </if> <if test="record.updateTime != null"> UPDATE_TIME = #{record.updateTime,jdbcType=TIMESTAMP}, </if> <if test="record.remark != null"> REMARK = #{record.remark,jdbcType=VARCHAR}, </if> </set> <if test="_parameter != null"> <include refid="Update_By_Example_Where_Clause" /> </if> </update> <update id="updateByExample" parameterType="map"> update cw_bd_record_batch set ID = #{record.id,jdbcType=VARCHAR}, INITIATE_USE = #{record.initiateUse,jdbcType=VARCHAR}, INITIATE_TIME = #{record.initiateTime,jdbcType=TIMESTAMP}, PROJECT_CODE = #{record.projectCode,jdbcType=VARCHAR}, PROJECT_NAME = #{record.projectName,jdbcType=VARCHAR}, BATCH_NO = #{record.batchNo,jdbcType=VARCHAR}, TRADECODE = #{record.tradecode,jdbcType=VARCHAR}, PREPAREDATE = #{record.preparedate,jdbcType=TIMESTAMP}, INST_ID = #{record.instId,jdbcType=VARCHAR}, SIGN_TYPE = #{record.signType,jdbcType=VARCHAR}, FAIL_REASON = #{record.failReason,jdbcType=VARCHAR}, USE_STATE = #{record.useState,jdbcType=VARCHAR}, CREATE_USER = #{record.createUser,jdbcType=VARCHAR}, CREATE_TIME = #{record.createTime,jdbcType=TIMESTAMP}, UPDATE_USER = #{record.updateUser,jdbcType=VARCHAR}, UPDATE_TIME = #{record.updateTime,jdbcType=TIMESTAMP}, REMARK = #{record.remark,jdbcType=VARCHAR} <if test="_parameter != null"> <include refid="Update_By_Example_Where_Clause" /> </if> </update> <update id="updateByPrimaryKeySelective" parameterType="com.dhcc.finance.main.domain.CwBdRecordBatch"> update cw_bd_record_batch <set> <if test="initiateUse != null"> INITIATE_USE = #{initiateUse,jdbcType=VARCHAR}, </if> <if test="initiateTime != null"> INITIATE_TIME = #{initiateTime,jdbcType=TIMESTAMP}, </if> <if test="projectCode != null"> PROJECT_CODE = #{projectCode,jdbcType=VARCHAR}, </if> <if test="projectName != null"> PROJECT_NAME = #{projectName,jdbcType=VARCHAR}, </if> <if test="batchNo != null"> BATCH_NO = #{batchNo,jdbcType=VARCHAR}, </if> <if test="tradecode != null"> TRADECODE = #{tradecode,jdbcType=VARCHAR}, </if> <if test="preparedate != null"> PREPAREDATE = #{preparedate,jdbcType=TIMESTAMP}, </if> <if test="instId != null"> INST_ID = #{instId,jdbcType=VARCHAR}, </if> <if test="signType != null"> SIGN_TYPE = #{signType,jdbcType=VARCHAR}, </if> <if test="failReason != null"> FAIL_REASON = #{failReason,jdbcType=VARCHAR}, </if> <if test="useState != null"> USE_STATE = #{useState,jdbcType=VARCHAR}, </if> <if test="createUser != null"> CREATE_USER = #{createUser,jdbcType=VARCHAR}, </if> <if test="createTime != null"> CREATE_TIME = #{createTime,jdbcType=TIMESTAMP}, </if> <if test="updateUser != null"> UPDATE_USER = #{updateUser,jdbcType=VARCHAR}, </if> <if test="updateTime != null"> UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP}, </if> <if test="remark != null"> REMARK = #{remark,jdbcType=VARCHAR}, </if> </set> where ID = #{id,jdbcType=VARCHAR} </update> <update id="updateByPrimaryKey" parameterType="com.dhcc.finance.main.domain.CwBdRecordBatch"> update cw_bd_record_batch set INITIATE_USE = #{initiateUse,jdbcType=VARCHAR}, INITIATE_TIME = #{initiateTime,jdbcType=TIMESTAMP}, PROJECT_CODE = #{projectCode,jdbcType=VARCHAR}, PROJECT_NAME = #{projectName,jdbcType=VARCHAR}, BATCH_NO = #{batchNo,jdbcType=VARCHAR}, TRADECODE = #{tradecode,jdbcType=VARCHAR}, PREPAREDATE = #{preparedate,jdbcType=TIMESTAMP}, INST_ID = #{instId,jdbcType=VARCHAR}, SIGN_TYPE = #{signType,jdbcType=VARCHAR}, FAIL_REASON = #{failReason,jdbcType=VARCHAR}, USE_STATE = #{useState,jdbcType=VARCHAR}, CREATE_USER = #{createUser,jdbcType=VARCHAR}, CREATE_TIME = #{createTime,jdbcType=TIMESTAMP}, UPDATE_USER = #{updateUser,jdbcType=VARCHAR}, UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP}, REMARK = #{remark,jdbcType=VARCHAR} where ID = #{id,jdbcType=VARCHAR} </update> <!-- 根据批次号更新是否记账 --> <update id="updateRecordBybatchNo" parameterType="com.dhcc.finance.main.domain.CwBdRecordBatch"> update cw_bd_record_batch <set> <if test="initiateUse != null"> INITIATE_USE = #{initiateUse,jdbcType=VARCHAR}, </if> <if test="initiateTime != null"> INITIATE_TIME = #{initiateTime,jdbcType=TIMESTAMP}, </if> <if test="projectCode != null"> PROJECT_CODE = #{projectCode,jdbcType=VARCHAR}, </if> <if test="projectName != null"> PROJECT_NAME = #{projectName,jdbcType=VARCHAR}, </if> <if test="preparedate != null"> PREPAREDATE = #{preparedate,jdbcType=TIMESTAMP}, </if> <if test="signType != null"> SIGN_TYPE = #{signType,jdbcType=VARCHAR}, </if> <if test="failReason != null"> FAIL_REASON = #{failReason,jdbcType=VARCHAR}, </if> <if test="useState != null"> USE_STATE = #{useState,jdbcType=VARCHAR}, </if> <if test="createUser != null"> CREATE_USER = #{createUser,jdbcType=VARCHAR}, </if> <if test="createTime != null"> CREATE_TIME = #{createTime,jdbcType=TIMESTAMP}, </if> <if test="updateUser != null"> UPDATE_USER = #{updateUser,jdbcType=VARCHAR}, </if> <if test="updateTime != null"> UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP}, </if> <if test="remark != null"> REMARK = #{remark,jdbcType=VARCHAR}, </if> </set> where BATCH_NO = #{batchNo,jdbcType=VARCHAR} and TRADECODE = #{tradecode,jdbcType=VARCHAR} </update> <!-- 查询所有批次信息 --> <select id="selectCwBdRecordBatchList" resultMap="BaseResultMap"> select ID, INITIATE_USE, INITIATE_TIME, PROJECT_CODE, PROJECT_NAME, BATCH_NO,TRADECODE,PREPAREDATE, SIGN_TYPE, FAIL_REASON, USE_STATE, CREATE_USER, CREATE_TIME, UPDATE_USER, UPDATE_TIME, REMARK from (select ID,(select USER_NAME FROM sys_user_info b WHERE b.USER_ID = a.INITIATE_USE ) INITIATE_USE, INITIATE_TIME, PROJECT_CODE, case when (select XTZXMQC from pm_project_child b where b.XTZXMBH= a.PROJECT_CODE ) is null then '无' else (select XTZXMQC from pm_project_child b where b.XTZXMBH= a.PROJECT_CODE ) end as PROJECT_NAME, BATCH_NO, TRADECODE,PREPAREDATE,SIGN_TYPE, FAIL_REASON, USE_STATE, CREATE_USER, CREATE_TIME, UPDATE_USER, UPDATE_TIME, REMARK from cw_bd_record_batch a) cbrb where cbrb.USE_STATE= "1" <if test="signType!=null"> and cbrb.SIGN_TYPE = #{signType,jdbcType=VARCHAR} </if> <if test="batchNo!=null"> and cbrb.BATCH_NO like "%"#{batchNo,jdbcType=VARCHAR}"%" </if> <if test="failReason!=null"> and cbrb.FAIL_REASON like "%"#{failReason,jdbcType=VARCHAR}"%" </if> <if test="tradeCode!=null"> and cbrb.TRADECODE like "%"#{tradeCode,jdbcType=VARCHAR}"%" </if> <if test="xtzxmbh!=null"> and cbrb.PROJECT_CODE like "%"#{xtzxmbh,jdbcType=VARCHAR}"%" </if> order by cbrb.INITIATE_TIME desc </select> <!-- 查询当前批次号和交易码是否存在 --> <select id="searchBatchIsExistOfCount" resultMap="BaseResultMap"> select <include refid="Base_Column_List" /> from cw_bd_record_batch where BATCH_NO = #{batchNo,jdbcType=VARCHAR} and TRADECODE =#{tradeCode,jdbcType=VARCHAR} </select> <!-- 查询批次号信息 --> <select id="searchCwBdRecordBatchByBatchNo" resultMap="BaseResultMap"> select ID, INITIATE_USE, INITIATE_TIME, PROJECT_CODE, PROJECT_NAME, BATCH_NO,TRADECODE,PREPAREDATE, SIGN_TYPE, FAIL_REASON, USE_STATE, CREATE_USER, CREATE_TIME, UPDATE_USER, UPDATE_TIME, REMARK from (select ID,(select USER_NAME FROM sys_user_info b WHERE b.USER_ID = a.INITIATE_USE ) INITIATE_USE, INITIATE_TIME, PROJECT_CODE, case when (select XTZXMQC from pm_project_child b where b.XTZXMBH= a.PROJECT_CODE ) is null then '无' else (select XTZXMQC from pm_project_child b where b.XTZXMBH= a.PROJECT_CODE ) end as PROJECT_NAME, BATCH_NO, TRADECODE,PREPAREDATE,SIGN_TYPE, FAIL_REASON, USE_STATE, CREATE_USER, CREATE_TIME, UPDATE_USER, UPDATE_TIME, REMARK from cw_bd_record_batch a) cbrb where cbrb.USE_STATE= "1" and cbrb.BATCH_NO=#{batchNo,jdbcType=VARCHAR} order by cbrb.INITIATE_TIME desc </select> </mapper>