Merge branch 'susu' into dev
This commit is contained in:
13
core/src/main/resources/mappers/admin/CheckAdminIdMapper.xml
Normal file
13
core/src/main/resources/mappers/admin/CheckAdminIdMapper.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?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="app.module.core.usecase.admin.checkAdminId.persistence.CheckAdminIdMapper">
|
||||
|
||||
<select id="checkAdminId" >
|
||||
select count(*)
|
||||
from admin
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -7,6 +7,10 @@
|
||||
SELECT
|
||||
a.seq,
|
||||
a.id AS id,
|
||||
a.name,
|
||||
a.region_main_code,
|
||||
u.code_text as region_main_code_name,
|
||||
a.phone,
|
||||
a.created_by,
|
||||
a.created_at,
|
||||
a.updated_by,
|
||||
@@ -16,15 +20,24 @@
|
||||
a.account_locked,
|
||||
COUNT(*) OVER() AS total
|
||||
FROM admin a
|
||||
LEFT JOIN uicode u ON u.parent_id = 'code.region.main' AND u.id = a.region_main_code
|
||||
WHERE a.is_deleted = false
|
||||
|
||||
<if test="cmd.searchField != null and cmd.searchValue != null and cmd.searchValue != ''">
|
||||
<choose>
|
||||
<when test="cmd.searchField == 'email'">AND a.email ILIKE '%' || #{cmd.searchValue} || '%'</when>
|
||||
<when test="cmd.searchField == 'id'">AND a.id ILIKE '%' || #{cmd.searchValue} || '%'</when>
|
||||
<when test="cmd.searchField == 'name'">AND a.name LIKE '%' || #{cmd.searchValue} || '%'</when>
|
||||
<when test="cmd.searchField == 'id'">AND a.id LIKE '%' || #{cmd.searchValue} || '%'</when>
|
||||
</choose>
|
||||
</if>
|
||||
|
||||
<if test="cmd.searchArea != null and cmd.searchArea != '' ">
|
||||
AND a.region_main_code = #{cmd.searchArea}
|
||||
</if>
|
||||
|
||||
<if test="cmd.searchDisabled != null and cmd.searchDisabled != '' ">
|
||||
AND a.account_disabled = CAST(#{cmd.searchDisabled} AS BOOLEAN)
|
||||
</if>
|
||||
|
||||
<if test="cmd.searchRole != null and cmd.searchRole != ''">
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
INSERT INTO admin (seq,
|
||||
id,
|
||||
password,
|
||||
name,
|
||||
phone,
|
||||
region_main_code,
|
||||
password_updated_at,
|
||||
account_disabled,
|
||||
@@ -20,6 +22,8 @@
|
||||
VALUES (#{seq},
|
||||
#{id},
|
||||
#{encodedPassword},
|
||||
#{name},
|
||||
#{phone},
|
||||
#{regionMainCode},
|
||||
#{passwordUpdatedAt},
|
||||
#{accountDisabled},
|
||||
@@ -32,6 +36,8 @@
|
||||
UPDATE admin
|
||||
SET
|
||||
password = #{encodedPassword},
|
||||
name = #{name},
|
||||
phone = #{phone},
|
||||
region_main_code = #{regionMainCode},
|
||||
password_updated_at = #{passwordUpdatedAt},
|
||||
account_disabled = #{accountDisabled},
|
||||
@@ -48,14 +54,12 @@
|
||||
role_id,
|
||||
<include refid="common.fields.CreateUpdateBaseColumns"/>
|
||||
) VALUES
|
||||
<foreach collection="roleIds" item="roleId" separator=",">
|
||||
(
|
||||
nextval('admin_has_role_seq'),
|
||||
#{adminSeq},
|
||||
#{roleId},
|
||||
<include refid="common.fields.CreateUpdateBaseValues"/>
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="deleteAdminRolesByAdminId">
|
||||
|
||||
Reference in New Issue
Block a user