You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

159 lines
6.4 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.ruoyi.basic.mapper.HwGlobalCfgDao">
<resultMap type="com.ruoyi.basic.domain.HwGlobalCfg" id="HwGlobalCfgMap">
<result property="globalCfgId" column="global_cfg_id" jdbcType="INTEGER"/>
<result property="globalCfgName" column="global_cfg_name" jdbcType="VARCHAR"/>
<result property="globalCfgType" column="global_cfg_type" jdbcType="VARCHAR"/>
<result property="globalCfgDate" column="global_cfg_date" jdbcType="VARCHAR"/>
<result property="isDetail" column="is_detail" jdbcType="VARCHAR"/>
<result property="details" column="details" jdbcType="VARCHAR"/>
</resultMap>
<!--查询单个-->
<select id="queryById" resultMap="HwGlobalCfgMap">
select
global_cfg_id, global_cfg_name, global_cfg_type, global_cfg_date, is_detail, details
from hw_global_cfg
where global_cfg_id = #{globalCfgId}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="HwGlobalCfgMap">
select
global_cfg_id, global_cfg_name, global_cfg_type, global_cfg_date, is_detail, details
from hw_global_cfg
<where>
<if test="globalCfgId != null">
and global_cfg_id = #{globalCfgId}
</if>
<if test="globalCfgName != null and globalCfgName != ''">
and global_cfg_name = #{globalCfgName}
</if>
<if test="globalCfgType != null and globalCfgType != ''">
and global_cfg_type = #{globalCfgType}
</if>
<if test="globalCfgDate != null and globalCfgDate != ''">
and global_cfg_date = #{globalCfgDate}
</if>
<if test="isDetail != null and isDetail != ''">
and is_detail = #{isDetail}
</if>
<if test="details != null">
and details = #{details}
</if>
</where>
limit #{pageable.offset}, #{pageable.pageSize}
</select>
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">
select count(1)
from hw_global_cfg
<where>
<if test="globalCfgId != null">
and global_cfg_id = #{globalCfgId}
</if>
<if test="globalCfgName != null and globalCfgName != ''">
and global_cfg_name = #{globalCfgName}
</if>
<if test="globalCfgType != null and globalCfgType != ''">
and global_cfg_type = #{globalCfgType}
</if>
<if test="globalCfgDate != null and globalCfgDate != ''">
and global_cfg_date = #{globalCfgDate}
</if>
<if test="isDetail != null and isDetail != ''">
and is_detail = #{isDetail}
</if>
<if test="details != null and details.size()>0">
and details = #{details}
</if>
</where>
</select>
<select id="queryAll" resultType="com.ruoyi.basic.domain.HwGlobalCfg"
parameterType="com.ruoyi.basic.domain.HwGlobalCfg">
select *
from hw_global_cfg
<where>
<if test="globalCfgId != null">
and global_cfg_id = #{globalCfgId}
</if>
<if test="globalCfgName != null and globalCfgName != ''">
and global_cfg_name = #{globalCfgName}
</if>
<if test="globalCfgType != null and globalCfgType != ''">
and global_cfg_type = #{globalCfgType}
</if>
<if test="globalCfgDate != null and globalCfgDate != ''">
and global_cfg_date = #{globalCfgDate}
</if>
<if test="isDetail != null and isDetail != ''">
and is_detail = #{isDetail}
</if>
<if test="details != null">
and details = #{details}
</if>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="globalCfgId" useGeneratedKeys="true">
insert into hw_global_cfg(global_cfg_name, global_cfg_type, global_cfg_date, is_detail, details)
values (#{globalCfgName}, #{globalCfgType}, #{globalCfgDate}, #{isDetail}, #{details})
</insert>
<insert id="insertBatch" keyProperty="globalCfgId" useGeneratedKeys="true">
insert into hw_global_cfg(global_cfg_name, global_cfg_type, global_cfg_date, is_detail, details)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.globalCfgName}, #{entity.globalCfgType}, #{entity.globalCfgDate}, #{entity.isDetail}, #{entity.details})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="globalCfgId" useGeneratedKeys="true">
insert into hw_global_cfg(global_cfg_name, global_cfg_type, global_cfg_date, is_detail, details)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.globalCfgName}, #{entity.globalCfgType}, #{entity.globalCfgDate}, #{entity.isDetail}, #{entity.details})
</foreach>
on duplicate key update
global_cfg_name = values(global_cfg_name),
global_cfg_type = values(global_cfg_type),
global_cfg_date = values(global_cfg_date),
is_detail = values(is_detail),
details = values(details)
</insert>
<!--通过主键修改数据-->
<update id="update">
update hw_global_cfg
<set>
<if test="globalCfgName != null and globalCfgName != ''">
global_cfg_name = #{globalCfgName},
</if>
<if test="globalCfgType != null and globalCfgType != ''">
global_cfg_type = #{globalCfgType},
</if>
<if test="globalCfgDate != null and globalCfgDate != ''">
global_cfg_date = #{globalCfgDate},
</if>
<if test="isDetail != null and isDetail != ''">
is_detail = #{isDetail},
</if>
<if test="details != null">
details = #{details},
</if>
</set>
where global_cfg_id = #{globalCfgId}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from hw_global_cfg where global_cfg_id = #{globalCfgId}
</delete>
</mapper>