|
@@ -28,57 +28,70 @@
|
|
|
</select>
|
|
|
|
|
|
<!-- 向数据库增加一条记录 -->
|
|
|
- <insert id="insert" parameterType="com.keao.edu.datasource.dal.entity.Agency" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
|
|
- <!--
|
|
|
- <selectKey resultClass="int" keyProperty="id" >
|
|
|
- SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL
|
|
|
- </selectKey>
|
|
|
- -->
|
|
|
- INSERT INTO agency (id_,name_,contact_name_,contact_phone_,settlement_type_,share_profit_amount,create_time_,update_time_) VALUES(#{id},#{name},#{contactName},#{contactPhone},#{settlementType},#{shareProfitAmount},#{createTime},#{updateTime})
|
|
|
+ <insert id="insert" parameterType="com.keao.edu.user.entity.Agency" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
|
|
+ INSERT INTO agency (id_,name_,contact_name_,contact_phone_,settlement_type_,share_profit_amount,create_time_,update_time_)
|
|
|
+ VALUES(#{id},#{name},#{contactName},#{contactPhone},#{settlementType},#{shareProfitAmount},#{createTime},#{updateTime})
|
|
|
</insert>
|
|
|
|
|
|
<!-- 根据主键查询一条记录 -->
|
|
|
- <update id="update" parameterType="com.keao.edu.datasource.dal.entity.Agency">
|
|
|
+ <update id="update" parameterType="com.keao.edu.user.entity.Agency">
|
|
|
UPDATE agency <set>
|
|
|
-<if test="id != null">
|
|
|
-id_ = #{id},
|
|
|
-</if>
|
|
|
-<if test="updateTime != null">
|
|
|
-update_time_ = #{updateTime},
|
|
|
-</if>
|
|
|
-<if test="contactPhone != null">
|
|
|
-contact_phone_ = #{contactPhone},
|
|
|
-</if>
|
|
|
-<if test="settlementType != null">
|
|
|
-settlement_type_ = #{settlementType},
|
|
|
-</if>
|
|
|
-<if test="contactName != null">
|
|
|
-contact_name_ = #{contactName},
|
|
|
-</if>
|
|
|
-<if test="shareProfitAmount != null">
|
|
|
-share_profit_amount = #{shareProfitAmount},
|
|
|
-</if>
|
|
|
-<if test="name != null">
|
|
|
-name_ = #{name},
|
|
|
-</if>
|
|
|
-<if test="createTime != null">
|
|
|
-create_time_ = #{createTime},
|
|
|
-</if>
|
|
|
-</set> WHERE id_ = #{id}
|
|
|
+ <if test="id != null">
|
|
|
+ id_ = #{id},
|
|
|
+ </if>
|
|
|
+ <if test="updateTime != null">
|
|
|
+ update_time_ = #{updateTime},
|
|
|
+ </if>
|
|
|
+ <if test="contactPhone != null">
|
|
|
+ contact_phone_ = #{contactPhone},
|
|
|
+ </if>
|
|
|
+ <if test="settlementType != null">
|
|
|
+ settlement_type_ = #{settlementType},
|
|
|
+ </if>
|
|
|
+ <if test="contactName != null">
|
|
|
+ contact_name_ = #{contactName},
|
|
|
+ </if>
|
|
|
+ <if test="shareProfitAmount != null">
|
|
|
+ share_profit_amount = #{shareProfitAmount},
|
|
|
+ </if>
|
|
|
+ <if test="name != null">
|
|
|
+ name_ = #{name},
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">
|
|
|
+ create_time_ = #{createTime},
|
|
|
+ </if>
|
|
|
+ </set> WHERE id_ = #{id}
|
|
|
</update>
|
|
|
|
|
|
<!-- 根据主键删除一条记录 -->
|
|
|
<delete id="delete" >
|
|
|
DELETE FROM agency WHERE id_ = #{id}
|
|
|
</delete>
|
|
|
+
|
|
|
+ <sql id="agencyQueryPage">
|
|
|
+ <where>
|
|
|
+ del_flag_ = 0
|
|
|
+ <if test="settlementType">
|
|
|
+ AND settlement_type_ = #{settlementType}
|
|
|
+ </if>
|
|
|
+ <if test="search">
|
|
|
+ AND (id_ = #{search} OR name_ LIKE CONCAT('%',#{search},'%')
|
|
|
+ OR contact_name_ LIKE CONCAT('%',#{search},'%')
|
|
|
+ OR contact_phone_ LIKE CONCAT('%',#{search},'%'))
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </sql>
|
|
|
|
|
|
<!-- 分页查询 -->
|
|
|
<select id="queryPage" resultMap="Agency" parameterType="map">
|
|
|
- SELECT * FROM agency ORDER BY id_ <include refid="global.limit"/>
|
|
|
+ SELECT * FROM agency
|
|
|
+ <include refid="agencyQueryPage"/>
|
|
|
+ ORDER BY update_time_ DESC <include refid="global.limit"/>
|
|
|
</select>
|
|
|
|
|
|
<!-- 查询当前表的总记录数 -->
|
|
|
<select id="queryCount" resultType="int">
|
|
|
SELECT COUNT(*) FROM agency
|
|
|
+ <include refid="agencyQueryPage"/>
|
|
|
</select>
|
|
|
</mapper>
|