123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- <?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.jkcredit.invoice.mapper.calculateInfor.SelfCarCalculateInforMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.jkcredit.invoice.model.entity.Calculate.SelfCarCalculateInfor">
- <id column="id" property="id"/>
- <result column="customId" property="customId"/>
- <result column="companyNum" property="companyNum"/>
- <result column="tradeId" property="tradeId"/>
- <result column="fee" property="fee"/>
- <result column="calculateTime" property="calculateTime"/>
- <result column="ctype" property="ctype"/>
- <result column="invoiceMkTime" property="invoiceMkTime"/>
- <result column="companyReferencenum" property="companyReferencenum"/>
- </resultMap>
- <sql id="baseSql">
- id,
- customId,
- companyNum,
- etcNum,
- fee,
- calTime,
- invoiceMkTime,
- companyReferencenum
- </sql>
- <select id="selectAllByPage" resultMap="BaseResultMap">
- select
- <include refid="baseSql" />
- from t_SelfCalculateInfor
- <if test="calculateInfor.customId != null and calculateInfor.customId != ''">
- and customId LIKE CONCAT('%',#{calculateInfor.customId},'%')
- </if>
- <if test="calculateInfor.companyReferencenum != null and calculateInfor.companyReferencenum != ''">
- and companyReferencenum =#{calculateInfor.companyReferencenum}
- </if>
- <if test="calculateInfor.etcNum != null and calculateInfor.etcNum != ''">
- and etcNum = #{calculateInfor.etcNum}
- </if>
- <if test="calculateInfor.calTime != null and calculateInfor.calTime != ''">
- and calTime BETWEEN #{calTimeStart} and #{calculateInfor.calTimeEnd}
- </if>
- </select>
- <select id="selectByEtcAndTime" resultMap="BaseResultMap" parameterType="com.jkcredit.invoice.model.entity.Calculate.SelfCarCalculateInfor">
- select
- <include refid="baseSql" />
- from t_SelfCalculateInfor where calTime = #{calTime,jdbcType=VARCHAR} and etcNum = #{etcNum,jdbcType=VARCHAR}
- </select>
- <insert id="insert" parameterType="com.jkcredit.invoice.model.entity.Calculate.SelfCarCalculateInfor" >
- insert into t_SelfCalculateInfor (
- customId,
- companyNum,
- etcNum,
- fee,
- calTime,invoiceMkTime,companyReferencenum
- )
- values ( #{customId,jdbcType=VARCHAR}, #{companyNum,jdbcType=VARCHAR},
- #{etcNum,jdbcType=VARCHAR}, #{fee,jdbcType=DOUBLE},#{calTime,jdbcType=VARCHAR},#{invoiceMkTime,jdbcType=VARCHAR},#{companyReferencenum,jdbcType=VARCHAR}
- )
- </insert>
- <resultMap id="staticResultMap" type="java.util.Map">
- <result column="customId" property="customId"/>
- <result column="companyNum" property="companyNum"/>
- <result column="companyReferencenum" property="companyReferencenum"/>
- <result column="etcNum" property="etcNum"/>
- <result column="tradeIdNum" property="tradeIdNum"/>
- <result column="feeNum" property="feeNum"/>
- </resultMap>
- <select id="findSelfcarCalculateInfoSta" resultMap="staticResultMap">
- select k.*,
- (
- select count(1) from (select DISTINCT f.etcNum from t_SelfCalculateInfor f where f.companyNum = companyNum
- <if test="etcNum != null and etcNum != ''">
- and f.etcNum = #{etcNum}
- </if>
- <if test="calTime != null and calTime != ''">
- and f.calTime BETWEEN #{calTimeStart} and #{calTimeEnd}
- </if>
- ) g
- ) etcNum,
- (select count(1) from t_SellCarTrade t where t.companyNum = k.companyNum
- and t.cardId in (select DISTINCT f.etcNum from t_SelfCalculateInfor f where f.companyNum = k.companyNum
- <if test="etcNum != null and etcNum != ''">
- and f.etcNum = #{etcNum}
- </if>
- <if test="calTime != null and calTime != ''">
- and f.calTime BETWEEN #{calTimeStart} and #{calTimeEnd}
- </if>
- )
- <if test="calTime != null and calTime != ''">
- and t.exTime BETWEEN #{calTimeStart} and #{calTimeEnd}
- </if>
- ) tradeIdNum
- from (
- select
- customId,
- companyNum,
- companyReferencenum,
- count(1) feeNum
- from t_SelfCalculateInfor h
- <where>
- <if test="customId != null and customId != ''">
- and customId LIKE CONCAT('%',#{customId},'%')
- </if>
- <if test="companyReferencenum != null and companyReferencenum != ''">
- and companyReferencenum =#{companyReferencenum}
- </if>
- <if test="etcNum != null and etcNum != ''">
- and etcNum = #{etcNum}
- </if>
- <if test="calTime != null and calTime != ''">
- and calTime BETWEEN #{calTimeStart} and #{calTimeEnd}
- </if>
- </where>
- GROUP by customId,companyNum,companyReferencenum) k
- </select>
- <select id="selectEtcNum" resultMap="BaseResultMap">
- select
- <include refid="baseSql" />
- from t_SelfCalculateInfor
- </select>
- <select id="selectAllByPage" resultMap="BaseResultMap">
- select
- <include refid="baseSql" />
- from t_SelfCalculateInfor
- </select>
- </mapper>
|