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.

77 lines
3.8 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="com.qs.serve.modules.qms.mapper.QmsGroupMapper">
<resultMap id="qmsGroupMap" type="com.qs.serve.modules.qms.entity.QmsGroup" >
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="descr" column="descr"/>
<result property="formId" column="form_id"/>
<result property="formContext" column="form_context"/>
<result property="publishState" column="publish_state"/>
<result property="version" column="version"/>
<result property="remark" column="remark"/>
<result property="createTime" column="create_time"/>
<result property="createBy" column="create_by"/>
<result property="updateTime" column="update_time"/>
<result property="updateBy" column="update_by"/>
<result property="tenantId" column="tenant_id"/>
<result property="delFlag" column="del_flag"/>
</resultMap>
<sql id="qmsGroupSql">
qms_group.`id`,
qms_group.`name`,
qms_group.`descr`,
qms_group.`form_id`,
qms_group.`form_context`,
qms_group.`publish_state`,
qms_group.`version`,
qms_group.`remark`,
qms_group.`create_time`,
qms_group.`create_by`,
qms_group.`update_time`,
qms_group.`update_by`,
qms_group.`tenant_id`,
qms_group.`del_flag` </sql>
<select id="selectQmsGroupList" parameterType="com.qs.serve.modules.qms.entity.QmsGroup" resultMap="qmsGroupMap">
SELECT <include refid="qmsGroupSql"/> FROM `qms_group` `qms_group`
<where>
<if test="query.id != null"> and `qms_group`.`id` = #{query.id}</if>
<if test="query.name != null and query.name != ''"> and `qms_group`.`name` = #{query.name}</if>
<if test="query.descr != null and query.descr != ''"> and `qms_group`.`descr` = #{query.descr}</if>
<if test="query.formId != null"> and `qms_group`.`form_id` = #{query.formId}</if>
<if test="query.formContext != null and query.formContext != ''"> and `qms_group`.`form_context` = #{query.formContext}</if>
<if test="query.publishState != null"> and `qms_group`.`publish_state` = #{query.publishState}</if>
<if test="query.version != null"> and `qms_group`.`version` = #{query.version}</if>
<if test="query.remark != null and query.remark != ''"> and `qms_group`.`remark` = #{query.remark}</if>
<if test="query.createTime != null"> and `qms_group`.`create_time` = #{query.createTime}</if>
<if test="query.createBy != null and query.createBy != ''"> and `qms_group`.`create_by` = #{query.createBy}</if>
<if test="query.updateTime != null"> and `qms_group`.`update_time` = #{query.updateTime}</if>
<if test="query.updateBy != null and query.updateBy != ''"> and `qms_group`.`update_by` = #{query.updateBy}</if>
<if test="query.tenantId != null and query.tenantId != ''"> and `qms_group`.`tenant_id` = #{query.tenantId}</if>
<if test="query.delFlag != null"> and `qms_group`.`del_flag` = #{query.delFlag}</if>
</where>
</select>
<select id="listByUserIdOrDeptId" parameterType="com.qs.serve.modules.qms.entity.QmsGroup" resultMap="qmsGroupMap">
SELECT
<include refid="qmsGroupSql"/>
FROM
qms_group qg
LEFT JOIN qms_group_scope qgs ON qg.id = qgs.group_id
WHERE
qg.del_flag = '0'
AND qgs.del_flag = '0'
AND
(
qgs.scope_type = '0'
OR ( qgs.scope_type = '1' AND qgs.scope_value = #{userId} )
OR (qgs.scope_type = '2' AND qgs.scope_value = #{deptId})
)
</select>
</mapper>