`

项目积累

    博客分类:
  • Java
阅读更多

Ibatis查询中参数为:list

XML代码1:

<!-- 查询未通航城市 -->
	<select id="findCityByCityCodeNotIn" resultMap="BaseResultMap" parameterType="list">
	  	select 
			CITY_CODE,
			CITY_CNNAME 
	  	from 
			BTSF_BIS_CITY 
	  	where 
			CITY_CODE not in
	  	<foreach collection="list" item="cityCode"  open="(" separator="," close=")">
	  		#{cityCode}
	  	</foreach>	  
		 and DELETE_SIGN = '0'	
		 order by CITY_CODE
	</select>

 

 

 Java 代码1Dao:

/**
	 * 根据城市三字码查询城市中文名称 ___未通航城市查询
	 * 
	 * @param cityCode 查询参数
	 * @return 城市中文名称
	 */
	public List<CityPO> findCityByCityCodeNotIn(List<String> codeList);

 

XML代码2:

<select id="findCityFuzzy" resultMap="BaseResultMap" parameterType="hashmap">
	 	select 
			c.id,
			c.CITY_CNNAME,
			c.CITY_CODE,
			c.CITY_PINYIN,
			c.CITY_INITIAL
		from 
			BTSF_BIS_CITY c 
        where 
			c.DELETE_SIGN='0' 
        <if test="cityCode != '' and cityCode != null">
        	AND C.CITY_CODE LIKE CONCAT(#{cityCode},'%')
        </if>
        <if test="cityCnname != '' and cityCnname != null">
        	AND C.CITY_CNNAME LIKE CONCAT(#{cityCnname},'%')
        </if>
        <if test="cityPinyin != '' and cityPinyin != null">
        	AND REPLACE(UPPER(C.CITY_PINYIN),'-','') LIKE CONCAT(#{cityPinyin},'%')
        </if>
        <if test="cityInitCap != '' and cityInitCap != null">
        	AND UPPER(C.CITY_INITIAL) LIKE CONCAT(#{cityInitCap},'%')
        </if>
	</select>

Java代码2:

/**
	 * 按照给定的条件模糊查询城市信息。
	 * 应用场合之一:航班查询时由城市名称/拼音/三字码/拼音首字母查询城市。
	 * 
	 * @param param cityCnname:城市名称/cityPinyin: 拼音/cityCode:三字码/cityInitCap:拼音首字母
	 * @return
	 */
	public List<CityPO> findCityFuzzy(Map<String, String> param);

  

 

XML代码3:

<select id="findFlightCardList" resultMap="BaseResultMap" parameterType="hashmap">
             select * from btsf_cc_flight_cart 
	where generate_order='0'
					<if test="registerId !=null and registerId !='' ">
					   and register_id = #{registerId}
					</if>
					<if test="custMobile !=null and custMobile!='' ">
					   and cust_mobile = #{custMobile}
					</if>
					<if test="customer !=null and customer!='' ">
					   and customer like '%${customer}%'
					</if>
					<if test="registerName !=null and registerName !='' ">
					   and register_name like '%${registerName}%'
					</if>
					<if test="beginDate !=null and beginDate !='' ">
					   <![CDATA[and call_time >= to_date(#{beginDate},'yyyy-mm-dd HH24:MI:SS')]]>
					</if>
					<if test="endDate !=null and endDate !='' ">
					 <![CDATA[and call_time <= to_date(#{endDate},'yyyy-mm-dd HH24:MI:SS')]]>
					</if>
					<![CDATA[
			order by call_time  desc]]>
</select>

 

Java代码3:

	/**
	 * 
	 * @method_name flightCardList
	 * @author liuqiuyue
	 * @date 2011-5-30 下午03:28:03
	 * 根据登录的座席人员信息查看购物车
	 */
	@Override
	public List<FlightCartPO> flightCardList(Map<String, Object> query) {
	         if (query == null) {
		query = new HashMap<String, Object>();
	        }
	return flightCartDao.findFlightCardList(query);
	}

 

 

XML代码4:

<delete id="delFlightCartMore" parameterType="java.util.HashMap" >
    delete from BTSF_CC_FLIGHT_CART
     <![CDATA[${condition}]]>
</delete>

 

Java代码4:

/**
	 * 
	 * @method_name delTicketInfoMore
	 * @author yatou
	 * @date 2011-5-30 下午03:28:19
	 * 批量删除购物车信息
	 */
@Override
public boolean delFlightCartMore(String id) throws AppException {
	Map<String, Object>  query = new HashMap<String, Object>(); 
	String condition="where ID in ("+id+")";
	query.put("condition", condition);
	flightCartDao.delFlightCartMore(query);
	return true;
}

 

 

XML代码5:

<update id="updateFlightAboutOrder" parameterType="java.util.HashMap">
    update BTSF_CC_FLIGHT_CART
    set 
    	GENERATE_ORDER = '1'
	   where id in
		(select flight_cart_id from btsf_sys_ticket_info  <![CDATA[${condition}]]>)
</update>

 

Java代码5:

/**
* 提交订单后,更改购物车是否生成订单状态
*/
public void updateFlightAboutOrder(Map<String, Object> queryvalue);

 

 

XML代码6:

Java代码6:

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics