mx_datav_gs/mxdata_v-system/target/classes/mybatis/engine/MxProjectMapper.xml

108 lines
4.5 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.alonginfo.project.engine.mapper.MxProjectMapper">
<resultMap type="MxProject" id="MxProjectResult">
<id property="proId" column="pro_id" />
<result property="proName" column="pro_name" />
<result property="proState" column="pro_state" />
<result property="themeId" column="theme_id" />
<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="themeName" column="theme_name" />
<result property="remark" column="remark" />
</resultMap>
<!-- 工程列表-->
<select id="selectProject" parameterType="MxProject" resultMap="MxProjectResult">
select ma.pro_id, ma.pro_name, ma.pro_state, ma.theme_id, ma.create_by, ma.create_time ,ma.update_by , ma.update_time ,ma.remark , us.theme_name
from mx_project ma left join mx_theme_manager us on ma.theme_id = us.theme_id
<where>
<if test="userId != null and userId != 1 ">
AND ma.pro_state = '0'
</if>
<if test="proName != null and proName != ''">
AND ma.pro_name like concat('%', #{proName}, '%')
</if>
</where>
order by create_time desc
</select>
<!-- 检测工程名是否唯一-->
<select id="selectProjectForName" parameterType="MxProject" resultMap="MxProjectResult">
select ma.pro_id, ma.pro_name, ma.pro_state, ma.theme_id, ma.create_by, ma.create_time
from mx_project ma
<where>
<if test="proName != null and proName != ''">
AND pro_name = #{proName}
</if>
</where>
</select>
<!-- 新增工程 -->
<insert id="insertPro" parameterType="MxProject">
insert into mx_project (
<if test="proId != null and proId != '' ">pro_id,</if>
<if test="proName != null and proName != '' ">pro_name,</if>
<if test="proState != null and proState != '' ">pro_state,</if>
<if test="themeId != null and themeId != '' ">theme_id,</if>
<if test="createBy != null and createBy != '' ">create_by,</if>
<if test="remark != null and remark != '' ">remark,</if>
create_time
) values (
<if test="proId != null and proId != '' ">#{proId},</if>
<if test="proName != null and proName != '' ">#{proName},</if>
<if test="proState != null and proState != '' ">#{proState},</if>
<if test="themeId != null and themeId != '' ">#{themeId},</if>
<if test="createBy != null and createBy != '' ">#{createBy},</if>
<if test="remark != null and remark != '' ">remark,</if>
sysdate()
)
</insert>
<!-- 根据id查询工程信息 -->
<select id="getInfo" parameterType="MxProject" resultMap="MxProjectResult">
select ma.pro_id, ma.pro_name, ma.pro_state, ma.theme_id, ma.create_by, ma.create_time ,ma.update_by , ma.update_time ,ma.remark
from mx_project ma
<where>
<if test="proId != null and proId != ''">
AND ma.pro_id = #{proId}
</if>
</where>
</select>
<!-- 更新工程信息-->
<update id="updateMxProject" parameterType="MxProject">
update mx_project
<set>
<if test="proName != null and proName != ''">pro_name = #{proName},</if>
<if test="themeId != null and themeId != ''">theme_id = #{themeId},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
where pro_id = #{proId}
</update>
<!-- 删除工程信息 -->
<delete id="deleteProjects" parameterType="String">
delete from mx_project where pro_id in
<foreach item="proId" collection="array" open="(" separator="," close=")">
#{proId}
</foreach>
</delete>
<!-- 改变工程状态-->
<update id="changeProState" parameterType="String">
update mx_project set pro_state = #{proState} where pro_id = #{proId}
</update>
</mapper>