money_management/src/main/resources/mapper/CaseInfoMapper.xml

367 lines
16 KiB
XML

<?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.sztzjy.money_management.mapper.CaseInfoMapper">
<resultMap id="BaseResultMap" type="com.sztzjy.money_management.entity.CaseInfo">
<id column="caseid" jdbcType="VARCHAR" property="caseid"/>
<result column="customer_name" jdbcType="VARCHAR" property="customerName"/>
<result column="age" jdbcType="INTEGER" property="age"/>
<result column="id_card" jdbcType="VARCHAR" property="idCard"/>
<result column="manage_money_matters_type" jdbcType="VARCHAR" property="manageMoneyMattersType"/>
<result column="model" jdbcType="VARCHAR" property="model"/>
<result column="source" jdbcType="VARCHAR" property="source"/>
<result column="publish" jdbcType="VARCHAR" property="publish"/>
<result column="add_time" jdbcType="TIMESTAMP" property="addTime"/>
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.sztzjy.money_management.entity.CaseInfo">
<result column="customer_backdrop" jdbcType="LONGVARCHAR" property="customerBackdrop"/>
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
caseid
, customer_name, age, id_card, manage_money_matters_type, model, source, publish,
add_time
</sql>
<sql id="Blob_Column_List">
customer_backdrop
</sql>
<select id="selectByExampleWithBLOBs" parameterType="com.sztzjy.money_management.entity.CaseInfoExample"
resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List"/>
,
<include refid="Blob_Column_List"/>
from case_info
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByExample" parameterType="com.sztzjy.money_management.entity.CaseInfoExample"
resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List"/>
from case_info
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
select
<include refid="Base_Column_List"/>
,
<include refid="Blob_Column_List"/>
from case_info
where caseid = #{caseid,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete
from case_info
where caseid = #{caseid,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="com.sztzjy.money_management.entity.CaseInfoExample">
delete from case_info
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</delete>
<insert id="insert" parameterType="com.sztzjy.money_management.entity.CaseInfo">
insert into case_info (caseid, customer_name, age,
id_card, manage_money_matters_type, model,
source, publish, add_time,
customer_backdrop)
values (#{caseid,jdbcType=VARCHAR}, #{customerName,jdbcType=VARCHAR}, #{age,jdbcType=INTEGER},
#{idCard,jdbcType=VARCHAR}, #{manageMoneyMattersType,jdbcType=VARCHAR}, #{model,jdbcType=VARCHAR},
#{source,jdbcType=VARCHAR}, #{publish,jdbcType=VARCHAR}, #{addTime,jdbcType=TIMESTAMP},
#{customerBackdrop,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.sztzjy.money_management.entity.CaseInfo">
insert into case_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="caseid != null">
caseid,
</if>
<if test="customerName != null">
customer_name,
</if>
<if test="age != null">
age,
</if>
<if test="idCard != null">
id_card,
</if>
<if test="manageMoneyMattersType != null">
manage_money_matters_type,
</if>
<if test="model != null">
model,
</if>
<if test="source != null">
source,
</if>
<if test="publish != null">
publish,
</if>
<if test="addTime != null">
add_time,
</if>
<if test="customerBackdrop != null">
customer_backdrop,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="caseid != null">
#{caseid,jdbcType=VARCHAR},
</if>
<if test="customerName != null">
#{customerName,jdbcType=VARCHAR},
</if>
<if test="age != null">
#{age,jdbcType=INTEGER},
</if>
<if test="idCard != null">
#{idCard,jdbcType=VARCHAR},
</if>
<if test="manageMoneyMattersType != null">
#{manageMoneyMattersType,jdbcType=VARCHAR},
</if>
<if test="model != null">
#{model,jdbcType=VARCHAR},
</if>
<if test="source != null">
#{source,jdbcType=VARCHAR},
</if>
<if test="publish != null">
#{publish,jdbcType=VARCHAR},
</if>
<if test="addTime != null">
#{addTime,jdbcType=TIMESTAMP},
</if>
<if test="customerBackdrop != null">
#{customerBackdrop,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.sztzjy.money_management.entity.CaseInfoExample"
resultType="java.lang.Long">
select count(*) from case_info
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update case_info
<set>
<if test="record.caseid != null">
caseid = #{record.caseid,jdbcType=VARCHAR},
</if>
<if test="record.customerName != null">
customer_name = #{record.customerName,jdbcType=VARCHAR},
</if>
<if test="record.age != null">
age = #{record.age,jdbcType=INTEGER},
</if>
<if test="record.idCard != null">
id_card = #{record.idCard,jdbcType=VARCHAR},
</if>
<if test="record.manageMoneyMattersType != null">
manage_money_matters_type = #{record.manageMoneyMattersType,jdbcType=VARCHAR},
</if>
<if test="record.model != null">
model = #{record.model,jdbcType=VARCHAR},
</if>
<if test="record.source != null">
source = #{record.source,jdbcType=VARCHAR},
</if>
<if test="record.publish != null">
publish = #{record.publish,jdbcType=VARCHAR},
</if>
<if test="record.addTime != null">
add_time = #{record.addTime,jdbcType=TIMESTAMP},
</if>
<if test="record.customerBackdrop != null">
customer_backdrop = #{record.customerBackdrop,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update case_info
set caseid = #{record.caseid,jdbcType=VARCHAR},
customer_name = #{record.customerName,jdbcType=VARCHAR},
age = #{record.age,jdbcType=INTEGER},
id_card = #{record.idCard,jdbcType=VARCHAR},
manage_money_matters_type = #{record.manageMoneyMattersType,jdbcType=VARCHAR},
model = #{record.model,jdbcType=VARCHAR},
source = #{record.source,jdbcType=VARCHAR},
publish = #{record.publish,jdbcType=VARCHAR},
add_time = #{record.addTime,jdbcType=TIMESTAMP},
customer_backdrop = #{record.customerBackdrop,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByExample" parameterType="map">
update case_info
set caseid = #{record.caseid,jdbcType=VARCHAR},
customer_name = #{record.customerName,jdbcType=VARCHAR},
age = #{record.age,jdbcType=INTEGER},
id_card = #{record.idCard,jdbcType=VARCHAR},
manage_money_matters_type = #{record.manageMoneyMattersType,jdbcType=VARCHAR},
model = #{record.model,jdbcType=VARCHAR},
source = #{record.source,jdbcType=VARCHAR},
publish = #{record.publish,jdbcType=VARCHAR},
add_time = #{record.addTime,jdbcType=TIMESTAMP}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.sztzjy.money_management.entity.CaseInfo">
update case_info
<set>
<if test="customerName != null">
customer_name = #{customerName,jdbcType=VARCHAR},
</if>
<if test="age != null">
age = #{age,jdbcType=INTEGER},
</if>
<if test="idCard != null">
id_card = #{idCard,jdbcType=VARCHAR},
</if>
<if test="manageMoneyMattersType != null">
manage_money_matters_type = #{manageMoneyMattersType,jdbcType=VARCHAR},
</if>
<if test="model != null">
model = #{model,jdbcType=VARCHAR},
</if>
<if test="source != null">
source = #{source,jdbcType=VARCHAR},
</if>
<if test="publish != null">
publish = #{publish,jdbcType=VARCHAR},
</if>
<if test="addTime != null">
add_time = #{addTime,jdbcType=TIMESTAMP},
</if>
<if test="customerBackdrop != null">
customer_backdrop = #{customerBackdrop,jdbcType=LONGVARCHAR},
</if>
</set>
where caseid = #{caseid,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="com.sztzjy.money_management.entity.CaseInfo">
update case_info
set customer_name = #{customerName,jdbcType=VARCHAR},
age = #{age,jdbcType=INTEGER},
id_card = #{idCard,jdbcType=VARCHAR},
manage_money_matters_type = #{manageMoneyMattersType,jdbcType=VARCHAR},
model = #{model,jdbcType=VARCHAR},
source = #{source,jdbcType=VARCHAR},
publish = #{publish,jdbcType=VARCHAR},
add_time = #{addTime,jdbcType=TIMESTAMP},
customer_backdrop = #{customerBackdrop,jdbcType=LONGVARCHAR}
where caseid = #{caseid,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.sztzjy.money_management.entity.CaseInfo">
update case_info
set customer_name = #{customerName,jdbcType=VARCHAR},
age = #{age,jdbcType=INTEGER},
id_card = #{idCard,jdbcType=VARCHAR},
manage_money_matters_type = #{manageMoneyMattersType,jdbcType=VARCHAR},
model = #{model,jdbcType=VARCHAR},
source = #{source,jdbcType=VARCHAR},
publish = #{publish,jdbcType=VARCHAR},
add_time = #{addTime,jdbcType=TIMESTAMP}
where caseid = #{caseid,jdbcType=VARCHAR}
</update>
<!--下面为自己手动添加的xml-->
<select id="getCaseInfoList" resultMap="ResultMapWithBLOBs">
SELECT * FROM case_info
<where>
<if test="schoolId != null and schoolId != ''">
AND source IN ('999999999', #{schoolId})
</if>
<if test="keyWord != null and keyWord != ''">
AND
(customer_name LIKE CONCAT('%', #{keyWord}, '%') OR id_card LIKE CONCAT('%', #{keyWord}, '%'))
</if>
<if test="type != null and type != ''">
AND manage_money_matters_type LIKE CONCAT('%', #{type}, '%')
</if>
</where>
ORDER BY add_time DESC
</select>
</mapper>