济菏高速数据中心代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

112 lines
5.6 KiB

<?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.zc.business.mapper.DcOrganizationMapper">
<resultMap type="DcOrganization" id="DcOrganizationResult">
<result property="id" column="id" />
<result property="parentId" column="parent_id" />
<result property="organizationType" column="organization_type" />
<result property="organizationName" column="organization_name" />
<result property="organizationAddress" column="organization_address" />
<result property="stakeMark" column="stake_mark" />
<result property="rescueUnit" column="rescue_unit" />
<result property="description" column="description" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="direction" column="direction" />
</resultMap>
<sql id="selectDcOrganizationVo">
select id,direction, parent_id,
organization_type, organization_name,
organization_address, stake_mark,
rescue_unit, description, create_time,
update_time from dc_organization
</sql>
<select id="selectDcOrganizationList" parameterType="DcOrganization" resultMap="DcOrganizationResult">
<include refid="selectDcOrganizationVo"/>
<where>
<if test="parentId != null "> and parent_id = #{parentId}</if>
<if test="organizationType != null "> and organization_type = #{organizationType}</if>
<if test="organizationName != null and organizationName != ''"> and organization_name like concat('%', #{organizationName}, '%')</if>
</where>
</select>
<select id="selectDcOrganizationById" parameterType="Long" resultMap="DcOrganizationResult">
<include refid="selectDcOrganizationVo"/>
where id = #{id}
</select>
<select id="selectParen" resultType="java.lang.Long">
select count(1) from dc_organization where parent_id=#{id}
</select>
<insert id="insertDcOrganization" parameterType="DcOrganization">
insert into dc_organization
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="direction != null">direction,</if>
<if test="parentId != null">parent_id,</if>
<if test="organizationType != null">organization_type,</if>
<if test="organizationName != null and organizationName != ''">organization_name,</if>
<if test="organizationAddress != null">organization_address,</if>
<if test="stakeMark != null">stake_mark,</if>
<if test="rescueUnit != null">rescue_unit,</if>
<if test="description != null">`description`,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="direction != null">#{direction},</if>
<if test="parentId != null">#{parentId},</if>
<if test="organizationType != null">#{organizationType},</if>
<if test="organizationName != null and organizationName != ''">#{organizationName},</if>
<if test="organizationAddress != null">#{organizationAddress},</if>
<if test="stakeMark != null">#{stakeMark},</if>
<if test="rescueUnit != null">#{rescueUnit},</if>
<if test="description != null">#{description},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateDcOrganization" parameterType="DcOrganization">
update dc_organization
<trim prefix="SET" suffixOverrides=",">
<if test="direction != null">direction = #{direction},</if>
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="organizationType != null">organization_type = #{organizationType},</if>
<if test="organizationName != null and organizationName != ''">organization_name = #{organizationName},</if>
<if test="organizationAddress != null">organization_address = #{organizationAddress},</if>
<if test="stakeMark != null">stake_mark = #{stakeMark},</if>
<if test="rescueUnit != null">rescue_unit = #{rescueUnit},</if>
<if test="description != null">description = #{description},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteDcOrganizationById" parameterType="Long">
delete from dc_organization where id = #{id}
</delete>
<delete id="deleteDcOrganizationByIds" parameterType="String">
delete from dc_organization where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectDcOrganizationCar" resultType="java.util.HashMap">
SELECT vehicle_type vehicleType, COUNT(vehicle_type) carNum FROM dc_vehicles WHERE organization_id=#{id}
GROUP BY vehicle_type
</select>
<select id="selectEmployeesNum" resultType="java.lang.String">
select count(1) from dc_employees where organization_id=#{id}
</select>
</mapper>