Blame view

parking-module-pay/src/main/resources/mybatis/smapper/TdCCustSignSMapper.xml 2.7 KB
55f68655   王彪总   新项目
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
  <?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.zteits.pay.mapper.smapper.TdCCustSignSMapper">
    <resultMap id="BaseResultMap" type="com.zteits.pay.domain.TdCCustSign">
      <id column="id" jdbcType="BIGINT" property="id" />
      <result column="cust_id" jdbcType="VARCHAR" property="custId" />
      <result column="sign_date" jdbcType="TIMESTAMP" property="signDate" />
      <result column="sign_source" jdbcType="INTEGER" property="signSource" />
      <result column="lon_id" jdbcType="DECIMAL" property="lonId" />
      <result column="lat_id" jdbcType="DECIMAL" property="latId" />
      <result column="sign_score" jdbcType="INTEGER" property="signScore" />
      <result column="continue_sign_num" jdbcType="INTEGER" property="continueSignNum" />
      <result column="data_state" jdbcType="INTEGER" property="dataState" />
      <result column="create_empid" jdbcType="VARCHAR" property="createEmpid" />
      <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
      <result column="modfiy_empid" jdbcType="VARCHAR" property="modfiyEmpid" />
      <result column="modfiy_date" jdbcType="TIMESTAMP" property="modfiyDate" />
    </resultMap>
    <sql id="Base_Column_List">
      id, cust_id, sign_date, sign_source, lon_id, lat_id, sign_score, continue_sign_num, 
      data_state, create_empid, create_date, modfiy_empid, modfiy_date
    </sql>
    <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
      select 
      <include refid="Base_Column_List" />
      from td_c_cust_sign
      where id = #{id,jdbcType=BIGINT}
    </select>
    
    <!-- 查询车主是否签到 -->
    <select id="getCustSignState" parameterType="com.zteits.pay.domain.TdCCustSign" 
    	resultType="java.lang.Integer">
      select count(1) 
  	from td_c_cust_sign a
  	where a.cust_id = #{custId,jdbcType=VARCHAR}
  	and date(a.sign_date) = date(#{signDate})
  	and sign_source = #{signSource}
    </select>
    <!-- 查询前一天签到信息 -->
     <select id="queryCustSignOld" parameterType="com.zteits.pay.domain.TdCCustSign" 
    	resultType="com.zteits.pay.domain.TdCCustSignDO">
      select B.cust_id as custId,
      a.sign_date as signDate,
      IFNULL(a.sign_score,0) as signScore,
      IFNULL(a.continue_sign_num,0) as continueSignNum,
  	IFNULL(B.totalScore,0) as totalScore,
  	IFNULL(B.totalSignNum,0) as totalSignNum
  	from 
  	(select 
  	cust_id,sum(sign_score) totalScore, count(continue_sign_num) totalSignNum
  	from td_c_cust_sign
  	where cust_id = #{custId,jdbcType=VARCHAR}
  	and sign_source = #{signSource}
  	GROUP BY cust_id)B LEFT JOIN td_c_cust_sign a on a.cust_id = B.cust_id
  	and date(a.sign_date) = date(#{signDate})
    </select>
    
    
  </mapper>