Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
79034404a7
|
|
@ -18,7 +18,7 @@ public interface CompanyDao {
|
||||||
@Select("SELECT \"id\",\"name\" AS companyName FROM \"ynrealname\".\"pm_company\" where \"name\" = #{companyName} and \"is_active\" = '1'")
|
@Select("SELECT \"id\",\"name\" AS companyName FROM \"ynrealname\".\"pm_company\" where \"name\" = #{companyName} and \"is_active\" = '1'")
|
||||||
CompanyBean getCompanyByName(String companyName);
|
CompanyBean getCompanyByName(String companyName);
|
||||||
|
|
||||||
@SelectKey(statement = "SELECT IDENTITY()", keyProperty = "id", before = false, resultType = Long.class)
|
@SelectKey(statement = "SELECT @@IDENTITY", keyProperty = "id", before = false, resultType = Long.class)
|
||||||
@Insert("INSERT INTO \"ynrealname\".\"pm_company\"(\"name\", \"type_id\", \"address\", \"register_date\", \"legal_person\", \"legal_phone\", \"legal_idnumber\", \"is_active\") VALUES (#{companyName}, #{unitType}, #{address}, #{registerDate}, #{represent}, #{representPhone}, #{representIdNumber}, '1')")
|
@Insert("INSERT INTO \"ynrealname\".\"pm_company\"(\"name\", \"type_id\", \"address\", \"register_date\", \"legal_person\", \"legal_phone\", \"legal_idnumber\", \"is_active\") VALUES (#{companyName}, #{unitType}, #{address}, #{registerDate}, #{represent}, #{representPhone}, #{representIdNumber}, '1')")
|
||||||
int saveCompany(CompanyBean o);
|
int saveCompany(CompanyBean o);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ package com.bonus.bmw.basic.dao;
|
||||||
|
|
||||||
import com.bonus.system.api.model.Permission;
|
import com.bonus.system.api.model.Permission;
|
||||||
import org.apache.ibatis.annotations.*;
|
import org.apache.ibatis.annotations.*;
|
||||||
|
import org.apache.ibatis.mapping.StatementType;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
|
@ -63,6 +65,18 @@ public interface PermissionDao {
|
||||||
@Select("select p.* from \"ynrealname\".\"sys_permission\" p inner join \"ynrealname\".\"sys_role_permission\" rp on p.\"id\" = rp.\"permissionId\" where rp.\"roleId\" = #{appRoleId} and p.\"is_active\" = '1' and rp.\"is_active\" = 1 AND p.\"permission_type\"='APP' order by p.\"sort\"")
|
@Select("select p.* from \"ynrealname\".\"sys_permission\" p inner join \"ynrealname\".\"sys_role_permission\" rp on p.\"id\" = rp.\"permissionId\" where rp.\"roleId\" = #{appRoleId} and p.\"is_active\" = '1' and rp.\"is_active\" = 1 AND p.\"permission_type\"='APP' order by p.\"sort\"")
|
||||||
List<Permission> listByBackApp(Long appRoleId);
|
List<Permission> listByBackApp(Long appRoleId);
|
||||||
|
|
||||||
@Select("select getPermissionChildList(#{id})")
|
@Select("WITH RECURSIVE permission_tree(id, path) AS (\n" +
|
||||||
|
" SELECT \"id\", TO_CHAR(\"id\") AS path\n" +
|
||||||
|
" FROM \"ynrealname\".\"sys_permission\"\n" +
|
||||||
|
" WHERE \"id\" = #{id}\n" +
|
||||||
|
" \n" +
|
||||||
|
" UNION ALL\n" +
|
||||||
|
" \n" +
|
||||||
|
" SELECT p.\"id\", t.path || ',' || TO_CHAR(p.\"id\")\n" +
|
||||||
|
" FROM \"ynrealname\".\"sys_permission\" p\n" +
|
||||||
|
" INNER JOIN permission_tree t ON p.\"parentId\" = t.id\n" +
|
||||||
|
")\n" +
|
||||||
|
"SELECT LISTAGG(id,',') AS result\n" +
|
||||||
|
"FROM permission_tree;")
|
||||||
String getChildString(Long id);
|
String getChildString(Long id);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import java.util.Map;
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface RoleDao {
|
public interface RoleDao {
|
||||||
|
|
||||||
@SelectKey(statement = "SELECT IDENTITY()", keyProperty = "id", before = false, resultType = Long.class)
|
@SelectKey(statement = "SELECT @@IDENTITY", keyProperty = "id", before = false, resultType = Long.class)
|
||||||
@Insert("insert into \"ynrealname\".\"sys_role\"(\"name\", \"company_id\", \"description\", \"type\", \"level\", \"status\") values(#{name}, #{companyId}, #{description}, #{type}, #{level}, #{status})")
|
@Insert("insert into \"ynrealname\".\"sys_role\"(\"name\", \"company_id\", \"description\", \"type\", \"level\", \"status\") values(#{name}, #{companyId}, #{description}, #{type}, #{level}, #{status})")
|
||||||
int save(Role role);
|
int save(Role role);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ public interface SubCompanyDao {
|
||||||
@Select("SELECT \"id\",\"name\" AS subCompanyName FROM \"ynrealname\".\"pm_dept\" where \"name\" = #{companyName} and \"is_active\" = '1'")
|
@Select("SELECT \"id\",\"name\" AS subCompanyName FROM \"ynrealname\".\"pm_dept\" where \"name\" = #{companyName} and \"is_active\" = '1'")
|
||||||
SubCompanyBean getCompanyByName(String companyName);
|
SubCompanyBean getCompanyByName(String companyName);
|
||||||
|
|
||||||
@SelectKey(statement = "SELECT IDENTITY()", keyProperty = "id", before = false, resultType = Long.class)
|
@SelectKey(statement = "SELECT @@IDENTITY", keyProperty = "id", before = false, resultType = Long.class)
|
||||||
@Insert("INSERT INTO \"ynrealname\".\"pm_dept\"(\"name\", \"abbreviation\", \"company_id\", \"status\", \"is_active\") VALUES (#{subCompanyName}, #{abbreviation}, #{companyId}, '1', '1')")
|
@Insert("INSERT INTO \"ynrealname\".\"pm_dept\"(\"name\", \"abbreviation\", \"company_id\", \"status\", \"is_active\") VALUES (#{subCompanyName}, #{abbreviation}, #{companyId}, '1', '1')")
|
||||||
int saveCompany(SubCompanyBean o);
|
int saveCompany(SubCompanyBean o);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,61 +7,61 @@
|
||||||
|
|
||||||
<select id="getAll" parameterType="com.bonus.bmw.basic.entity.OrgBean" resultMap="ZNode">
|
<select id="getAll" parameterType="com.bonus.bmw.basic.entity.OrgBean" resultMap="ZNode">
|
||||||
SELECT
|
SELECT
|
||||||
po.ID AS id,
|
po."id" AS id,
|
||||||
po.PARENT_ID AS pId ,
|
po."parent_id" AS pId ,
|
||||||
po.COMPANY_ID as companyId,
|
po."company_id" as companyId,
|
||||||
po.NAME as name,
|
po."name" as name,
|
||||||
po."foreign_id" as foreignId
|
po."foreign_id" as foreignId
|
||||||
FROM
|
FROM
|
||||||
"ynrealname"."pm_organization" po
|
"ynrealname"."pm_organization" po
|
||||||
LEFT JOIN "ynrealname"."pm_company" pc on po.COMPANY_ID = pc.ID
|
LEFT JOIN "ynrealname"."pm_company" pc on po."company_id" = pc."id"
|
||||||
WHERE
|
WHERE
|
||||||
po."is_active" = '1'
|
po."is_active" = '1'
|
||||||
<if test="companyId!=null and companyId!='' ">
|
<if test="companyId!=null and companyId!='' ">
|
||||||
and pc.ID =#{companyId}
|
and pc."id" =#{companyId}
|
||||||
</if>
|
</if>
|
||||||
<if test="childList!=null and childList!='' ">
|
<if test="childList!=null and childList!='' ">
|
||||||
and po.ID in (${childList})
|
and po."id" in (${childList})
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getAllRl" parameterType="com.bonus.bmw.basic.entity.OrgBean" resultMap="ZNode">
|
<select id="getAllRl" parameterType="com.bonus.bmw.basic.entity.OrgBean" resultMap="ZNode">
|
||||||
SELECT
|
SELECT
|
||||||
po.ID AS id,
|
po."id" AS id,
|
||||||
po.PARENT_ID AS pId ,
|
po."parent_id" AS pId ,
|
||||||
po.ID as companyId,
|
po."id" as companyId,
|
||||||
po.NAME as name,
|
po."name" as name,
|
||||||
po."foreign_id" as foreignId
|
po."foreign_id" as foreignId
|
||||||
FROM
|
FROM
|
||||||
"ynrealname"."pm_organization" po
|
"ynrealname"."pm_organization" po
|
||||||
LEFT JOIN "ynrealname"."pm_company" pc on po.COMPANY_ID = pc.ID
|
LEFT JOIN "ynrealname"."pm_company" pc on po."company_id" = pc."id"
|
||||||
WHERE
|
WHERE
|
||||||
po."is_active" = '1'
|
po."is_active" = '1'
|
||||||
<if test="companyId!=null and companyId!='' ">
|
<if test="companyId!=null and companyId!='' ">
|
||||||
and pc.ID =#{companyId}
|
and pc."id" =#{companyId}
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getCompanyTree" parameterType="com.bonus.bmw.basic.entity.OrgBean" resultMap="ZNode">
|
<select id="getCompanyTree" parameterType="com.bonus.bmw.basic.entity.OrgBean" resultMap="ZNode">
|
||||||
SELECT
|
SELECT
|
||||||
ID AS id,
|
"id" AS id,
|
||||||
PARENT_ID AS pId ,
|
"parent_id" AS pId ,
|
||||||
NAME as name,
|
"name" as name,
|
||||||
COMPANY_ID as companyId,
|
"company_id" as companyId,
|
||||||
po."foreign_id" as foreignId
|
po."foreign_id" as foreignId
|
||||||
FROM
|
FROM
|
||||||
"ynrealname"."pm_organization"
|
"ynrealname"."pm_organization"
|
||||||
WHERE
|
WHERE
|
||||||
"is_active" = '1'
|
"is_active" = '1'
|
||||||
<if test="companyId!=null and companyId!='' and companyId!='0' ">
|
<if test="companyId!=null and companyId!='' and companyId!='0' ">
|
||||||
and COMPANY_ID = #{companyId}
|
and "company_id" = #{companyId}
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<insert id="addOrg" parameterType="com.bonus.bmw.basic.entity.OrgBean">
|
<insert id="addOrg" parameterType="com.bonus.bmw.basic.entity.OrgBean">
|
||||||
insert into "ynrealname"."pm_organization"( NAME,PARENT_ID,IS_ACTIVE,TYPE,"update_time",COMPANY_ID)
|
insert into "ynrealname"."pm_organization"( "name","parent_id","is_active","type","update_time","company_id")
|
||||||
values ( #{name},#{parentId},'1',#{type},now(),#{companyId})
|
values ( #{name},#{parentId},'1',#{type},now(),#{companyId})
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
|
@ -69,21 +69,21 @@
|
||||||
update "ynrealname"."pm_organization"
|
update "ynrealname"."pm_organization"
|
||||||
<set>
|
<set>
|
||||||
<if test="name != null">
|
<if test="name != null">
|
||||||
NAME =#{name},
|
"name" =#{name},
|
||||||
</if>
|
</if>
|
||||||
</set>
|
</set>
|
||||||
where ID = #{id}
|
where "id" = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="deleteOrg" parameterType="com.bonus.bmw.basic.entity.OrgBean">
|
<update id="deleteOrg" parameterType="com.bonus.bmw.basic.entity.OrgBean">
|
||||||
update "ynrealname"."pm_organization" set IS_ACTIVE = 0 WHERE ID = #{id}
|
update "ynrealname"."pm_organization" set "is_active" = 0 WHERE "id" = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<select id="findCompanyInfo" resultType="com.bonus.bmw.basic.entity.OrgBean"
|
<select id="findCompanyInfo" resultType="com.bonus.bmw.basic.entity.OrgBean"
|
||||||
parameterType="com.bonus.bmw.basic.entity.OrgBean">
|
parameterType="com.bonus.bmw.basic.entity.OrgBean">
|
||||||
SELECT po.ID as companyId,po.NAME as companyName,po.PARENT_ID as parentId
|
SELECT po."id" as companyId,po."name" as companyName,po."parent_id" as parentId
|
||||||
FROM "ynrealname"."pm_organization" po
|
FROM "ynrealname"."pm_organization" po
|
||||||
WHERE po.ID = #{id} AND po.IS_ACTIVE = 1
|
WHERE po."id" = #{id} AND po."is_active" = 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- <select id="getCompany" resultType="com.bonus.bmw.basic.entity.OrgBean">-->
|
<!-- <select id="getCompany" resultType="com.bonus.bmw.basic.entity.OrgBean">-->
|
||||||
|
|
@ -101,23 +101,23 @@
|
||||||
<select id="getSubCompany" resultType="com.bonus.bmw.basic.entity.OrgBean">
|
<select id="getSubCompany" resultType="com.bonus.bmw.basic.entity.OrgBean">
|
||||||
WITH RECURSIVE org_tree(orgId, orgName, parentId, "level") AS (
|
WITH RECURSIVE org_tree(orgId, orgName, parentId, "level") AS (
|
||||||
SELECT
|
SELECT
|
||||||
ID as orgId,
|
"id" as orgId,
|
||||||
NAME as orgName,
|
"name" as orgName,
|
||||||
PARENT_ID as parentId,
|
"parent_id" as parentId,
|
||||||
1 as "level"
|
1 as "level"
|
||||||
FROM "ynrealname"."pm_organization"
|
FROM "ynrealname"."pm_organization"
|
||||||
WHERE ID = #{orgId} AND IS_ACTIVE = '1'
|
WHERE "id" = #{orgId} AND "is_active" = '1'
|
||||||
|
|
||||||
UNION ALL
|
UNION ALL
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
po.ID as orgId,
|
po."id" as orgId,
|
||||||
po.NAME as orgName,
|
po."name" as orgName,
|
||||||
po.PARENT_ID as parentId,
|
po."parent_id" as parentId,
|
||||||
ot."level" + 1 as "level"
|
ot."level" + 1 as "level"
|
||||||
FROM "ynrealname"."pm_organization" po
|
FROM "ynrealname"."pm_organization" po
|
||||||
INNER JOIN org_tree ot ON po.ID = ot.parentId
|
INNER JOIN org_tree ot ON po."id" = ot.parentId
|
||||||
WHERE po.IS_ACTIVE = '1' AND po.PARENT_ID > 0
|
WHERE po."is_active" = '1' AND po."parent_id" > 0
|
||||||
)
|
)
|
||||||
SELECT
|
SELECT
|
||||||
orgId,
|
orgId,
|
||||||
|
|
|
||||||
|
|
@ -9,17 +9,17 @@
|
||||||
</delete>
|
</delete>
|
||||||
<!--查询用户记录列表-->
|
<!--查询用户记录列表-->
|
||||||
<select id="getAppUserHistoryList" resultType="com.bonus.bmw.basic.entity.UserHistoryBean">
|
<select id="getAppUserHistoryList" resultType="com.bonus.bmw.basic.entity.UserHistoryBean">
|
||||||
select ala."id" as id,ala.USER_ID as userId,su.USERNAME as userName,su."phone",ala.DEVICE_ID as deviceId,ala.DEVICE_MODEL as deviceMode,
|
select ala."id" as id,ala."user_id" as userId,su."username" as userName,su."phone",ala."device_id" as deviceId,ala."device_model" as deviceMode,
|
||||||
ala.ANDROID_VERSION as androidVersion,ala.LOGIN_DATE as loginDate,ala.LOGIN_TIME as loginTime
|
ala."android_version" as androidVersion,ala."login_date" as loginDate,ala."login_time" as loginTime
|
||||||
from "ynrealname"."app_login_audit" ala
|
from "ynrealname"."app_login_audit" ala
|
||||||
left join "ynrealname"."sys_user" su on su."id" = ala.USER_ID
|
left join "ynrealname"."sys_user" su on su."id" = ala."user_id"
|
||||||
where ala."is_active" = '1'
|
where ala."is_active" = '1'
|
||||||
and ala.LOGIN_DATE BETWEEN #{params.startTime} and #{params.endTime}
|
and ala."login_date" BETWEEN #{params.startTime} and #{params.endTime}
|
||||||
<if test="params.keyWord != null and params.keyWord!='' ">
|
<if test="params.keyWord != null and params.keyWord!='' ">
|
||||||
and (
|
and (
|
||||||
su.USERNAME like concat ('%',#{params.keyWord},'%') or
|
su."username" like '%' || #{params.keyWord} || '%' or
|
||||||
ala.DEVICE_ID like concat ('%',#{params.keyWord},'%') or
|
ala."device_id" like '%' || #{params.keyWord} || '%' or
|
||||||
ala.DEVICE_MODEL like concat ('%',#{params.keyWord},'%')
|
ala."device_model" like '%' || #{params.keyWord} || '%'
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
<if test="offset != null and offset >= 0 and limit != null and limit >= 0">
|
<if test="offset != null and offset >= 0 and limit != null and limit >= 0">
|
||||||
|
|
@ -28,14 +28,14 @@
|
||||||
</select>
|
</select>
|
||||||
<select id="getAppUserHistoryCount" resultType="java.lang.Integer">
|
<select id="getAppUserHistoryCount" resultType="java.lang.Integer">
|
||||||
select COUNT(1) from "ynrealname"."app_login_audit" ala
|
select COUNT(1) from "ynrealname"."app_login_audit" ala
|
||||||
left join "ynrealname"."sys_user" su on su."id" = ala.USER_ID
|
left join "ynrealname"."sys_user" su on su."id" = ala."user_id"
|
||||||
where ala."is_active" = '1'
|
where ala."is_active" = '1'
|
||||||
and ala.LOGIN_DATE BETWEEN #{params.startTime} and #{params.endTime}
|
and ala."login_date" BETWEEN #{params.startTime} and #{params.endTime}
|
||||||
<if test="params.keyWord != null and params.keyWord!='' ">
|
<if test="params.keyWord != null and params.keyWord!='' ">
|
||||||
and (
|
and (
|
||||||
su.USERNAME like concat ('%',#{params.keyWord},'%') or
|
su."username" like '%' || #{params.keyWord} || '%' or
|
||||||
ala.DEVICE_ID like concat ('%',#{params.keyWord},'%') or
|
ala."device_id" like '%' || #{params.keyWord} || '%' or
|
||||||
ala.DEVICE_MODEL like concat ('%',#{params.keyWord},'%')
|
ala."device_model" like '%' || #{params.keyWord} || '%'
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
|
||||||
|
|
@ -172,7 +172,10 @@
|
||||||
insert into "ynrealname"."sys_role_user"("roleId", "userId","is_active") values(#{roleId},#{userId},'1')
|
insert into "ynrealname"."sys_role_user"("roleId", "userId","is_active") values(#{roleId},#{userId},'1')
|
||||||
</insert>
|
</insert>
|
||||||
<!-- 添加用户 -->
|
<!-- 添加用户 -->
|
||||||
<insert id="saveUser" useGeneratedKeys="true" keyProperty = "userId" keyColumn="id">
|
<insert id="saveUser">
|
||||||
|
<selectKey resultType="java.lang.Long" keyProperty="userId" order="BEFORE">
|
||||||
|
SELECT @@IDENTITY
|
||||||
|
</selectKey>
|
||||||
insert into "ynrealname"."sys_user"
|
insert into "ynrealname"."sys_user"
|
||||||
("username", "password", "loginname", "id_number","phone",
|
("username", "password", "loginname", "id_number","phone",
|
||||||
<if test="orgId != null and orgId !=''">
|
<if test="orgId != null and orgId !=''">
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,52 @@
|
||||||
<mapper namespace="com.bonus.bmw.person.dao.GetChildListDao">
|
<mapper namespace="com.bonus.bmw.person.dao.GetChildListDao">
|
||||||
|
|
||||||
<select id="getChildList" resultType="java.lang.String">
|
<select id="getChildList" resultType="java.lang.String">
|
||||||
SELECT getChildList( #{params} )
|
WITH RECURSIVE child_tree(id,PATH,level) AS (
|
||||||
|
SELECT
|
||||||
|
"id",
|
||||||
|
CAST("id" AS VARCHAR(4000)) AS path,
|
||||||
|
1 AS level
|
||||||
|
FROM "ynrealname"."pm_organization"
|
||||||
|
WHERE "id" = #{params} AND "is_active" = '1'
|
||||||
|
|
||||||
|
UNION ALL
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
p."id",
|
||||||
|
CAST(t.path || ',' || p."id" AS VARCHAR(4000)),
|
||||||
|
t.level + 1
|
||||||
|
FROM "ynrealname"."pm_organization" p
|
||||||
|
INNER JOIN child_tree t ON p."parent_id" = t.id
|
||||||
|
WHERE p."is_active" = '1'
|
||||||
|
)
|
||||||
|
SELECT LISTAGG(id, ',') WITHIN GROUP (ORDER BY level, id) AS result
|
||||||
|
FROM child_tree;
|
||||||
</select>
|
</select>
|
||||||
<select id="getParentList" resultType="java.lang.String">
|
<select id="getParentList" resultType="java.lang.String">
|
||||||
SELECT getParentList( #{params} )
|
WITH RECURSIVE parent_tree(id,parent_id,allpid,level) AS (
|
||||||
|
SELECT
|
||||||
|
"id",
|
||||||
|
"parent_id",
|
||||||
|
CAST("id" AS VARCHAR(1000)) AS allpid,
|
||||||
|
1 AS level
|
||||||
|
FROM "ynrealname"."pm_organization"
|
||||||
|
WHERE "id" = #{params}
|
||||||
|
|
||||||
|
UNION ALL
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
p."id",
|
||||||
|
p."parent_id",
|
||||||
|
CAST(t.allpid || ',' || p."id" AS VARCHAR(1000)),
|
||||||
|
t.level + 1
|
||||||
|
FROM "ynrealname"."pm_organization" p
|
||||||
|
INNER JOIN parent_tree t ON p."id" = t.parent_id
|
||||||
|
WHERE p."id" IS NOT NULL
|
||||||
|
)
|
||||||
|
SELECT allpid AS result
|
||||||
|
FROM parent_tree
|
||||||
|
ORDER BY level DESC
|
||||||
|
FETCH FIRST 1 ROW ONLY;
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -5,29 +5,29 @@
|
||||||
<mapper namespace="com.bonus.system.logs.dao.SysOperLogMapper">
|
<mapper namespace="com.bonus.system.logs.dao.SysOperLogMapper">
|
||||||
|
|
||||||
<sql id="selectOperLogVo">
|
<sql id="selectOperLogVo">
|
||||||
select oper_id, title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_param, json_result, status, error_msg, oper_time
|
select "oper_id", "title", "business_type", "method", "request_method", "operator_type", "oper_name", "dept_name", "oper_url", "oper_ip", "oper_param", "json_result", "status", "error_msg", "oper_time"
|
||||||
from sys_oper_log
|
from "ynrealname"."sys_oper_log"
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<sql id="where">
|
<sql id="where">
|
||||||
<where>
|
<where>
|
||||||
a.opersTime BETWEEN CONCAT(#{params.startTime},' 00:00:00') and CONCAT(#{params.endTime},' 23:59:59')
|
a."opersTime" BETWEEN #{params.startTime} || ' 00:00:00' and #{params.endTime} || ' 23:59:59'
|
||||||
<if test="params != null">
|
<if test="params != null">
|
||||||
<if test="params.type != null and params.type != ''">
|
<if test="params.type != null and params.type != ''">
|
||||||
and a.operatoType = #{params.type}
|
and a."operatoType" = #{params.type}
|
||||||
</if>
|
</if>
|
||||||
<if test="params.module != null and params.module != ''">
|
<if test="params.module != null and params.module != ''">
|
||||||
and locate(#{params.module},a.title) > 0
|
and INSTR(a."title", #{params.module}) > 0
|
||||||
</if>
|
</if>
|
||||||
<if test="params.result != null and params.result != ''">
|
<if test="params.result != null and params.result != ''">
|
||||||
and locate(#{params.result},a.jsonResult) > 0
|
and INSTR(a."jsonResult", #{params.result}) > 0
|
||||||
</if>
|
</if>
|
||||||
<if test="params.keyWord != null and params.keyWord != ''">
|
<if test="params.keyWord != null and params.keyWord != ''">
|
||||||
and (
|
and (
|
||||||
a.title like concat('%', #{params.keyWord}, '%') or
|
a."title" like '%' || #{params.keyWord} || '%' or
|
||||||
a.type like concat('%', #{params.keyWord}, '%') or
|
a."type" like '%' || #{params.keyWord} || '%' or
|
||||||
a.operName like concat('%', #{params.keyWord}, '%') or
|
a."operName" like '%' || #{params.keyWord} || '%' or
|
||||||
a.phone like concat('%', #{params.keyWord}, '%')
|
a."phone" like '%' || #{params.keyWord} || '%'
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -35,43 +35,43 @@
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<insert id="insertOperlog">
|
<insert id="insertOperlog">
|
||||||
insert into "ynrealname"."sys_oper_log"("title", "user_id","business_type", "method", "request_method", "operator_type", "oper_url", "oper_ip", "oper_param", "json_result", "status", "error_msg")
|
insert into "ynrealname"."sys_oper_log"("title", "user_id","business_type", "method", "request_method", "operator_type", "oper_url", "oper_ip", "oper_param", "json_result", "status", "error_msg")
|
||||||
values (#{title}, #{userId}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operUrl}, #{operIp}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg})
|
values (#{title}, #{userId}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operUrl}, #{operIp}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg})
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<select id="selectOperLogList" resultType="com.bonus.system.api.domain.SysOperLog">
|
<select id="selectOperLogList" resultType="com.bonus.system.api.domain.SysOperLog">
|
||||||
<include refid="selectOperLogVo"/>
|
<include refid="selectOperLogVo"/>
|
||||||
<where>
|
<where>
|
||||||
<if test="title != null and title != ''">
|
<if test="title != null and title != ''">
|
||||||
AND title like concat('%', #{title}, '%')
|
AND "title" like '%' || #{title} || '%'
|
||||||
</if>
|
</if>
|
||||||
<if test="businessType != null">
|
<if test="businessType != null">
|
||||||
AND business_type = #{businessType}
|
AND "business_type" = #{businessType}
|
||||||
</if>
|
</if>
|
||||||
<if test="businessTypes != null and businessTypes.length > 0">
|
<if test="businessTypes != null and businessTypes.length > 0">
|
||||||
AND business_type in
|
AND "business_type" in
|
||||||
<foreach collection="businessTypes" item="businessType" open="(" separator="," close=")">
|
<foreach collection="businessTypes" item="businessType" open="(" separator="," close=")">
|
||||||
#{businessType}
|
#{businessType}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
<if test="status != null">
|
<if test="status != null">
|
||||||
AND status = #{status}
|
AND "status" = #{status}
|
||||||
</if>
|
</if>
|
||||||
<if test="operName != null and operName != ''">
|
<if test="operName != null and operName != ''">
|
||||||
AND oper_name like concat('%', #{operName}, '%')
|
AND "oper_name" like '%' || #{operName} || '%'
|
||||||
</if>
|
</if>
|
||||||
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
||||||
and date_format(oper_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
|
and to_char("oper_time", 'YYYYMMDD') >= to_char(to_date(#{params.beginTime}, 'YYYY-MM-DD'), 'YYYYMMDD')
|
||||||
</if>
|
</if>
|
||||||
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
||||||
and date_format(oper_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
and to_char("oper_time", 'YYYYMMDD') <= to_char(to_date(#{params.endTime}, 'YYYY-MM-DD'), 'YYYYMMDD')
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
order by oper_id desc
|
order by "oper_id" desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<delete id="deleteOperLogByIds" parameterType="Long">
|
<delete id="deleteOperLogByIds" parameterType="Long">
|
||||||
delete from sys_oper_log where oper_id in
|
delete from "ynrealname"."sys_oper_log" where "oper_id" in
|
||||||
<foreach collection="array" item="operId" open="(" separator="," close=")">
|
<foreach collection="array" item="operId" open="(" separator="," close=")">
|
||||||
#{operId}
|
#{operId}
|
||||||
</foreach>
|
</foreach>
|
||||||
|
|
@ -79,40 +79,40 @@
|
||||||
|
|
||||||
<select id="selectOperLogById" parameterType="Long" resultType="com.bonus.system.api.domain.SysOperLog">
|
<select id="selectOperLogById" parameterType="Long" resultType="com.bonus.system.api.domain.SysOperLog">
|
||||||
<include refid="selectOperLogVo"/>
|
<include refid="selectOperLogVo"/>
|
||||||
where oper_id = #{operId}
|
where "oper_id" = #{operId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="count" resultType="java.lang.Integer">
|
<select id="count" resultType="java.lang.Integer">
|
||||||
SELECT
|
SELECT
|
||||||
count(1)
|
count(1)
|
||||||
FROM
|
FROM
|
||||||
sys_oper_log sol
|
"ynrealname"."sys_oper_log" sol
|
||||||
where
|
where
|
||||||
create_time BETWEEN CONCAT(#{params.startTime},' 00:00:00') and CONCAT(#{params.endTime},' 23:59:59')
|
"create_time" BETWEEN #{params.startTime} || ' 00:00:00' and #{params.endTime} || ' 23:59:59'
|
||||||
<if test="params.type != null and params.type != ''">
|
<if test="params.type != null and params.type != ''">
|
||||||
and operator_type = #{params.type}
|
and "operator_type" = #{params.type}
|
||||||
</if>
|
</if>
|
||||||
<if test="params.module != null and params.module != ''">
|
<if test="params.module != null and params.module != ''">
|
||||||
and locate(#{params.module},title) > 0
|
and INSTR("title", #{params.module}) > 0
|
||||||
</if>
|
</if>
|
||||||
<if test="params.result != null and params.result != ''">
|
<if test="params.result != null and params.result != ''">
|
||||||
and locate(#{params.result},json_result) > 0
|
and INSTR("json_result", #{params.result}) > 0
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="list" resultType="com.bonus.system.api.domain.SysOperLog">
|
<select id="list" resultType="com.bonus.system.api.domain.SysOperLog">
|
||||||
select
|
select
|
||||||
su.username AS operName,
|
su."username" AS operName,
|
||||||
su.phone,
|
su."phone",
|
||||||
a.*
|
a.*
|
||||||
from(
|
from(
|
||||||
SELECT
|
SELECT
|
||||||
user_id,
|
"user_id",
|
||||||
oper_id AS operId,
|
"oper_id" AS operId,
|
||||||
title,
|
"title",
|
||||||
json_result as jsonResult,
|
"json_result" as jsonResult,
|
||||||
CASE
|
CASE
|
||||||
business_type
|
"business_type"
|
||||||
WHEN 1 THEN '查询'
|
WHEN 1 THEN '查询'
|
||||||
WHEN 2 THEN '新增'
|
WHEN 2 THEN '新增'
|
||||||
WHEN 3 THEN '修改'
|
WHEN 3 THEN '修改'
|
||||||
|
|
@ -126,35 +126,35 @@
|
||||||
ELSE '其他'
|
ELSE '其他'
|
||||||
END AS type,
|
END AS type,
|
||||||
CASE
|
CASE
|
||||||
operator_type
|
"operator_type"
|
||||||
WHEN 1 THEN '后台'
|
WHEN 1 THEN '后台'
|
||||||
WHEN 2 THEN 'APP'
|
WHEN 2 THEN 'APP'
|
||||||
ELSE '其他'
|
ELSE '其他'
|
||||||
END AS operatoType ,
|
END AS operatoType ,
|
||||||
create_time AS opersTime
|
"create_time" AS opersTime
|
||||||
FROM
|
FROM
|
||||||
sys_oper_log
|
"ynrealname"."sys_oper_log"
|
||||||
where
|
where
|
||||||
create_time BETWEEN CONCAT(#{params.startTime},' 00:00:00') and CONCAT(#{params.endTime},' 23:59:59')
|
"create_time" BETWEEN #{params.startTime} || ' 00:00:00' and #{params.endTime} || ' 23:59:59'
|
||||||
<if test="params.type != null and params.type != ''">
|
<if test="params.type != null and params.type != ''">
|
||||||
and operator_type = #{params.type}
|
and "operator_type" = #{params.type}
|
||||||
</if>
|
</if>
|
||||||
<if test="params.module != null and params.module != ''">
|
<if test="params.module != null and params.module != ''">
|
||||||
and locate(#{params.module},title) > 0
|
and INSTR("title", #{params.module}) > 0
|
||||||
</if>
|
</if>
|
||||||
<if test="params.result != null and params.result != ''">
|
<if test="params.result != null and params.result != ''">
|
||||||
and locate(#{params.result},json_result) > 0
|
and INSTR("json_result", #{params.result}) > 0
|
||||||
</if>
|
</if>
|
||||||
) a
|
) a
|
||||||
LEFT JOIN sys_user su ON su.id = a.user_id
|
LEFT JOIN "ynrealname"."sys_user" su ON su."id" = a."user_id"
|
||||||
order by a.opersTime DESC
|
order by a.opersTime DESC
|
||||||
<if test="offset != null and offset >= 0 and limit != null and limit >= 0">
|
<if test="offset != null and offset >= 0 and limit != null and limit >= 0">
|
||||||
limit #{offset}, #{limit}
|
OFFSET #{offset} ROWS FETCH NEXT #{limit} ROWS ONLY
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<update id="cleanOperLog">
|
<update id="cleanOperLog">
|
||||||
truncate table sys_oper_log
|
truncate table "ynrealname"."sys_oper_log"
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue