12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <?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.ym.mec.collectfee.dao.AccountDao">
-
- <resultMap type="com.ym.mec.collectfee.entity.Account" id="Account">
- <result column="id" property="id" />
- <result column="branch_id" property="branchId" />
- <result column="seller_no" property="sellerNo" />
- <result column="max_routing" property="maxRouting" />
- <result column="has_routing" property="hasRouting" />
- <result column="version" property="version" />
- </resultMap>
-
- <!-- 根据主键查询一条记录 -->
- <select id="get" resultMap="Account" >
- SELECT * FROM `account` WHERE id = #{id}
- </select>
- <!-- 全查询 -->
- <select id="findAll" resultMap="Account">
- SELECT * FROM `account` ORDER BY id
- </select>
- <!-- 向数据库增加一条记录 -->
- <insert id="insert" parameterType="com.ym.mec.collectfee.entity.Account" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
- <!--
- <selectKey resultClass="int" keyProperty="id" >
- SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL
- </selectKey>
- -->
- INSERT INTO `account` (id,branch_id,seller_no,max_routing,has_routing) VALUES(#{id},#{branchId},#{sellerNo},#{maxRouting},#{hasRouting})
- </insert>
- <!-- 根据主键查询一条记录 -->
- <update id="update" parameterType="com.ym.mec.collectfee.entity.Account">
- UPDATE `account` SET has_routing = #{hasRouting},seller_no = #{sellerNo},max_routing = #{maxRouting},branch_id = #{branchId},id = #{id} WHERE id = #{id}
- </update>
- <!-- 根据主键删除一条记录 -->
- <delete id="delete" >
- DELETE FROM `account` WHERE id = #{id}
- </delete>
- <!-- 分页查询 -->
- <select id="queryPage" resultMap="Account" parameterType="map">
- SELECT * FROM `account` ORDER BY id <include refid="global.limit"/>
- </select>
- <!-- 查询当前表的总记录数 -->
- <select id="queryCount" resultType="int">
- SELECT COUNT(*) FROM `account`
- </select>
- <!-- 根据分部id获取分部收款账户 -->
- <select id="getAccountByBranchId" resultMap="Account" >
- SELECT * FROM `account` WHERE branch_id = #{branchId} AND `max_routing` > `has_routing` ORDER BY `id` ASC LIMIT 1
- </select>
- <!-- 根据id和version更新已收金额 -->
- <update id="upByIdAndVersion" parameterType="com.ym.mec.collectfee.entity.Account">
- UPDATE `account` SET `has_routing` = #{hasRouting},`version` = `version`+1 WHERE id = #{id} AND `version`=#{version}
- </update>
- </mapper>
|