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

99 lines
4.8 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-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-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-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>
</mapper>