Administrator
2023-12-26 a40eed2a4d81d27d252823a18529f072af56579c
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientCardMapper.xml
@@ -6,6 +6,7 @@
    <!--@Table se_client_card-->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="cardAddr" jdbcType="VARCHAR" property="cardaddr" />
    <result column="cardNum" jdbcType="BIGINT" property="cardnum" />
    <result column="clientId" jdbcType="BIGINT" property="clientid" />
    <result column="money" jdbcType="FLOAT" property="money" />
    <result column="state" jdbcType="TINYINT" property="state" />
@@ -22,8 +23,8 @@
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, cardAddr, clientId, money, `state`, createDt, replaceDt, rechargeDt, lossDtDt,
    cancelDt, unlockDt, reversalDt, consumeDt, lastOper, remarks
    id, cardAddr, cardNum, clientId, money, `state`, createDt, replaceDt, rechargeDt,
    lossDtDt, cancelDt, unlockDt, reversalDt, consumeDt, lastOper, remarks
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--@mbg.generated-->
@@ -38,23 +39,53 @@
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <!--依据水卡地址获取水卡编号(主键)-->
  <!--依据水卡地址获取水卡编号(12月19日废弃)-->
  <select id="getCardIdByAddr" resultType="java.lang.Long">
    SELECT id AS cardId FROM se_client_card WHERE cardAddr = #{cardAddr}
  </select>
  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.dy.pipIrrGlobal.pojoSe.SeClientCard" useGeneratedKeys="true">
  <!--根据水卡编号获取水卡表主键(12月19日添加后废弃)-->
  <select id="getCardIdByNum" resultType="java.lang.Long">
    SELECT id AS cardId FROM se_client_card WHERE cardNum = #{cardNum}
  </select>
  <!--根据水卡编号获取水卡表主键及农户编号-->
  <select id="getCardIdAndClientNum" resultType="java.util.Map">
<!--    SELECT id AS cardId, clientNum FROM se_client_card WHERE cardNum = #{cardNum}-->
    SELECT
        card.id AS cardId,
        cli.clientNum,
        cli.id AS clientId
    FROM se_client_card card
        INNER JOIN se_client cli ON card.clientId = cli.id
    WHERE card.cardNum = #{cardNum}
  </select>
  <!--根据行政区划串模糊查询水卡编号-->
  <select id="getCardNumOfMax"  resultType="java.lang.String">
    SELECT cardNum
    FROM se_client_card
    WHERE cardNum LIKE CONCAT('%',#{areaCode},'%')
    ORDER BY cardNum desc
    LIMIT 0,1
  </select>
  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.dy.pipIrrGlobal.pojoSe.SeClientCard">
    <!--@mbg.generated-->
    insert into se_client_card (cardAddr, clientId, money,
      `state`, createDt, replaceDt,
      rechargeDt, lossDtDt, cancelDt,
      unlockDt, reversalDt, consumeDt,
      lastOper, remarks)
    values (#{cardaddr,jdbcType=VARCHAR}, #{clientid,jdbcType=BIGINT}, #{money,jdbcType=FLOAT},
      #{state,jdbcType=TINYINT}, #{createdt,jdbcType=TIMESTAMP}, #{replacedt,jdbcType=TIMESTAMP},
      #{rechargedt,jdbcType=TIMESTAMP}, #{lossdtdt,jdbcType=TIMESTAMP}, #{canceldt,jdbcType=TIMESTAMP},
      #{unlockdt,jdbcType=TIMESTAMP}, #{reversaldt,jdbcType=TIMESTAMP}, #{consumedt,jdbcType=TIMESTAMP},
      #{lastoper,jdbcType=TINYINT}, #{remarks,jdbcType=VARCHAR})
    insert into se_client_card (id, cardAddr, cardNum, clientId,
      money, `state`, createDt,
      replaceDt, rechargeDt, lossDtDt,
      cancelDt, unlockDt, reversalDt,
      consumeDt, lastOper, remarks
      )
    values (#{id,jdbcType=BIGINT}, #{cardaddr,jdbcType=VARCHAR}, #{cardnum,jdbcType=BIGINT}, #{clientid,jdbcType=BIGINT},
      #{money,jdbcType=FLOAT}, #{state,jdbcType=TINYINT}, #{createdt,jdbcType=TIMESTAMP},
      #{replacedt,jdbcType=TIMESTAMP}, #{rechargedt,jdbcType=TIMESTAMP}, #{lossdtdt,jdbcType=TIMESTAMP},
      #{canceldt,jdbcType=TIMESTAMP}, #{unlockdt,jdbcType=TIMESTAMP}, #{reversaldt,jdbcType=TIMESTAMP},
      #{consumedt,jdbcType=TIMESTAMP}, #{lastoper,jdbcType=TINYINT}, #{remarks,jdbcType=VARCHAR}
      )
  </insert>
  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.dy.pipIrrGlobal.pojoSe.SeClientCard" useGeneratedKeys="true">
    <!--@mbg.generated-->
@@ -62,6 +93,9 @@
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="cardaddr != null">
        cardAddr,
      </if>
      <if test="cardnum != null">
        cardNum,
      </if>
      <if test="clientid != null">
        clientId,
@@ -106,6 +140,9 @@
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="cardaddr != null">
        #{cardaddr,jdbcType=VARCHAR},
      </if>
      <if test="cardnum != null">
        #{cardnum,jdbcType=BIGINT},
      </if>
      <if test="clientid != null">
        #{clientid,jdbcType=BIGINT},
@@ -155,6 +192,9 @@
      <if test="cardaddr != null">
        cardAddr = #{cardaddr,jdbcType=VARCHAR},
      </if>
      <if test="cardnum != null">
        cardNum = #{cardnum,jdbcType=BIGINT},
      </if>
      <if test="clientid != null">
        clientId = #{clientid,jdbcType=BIGINT},
      </if>
@@ -201,6 +241,7 @@
    <!--@mbg.generated-->
    update se_client_card
    set cardAddr = #{cardaddr,jdbcType=VARCHAR},
      cardNum = #{cardnum,jdbcType=BIGINT},
      clientId = #{clientid,jdbcType=BIGINT},
      money = #{money,jdbcType=FLOAT},
      `state` = #{state,jdbcType=TINYINT},