Commit 3314fa52 authored by 赵啸非's avatar 赵啸非

添加上传附件限制

parent 73ba5365
-- ----------------------------
2023-09-04
-- ----------------------------
ALTER TABLE mortals_xhx_room ADD COLUMN `fileName` varchar(256) default '' COMMENT '文件名称';
ALTER TABLE mortals_xhx_room ADD COLUMN `filePath` varchar(256) default '' COMMENT '文件相对路径地址';
ALTER TABLE mortals_xhx_room ADD COLUMN `fileName` varchar(256) COMMENT '文件名称';
ALTER TABLE mortals_xhx_room ADD COLUMN `filePath` varchar(256) COMMENT '文件相对路径地址';
-- ----------------------------
-- 通知公告表
......@@ -71,3 +71,8 @@ INSERT INTO `mortals_xhx_resource` VALUES (null, '房间公告-菜单管理-维
-- ----------------------------
ALTER TABLE mortals_xhx_workman ADD COLUMN `fileName` varchar(256) COMMENT '文件名称';
ALTER TABLE mortals_xhx_workman ADD COLUMN `filePath` varchar(256) COMMENT '文件相对路径地址';
-- ----------------------------
2023-09-21
-- ----------------------------
ALTER TABLE mortals_xhx_workman ADD COLUMN `order` int(4) DEFAULT '1' COMMENT '排序,值越大越靠前'
......@@ -28,7 +28,7 @@
/></Field>
<Field :span="20" label="党员示范logo" ><fileUpload v-model="form.filePath" :fileType="fileType" :fileName="form.fileName" @getFileName="getFileName" prePath="/file/fileupload"/></Field>
<Field label="排序值" type="num" prop="order" v-model="form.order" placeholder="请输入排序,值越大越靠前"/>
</el-row>
<form-buttons @submit='submitForm' v-if="pageInfo.type!='view'" noCancelBtn />
......
......@@ -13,7 +13,7 @@ import lombok.Data;
* 工作人员实体对象
*
* @author zxfei
* @date 2023-09-14
* @date 2023-09-21
*/
@Data
public class WorkmanEntity extends WorkmanVo {
......@@ -81,6 +81,10 @@ public class WorkmanEntity extends WorkmanVo {
*/
@Excel(name = "文件相对路径地址")
private String filePath;
/**
* 排序,值越大越靠前
*/
private Integer order;
@Override
public int hashCode() {
return this.getId().hashCode();
......@@ -113,5 +117,6 @@ public class WorkmanEntity extends WorkmanVo {
this.loginPwd = "";
this.fileName = "";
this.filePath = "";
this.order = 1;
}
}
\ No newline at end of file
......@@ -6,7 +6,7 @@ import com.mortals.xhx.module.workman.model.WorkmanEntity;
* 工作人员查询对象
*
* @author zxfei
* @date 2023-09-14
* @date 2023-09-21
*/
public class WorkmanQuery extends WorkmanEntity {
/** 开始 序号,主键,自增长 */
......@@ -146,6 +146,21 @@ public class WorkmanQuery extends WorkmanEntity {
/** 文件相对路径地址排除列表 */
private List <String> filePathNotList;
/** 开始 排序,值越大越靠前 */
private Integer orderStart;
/** 结束 排序,值越大越靠前 */
private Integer orderEnd;
/** 增加 排序,值越大越靠前 */
private Integer orderIncrement;
/** 排序,值越大越靠前列表 */
private List <Integer> orderList;
/** 排序,值越大越靠前排除列表 */
private List <Integer> orderNotList;
/** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */
private List<WorkmanQuery> orConditionList;
......@@ -958,6 +973,87 @@ public class WorkmanQuery extends WorkmanEntity {
this.filePathNotList = filePathNotList;
}
/**
* 获取 开始 排序,值越大越靠前
* @return orderStart
*/
public Integer getOrderStart(){
return this.orderStart;
}
/**
* 设置 开始 排序,值越大越靠前
* @param orderStart
*/
public void setOrderStart(Integer orderStart){
this.orderStart = orderStart;
}
/**
* 获取 结束 排序,值越大越靠前
* @return $orderEnd
*/
public Integer getOrderEnd(){
return this.orderEnd;
}
/**
* 设置 结束 排序,值越大越靠前
* @param orderEnd
*/
public void setOrderEnd(Integer orderEnd){
this.orderEnd = orderEnd;
}
/**
* 获取 增加 排序,值越大越靠前
* @return orderIncrement
*/
public Integer getOrderIncrement(){
return this.orderIncrement;
}
/**
* 设置 增加 排序,值越大越靠前
* @param orderIncrement
*/
public void setOrderIncrement(Integer orderIncrement){
this.orderIncrement = orderIncrement;
}
/**
* 获取 排序,值越大越靠前
* @return orderList
*/
public List<Integer> getOrderList(){
return this.orderList;
}
/**
* 设置 排序,值越大越靠前
* @param orderList
*/
public void setOrderList(List<Integer> orderList){
this.orderList = orderList;
}
/**
* 获取 排序,值越大越靠前
* @return orderNotList
*/
public List<Integer> getOrderNotList(){
return this.orderNotList;
}
/**
* 设置 排序,值越大越靠前
* @param orderNotList
*/
public void setOrderNotList(List<Integer> orderNotList){
this.orderNotList = orderNotList;
}
/**
* 设置 序号,主键,自增长
* @param id
......@@ -1423,6 +1519,60 @@ public class WorkmanQuery extends WorkmanEntity {
return this;
}
/**
* 设置 排序,值越大越靠前
* @param order
*/
public WorkmanQuery order(Integer order){
setOrder(order);
return this;
}
/**
* 设置 开始 排序,值越大越靠前
* @param orderStart
*/
public WorkmanQuery orderStart(Integer orderStart){
this.orderStart = orderStart;
return this;
}
/**
* 设置 结束 排序,值越大越靠前
* @param orderEnd
*/
public WorkmanQuery orderEnd(Integer orderEnd){
this.orderEnd = orderEnd;
return this;
}
/**
* 设置 增加 排序,值越大越靠前
* @param orderIncrement
*/
public WorkmanQuery orderIncrement(Integer orderIncrement){
this.orderIncrement = orderIncrement;
return this;
}
/**
* 设置 排序,值越大越靠前
* @param orderList
*/
public WorkmanQuery orderList(List<Integer> orderList){
this.orderList = orderList;
return this;
}
/**
* 设置 排序,值越大越靠前
* @param orderNotList
*/
public WorkmanQuery orderNotList(List<Integer> orderNotList){
this.orderNotList = orderNotList;
return this;
}
/**
* 获取 OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4)
* @return orConditionList
......
......@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.OrderCol;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.feign.device.IDeviceMessageFeign;
......@@ -81,14 +82,22 @@ public class WorkmanController extends BaseCRUDJsonBodyMappingController<Workman
protected void doListBefore(WorkmanEntity query, Map<String, Object> model, Context context) throws AppException {
super.doListBefore(query, model, context);
if (ObjectUtils.isEmpty(query.getOrderColList())) {
ArrayList<OrderCol> orderCols = new ArrayList<>();
OrderCol orderCol = new OrderCol("roomId", OrderCol.ASCENDING);
orderCols.add(orderCol);
orderCol = new OrderCol("order", OrderCol.DESCENDING);
orderCols.add(orderCol);
query.setOrderColList(orderCols);
}
if (!ObjectUtils.isEmpty(query.getDeviceCode())) {
//根据设备编码 查询房间room
RoomDeviceEntity roomEntity = roomDeviceService.selectOne(new RoomDeviceQuery().deviceCode(query.getDeviceCode()));
if (!ObjectUtils.isEmpty(roomEntity)) {
query.setRoomId(roomEntity.getRoomId());
}else{
log.info("deviceCode:{}",query.getDeviceCode());
} else {
log.info("deviceCode:{}", query.getDeviceCode());
query.setRoomId(-1L);
}
}
......@@ -190,8 +199,8 @@ public class WorkmanController extends BaseCRUDJsonBodyMappingController<Workman
RoomQuery roomQuery = new RoomQuery();
roomQuery.setId(workmanEntity.getRoomId());
RoomEntity roomEntity = roomService.selectOne(roomQuery, context);
if(!ObjectUtils.isEmpty(roomEntity)){
roomEntity.setCountPerson(roomEntity.getCountPerson()-1);
if (!ObjectUtils.isEmpty(roomEntity)) {
roomEntity.setCountPerson(roomEntity.getCountPerson() - 1);
roomService.update(roomEntity);
}
}
......
......@@ -24,6 +24,7 @@
<result property="loginPwd" column="loginPwd" />
<result property="fileName" column="fileName" />
<result property="filePath" column="filePath" />
<result property="order" column="order" />
</resultMap>
......@@ -88,23 +89,26 @@
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('filePath') or colPickMode == 1 and data.containsKey('filePath')))">
a.filePath,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('order') or colPickMode == 1 and data.containsKey('order')))">
a.`order`,
</if>
</trim>
</sql>
<!-- 新增 区分主键自增加还是业务插入 -->
<insert id="insert" parameterType="WorkmanEntity" useGeneratedKeys="true" keyProperty="id">
insert into mortals_xhx_workman
(roomId,roomName,deptName,name,sex,userPost,phone,mobile,summary,photoPath,workStatus,createTime,createUserId,updateTime,loginName,loginPwd,fileName,filePath)
(roomId,roomName,deptName,name,sex,userPost,phone,mobile,summary,photoPath,workStatus,createTime,createUserId,updateTime,loginName,loginPwd,fileName,filePath,`order`)
VALUES
(#{roomId},#{roomName},#{deptName},#{name},#{sex},#{userPost},#{phone},#{mobile},#{summary},#{photoPath},#{workStatus},#{createTime},#{createUserId},#{updateTime},#{loginName},#{loginPwd},#{fileName},#{filePath})
(#{roomId},#{roomName},#{deptName},#{name},#{sex},#{userPost},#{phone},#{mobile},#{summary},#{photoPath},#{workStatus},#{createTime},#{createUserId},#{updateTime},#{loginName},#{loginPwd},#{fileName},#{filePath},#{order})
</insert>
<!-- 批量新增 -->
<insert id="insertBatch" parameterType="paramDto">
insert into mortals_xhx_workman
(roomId,roomName,deptName,name,sex,userPost,phone,mobile,summary,photoPath,workStatus,createTime,createUserId,updateTime,loginName,loginPwd,fileName,filePath)
(roomId,roomName,deptName,name,sex,userPost,phone,mobile,summary,photoPath,workStatus,createTime,createUserId,updateTime,loginName,loginPwd,fileName,filePath,`order`)
VALUES
<foreach collection="data.dataList" item="item" index="index" separator="," >
(#{item.roomId},#{item.roomName},#{item.deptName},#{item.name},#{item.sex},#{item.userPost},#{item.phone},#{item.mobile},#{item.summary},#{item.photoPath},#{item.workStatus},#{item.createTime},#{item.createUserId},#{item.updateTime},#{item.loginName},#{item.loginPwd},#{item.fileName},#{item.filePath})
(#{item.roomId},#{item.roomName},#{item.deptName},#{item.name},#{item.sex},#{item.userPost},#{item.phone},#{item.mobile},#{item.summary},#{item.photoPath},#{item.workStatus},#{item.createTime},#{item.createUserId},#{item.updateTime},#{item.loginName},#{item.loginPwd},#{item.fileName},#{item.filePath},#{item.order})
</foreach>
</insert>
......@@ -177,6 +181,12 @@
<if test="(colPickMode==0 and data.containsKey('filePath')) or (colPickMode==1 and !data.containsKey('filePath'))">
a.filePath=#{data.filePath},
</if>
<if test="(colPickMode==0 and data.containsKey('order')) or (colPickMode==1 and !data.containsKey('order'))">
a.`order`=#{data.order},
</if>
<if test="(colPickMode==0 and data.containsKey('orderIncrement')) or (colPickMode==1 and !data.containsKey('orderIncrement'))">
a.`order`=ifnull(a.`order`,0) + #{data.orderIncrement},
</if>
</trim>
<trim suffixOverrides="where" suffix="">
where
......@@ -330,6 +340,18 @@
</if>
</foreach>
</trim>
<trim prefix="`order`=(case" suffix="ELSE `order` end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<choose>
<when test="(colPickMode==0 and item.containsKey('order')) or (colPickMode==1 and !item.containsKey('order'))">
when a.id=#{item.id} then #{item.order}
</when>
<when test="(colPickMode==0 and item.containsKey('orderIncrement')) or (colPickMode==1 and !item.containsKey('orderIncrement'))">
when a.id=#{item.id} then ifnull(a.`order`,0) + #{item.orderIncrement}
</when>
</choose>
</foreach>
</trim>
</trim>
where id in
<foreach collection="data.dataList" item="item" index="index" open="(" separator="," close=")">
......@@ -857,6 +879,33 @@
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('order')">
<if test="conditionParamRef.order != null ">
${_conditionType_} a.`order` = #{${_conditionParam_}.order}
</if>
<if test="conditionParamRef.order == null">
${_conditionType_} a.`order` is null
</if>
</if>
<if test="conditionParamRef.containsKey('orderList') and conditionParamRef.orderList.size() > 0">
${_conditionType_} a.`order` in
<foreach collection="conditionParamRef.orderList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('orderNotList') and conditionParamRef.orderNotList.size() > 0">
${_conditionType_} a.`order` not in
<foreach collection="conditionParamRef.orderNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('orderStart') and conditionParamRef.orderStart != null">
${_conditionType_} a.`order` <![CDATA[ >= ]]> #{${_conditionParam_}.orderStart}
</if>
<if test="conditionParamRef.containsKey('orderEnd') and conditionParamRef.orderEnd != null">
${_conditionType_} a.`order` <![CDATA[ <= ]]> #{${_conditionParam_}.orderEnd}
</if>
</sql>
<sql id="_orderCols_">
<if test="orderColList != null and !orderColList.isEmpty()">
......@@ -889,6 +938,13 @@
</foreach>
,
</if>
<if test="conditionParamRef.containsKey('orderList') and conditionParamRef.orderList.size() > 0">
field(a.order,
<foreach collection="conditionParamRef.orderList" open="" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
,
</if>
<trim suffixOverrides="," suffix="">
<foreach collection="orderColList" open="" close="" index="index" item="item" separator=",">
${item.colName} ${item.sortKind}
......@@ -925,6 +981,13 @@
</foreach>
,
</if>
<if test="conditionParamRef.containsKey('orderList') and conditionParamRef.orderList.size() > 0">
field(a.order,
<foreach collection="conditionParamRef.orderList" open="" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
,
</if>
<trim suffixOverrides="," suffix="">
<if test="orderCol.containsKey('id')">
a.id
......@@ -1021,6 +1084,11 @@
<if test='orderCol.filePath != null and "DESC".equalsIgnoreCase(orderCol.filePath)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('order')">
a.`order`
<if test='orderCol.order != null and "DESC".equalsIgnoreCase(orderCol.order)'>DESC</if>
,
</if>
</trim>
</if>
......
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