<?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.fin.statistical.analysis.infrastructure.dao.AllowanceScheduleDao">
<!-- 字段 说明
id 主键id
biz_reim_no 商旅报销单编号
chk_in_ct_nm 城市名称
city_code 城市编码
fd_allce 伙食补助
follow_car_flag 是否公车跟随
pub_subsidy 公杂补助
schedule_date 日程日期
usr_cod 用户编码
usr_nm 用户名
wt_unif_acc 是否统一食宿
data_Create_Time 数据创建时间
data_Update_Time 数据更新时间
data_Create_By 数据创建人
data_Update_By 数据更新人
-->
<sql id="table">
allowance_schedule
</sql>
<sql id="BaseColumnList">
id,
biz_reim_no,
chk_in_ct_nm,
city_code,
fd_allce,
follow_car_flag,
pub_subsidy,
schedule_date,
usr_cod,
usr_nm,
wt_unif_acc,
data_Create_Time,
data_Update_Time,
data_Create_By,
data_Update_By
</sql>
<resultMap id="BaseResultMap" type="com.fin.statistical.analysis.domain.model.po.AllowanceSchedule">
<id column="id" property="id"/>
<result column="biz_reim_no" property="bizReimNo"/>
<result column="chk_in_ct_nm" property="chkInCtNm"/>
<result column="city_code" property="cityCode"/>
<result column="fd_allce" property="fdAllce"/>
<result column="follow_car_flag" property="followCarFlag"/>
<result column="pub_subsidy" property="pubSubsidy"/>
<result column="schedule_date" property="scheduleDate"/>
<result column="usr_cod" property="usrCod"/>
<result column="usr_nm" property="usrNm"/>
<result column="wt_unif_acc" property="wtUnifAcc"/>
<result column="data_Create_Time" property="dataCreateTime"/>
<result column="data_Update_Time" property="dataUpdateTime"/>
<result column="data_Create_By" property="dataCreateBy"/>
<result column="data_Update_By" property="dataUpdateBy"/>
</resultMap>
<!-- 分页查询 -->
<select id="count" resultType="java.lang.Long">
SELECT
COUNT(*)
FROM
<include refid="table"/>
<include refid="pageWhereSql"/>
</select>
<sql id="pageWhereSql">
<where>
<if test="id != null and id != 0">
and id = #{id,jdbcType=INTEGER }
</if>
<if test="bizReimNo != null and bizReimNo != ''">
and biz_reim_no = #{bizReimNo,jdbcType=VARCHAR }
</if>
<if test="chkInCtNm != null and chkInCtNm != ''">
and chk_in_ct_nm = #{chkInCtNm,jdbcType=VARCHAR }
</if>
<if test="cityCode != null and cityCode != ''">
and city_code = #{cityCode,jdbcType=VARCHAR }
</if>
<if test="fdAllce != null">
and fd_allce = #{fdAllce,jdbcType=DECIMAL }
</if>
<if test="followCarFlag != null">
and follow_car_flag = #{followCarFlag,jdbcType=TINYINT }
</if>
<if test="pubSubsidy != null">
and pub_subsidy = #{pubSubsidy,jdbcType=DECIMAL }
</if>
<if test="scheduleDate != null">
and schedule_date = #{scheduleDate,jdbcType=TIMESTAMP }
</if>
<if test="usrCod != null and usrCod != ''">
and usr_cod = #{usrCod,jdbcType=VARCHAR }
</if>
<if test="usrNm != null and usrNm != ''">
and usr_nm = #{usrNm,jdbcType=VARCHAR }
</if>
<if test="wtUnifAcc != null">
and wt_unif_acc = #{wtUnifAcc,jdbcType=TINYINT }
</if>
<if test="dataCreateTime != null">
and data_Create_Time = #{dataCreateTime,jdbcType=TIMESTAMP }
</if>
<if test="dataUpdateTime != null">
and data_Update_Time = #{dataUpdateTime,jdbcType=TIMESTAMP }
</if>
<if test="dataCreateBy != null and dataCreateBy != ''">
and data_Create_By = #{dataCreateBy,jdbcType=VARCHAR }
</if>
<if test="dataUpdateBy != null and dataUpdateBy != ''">
and data_Update_By = #{dataUpdateBy,jdbcType=VARCHAR }
</if>
</where>
</sql>
<select id="pageList" resultMap="BaseResultMap">
SELECT
<include refid="BaseColumnList"/>
FROM
<include refid="table"/>
<include refid="pageWhereSql"/>
ORDER BY
data_Update_Time DESC
LIMIT #{start},#{pageSize}
</select>
<!-- getByPrimaryKey -->
<select id="getByPrimaryKey" resultMap="BaseResultMap">
SELECT
<include refid="BaseColumnList"/>
FROM
<include refid="table"/>
WHERE
id = #{id,jdbcType=INTEGER }
</select>
<!-- 新增 -->
<insert id="save" keyProperty="id" useGeneratedKeys="true" parameterType="com.fin.statistical.analysis.domain.model.po.AllowanceSchedule">
INSERT INTO
<include refid="table"/>
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="bizReimNo != null and bizReimNo != ''">
biz_reim_no,
</if>
<if test="chkInCtNm != null and chkInCtNm != ''">
chk_in_ct_nm,
</if>
<if test="cityCode != null and cityCode != ''">
city_code,
</if>
<if test="fdAllce != null">
fd_allce,
</if>
<if test="followCarFlag != null">
follow_car_flag,
</if>
<if test="pubSubsidy != null">
pub_subsidy,
</if>
<if test="scheduleDate != null">
schedule_date,
</if>
<if test="usrCod != null and usrCod != ''">
usr_cod,
</if>
<if test="usrNm != null and usrNm != ''">
usr_nm,
</if>
<if test="wtUnifAcc != null">
wt_unif_acc,
</if>
<if test="dataCreateTime != null">
data_Create_Time,
</if>
<if test="dataUpdateTime != null">
data_Update_Time,
</if>
<if test="dataCreateBy != null and dataCreateBy != ''">
data_Create_By,
</if>
<if test="dataUpdateBy != null and dataUpdateBy != ''">
data_Update_By
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER },
</if>
<if test="bizReimNo != null and bizReimNo != ''">
#{bizReimNo,jdbcType=VARCHAR },
</if>
<if test="chkInCtNm != null and chkInCtNm != ''">
#{chkInCtNm,jdbcType=VARCHAR },
</if>
<if test="cityCode != null and cityCode != ''">
#{cityCode,jdbcType=VARCHAR },
</if>
<if test="fdAllce != null">
#{fdAllce,jdbcType=DECIMAL },
</if>
<if test="followCarFlag != null">
#{followCarFlag,jdbcType=TINYINT },
</if>
<if test="pubSubsidy != null">
#{pubSubsidy,jdbcType=DECIMAL },
</if>
<if test="scheduleDate != null">
#{scheduleDate,jdbcType=TIMESTAMP },
</if>
<if test="usrCod != null and usrCod != ''">
#{usrCod,jdbcType=VARCHAR },
</if>
<if test="usrNm != null and usrNm != ''">
#{usrNm,jdbcType=VARCHAR },
</if>
<if test="wtUnifAcc != null">
#{wtUnifAcc,jdbcType=TINYINT },
</if>
<if test="dataCreateTime != null">
#{dataCreateTime,jdbcType=TIMESTAMP },
</if>
<if test="dataUpdateTime != null">
#{dataUpdateTime,jdbcType=TIMESTAMP },
</if>
<if test="dataCreateBy != null and dataCreateBy != ''">
#{dataCreateBy,jdbcType=VARCHAR },
</if>
<if test="dataUpdateBy != null and dataUpdateBy != ''">
#{dataUpdateBy,jdbcType=VARCHAR }
</if>
</trim>
</insert>
<!-- 修改 -->
<update id="update" parameterType="com.fin.statistical.analysis.domain.model.po.AllowanceSchedule">
UPDATE
<include refid="table"/>
<set>
<if test="bizReimNo != null">
biz_reim_no = #{bizReimNo,jdbcType=VARCHAR },
</if>
<if test="chkInCtNm != null">
chk_in_ct_nm = #{chkInCtNm,jdbcType=VARCHAR },
</if>
<if test="cityCode != null">
city_code = #{cityCode,jdbcType=VARCHAR },
</if>
<if test="fdAllce != null">
fd_allce = #{fdAllce,jdbcType=DECIMAL },
</if>
<if test="followCarFlag != null">
follow_car_flag = #{followCarFlag,jdbcType=TINYINT },
</if>
<if test="pubSubsidy != null">
pub_subsidy = #{pubSubsidy,jdbcType=DECIMAL },
</if>
<if test="scheduleDate != null">
schedule_date = #{scheduleDate,jdbcType=TIMESTAMP },
</if>
<if test="usrCod != null">
usr_cod = #{usrCod,jdbcType=VARCHAR },
</if>
<if test="usrNm != null">
usr_nm = #{usrNm,jdbcType=VARCHAR },
</if>
<if test="wtUnifAcc != null">
wt_unif_acc = #{wtUnifAcc,jdbcType=TINYINT },
</if>
<if test="dataCreateTime != null">
data_Create_Time = #{dataCreateTime,jdbcType=TIMESTAMP },
</if>
<if test="dataUpdateTime != null">
data_Update_Time = #{dataUpdateTime,jdbcType=TIMESTAMP },
</if>
<if test="dataCreateBy != null">
data_Create_By = #{dataCreateBy,jdbcType=VARCHAR },
</if>
<if test="dataUpdateBy != null">
data_Update_By = #{dataUpdateBy,jdbcType=VARCHAR }
</if>
</set>
WHERE
id = #{id,jdbcType=INTEGER }
</update>
</mapper>