Files
chaozhanggui/pluss-dao-bundle/target/classes/mapper/RoleInfo-sqlmap.xml
2023-01-28 15:57:27 +08:00

172 lines
4.9 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="cn.pluss.platform.mapper.RoleInfoMapper">
<insert id="saveRoleInfo" parameterType="cn.pluss.platform.entity.RoleInfo">
insert into tb_pluss_role_info(name,creator,createTime,updator,updateTime,version)VALUES(#{name},#{creator},#{createTime},#{updator},#{updateTime},#{version})
</insert>
<insert id="saveRoleInfoBatch">
insert into tb_pluss_role_info(name,creator,createTime,updator,updateTime,version) VALUES
<foreach collection="list" item="item" index="index" separator=",">
(#{name},#{creator},#{createTime},#{updator},#{updateTime},#{version} )
</foreach>
</insert>
<select id="queryRoleInfo" parameterType="cn.pluss.platform.entity.RoleInfo" resultType="cn.pluss.platform.entity.RoleInfo">
SELECT * from tb_pluss_role_info
<where>
<if test="id!= null">
and id = #{id}
</if>
<if test="name!= null">
and name = #{name}
</if>
<if test="creator!= null">
and creator = #{creator}
</if>
<if test="createTime!= null">
and createTime = #{createTime}
</if>
<if test="updator!= null">
and updator = #{updator}
</if>
<if test="updateTime!= null">
and updateTime = #{updateTime}
</if>
<if test="version!= null">
and version = #{version}
</if>
</where>
</select>
<select id="queryRoleInfoList" parameterType="cn.pluss.platform.entity.RoleInfo" resultType="cn.pluss.platform.entity.RoleInfo">
SELECT * from tb_pluss_role_info
<where>
<if test="id!= null">
and id = #{id}
</if>
<if test="name!= null">
and name = #{name}
</if>
<if test="creator!= null">
and creator = #{creator}
</if>
<if test="createTime!= null">
and createTime = #{createTime}
</if>
<if test="updator!= null">
and updator = #{updator}
</if>
<if test="updateTime!= null">
and updateTime = #{updateTime}
</if>
<if test="version!= null">
and version = #{version}
</if>
</where>
order by id desc
</select>
<update id="updateRoleInfo" parameterType="cn.pluss.platform.entity.RoleInfo" >
update tb_pluss_role_info
<set>
<if test="name!= null">
name = #{name},
</if>
<if test="creator!= null">
creator = #{creator},
</if>
<if test="createTime!= null">
createTime = #{createTime},
</if>
<if test="updator!= null">
updator = #{updator},
</if>
<if test="updateTime!= null">
updateTime = #{updateTime},
</if>
<if test="version!= null">
version = #{version}
</if>
</set>
where id=#{id}
</update>
<delete id="deleteRoleInfo" parameterType="cn.pluss.platform.entity.RoleInfo" >
DELETE FROM tb_pluss_role_info where id=#{id}
</delete>
<select id="queryRoleInfoPage" parameterType="java.util.Map" resultType="cn.pluss.platform.entity.RoleInfo">
SELECT * from tb_pluss_role_info
<where>
<if test="id!= null">
and id = #{id}
</if>
<if test="name!= null">
and name Like CONCAT("%",#{name},"%")
</if>
<if test="creator!= null">
and creator = #{creator}
</if>
<if test="createTime!= null">
and createTime = #{createTime}
</if>
<if test="updator!= null">
and updator = #{updator}
</if>
<if test="updateTime!= null">
and updateTime = #{updateTime}
</if>
<if test="version!= null">
and version = #{version}
</if>
</where>
order by id desc limit #{pageSize} offset #{offset}
</select>
<select id="queryRoleInfoPageCount" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT count(*) from tb_pluss_role_info
<where>
<if test="id!= null">
and id = #{id}
</if>
<if test="name!= null">
and name = #{name}
</if>
<if test="creator!= null">
and creator = #{creator}
</if>
<if test="createTime!= null">
and createTime = #{createTime}
</if>
<if test="updator!= null">
and updator = #{updator}
</if>
<if test="updateTime!= null">
and updateTime = #{updateTime}
</if>
<if test="version!= null">
and version = #{version}
</if>
</where>
</select>
<select id="getRoleNames" parameterType="java.lang.String" resultType="cn.pluss.platform.entity.RoleInfo">
select * from tb_pluss_role_info where id in (select roleId from tb_pluss_role_user_info where userId in (select id from tb_pluss_user_info
<where>
<if test="loginName!= null">
and loginName=#{loginName}
</if>
</where>
))
</select>
</mapper>