2023-11-28 20:33:38 +08:00
|
|
|
<?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">
|
2023-12-08 09:51:56 +08:00
|
|
|
<mapper namespace="com.bonus.sgzb.base.mapper.MaHouseMapper">
|
2023-11-28 20:33:38 +08:00
|
|
|
|
2023-12-08 15:45:04 +08:00
|
|
|
<resultMap type="com.bonus.sgzb.base.domain.MaHouse" id="SysHouseResult">
|
2023-11-28 20:33:38 +08:00
|
|
|
<id property="houseId" column="house_id" />
|
|
|
|
|
<result property="houseName" column="house_name" />
|
|
|
|
|
<result property="parentId" column="parent_id" />
|
2023-12-08 15:45:04 +08:00
|
|
|
<result property="status" column="status" />
|
2023-11-28 20:33:38 +08:00
|
|
|
<result property="deptId" column="dept_id" />
|
|
|
|
|
<result property="delFlag" column="del_flag" />
|
|
|
|
|
<result property="createBy" column="create_by" />
|
|
|
|
|
<result property="createTime" column="create_time" />
|
|
|
|
|
<result property="updateBy" column="update_by" />
|
|
|
|
|
<result property="updateTime" column="update_time" />
|
2023-12-08 15:45:04 +08:00
|
|
|
<result property="remark" column="remark" />
|
2023-11-28 20:33:38 +08:00
|
|
|
<result property="companyId" column="company_id" />
|
2023-12-08 15:45:04 +08:00
|
|
|
<result property="sort" column="sort" />
|
2023-11-28 20:33:38 +08:00
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<sql id="selectHouseVo">
|
2023-12-08 15:45:04 +08:00
|
|
|
select house_id, house_name, parent_id, status, dept_id, del_flag, create_by, create_time, remark, company_id, sort
|
2023-11-28 20:33:38 +08:00
|
|
|
from ma_house_info
|
|
|
|
|
</sql>
|
|
|
|
|
|
2023-12-08 15:45:04 +08:00
|
|
|
<insert id="insertHouse" parameterType="com.bonus.sgzb.base.domain.MaHouse" useGeneratedKeys="true" keyProperty="houseId">
|
2023-11-28 20:33:38 +08:00
|
|
|
insert into ma_house_info(
|
|
|
|
|
<if test="houseId != null and houseId != 0">house_id,</if>
|
|
|
|
|
<if test="houseName != null and houseName != ''">house_name,</if>
|
|
|
|
|
<if test="parentId != null and parentId != 0">parent_id,</if>
|
|
|
|
|
<if test="status != null and status != ''">status,</if>
|
|
|
|
|
<if test="deptId != null and deptId != 0">dept_id,</if>
|
|
|
|
|
<if test="delFlag != null and delFlag != ''">del_flag,</if>
|
|
|
|
|
<if test="remark != null and remark != ''">remark,</if>
|
|
|
|
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
|
|
|
|
<if test="companyId != null and companyId != ''">company_id,</if>
|
|
|
|
|
create_time
|
|
|
|
|
)values(
|
|
|
|
|
<if test="houseId != null and houseId != 0">#{houseId},</if>
|
|
|
|
|
<if test="houseName != null and houseName != ''">#{houseName},</if>
|
|
|
|
|
<if test="parentId != null and parentId != 0">#{parentId},</if>
|
|
|
|
|
<if test="status != null and status != ''">#{status},</if>
|
|
|
|
|
<if test="deptId != null and deptId != 0">#{deptId},</if>
|
|
|
|
|
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
|
|
|
|
|
<if test="remark != null and remark != ''">#{remark},</if>
|
|
|
|
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
|
|
|
|
<if test="companyId != null and companyId != ''">#{companyId},</if>
|
|
|
|
|
sysdate()
|
|
|
|
|
)
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<update id="updateHouse">
|
|
|
|
|
update ma_house_info
|
|
|
|
|
<set>
|
|
|
|
|
<if test="houseName != null and houseName != ''">house_name = #{houseName},</if>
|
|
|
|
|
<if test="parentId != null and parentId != ''">parent_id = #{parentId},</if>
|
|
|
|
|
<if test="status != null and status != ''">status = #{status},</if>
|
|
|
|
|
<if test="deptId != null and deptId != ''">dept_id = #{deptId},</if>
|
|
|
|
|
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
|
|
|
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
|
|
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
|
|
|
|
<if test="companyId != null and companyId != ''">company_id = #{companyId},</if>
|
|
|
|
|
update_time = sysdate()
|
|
|
|
|
</set>
|
|
|
|
|
where house_id = #{houseId}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteHouseById" parameterType="Long">
|
|
|
|
|
update ma_house_info set del_flag = '2' where house_id = #{houseId}
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
|
2023-12-08 15:45:04 +08:00
|
|
|
<select id="selectHouseList" parameterType="com.bonus.sgzb.base.domain.MaHouse" resultMap="SysHouseResult">
|
|
|
|
|
select house_id, house_name, parent_id, status, dept_id, del_flag, create_by, create_time, remark, company_id, sort
|
|
|
|
|
from ma_house_info
|
2023-11-28 20:33:38 +08:00
|
|
|
<where>
|
|
|
|
|
<if test="houseName != null and houseName != ''">
|
|
|
|
|
AND house_name like concat('%', #{houseName}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
</select>
|
|
|
|
|
|
2023-12-08 15:45:04 +08:00
|
|
|
<select id="selectHouseById" parameterType="com.bonus.sgzb.base.domain.MaHouse" resultMap="SysHouseResult">
|
2023-11-28 20:33:38 +08:00
|
|
|
<include refid="selectHouseVo"/>
|
|
|
|
|
where house_id = #{houseId}
|
2023-12-08 15:45:04 +08:00
|
|
|
order by sort
|
2023-11-28 20:33:38 +08:00
|
|
|
</select>
|
|
|
|
|
|
2023-12-08 15:45:04 +08:00
|
|
|
<select id="hasChildByHouseId" parameterType="Long">
|
2023-11-28 20:33:38 +08:00
|
|
|
select count(1) from ma_house_info
|
|
|
|
|
where del_flag = '0' and parent_id = #{houseId} limit 1
|
|
|
|
|
</select>
|
|
|
|
|
|
2023-12-08 15:45:04 +08:00
|
|
|
<select id="selectHouse" parameterType="com.bonus.sgzb.base.domain.MaHouse" resultMap="SysHouseResult">
|
2023-11-28 20:33:38 +08:00
|
|
|
<include refid="selectHouseVo"/>
|
|
|
|
|
</select>
|
|
|
|
|
|
2023-12-08 15:45:04 +08:00
|
|
|
<select id="selectHouseParent" parameterType="com.bonus.sgzb.base.domain.MaHouse" resultMap="SysHouseResult">
|
|
|
|
|
<include refid="selectHouseVo"/>
|
|
|
|
|
where parent_id = #{parentId}
|
|
|
|
|
order by sort
|
|
|
|
|
</select>
|
|
|
|
|
<select id="checkHouseNameUnique" parameterType= "String" resultMap="SysHouseResult">
|
|
|
|
|
<include refid="selectHouseVo"/>
|
|
|
|
|
where house_name=#{houseName} limit 1
|
|
|
|
|
</select>
|
2023-11-28 20:33:38 +08:00
|
|
|
</mapper>
|