智慧保安后台管理-验收版本
Administrator
2021-12-01 ffa79b721ba96bd12b4ca394b8849a6b0c7bf01e
枪支接口修改,部门树修改
7 files modified
227 ■■■■■ changed files
src/main/java/org/springblade/modules/equipage/controller/GunController.java 11 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/equipage/mapper/GunMapper.java 6 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/equipage/mapper/GunMapper.xml 37 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/equipage/service/GunService.java 8 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/equipage/service/impl/GunServiceImpl.java 12 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/equipage/vo/GunVo.java 11 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/mapper/DeptMapper.xml 142 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/equipage/controller/GunController.java
@@ -51,6 +51,17 @@
        return R.data(pages);
    }
    /**
     * 查询枪支数据
     * @param query page,size
     * @param gun 枪支信息对象
     */
    @GetMapping("/getGunList")
    public R<List<GunVo>> getGunList(GunVo gun, Query query) {
        return R.data(gunService.getGunList(gun));
    }
    /**
     * 新增
     * @param gun 枪支信息对象
src/main/java/org/springblade/modules/equipage/mapper/GunMapper.java
@@ -29,4 +29,10 @@
     * @return
     */
    GunVo selectGunInfo(@Param("gun") Gun gun);
    /**
     * 查询枪支数据
     * @param gun 枪支信息对象
     */
    List<GunVo> getGunList(@Param("gun")GunVo gun);
}
src/main/java/org/springblade/modules/equipage/mapper/GunMapper.xml
@@ -50,4 +50,41 @@
            and sg.id = #{gun.id}
        </if>
    </select>
    <!--查询枪支数据-->
    <select id="getGunList" resultType="org.springblade.modules.equipage.vo.GunVo">
        SELECT
        sg.*,bt.dept_name AS tenantName,sll.longitude jd,sll.latitude wd,sll.record_time recordTime
        FROM
        sys_gun sg
        LEFT JOIN
        blade_dept bt
        ON
        sg.dept_id = bt.id
        left join
        sys_live_location sll
        on
        sll.worker_id = sg.id
        WHERE
        1=1
        and type = 3
        <if test="gun.tenantName!=null and  gun.tenantName!=''">
            and bt.dept_name like concat('%', #{gun.tenantName},'%')
        </if>
        <if test="gun.deptId!=null and gun.deptId!=''">
            and sg.dept_id = #{gun.deptId}
        </if>
        <if test="gun.gunCardNumber!=null and gun.gunCardNumber!=''">
            and sg.gun_card_number like concat('%', #{gun.gunCardNumber},'%')
        </if>
        <if test="gun.cardNumber!=null and gun.cardNumber!=''">
            and sg.card_number like concat('%', #{gun.cardNumber},'%')
        </if>
        <if test="gun.issueUnit!=null and gun.issueUnit!=''">
            and sg.issue_unit like concat('%', #{gun.issueUnit},'%')
        </if>
        <if test="gun.personInCharge!=null and gun.personInCharge!=''">
            and sg.person_in_charge like concat('%', #{gun.personInCharge},'%')
        </if>
    </select>
</mapper>
src/main/java/org/springblade/modules/equipage/service/GunService.java
@@ -4,6 +4,8 @@
import org.springblade.modules.equipage.entity.Gun;
import org.springblade.modules.equipage.vo.GunVo;
import java.util.List;
public interface GunService extends IService<Gun> {
    /**
@@ -20,4 +22,10 @@
     * @return
     */
    IPage<GunVo> selectGunPage(IPage<GunVo> page, GunVo gun);
    /**
     * 查询枪支数据
     * @param gun 枪支信息对象
     */
    List<GunVo> getGunList(GunVo gun);
}
src/main/java/org/springblade/modules/equipage/service/impl/GunServiceImpl.java
@@ -8,6 +8,8 @@
import org.springblade.modules.equipage.vo.GunVo;
import org.springframework.stereotype.Service;
import java.util.List;
/**
 * 枪支服务实现类
 * @author zhongrj
@@ -34,4 +36,14 @@
    public GunVo selectGunInfo(Gun gun) {
        return baseMapper.selectGunInfo(gun);
    }
    /**
     * 查询枪支数据
     * @param gun 枪支信息对象
     */
    @Override
    public List<GunVo> getGunList(GunVo gun) {
        return baseMapper.getGunList(gun);
    }
}
src/main/java/org/springblade/modules/equipage/vo/GunVo.java
@@ -1,9 +1,12 @@
package org.springblade.modules.equipage.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springblade.modules.equipage.entity.Gun;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
 * @author zhongrj
@@ -12,4 +15,12 @@
public class GunVo extends Gun implements Serializable {
    private String tenantName;
    private String jd;
    private String wd;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date recordTime;
}
src/main/java/org/springblade/modules/system/mapper/DeptMapper.xml
@@ -103,6 +103,43 @@
    </select>
    <!--懒加载获取部门树形结构(包含用户数据)-->
<!--    <select id="lazyTreeUser" resultMap="treeNodeResultMap">-->
<!--        select DISTINCT  * from (-->
<!--            (SELECT-->
<!--              dept.id,-->
<!--              dept.parent_id,-->
<!--              dept.dept_name AS title,-->
<!--              dept.id AS "value",-->
<!--              dept.id AS "key",-->
<!--                        (-->
<!--                            SELECT-->
<!--                                CASE WHEN count(1) > 0 THEN 1 ELSE 0 END-->
<!--                            FROM-->
<!--                                blade_dept-->
<!--                            WHERE-->
<!--                                parent_id = dept.id and is_deleted = 0-->
<!--                        ) AS "has_children"-->
<!--                    FROM-->
<!--                        blade_dept dept-->
<!--                    WHERE-->
<!--                        dept.is_deleted = 0-->
<!--            )-->
<!--            union-->
<!--            (select-->
<!--                id,-->
<!--                dept_id  parent_id,-->
<!--                real_name AS title,-->
<!--                id AS "value",-->
<!--                id AS "key",-->
<!--                0 as "has_children"-->
<!--                from blade_user-->
<!--            )-->
<!--        )c-->
<!--    </select>    -->
    <!--懒加载获取部门树形结构(包含用户数据)-->
    <select id="lazyTreeUser" resultMap="treeNodeResultMap">
        select DISTINCT  * from (
            (SELECT
@@ -121,25 +158,106 @@
                        ) AS "has_children"
                    FROM
                        blade_dept dept
                                        left join
                                        sys_information si
                                        on
                                        si.departmentid = dept.id
                    WHERE
                        dept.is_deleted = 0
                        and si.stats = 2
                        and si.departmentid !=1432626178757275649
                    <if test="parentId!=null and parentId!=0">
                        and si.departmentid = 1111
                    </if>
            )
            union
            (select
                id,
                dept_id  parent_id,
                real_name AS title,
                id AS "value",
                id AS "key",
                0 as "has_children"
                from blade_user
            )
            <if test="parentId!=null and parentId!=0">
                union
                (select
                    bu.id,
                    bu.dept_id  parent_id,
                    real_name AS title,
                    bu.id AS "value",
                    bu.id AS "key",
                    0 as "has_children"
                    from blade_user bu
                                    left join
                                    blade_dept bd
                                    on
                                    bd.id = bu.dept_id
                                    left join
                                    sys_information si
                                    on
                                    si.departmentid = bd.id
                                    where bd.is_deleted = 0
                                    and bu.is_deleted = 0
                                    and bu.`status` =1
                                    and si.stats = 2
                                    and si.departmentid = #{parentId}
                                    and si.departmentid !=1432626178757275649
                )
            </if>
        )c
    </select>
    <!--懒加载获取部门树形结构(包含用户数据)-->
<!--    <select id="lazyTreeUser" resultMap="treeNodeResultMap">-->
<!--        select DISTINCT  * from (-->
<!--            (SELECT-->
<!--              dept.id,-->
<!--              dept.parent_id,-->
<!--              dept.dept_name AS title,-->
<!--              dept.id AS "value",-->
<!--              dept.id AS "key",-->
<!--                        (-->
<!--                            SELECT-->
<!--                                CASE WHEN count(1) > 0 THEN 1 ELSE 0 END-->
<!--                            FROM-->
<!--                                blade_dept-->
<!--                            WHERE-->
<!--                                parent_id = dept.id and is_deleted = 0-->
<!--                        ) AS "has_children"-->
<!--                    FROM-->
<!--                        blade_dept dept-->
<!--                                        left join-->
<!--                                        sys_information si-->
<!--                                        on-->
<!--                                        si.departmentid = dept.id-->
<!--                    WHERE-->
<!--                        dept.is_deleted = 0-->
<!--                                                and si.stats = 2-->
<!--                                                and (si.departmentid = 1442114073838800898-->
<!--                                                or si.departmentid = 1442115701350387714)-->
<!--            )-->
<!--            union-->
<!--            (select-->
<!--                bu.id,-->
<!--                bu.dept_id  parent_id,-->
<!--                real_name AS title,-->
<!--                bu.id AS "value",-->
<!--                bu.id AS "key",-->
<!--                0 as "has_children"-->
<!--                from blade_user bu-->
<!--                                left join-->
<!--                                blade_dept bd-->
<!--                                on-->
<!--                                bd.id = bu.dept_id-->
<!--                                left join-->
<!--                                sys_information si-->
<!--                                on-->
<!--                                si.departmentid = bd.id-->
<!--                                where bd.is_deleted = 0-->
<!--                                and bu.is_deleted = 0-->
<!--                                and bu.`status` =1-->
<!--                                and si.stats = 2-->
<!--                                and (si.departmentid = 1442114073838800898-->
<!--                                or si.departmentid = 1442115701350387714)-->
<!--            )-->
<!--        )c-->
<!--    </select>-->
    <!--懒加载获取部门树形结构(包含用户数据)-->
    <select id="lazyTreeUsers" resultType="org.springblade.modules.system.node.TreeNodes" >
        select DISTINCT
        *