You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.9 KiB
62 lines
1.9 KiB
<?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.chjyj.szwh.mapper.AdminMapper">
|
|
|
|
<sql id="column">
|
|
id,account_name as accountName,account_id as accountName,account_id as accountId
|
|
</sql>
|
|
<sql id="tbName">`admin`</sql>
|
|
|
|
<!--查询记录列表-->
|
|
<select id="getAdminList" parameterType="java.lang.Integer" resultType="cn.chjyj.szwh.bean.Admin">
|
|
WITH mm as (select * from
|
|
<include refid="tbName"/>
|
|
where id>#{startRs} limit #{pageSize}
|
|
)SELECT * FROM mm ORDER BY id DESC;
|
|
</select>
|
|
|
|
<!-- 主键查询用户信息 -->
|
|
<select id="getAdminById" parameterType="java.lang.Integer" resultType="cn.chjyj.szwh.bean.Admin">
|
|
select <include refid="column"/>
|
|
from <include refid="tbName"/>
|
|
where id=#{id};
|
|
</select>
|
|
|
|
<!--根据id查询-->
|
|
<select id="getAdminByAccountId" parameterType="java.lang.String" resultType="cn.chjyj.szwh.bean.Admin">
|
|
select
|
|
<include refid="column"/>
|
|
from
|
|
<include refid="tbName"/>
|
|
where account_id=#{accountId}
|
|
</select>
|
|
|
|
<!--新增用户 id 自增加-->
|
|
<insert id="addAdmin" parameterType="cn.chjyj.szwh.bean.Admin" useGeneratedKeys="true" keyColumn="id">
|
|
insert into
|
|
<include refid="tbName"/>
|
|
(account_name,account_id)
|
|
values (
|
|
#{accountName},
|
|
#{accountId}
|
|
)
|
|
</insert>
|
|
|
|
<!-- 更新-->
|
|
<update id="updateAdmin" parameterType="cn.chjyj.szwh.bean.Admin">
|
|
update
|
|
<include refid="tbName"/>
|
|
<set>
|
|
<if test="accountName!=null">
|
|
account_name=#{accountName},
|
|
</if>
|
|
<if test="accountId!=null">
|
|
account_id=#{accountId},
|
|
</if>
|
|
</set>
|
|
where id=#{id};
|
|
</update>
|
|
|
|
</mapper>
|