21 changed files with 1818 additions and 216 deletions
@ -0,0 +1,149 @@ |
|||
package com.dreamchaser.depository_manage.controller; |
|||
|
|||
import com.dreamchaser.depository_manage.entity.BusinessType; |
|||
import com.dreamchaser.depository_manage.entity.UserByPort; |
|||
import com.dreamchaser.depository_manage.exception.MyException; |
|||
import com.dreamchaser.depository_manage.pojo.RestResponse; |
|||
import com.dreamchaser.depository_manage.security.pool.AuthenticationTokenPool; |
|||
import com.dreamchaser.depository_manage.service.BusinessTypeService; |
|||
import com.dreamchaser.depository_manage.utils.CrudUtil; |
|||
import com.dreamchaser.depository_manage.utils.ObjectFormatUtil; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Controller; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
@Controller |
|||
@Slf4j |
|||
@RequestMapping("/businessType") |
|||
public class BusinessTypeController { |
|||
@Autowired |
|||
private BusinessTypeService businessTypeService; |
|||
|
|||
/** |
|||
* 添加一条新的业务类型数据 |
|||
* |
|||
* @param map 带插入数据 |
|||
* @param request |
|||
* @return |
|||
*/ |
|||
@PostMapping("/addBusinessType") |
|||
public RestResponse addBusinessType(@RequestBody Map<String, Object> map, HttpServletRequest request) { |
|||
String usertoken = request.getHeader("user-token"); |
|||
String userkey = request.getHeader("user-key"); |
|||
if (usertoken == null) { |
|||
usertoken = (String) request.getSession().getAttribute("userToken"); |
|||
userkey = (String) request.getSession().getAttribute("userKey"); |
|||
} |
|||
// 获取当前登录用户
|
|||
UserByPort userToken = AuthenticationTokenPool.getUserToken(usertoken); |
|||
map.put("createUid", userToken.getId()); |
|||
return CrudUtil.insertHandle(businessTypeService.addBusinessType(map), 1); |
|||
} |
|||
|
|||
/** |
|||
* 修改一条业务类型数据 |
|||
* |
|||
* @param map 待修改数据 |
|||
* @param request |
|||
* @return |
|||
*/ |
|||
@PostMapping("/updateBusinessType") |
|||
public RestResponse updateBusinessType(@RequestBody Map<String, Object> map, HttpServletRequest request) { |
|||
String usertoken = request.getHeader("user-token"); |
|||
String userkey = request.getHeader("user-key"); |
|||
if (usertoken == null) { |
|||
usertoken = (String) request.getSession().getAttribute("userToken"); |
|||
userkey = (String) request.getSession().getAttribute("userKey"); |
|||
} |
|||
// 获取当前登录用户
|
|||
UserByPort userToken = AuthenticationTokenPool.getUserToken(usertoken); |
|||
map.put("updateUid", userToken.getId()); |
|||
return CrudUtil.updateHandle(businessTypeService.updateBusinessType(map), 1); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 删除业务类型数据(软删除) |
|||
* |
|||
* @param map 待删除数据 |
|||
* @param request |
|||
* @return |
|||
*/ |
|||
@PostMapping("/deleteBusinessType") |
|||
public RestResponse deleteBusinessType(@RequestBody Map<String, Object> map, HttpServletRequest request) { |
|||
String usertoken = request.getHeader("user-token"); |
|||
String userkey = request.getHeader("user-key"); |
|||
if (usertoken == null) { |
|||
usertoken = (String) request.getSession().getAttribute("userToken"); |
|||
userkey = (String) request.getSession().getAttribute("userKey"); |
|||
} |
|||
// 获取当前登录用户
|
|||
UserByPort userToken = AuthenticationTokenPool.getUserToken(usertoken); |
|||
map.put("state", 3); |
|||
map.put("updateUid", userToken.getId()); |
|||
if (map.containsKey("id")) { |
|||
return CrudUtil.updateHandle(businessTypeService.updateBusinessTypeStateById(map), 1); |
|||
|
|||
} else if (map.containsKey("ids")) { |
|||
Integer count = ObjectFormatUtil.toInteger(map.get("count")); |
|||
return CrudUtil.updateHandle(businessTypeService.updateBusinessTypeStateByIds(map), count); |
|||
} else { |
|||
throw new MyException("所需请求参数缺失!"); |
|||
} |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 修改业务类型数据状态(启用禁用) |
|||
* |
|||
* @param map 待修改数据 |
|||
* @param request |
|||
* @return |
|||
*/ |
|||
@PostMapping("/forbiddenBusinessType") |
|||
public RestResponse forbiddenBusinessType(@RequestBody Map<String, Object> map, HttpServletRequest request) { |
|||
String usertoken = request.getHeader("user-token"); |
|||
String userkey = request.getHeader("user-key"); |
|||
if (usertoken == null) { |
|||
usertoken = (String) request.getSession().getAttribute("userToken"); |
|||
userkey = (String) request.getSession().getAttribute("userKey"); |
|||
} |
|||
// 获取当前登录用户
|
|||
UserByPort userToken = AuthenticationTokenPool.getUserToken(usertoken); |
|||
if (map.containsKey("state")) { |
|||
map.put("state", 1); |
|||
} else { |
|||
map.put("state", 2); |
|||
} |
|||
map.put("updateUid", userToken.getId()); |
|||
if (map.containsKey("id")) { |
|||
return CrudUtil.updateHandle(businessTypeService.updateBusinessTypeStateById(map), 1); |
|||
|
|||
} else if (map.containsKey("ids")) { |
|||
Integer count = ObjectFormatUtil.toInteger(map.get("count")); |
|||
return CrudUtil.updateHandle(businessTypeService.updateBusinessTypeStateByIds(map), count); |
|||
} else { |
|||
throw new MyException("所需请求参数缺失!"); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 根据条件查询业务类型数据 |
|||
* @param map 带查询数据 |
|||
* @param request |
|||
* @return |
|||
*/ |
|||
@GetMapping("/findBusinessType") |
|||
public RestResponse findBusinessType(@RequestParam Map<String, Object> map, HttpServletRequest request) { |
|||
List<BusinessType> businessTypeByCondition = businessTypeService.findBusinessTypeByCondition(map); |
|||
Integer businessTypeCountByCondition = businessTypeService.findBusinessTypeCountByCondition(map); |
|||
return new RestResponse(businessTypeByCondition, businessTypeCountByCondition, 200); |
|||
} |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,50 @@ |
|||
package com.dreamchaser.depository_manage.entity; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* 业务类型类 |
|||
*/ |
|||
@Data |
|||
public class BusinessType { |
|||
/** |
|||
* 自增id主键 |
|||
*/ |
|||
private Integer id; |
|||
/** |
|||
* 业务类型名称 |
|||
*/ |
|||
private String typeName; |
|||
/** |
|||
* 业务类型描述 |
|||
*/ |
|||
private String typeDescription; |
|||
/** |
|||
* 单据类型名称 |
|||
*/ |
|||
private String recordTypeName; |
|||
/** |
|||
* 单据类型描述 |
|||
*/ |
|||
private String recordTypeDescription; |
|||
/** |
|||
* 1启用2禁用3删除 |
|||
*/ |
|||
private Integer state; |
|||
/** |
|||
* 创建人id |
|||
*/ |
|||
private Integer createUid; |
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Long createTime; |
|||
/** |
|||
* 修改人id |
|||
*/ |
|||
private Integer updateUid; |
|||
/** |
|||
* 修改人时间 |
|||
*/ |
|||
private Long updateTime; |
|||
} |
|||
@ -0,0 +1,101 @@ |
|||
package com.dreamchaser.depository_manage.mapper; |
|||
|
|||
import com.dreamchaser.depository_manage.entity.BusinessType; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.springframework.stereotype.Repository; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
@Mapper |
|||
@Repository |
|||
public interface BusinessTypeMapper { |
|||
/** |
|||
* 插入一条业务类型数据 |
|||
* @param map 待插入数据 |
|||
* @return |
|||
*/ |
|||
Integer addBusinessType(Map<String,Object> map); |
|||
|
|||
/** |
|||
* 插入一条业务类型数据 |
|||
* @param businessType 待插入数据 |
|||
* @return |
|||
*/ |
|||
Integer addBusinessType(BusinessType businessType); |
|||
|
|||
/** |
|||
* 修改业务类型数据 |
|||
* @param map 待修改数据 |
|||
* @return |
|||
*/ |
|||
Integer updateBusinessType(Map<String,Object> map); |
|||
|
|||
/** |
|||
* 修改业务类型数据 |
|||
* @param businessType 待修改数据 |
|||
* @return |
|||
*/ |
|||
Integer updateBusinessType(BusinessType businessType); |
|||
|
|||
/** |
|||
* 修改业务类型数据状态 |
|||
* @param map 待修改数据 |
|||
* @return |
|||
*/ |
|||
Integer updateBusinessTypeStateById(Map<String,Object> map); |
|||
/** |
|||
* 批量修改业务类型数据状态 |
|||
* @param map 待修改数据 |
|||
* @return |
|||
*/ |
|||
Integer updateBusinessTypeStateByIds(Map<String,Object> map); |
|||
|
|||
/** |
|||
* 根据id删除一条业务类型数据(硬删除) |
|||
* @param id 待删除id |
|||
* @return |
|||
*/ |
|||
Integer deleteBusinessTypeById(Integer id); |
|||
|
|||
/** |
|||
* 根据id批量删除一条业务类型数据(硬删除) |
|||
* @param ids 待删除id列表 |
|||
* @return |
|||
*/ |
|||
Integer deleteBusinessTypeByIds(List<Integer> ids); |
|||
|
|||
/** |
|||
* 根据条件获取业务类型数据 |
|||
* @param map 待查询数据 |
|||
* @return |
|||
*/ |
|||
List<BusinessType> findBusinessTypeByCondition(Map<String,Object> map); |
|||
|
|||
/** |
|||
* 根据条件获取业务类型数据数量 |
|||
* @param map 待查询数据 |
|||
* @return |
|||
*/ |
|||
Integer findBusinessTypeCountByCondition(Map<String,Object> map); |
|||
|
|||
/** |
|||
* 获取所有业务类型数据 |
|||
* @return |
|||
*/ |
|||
List<BusinessType> findBusinessTypeAll(); |
|||
|
|||
/** |
|||
* 根据id获取业务类型数据 |
|||
* @param id 待查询id |
|||
* @return |
|||
*/ |
|||
BusinessType findBusinessTypeById(Integer id); |
|||
|
|||
/** |
|||
* 根据id批量获取业务类型数据 |
|||
* @param ids 待查询id列表 |
|||
* @return |
|||
*/ |
|||
List<BusinessType> findBusinessTypeByIds(List<Integer> ids); |
|||
} |
|||
@ -0,0 +1,181 @@ |
|||
<?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.dreamchaser.depository_manage.mapper.BusinessTypeMapper"> |
|||
<resultMap id="BusinessTypeMap" type="com.dreamchaser.depository_manage.entity.BusinessType"> |
|||
<id property="id" column="id" jdbcType="BIGINT"/> |
|||
<result property="typeName" column="typeName" jdbcType="VARCHAR"/> |
|||
<result property="typeDescription" column="typeDescription" jdbcType="VARCHAR"/> |
|||
<result property="recordTypeName" column="recordTypeName" jdbcType="VARCHAR"/> |
|||
<result property="recordTypeDescription" column="recordTypeDescription" jdbcType="VARCHAR"/> |
|||
<result property="state" column="state" jdbcType="INTEGER"/> |
|||
<result property="createUid" column="createUid" jdbcType="INTEGER"/> |
|||
<result property="createTime" column="createTime" jdbcType="BIGINT"/> |
|||
<result property="updateUid" column="updateUid" jdbcType="INTEGER"/> |
|||
<result property="updateTime" column="updateTime" jdbcType="INTEGER"/> |
|||
</resultMap> |
|||
|
|||
<sql id="allColumns"> |
|||
|
|||
</sql> |
|||
|
|||
<insert id="addBusinessType" useGeneratedKeys="true" keyProperty="id"> |
|||
insert into businesstype(id, typeName, typeDescription, recordTypeName, recordTypeDescription, state, createUid, |
|||
createTime) |
|||
values (#{id}, #{typeName}, #{typeDescription}, #{recordTypeName}, #{recordTypeDescription}, #{state}, |
|||
#{createUid}, #{createTime}) |
|||
</insert> |
|||
|
|||
<update id="updateBusinessType"> |
|||
update businesstype |
|||
<set> |
|||
<if test="typeName != null and typeName != ''"> |
|||
typeName = #{typeName}, |
|||
</if> |
|||
<if test="typeDescription != null and typeDescription != ''"> |
|||
typeDescription = #{typeDescription}, |
|||
</if> |
|||
<if test="recordTypeName != null and recordTypeName != ''"> |
|||
recordTypeName = #{recordTypeName}, |
|||
</if> |
|||
<if test="recordTypeDescription != null and recordTypeDescription != ''"> |
|||
recordTypeDescription = #{recordTypeDescription}, |
|||
</if> |
|||
<if test="state != null and state != ''"> |
|||
state = #{state}, |
|||
</if> |
|||
<if test="updateUid != null and updateUid != ''"> |
|||
updateUid = #{updateUid}, |
|||
</if> |
|||
<if test="updateTime != null and updateTime != ''"> |
|||
updateTime = #{updateTime} |
|||
</if> |
|||
</set> |
|||
where id = #{id} |
|||
</update> |
|||
|
|||
|
|||
<update id="updateBusinessTypeStateById" parameterType="map"> |
|||
update businesstype |
|||
<set> |
|||
<if test="state != null and state != ''"> |
|||
state = #{state}, |
|||
</if> |
|||
<if test="updateUid != null and updateUid != ''"> |
|||
updateUid = #{updateUid}, |
|||
</if> |
|||
<if test="updateTime != null and updateTime != ''"> |
|||
updateTime = #{updateTime} |
|||
</if> |
|||
</set> |
|||
where id = #{id} |
|||
</update> |
|||
|
|||
<update id="updateBusinessTypeStateByIds" parameterType="map"> |
|||
update businesstype |
|||
<set> |
|||
<if test="state != null and state != ''"> |
|||
state = #{state}, |
|||
</if> |
|||
<if test="updateUid != null and updateUid != ''"> |
|||
updateUid = #{updateUid}, |
|||
</if> |
|||
<if test="updateTime != null and updateTime != ''"> |
|||
updateTime = #{updateTime} |
|||
</if> |
|||
</set> |
|||
where id in |
|||
<foreach collection="ids" open="(" close=")" separator="," item="id" > |
|||
#{id} |
|||
</foreach> |
|||
</update> |
|||
|
|||
<delete id="deleteBusinessTypeById" parameterType="int"> |
|||
delete |
|||
from businesstype |
|||
where id = #{id} |
|||
</delete> |
|||
|
|||
<delete id="deleteBusinessTypeByIds" parameterType="list"> |
|||
delete |
|||
from businesstype |
|||
where id in |
|||
<foreach collection="ids" open="(" close=")" separator="," item="id" index="index"> |
|||
#{id} |
|||
</foreach> |
|||
</delete> |
|||
|
|||
|
|||
<select id="findBusinessTypeByCondition" parameterType="map" resultMap="BusinessTypeMap"> |
|||
select |
|||
<include refid="allColumns"/> |
|||
from businesstype |
|||
where 1 = 1 |
|||
<if test="typeName != null and typeName != ''"> |
|||
and typeName like concat('%',#{typeName},'%') |
|||
</if> |
|||
<if test="typeDescription != null and typeDescription != ''"> |
|||
and typeDescription like concat('%',#{typeDescription},'%') |
|||
</if> |
|||
<if test="recordTypeName != null and recordTypeName != ''"> |
|||
and recordTypeName like concat('%',#{recordTypeName},'%') |
|||
</if> |
|||
<if test="recordTypeDescription != null and recordTypeDescription != ''"> |
|||
and recordTypeDescription like concat('%',#{recordTypeDescription},'%') |
|||
</if> |
|||
<if test="state != null and state != ''"> |
|||
and state = #{state} |
|||
</if> |
|||
</select> |
|||
|
|||
<select id="findBusinessTypeCountByCondition" parameterType="map" resultType="int"> |
|||
select |
|||
COUNT(*) |
|||
from businesstype |
|||
where 1 = 1 |
|||
<if test="typeName != null and typeName != ''"> |
|||
and typeName like concat('%',#{typeName},'%') |
|||
</if> |
|||
<if test="typeDescription != null and typeDescription != ''"> |
|||
and typeDescription like concat('%',#{typeDescription},'%') |
|||
</if> |
|||
<if test="recordTypeName != null and recordTypeName != ''"> |
|||
and recordTypeName like concat('%',#{recordTypeName},'%') |
|||
</if> |
|||
<if test="recordTypeDescription != null and recordTypeDescription != ''"> |
|||
and recordTypeDescription like concat('%',#{recordTypeDescription},'%') |
|||
</if> |
|||
<if test="state != null and state != ''"> |
|||
and state = #{state} |
|||
</if> |
|||
</select> |
|||
|
|||
<select id="findBusinessTypeAll" resultMap="BusinessTypeMap"> |
|||
select |
|||
<include refid="allColumns"/> |
|||
from businesstype |
|||
where state = 1 |
|||
</select> |
|||
|
|||
|
|||
<select id="findBusinessTypeById" parameterType="int" resultMap="BusinessTypeMap"> |
|||
select |
|||
<include refid="allColumns"/> |
|||
from businesstype |
|||
where id = #{id} |
|||
</select> |
|||
|
|||
<select id="findBusinessTypeByIds" parameterType="list" resultMap="BusinessTypeMap"> |
|||
select |
|||
<include refid="allColumns"/> |
|||
from businesstype |
|||
where id in |
|||
<foreach collection="ids" item="id" open="(" close=")" separator=","> |
|||
#{id} |
|||
</foreach> |
|||
</select> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
</mapper> |
|||
@ -0,0 +1,97 @@ |
|||
package com.dreamchaser.depository_manage.service; |
|||
|
|||
import com.dreamchaser.depository_manage.entity.BusinessType; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
public interface BusinessTypeService { |
|||
/** |
|||
* 插入一条业务类型数据 |
|||
* @param map 待插入数据 |
|||
* @return |
|||
*/ |
|||
Integer addBusinessType(Map<String,Object> map); |
|||
|
|||
/** |
|||
* 插入一条业务类型数据 |
|||
* @param businessType 待插入数据 |
|||
* @return |
|||
*/ |
|||
Integer addBusinessType(BusinessType businessType); |
|||
|
|||
/** |
|||
* 修改业务类型数据 |
|||
* @param map 待修改数据 |
|||
* @return |
|||
*/ |
|||
Integer updateBusinessType(Map<String,Object> map); |
|||
|
|||
/** |
|||
* 修改业务类型数据状态 |
|||
* @param map 待修改数据 |
|||
* @return |
|||
*/ |
|||
Integer updateBusinessTypeStateById(Map<String,Object> map); |
|||
/** |
|||
* 批量修改业务类型数据状态 |
|||
* @param map 待修改数据 |
|||
* @return |
|||
*/ |
|||
Integer updateBusinessTypeStateByIds(Map<String,Object> map); |
|||
|
|||
/** |
|||
* 修改业务类型数据 |
|||
* @param businessType 待修改数据 |
|||
* @return |
|||
*/ |
|||
Integer updateBusinessType(BusinessType businessType); |
|||
|
|||
/** |
|||
* 根据id删除一条业务类型数据(硬删除) |
|||
* @param id 待删除id |
|||
* @return |
|||
*/ |
|||
Integer deleteBusinessTypeById(Integer id); |
|||
|
|||
/** |
|||
* 根据id批量删除一条业务类型数据(硬删除) |
|||
* @param ids 待删除id列表 |
|||
* @return |
|||
*/ |
|||
Integer deleteBusinessTypeByIds(List<Integer> ids); |
|||
|
|||
/** |
|||
* 根据条件获取业务类型数据 |
|||
* @param map 待查询数据 |
|||
* @return |
|||
*/ |
|||
List<BusinessType> findBusinessTypeByCondition(Map<String,Object> map); |
|||
|
|||
/** |
|||
* 根据条件获取业务类型数据数量 |
|||
* @param map 待查询数据 |
|||
* @return |
|||
*/ |
|||
Integer findBusinessTypeCountByCondition(Map<String,Object> map); |
|||
|
|||
/** |
|||
* 获取所有业务类型数据 |
|||
* @return |
|||
*/ |
|||
List<BusinessType> findBusinessTypeAll(); |
|||
|
|||
/** |
|||
* 根据id获取业务类型数据 |
|||
* @param id 待查询id |
|||
* @return |
|||
*/ |
|||
BusinessType findBusinessTypeById(Integer id); |
|||
|
|||
/** |
|||
* 根据id批量获取业务类型数据 |
|||
* @param ids 待查询id列表 |
|||
* @return |
|||
*/ |
|||
List<BusinessType> findBusinessTypeByIds(List<Integer> ids); |
|||
} |
|||
@ -0,0 +1,155 @@ |
|||
package com.dreamchaser.depository_manage.service.impl; |
|||
|
|||
import com.dreamchaser.depository_manage.entity.BusinessType; |
|||
import com.dreamchaser.depository_manage.mapper.BusinessTypeMapper; |
|||
import com.dreamchaser.depository_manage.service.BusinessTypeService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
@Service |
|||
public class BusinessTypeServiceImpl implements BusinessTypeService { |
|||
|
|||
@Autowired |
|||
private BusinessTypeMapper businessTypeMapper; |
|||
|
|||
/** |
|||
* 插入一条业务类型数据 |
|||
* @param map 待插入数据 |
|||
* @return |
|||
*/ |
|||
@Override |
|||
public Integer addBusinessType(Map<String, Object> map) { |
|||
map.put("createTime",System.currentTimeMillis()); |
|||
map.put("state",1); |
|||
return businessTypeMapper.addBusinessType(map); |
|||
} |
|||
|
|||
/** |
|||
* 插入一条业务类型数据 |
|||
* @param businessType 待插入数据 |
|||
* @return |
|||
*/ |
|||
@Override |
|||
public Integer addBusinessType(BusinessType businessType) { |
|||
businessType.setCreateTime(System.currentTimeMillis()); |
|||
return businessTypeMapper.addBusinessType(businessType); |
|||
} |
|||
|
|||
/** |
|||
* 修改业务类型数据 |
|||
* @param map 待修改数据 |
|||
* @return |
|||
*/ |
|||
@Override |
|||
public Integer updateBusinessType(Map<String, Object> map) { |
|||
map.put("updateTime",System.currentTimeMillis()); |
|||
return businessTypeMapper.updateBusinessType(map); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 修改业务类型数据状态 |
|||
* @param map 待修改数据 |
|||
* @return |
|||
*/ |
|||
@Override |
|||
public Integer updateBusinessTypeStateById(Map<String,Object> map){ |
|||
map.put("updateTime",System.currentTimeMillis()); |
|||
return businessTypeMapper.updateBusinessTypeStateById(map); |
|||
} |
|||
/** |
|||
* 批量修改业务类型数据状态 |
|||
* @param map 待修改数据 |
|||
* @return |
|||
*/ |
|||
@Override |
|||
public Integer updateBusinessTypeStateByIds(Map<String,Object> map){ |
|||
map.put("updateTime",System.currentTimeMillis()); |
|||
return businessTypeMapper.updateBusinessTypeStateByIds(map); |
|||
} |
|||
|
|||
/** |
|||
* 修改业务类型数据 |
|||
* @param businessType 待修改数据 |
|||
* @return |
|||
*/ |
|||
@Override |
|||
public Integer updateBusinessType(BusinessType businessType) { |
|||
businessType.setUpdateTime(System.currentTimeMillis()); |
|||
return businessTypeMapper.updateBusinessType(businessType); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 根据id删除一条业务类型数据(硬删除) |
|||
* @param id 待删除id |
|||
* @return |
|||
*/ |
|||
@Override |
|||
public Integer deleteBusinessTypeById(Integer id) { |
|||
return businessTypeMapper.deleteBusinessTypeById(id); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 根据id删除一条业务类型数据(硬删除) |
|||
* @param ids 待删除id列表 |
|||
* @return |
|||
*/ |
|||
@Override |
|||
public Integer deleteBusinessTypeByIds(List<Integer> ids) { |
|||
return businessTypeMapper.deleteBusinessTypeByIds(ids); |
|||
} |
|||
|
|||
/** |
|||
* 根据条件获取业务类型数据 |
|||
* @param map 待查询数据 |
|||
* @return |
|||
*/ |
|||
@Override |
|||
public List<BusinessType> findBusinessTypeByCondition(Map<String, Object> map) { |
|||
return businessTypeMapper.findBusinessTypeByCondition(map); |
|||
} |
|||
|
|||
/** |
|||
* 根据条件获取业务类型数据数量 |
|||
* @param map 待查询数据 |
|||
* @return |
|||
*/ |
|||
@Override |
|||
public Integer findBusinessTypeCountByCondition(Map<String, Object> map) { |
|||
return businessTypeMapper.findBusinessTypeCountByCondition(map); |
|||
} |
|||
|
|||
/** |
|||
* 获取所有业务类型数据 |
|||
* @return |
|||
*/ |
|||
@Override |
|||
public List<BusinessType> findBusinessTypeAll() { |
|||
return businessTypeMapper.findBusinessTypeAll(); |
|||
} |
|||
|
|||
/** |
|||
* 根据id获取业务类型数据 |
|||
* @param id 待查询id |
|||
* @return |
|||
*/ |
|||
@Override |
|||
public BusinessType findBusinessTypeById(Integer id) { |
|||
return businessTypeMapper.findBusinessTypeById(id); |
|||
} |
|||
|
|||
/** |
|||
* 根据id批量获取业务类型数据 |
|||
* @param ids 待查询id列表 |
|||
* @return |
|||
*/ |
|||
@Override |
|||
public List<BusinessType> findBusinessTypeByIds(List<Integer> ids) { |
|||
return businessTypeMapper.findBusinessTypeByIds(ids); |
|||
} |
|||
} |
|||
@ -0,0 +1,126 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" xmlns:th="http://www.thymeleaf.org"> |
|||
<head> |
|||
<meta charset="utf-8"> |
|||
<title>layui</title> |
|||
<meta name="renderer" content="webkit"> |
|||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> |
|||
<link rel="stylesheet" href="/static/lib/layui-v2.6.3/css/layui.css" media="all"> |
|||
<link rel="stylesheet" href="/static/css/public.css" media="all"> |
|||
<link rel="stylesheet" href="/static/lib/font-awesome-4.7.0/css/font-awesome.min.css" media="all"> |
|||
</head> |
|||
<body> |
|||
<div class="layuimini-container"> |
|||
<div class="layuimini-main"> |
|||
|
|||
|
|||
<fieldset class="table-search-fieldset"> |
|||
<legend>出库业务类型创建</legend> |
|||
<div class="layui-fluid"> |
|||
<div class="layui-card"> |
|||
<div class="layui-card-body" style="padding-top: 40px;"> |
|||
<div> |
|||
<form class="layui-form layui-form-pane" |
|||
style="margin: 0 auto;max-width: 700px;padding-top: 100px; padding-bottom: 200px" |
|||
lay-filter="form1"> |
|||
<div class="layui-form-item"> |
|||
<label class="layui-form-label" style="width: 130px">业务类型名称:</label> |
|||
<div class="layui-input-block" style="margin-left: 130px;"> |
|||
<input type="text" placeholder="请填写业务类型名称" class="layui-input" |
|||
name="typeName" lay-verify="required"/> |
|||
</div> |
|||
</div> |
|||
<div class="layui-form-item"> |
|||
<label class="layui-form-label" style="width: 130px">业务类型描述:</label> |
|||
<div class="layui-input-block" style="margin-left: 130px;"> |
|||
<input type="text" placeholder="业务类型描述" class="layui-input" |
|||
name="typeDescription"/> |
|||
</div> |
|||
</div> |
|||
<div class="layui-form-item"> |
|||
<label class="layui-form-label" style="width: 130px">单据类型名称:</label> |
|||
<div class="layui-input-block" style="margin-left: 130px;"> |
|||
<input name="recordTypeName" placeholder="单据类型名称..." |
|||
class="layui-input"/> |
|||
</div> |
|||
</div> |
|||
<div class="layui-form-item"> |
|||
<label class="layui-form-label" style="width: 130px">单据类型描述:</label> |
|||
<div class="layui-input-block" style="margin-left: 130px;"> |
|||
<input name="recordTypeDescription" placeholder="单据类型描述..." |
|||
class="layui-input"/> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="layui-form-item"> |
|||
<div class="layui-input-block"> |
|||
<button class="layui-btn" lay-submit lay-filter="formStep"> |
|||
 创建  |
|||
</button> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
</div> |
|||
<hr> |
|||
</div> |
|||
</div> |
|||
</fieldset> |
|||
|
|||
</div> |
|||
</div> |
|||
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script> |
|||
<script> |
|||
var data; |
|||
// 用于标志是否为第一次提交 |
|||
let flagForForm = false; |
|||
layui.use(['form', 'layer'], function () { |
|||
var $ = layui.jquery, |
|||
form = layui.form, |
|||
layer = layui.layer; |
|||
form.on('submit(formStep)', function (data) { |
|||
if (!flagForForm) { |
|||
flagForForm = true; |
|||
$.ajax({ |
|||
url: "/businessType/addBusinessType", |
|||
type: 'post', |
|||
dataType: 'json', |
|||
contentType: "application/json;charset=utf-8", |
|||
data: JSON.stringify(data.field), |
|||
beforeSend: function () { |
|||
this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']}); |
|||
}, |
|||
success: function (data) { |
|||
layer.close(this.layerIndex); |
|||
if (data.status >= 300) { |
|||
layer.msg(data.statusInfo.message);//失败的表情 |
|||
return; |
|||
} else { |
|||
layer.msg("添加成功!", { |
|||
icon: 6,//成功的表情 |
|||
time: 1000 //1秒关闭(如果不配置,默认是3秒) |
|||
}, function () { |
|||
window.location = "/businessTypeAdd" |
|||
}); |
|||
|
|||
} |
|||
}, |
|||
complete: function () { |
|||
form.val("form1", { |
|||
"typeName": "",// "name": "value" |
|||
"typeDescription": "", |
|||
"recordTypeName": "", |
|||
"recordTypeDescription": "" |
|||
}) |
|||
} |
|||
}); |
|||
} |
|||
return false; |
|||
}); |
|||
|
|||
}); |
|||
</script> |
|||
|
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,125 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" xmlns:th="http://www.thymeleaf.org"> |
|||
<head> |
|||
<meta charset="utf-8"> |
|||
<title>layui</title> |
|||
<meta name="renderer" content="webkit"> |
|||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> |
|||
<link rel="stylesheet" href="/static/lib/layui-v2.6.3/css/layui.css" media="all"> |
|||
<link rel="stylesheet" href="/static/css/public.css" media="all"> |
|||
<link rel="stylesheet" href="/static/lib/font-awesome-4.7.0/css/font-awesome.min.css" media="all"> |
|||
</head> |
|||
<body> |
|||
<div class="layuimini-container"> |
|||
<div class="layuimini-main"> |
|||
|
|||
|
|||
<fieldset class="table-search-fieldset"> |
|||
<legend>业务类型编辑</legend> |
|||
<div class="layui-fluid"> |
|||
<div class="layui-card"> |
|||
<div class="layui-card-body" style="padding-top: 40px;"> |
|||
<div> |
|||
<form class="layui-form layui-form-pane" |
|||
style="margin: 0 auto;max-width: 700px;padding-top: 100px; padding-bottom: 200px" |
|||
lay-filter="form1"> |
|||
<input th:value="${record.getId()}" name="id" id="id" style="display:none;"/> |
|||
<div class="layui-form-item"> |
|||
<label class="layui-form-label" style="width: 130px">业务类型名称:</label> |
|||
<div class="layui-input-block" style="margin-left: 130px;"> |
|||
<input type="text" placeholder="请填写业务类型名称" class="layui-input" |
|||
th:value="${record.getTypeName()}" |
|||
name="typeName" lay-verify="required"/> |
|||
</div> |
|||
</div> |
|||
<div class="layui-form-item"> |
|||
<label class="layui-form-label" style="width: 130px">业务类型描述:</label> |
|||
<div class="layui-input-block" style="margin-left: 130px;"> |
|||
<input type="text" placeholder="业务类型描述" class="layui-input" th:value="${record.getTypeDescription()}" |
|||
name="typeDescription"/> |
|||
</div> |
|||
</div> |
|||
<div class="layui-form-item"> |
|||
<label class="layui-form-label" style="width: 130px">单据类型名称:</label> |
|||
<div class="layui-input-block" style="margin-left: 130px;"> |
|||
<input name="recordTypeName" placeholder="单据类型名称..." th:value="${record.getRecordTypeName()}" |
|||
class="layui-input"/> |
|||
</div> |
|||
</div> |
|||
<div class="layui-form-item"> |
|||
<label class="layui-form-label" style="width: 130px">单据类型描述:</label> |
|||
<div class="layui-input-block" style="margin-left: 130px;"> |
|||
<input name="recordTypeDescription" placeholder="单据类型描述..." th:value="${record.getRecordTypeDescription()}" |
|||
class="layui-input"/> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div class="layui-form-item"> |
|||
<div class="layui-input-block"> |
|||
<button class="layui-btn" lay-submit lay-filter="formStep"> |
|||
 修改  |
|||
</button> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
</div> |
|||
<hr> |
|||
</div> |
|||
</div> |
|||
</fieldset> |
|||
|
|||
</div> |
|||
</div> |
|||
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script> |
|||
<script> |
|||
var data; |
|||
// 用于标志是否为第一次提交 |
|||
let flagForForm = false; |
|||
layui.use(['form', 'layer'], function () { |
|||
var $ = layui.jquery, |
|||
form = layui.form, |
|||
layer = layui.layer; |
|||
form.on('submit(formStep)', function (data) { |
|||
if(!flagForForm){ |
|||
flagForForm = true; |
|||
$.ajax({ |
|||
url: "/businessType/updateBusinessType", |
|||
type: 'post', |
|||
dataType: 'json', |
|||
contentType: "application/json;charset=utf-8", |
|||
data: JSON.stringify(data.field), |
|||
beforeSend: function () { |
|||
this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']}); |
|||
}, |
|||
success: function (data) { |
|||
layer.close(this.layerIndex); |
|||
if (data.status >= 300) { |
|||
layer.msg(data.statusInfo.message);//失败的表情 |
|||
return; |
|||
} else { |
|||
layer.msg("修改成功!", { |
|||
icon: 6,//成功的表情 |
|||
time: 1000 //1秒关闭(如果不配置,默认是3秒) |
|||
}, function () { |
|||
window.location = "/businessTypeEdit?id="+$("#id").val(); |
|||
}); |
|||
|
|||
} |
|||
} |
|||
}); |
|||
} |
|||
return false; |
|||
}); |
|||
|
|||
$('body').on('click', '[data-refresh]', function () { |
|||
location.reload(); |
|||
}) |
|||
|
|||
}); |
|||
</script> |
|||
|
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,354 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" xmlns:th="http://www.thymeleaf.org"> |
|||
<head> |
|||
<meta charset="utf-8"> |
|||
<title>layui</title> |
|||
<meta name="renderer" content="webkit"> |
|||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> |
|||
<link rel="stylesheet" href="/static/lib/layui-v2.6.3/css/layui.css" media="all"> |
|||
<link rel="stylesheet" href="/static/css/public.css" media="all"> |
|||
<link rel="stylesheet" href="/static/lib/font-awesome-4.7.0/css/font-awesome.min.css" media="all"> |
|||
</head> |
|||
<body> |
|||
<div class="layuimini-container"> |
|||
<div class="layuimini-main"> |
|||
|
|||
|
|||
<fieldset class="table-search-fieldset"> |
|||
<legend>搜索信息</legend> |
|||
<div style="margin: 10px 10px 10px 10px"> |
|||
<form class="layui-form layui-form-pane" action=""> |
|||
<div class="layui-form-item"> |
|||
<div class="layui-inline"> |
|||
<label class="layui-form-label">业务类型名称</label> |
|||
<div class="layui-input-block"> |
|||
<input type="text" placeholder="业务类型名称" class="layui-input" |
|||
name="typeName" /> |
|||
</div> |
|||
</div> |
|||
<div class="layui-inline"> |
|||
<label class="layui-form-label">状态</label> |
|||
<div class="layui-input-block"> |
|||
<select name="state"> |
|||
<option value="">请选择状态</option> |
|||
<option value="1">启用</option> |
|||
<option value="2">禁用</option> |
|||
</select> |
|||
</div> |
|||
</div> |
|||
<div class="layui-inline"> |
|||
<button type="submit" class="layui-btn layui-btn-primary" lay-submit |
|||
lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索 |
|||
</button> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
</fieldset> |
|||
|
|||
|
|||
<!-- 状态展示--> |
|||
<script type="text/html" id="switchTpl"> |
|||
<input type="checkbox" name="state" value="{{d.id}}" lay-skin="switch" lay-text="启用|禁用" |
|||
lay-filter="changeState" {{ d.state== 1 ? 'checked' : '' }} > |
|||
</script> |
|||
|
|||
<script id="CNName" type="text/html"> |
|||
<a id="{{d.id}}" onclick="showDetail(this)">{{d.typeName}}</a> |
|||
</script> |
|||
|
|||
<script type="text/html" id="toolbarDemo"> |
|||
<div class="layui-btn-container"> |
|||
<button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn" lay-event="add"> 添加 |
|||
</button> |
|||
<button class="layui-btn layui-btn-sm layui-btn-danger data-delete-btn" lay-event="delete"> 删除 |
|||
</button> |
|||
|
|||
</div> |
|||
</script> |
|||
|
|||
<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table> |
|||
|
|||
<script type="text/html" id="currentTableBar"> |
|||
<a class="layui-btn layui-btn-xs data-count-edit" lay-event="detail">详情</a> |
|||
<a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">删除</a> |
|||
</script> |
|||
|
|||
</div> |
|||
</div> |
|||
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script> |
|||
<script> |
|||
function showDetail() { |
|||
|
|||
} |
|||
|
|||
layui.use(['form', 'table', 'upload'], function () { |
|||
var $ = layui.jquery, |
|||
form = layui.form, |
|||
upload = layui.upload, |
|||
table = layui.table; |
|||
table.render({ |
|||
elem: "#currentTableId", |
|||
url: '/businessType/findBusinessType', |
|||
parseData: function (res) { //res 即为原始返回的数据 |
|||
return { |
|||
"status": res.status, //解析接口状态 |
|||
"message": res.statusInfo.message, //解析提示文本 |
|||
"count": res.count, //解析数据长度 |
|||
"data": res.data //解析数据列表 |
|||
}; |
|||
}, |
|||
height: 'full-255',//固定高度-即固定表头固定第一行首行 |
|||
request: { |
|||
pageName: 'page', //页码的参数名称,默认:page |
|||
limitName: 'size' //每页数据量的参数名,默认:limit |
|||
}, |
|||
response: { |
|||
statusName: 'status' //规定数据状态的字段名称,默认:code |
|||
, statusCode: 200 //规定成功的状态码,默认:0 |
|||
, msgName: 'message' //规定状态信息的字段名称,默认:msg |
|||
, countName: 'count' //规定数据总数的字段名称,默认:count |
|||
, dataName: 'data' //规定数据列表的字段名称,默认:data |
|||
}, |
|||
toolbar: '#toolbarDemo', |
|||
defaultToolbar: ['filter', 'exports', 'print'], |
|||
cols: [ |
|||
[ |
|||
{type: "checkbox", width: 50}, |
|||
{title: '业务类型名称', width: 120, templet: '#CNName', align: "center"}, |
|||
{field: 'typeDescription', width: 200, title: '业务类型描述'}, |
|||
{field: 'recordTypeName', width: 200, title: '单据类型名称'}, |
|||
{field: 'recordTypeDescription', width: 200, title: '单据类型描述'}, |
|||
{title: '状态', width: 100, templet: '#switchTpl', align: "center"}, |
|||
{title: '操作', minWidth: 200, toolbar: '#currentTableBar', align: "center"} |
|||
] |
|||
], |
|||
limits: [10, 15, 20, 25, 50, 100], |
|||
limit: 10, |
|||
page: true, |
|||
skin: 'line' |
|||
}); |
|||
|
|||
// 监听搜索操作 |
|||
form.on('submit(data-search-btn)', function (data) { |
|||
var req = {}; |
|||
data = data.field; |
|||
if (data.typeName !== '') { |
|||
req.typeName = data.typeName; |
|||
} |
|||
if (data.state !== '') { |
|||
req.state = data.state; |
|||
} |
|||
//执行搜索重载 |
|||
table.reload('currentTableId', { |
|||
url: '/businessType/findBusinessType', |
|||
page: { |
|||
curr: 1 |
|||
}, |
|||
where: req |
|||
}, 'data'); |
|||
return false; |
|||
}); |
|||
|
|||
/** |
|||
* toolbar监听事件 |
|||
*/ |
|||
table.on('toolbar(currentTableFilter)', function (obj) { |
|||
if (obj.event === 'add') { // 监听添加操作 |
|||
var index = layer.open({ |
|||
title: '创建业务类型', |
|||
type: 2, |
|||
shade: 0.2, |
|||
maxmin: true, |
|||
shadeClose: true, |
|||
area: ['100%', '100%'], |
|||
content: '/businessTypeAdd', |
|||
}); |
|||
$(window).on("resize", function () { |
|||
layer.full(index); |
|||
}); |
|||
} else if (obj.event === 'delete') { // 监听删除操作 |
|||
var checkStatus = table.checkStatus('currentTableId') |
|||
, data = checkStatus.data; |
|||
var req = {}; |
|||
req.ids = []; |
|||
for (i = 0, len = data.length; i < len; i++) { |
|||
req.ids[i] = data[i].id; |
|||
} |
|||
if (req.ids.length > 0) { |
|||
layer.confirm('真的删除么', {icon: 2, title: '提示'}, function (index) { |
|||
$.ajax({ |
|||
url: '/businessType/deleteBusinessType', |
|||
dataType: 'json', |
|||
type: 'POST', |
|||
contentType: "application/json;charset=utf-8", |
|||
data: JSON.stringify(req), |
|||
beforeSend: function () { |
|||
this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']}); |
|||
}, |
|||
success: function (data) { |
|||
layer.close(this.layerIndex); |
|||
if (data.status >= 300) { |
|||
layer.msg(data.statusInfo.message);//失败的表情 |
|||
|
|||
} else { |
|||
layer.msg("删除成功", { |
|||
icon: 6,//成功的表情 |
|||
time: 500 //1秒关闭(如果不配置,默认是3秒) |
|||
}); |
|||
//执行搜索重载 |
|||
table.reload('currentTableId', { |
|||
url: '/businessType/findBusinessType', |
|||
page: { |
|||
curr: 1 |
|||
} |
|||
}, 'data'); |
|||
return false; |
|||
} |
|||
} |
|||
}) |
|||
}) |
|||
} else { |
|||
layer.msg("未选中记录,请确认!"); |
|||
return false; |
|||
} |
|||
} |
|||
}); |
|||
|
|||
|
|||
table.on('tool(currentTableFilter)', function (obj) { |
|||
let data = obj.data; |
|||
if (obj.event === 'detail') { |
|||
let req = {}; |
|||
var index = layer.open({ |
|||
title: '业务类型详情', |
|||
type: 2, |
|||
shade: 0.2, |
|||
maxmin: true, |
|||
shadeClose: true, |
|||
area: ['100%', '100%'], |
|||
content: '/businessTypeEdit?id=' + data.id, |
|||
end: function () { |
|||
//执行搜索重载 |
|||
table.reload('currentTableId', { |
|||
url: '/businessType/findBusinessType', |
|||
page: { |
|||
curr: 1 |
|||
}, |
|||
where: req |
|||
}, 'data'); |
|||
} |
|||
}); |
|||
$(window).on("resize", function () { |
|||
layer.full(index); |
|||
}); |
|||
return false; |
|||
} |
|||
else if (obj.event === 'delete') { |
|||
|
|||
layer.confirm('真的删除么', {icon: 2, title: '提示'}, function (index) { |
|||
$.ajax({ |
|||
url: '/businessType/deleteBusinessType', |
|||
dataType: 'json', |
|||
type: 'POST', |
|||
contentType: "application/json;charset=utf-8", |
|||
data: JSON.stringify(data), |
|||
beforeSend: function () { |
|||
this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']}); |
|||
}, |
|||
success: function (data) { |
|||
layer.close(this.layerIndex); |
|||
if (data.status >= 300) { |
|||
layer.msg(data.statusInfo.message);//失败的表情 |
|||
|
|||
} else { |
|||
obj.del(); |
|||
layer.msg("删除成功", { |
|||
icon: 6,//成功的表情 |
|||
time: 500 //1秒关闭(如果不配置,默认是3秒) |
|||
}); |
|||
} |
|||
} |
|||
}) |
|||
}); |
|||
} |
|||
}); |
|||
|
|||
// 用于查看详情 |
|||
showDetail = function (obj) { |
|||
let req = {}; |
|||
layer.open({ |
|||
title: '业务类型详情', |
|||
type: 2, |
|||
shade: 0.2, |
|||
maxmin: true, |
|||
shadeClose: true, |
|||
area: ['100%', '100%'], |
|||
content: '/businessTypeEdit?id=' + obj.id, |
|||
end: function () { |
|||
//执行搜索重载 |
|||
table.reload('currentTableId', { |
|||
url: '/businessType/findBusinessType', |
|||
page: { |
|||
curr: 1 |
|||
}, |
|||
where: req |
|||
}, 'data'); |
|||
} |
|||
}); |
|||
}; |
|||
//监听状态操作 |
|||
form.on('switch(changeState)', function (obj) { |
|||
var req = new Map; |
|||
if (obj.elem.checked) { |
|||
req["state"] = 1; |
|||
} |
|||
req["id"] = this.value; |
|||
// 如果启用 |
|||
$.ajax({ |
|||
url: "/businessType/forbiddenBusinessType", |
|||
type: 'post', |
|||
dataType: 'json', |
|||
contentType: "application/json;charset=utf-8", |
|||
data: JSON.stringify(req), |
|||
beforeSend: function () { |
|||
this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']}); |
|||
}, |
|||
success: function (data) { |
|||
layer.close(this.layerIndex); |
|||
if (data.status >= 300) { |
|||
layer.msg(data.statusInfo.message);//失败的表情 |
|||
|
|||
} else { |
|||
layer.msg("修改成功", { |
|||
icon: 6,//成功的表情 |
|||
time: 500 //1秒关闭(如果不配置,默认是3秒) |
|||
}, function () { |
|||
// 执行表格重加载 |
|||
table.reload('currentTableId', { |
|||
url: '/businessType/findBusinessType', |
|||
page: { |
|||
curr: 1 |
|||
}, |
|||
}); |
|||
}) |
|||
} |
|||
} |
|||
}) |
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
$('body').on('click', '[data-refresh]', function () { |
|||
location.reload(); |
|||
}) |
|||
}); |
|||
|
|||
|
|||
|
|||
</script> |
|||
|
|||
</body> |
|||
</html> |
|||
Loading…
Reference in new issue