Commit 6e44b2a5 by huluobin

update

parent e6bfd788
package com.blt.other.other_cost.dao; package com.blt.other.other_cost.dao;
import com.blt.other.other_cost.dto.CostTypeKindDto;
import com.blt.other.other_database.model.CostTypeDomain;
import com.blt.other.other_database.model.CostTypeKindDomain; import com.blt.other.other_database.model.CostTypeKindDomain;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
...@@ -14,12 +13,14 @@ public interface CostTypeKindDao { ...@@ -14,12 +13,14 @@ public interface CostTypeKindDao {
/** /**
* 获取所有费用种类 * 获取所有费用种类
*
* @return * @return
*/ */
List<CostTypeKindDomain> selectAll(); List<CostTypeKindDomain> selectAll();
/** /**
* 根据 typeNo 获取费用种类 * 根据 typeNo 获取费用种类
*
* @param typeNo * @param typeNo
* @return * @return
*/ */
...@@ -27,6 +28,7 @@ public interface CostTypeKindDao { ...@@ -27,6 +28,7 @@ public interface CostTypeKindDao {
/** /**
* 根据 companyNo 获取费用种类 * 根据 companyNo 获取费用种类
*
* @param companyNo * @param companyNo
* @return * @return
*/ */
...@@ -34,6 +36,7 @@ public interface CostTypeKindDao { ...@@ -34,6 +36,7 @@ public interface CostTypeKindDao {
/** /**
* 根据 typeNo 和 kindName 获取费用种类,用于添加费用种类时判断是否已经存在相同的费用种类 * 根据 typeNo 和 kindName 获取费用种类,用于添加费用种类时判断是否已经存在相同的费用种类
*
* @param costTypeKindDomain * @param costTypeKindDomain
* @return * @return
*/ */
...@@ -41,6 +44,7 @@ public interface CostTypeKindDao { ...@@ -41,6 +44,7 @@ public interface CostTypeKindDao {
/** /**
* 根据 costTypeKindNo 获取种类信息 * 根据 costTypeKindNo 获取种类信息
*
* @param costTypeKindNo * @param costTypeKindNo
* @return * @return
*/ */
...@@ -48,14 +52,27 @@ public interface CostTypeKindDao { ...@@ -48,14 +52,27 @@ public interface CostTypeKindDao {
/** /**
* 根据费用小类名称和公司名称获取种类信息 * 根据费用小类名称和公司名称获取种类信息
*
* @param kindName * @param kindName
* @param companyName * @param companyName
* @return * @return
*/ */
@Deprecated
CostTypeKindDomain selectByKindNameAndCompanyName(String kindName, String companyName); CostTypeKindDomain selectByKindNameAndCompanyName(String kindName, String companyName);
/** /**
* <
*
* @param kindName
* @param companyNo
* @return
*/
CostTypeKindDomain selectByKindNameAndCompanyNo(@Param("kindName") String kindName, @Param("companyNo") String companyNo);
/**
* 新增费用种类记录 * 新增费用种类记录
*
* @param ctkd * @param ctkd
* @return * @return
*/ */
...@@ -66,4 +83,5 @@ public interface CostTypeKindDao { ...@@ -66,4 +83,5 @@ public interface CostTypeKindDao {
Integer update(CostTypeKindDomain costTypeKindDomain); Integer update(CostTypeKindDomain costTypeKindDomain);
Integer delete(String kindNo); Integer delete(String kindNo);
} }
...@@ -63,6 +63,9 @@ public class CostApiServiceImpl implements CostApiService { ...@@ -63,6 +63,9 @@ public class CostApiServiceImpl implements CostApiService {
@Autowired @Autowired
CostLogDao costLogDao; CostLogDao costLogDao;
@Autowired
CostCompanyDao costCompanyDao;
@Override @Override
@Transactional @Transactional
public String generateLogisticsCost(int costForm, LogisticsCostDto logisticsCostDto) throws Exception { public String generateLogisticsCost(int costForm, LogisticsCostDto logisticsCostDto) throws Exception {
...@@ -281,7 +284,9 @@ public class CostApiServiceImpl implements CostApiService { ...@@ -281,7 +284,9 @@ public class CostApiServiceImpl implements CostApiService {
sqlParam.setKindName("工资"); sqlParam.setKindName("工资");
sqlParam.setCompanyName(wageCostDto.getCompanyName()); sqlParam.setCompanyName(wageCostDto.getCompanyName());
CostTypeKindDomain costTypeKindDomain = costTypeKindDao.selectByKindNameAndCompanyName("工资", wageCostDto.getCompanyName()); CostCompanyDomain costCompany = costCompanyDao.selectByName(wageCostDto.getCompanyName());
CostTypeKindDomain costTypeKindDomain = costTypeKindDao.selectByKindNameAndCompanyNo("工资", costCompany.getCompanyNo());
if (costTypeKindDomain == null) { if (costTypeKindDomain == null) {
throw new RuntimeException(wageCostDto + "在费用系统不存在费用单小类:工资"); throw new RuntimeException(wageCostDto + "在费用系统不存在费用单小类:工资");
} }
......
...@@ -3,85 +3,68 @@ ...@@ -3,85 +3,68 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" > "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.blt.other.other_cost.dao.CostTypeKindDao"> <mapper namespace="com.blt.other.other_cost.dao.CostTypeKindDao">
<select id="selectAll" resultType="com.blt.other.other_database.model.CostTypeKindDomain"> <select id="selectAll" resultType="com.blt.other.other_database.model.CostTypeKindDomain">
SELECT SELECT *
* FROM cost_type_kind
FROM ORDER BY id desc
cost_type_kind
ORDER BY
id desc
</select> </select>
<select id="selectByTypeNo" resultType="com.blt.other.other_database.model.CostTypeKindDomain"> <select id="selectByTypeNo" resultType="com.blt.other.other_database.model.CostTypeKindDomain">
SELECT SELECT *
* FROM cost_type_kind
FROM WHERE type_no = #{typeNo}
cost_type_kind
WHERE
type_no = #{typeNo}
</select> </select>
<select id="selectByCompanyNo" resultType="com.blt.other.other_database.model.CostTypeKindDomain"> <select id="selectByCompanyNo" resultType="com.blt.other.other_database.model.CostTypeKindDomain">
SELECT SELECT *
* FROM cost_type_kind
FROM WHERE company_no = #{companyNo}
cost_type_kind
WHERE
company_no = #{companyNo}
</select> </select>
<select id="selectByTypeNoAndKindName" resultType="com.blt.other.other_database.model.CostTypeKindDomain"> <select id="selectByTypeNoAndKindName" resultType="com.blt.other.other_database.model.CostTypeKindDomain">
SELECT SELECT *
* FROM cost_type_kind
FROM WHERE type_no = #{typeNo}
cost_type_kind AND kind_name = #{kindName}
WHERE
type_no = #{typeNo}
AND
kind_name = #{kindName}
</select> </select>
<select id="selectByKindNo" resultType="com.blt.other.other_database.model.CostTypeKindDomain"> <select id="selectByKindNo" resultType="com.blt.other.other_database.model.CostTypeKindDomain">
SELECT SELECT *
* FROM cost_type_kind
FROM WHERE kind_no = #{kindNo}
cost_type_kind
WHERE
kind_no = #{kindNo}
</select> </select>
<select id="selectByKindNameAndCompanyName" resultType="com.blt.other.other_database.model.CostTypeKindDomain"> <select id="selectByKindNameAndCompanyName" resultType="com.blt.other.other_database.model.CostTypeKindDomain">
SELECT SELECT *
* FROM cost_type_kind
FROM WHERE kind_name = #{kindName}
cost_type_kind AND company_name = #{companyName}
WHERE
kind_name = #{kindName}
AND
company_name = #{companyName}
</select> </select>
<insert id="insert" useGeneratedKeys="true" keyColumn="id" keyProperty="id"> <insert id="insert" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
INSERT INTO INSERT INTO cost_type_kind(kind_no, kind_name, type_no, type_name, company_no, company_name, cost_form,
cost_type_kind( subject_code, is_lend,
kind_no,kind_name,type_no,type_name,company_no,company_name,cost_form,subject_code,is_lend, create_username, create_usercode, cost_type_status)
create_username,create_usercode,cost_type_status
)
VALUE VALUE
( (
#{kindNo},#{kindName},#{typeNo},#{typeName},#{companyNo},#{companyName},#{costForm},#{subjectCode},#{isLend}, #{kindNo}, #{kindName}, #{typeNo}, #{typeName}, #{companyNo}, #{companyName}, #{costForm}, #{subjectCode},
#{createUsername},#{createUsercode},#{costTypeStatus} #{isLend},
#{createUsername}, #{createUsercode}, #{costTypeStatus}
) )
</insert> </insert>
<select id="selectByCompanyNoAndCostForm" resultType="com.blt.other.other_database.model.CostTypeKindDomain"> <select id="selectByCompanyNoAndCostForm" resultType="com.blt.other.other_database.model.CostTypeKindDomain">
SELECT SELECT *
* FROM cost_type_kind
FROM WHERE company_no = #{companyNo}
cost_type_kind AND cost_form = #{costForm}
WHERE </select>
company_no = #{companyNo}
AND <select id="selectByKindNameAndCompanyNo"
cost_form = #{costForm} resultType="com.blt.other.other_database.model.CostTypeKindDomain">
SELECT *
FROM cost_type_kind
WHERE kind_name = #{kindName}
AND company_no = #{companyNo}
</select> </select>
<update id="update" parameterType="com.blt.other.other_database.model.CostTypeKindDomain"> <update id="update" parameterType="com.blt.other.other_database.model.CostTypeKindDomain">
...@@ -105,9 +88,8 @@ ...@@ -105,9 +88,8 @@
</update> </update>
<delete id="delete"> <delete id="delete">
DELETE FROM DELETE
cost_type_kind FROM cost_type_kind
WHERE WHERE kind_no = #{kindNo}
kind_no = #{kindNo}
</delete> </delete>
</mapper> </mapper>
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