|  |  |  | 
|---|
|  |  |  | <result column="last_operate_time" jdbcType="TIMESTAMP" property="lastOperateTime" /> | 
|---|
|  |  |  | <result column="in_use" jdbcType="TINYINT" property="inUse" /> | 
|---|
|  |  |  | <result column="intake_id" jdbcType="BIGINT" property="intakeId" /> | 
|---|
|  |  |  | <result column="open_time" jdbcType="TIMESTAMP" property="openTime" /> | 
|---|
|  |  |  | <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | 
|---|
|  |  |  | </resultMap> | 
|---|
|  |  |  | <sql id="Base_Column_List"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | id, vc_num, client_id, money, state, last_operate, last_operate_time, in_use, intake_id, create_time | 
|---|
|  |  |  | id, vc_num, client_id, money, state, last_operate, last_operate_time, in_use, intake_id, open_time, create_time | 
|---|
|  |  |  | </sql> | 
|---|
|  |  |  | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | insert into se_virtual_card (id, vc_num, client_id, | 
|---|
|  |  |  | money, state, last_operate, last_operate_time, | 
|---|
|  |  |  | in_use, intake_id, create_time) | 
|---|
|  |  |  | in_use, intake_id, open_time, create_time) | 
|---|
|  |  |  | values (#{id,jdbcType=BIGINT}, #{vcNum,jdbcType=BIGINT}, #{clientId,jdbcType=BIGINT}, | 
|---|
|  |  |  | #{money,jdbcType=FLOAT}, #{state,jdbcType=TINYINT}, #{lastOperate,jdbcType=TINYINT}, #{lastOperateTime,jdbcType=TIMESTAMP}, | 
|---|
|  |  |  | #{inUse,jdbcType=TINYINT}, #{intakeId,jdbcType=BIGINT},#{createTime,jdbcType=TIMESTAMP}) | 
|---|
|  |  |  | #{inUse,jdbcType=TINYINT}, #{intakeId,jdbcType=BIGINT},#{openTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP}) | 
|---|
|  |  |  | </insert> | 
|---|
|  |  |  | <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeVirtualCard"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | 
|---|
|  |  |  | <if test="intakeId != null"> | 
|---|
|  |  |  | intake_id, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="openTime != null"> | 
|---|
|  |  |  | open_time, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="createTime != null"> | 
|---|
|  |  |  | create_time, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="intakeId != null"> | 
|---|
|  |  |  | #{intakeId,jdbcType=BIGINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="openTime != null"> | 
|---|
|  |  |  | #{openTime,jdbcType=TIMESTAMP}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="createTime != null"> | 
|---|
|  |  |  | #{createTime,jdbcType=TIMESTAMP}, | 
|---|
|  |  |  | 
|---|
|  |  |  | <if test="intakeId != null"> | 
|---|
|  |  |  | intake_id = #{intakeId,jdbcType=BIGINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="openTime != null"> | 
|---|
|  |  |  | open_time = #{openTime,jdbcType=TIMESTAMP}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="createTime != null"> | 
|---|
|  |  |  | create_time = #{createTime,jdbcType=TIMESTAMP}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | 
|---|
|  |  |  | last_operate_time = #{lastOperateTime,jdbcType=TIMESTAMP}, | 
|---|
|  |  |  | in_use = #{inUse,jdbcType=TINYINT}, | 
|---|
|  |  |  | intake_id = #{intakeId,jdbcType=BIGINT}, | 
|---|
|  |  |  | open_time = #{openTime,jdbcType=TIMESTAMP}, | 
|---|
|  |  |  | create_time = #{createTime,jdbcType=TIMESTAMP} | 
|---|
|  |  |  | where id = #{id,jdbcType=BIGINT} | 
|---|
|  |  |  | </update> | 
|---|
|  |  |  | <update id="updateVcCardNoUseStateByIntakeId" parameterType="java.lang.Long"> | 
|---|
|  |  |  | <update id="updateVcCardNoUseStateByIntakeId"> | 
|---|
|  |  |  | update se_virtual_card | 
|---|
|  |  |  | set in_use = 0, | 
|---|
|  |  |  | intake_id = null | 
|---|
|  |  |  | where intake_id = #{intakeId,jdbcType=BIGINT} | 
|---|
|  |  |  | where intake_id = #{intakeId,jdbcType=BIGINT} and open_time < #{now,jdbcType=TIMESTAMP} | 
|---|
|  |  |  | </update> | 
|---|
|  |  |  | <update id="updateMoney" > | 
|---|
|  |  |  | update se_virtual_card | 
|---|
|  |  |  | 
|---|
|  |  |  | SELECT | 
|---|
|  |  |  | id, | 
|---|
|  |  |  | vc_num AS vcNum, | 
|---|
|  |  |  | <!--      ROUND(money / 100, 2) AS money,--> | 
|---|
|  |  |  | money, | 
|---|
|  |  |  | in_use AS inUse, | 
|---|
|  |  |  | (CASE | 
|---|
|  |  |  | 
|---|
|  |  |  | SELECT | 
|---|
|  |  |  | id, | 
|---|
|  |  |  | vc_num AS vcNum, | 
|---|
|  |  |  | <!--        ROUND(money / 100,2) AS money,--> | 
|---|
|  |  |  | money, | 
|---|
|  |  |  | in_use AS inUse, | 
|---|
|  |  |  | (CASE | 
|---|
|  |  |  | 
|---|
|  |  |  | SELECT id FROM se_virtual_card WHERE state = 1 AND vc_num = #{vcNum} | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!--根据虚拟卡编号获取虚拟卡ID--> | 
|---|
|  |  |  | <!--根据虚拟卡编号获取农户id、姓名、地址--> | 
|---|
|  |  |  | <select id="getClientIdAndNameByVsCardNo" resultType="java.util.Map"> | 
|---|
|  |  |  | SELECT | 
|---|
|  |  |  | cli.id AS clientId, | 
|---|
|  |  |  | cli.name AS clientName | 
|---|
|  |  |  | cli.name AS clientName, | 
|---|
|  |  |  | cli.address AS clientAddress | 
|---|
|  |  |  | FROM se_virtual_card card | 
|---|
|  |  |  | INNER JOIN se_client cli ON card.client_id = cli.id | 
|---|
|  |  |  | WHERE card.state = 1 AND card.vc_num = #{vcNum} | 
|---|