<?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.CwBdManualSerialMapper"> <resultMap id="BaseResultMap" type="com.dhcc.finance.main.domain.CwBdManualSerial"> <id column="ID" jdbcType="VARCHAR" property="id" /> <result column="BATCH_NO" jdbcType="VARCHAR" property="batchNo" /> <result column="PK_VOUCHER" jdbcType="VARCHAR" property="pkVoucher" /> <result column="PROJECT_CODE" jdbcType="VARCHAR" property="projectCode" /> <result column="PROJECT_NAME" jdbcType="VARCHAR" property="projectName" /> <result column="SUB_PROJECT_CODE" jdbcType="VARCHAR" property="subProjectCode" /> <result column="SUB_PROJECT_NAME" jdbcType="VARCHAR" property="subProjectName" /> <result column="SUBJCODE" jdbcType="VARCHAR" property="subjcode" /> <result column="VOUCHER_TYPE" jdbcType="VARCHAR" property="voucherType" /> <result column="VOUCHER_AMOUNT" jdbcType="DECIMAL" property="voucherAmount" /> <result column="LOAN_AMOUNT" jdbcType="DECIMAL" property="loanAmount" /> <result column="STAMP_DUTY" jdbcType="DECIMAL" property="stampDuty" /> <result column="INTEREST" jdbcType="DECIMAL" property="interest" /> <result column="IMPORT_DATE" jdbcType="DATE" property="importDate" /> <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> <resultMap id="BaseResultWebMap" type="com.dhcc.finance.main.model.CwBdManualSerialWeb"> <id column="ID" jdbcType="VARCHAR" property="id" /> <result column="BATCH_NO" jdbcType="VARCHAR" property="batchNo" /> <result column="PK_VOUCHER" jdbcType="VARCHAR" property="pkVoucher" /> <result column="PROJECT_CODE" jdbcType="VARCHAR" property="projectCode" /> <result column="PROJECT_NAME" jdbcType="VARCHAR" property="projectName" /> <result column="SUB_PROJECT_CODE" jdbcType="VARCHAR" property="subProjectCode" /> <result column="SUB_PROJECT_NAME" jdbcType="VARCHAR" property="subProjectName" /> <result column="SUBJCODE" jdbcType="VARCHAR" property="subjcode" /> <result column="VOUCHER_TYPE" jdbcType="VARCHAR" property="voucherType" /> <result column="VOUCHER_AMOUNT" jdbcType="DECIMAL" property="voucherAmount" /> <result column="IMPORT_DATE" jdbcType="DATE" property="importDate" /> <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" /> <result column="SERIAL_NO" jdbcType="VARCHAR" property="serialNo" /> </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, BATCH_NO, PROJECT_CODE, PROJECT_NAME, SUB_PROJECT_CODE, SUB_PROJECT_NAME, SUBJCODE, VOUCHER_TYPE, VOUCHER_AMOUNT,LOAN_AMOUNT, STAMP_DUTY, INTEREST, IMPORT_DATE, USE_STATE, CREATE_USER, CREATE_TIME, UPDATE_USER, UPDATE_TIME, REMARK </sql> <select id="selectByExample" parameterType="com.dhcc.finance.main.domain.CwBdManualSerialExample" resultMap="BaseResultMap"> select <if test="distinct"> distinct </if> <include refid="Base_Column_List" /> from cw_bd_manual_serial <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_manual_serial where ID = #{id,jdbcType=VARCHAR} </select> <delete id="deleteByPrimaryKey" parameterType="java.lang.String"> delete from cw_bd_manual_serial where ID = #{id,jdbcType=VARCHAR} </delete> <delete id="deleteByExample" parameterType="com.dhcc.finance.main.domain.CwBdManualSerialExample"> delete from cw_bd_manual_serial <if test="_parameter != null"> <include refid="Example_Where_Clause" /> </if> </delete> <insert id="insert" parameterType="com.dhcc.finance.main.domain.CwBdManualSerial"> insert into cw_bd_manual_serial (ID, BATCH_NO, PROJECT_CODE, PROJECT_NAME, SUB_PROJECT_CODE, SUB_PROJECT_NAME, SUBJCODE, VOUCHER_TYPE,VOUCHER_AMOUNT, LOAN_AMOUNT, STAMP_DUTY, INTEREST, IMPORT_DATE, USE_STATE, CREATE_USER, CREATE_TIME, UPDATE_USER, UPDATE_TIME, REMARK) values (#{id,jdbcType=VARCHAR}, #{batchNo,jdbcType=VARCHAR}, #{projectCode,jdbcType=VARCHAR}, #{projectName,jdbcType=VARCHAR}, #{subProjectCode,jdbcType=VARCHAR}, #{subProjectName,jdbcType=VARCHAR}, #{subjcode,jdbcType=VARCHAR}, #{voucherType,jdbcType=VARCHAR}, #{voucherAmount,jdbcType=DECIMAL}, #{loanAmount,jdbcType=DECIMAL}, #{stampDuty,jdbcType=DECIMAL}, #{interest,jdbcType=DECIMAL}, #{importDate,jdbcType=DATE}, #{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.CwBdManualSerial"> insert into cw_bd_manual_serial <trim prefix="(" suffix=")" suffixOverrides=","> <if test="id != null"> ID, </if> <if test="batchNo != null"> BATCH_NO, </if> <if test="projectCode != null"> PROJECT_CODE, </if> <if test="projectName != null"> PROJECT_NAME, </if> <if test="subProjectCode != null"> SUB_PROJECT_CODE, </if> <if test="subProjectName != null"> SUB_PROJECT_NAME, </if> <if test="subjcode != null"> SUBJCODE, </if> <if test="voucherType != null"> VOUCHER_TYPE, </if> <if test="voucherAmount != null"> VOUCHER_AMOUNT, </if> <if test="loanAmount != null"> LOAN_AMOUNT, </if> <if test="stampDuty != null"> STAMP_DUTY, </if> <if test="interest != null"> INTEREST, </if> <if test="importDate != null"> IMPORT_DATE, </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="batchNo != null"> #{batchNo,jdbcType=VARCHAR}, </if> <if test="projectCode != null"> #{projectCode,jdbcType=VARCHAR}, </if> <if test="projectName != null"> #{projectName,jdbcType=VARCHAR}, </if> <if test="subProjectCode != null"> #{subProjectCode,jdbcType=VARCHAR}, </if> <if test="subProjectName != null"> #{subProjectName,jdbcType=VARCHAR}, </if> <if test="subjcode != null"> #{subjcode,jdbcType=VARCHAR}, </if> <if test="voucherType != null"> #{voucherType,jdbcType=VARCHAR}, </if> <if test="voucherAmount != null"> #{voucherAmount,jdbcType=DECIMAL}, </if> <if test="loanAmount != null"> #{loanAmount,jdbcType=DECIMAL}, </if> <if test="stampDuty != null"> #{stampDuty,jdbcType=DECIMAL}, </if> <if test="interest != null"> #{interest,jdbcType=DECIMAL}, </if> <if test="importDate != null"> #{importDate,jdbcType=DATE}, </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.CwBdManualSerialExample" resultType="java.lang.Long"> select count(*) from cw_bd_manual_serial <if test="_parameter != null"> <include refid="Example_Where_Clause" /> </if> </select> <update id="updateByExampleSelective" parameterType="map"> update cw_bd_manual_serial <set> <if test="record.id != null"> ID = #{record.id,jdbcType=VARCHAR}, </if> <if test="record.batchNo != null"> BATCH_NO = #{record.batchNo,jdbcType=VARCHAR}, </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.subProjectCode != null"> PROJECT_CODE = #{record.subProjectCode,jdbcType=VARCHAR}, </if> <if test="record.subProjectName != null"> PROJECT_NAME = #{record.subProjectName,jdbcType=VARCHAR}, </if> <if test="record.subjcode != null"> SUBJCODE = #{record.subjcode,jdbcType=VARCHAR}, </if> <if test="record.voucherType != null"> VOUCHER_TYPE = #{record.voucherType,jdbcType=VARCHAR}, </if> <if test="record.voucherAmount != null"> VOUCHER_AMOUNT = #{record.voucherAmount,jdbcType=DECIMAL}, </if> <if test="record.loanAmount != null"> LOAN_AMOUNT = #{record.loanAmount,jdbcType=DECIMAL}, </if> <if test="record.stampDuty != null"> STAMP_DUTY = #{record.stampDuty,jdbcType=DECIMAL}, </if> <if test="record.interest != null"> INTEREST = #{record.interest,jdbcType=DECIMAL}, </if> <if test="record.importDate != null"> IMPORT_DATE = #{record.importDate,jdbcType=DATE}, </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_manual_serial set ID = #{record.id,jdbcType=VARCHAR}, BATCH_NO = #{record.batchNo,jdbcType=VARCHAR}, PROJECT_CODE = #{record.projectCode,jdbcType=VARCHAR}, PROJECT_NAME = #{record.projectName,jdbcType=VARCHAR}, SUB_PROJECT_CODE = #{record.subProjectCode,jdbcType=VARCHAR}, SUB_PROJECT_NAME = #{record.subProjectName,jdbcType=VARCHAR}, SUBJCODE = #{record.subjcode,jdbcType=VARCHAR}, VOUCHER_TYPE = #{record.voucherType,jdbcType=VARCHAR}, VOUCHER_AMOUNT = #{record.voucherAmount,jdbcType=DECIMAL}, LOAN_AMOUNT = #{record.loanAmount,jdbcType=DECIMAL}, STAMP_DUTY = #{record.stampDuty,jdbcType=DECIMAL}, INTEREST = #{record.interest,jdbcType=DECIMAL}, IMPORT_DATE = #{record.importDate,jdbcType=DATE}, 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.CwBdManualSerial"> update cw_bd_manual_serial <set> <if test="batchNo != null"> BATCH_NO = #{batchNo,jdbcType=VARCHAR}, </if> <if test="projectCode != null"> PROJECT_CODE = #{projectCode,jdbcType=VARCHAR}, </if> <if test="projectName != null"> PROJECT_NAME = #{projectName,jdbcType=VARCHAR}, </if> <if test="subProjectCode != null"> PROJECT_CODE = #{subProjectCode,jdbcType=VARCHAR}, </if> <if test="subProjectName != null"> PROJECT_NAME = #{subProjectName,jdbcType=VARCHAR}, </if> <if test="subjcode != null"> SUBJCODE = #{subjcode,jdbcType=VARCHAR}, </if> <if test="voucherType != null"> VOUCHER_TYPE = #{voucherType,jdbcType=VARCHAR}, </if> <if test="voucherAmount != null"> VOUCHER_AMOUNT = #{voucherAmount,jdbcType=DECIMAL}, </if> <if test="loanAmount != null"> LOAN_AMOUNT = #{loanAmount,jdbcType=DECIMAL}, </if> <if test="stampDuty != null"> STAMP_DUTY = #{stampDuty,jdbcType=DECIMAL}, </if> <if test="interest != null"> INTEREST = #{interest,jdbcType=DECIMAL}, </if> <if test="importDate != null"> IMPORT_DATE = #{importDate,jdbcType=DATE}, </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.CwBdManualSerial"> update cw_bd_manual_serial set BATCH_NO = #{batchNo,jdbcType=VARCHAR}, PROJECT_CODE = #{projectCode,jdbcType=VARCHAR}, PROJECT_NAME = #{projectName,jdbcType=VARCHAR}, SUB_PROJECT_CODE = #{subProjectCode,jdbcType=VARCHAR}, SUB_PROJECT_NAME = #{subProjectName,jdbcType=VARCHAR}, SUBJCODE = #{subjcode,jdbcType=VARCHAR}, VOUCHER_TYPE = #{voucherType,jdbcType=VARCHAR}, VOUCHER_AMOUNT = #{voucherAmount,jdbcType=DECIMAL}, LOAN_AMOUNT = #{loanAmount,jdbcType=DECIMAL}, STAMP_DUTY = #{stampDuty,jdbcType=DECIMAL}, INTEREST = #{interest,jdbcType=DECIMAL}, IMPORT_DATE = #{importDate,jdbcType=DATE}, 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> <select id="selectAll" resultMap="BaseResultMap"> select distinct temp.BATCH_NO,getVoucherType(temp.BATCH_NO) as VOUCHER_TYPE,IMPORT_DATE,temp.CREATE_USER,getPkVoucher(temp.BATCH_NO) as PK_VOUCHER from (select BATCH_NO,VOUCHER_TYPE,IMPORT_DATE,USE_STATE, (select USER_NAME from sys_user_info b where b.USER_ID = a.CREATE_USER) as CREATE_USER from cw_bd_manual_serial a where USE_STATE = 1 <if test="voucherType != null and voucherType !=''"> and VOUCHER_TYPE = #{voucherType,jdbcType=VARCHAR} </if> <if test="importDate != null and importDate !=''"> and IMPORT_DATE = #{importDate,jdbcType=DATE} </if> <if test="createUser != null and createUser !=''"> and CREATE_USER = #{createUser,jdbcType=VARCHAR} </if> group by BATCH_NO )temp </select> <select id="selectDataDetail" resultMap="BaseResultMap"> select distinct c.ID, c.BATCH_NO, c.PROJECT_CODE, c.PROJECT_NAME, c.SUB_PROJECT_CODE, c.SUB_PROJECT_NAME, SUBJCODE, VOUCHER_TYPE, VOUCHER_AMOUNT, LOAN_AMOUNT, STAMP_DUTY, INTEREST, IMPORT_DATE, c.USE_STATE, c.CREATE_USER, c.CREATE_TIME, c.UPDATE_USER, c.UPDATE_TIME, c.REMARK,PK_VOUCHER from cw_bd_manual_serial c left join cw_bd_record_serial rs on c.ID = rs.SERIAL_NO where c.USE_STATE = 1 <if test="batchNo != null and batchNo != ''"> and c.BATCH_NO = #{batchNo,jdbcType=VARCHAR} </if> <if test="subjcode != null and subjcode != ''"> and c.SUBJCODE = #{subjcode,jdbcType=VARCHAR} </if> <if test="projectCode != null and projectCode !=''"> and PROJECT_CODE = #{projectCode,jdbcType=VARCHAR} </if> <if test="subProjectCode != null and subProjectCode !=''"> and SUB_PROJECT_CODE = #{subProjectCode,jdbcType=VARCHAR} </if> <if test="pkVoucher != null and pkVoucher != ''"> and PK_VOUCHER = #{pkVoucher,jdbcType=VARCHAR} </if> order by c.BATCH_NO </select> <insert id="importBatchVoucherInfo" parameterType="java.util.List"> insert into cw_bd_manual_serial (ID, BATCH_NO, PROJECT_CODE, PROJECT_NAME, SUB_PROJECT_CODE, SUB_PROJECT_NAME, SUBJCODE, VOUCHER_TYPE, VOUCHER_AMOUNT, IMPORT_DATE, USE_STATE, CREATE_USER, CREATE_TIME) values <foreach collection="list" item="item" index="index" separator=","> (#{item.id,jdbcType=VARCHAR}, #{item.batchNo,jdbcType=VARCHAR}, #{item.projectCode,jdbcType=VARCHAR}, #{item.projectName,jdbcType=VARCHAR}, #{item.subProjectCode,jdbcType=VARCHAR}, #{item.subProjectName,jdbcType=VARCHAR}, #{item.subjcode,jdbcType=VARCHAR}, #{item.voucherType,jdbcType=VARCHAR}, #{item.voucherAmount,jdbcType=DECIMAL}, #{item.importDate,jdbcType=DATE}, #{item.useState,jdbcType=VARCHAR}, #{item.createUser,jdbcType=VARCHAR}, #{item.createTime,jdbcType=TIMESTAMP}) </foreach> </insert> </mapper>