Files
foton-slrs-system-rest/adc-da-slrs/src/main/resources/mybatis/mapper/wgdCensusLeo/WgdFyfyMapper.xml
T
2021-11-19 11:19:42 +08:00

155 lines
5.6 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.adc.da.slrs.wgdCensusLeo.dao.WgdFyfyDao">
<!-- 基础信息-->
<sql id="BaseInfo">
id,type,number,name,translation,pages,cost,time
</sql>
<!-- 查询条件-->
<sql id="Conditions">
<where>
<if test="id != null and id != ''">
and id = #{id}
</if>
<if test="type != null and type != ''">
and type like concat('%',#{type},'%')
</if>
<if test="number != null and number != ''">
and number like concat('%',#{number},'%')
</if>
<if test="name != null and name != ''">
and name like concat('%',#{name},'%')
</if>
<if test="translation != null and translation != ''">
and translation like concat('%',#{translation},'%')
</if>
<if test="pages != null and pages != ''">
and pages = #{pages}
</if>
<if test="cost != null and cost != ''">
and cost = #{cost}
</if>
<if test="time != null and time != ''">
and time = #{time}
</if>
</where>
</sql>
<select id="getTotal" resultType="java.lang.Integer">
select count(*) from wgd_fyfy
</select>
<select id="getQueryTotal" parameterType="com.adc.da.slrs.wgdCensusLeo.entity.WgdFyfy" resultType="java.lang.Integer">
select count(*) from wgd_fyfy
<include refid="Conditions"></include>
</select>
<!-- 查询所有-->
<select id="selectAll" resultType="com.adc.da.slrs.wgdCensusLeo.entity.WgdFyfy">
select <include refid="BaseInfo"></include> from wgd_fyfy
</select>
<!-- 多条件查询-->
<select id="queryAll" parameterType="com.adc.da.slrs.wgdCensusLeo.entity.WgdFyfy" resultType="com.adc.da.slrs.wgdCensusLeo.entity.WgdFyfy">
select <include refid="BaseInfo"></include> from wgd_fyfy
<include refid="Conditions"></include>
</select>
<!-- 查询详情-->
<select id="selectOne" parameterType="java.lang.String" resultType="com.adc.da.slrs.wgdCensusLeo.entity.WgdFyfy">
select <include refid="BaseInfo"></include> from wgd_fyfy
where id = #{id}
</select>
<!-- 修改-->
<update id="updateOne" parameterType="com.adc.da.slrs.wgdCensusLeo.entity.WgdFyfy">
update wgd_fyfy
<set>
<if test="type != null and type != ''">
type = #{type},
</if>
<if test="number != null and number != ''">
number = #{number},
</if>
<if test="name != null and name != ''">
name = #{name},
</if>
<if test="translation != null and translation != ''">
translation = #{translation},
</if>
<if test="pages != null and pages != ''">
pages = #{pages},
</if>
<if test="cost != null and cost != ''">
cost = #{cost},
</if>
<if test="time != null and time != ''">
time = #{time},
</if>
</set>
where id = #{id}
</update>
<!-- 插入一条数据-->
<insert id="insertOne" parameterType="com.adc.da.slrs.wgdCensusLeo.entity.WgdFyfy">
insert into wgd_fyfy
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null and id != ''">
id,
</if>
<if test="type != null and type != ''">
type,
</if>
<if test="number != null and number != ''">
number,
</if>
<if test="name != null and name != ''">
name,
</if>
<if test="translation != null and translation != ''">
translation,
</if>
<if test="pages != null and pages != ''">
pages,
</if>
<if test="cost != null and cost != ''">
cost,
</if>
<if test="time != null and time != ''">
time,
</if>
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null and id != ''">
#{id},
</if>
<if test="type != null and type != ''">
#{type},
</if>
<if test="number != null and number != ''">
#{number},
</if>
<if test="name != null and name != ''">
#{name},
</if>
<if test="translation != null and translation != ''">
#{translation},
</if>
<if test="pages != null and pages != ''">
#{pages},
</if>
<if test="cost != null and cost != ''">
#{cost},
</if>
<if test="time != null and time != ''">
#{time},
</if>
</trim>
</insert>
<!-- 删除-->
<delete id="deleteOne" parameterType="java.lang.String">
delete from wgd_fyfy where id = #{id}
</delete>
<!-- 批量删除-->
<delete id="deleteBatch" parameterType="java.lang.String">
delete from wgd_fyfy where id in
<foreach collection="array" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
</delete>
</mapper>