Commit 3d6e5caa authored by 周昊's avatar 周昊

1、修改楼层列表筛选,导出删除

parent 8d797c53
......@@ -43,6 +43,7 @@ public class LedgerFloorController extends BaseController
public TableDataInfo list(LedgerFloor ledgerFloor)
{
startPage();
ledgerFloor.setDeptId(getDeptId());
List<LedgerFloor> list = ledgerFloorService.selectLedgerFloorList(ledgerFloor);
return getDataTable(list);
}
......@@ -55,6 +56,7 @@ public class LedgerFloorController extends BaseController
@PostMapping("/export")
public void export(HttpServletResponse response, LedgerFloor ledgerFloor)
{
ledgerFloor.setDeptId(getDeptId());
List<LedgerFloor> list = ledgerFloorService.selectLedgerFloorList(ledgerFloor);
ExcelUtil<LedgerFloor> util = new ExcelUtil<LedgerFloor>(LedgerFloor.class);
util.exportExcel(response, list, "基础数据-楼层数据");
......@@ -78,6 +80,7 @@ public class LedgerFloorController extends BaseController
@PostMapping
public AjaxResult add(@RequestBody LedgerFloor ledgerFloor)
{
ledgerFloor.setCreateBy(getUsername());
return toAjax(ledgerFloorService.insertLedgerFloor(ledgerFloor));
}
......@@ -89,6 +92,7 @@ public class LedgerFloorController extends BaseController
@PutMapping
public AjaxResult edit(@RequestBody LedgerFloor ledgerFloor)
{
ledgerFloor.setUpdateBy(getUsername());
return toAjax(ledgerFloorService.updateLedgerFloor(ledgerFloor));
}
......
......@@ -23,23 +23,21 @@ public class LedgerFloor extends BaseEntityClean
private Long id;
/** 楼宇id */
@Excel(name = "楼宇id")
private Long buildingId;
/** 楼层名称 */
@Excel(name = "楼层名称")
@Excel(name = "楼层名称",sort = 2)
private String name;
/** 楼层属性 */
@Excel(name = "楼层属性")
@Excel(name = "楼层属性",sort = 3)
private String type;
/** 房间数量 */
@Excel(name = "房间数量")
private Long roomNumber;
/** 状态(0正常 1停用) */
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
@Excel(name = "状态", readConverterExp = "0=正常,1=停用",sort = 4)
private String status;
/** 删除标志(0代表存在 1代表删除) */
......@@ -49,7 +47,12 @@ public class LedgerFloor extends BaseEntityClean
* 楼栋名称
*/
@TableField(exist = false)
@Excel(name = "楼宇名称",sort = 1)
private String buildingName;
/** 组织机构id */
@TableField(exist = false)
private Long deptId;
}
......@@ -23,15 +23,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<select id="selectLedgerFloorList" parameterType="com.censoft.censoftrongtong.domain.LedgerFloor" resultMap="LedgerFloorResult">
select * from(SELECT f.id, f.building_id, b.name 'building_name', f.NAME, f.type, f.room_number, f.STATUS, f.del_flag, f.create_by, f.create_time, f.update_by, f.update_time FROM ledger_floor f LEFT JOIN ledger_building b on f.building_id=b.id) tt
SELECT
f.id,
f.building_id,
b.NAME 'building_name',
f.NAME,
f.type,
f.room_number,
f.STATUS,
f.del_flag,
f.create_by,
f.create_time,
f.update_by,
f.update_time
FROM
ledger_floor f
LEFT JOIN ledger_building b ON f.building_id = b.id
LEFT JOIN sys_dept d ON b.dept_id = d.dept_id
<where>
<if test="buildingName != null "> and tt.building_name like concat('%', #{buildingName}, '%')</if>
<if test="buildingId != null "> and tt.building_id = #{buildingId}</if>
<if test="name != null and name != ''"> and tt.name like concat('%', #{name}, '%')</if>
<if test="type != null and type != ''"> and tt.type = #{type}</if>
<if test="roomNumber != null "> and tt.room_number = #{roomNumber}</if>
<if test="status != null and status != ''"> and tt.status = #{status}</if>
<if test="delFlag != null and delFlag != ''"> and tt.del_flag = #{delFlag}</if>
<if test="buildingName != null "> and b.building_name like concat('%', #{buildingName}, '%')</if>
<if test="buildingId != null "> and b.building_id = #{buildingId}</if>
<if test="name != null and name != ''"> and f.name like concat('%', #{name}, '%')</if>
<if test="type != null and type != ''"> and f.type = #{type}</if>
<if test="roomNumber != null "> and f.room_number = #{roomNumber}</if>
<if test="status != null and status != ''"> and f.status = #{status}</if>
and f.del_flag = '0'
</where>
</select>
......@@ -86,11 +102,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<delete id="deleteLedgerFloorById" parameterType="Long">
delete from ledger_floor where id = #{id}
update ledger_floor set del_flag = '1' where id = #{id}
</delete>
<delete id="deleteLedgerFloorByIds" parameterType="String">
delete from ledger_floor where id in
update ledger_floor set del_flag = '1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment