完善权限+正则

master
李永杰 2023-11-19 21:19:56 +08:00
parent c67ec5a6ab
commit 233021c10b
2 changed files with 20 additions and 18 deletions

View File

@ -15,9 +15,8 @@
</where> </where>
</select> </select>
<insert id="add"> <insert id="add" useGeneratedKeys="true" keyProperty="empId">
insert into tb_employee (emp_name, username, password, emp_tel, emp_id_card, emp_age, emp_gender, emp_address, emp_sal) <include refid="com.bwie.manage.mapper.ManagerMapper.insertEmp"></include>
values (#{empName},#{username},#{password},#{empTel},#{empIdCard},#{empAge},#{empGender},#{empAddress},#{empSal})
</insert> </insert>
<select id="findById" resultType="com.bwie.common.domain.Emp"> <select id="findById" resultType="com.bwie.common.domain.Emp">
@ -26,15 +25,15 @@
<update id="update"> <update id="update">
update tb_employee set update tb_employee set
emp_name = #{empName}, emp_name = #{empName},
username = #{username}, username = #{username},
password = #{password}, password = #{password},
emp_tel = #{empTel}, emp_tel = #{empTel},
emp_id_card = #{empIdCard}, emp_id_card = #{empIdCard},
emp_age = #{empAge}, emp_age = #{empAge},
emp_gender = #{empGender}, emp_gender = #{empGender},
emp_address = #{empAddress}, emp_address = #{empAddress},
emp_sal = #{empSal} emp_sal = #{empSal}
where emp_id = #{empId} where emp_id = #{empId}
</update> </update>

View File

@ -27,23 +27,26 @@
left join tb_post p on ep.post_id = p.post_id left join tb_post p on ep.post_id = p.post_id
</sql> </sql>
<sql id="insertEmp">
insert into tb_employee (emp_name, username, password, emp_tel, emp_id_card, emp_age, emp_gender, emp_address, emp_sal)
values (#{empName},#{username},#{password},#{empTel},#{empIdCard},#{empAge},#{empGender},#{empAddress},#{empSal})
</sql>
<select id="list" resultType="com.bwie.common.domain.response.EmpResponse"> <select id="list" resultType="com.bwie.common.domain.response.EmpResponse">
<include refid="selectEmpVo"/> <include refid="selectEmpVo"/>
<where> <where>
er.role_id = 2 or er.role_id = 3 er.role_id in (2, 3)
<if test="null != empName and '' != empName"> <if test="null != empName and '' != empName">
and e.emp_name like concat('%',#{empName},'%') and e.emp_name like concat('%',#{empName},'%')
</if> </if>
</where> </where>
</select> </select>
<insert id="add" useGeneratedKeys="true" keyProperty="empId">
<insert id="add"> <include refid="insertEmp"></include>
insert into tb_employee (emp_name, username, password, emp_tel, emp_id_card, emp_age, emp_gender, emp_address, emp_sal)
values (#{empName},#{username},#{password},#{empTel},#{empIdCard},#{empAge},#{empGender},#{empAddress},#{empSal})
</insert> </insert>
<select id="findById" resultType="com.bwie.common.domain.Emp"> <select id="findById" resultType="com.bwie.common.domain.response.EmpResponse">
<include refid="selectEmpVo"/> where e.emp_id = #{empId} <include refid="selectEmpVo"/> where e.emp_id = #{empId}
</select> </select>