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

209 lines
9.4 KiB
XML

<?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.bonus.sgzb.base.mapper.BmProjectInfoMapper">
<resultMap type="com.bonus.sgzb.base.domain.BmProjectInfo" id="BmProjectInfoResult">
<id property="proId" column="pro_id" />
<result property="proName" column="pro_name" />
<result property="status" column="status" />
<result property="typeId" column="type_id" />
<result property="linkMan" column="link_man" />
<result property="telphone" column="telphone" />
<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" />
<result property="typeName" column="name" />
</resultMap>
<sql id="bmProjectInfo">
select pro_id, pro_name, status, type_id, link_man, telphone, dept_id, del_flag, create_by, create_time,
update_by, update_time, remark, company_id
from bm_project_info
</sql>
<select id="getProjectInfoAll" parameterType="com.bonus.sgzb.base.domain.BmProjectInfo" resultMap="BmProjectInfoResult">
<!--<include refid="bmProjectInfo"/>-->
select a.pro_id, a.pro_name, a.status, a.type_id, a.link_man, a.telphone, a.dept_id, a.del_flag, a.create_by,
a.create_time,a.update_by, a.update_time, a.remark, a.company_id, b.dept_name, c.name
from bm_project_info a
left join sys_dept b on a.dept_id = b.dept_id
left join sys_dic c on a.type_id = c.id
where a.del_flag ='0'
<if test="proId != null and proId != ''">
AND a.pro_id = #{proId}
</if>
<if test="proName != null and proName != ''">
AND a.pro_name like concat('%', #{proName}, '%')
</if>
<if test="status != null and status != ''">
AND a.status = #{status}
</if>
<if test="typeId != null and typeId != ''">
AND a.type_id = #{typeId}
</if>
<if test="linkMan != null and linkMan != ''">
and a.link_man = #{linkMan}
</if>
<if test="telphone != null and telphone != ''">
and a.telphone = #{telphone}
</if>
<if test="deptId != null and deptId != ''">
and a.dept_id = #{deptId}
</if>
<if test="delFlag != null and delFlag != ''">
and a.del_flag = #{delFlag}
</if>
<if test="createBy != null and createBy != ''">
and a.create_by = #{createBy}
</if>
<if test="createTime != null and createTime != ''">
and a.create_time = #{createTime}
</if>
<if test="updateBy != null and updateBy != ''">
and a.update_by = #{updateBy}
</if>
<if test="updateTime != null and updateTime != ''">
and a.update_time = #{updateTime}
</if>
<if test="remark != null and remark != ''">
and a.remark = #{remark}
</if>
<if test="companyId != null and companyId != ''">
and a.company_id = #{companyId}
</if>
ORDER BY a.pro_id DESC
</select>
<select id="getProjectLot" parameterType="com.bonus.sgzb.base.domain.BmProjectInfo" resultMap="BmProjectInfoResult">
<!--<include refid="bmProjectInfo"/>-->
select pro_id,pro_name,status
from bm_project_info
where del_flag ='0'
</select>
<select id="getProjectInfo" parameterType="com.bonus.sgzb.base.domain.BmProjectInfo" resultMap="BmProjectInfoResult">
select a.pro_id, a.pro_name, a.status, a.type_id, a.link_man, a.telphone, a.dept_id, a.del_flag, a.create_by,
a.create_time,a.update_by, a.update_time, a.remark, a.company_id, b.dept_name, c.name
from bm_project_info a
left join sys_dept b on a.dept_id = b.dept_id
left join sys_dic c on a.type_id = c.id
where a.del_flag = '0'
<if test="proId != null and proId != ''">
AND a.pro_id = #{proId}
</if>
<if test="proName != null and proName != ''">
AND a.pro_name like concat('%', #{proName}, '%')
</if>
<if test="status != null and status != ''">
AND a.status = #{status}
</if>
<if test="typeId != null and typeId != ''">
AND a.type_id = #{typeId}
</if>
<if test="linkMan != null and linkMan != ''">
and a.link_man = #{linkMan}
</if>
<if test="telphone != null and telphone != ''">
and a.telphone = #{telphone}
</if>
<if test="deptId != null and deptId != ''">
and a.dept_id = #{deptId}
</if>
<if test="delFlag != null and delFlag != ''">
and a.del_flag = #{delFlag}
</if>
<if test="createBy != null and createBy != ''">
and a.create_by = #{createBy}
</if>
<if test="createTime != null and createTime != ''">
and a.create_time = #{createTime}
</if>
<if test="updateBy != null and updateBy != ''">
and a.update_by = #{updateBy}
</if>
<if test="updateTime != null and updateTime != ''">
and a.update_time = #{updateTime}
</if>
<if test="remark != null and remark != ''">
and a.remark = #{remark}
</if>
<if test="companyId != null and companyId != ''">
and a.company_id = #{companyId}
</if>
</select>
<select id="selectByName" resultType="java.lang.Integer">
select count(*) from bm_project_info
where
1 = 1
<if test="proName != null and proName != ''">and pro_name = #{proName}</if>
</select>
<insert id="projectInfoAdd" parameterType="com.bonus.sgzb.base.domain.BmProjectInfo">
insert into bm_project_info (
<if test="proName != null and proName != '' ">pro_name,</if>
<if test="status != null and status != '' ">status,</if>
<if test="typeId != null and typeId != '' ">type_id,</if>
<if test="linkMan != null and linkMan != '' ">link_man,</if>
<if test="telphone != null and telphone != ''">telphone,</if>
<if test="deptId != null and deptId != ''">dept_id,</if>
<if test="delFlag != null and delFlag != ''">del_flag,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="companyId != null and companyId != ''">company_id,</if>
create_time
)values(
<if test="proName != null and proName != ''">#{proName},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="typeId != null and typeId != ''">#{typeId},</if>
<if test="linkMan != null and linkMan != ''">#{linkMan},</if>
<if test="telphone != null and telphone != ''">#{telphone},</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="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="companyId != null and companyId != ''">#{companyId},</if>
sysdate()
)
</insert>
<update id="updateBmProjectInfo" parameterType="com.bonus.sgzb.base.domain.BmProjectInfo">
update bm_project_info
<set>
<if test="proName != null and proName != ''">pro_name = #{proName},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="typeId != null and typeId != ''">type_id = #{typeId},</if>
<if test="linkMan != null and linkMan != ''">link_man = #{linkMan},</if>
<if test="telphone != null and telphone != ''">telphone = #{telphone},</if>
<if test="deptId != null and deptId != ''">dept_id = #{deptId},</if>
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
<if test="createBy != null and createBy != ''">create_by =#{createBy},</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 pro_id = #{proId}
</update>
<delete id="deleteProjectInfoById" parameterType="Long">
update bm_project_info set del_flag = '2' where pro_id = #{proId}
</delete>
<delete id="remove" parameterType="Long">
delete from bm_project_info where pro_id in
<foreach item="proId" collection="array" open="(" separator="," close=")">
#{proId}
</foreach>
</delete>
</mapper>