BillMapper.xml
张创琦
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE mapperPUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"><mapper namespace="com.zcq.dao.BillMapper"><sql id="selectSql"> SELECTb.id_ as id, b.title_ as title,b.bill_time_ as billTime, b.type_id_ as typeId,b.price_ as price,b.explain_ as `explain`,t.name_ as typeName FROMbill_ as b left joinbill_type_ as tonb.type_id_ = t.id_</sql><select id="select" resultType="bill"><include refid="selectSql"/><where><if test="typeId !=null"> b.type_id_ = #{typeId}</if><if test="title !=null">and b.title_ like '%${title}%'</if><if test="date1 !=null">and b.bill_time_ >= #{date1}</if><if test="date2 !=null">and b.bill_time_ <= #{date2}</if></where></select></mapper>
