This commit is contained in:
Suh
2024-01-16 12:04:48 +09:00
parent f21300a991
commit 88806ccde6
5 changed files with 95 additions and 10 deletions

View File

@@ -63,8 +63,14 @@
acc.birth, acc.telephone, acc.address, acc.activation,
auth2.name group_auth_name, auth.name personal_auth_name
from account acc join authority auth join authority auth2 on acc.personal_authority_id = auth.id and acc.group_authority_id = auth2.id
where acc.name like concat('%',#{search},'%')
order by acc.activation desc, acc.id desc limit #{start}, #{perPage}
<where>
<choose>
<when test="searchn == 0"> acc.activation = 1 and acc.name like concat('%',#{search},'%')</when>
<when test="searchn == 1"> acc.activation = 1 and acc.employee_number like concat('%',#{search},'%') </when>
</choose>
</where>
order by acc.id desc limit #{start}, #{perPage}
</select>
<insert id="insert" parameterType="accountDto">
insert into account
@@ -134,4 +140,15 @@
<update id="delete" parameterType="accountDto">
update account SET activation = false WHERE id = #{id}
</update>
<select id="count" parameterType="map" resultType="java.lang.Integer">
select count(*) from ( SELECT 1 from account
<where>
<choose>
<when test="searchn == 1"> activation = 1 and name like concat('%',#{search},'%')</when>
<when test="searchn == 0"> activation = 1 and employee_number like concat('%',#{search},'%') </when>
</choose>
</where>
order by id desc limit #{start}, #{perPage} ) t
</select>
</mapper>