数据库语句缺漏问题

newFrame
anthonywj 3 years ago
parent b4f09051b5
commit e07922d3b2

@ -120,7 +120,8 @@
#{CustomerId},
#{locInvCode},
#{locSubInvCode},
#{dept},#{comments}
#{dept},
#{comments}
)
</insert>
@ -153,4 +154,61 @@
from auth_user
where userFlag != 0
</select>
<select id="selectNotSelectUser" resultType="com.glxp.api.entity.auth.AuthAdmin">
select *
from auth_user
<where>
userFlag != 0
<if test="userIds != null and userIds.size()!=0">
and id not in
<foreach collection="userIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
</select>
<select id="selectAllocatedList" parameterType="com.glxp.api.req.auth.AuthAdminQueryRequest"
resultType="com.glxp.api.entity.auth.AuthAdmin">
select u.*
from auth_user u
left join sys_user_role sur on u.id = sur.user_id
left join sys_role r on r.role_id = sur.role_id
<where>
<if test="roleId != null and '' != roleId">
AND r.role_id =#{roleId}
</if>
</where>
</select>
<select id="selectUnallocatedList" parameterType="com.glxp.api.req.auth.AuthAdminQueryRequest"
resultType="com.glxp.api.entity.auth.AuthAdmin">
select u.*
from auth_user u
left join sys_user_role sur on u.id = sur.user_id
left join sys_role r on r.role_id = sur.role_id
<where>
<if test="ids!=null and ids.size()!=0">
u.id not in
<foreach collection="ids" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test="roleId != null and '' != roleId">
AND r.role_id <![CDATA[ <> ]]> #{roleId}
</if>
<if test="userName != null and '' != userName">
AND u.user_name LIKE concat('%', #{userName}, '%')
</if>
</where>
</select>
</mapper>

@ -8,9 +8,15 @@
SELECT *
FROM auth_dept
<where>
<if test="flag != null and flag != ''">
<if test="id != null ">
and id = #{id}
</if>
<if test="flag != null ">
and flag = #{flag}
</if>
<if test="parentId != null and parentId != ''">
and parentId = #{parentId}
</if>
<if test="name != null and '' != name">
AND `name` LIKE CONCAT('%',#{name},'%')
</if>
@ -22,10 +28,10 @@
<insert id="insertDept" keyProperty="id" parameterType="com.glxp.api.entity.auth.DeptEntity">
INSERT INTO auth_dept(`name`, `flag`, `remark`, updateTime, code)
INSERT INTO auth_dept(`name`, `flag`, `remark`, updateTime, code, parentId)
values (#{name},
#{flag},
#{remark}, #{updateTime}, #{code})
#{remark}, #{updateTime}, #{code}, #{parentId})
</insert>
<update id="updateDept" parameterType="com.glxp.api.entity.auth.DeptEntity">
@ -36,6 +42,7 @@
<if test="remark != null">remark=#{remark},</if>
<if test="code != null">code=#{code},</if>
<if test="updateTime != null">updateTime=#{updateTime},</if>
<if test="parentId != null">parentId=#{parentId},</if>
</trim>
WHERE id=#{id}
</update>

Loading…
Cancel
Save