TdBParkCardCouponsSMapper.xml 3.04 KB
<?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.TdBParkCardCouponsSMapper" >
 <resultMap id="BaseResultMap" type="com.zteits.pay.domain.TdBParkCardCoupons" >
    <id column="id" property="id" jdbcType="BIGINT" />
    <result column="park_id" property="parkId" jdbcType="VARCHAR" />
    <result column="goods_big_type" property="goodsBigType" jdbcType="INTEGER" />
    <result column="goods_type" property="goodsType" jdbcType="INTEGER" />
    <result column="goods_type_remark" property="goodsTypeRemark" jdbcType="VARCHAR" />
    <result column="goods_amount" property="goodsAmount" jdbcType="DECIMAL" />
    <result column="eff_date" property="effDate" jdbcType="TIMESTAMP" />
    <result column="exp_date" property="expDate" jdbcType="TIMESTAMP" />
    <result column="goods_state" property="goodsState" jdbcType="BIGINT" />
    <result column="data_state" property="dataState" jdbcType="INTEGER" />
    <result column="create_empid" property="createEmpid" jdbcType="VARCHAR" />
    <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
    <result column="modfiy_empid" property="modfiyEmpid" jdbcType="VARCHAR" />
    <result column="modfiy_date" property="modfiyDate" jdbcType="TIMESTAMP" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, park_id, goods_big_type, goods_type, goods_type_remark, goods_amount, eff_date, 
    exp_date, goods_state, data_state, create_empid, create_date, modfiy_empid, modfiy_date
  </sql>
  <select id="selectByParkIds" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from td_b_park_card_coupons
	<where>
	 park_id IN
	<foreach collection="parkIds" open="(" close=")"
		item="parkId" separator=",">
		#{parkId}
	</foreach>
	</where>
  </select>
  
   <select id="selectByParkId" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from td_b_park_card_coupons
	<where>
	park_id = #{parkId,jdbcType=VARCHAR}
	</where>
  </select>
  
   <select id="selectGoodTypesByParkId" resultType="java.util.HashMap">
	  SELECT
	  	t.id as parkCardId,
		t.goods_amount goodsAmount,
		t.park_id AS parkId,
	    t.goods_type goodstype,
		t.goods_type_remark goodsTypeRemark,
		CASE
	WHEN t.goods_type IN ('20', '21') THEN
		'year'
	ELSE
		'month'
	END AS 'goodsTypes'
	FROM
		td_b_park_card_coupons t
	WHERE
		data_state = 1
	AND goods_state = 1
	AND goods_big_type = 2
	AND t.park_id = #{parkId,jdbcType=VARCHAR}
	
  </select>
  
  
   <select id="queryParkVipCard" resultType="java.util.HashMap">
	   SELECT
		t.park_id as parkId,
			max(
				CASE
				WHEN t.goods_type IN ('20', '21') THEN
					'year' else '' end
			)  'year',
			max(
				CASE
				WHEN t.goods_type IN ('22', '23') THEN
					'month' else '' end
			)  'month'
		FROM
			td_b_park_card_coupons t
			WHERE
				data_state = 1
			AND goods_state = 1
			and goods_big_type = 2
<!-- 			//and  t.park_id = #{parkId,jdbcType=VARCHAR}
 -->		GROUP BY t.park_id
	
  </select>
</mapper>