187 lines
6.7 KiB
XML
187 lines
6.7 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.material.project.mapper.ProjectMapper">
|
|
|
|
<!-- 工程实体映射 -->
|
|
<resultMap id="ProjectResult" type="com.bonus.material.project.domain.Project">
|
|
<id property="id" column="id"/>
|
|
<result property="pro_code" column="pro_code"/>
|
|
<result property="pro_name" column="pro_name"/>
|
|
<result property="voltage" column="voltage"/>
|
|
<result property="scale" column="scale"/>
|
|
<result property="project_type" column="project_type"/>
|
|
<result property="dict_label" column="dict_label"/>
|
|
<result property="org_name" column="org_name"/>
|
|
<result property="start_time" column="start_time"/>
|
|
<result property="put_time" column="put_time"/>
|
|
<result property="province" column="province"/>
|
|
<result property="mechanize_rate" column="mechanize_rate"/>
|
|
<result property="city" column="city"/>
|
|
<result property="county" column="county"/>
|
|
</resultMap>
|
|
|
|
<!-- 字典类型实体映射 -->
|
|
<resultMap id="ProjectTypeResult" type="com.bonus.material.project.domain.ProjectType">
|
|
<result property="dict_type" column="dict_type"/>
|
|
<result property="dict_value" column="dict_value"/>
|
|
<result property="dict_label" column="dict_label"/>
|
|
</resultMap>
|
|
|
|
<!-- 查询工程列表 -->
|
|
<select id="selectProjectList" parameterType="com.bonus.material.project.domain.Project" resultMap="ProjectResult">
|
|
select
|
|
jsp.id, pro_code, pro_name, voltage, scale,project_type,org_name, province, city, county,mechanize_rate,start_time, put_time , sdd.dict_label
|
|
from
|
|
jj_sing_project jsp
|
|
left join sys_dict_data sdd on sdd.dict_value = jsp.project_type and sdd.dict_type='bm_project_type'
|
|
<where>
|
|
<if test="pro_name != null and pro_name != ''">
|
|
AND pro_name like concat('%', #{pro_name}, '%')
|
|
</if>
|
|
<if test="voltage != null and voltage != ''">
|
|
AND voltage = #{voltage}
|
|
</if>
|
|
<if test="project_type != null and project_type != ''">
|
|
AND project_type = #{project_type}
|
|
</if>
|
|
<if test="org_name != null and org_name != ''">
|
|
AND org_name like concat('%', #{org_name}, '%')
|
|
</if>
|
|
</where>
|
|
order by id desc
|
|
</select>
|
|
|
|
<!-- 通过ID查询工程 -->
|
|
<select id="selectProjectById" resultMap="ProjectResult">
|
|
select
|
|
id, pro_code, pro_name, voltage,scale, project_type,org_name, province, city, county,mechanize_rate,start_time, put_time ,sdd.dict_label,jsp.remark
|
|
from
|
|
jj_sing_project jsp
|
|
left join sys_dict_data sdd on sdd.dict_value = jsp.project_type and sdd.dict_type='bm_project_type'
|
|
where
|
|
id = #{id}
|
|
</select>
|
|
|
|
<!-- 新增工程 -->
|
|
<insert id="insertProject" parameterType="com.bonus.material.project.domain.Project" useGeneratedKeys="true" keyProperty="id">
|
|
insert into
|
|
jj_sing_project
|
|
(pro_code,
|
|
pro_name,
|
|
voltage,
|
|
scale,
|
|
project_type,
|
|
org_name,
|
|
start_time,
|
|
put_time,
|
|
province,
|
|
city,
|
|
county,
|
|
mechanize_rate,
|
|
remark)
|
|
values (#{pro_code},
|
|
#{pro_name},
|
|
#{voltage},
|
|
#{scale},
|
|
#{project_type},
|
|
#{org_name},
|
|
#{start_time},
|
|
#{put_time},
|
|
#{province},
|
|
#{city},
|
|
#{county},
|
|
#{mechanize_rate},
|
|
#{remark})
|
|
</insert>
|
|
|
|
<!-- 修改工程 -->
|
|
<update id="updateProject" parameterType="com.bonus.material.project.domain.Project">
|
|
update jj_sing_project
|
|
<set>
|
|
<if test="pro_code != null and pro_code != ''">
|
|
pro_code = #{pro_code},
|
|
</if>
|
|
<if test="pro_name != null and pro_name != ''">
|
|
pro_name = #{pro_name},
|
|
</if>
|
|
<if test="voltage != null and voltage != ''">
|
|
voltage = #{voltage},
|
|
</if>
|
|
<if test="scale != null and scale != ''">
|
|
scale = #{scale},
|
|
</if>
|
|
<if test="project_type != null and project_type != ''">
|
|
project_type = #{project_type},
|
|
</if>
|
|
<if test="org_name != null and org_name != ''">
|
|
org_name = #{org_name},
|
|
</if>
|
|
<if test="province != null and province != ''">
|
|
province = #{province},
|
|
</if>
|
|
<if test="city != null and city != ''">
|
|
city = #{city},
|
|
</if>
|
|
<if test="county != null and county != ''">
|
|
county = #{county},
|
|
</if>
|
|
<if test="mechanize_rate != null and mechanize_rate != ''">
|
|
mechanize_rate = #{mechanize_rate},
|
|
</if>
|
|
<if test="start_time != null ">
|
|
start_time = #{start_time},
|
|
</if>
|
|
<if test="put_time != null ">
|
|
put_time = #{put_time},
|
|
</if>
|
|
<if test="remark != null ">
|
|
remark = #{remark},
|
|
</if>
|
|
</set>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<!-- 删除工程 -->
|
|
<delete id="deleteProjectById" >
|
|
delete from jj_sing_project where id = #{id}
|
|
</delete>
|
|
|
|
<!--批量删除工程-->
|
|
<delete id="delProjectBatch">
|
|
DELETE FROM jj_sing_project WHERE id IN
|
|
<foreach collection="list" item="id" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
|
|
|
|
<!-- 查询工程类型列表) -->
|
|
<select id="selectProjectTypeList" resultMap="ProjectTypeResult">
|
|
select
|
|
dict_type, dict_value, dict_label
|
|
from
|
|
sys_dict_data
|
|
where
|
|
dict_type = 'bm_project_type'
|
|
order by
|
|
dict_value asc
|
|
</select>
|
|
|
|
<select id="countByProjectName" resultType="java.lang.Integer">
|
|
select count(1)
|
|
from jj_sing_project
|
|
where pro_name = #{pro_name}
|
|
</select>
|
|
<select id="countByProjectCode" resultType="java.lang.Integer">
|
|
select count(*)
|
|
from jj_sing_project
|
|
where pro_code = #{pro_code}
|
|
</select>
|
|
<select id="countByProjectNameById" resultType="java.lang.Integer">
|
|
select count(1)
|
|
from jj_sing_project
|
|
where pro_name = #{proName}
|
|
and id !=#{id}
|
|
</select>
|
|
|
|
</mapper> |