devicesmgt/sgzb-modules/sgzb-base/src/main/resources/mapper/base/MaPropInfoMapper.xml

203 lines
11 KiB
XML
Raw Normal View History

2023-12-01 14:42:00 +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.MaPropInfoMapper">
2023-12-15 14:03:03 +08:00
<resultMap type="com.bonus.sgzb.base.domain.MaPropInfo" id="MaPropInfoResult">
<id property="propId" column="prop_id" />
<result property="propName" column="prop_name" />
<result property="code" column="code" />
<result property="status" column="status" />
<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" />
<result property="remark" column="remark" />
<result property="companyId" column="company_id" />
<result property="deptName" column="dept_name" />
</resultMap>
2023-12-19 00:31:13 +08:00
<resultMap type="com.bonus.sgzb.base.domain.MaPropSet" id="MaPropSetResult">
<result property="id" column="id" />
<result property="propId" column="prop_id" />
<result property="typeId" column="type_id" />
<result property="status" column="status" />
<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" />
<result property="remark" column="remark" />
<result property="companyId" column="company_id" />
</resultMap>
<resultMap type="com.bonus.sgzb.base.api.domain.MaType" id="MaTypeResult">
<result property="typeId" column="type_id" />
<result property="typeName" column="type_name" />
<result property="parentId" column="parent_id" />
<result property="status" column="status" />
<result property="num" column="num" />
<result property="unitId" column="unit_id" />
<result property="manageType" column="manage_type" />
<result property="leasePrice" column="lease_price" />
<result property="rentPrice" column="rent_price" />
<result property="buyPrice" column="buy_price" />
<result property="payPrice" column="pay_price" />
<result property="level" column="level" />
<result property="ratedLoad" column="rated_load" />
<result property="testLoad" column="test_load" />
<result property="holdingTime" column="holding_time" />
<result property="warnNum" column="warn_num" />
<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" />
<result property="isPlan" column="is_plan" />
<result property="isAncuo" column="is_ancuo" />
<result property="remark" column="remark" />
<result property="companyId" column="company_id" />
<result property="propName" column="prop_name" />
<result property="id" column="id" />
</resultMap>
2023-12-01 14:42:00 +08:00
<sql id="selectMaPropInfoVo">
2023-12-15 14:03:03 +08:00
select prop_id, prop_name, code, status, dept_id, del_flag, create_by, create_time, remark, company_id
2023-12-01 14:42:00 +08:00
from ma_prop_info
</sql>
2023-12-19 00:31:13 +08:00
<select id="selectMaType" resultMap="MaTypeResult" parameterType="com.bonus.sgzb.base.api.domain.MaType">
select m.type_id, m.type_name, m.parent_id, m.status, m.num, m.unit_id, m.unit_name, m.manage_type,
m.lease_price, m.rent_price, m.buy_price, m.pay_price, m.level, m.rated_load, m.test_load,
m.holding_time, m.warn_num, m.del_flag, m.create_by, m.create_time,
m.remark, m.company_id ,e.prop_name,l.id
from ma_type m
left join ma_prop_set l on m.type_id = l.type_id
left join ma_prop_info e on e.prop_id = l.prop_id
<where>
level = 4 and m.status = '0'
<if test="typeName != null and typeName !=''">
AND type_name like concat('%',#{typeName},'%')
</if>
</where>
</select>
2023-12-01 14:42:00 +08:00
2023-12-19 00:31:13 +08:00
<insert id="insertMaPropSet" parameterType="com.bonus.sgzb.base.domain.MaPropSet">
insert into ma_prop_set
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="propId != null">prop_id,</if>
<if test="typeId != null">type_id,</if>
<if test="status != null">status,</if>
<if test="delFlag != null">del_flag,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="companyId != null">company_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="propId != null">#{propId},</if>
<if test="typeId != null">#{typeId},</if>
<if test="status != null">#{status},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="companyId != null">#{companyId},</if>
</trim>
</insert>
<update id="updateMaPropSet">
update ma_prop_set
<set>
<if test="propId != null and propId != ''" >prop_id = #{propId},</if>
<if test="typeId != null and typeId != ''">type_id = #{typeId},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="createTime != null and createTime != ''">create_time = #{createTime},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="companyId != null and companyId != ''">company_id = #{companyId},</if>
update_time = sysdate()
</set>
where type_id = #{typeId}
</update>
2023-12-08 09:51:56 +08:00
<insert id="insertProp" parameterType="com.bonus.sgzb.base.mapper.MaPropInfoMapper" useGeneratedKeys="true" keyProperty="propId">
2023-12-01 14:42:00 +08:00
insert into ma_prop_info(
<if test="propId != null and propId != 0">prop_id,</if>
2023-12-15 14:03:03 +08:00
<if test="propName != null and propName != ''">prop_name,</if>
<if test="code != null and code != ''">code,</if>
2023-12-01 14:42:00 +08:00
<if test="status != null and status != 0">status,</if>
<if test="deptId != null and deptId != ''">dept_id,</if>
<if test="delFlag != null and delFlag != 0">del_flag,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="companyId != null and companyId != ''">company_id,</if>
create_time
)values(
<if test="propId != null and propId != 0">#{propId},</if>
2023-12-15 14:03:03 +08:00
<if test="propName != null and propName != ''">#{propName},</if>
<if test="code != null and code != ''">#{code},</if>
2023-12-01 14:42:00 +08:00
<if test="status != null and status != 0">#{status},</if>
<if test="deptId != null and deptId != ''">#{deptId},</if>
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="companyId != null and companyId != ''">#{companyId},</if>
sysdate()
)
</insert>
<update id="updateMaProp">
update ma_prop_info
<set>
<if test="propName != null and propName != ''">prop_name = #{propName},</if>
2023-12-15 14:03:03 +08:00
<if test="code != null and code != ''">code = #{code},</if>
2023-12-01 14:42:00 +08:00
<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 prop_id = #{propId}
</update>
<delete id="deleteMaProp">
update ma_prop_info set del_flag = '2' where prop_id = #{propId}
</delete>
2023-12-19 00:31:13 +08:00
<delete id="deleteMaPropSetByPropIds">
delete from ma_prop_set where type_id =#{typeId}
</delete>
2023-12-15 14:03:03 +08:00
<select id="selectMaPropSet" resultType="com.bonus.sgzb.base.domain.MaPropInfo" resultMap="MaPropInfoResult">
select a.prop_id, a.prop_name, a.code, a.status, a.dept_id, a.del_flag, a.create_by,
a.create_time, a.remark, a.company_id ,b.dept_name
from ma_prop_info a
left join sys_dept b on a.dept_id = b.dept_id
<where> a.del_flag = '0'
2023-12-01 14:42:00 +08:00
<if test="propName != null and propName != ''">
2023-12-15 14:03:03 +08:00
AND a.prop_name like concat('%', #{propName}, '%')
2023-12-01 14:42:00 +08:00
</if>
</where>
</select>
2023-12-15 18:59:41 +08:00
<select id="selectMaPropSets" resultType="com.bonus.sgzb.base.domain.MaPropInfo" resultMap="MaPropInfoResult">
select prop_id, prop_name
from ma_prop_info
<where> del_flag = '0'
<if test="propName != null and propName != ''">
AND a.prop_name like concat('%', #{propName}, '%')
</if>
</where>
</select>
2023-12-15 14:03:03 +08:00
<select id="checkPropNameUnique" resultType="com.bonus.sgzb.base.domain.MaPropInfo" resultMap="MaPropInfoResult">
2023-12-01 14:42:00 +08:00
<include refid="selectMaPropInfoVo"/>
where prop_name = #{propName} limit 1
</select>
2023-12-19 00:31:13 +08:00
<select id="checkPropIdUnique" resultType="com.bonus.sgzb.base.domain.MaPropSet" resultMap="MaPropSetResult">
select id,prop_id,type_id,status,del_flag,create_by,create_time,update_by,update_time,remark,company_id
from ma_prop_set
where type_id = #{typeId} and prop_id = #{propId}
</select>
2023-12-01 14:42:00 +08:00
</mapper>