| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- <?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.usoftchina.saas.document.mapper.CurrencyMapper" >
- <resultMap id="BaseResultMap" type="com.usoftchina.saas.document.entities.Currency" >
- <id column="cr_id" property="id" jdbcType="INTEGER" />
- <result column="cr_name" property="cr_name" jdbcType="VARCHAR" />
- <result column="cr_rate" property="cr_rate" jdbcType="VARCHAR" />
- <result column="companyId" property="companyId" jdbcType="INTEGER" />
- <result column="creatorId" property="creatorId" jdbcType="INTEGER" />
- <result column="updaterId" property="updaterId" jdbcType="INTEGER" />
- <result column="updateTime" property="updateTime" jdbcType="TIMESTAMP" />
- <result column="creatorName" property="creatorName" jdbcType="INTEGER" />
- <result column="updaterName" property="updaterName" jdbcType="INTEGER" />
- <result column="createTime" property="createTime" jdbcType="TIMESTAMP" />
- <result column="cr_standard" property="cr_standard" jdbcType="INTEGER" />
- </resultMap>
- <sql id="Base_Column_List" >
- cr_id, cr_name, cr_rate, companyId, creatorId, updaterId, updateTime, creatorName, updaterName, createTime, cr_standard
- </sql>
- <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
- select
- <include refid="Base_Column_List" />
- from currencys
- where cr_id = #{id}
- </select>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
- delete from currencys
- where cr_id = #{id}
- </delete>
- <insert id="insertSelective" parameterType="com.usoftchina.saas.document.entities.Currency" >
- <selectKey resultType="java.lang.Long" keyProperty="id">
- SELECT LAST_INSERT_ID() AS ID
- </selectKey>
- insert into Currencys
- <trim prefix="(" suffix=")" suffixOverrides="," >
- <if test="cr_name != null" >
- cr_name,
- </if>
- <if test="cr_rate != null">
- cr_rate,
- </if>
- <if test="cr_standard != null">
- cr_standard,
- </if>
- <if test="companyId != null" >
- companyId,
- </if>
- <if test="updaterId != null" >
- updaterId,
- </if>
- <if test="updateTime != null" >
- updateTime,
- </if>
- <if test="creatorId != null" >
- creatorId,
- </if>
- <if test="createTime != null" >
- createTime,
- </if>
- <if test="creatorName != null" >
- creatorName,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides="," >
- <if test="cr_name != null" >
- #{cr_name,jdbcType=VARCHAR},
- </if>
- <if test="cr_rate != null" >
- #{cr_rate,jdbcType=DOUBLE},
- </if>
- <if test="cr_standard != null" >
- #{cr_standard,jdbcType=INTEGER},
- </if>
- <if test="companyId != null" >
- #{companyId,jdbcType=INTEGER},
- </if>
- <if test="updaterId != null" >
- #{updaterId,jdbcType=INTEGER},
- </if>
- <if test="updateTime != null" >
- #{updateTime,jdbcType=TIMESTAMP},
- </if>
- <if test="creatorId != null" >
- #{creatorId,jdbcType=INTEGER},
- </if>
- <if test="createTime != null" >
- #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="creatorName != null" >
- #{creatorName,jdbcType=VARCHAR},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.document.entities.Currency" >
- update Currencys
- <set >
- <if test="cr_name != null" >
- cr_name = #{cr_name,jdbcType=VARCHAR},
- </if>
- <if test="cr_rate != null" >
- cr_rate = #{cr_rate,jdbcType=DOUBLE},
- </if>
- <if test="cr_standard != null" >
- cr_standard = #{cr_standard,jdbcType=INTEGER},
- </if>
- <if test="companyId != null" >
- companyId = #{companyId,jdbcType=INTEGER},
- </if>
- <if test="updaterId != null" >
- updaterId = #{updaterId,jdbcType=INTEGER},
- </if>
- <if test="updateTime != null" >
- updateTime = #{updateTime,jdbcType=TIMESTAMP},
- </if>
- </set>
- where cr_id = #{id}
- </update>
- <select id="selectByCompanyId" resultMap="BaseResultMap">
- SELECT * FROM Currencys where companyId=#{companyId} ORDER BY CR_ID DESC
- </select>
- <select id="getAll" resultMap="BaseResultMap">
- SELECT * FROM Currencys
- <where>
- <if test="condition != null">
- ${condition}
- </if>
- <if test="companyId != null">
- and companyId = #{companyId}
- </if>
- </where>
- ORDER BY CR_ID DESC
- </select>
- <update id="clearStandard">
- UPDATE CURRENCYS SET CR_STANDARD = 0, CR_RATE = 0 WHERE COMPANYID = #{companyId}
- </update>
- <update id="setStandard">
- UPDATE CURRENCYS SET CR_STANDARD = #{standard}, CR_RATE = 1 WHERE COMPANYID = #{companyId} AND CR_NAME = #{name}
- </update>
- <select id="selectCountByName" resultType="int">
- SELECT COUNT(*) FROM CURRENCYS WHERE CR_NAME = #{name} AND COMPANYID = #{companyId}
- </select>
- <select id="getStandard" resultType="com.usoftchina.saas.document.dto.CurrencyDTO">
- select * from CURRENCYS where cr_standard = '1' and companyId = #{companyId}
- </select>
- </mapper>
|